#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "cufft.h"
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <complex>

#define BATCH 1

void fft(cufftDoubleComplex *in, cufftDoubleComplex *out, int size)
{

	cufftDoubleComplex *inDev;
	cufftDoubleComplex *outDev;
	cudaMalloc((void **)&inDev, sizeof(cufftDoubleComplex)*size);
	cudaMalloc((void **)&outDev, sizeof(cufftDoubleComplex)*size);
	cufftHandle plan;
	cufftPlan1d(&plan, size, CUFFT_Z2Z, BATCH);

	cudaMemcpy(inDev, in, sizeof(cufftDoubleComplex)*size, cudaMemcpyHostToDevice);
	cufftExecZ2Z(plan, inDev, outDev, -1);
	cudaDeviceSynchronize();
	cudaMemcpy(out, outDev, sizeof(cufftDoubleComplex)*size, cudaMemcpyDeviceToHost);
	cudaDeviceSynchronize();

	cufftDestroy(plan);
	cudaFree(inDev);
	cudaFree(outDev);
}


void ifft(cufftDoubleComplex *in, cufftDoubleComplex *out, int size)
{

	cufftDoubleComplex *inDev;
	cufftDoubleComplex *outDev;
	cudaMalloc((void **)&inDev, sizeof(cufftDoubleComplex)*size);
	cudaMalloc((void **)&outDev, sizeof(cufftDoubleComplex)*size);
	cufftDoubleComplex N;
	N.x = (double)size;
	N.y = (double)size;
	cufftHandle plan;
	cufftPlan1d(&plan, size, CUFFT_Z2Z, BATCH);

	cudaMemcpy(inDev, in, sizeof(cufftDoubleComplex)*size, cudaMemcpyHostToDevice);
	cufftExecZ2Z(plan, inDev, outDev, 1);
	cudaDeviceSynchronize();
	cudaMemcpy(out, outDev, sizeof(cufftDoubleComplex)*size, cudaMemcpyDeviceToHost);
	cudaDeviceSynchronize();

	for (int i = 0; i < size; i++)
	{
		out[i].x = out[i].x / N.x;
		out[i].y = out[i].y / N.y;
	}

	cufftDestroy(plan);
	cudaFree(inDev);
	cudaFree(outDev);
}

void fftshift(cufftDoubleComplex *in, cufftDoubleComplex *out, int size)
{
	int idx = size / 2;

	for (int i = 0; i < idx; i++)
	{
		out[i] = in[size - idx + i];
		out[idx + i] = in[i];
	}

	if ((size % 2) == 1)
	{
		out[size - 1] = in[idx];
	}
}

void ifftshift(cufftDoubleComplex *in, cufftDoubleComplex *out, int size)
{
	int idx = size / 2;

	for (int i = 0; i < idx; i++)
	{
		out[size - idx + i] = in[i];
		out[i] = in[idx + i];
	}

	if ((size % 2) == 1)
	{
		out[idx] = in[size - 1];
	}

}
	.file	"tmpxft_002e2d08_00000000-6_fft.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3965:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3965:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z3fftP7double2S0_i
	.type	_Z3fftP7double2S0_i, @function
_Z3fftP7double2S0_i:
.LFB3959:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edx, %rbx
	movq	%rbx, %rbp
	salq	$4, %rbx
	movq	%rbx, %rsi
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	4(%rsp), %rdi
	movl	$1, %ecx
	movl	%ebp, %esi
	movl	$105, %edx
	call	cufftPlan1d@PLT
	movq	8(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	orl	$-1, %ecx
	movl	4(%rsp), %edi
	call	cufftExecZ2Z@PLT
	call	cudaDeviceSynchronize@PLT
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movl	4(%rsp), %edi
	call	cufftDestroy@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3959:
	.size	_Z3fftP7double2S0_i, .-_Z3fftP7double2S0_i
	.globl	_Z4ifftP7double2S0_i
	.type	_Z4ifftP7double2S0_i, @function
_Z4ifftP7double2S0_i:
.LFB3960:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rbp
	salq	$4, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rsi, %rbx
	movq	%r12, %rsi
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	cvtsi2sdl	%ebp, %xmm1
	leaq	20(%rsp), %rdi
	movl	%ebp, %esi
	movl	$1, %ecx
	movl	$105, %edx
	movsd	%xmm1, 8(%rsp)
	call	cufftPlan1d@PLT
	movq	24(%rsp), %rdi
	movq	%r12, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$1, %ecx
	movl	20(%rsp), %edi
	call	cufftExecZ2Z@PLT
	call	cudaDeviceSynchronize@PLT
	movq	32(%rsp), %rsi
	movq	%r12, %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	movsd	8(%rsp), %xmm1
	movq	%rbx, %rax
	xorl	%edx, %edx
.L7:
	cmpl	%ebp, %edx
	jge	.L11
	movsd	(%rax), %xmm0
	incl	%edx
	addq	$16, %rax
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rax)
	movsd	-8(%rax), %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -8(%rax)
	jmp	.L7
.L11:
	movl	20(%rsp), %edi
	call	cufftDestroy@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3960:
	.size	_Z4ifftP7double2S0_i, .-_Z4ifftP7double2S0_i
	.globl	_Z8fftshiftP7double2S0_i
	.type	_Z8fftshiftP7double2S0_i, @function
_Z8fftshiftP7double2S0_i:
.LFB3961:
	.cfi_startproc
	endbr64
	movl	%edx, %eax
	movq	%rdi, %r8
	movl	%edx, %ecx
	movq	%rsi, %rdi
	cltd
	movl	$2, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%r8, %r9
	idivl	%esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%ecx, %rsi
	movq	%rdi, %rdx
	xorl	%r11d, %r11d
	salq	$4, %rsi
	movslq	%eax, %r10
	imulq	$-16, %r10, %r10
	movq	%r10, %rbx
	negq	%rbx
.L13:
	cmpl	%eax, %r11d
	jge	.L17
	leaq	(%r9,%rsi), %rbp
	incl	%r11d
	addq	$16, %rdx
	addq	$16, %r9
	movaps	0(%rbp,%r10), %xmm0
	movaps	%xmm0, -16(%rdx)
	movaps	-16(%r9), %xmm1
	movaps	%xmm1, -16(%rdx,%rbx)
	jmp	.L13
.L17:
	movl	%ecx, %eax
	movl	$2, %r9d
	cltd
	idivl	%r9d
	decl	%edx
	jne	.L12
	movaps	(%r8,%rbx), %xmm2
	movaps	%xmm2, -16(%rdi,%rsi)
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3961:
	.size	_Z8fftshiftP7double2S0_i, .-_Z8fftshiftP7double2S0_i
	.globl	_Z9ifftshiftP7double2S0_i
	.type	_Z9ifftshiftP7double2S0_i, @function
_Z9ifftshiftP7double2S0_i:
.LFB3962:
	.cfi_startproc
	endbr64
	movl	%edx, %eax
	movq	%rdi, %r8
	movl	%edx, %ecx
	movl	$2, %edi
	cltd
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %r9
	xorl	%r11d, %r11d
	idivl	%edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%ecx, %rdi
	movq	%r8, %rdx
	salq	$4, %rdi
	movslq	%eax, %r10
	imulq	$-16, %r10, %r10
	movq	%r10, %rbx
	negq	%rbx
.L19:
	cmpl	%eax, %r11d
	jge	.L23
	movaps	(%rdx), %xmm0
	leaq	(%r9,%rdi), %rbp
	incl	%r11d
	addq	$16, %rdx
	addq	$16, %r9
	movaps	%xmm0, 0(%rbp,%r10)
	movaps	-16(%rdx,%rbx), %xmm1
	movaps	%xmm1, -16(%r9)
	jmp	.L19
.L23:
	movl	%ecx, %eax
	movl	$2, %r9d
	cltd
	idivl	%r9d
	decl	%edx
	jne	.L18
	movaps	-16(%r8,%rdi), %xmm2
	movaps	%xmm2, (%rsi,%rbx)
.L18:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3962:
	.size	_Z9ifftshiftP7double2S0_i, .-_Z9ifftshiftP7double2S0_i
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3988:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3988:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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
	.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 <stdio.h>
#include <malloc.h>
#include <math.h>
#include <complex>

#define BATCH 1

void fft(hipfftDoubleComplex *in, hipfftDoubleComplex *out, int size)
{

	hipfftDoubleComplex *inDev;
	hipfftDoubleComplex *outDev;
	hipMalloc((void **)&inDev, sizeof(hipfftDoubleComplex)*size);
	hipMalloc((void **)&outDev, sizeof(hipfftDoubleComplex)*size);
	hipfftHandle plan;
	hipfftPlan1d(&plan, size, HIPFFT_Z2Z, BATCH);

	hipMemcpy(inDev, in, sizeof(hipfftDoubleComplex)*size, hipMemcpyHostToDevice);
	hipfftExecZ2Z(plan, inDev, outDev, -1);
	hipDeviceSynchronize();
	hipMemcpy(out, outDev, sizeof(hipfftDoubleComplex)*size, hipMemcpyDeviceToHost);
	hipDeviceSynchronize();

	hipfftDestroy(plan);
	hipFree(inDev);
	hipFree(outDev);
}


void ifft(hipfftDoubleComplex *in, hipfftDoubleComplex *out, int size)
{

	hipfftDoubleComplex *inDev;
	hipfftDoubleComplex *outDev;
	hipMalloc((void **)&inDev, sizeof(hipfftDoubleComplex)*size);
	hipMalloc((void **)&outDev, sizeof(hipfftDoubleComplex)*size);
	hipfftDoubleComplex N;
	N.x = (double)size;
	N.y = (double)size;
	hipfftHandle plan;
	hipfftPlan1d(&plan, size, HIPFFT_Z2Z, BATCH);

	hipMemcpy(inDev, in, sizeof(hipfftDoubleComplex)*size, hipMemcpyHostToDevice);
	hipfftExecZ2Z(plan, inDev, outDev, 1);
	hipDeviceSynchronize();
	hipMemcpy(out, outDev, sizeof(hipfftDoubleComplex)*size, hipMemcpyDeviceToHost);
	hipDeviceSynchronize();

	for (int i = 0; i < size; i++)
	{
		out[i].x = out[i].x / N.x;
		out[i].y = out[i].y / N.y;
	}

	hipfftDestroy(plan);
	hipFree(inDev);
	hipFree(outDev);
}

void fftshift(hipfftDoubleComplex *in, hipfftDoubleComplex *out, int size)
{
	int idx = size / 2;

	for (int i = 0; i < idx; i++)
	{
		out[i] = in[size - idx + i];
		out[idx + i] = in[i];
	}

	if ((size % 2) == 1)
	{
		out[size - 1] = in[idx];
	}
}

void ifftshift(hipfftDoubleComplex *in, hipfftDoubleComplex *out, int size)
{
	int idx = size / 2;

	for (int i = 0; i < idx; i++)
	{
		out[size - idx + i] = in[i];
		out[i] = in[idx + i];
	}

	if ((size % 2) == 1)
	{
		out[idx] = in[size - 1];
	}

}
	.text
	.file	"fft.hip"
	.globl	_Z3fftP15HIP_vector_typeIdLj2EES1_i # -- Begin function _Z3fftP15HIP_vector_typeIdLj2EES1_i
	.type	_Z3fftP15HIP_vector_typeIdLj2EES1_i,@function
_Z3fftP15HIP_vector_typeIdLj2EES1_i:    # @_Z3fftP15HIP_vector_typeIdLj2EES1_i
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	movq	%rdi, %rbp
	movslq	%edx, %r15
	movq	%r15, %r12
	shlq	$4, %r12
	leaq	32(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	24(%rsp), %r14
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %r13
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$105, %edx
	movl	$1, %ecx
	callq	hipfftPlan1d
	movq	(%rbx), %rdi
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movq	(%rbx), %rsi
	movq	(%r14), %rdx
	movl	$-1, %ecx
	callq	hipfftExecZ2Z
	callq	hipDeviceSynchronize
	movq	(%r14), %rsi
	movq	8(%rsp), %rdi                   # 8-byte Reload
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	movq	(%r13), %rdi
	callq	hipfftDestroy
	movq	(%rbx), %rdi
	callq	hipFree
	movq	(%r14), %rdi
	callq	hipFree
	addq	$40, %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_end0:
	.size	_Z3fftP15HIP_vector_typeIdLj2EES1_i, .Lfunc_end0-_Z3fftP15HIP_vector_typeIdLj2EES1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z4ifftP15HIP_vector_typeIdLj2EES1_i # -- Begin function _Z4ifftP15HIP_vector_typeIdLj2EES1_i
	.type	_Z4ifftP15HIP_vector_typeIdLj2EES1_i,@function
_Z4ifftP15HIP_vector_typeIdLj2EES1_i:   # @_Z4ifftP15HIP_vector_typeIdLj2EES1_i
	.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	$24, %rsp
	.cfi_def_cfa_offset 80
	.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, %rbx
	movq	%rdi, %r12
	movslq	%edx, %r14
	shlq	$4, %r14
	leaq	16(%rsp), %r13
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	%rsp, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	movl	%ebp, %esi
	movl	$105, %edx
	movl	$1, %ecx
	callq	hipfftPlan1d
	movq	(%r13), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	movq	(%r13), %rsi
	movq	%rsp, %rax
	movq	(%rax), %rdx
	movl	$1, %ecx
	callq	hipfftExecZ2Z
	callq	hipDeviceSynchronize
	movq	%rsp, %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	testl	%ebp, %ebp
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	cvtsi2sd	%ebp, %xmm0
	movl	%ebp, %eax
	shlq	$4, %rax
	xorl	%ecx, %ecx
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%rcx), %xmm1              # xmm1 = mem[0],zero
	movsd	8(%rbx,%rcx), %xmm2             # xmm2 = mem[0],zero
	divsd	%xmm0, %xmm1
	movsd	%xmm1, (%rbx,%rcx)
	divsd	%xmm0, %xmm2
	movsd	%xmm2, 8(%rbx,%rcx)
	addq	$16, %rcx
	cmpq	%rcx, %rax
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	movq	8(%rsp), %rdi
	callq	hipfftDestroy
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	addq	$24, %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_end1:
	.size	_Z4ifftP15HIP_vector_typeIdLj2EES1_i, .Lfunc_end1-_Z4ifftP15HIP_vector_typeIdLj2EES1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i # -- Begin function _Z8fftshiftP15HIP_vector_typeIdLj2EES1_i
	.type	_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i,@function
_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i: # @_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i
	.cfi_startproc
# %bb.0:
	movl	%edx, %ecx
	shrl	$31, %ecx
	addl	%edx, %ecx
	sarl	%ecx
	movl	%ecx, %eax
	cmpl	$2, %edx
	jl	.LBB2_3
# %bb.1:                                # %.lr.ph
	movl	%edx, %r8d
	subl	%ecx, %r8d
	movslq	%r8d, %rcx
	shlq	$4, %rcx
	addq	%rdi, %rcx
	movq	%rax, %r8
	shlq	$4, %r8
	leaq	(%rsi,%r8), %r9
	xorl	%r10d, %r10d
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movaps	(%rcx,%r10), %xmm0
	movaps	%xmm0, (%rsi,%r10)
	movaps	(%rdi,%r10), %xmm0
	movaps	%xmm0, (%r9,%r10)
	addq	$16, %r10
	cmpq	%r10, %r8
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	movl	%edx, %ecx
	andl	$-2147483647, %ecx              # imm = 0x80000001
	cmpl	$1, %ecx
	jne	.LBB2_5
# %bb.4:
	shlq	$4, %rax
	movl	%edx, %ecx
	shlq	$4, %rcx
	movaps	(%rdi,%rax), %xmm0
	movaps	%xmm0, -16(%rsi,%rcx)
.LBB2_5:
	retq
.Lfunc_end2:
	.size	_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i, .Lfunc_end2-_Z8fftshiftP15HIP_vector_typeIdLj2EES1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i # -- Begin function _Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i
	.type	_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i,@function
_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i: # @_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i
	.cfi_startproc
# %bb.0:
	movl	%edx, %ecx
	shrl	$31, %ecx
	addl	%edx, %ecx
	sarl	%ecx
	movl	%ecx, %eax
	cmpl	$2, %edx
	jl	.LBB3_3
# %bb.1:                                # %.lr.ph
	movl	%edx, %r8d
	subl	%ecx, %r8d
	movslq	%r8d, %rcx
	shlq	$4, %rcx
	addq	%rsi, %rcx
	movq	%rax, %r8
	shlq	$4, %r8
	leaq	(%rdi,%r8), %r9
	xorl	%r10d, %r10d
.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	movaps	(%rdi,%r10), %xmm0
	movaps	%xmm0, (%rcx,%r10)
	movaps	(%r9,%r10), %xmm0
	movaps	%xmm0, (%rsi,%r10)
	addq	$16, %r10
	cmpq	%r10, %r8
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	movl	%edx, %ecx
	andl	$-2147483647, %ecx              # imm = 0x80000001
	cmpl	$1, %ecx
	jne	.LBB3_5
# %bb.4:
	movl	%edx, %ecx
	shlq	$4, %rcx
	shlq	$4, %rax
	movaps	-16(%rdi,%rcx), %xmm0
	movaps	%xmm0, (%rsi,%rax)
.LBB3_5:
	retq
.Lfunc_end3:
	.size	_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i, .Lfunc_end3-_Z9ifftshiftP15HIP_vector_typeIdLj2EES1_i
	.cfi_endproc
                                        # -- End function
	.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 __hip_cuid_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
