#include <stdio.h>
#include <cuda_runtime.h>
#include <cufft.h>
#include <device_launch_parameters.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <fstream>
#include <math.h>

using namespace std;

#define rawR 7
#define rawC 840
#define rawL (rawR*rawC)
#define LENGTH 840
#define BATCH 1
#define LENGTHPAD 1024
#define NRANK 2

static __global__ void cufftComplexScale(cufftComplex *idata, cufftComplex *odata, const int size, float scale)
{
    const int threadID = blockIdx.x * blockDim.x + threadIdx.x;
    if (threadID < size)
    {
        odata[threadID].x = idata[threadID].x * scale;
        odata[threadID].y = idata[threadID].y * scale;
    }
}

int main()
{
  int n[NRANK] = {rawR, rawC};
  // create arrays
  float speed2d[rawR][rawC];

  // read raw data 
  ifstream rawData("../data/speedData.txt");

  // generate 2d speed data
  if (!(rawData.is_open())){
    cout<<"faild to read data." << endl;
  } 

  for (int row=0; row<rawR; row++){
    for (int col=0; col<rawC; col++){
      rawData >> speed2d[row][col];
    }
  }

  rawData.close();

  // print array for debug
  // for (int row=0; row<rawR; row++){
  //   for (int col=0; col<10; col++){
  //     cout << speed2d[row][col] << '\t';
  //   }
  //   cout << '\n';
  // }

  // host data pointer
  cufftComplex *CompData2d=(cufftComplex*)malloc(rawC*rawR*sizeof(cufftComplex)); 

  // 2 d

  for (int i=0; i<rawR; i++){
    for (int j=0; j<rawC; j++){
      CompData2d[i*rawC+j].x = speed2d[i][j];
      CompData2d[i*rawC+j].y = 0;
    }
  }

  cufftComplex *d_fftData; // device data pointer
  cudaMalloc((void**)&d_fftData,rawC*rawR*sizeof(cufftComplex));
  cudaMemcpy(d_fftData,CompData2d,rawC*rawR*sizeof(cufftComplex),cudaMemcpyHostToDevice);

  // create the cuda event to count the running time for GPU
  cudaEvent_t start1, stop1;
  cudaEventCreate(&start1);
  cudaEventCreate(&stop1);

  cufftHandle plan;
  cufftPlanMany(&plan, NRANK, n,
        NULL, 1, 0,
        NULL, 1, 0,
        CUFFT_C2C, BATCH);

  // execute kernel
  

  cufftExecC2C(plan,(cufftComplex*)d_fftData,(cufftComplex*)d_fftData,CUFFT_FORWARD);


  cudaEventRecord(start1);
  cufftExecC2C(plan, (cufftComplex*)d_fftData, (cufftComplex*)d_fftData, CUFFT_INVERSE);
 
  dim3 dimBlock(1024);
  dim3 dimGrid(6); 

  cufftComplexScale <<<dimGrid, dimBlock>>>((cufftComplex*)d_fftData,(cufftComplex*)d_fftData,rawC*rawR,1.0f / (rawC*rawR));
  
  cudaEventRecord(stop1);

  cudaEventSynchronize(stop1);
  float milliseconds = 0;
  cudaEventElapsedTime(&milliseconds, start1, stop1);
  cout << "GPU FFT time used: "<< milliseconds << " ms\n";



  cudaDeviceSynchronize();

  cudaMemcpy(CompData2d,d_fftData,rawC*rawR*sizeof(cufftComplex)*BATCH,cudaMemcpyDeviceToHost);

  //store result to txt
  ofstream myFile;
  myFile.open("../data/2d_batch_inverse.txt");

  for (int i=0; i<rawR; i++){
    for (int j=0; j<rawC; j++){
      myFile << CompData2d[i*rawC+j].x <<','<< CompData2d[i*rawC+j].y << endl;
    }
  }

  cufftDestroy(plan);
  free(CompData2d);
  cudaFree(d_fftData);

  return 0;
}
	.file	"tmpxft_002d2ec5_00000000-6_2D_cufft_inverse.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3792:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3792:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if, @function
_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if:
.LFB3814:
	.cfi_startproc
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rcx
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movss	%xmm0, 8(%rsp)
	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	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%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	_ZL17cufftComplexScaleP6float2S0_if(%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
.LFE3814:
	.size	_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if, .-_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if
	.type	_ZL17cufftComplexScaleP6float2S0_if, @function
_ZL17cufftComplexScaleP6float2S0_if:
.LFB3815:
	.cfi_startproc
	endbr64
	jmp	_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if
	.cfi_endproc
.LFE3815:
	.size	_ZL17cufftComplexScaleP6float2S0_if, .-_ZL17cufftComplexScaleP6float2S0_if
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z17cufftComplexScaleP6float2S0_if"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3817:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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
	leaq	_ZL17cufftComplexScaleP6float2S0_if(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	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	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3817:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC1:
	.string	"../data/speedData.txt"
.LC2:
	.string	"faild to read data."
.LC5:
	.string	"GPU FFT time used: "
.LC6:
	.string	" ms\n"
.LC7:
	.string	"../data/2d_batch_inverse.txt"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3789:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3789
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-24576(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$72, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movl	$8, %edx
	leaq	.LC1(%rip), %rsi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	movabsq	$3607772528647, %rax
	movq	%rax, -24616(%rbp)
	leaq	-24096(%rbp), %rax
	movq	%rax, %rdi
	movq	%rax, -24680(%rbp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	leaq	-23976(%rbp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	jne	.L11
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB1:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L11:
	leaq	-23576(%rbp), %r13
	xorl	%r15d, %r15d
	movq	%r13, %r14
.L12:
	movq	%r14, %rbx
	movl	$840, %r12d
.L13:
	movq	-24680(%rbp), %rdi
	movq	%rbx, %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	addq	$4, %rbx
	decl	%r12d
	jne	.L13
	addq	$840, %r15
	addq	$3360, %r14
	cmpq	$5880, %r15
	jne	.L12
	movq	-24680(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movl	$47040, %edi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %rcx
.L15:
	movq	%rcx, %rdx
	xorl	%eax, %eax
.L16:
	movss	0(%r13,%rax,4), %xmm0
	incq	%rax
	movl	$0x00000000, 4(%rdx)
	addq	$8, %rdx
	movss	%xmm0, -8(%rdx)
	cmpq	$840, %rax
	jne	.L16
	addl	$840, %r12d
	addq	$6720, %rcx
	addq	$3360, %r13
	cmpl	$5880, %r12d
	jne	.L15
	leaq	-24664(%rbp), %rdi
	movl	$47040, %esi
	call	cudaMalloc@PLT
	movq	-24664(%rbp), %rdi
	movl	$1, %ecx
	movl	$47040, %edx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	leaq	-24656(%rbp), %rdi
	call	cudaEventCreate@PLT
	leaq	-24648(%rbp), %rdi
	call	cudaEventCreate@PLT
	pushq	%rax
	leaq	-24616(%rbp), %rdx
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	pushq	$1
	movl	$1, %r8d
	movl	$2, %esi
	leaq	-24672(%rbp), %rdi
	pushq	$41
	pushq	$0
	pushq	$1
	pushq	$0
	.cfi_escape 0x2e,0x30
	call	cufftPlanMany@PLT
	movq	-24664(%rbp), %rsi
	movl	-24672(%rbp), %edi
	addq	$48, %rsp
	orl	$-1, %ecx
	movq	%rsi, %rdx
	.cfi_escape 0x2e,0
	call	cufftExecC2C@PLT
	movq	-24656(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-24664(%rbp), %rsi
	movl	-24672(%rbp), %edi
	movl	$1, %ecx
	movq	%rsi, %rdx
	call	cufftExecC2C@PLT
	movl	$4194305, %edx
	movl	$2147483651, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$10, %rdx
	movl	$1, %ecx
	addq	%rdi, %rdi
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L18
.L20:
	movq	-24648(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	jmp	.L38
.L18:
	movq	-24664(%rbp), %rdi
	movss	.LC4(%rip), %xmm0
	movl	$5880, %edx
	movq	%rdi, %rsi
	call	_ZL48__device_stub__Z17cufftComplexScaleP6float2S0_ifP6float2S0_if
	jmp	.L20
.L38:
	movq	-24648(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-24648(%rbp), %rdx
	movq	-24656(%rbp), %rsi
	leaq	-24668(%rbp), %rdi
	movl	$0x00000000, -24668(%rbp)
	call	cudaEventElapsedTime@PLT
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	-24668(%rbp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC6(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	call	cudaDeviceSynchronize@PLT
	movq	-24664(%rbp), %rsi
	movl	$2, %ecx
	movl	$47040, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	leaq	-24608(%rbp), %r13
	movq	%r13, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE1:
	movl	$16, %edx
	leaq	.LC7(%rip), %rsi
	movq	%r13, %rdi
.LEHB2:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	xorl	%r14d, %r14d
.L21:
	imulq	$6720, %r14, %r12
	movl	$840, %r15d
	addq	%rbx, %r12
.L22:
	movq	%r13, %rdi
	cvtss2sd	(%r12), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$44, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	cvtss2sd	4(%r12), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	addq	$8, %r12
	decl	%r15d
	jne	.L22
	incq	%r14
	cmpq	$7, %r14
	jne	.L21
	movl	-24672(%rbp), %edi
	call	cufftDestroy@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	-24664(%rbp), %rdi
	call	cudaFree@PLT
.LEHE2:
	movq	%r13, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-24096(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L27
	jmp	.L36
.L30:
	endbr64
	movq	%rax, %rbx
.L24:
	movq	%r13, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L25
.L29:
	endbr64
	movq	%rax, %rbx
.L25:
	movq	-24680(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L36
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L36:
	call	__stack_chk_fail@PLT
.L27:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 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 .L29-.LFB3789
	.uleb128 0
	.uleb128 .LEHB2-.LFB3789
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L30-.LFB3789
	.uleb128 0
	.uleb128 .LEHB3-.LFB3789
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE3789:
	.section	.text.startup
	.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	959599690
	.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 <stdio.h>
#include <hip/hip_runtime.h>
#include <hipfft/hipfft.h>

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <fstream>
#include <math.h>

using namespace std;

#define rawR 7
#define rawC 840
#define rawL (rawR*rawC)
#define LENGTH 840
#define BATCH 1
#define LENGTHPAD 1024
#define NRANK 2

static __global__ void cufftComplexScale(hipfftComplex *idata, hipfftComplex *odata, const int size, float scale)
{
    const int threadID = blockIdx.x * blockDim.x + threadIdx.x;
    if (threadID < size)
    {
        odata[threadID].x = idata[threadID].x * scale;
        odata[threadID].y = idata[threadID].y * scale;
    }
}

int main()
{
  int n[NRANK] = {rawR, rawC};
  // create arrays
  float speed2d[rawR][rawC];

  // read raw data 
  ifstream rawData("../data/speedData.txt");

  // generate 2d speed data
  if (!(rawData.is_open())){
    cout<<"faild to read data." << endl;
  } 

  for (int row=0; row<rawR; row++){
    for (int col=0; col<rawC; col++){
      rawData >> speed2d[row][col];
    }
  }

  rawData.close();

  // print array for debug
  // for (int row=0; row<rawR; row++){
  //   for (int col=0; col<10; col++){
  //     cout << speed2d[row][col] << '\t';
  //   }
  //   cout << '\n';
  // }

  // host data pointer
  hipfftComplex *CompData2d=(hipfftComplex*)malloc(rawC*rawR*sizeof(hipfftComplex)); 

  // 2 d

  for (int i=0; i<rawR; i++){
    for (int j=0; j<rawC; j++){
      CompData2d[i*rawC+j].x = speed2d[i][j];
      CompData2d[i*rawC+j].y = 0;
    }
  }

  hipfftComplex *d_fftData; // device data pointer
  hipMalloc((void**)&d_fftData,rawC*rawR*sizeof(hipfftComplex));
  hipMemcpy(d_fftData,CompData2d,rawC*rawR*sizeof(hipfftComplex),hipMemcpyHostToDevice);

  // create the cuda event to count the running time for GPU
  hipEvent_t start1, stop1;
  hipEventCreate(&start1);
  hipEventCreate(&stop1);

  hipfftHandle plan;
  hipfftPlanMany(&plan, NRANK, n,
        NULL, 1, 0,
        NULL, 1, 0,
        HIPFFT_C2C, BATCH);

  // execute kernel
  

  hipfftExecC2C(plan,(hipfftComplex*)d_fftData,(hipfftComplex*)d_fftData,HIPFFT_FORWARD);


  hipEventRecord(start1);
  hipfftExecC2C(plan, (hipfftComplex*)d_fftData, (hipfftComplex*)d_fftData, HIPFFT_BACKWARD);
 
  dim3 dimBlock(1024);
  dim3 dimGrid(6); 

  cufftComplexScale <<<dimGrid, dimBlock>>>((hipfftComplex*)d_fftData,(hipfftComplex*)d_fftData,rawC*rawR,1.0f / (rawC*rawR));
  
  hipEventRecord(stop1);

  hipEventSynchronize(stop1);
  float milliseconds = 0;
  hipEventElapsedTime(&milliseconds, start1, stop1);
  cout << "GPU FFT time used: "<< milliseconds << " ms\n";



  hipDeviceSynchronize();

  hipMemcpy(CompData2d,d_fftData,rawC*rawR*sizeof(hipfftComplex)*BATCH,hipMemcpyDeviceToHost);

  //store result to txt
  ofstream myFile;
  myFile.open("../data/2d_batch_inverse.txt");

  for (int i=0; i<rawR; i++){
    for (int j=0; j<rawC; j++){
      myFile << CompData2d[i*rawC+j].x <<','<< CompData2d[i*rawC+j].y << endl;
    }
  }

  hipfftDestroy(plan);
  free(CompData2d);
  hipFree(d_fftData);

  return 0;
}
	.text
	.file	"2D_cufft_inverse.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI0_0:
	.long	0x3932544a                      # float 1.7006803E-4
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.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	$24632, %rsp                    # imm = 0x6038
	.cfi_def_cfa_offset 24688
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$3607772528647, %rax            # imm = 0x34800000007
	movq	%rax, 64(%rsp)
	.cfi_escape 0x2e, 0x00
	leaq	584(%rsp), %rdi
	movl	$.L.str, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	leaq	704(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	jne	.LBB0_5
# %bb.1:
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp1:
# %bb.2:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %rbx
.Ltmp2:
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp3:
# %bb.3:                                # %.noexc70
.Ltmp4:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp5:
# %bb.4:                                # %.noexc71
.Ltmp6:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp7:
.LBB0_5:                                # %.preheader81.preheader
	leaq	1104(%rsp), %r14
	xorl	%r15d, %r15d
	leaq	584(%rsp), %rbx
.LBB0_6:                                # %.preheader81
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_7 Depth 2
	xorl	%r12d, %r12d
.LBB0_7:                                #   Parent Loop BB0_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r14,%r12), %rsi
.Ltmp8:
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp9:
# %bb.8:                                # %_ZNSirsERf.exit
                                        #   in Loop: Header=BB0_7 Depth=2
	addq	$4, %r12
	cmpq	$3360, %r12                     # imm = 0xD20
	jne	.LBB0_7
# %bb.9:                                #   in Loop: Header=BB0_6 Depth=1
	incq	%r15
	addq	$3360, %r14                     # imm = 0xD20
	cmpq	$7, %r15
	jne	.LBB0_6
# %bb.10:
.Ltmp11:
	.cfi_escape 0x2e, 0x00
	leaq	584(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp12:
# %bb.11:
	.cfi_escape 0x2e, 0x00
	movl	$47040, %edi                    # imm = 0xB7C0
	callq	malloc
	movq	%rax, %rbx
	addq	$4, %rax
	leaq	1104(%rsp), %rcx
	xorl	%edx, %edx
.LBB0_12:                               # %.preheader80
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_13 Depth 2
	xorl	%esi, %esi
.LBB0_13:                               #   Parent Loop BB0_12 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rcx,%rsi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -4(%rax,%rsi,8)
	movl	$0, (%rax,%rsi,8)
	incq	%rsi
	cmpq	$840, %rsi                      # imm = 0x348
	jne	.LBB0_13
# %bb.14:                               #   in Loop: Header=BB0_12 Depth=1
	incq	%rdx
	addq	$6720, %rax                     # imm = 0x1A40
	addq	$3360, %rcx                     # imm = 0xD20
	cmpq	$7, %rdx
	jne	.LBB0_12
# %bb.15:
.Ltmp14:
	.cfi_escape 0x2e, 0x00
	leaq	16(%rsp), %rdi
	movl	$47040, %esi                    # imm = 0xB7C0
	callq	hipMalloc
.Ltmp15:
# %bb.16:
	movq	16(%rsp), %rdi
.Ltmp16:
	.cfi_escape 0x2e, 0x00
	movl	$47040, %edx                    # imm = 0xB7C0
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp17:
# %bb.17:
.Ltmp19:
	.cfi_escape 0x2e, 0x00
	leaq	48(%rsp), %rdi
	callq	hipEventCreate
.Ltmp20:
# %bb.18:
.Ltmp21:
	.cfi_escape 0x2e, 0x00
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
.Ltmp22:
# %bb.19:
.Ltmp24:
	.cfi_escape 0x2e, 0x30
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	$1, %eax
	leaq	32(%rsp), %rdi
	leaq	72(%rsp), %rdx
	movl	$2, %esi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	xorl	%r9d, %r9d
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	$41
	.cfi_adjust_cfa_offset 8
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	$0
	.cfi_adjust_cfa_offset 8
	callq	hipfftPlanMany
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.Ltmp25:
# %bb.20:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rdx
.Ltmp26:
	.cfi_escape 0x2e, 0x00
	movq	%rdx, %rsi
	movl	$-1, %ecx
	callq	hipfftExecC2C
.Ltmp27:
# %bb.21:
	movq	48(%rsp), %rdi
.Ltmp28:
	.cfi_escape 0x2e, 0x00
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp29:
# %bb.22:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rdx
.Ltmp30:
	.cfi_escape 0x2e, 0x00
	movq	%rdx, %rsi
	movl	$1, %ecx
	callq	hipfftExecC2C
.Ltmp31:
# %bb.23:
.Ltmp33:
	.cfi_escape 0x2e, 0x00
	movabsq	$4294967302, %rdi               # imm = 0x100000006
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp34:
# %bb.24:
	testl	%eax, %eax
	jne	.LBB0_26
# %bb.25:
	movq	16(%rsp), %rdi
.Ltmp35:
	.cfi_escape 0x2e, 0x00
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movq	%rdi, %rsi
	movl	$5880, %edx                     # imm = 0x16F8
	callq	_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
.Ltmp36:
.LBB0_26:
	movq	32(%rsp), %rdi
.Ltmp37:
	.cfi_escape 0x2e, 0x00
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp38:
# %bb.27:
	movq	32(%rsp), %rdi
.Ltmp39:
	.cfi_escape 0x2e, 0x00
	callq	hipEventSynchronize
.Ltmp40:
# %bb.28:
	leaq	44(%rsp), %rdi
	movl	$0, (%rdi)
	movq	48(%rsp), %rsi
	movq	32(%rsp), %rdx
.Ltmp42:
	.cfi_escape 0x2e, 0x00
	callq	hipEventElapsedTime
.Ltmp43:
# %bb.29:
.Ltmp44:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp45:
# %bb.30:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit62
	xorps	%xmm0, %xmm0
	cvtss2sd	44(%rsp), %xmm0
.Ltmp46:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp47:
# %bb.31:                               # %_ZNSolsEf.exit
.Ltmp48:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.3, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp49:
# %bb.32:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit63
.Ltmp50:
	.cfi_escape 0x2e, 0x00
	callq	hipDeviceSynchronize
.Ltmp51:
# %bb.33:
	movq	16(%rsp), %rsi
.Ltmp52:
	.cfi_escape 0x2e, 0x00
	movl	$47040, %edx                    # imm = 0xB7C0
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp53:
# %bb.34:
.Ltmp55:
	.cfi_escape 0x2e, 0x00
	leaq	72(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp56:
# %bb.35:
.Ltmp58:
	.cfi_escape 0x2e, 0x00
	leaq	72(%rsp), %rdi
	movl	$.L.str.4, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp59:
# %bb.36:                               # %.preheader.preheader
	movq	%rbx, 56(%rsp)                  # 8-byte Spill
	movq	%rbx, %r13
	addq	$4, %r13
	xorl	%ebp, %ebp
	leaq	72(%rsp), %r14
	leaq	15(%rsp), %r15
.LBB0_37:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_38 Depth 2
	xorl	%ebx, %ebx
.LBB0_38:                               #   Parent Loop BB0_37 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	-4(%r13,%rbx,8), %xmm0
.Ltmp60:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp61:
# %bb.39:                               # %_ZNSolsEf.exit64
                                        #   in Loop: Header=BB0_38 Depth=2
	movq	%rax, %r12
	movb	$44, 15(%rsp)
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%r12,%rax)
	je	.LBB0_42
# %bb.40:                               #   in Loop: Header=BB0_38 Depth=2
.Ltmp62:
	.cfi_escape 0x2e, 0x00
	movl	$1, %edx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp63:
# %bb.41:                               #   in Loop: Header=BB0_38 Depth=2
	movq	%rax, %r12
	jmp	.LBB0_43
.LBB0_42:                               #   in Loop: Header=BB0_38 Depth=2
.Ltmp64:
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	movl	$44, %esi
	callq	_ZNSo3putEc
.Ltmp65:
.LBB0_43:                               #   in Loop: Header=BB0_38 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13,%rbx,8), %xmm0
.Ltmp66:
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp67:
# %bb.44:                               # %_ZNSolsEf.exit67
                                        #   in Loop: Header=BB0_38 Depth=2
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp68:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp69:
# %bb.45:                               # %.noexc73
                                        #   in Loop: Header=BB0_38 Depth=2
.Ltmp70:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
.Ltmp71:
# %bb.46:                               # %.noexc74
                                        #   in Loop: Header=BB0_38 Depth=2
.Ltmp72:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp73:
# %bb.47:                               # %_ZNSolsEPFRSoS_E.exit69
                                        #   in Loop: Header=BB0_38 Depth=2
	incq	%rbx
	cmpq	$840, %rbx                      # imm = 0x348
	jne	.LBB0_38
# %bb.48:                               #   in Loop: Header=BB0_37 Depth=1
	incq	%rbp
	addq	$6720, %r13                     # imm = 0x1A40
	cmpq	$7, %rbp
	jne	.LBB0_37
# %bb.49:
	movq	24(%rsp), %rdi
.Ltmp75:
	.cfi_escape 0x2e, 0x00
	callq	hipfftDestroy
.Ltmp76:
	movq	56(%rsp), %rdi                  # 8-byte Reload
# %bb.50:
	.cfi_escape 0x2e, 0x00
	callq	free
	movq	16(%rsp), %rdi
.Ltmp77:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp78:
# %bb.51:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	80(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 72(%rsp,%rax)
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	320(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt8ios_baseD2Ev
	.cfi_escape 0x2e, 0x00
	leaq	584(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$24632, %rsp                    # imm = 0x6038
	.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
.LBB0_52:
	.cfi_def_cfa_offset 24688
.Ltmp57:
	jmp	.LBB0_57
.LBB0_53:
.Ltmp23:
	jmp	.LBB0_57
.LBB0_54:
.Ltmp18:
	jmp	.LBB0_57
.LBB0_55:
.Ltmp79:
	jmp	.LBB0_63
.LBB0_56:
.Ltmp13:
	jmp	.LBB0_57
.LBB0_58:
.Ltmp41:
	jmp	.LBB0_57
.LBB0_59:
.Ltmp32:
	jmp	.LBB0_57
.LBB0_60:
.Ltmp54:
	jmp	.LBB0_57
.LBB0_61:
.Ltmp10:
.LBB0_57:
	movq	%rax, %rbx
	jmp	.LBB0_64
.LBB0_62:
.Ltmp74:
.LBB0_63:
	movq	%rax, %rbx
	.cfi_escape 0x2e, 0x00
	leaq	72(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB0_64:
	.cfi_escape 0x2e, 0x00
	leaq	584(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table0:
.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 .Ltmp7-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp7
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp9-.Ltmp8                  #   Call between .Ltmp8 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp12-.Ltmp11                #   Call between .Ltmp11 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp17-.Ltmp14                #   Call between .Ltmp14 and .Ltmp17
	.uleb128 .Ltmp18-.Lfunc_begin0          #     jumps to .Ltmp18
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp22-.Ltmp19                #   Call between .Ltmp19 and .Ltmp22
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp31-.Ltmp24                #   Call between .Ltmp24 and .Ltmp31
	.uleb128 .Ltmp32-.Lfunc_begin0          #     jumps to .Ltmp32
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp33-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp40-.Ltmp33                #   Call between .Ltmp33 and .Ltmp40
	.uleb128 .Ltmp41-.Lfunc_begin0          #     jumps to .Ltmp41
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp42-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp53-.Ltmp42                #   Call between .Ltmp42 and .Ltmp53
	.uleb128 .Ltmp54-.Lfunc_begin0          #     jumps to .Ltmp54
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp55-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp56-.Ltmp55                #   Call between .Ltmp55 and .Ltmp56
	.uleb128 .Ltmp57-.Lfunc_begin0          #     jumps to .Ltmp57
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp58-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp59-.Ltmp58                #   Call between .Ltmp58 and .Ltmp59
	.uleb128 .Ltmp79-.Lfunc_begin0          #     jumps to .Ltmp79
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp73-.Ltmp60                #   Call between .Ltmp60 and .Ltmp73
	.uleb128 .Ltmp74-.Lfunc_begin0          #     jumps to .Ltmp74
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp75-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp78-.Ltmp75                #   Call between .Ltmp75 and .Ltmp78
	.uleb128 .Ltmp79-.Lfunc_begin0          #     jumps to .Ltmp79
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp78-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Lfunc_end0-.Ltmp78            #   Call between .Ltmp78 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.type	_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,@function # -- Begin function _ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if: # @_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.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	8(%rsp), %rdx
	movss	%xmm0, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%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	$_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if, %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	_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if, .Lfunc_end1-_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"../data/speedData.txt"
	.size	.L.str, 22

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"faild to read data."
	.size	.L.str.1, 20

	.type	_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,@object # @_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if:
	.quad	_ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.size	_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if, 8

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"GPU FFT time used: "
	.size	.L.str.2, 20

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" ms\n"
	.size	.L.str.3, 5

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"../data/2d_batch_inverse.txt"
	.size	.L.str.4, 29

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if"
	.size	.L__unnamed_1, 53

	.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 __gxx_personality_v0
	.addrsig_sym _ZL32__device_stub__cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.section	.text._ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,"axG",@progbits,_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,comdat
	.globl	_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if ; -- Begin function _ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
	.p2align	8
	.type	_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,@function
_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if: ; @_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_load_b32 v4, v[2:3], off
	s_waitcnt vmcnt(0)
	v_mul_f32_e32 v4, s3, v4
	global_store_b32 v[0:1], v4, off
	global_load_b32 v2, v[2:3], off offset:4
	s_waitcnt vmcnt(0)
	v_mul_f32_e32 v2, s3, v2
	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 _ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.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 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.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
	.section	.text._ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,"axG",@progbits,_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if,comdat
.Lfunc_end0:
	.size	_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if, .Lfunc_end0-_ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 172
; 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: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .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:           _ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _ZL17cufftComplexScaleP15HIP_vector_typeIfLj2EES1_if.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
