#include <cufft.h>
#include <iostream>
#include <fstream>
#define BSZ 32
using namespace std;
__global__ void solve_poisson(cufftComplex *ft, cufftComplex *ft_k, float*k, int N){
    int i = threadIdx.x + blockIdx.x*BSZ;
    int j = threadIdx.y + blockIdx.y*BSZ;
    int index = j*N+i;

    if (i<N && j<N)
    {
        float k2 = k[i] * k[i] + k[j]*k[j];
        if (i==0 && j == 0) {k2 = 1.0f;}                                 //a to jest takie w chuj ciekawe dlaczego oni to tak robią wtf
        ft_k[index].x = -ft[index].x/k2;
        ft_k[index].y = -ft[index].y/k2;
    }
}

__global__ void real2complex(float *f, cufftComplex *fc, int N){
    int i = threadIdx.x + blockIdx.x * blockDim.x;
    int j = threadIdx.y + blockIdx.y * blockDim.y;
    int index = j*N + i;
    if(i<N && j < N)
    {
        fc[index].x = f[index];                 //ustawia rzeczywista
        fc[index].y = 0.0f;                     //zeruje urojona
    }
}

__global__ void complex2real(cufftComplex *fc, float *f, int N){
    int i = threadIdx.x + blockIdx.x * BSZ;
    int j = threadIdx.y + blockIdx.y * BSZ;
    int index = j*N+i;

    if (i<N && j < N)
    {
        f[index] = fc[index].x/((float)N*(float)N);        //divide by number of elements to recover value
    }
}

void write_to_file(char* filename, float* f, int N){
    ofstream file;
    file.open(filename);
    for(int i = 0; i<N; i++)
        for (int j = 0; j<N; j++)
        {
            file << f[N*j+i];
            file << "\n";
        }
    file.close();
}

int main(){
    int N = 64;
    float xmax = 1.0f, xmin = 0.0f, ymin = 0.0f,
          h = (xmax-xmin)/((float)N), s = 0.1, s2 = s*s;
    float *x = new float[N*N], *y = new float[N*N], *u = new float[N*N],
          *f = new float[N*N], *u_a = new float[N*N], *err = new float[N*N];

    float r2;

    for (int j = 0; j<N; j++)
        for (int i=0; i<N; i++)
        {
            x[N*j + i] = xmin + i*h; //allocate position matrix
            y[N*j + i] = ymin + j*h;

            r2 = (x[N*j+i]-0.5)*(x[N*j+i]-0.5) + (y[N*j+i]-0.5)*(y[N*j+i]-0.5);
            f[N*j+i] = (r2-2*s2)/(s2*s2)*exp(-r2/(2*s2));
            u_a[N*j+i] = exp(-r2/(2*s2));
        }

    float *k = new float[N];
    for (int i = 0; i<=N/2; i++)
    {
        k[i] = i*2*M_PI;
    }
    for(int i = N/2+1; i<N; i++)
    {
        k[i] = (i-N)*2*M_PI;
    }


    //the cuda begins here
    //allocate arrays upon yon device
    float *k_d, *f_d, *u_d;
    cudaMalloc((void**)&k_d, sizeof(float)*N);
    cudaMalloc((void**)&f_d, sizeof(float)*N*N);
    cudaMalloc((void**)&u_d, sizeof(float)*N*N);

    cudaMemcpy(k_d, k, sizeof(float)*N, cudaMemcpyHostToDevice);
    cudaMemcpy(f_d, f, sizeof(float)*N*N, cudaMemcpyHostToDevice);

    cufftComplex *ft_d, *f_dc, *ft_d_k, *u_dc;
    cudaMalloc ((void**)&ft_d, sizeof(cufftComplex)*N*N);
    cudaMalloc ((void**)&ft_d_k, sizeof(cufftComplex)*N*N);
    cudaMalloc ((void**)&f_dc, sizeof(cufftComplex)*N*N);
    cudaMalloc ((void**)&u_dc, sizeof(cufftComplex)*N*N);

    cout << "N-0.5)/BSZ: " << int((N-0.5)/BSZ) + 1 << endl;
    dim3 dimGrid(int((N-0.5)/BSZ) + 1, int((N-0.5)/BSZ) + 1);
    dim3 dimBlock(BSZ, BSZ);

    real2complex<<<dimGrid, dimBlock>>>(f_d, f_dc, N);

    cufftHandle plan;
    cufftPlan2d(&plan, N, N, CUFFT_C2C);
    cufftExecC2C(plan, f_dc, ft_d, CUFFT_FORWARD);

    solve_poisson<<<dimGrid, dimBlock>>>(ft_d, ft_d_k, k_d, N);
    cufftExecC2C(plan, ft_d_k, u_dc, CUFFT_INVERSE);
    complex2real<<<dimGrid, dimBlock>>>(u_dc, u_d, N);
    cudaMemcpy(u, u_d, sizeof(float)*N*N, cudaMemcpyDeviceToHost);


    cufftDestroy(plan);
    cudaFree(k_d);
    cudaFree(f_d);
    cudaFree(u_d);

    float constant = u[0];
    for (int i =0; i<N*N; i++)
    {
        // cout << u[i] << endl;
        u[i] -= constant; //subtract u[0] to force arbitrary constant to be 0
    }

    write_to_file("x.dat", x, N);
    write_to_file("y.dat", y, N);
    write_to_file("u.dat", u, N);
    write_to_file("u_a.dat", u_a, N);
    write_to_file("f.dat", f, N);
}

	.file	"tmpxft_0035409b_00000000-6_cufft.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3793:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3793:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi
	.type	_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi, @function
_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi:
.LFB3815:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z13solve_poissonP6float2S0_Pfi(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3815:
	.size	_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi, .-_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi
	.globl	_Z13solve_poissonP6float2S0_Pfi
	.type	_Z13solve_poissonP6float2S0_Pfi, @function
_Z13solve_poissonP6float2S0_Pfi:
.LFB3816:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi
	.cfi_endproc
.LFE3816:
	.size	_Z13solve_poissonP6float2S0_Pfi, .-_Z13solve_poissonP6float2S0_Pfi
	.globl	_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i
	.type	_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i, @function
_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i:
.LFB3817:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z12real2complexPfP6float2i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L8:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3817:
	.size	_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i, .-_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i
	.globl	_Z12real2complexPfP6float2i
	.type	_Z12real2complexPfP6float2i, @function
_Z12real2complexPfP6float2i:
.LFB3818:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i
	.cfi_endproc
.LFE3818:
	.size	_Z12real2complexPfP6float2i, .-_Z12real2complexPfP6float2i
	.globl	_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi
	.type	_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi, @function
_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi:
.LFB3819:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z12complex2realP6float2Pfi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L13:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3819:
	.size	_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi, .-_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi
	.globl	_Z12complex2realP6float2Pfi
	.type	_Z12complex2realP6float2Pfi, @function
_Z12complex2realP6float2Pfi:
.LFB3820:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi
	.cfi_endproc
.LFE3820:
	.size	_Z12complex2realP6float2Pfi, .-_Z12complex2realP6float2Pfi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z12complex2realP6float2Pfi"
.LC1:
	.string	"_Z12real2complexPfP6float2i"
.LC2:
	.string	"_Z13solve_poissonP6float2S0_Pfi"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3822:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z12complex2realP6float2Pfi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12real2complexPfP6float2i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13solve_poissonP6float2S0_Pfi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3822:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC3:
	.string	"\n"
	.text
	.globl	_Z13write_to_filePcPfi
	.type	_Z13write_to_filePcPfi, @function
_Z13write_to_filePcPfi:
.LFB3789:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3789
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movl	%edx, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
.LEHB0:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	(%rsp), %rdi
	movl	$16, %edx
	movq	%rbx, %rsi
.LEHB1:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movslq	12(%rsp), %r14
	xorl	%ebx, %ebx
	leaq	0(,%r14,4), %r15
.L21:
	cmpl	%ebx, 12(%rsp)
	jle	.L31
	leaq	0(%rbp,%rbx,4), %r13
	xorl	%r12d, %r12d
.L22:
	movq	(%rsp), %rdi
	cvtss2sd	0(%r13), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	(%rsp), %rdi
	leaq	.LC3(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%r12
	addq	%r15, %r13
	cmpq	%r12, %r14
	jne	.L22
	incq	%rbx
	jmp	.L21
.L31:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE1:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	jmp	.L29
.L27:
	endbr64
	movq	%rax, %rbx
.L24:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L29:
	call	__stack_chk_fail@PLT
.L26:
	addq	$552, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3789:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3789:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3789-.LLSDACSB3789
.LLSDACSB3789:
	.uleb128 .LEHB0-.LFB3789
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3789
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L27-.LFB3789
	.uleb128 0
	.uleb128 .LEHB2-.LFB3789
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3789:
	.text
	.size	_Z13write_to_filePcPfi, .-_Z13write_to_filePcPfi
	.section	.rodata.str1.1
.LC11:
	.string	"N-0.5)/BSZ: "
.LC12:
	.string	"x.dat"
.LC13:
	.string	"y.dat"
.LC14:
	.string	"u.dat"
.LC15:
	.string	"u_a.dat"
.LC16:
	.string	"f.dat"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3790:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$16384, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	call	_Znam@PLT
	movl	$16384, %edi
	movq	%rax, %r14
	call	_Znam@PLT
	movl	$16384, %edi
	movq	%rax, %r13
	call	_Znam@PLT
	movl	$16384, %edi
	movq	%rax, %rbx
	call	_Znam@PLT
	movl	$16384, %edi
	movq	%rax, %rbp
	call	_Znam@PLT
	movq	%rax, %r12
	xorl	%eax, %eax
.L33:
	cvtsi2ssl	%eax, %xmm2
	xorps	%xmm0, %xmm0
	movq	%rax, %r15
	xorl	%edx, %edx
	mulss	.LC4(%rip), %xmm2
	salq	$8, %r15
	addss	%xmm0, %xmm2
	cvtss2sd	%xmm2, %xmm0
	subsd	.LC6(%rip), %xmm0
	mulsd	%xmm0, %xmm0
	movsd	%xmm0, (%rsp)
.L34:
	cvtsi2ssl	%edx, %xmm0
	mulss	.LC4(%rip), %xmm0
	xorps	%xmm1, %xmm1
	movss	%xmm2, 0(%r13,%r15)
	movq	%rax, 24(%rsp)
	movl	%edx, 20(%rsp)
	movss	%xmm2, 16(%rsp)
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r14,%r15)
	cvtss2sd	%xmm0, %xmm0
	subsd	.LC6(%rip), %xmm0
	mulsd	%xmm0, %xmm0
	addsd	(%rsp), %xmm0
	cvtsd2ss	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	movss	%xmm1, 12(%rsp)
	xorps	.LC7(%rip), %xmm0
	divss	.LC8(%rip), %xmm0
	movss	%xmm0, 8(%rsp)
	call	expf@PLT
	movss	12(%rsp), %xmm1
	subss	.LC8(%rip), %xmm1
	divss	.LC9(%rip), %xmm1
	mulss	%xmm0, %xmm1
	movss	8(%rsp), %xmm0
	movss	%xmm1, 0(%rbp,%r15)
	call	expf@PLT
	movl	20(%rsp), %edx
	movss	16(%rsp), %xmm2
	movss	%xmm0, (%r12,%r15)
	addq	$4, %r15
	movq	24(%rsp), %rax
	incl	%edx
	cmpl	$64, %edx
	jne	.L34
	incq	%rax
	cmpq	$64, %rax
	jne	.L33
	movl	$256, %edi
	call	_Znam@PLT
	movsd	.LC10(%rip), %xmm1
	movq	%rax, %r15
	xorl	%eax, %eax
.L36:
	leal	(%rax,%rax), %edx
	cvtsi2sdl	%edx, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r15,%rax,4)
	incq	%rax
	cmpq	$33, %rax
	jne	.L36
.L37:
	leal	-128(%rax,%rax), %edx
	cvtsi2sdl	%edx, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r15,%rax,4)
	incq	%rax
	cmpq	$64, %rax
	jne	.L37
	leaq	40(%rsp), %rdi
	movl	$256, %esi
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	movl	$16384, %esi
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movl	$16384, %esi
	call	cudaMalloc@PLT
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movq	%r15, %rsi
	movl	$256, %edx
	call	cudaMemcpy@PLT
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$16384, %edx
	call	cudaMemcpy@PLT
	leaq	64(%rsp), %rdi
	movl	$32768, %esi
	call	cudaMalloc@PLT
	leaq	80(%rsp), %rdi
	movl	$32768, %esi
	call	cudaMalloc@PLT
	leaq	72(%rsp), %rdi
	movl	$32768, %esi
	call	cudaMalloc@PLT
	leaq	88(%rsp), %rdi
	movl	$32768, %esi
	call	cudaMalloc@PLT
	leaq	.LC11(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$2, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$8589934594, %rdi
	movl	$1, %esi
	movabsq	$137438953504, %rdx
	movl	$1, 104(%rsp)
	movq	%rdi, 96(%rsp)
	movq	%rdx, 108(%rsp)
	movl	$1, 116(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	movq	72(%rsp), %rsi
	movq	48(%rsp), %rdi
	movl	$64, %edx
	call	_Z41__device_stub__Z12real2complexPfP6float2iPfP6float2i
.L38:
	leaq	36(%rsp), %rdi
	movl	$41, %ecx
	movl	$64, %edx
	movl	$64, %esi
	call	cufftPlan2d@PLT
	movq	64(%rsp), %rdx
	movq	72(%rsp), %rsi
	orl	$-1, %ecx
	movl	36(%rsp), %edi
	call	cufftExecC2C@PLT
	movl	116(%rsp), %ecx
	movl	104(%rsp), %esi
	xorl	%r9d, %r9d
	movq	108(%rsp), %rdx
	movq	96(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	40(%rsp), %rdx
	movq	80(%rsp), %rsi
	movl	$64, %ecx
	movq	64(%rsp), %rdi
	call	_Z45__device_stub__Z13solve_poissonP6float2S0_PfiP6float2S0_Pfi
.L39:
	movq	88(%rsp), %rdx
	movq	80(%rsp), %rsi
	movl	$1, %ecx
	movl	36(%rsp), %edi
	call	cufftExecC2C@PLT
	movl	116(%rsp), %ecx
	movl	104(%rsp), %esi
	xorl	%r9d, %r9d
	movq	108(%rsp), %rdx
	movq	96(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L40
	movq	56(%rsp), %rsi
	movq	88(%rsp), %rdi
	movl	$64, %edx
	call	_Z41__device_stub__Z12complex2realP6float2PfiP6float2Pfi
.L40:
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movl	$16384, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	36(%rsp), %edi
	call	cufftDestroy@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movss	(%rbx), %xmm1
	xorl	%eax, %eax
.L41:
	movss	(%rbx,%rax,4), %xmm0
	subss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$4096, %rax
	jne	.L41
	movl	$64, %edx
	movq	%r14, %rsi
	leaq	.LC12(%rip), %rdi
	call	_Z13write_to_filePcPfi
	movl	$64, %edx
	movq	%r13, %rsi
	leaq	.LC13(%rip), %rdi
	call	_Z13write_to_filePcPfi
	movl	$64, %edx
	movq	%rbx, %rsi
	leaq	.LC14(%rip), %rdi
	call	_Z13write_to_filePcPfi
	movl	$64, %edx
	movq	%r12, %rsi
	leaq	.LC15(%rip), %rdi
	call	_Z13write_to_filePcPfi
	movl	$64, %edx
	movq	%rbp, %rsi
	leaq	.LC16(%rip), %rdi
	call	_Z13write_to_filePcPfi
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3790:
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC4:
	.long	1015021568
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	0
	.long	1071644672
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC7:
	.long	-2147483648
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst4
	.align 4
.LC8:
	.long	1017370379
	.align 4
.LC9:
	.long	953267993
	.section	.rodata.cst8
	.align 8
.LC10:
	.long	1413754136
	.long	1074340347
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <hipfft/hipfft.h>
#include <iostream>
#include <fstream>
#define BSZ 32
using namespace std;
__global__ void solve_poisson(hipfftComplex *ft, hipfftComplex *ft_k, float*k, int N){
    int i = threadIdx.x + blockIdx.x*BSZ;
    int j = threadIdx.y + blockIdx.y*BSZ;
    int index = j*N+i;

    if (i<N && j<N)
    {
        float k2 = k[i] * k[i] + k[j]*k[j];
        if (i==0 && j == 0) {k2 = 1.0f;}                                 //a to jest takie w chuj ciekawe dlaczego oni to tak robią wtf
        ft_k[index].x = -ft[index].x/k2;
        ft_k[index].y = -ft[index].y/k2;
    }
}

__global__ void real2complex(float *f, hipfftComplex *fc, int N){
    int i = threadIdx.x + blockIdx.x * blockDim.x;
    int j = threadIdx.y + blockIdx.y * blockDim.y;
    int index = j*N + i;
    if(i<N && j < N)
    {
        fc[index].x = f[index];                 //ustawia rzeczywista
        fc[index].y = 0.0f;                     //zeruje urojona
    }
}

__global__ void complex2real(hipfftComplex *fc, float *f, int N){
    int i = threadIdx.x + blockIdx.x * BSZ;
    int j = threadIdx.y + blockIdx.y * BSZ;
    int index = j*N+i;

    if (i<N && j < N)
    {
        f[index] = fc[index].x/((float)N*(float)N);        //divide by number of elements to recover value
    }
}

void write_to_file(char* filename, float* f, int N){
    ofstream file;
    file.open(filename);
    for(int i = 0; i<N; i++)
        for (int j = 0; j<N; j++)
        {
            file << f[N*j+i];
            file << "\n";
        }
    file.close();
}

int main(){
    int N = 64;
    float xmax = 1.0f, xmin = 0.0f, ymin = 0.0f,
          h = (xmax-xmin)/((float)N), s = 0.1, s2 = s*s;
    float *x = new float[N*N], *y = new float[N*N], *u = new float[N*N],
          *f = new float[N*N], *u_a = new float[N*N], *err = new float[N*N];

    float r2;

    for (int j = 0; j<N; j++)
        for (int i=0; i<N; i++)
        {
            x[N*j + i] = xmin + i*h; //allocate position matrix
            y[N*j + i] = ymin + j*h;

            r2 = (x[N*j+i]-0.5)*(x[N*j+i]-0.5) + (y[N*j+i]-0.5)*(y[N*j+i]-0.5);
            f[N*j+i] = (r2-2*s2)/(s2*s2)*exp(-r2/(2*s2));
            u_a[N*j+i] = exp(-r2/(2*s2));
        }

    float *k = new float[N];
    for (int i = 0; i<=N/2; i++)
    {
        k[i] = i*2*M_PI;
    }
    for(int i = N/2+1; i<N; i++)
    {
        k[i] = (i-N)*2*M_PI;
    }


    //the cuda begins here
    //allocate arrays upon yon device
    float *k_d, *f_d, *u_d;
    hipMalloc((void**)&k_d, sizeof(float)*N);
    hipMalloc((void**)&f_d, sizeof(float)*N*N);
    hipMalloc((void**)&u_d, sizeof(float)*N*N);

    hipMemcpy(k_d, k, sizeof(float)*N, hipMemcpyHostToDevice);
    hipMemcpy(f_d, f, sizeof(float)*N*N, hipMemcpyHostToDevice);

    hipfftComplex *ft_d, *f_dc, *ft_d_k, *u_dc;
    hipMalloc ((void**)&ft_d, sizeof(hipfftComplex)*N*N);
    hipMalloc ((void**)&ft_d_k, sizeof(hipfftComplex)*N*N);
    hipMalloc ((void**)&f_dc, sizeof(hipfftComplex)*N*N);
    hipMalloc ((void**)&u_dc, sizeof(hipfftComplex)*N*N);

    cout << "N-0.5)/BSZ: " << int((N-0.5)/BSZ) + 1 << endl;
    dim3 dimGrid(int((N-0.5)/BSZ) + 1, int((N-0.5)/BSZ) + 1);
    dim3 dimBlock(BSZ, BSZ);

    real2complex<<<dimGrid, dimBlock>>>(f_d, f_dc, N);

    hipfftHandle plan;
    hipfftPlan2d(&plan, N, N, HIPFFT_C2C);
    hipfftExecC2C(plan, f_dc, ft_d, HIPFFT_FORWARD);

    solve_poisson<<<dimGrid, dimBlock>>>(ft_d, ft_d_k, k_d, N);
    hipfftExecC2C(plan, ft_d_k, u_dc, HIPFFT_BACKWARD);
    complex2real<<<dimGrid, dimBlock>>>(u_dc, u_d, N);
    hipMemcpy(u, u_d, sizeof(float)*N*N, hipMemcpyDeviceToHost);


    hipfftDestroy(plan);
    hipFree(k_d);
    hipFree(f_d);
    hipFree(u_d);

    float constant = u[0];
    for (int i =0; i<N*N; i++)
    {
        // cout << u[i] << endl;
        u[i] -= constant; //subtract u[0] to force arbitrary constant to be 0
    }

    write_to_file("x.dat", x, N);
    write_to_file("y.dat", y, N);
    write_to_file("u.dat", u, N);
    write_to_file("u_a.dat", u_a, N);
    write_to_file("f.dat", f, N);
}

	.text
	.file	"cufft.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi # -- Begin function _Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.type	_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi,@function
_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi: # @_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi, .Lfunc_end0-_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi # -- Begin function _Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
	.type	_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi,@function
_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi: # @_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12real2complexPfP15HIP_vector_typeIfLj2EEi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi, .Lfunc_end1-_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi # -- Begin function _Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
	.type	_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi,@function
_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi: # @_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12complex2realP15HIP_vector_typeIfLj2EEPfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi, .Lfunc_end2-_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z13write_to_filePcPfi          # -- Begin function _Z13write_to_filePcPfi
	.type	_Z13write_to_filePcPfi,@function
_Z13write_to_filePcPfi:                 # @_Z13write_to_filePcPfi
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$520, %rsp                      # imm = 0x208
	.cfi_def_cfa_offset 576
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %r15
	movq	%rdi, %r14
	leaq	8(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:                                # %.preheader17
	testl	%ebp, %ebp
	jle	.LBB3_8
# %bb.2:                                # %.preheader.lr.ph
	movl	%ebp, %ebp
	leaq	(,%rbp,4), %r12
	xorl	%r13d, %r13d
	leaq	8(%rsp), %r14
	movq	%rbp, (%rsp)                    # 8-byte Spill
.LBB3_3:                                # %.lr.ph.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
	movq	%r15, %rbx
.LBB3_4:                                # %.lr.ph
                                        #   Parent Loop BB3_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
.Ltmp2:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp3:
# %bb.5:                                # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB3_4 Depth=2
.Ltmp4:
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp5:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB3_4 Depth=2
	addq	%r12, %rbx
	decq	%rbp
	jne	.LBB3_4
# %bb.7:                                # %._crit_edge
                                        #   in Loop: Header=BB3_3 Depth=1
	incq	%r13
	addq	$4, %r15
	movq	(%rsp), %rbp                    # 8-byte Reload
	cmpq	%rbp, %r13
	jne	.LBB3_3
.LBB3_8:                                # %._crit_edge20
.Ltmp7:
	leaq	8(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp8:
# %bb.9:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	16(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 8(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	256(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$520, %rsp                      # imm = 0x208
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB3_10:
	.cfi_def_cfa_offset 576
.Ltmp9:
	jmp	.LBB3_11
.LBB3_12:
.Ltmp6:
.LBB3_11:
	movq	%rax, %rbx
	leaq	8(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z13write_to_filePcPfi, .Lfunc_end3-_Z13write_to_filePcPfi
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp2-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp5-.Ltmp2                  #   Call between .Ltmp2 and .Ltmp5
	.uleb128 .Ltmp6-.Lfunc_begin0           #     jumps to .Ltmp6
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp8-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Lfunc_end3-.Ltmp8             #   Call between .Ltmp8 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI4_0:
	.long	0x3c800000                      # float 0.015625
.LCPI4_2:
	.long	0xbca3d70b                      # float -0.0200000014
.LCPI4_3:
	.long	0x38d1b719                      # float 1.00000012E-4
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI4_1:
	.quad	0xbfe0000000000000              # double -0.5
.LCPI4_4:
	.quad	0x400921fb54442d18              # double 3.1415926535897931
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$16384, %edi                    # imm = 0x4000
	callq	_Znam
	movq	%rax, %r12
	movl	$16384, %edi                    # imm = 0x4000
	callq	_Znam
	movq	%rax, %r13
	movl	$16384, %edi                    # imm = 0x4000
	callq	_Znam
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	movl	$16384, %edi                    # imm = 0x4000
	callq	_Znam
	movq	%rax, %rbp
	movl	$16384, %edi                    # imm = 0x4000
	callq	_Znam
	movq	%rax, %r14
	xorl	%ebx, %ebx
	movss	.LCPI4_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorps	%xmm2, %xmm2
	movsd	.LCPI4_1(%rip), %xmm3           # xmm3 = mem[0],zero
	movss	.LCPI4_2(%rip), %xmm4           # xmm4 = mem[0],zero,zero,zero
	movss	.LCPI4_3(%rip), %xmm5           # xmm5 = mem[0],zero,zero,zero
	movq	%r12, 96(%rsp)                  # 8-byte Spill
	movq	%r13, 104(%rsp)                 # 8-byte Spill
	movq	%rbp, 120(%rsp)                 # 8-byte Spill
	movq	%rax, 88(%rsp)                  # 8-byte Spill
.LBB4_1:                                # %.preheader169
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_2 Depth 2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	movss	%xmm0, 20(%rsp)                 # 4-byte Spill
	cvtss2sd	%xmm0, %xmm0
	addsd	%xmm3, %xmm0
	mulsd	%xmm0, %xmm0
	movsd	%xmm0, 128(%rsp)                # 8-byte Spill
	xorl	%r15d, %r15d
.LBB4_2:                                #   Parent Loop BB4_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r15d, %xmm0
	mulss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	movss	%xmm0, (%r12,%r15,4)
	movss	20(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	movss	%xmm1, (%r13,%r15,4)
	cvtss2sd	%xmm0, %xmm0
	addsd	%xmm3, %xmm0
	mulsd	%xmm0, %xmm0
	addsd	128(%rsp), %xmm0                # 8-byte Folded Reload
	cvtsd2ss	%xmm0, %xmm0
	movaps	%xmm0, %xmm1
	addss	%xmm4, %xmm1
	divss	%xmm5, %xmm1
	movss	%xmm1, 28(%rsp)                 # 4-byte Spill
	divss	%xmm4, %xmm0
	movss	%xmm0, 24(%rsp)                 # 4-byte Spill
	callq	expf
	mulss	28(%rsp), %xmm0                 # 4-byte Folded Reload
	movss	%xmm0, (%rbp,%r15,4)
	movss	24(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	callq	expf
	movss	.LCPI4_3(%rip), %xmm5           # xmm5 = mem[0],zero,zero,zero
	movss	.LCPI4_2(%rip), %xmm4           # xmm4 = mem[0],zero,zero,zero
	movsd	.LCPI4_1(%rip), %xmm3           # xmm3 = mem[0],zero
	xorps	%xmm2, %xmm2
	movss	.LCPI4_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movss	%xmm0, (%r14,%r15,4)
	incq	%r15
	cmpq	$64, %r15
	jne	.LBB4_2
# %bb.3:                                #   in Loop: Header=BB4_1 Depth=1
	incq	%rbx
	movl	$256, %eax                      # imm = 0x100
	addq	%rax, %r14
	addq	%rax, %rbp
	addq	%rax, %r13
	addq	%rax, %r12
	cmpq	$64, %rbx
	jne	.LBB4_1
# %bb.4:
	movl	$256, %edi                      # imm = 0x100
	callq	_Znam
	movq	%rax, %r12
	xorl	%eax, %eax
	movsd	.LCPI4_4(%rip), %xmm0           # xmm0 = mem[0],zero
.LBB4_5:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm1, %xmm1
	cvtsi2sd	%eax, %xmm1
	mulsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, (%r12,%rax,2)
	addq	$2, %rax
	cmpq	$66, %rax
	jne	.LBB4_5
# %bb.6:                                # %.preheader.preheader
	xorl	%eax, %eax
	movq	120(%rsp), %r14                 # 8-byte Reload
.LBB4_7:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	leal	-62(%rax), %ecx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ecx, %xmm1
	mulsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, 132(%r12,%rax,2)
	addq	$2, %rax
	cmpq	$62, %rax
	jne	.LBB4_7
# %bb.8:
	movabsq	$137438953504, %rbp             # imm = 0x2000000020
	movabsq	$8589934594, %r15               # imm = 0x200000002
	leaq	80(%rsp), %r13
	movl	$256, %esi                      # imm = 0x100
	movq	%r13, %rdi
	callq	hipMalloc
	leaq	72(%rsp), %rbx
	movl	$16384, %esi                    # imm = 0x4000
	movq	%rbx, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movl	$16384, %esi                    # imm = 0x4000
	callq	hipMalloc
	movq	(%r13), %rdi
	movl	$256, %edx                      # imm = 0x100
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rdi
	movl	$16384, %edx                    # imm = 0x4000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	64(%rsp), %rdi
	movl	$32768, %esi                    # imm = 0x8000
	callq	hipMalloc
	leaq	48(%rsp), %rdi
	movl	$32768, %esi                    # imm = 0x8000
	callq	hipMalloc
	leaq	56(%rsp), %rdi
	movl	$32768, %esi                    # imm = 0x8000
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	movl	$32768, %esi                    # imm = 0x8000
	callq	hipMalloc
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$2, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_10
# %bb.9:
	movq	72(%rsp), %rdi
	movq	56(%rsp), %rsi
	movl	$64, %edx
	callq	_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
.LBB4_10:
	leaq	32(%rsp), %rbx
	movq	%rbx, %rdi
	movl	$64, %esi
	movl	$64, %edx
	movl	$41, %ecx
	callq	hipfftPlan2d
	movq	(%rbx), %rdi
	movq	56(%rsp), %rsi
	movq	64(%rsp), %rdx
	movl	$-1, %ecx
	callq	hipfftExecC2C
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_12
# %bb.11:
	movq	64(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	80(%rsp), %rdx
	movl	$64, %ecx
	callq	_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
.LBB4_12:
	movq	32(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	40(%rsp), %rdx
	movl	$1, %ecx
	callq	hipfftExecC2C
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	movq	112(%rsp), %rbx                 # 8-byte Reload
	jne	.LBB4_14
# %bb.13:
	movq	40(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	$64, %edx
	callq	_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
.LBB4_14:
	movq	8(%rsp), %rsi
	movl	$16384, %edx                    # imm = 0x4000
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	32(%rsp), %rdi
	callq	hipfftDestroy
	movq	80(%rsp), %rdi
	callq	hipFree
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	xorl	%eax, %eax
.LBB4_15:                               # =>This Inner Loop Header: Depth=1
	movss	(%rbx,%rax,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	movss	%xmm1, (%rbx,%rax,4)
	incq	%rax
	cmpq	$4096, %rax                     # imm = 0x1000
	jne	.LBB4_15
# %bb.16:
	movl	$.L.str.2, %edi
	movq	96(%rsp), %rsi                  # 8-byte Reload
	movl	$64, %edx
	callq	_Z13write_to_filePcPfi
	movl	$.L.str.3, %edi
	movq	104(%rsp), %rsi                 # 8-byte Reload
	movl	$64, %edx
	callq	_Z13write_to_filePcPfi
	movl	$.L.str.4, %edi
	movq	%rbx, %rsi
	movl	$64, %edx
	callq	_Z13write_to_filePcPfi
	movl	$.L.str.5, %edi
	movq	88(%rsp), %rsi                  # 8-byte Reload
	movl	$64, %edx
	callq	_Z13write_to_filePcPfi
	movl	$.L.str.6, %edi
	movq	%r14, %rsi
	movl	$64, %edx
	callq	_Z13write_to_filePcPfi
	xorl	%eax, %eax
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12real2complexPfP15HIP_vector_typeIfLj2EEi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12complex2realP15HIP_vector_typeIfLj2EEPfi, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB6_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi,@object # @_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.section	.rodata,"a",@progbits
	.globl	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.p2align	3, 0x0
_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi:
	.quad	_Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.size	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi, 8

	.type	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi,@object # @_Z12real2complexPfP15HIP_vector_typeIfLj2EEi
	.globl	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi
	.p2align	3, 0x0
_Z12real2complexPfP15HIP_vector_typeIfLj2EEi:
	.quad	_Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
	.size	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi, 8

	.type	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi,@object # @_Z12complex2realP15HIP_vector_typeIfLj2EEPfi
	.globl	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi
	.p2align	3, 0x0
_Z12complex2realP15HIP_vector_typeIfLj2EEPfi:
	.quad	_Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
	.size	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"\n"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"N-0.5)/BSZ: "
	.size	.L.str.1, 13

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"x.dat"
	.size	.L.str.2, 6

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"y.dat"
	.size	.L.str.3, 6

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"u.dat"
	.size	.L.str.4, 6

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"u_a.dat"
	.size	.L.str.5, 8

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"f.dat"
	.size	.L.str.6, 6

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi"
	.size	.L__unnamed_1, 49

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z12real2complexPfP15HIP_vector_typeIfLj2EEi"
	.size	.L__unnamed_2, 45

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z12complex2realP15HIP_vector_typeIfLj2EEPfi"
	.size	.L__unnamed_3, 45

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z28__device_stub__solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.addrsig_sym _Z27__device_stub__real2complexPfP15HIP_vector_typeIfLj2EEi
	.addrsig_sym _Z27__device_stub__complex2realP15HIP_vector_typeIfLj2EEPfi
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.addrsig_sym _Z12real2complexPfP15HIP_vector_typeIfLj2EEi
	.addrsig_sym _Z12complex2realP15HIP_vector_typeIfLj2EEPfi
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi ; -- Begin function _Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.globl	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
	.p2align	8
	.type	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi,@function
_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi: ; @_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
; %bb.0:
	s_load_b32 s2, s[0:1], 0x18
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v2, v0, 10, 10
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v0, s14, 5, v1
	v_lshl_add_u32 v2, s15, 5, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_max_i32_e32 v1, v0, v2
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s2, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b64 s[4:5], s[0:1], 0x10
	v_ashrrev_i32_e32 v3, 31, v2
	v_mad_u64_u32 v[4:5], null, v2, s2, v[0:1]
	v_ashrrev_i32_e32 v1, 31, v0
	s_load_b128 s[0:3], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[6:7], 2, v[2:3]
	v_lshlrev_b64 v[8:9], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, 31, v4
	v_or_b32_e32 v0, v0, v2
	v_lshlrev_b64 v[3:4], 3, v[4:5]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v6, vcc_lo, s4, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s5, v7, vcc_lo
	v_add_co_u32 v8, vcc_lo, s4, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v9, vcc_lo
	global_load_b32 v1, v[6:7], off
	v_add_co_u32 v5, vcc_lo, s0, v3
	global_load_b32 v7, v[8:9], off
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v4, vcc_lo
	v_cmp_ne_u32_e32 vcc_lo, 0, v0
	global_load_b32 v8, v[5:6], off
	s_waitcnt vmcnt(2)
	v_mul_f32_e32 v1, v1, v1
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v1, v7, v7
	v_cndmask_b32_e32 v2, 1.0, v1, vcc_lo
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v0, null, v2, v2, -v8
	v_div_scale_f32 v9, vcc_lo, -v8, v2, -v8
	v_rcp_f32_e32 v1, v0
	s_waitcnt_depctr 0xfff
	v_fma_f32 v7, -v0, v1, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v1, v7, v1
	v_mul_f32_e32 v7, v9, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v10, -v0, v7, v9
	v_fmac_f32_e32 v7, v10, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v0, -v0, v7, v9
	v_div_fmas_f32 v7, v0, v1, v7
	v_add_co_u32 v0, vcc_lo, s2, v3
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v3, v7, v2, -v8
	global_store_b32 v[0:1], v3, off
	global_load_b32 v3, v[5:6], off offset:4
	s_waitcnt vmcnt(0)
	v_div_scale_f32 v4, null, v2, v2, -v3
	v_rcp_f32_e32 v5, v4
	s_waitcnt_depctr 0xfff
	v_fma_f32 v6, -v4, v5, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v5, v6, v5
	v_div_scale_f32 v6, vcc_lo, -v3, v2, -v3
	v_mul_f32_e32 v7, v6, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v8, -v4, v7, v6
	v_fmac_f32_e32 v7, v8, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v4, -v4, v7, v6
	v_div_fmas_f32 v4, v4, v5, v7
	s_delay_alu instid0(VALU_DEP_1)
	v_div_fixup_f32 v2, v4, v2, -v3
	global_store_b32 v[0:1], v2, off offset:4
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 28
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 11
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi, .Lfunc_end0-_Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 480
; NumSgprs: 18
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 11
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi ; -- Begin function _Z12real2complexPfP15HIP_vector_typeIfLj2EEi
	.globl	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi
	.p2align	8
	.type	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi,@function
_Z12real2complexPfP15HIP_vector_typeIfLj2EEi: ; @_Z12real2complexPfP15HIP_vector_typeIfLj2EEi
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x24
	s_load_b32 s2, s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s3, 16
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4]
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_i32_e32 v2, v0, v1
	v_cmpx_gt_i32_e64 s2, v2
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	v_lshlrev_b64 v[1:2], 3, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v2, vcc_lo
	v_mov_b32_e32 v1, 0
	s_waitcnt vmcnt(0)
	global_store_b64 v[3:4], v[0:1], off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12real2complexPfP15HIP_vector_typeIfLj2EEi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 5
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z12real2complexPfP15HIP_vector_typeIfLj2EEi, .Lfunc_end1-_Z12real2complexPfP15HIP_vector_typeIfLj2EEi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 208
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi ; -- Begin function _Z12complex2realP15HIP_vector_typeIfLj2EEPfi
	.globl	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi
	.p2align	8
	.type	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi,@function
_Z12complex2realP15HIP_vector_typeIfLj2EEPfi: ; @_Z12complex2realP15HIP_vector_typeIfLj2EEPfi
; %bb.0:
	s_load_b32 s2, s[0:1], 0x10
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v2, v0, 10, 10
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v0, s14, 5, v1
	v_lshl_add_u32 v1, s15, 5, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_max_i32_e32 v2, v0, v1
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s2, v2
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mad_u64_u32 v[2:3], null, v1, s2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 3, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v4, v[0:1], off
	v_cvt_f32_i32_e32 v0, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v5, v0, v0
	s_waitcnt vmcnt(0)
	v_div_scale_f32 v0, null, v5, v5, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v6, v0
	s_waitcnt_depctr 0xfff
	v_fma_f32 v1, -v0, v6, 1.0
	v_fmac_f32_e32 v6, v1, v6
	v_div_scale_f32 v1, vcc_lo, v4, v5, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v7, v1, v6
	v_fma_f32 v8, -v0, v7, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v6
	v_fma_f32 v8, -v0, v7, v1
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fmas_f32 v2, v8, v6, v7
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	v_div_fixup_f32 v2, v2, v5, v4
	global_store_b32 v[0:1], v2, off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12complex2realP15HIP_vector_typeIfLj2EEPfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z12complex2realP15HIP_vector_typeIfLj2EEPfi, .Lfunc_end2-_Z12complex2realP15HIP_vector_typeIfLj2EEPfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 284
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 28
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13solve_poissonP15HIP_vector_typeIfLj2EES1_Pfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12real2complexPfP15HIP_vector_typeIfLj2EEi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z12real2complexPfP15HIP_vector_typeIfLj2EEi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12complex2realP15HIP_vector_typeIfLj2EEPfi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z12complex2realP15HIP_vector_typeIfLj2EEPfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
