#include <iostream>
#include <cuda_runtime.h>
#include <cufft.h>
#include <cufftXt.h>
#include <vector>

// Define a complex number type for convenience
typedef float2 Complex;

// CUDA kernel for sparse FFT computation
__global__ void sparse_fft_kernel(Complex* d_data, int* d_indices, int num_elements, int N) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < num_elements) {
        int index = d_indices[idx];
        // Perform a simple transformation, in practice this would be more complex
        d_data[index].x *= 0.5f;
        d_data[index].y *= 0.5f;
    }
}

// Function to check CUDA errors
void checkCudaError(cudaError_t err, const char* msg) {
    if (err != cudaSuccess) {
        std::cerr << "CUDA error: " << msg << " - " << cudaGetErrorString(err) << std::endl;
        exit(EXIT_FAILURE);
    }
}

// Function to check cuFFT errors
void checkCufftError(cufftResult err, const char* msg) {
    if (err != CUFFT_SUCCESS) {
        std::cerr << "cuFFT error: " << msg << std::endl;
        exit(EXIT_FAILURE);
    }
}

int main() {
    // Problem size and number of GPUs
    int N = 1024;
    int num_gpus = 2;

    // Initialize CUDA devices
    cudaDeviceProp prop;
    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        cudaGetDeviceProperties(&prop, i);
        std::cout << "Using device " << i << ": " << prop.name << std::endl;
    }

    // Allocate host memory
    std::vector<Complex> h_data(N);
    std::vector<int> h_indices(N);
    for (int i = 0; i < N; ++i) {
        h_data[i].x = static_cast<float>(i);
        h_data[i].y = 0.0f;
        h_indices[i] = i; // In practice, these would be non-sequential
    }

    // Allocate device memory and copy data
    std::vector<Complex*> d_data(num_gpus);
    std::vector<int*> d_indices(num_gpus);
    std::vector<cufftHandle> fft_plans(num_gpus);
    int elements_per_gpu = N / num_gpus;

    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        checkCudaError(cudaMalloc(&d_data[i], elements_per_gpu * sizeof(Complex)), "cudaMalloc d_data");
        checkCudaError(cudaMalloc(&d_indices[i], elements_per_gpu * sizeof(int)), "cudaMalloc d_indices");
        checkCudaError(cudaMemcpy(d_data[i], h_data.data() + i * elements_per_gpu, elements_per_gpu * sizeof(Complex), cudaMemcpyHostToDevice), "cudaMemcpy d_data");
        checkCudaError(cudaMemcpy(d_indices[i], h_indices.data() + i * elements_per_gpu, elements_per_gpu * sizeof(int), cudaMemcpyHostToDevice), "cudaMemcpy d_indices");

        // Create cuFFT plan
        checkCufftError(cufftPlan1d(&fft_plans[i], elements_per_gpu, CUFFT_C2C, 1), "cufftPlan1d");
    }

    // Launch kernel for sparse FFT computation
    int blockSize = 256;
    int numBlocks = (elements_per_gpu + blockSize - 1) / blockSize;

    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        sparse_fft_kernel<<<numBlocks, blockSize>>>(d_data[i], d_indices[i], elements_per_gpu, N);
        checkCudaError(cudaGetLastError(), "sparse_fft_kernel launch failed");
        checkCudaError(cudaDeviceSynchronize(), "cudaDeviceSynchronize failed");
    }

    // Execute FFT on each GPU
    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        checkCufftError(cufftExecC2C(fft_plans[i], reinterpret_cast<cufftComplex*>(d_data[i]), reinterpret_cast<cufftComplex*>(d_data[i]), CUFFT_FORWARD), "cufftExecC2C");
    }

    // Copy results back to host
    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        checkCudaError(cudaMemcpy(h_data.data() + i * elements_per_gpu, d_data[i], elements_per_gpu * sizeof(Complex), cudaMemcpyDeviceToHost), "cudaMemcpy h_data");
    }

    // Clean up
    for (int i = 0; i < num_gpus; ++i) {
        cudaSetDevice(i);
        cudaFree(d_data[i]);
        cudaFree(d_indices[i]);
        cufftDestroy(fft_plans[i]);
    }

    // Output results (first few elements)
    std::cout << "First 10 transformed elements:" << std::endl;
    for (int i = 0; i < 10; ++i) {
        std::cout << h_data[i].x << " + " << h_data[i].y << "i" << std::endl;
    }

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

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4027:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4027:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4979:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4979:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA error: "
.LC1:
	.string	" - "
	.text
	.globl	_Z14checkCudaError9cudaErrorPKc
	.type	_Z14checkCudaError9cudaErrorPKc, @function
_Z14checkCudaError9cudaErrorPKc:
.LFB4022:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L3
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	leaq	.LC0(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	leaq	_ZSt4cerr(%rip), %rdi
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1, %edi
	call	exit@PLT
.L3:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE4022:
	.size	_Z14checkCudaError9cudaErrorPKc, .-_Z14checkCudaError9cudaErrorPKc
	.section	.rodata.str1.1
.LC2:
	.string	"cuFFT error: "
	.text
	.globl	_Z15checkCufftError13cufftResult_tPKc
	.type	_Z15checkCufftError13cufftResult_tPKc, @function
_Z15checkCufftError13cufftResult_tPKc:
.LFB4023:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L9
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZSt4cerr(%rip), %rdi
	movq	%rsi, %rbx
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1, %edi
	call	exit@PLT
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE4023:
	.size	_Z15checkCufftError13cufftResult_tPKc, .-_Z15checkCufftError13cufftResult_tPKc
	.globl	_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii
	.type	_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii, @function
_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii:
.LFB4049:
	.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
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%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	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	.L14
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17sparse_fft_kernelP6float2Piii(%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
.L14:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4049:
	.size	_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii, .-_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii
	.globl	_Z17sparse_fft_kernelP6float2Piii
	.type	_Z17sparse_fft_kernelP6float2Piii, @function
_Z17sparse_fft_kernelP6float2Piii:
.LFB4050:
	.cfi_startproc
	endbr64
	jmp	_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii
	.cfi_endproc
.LFE4050:
	.size	_Z17sparse_fft_kernelP6float2Piii, .-_Z17sparse_fft_kernelP6float2Piii
	.section	.rodata.str1.1
.LC3:
	.string	"_Z17sparse_fft_kernelP6float2Piii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4052:
	.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	.LC3(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z17sparse_fft_kernelP6float2Piii(%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
.LFE4052:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorI6float2SaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorI6float2SaIS0_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorI6float2SaIS0_EED2Ev
	.type	_ZNSt6vectorI6float2SaIS0_EED2Ev, @function
_ZNSt6vectorI6float2SaIS0_EED2Ev:
.LFB4365:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L21
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L21:
	ret
	.cfi_endproc
.LFE4365:
	.size	_ZNSt6vectorI6float2SaIS0_EED2Ev, .-_ZNSt6vectorI6float2SaIS0_EED2Ev
	.weak	_ZNSt6vectorI6float2SaIS0_EED1Ev
	.set	_ZNSt6vectorI6float2SaIS0_EED1Ev,_ZNSt6vectorI6float2SaIS0_EED2Ev
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB4377:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L23
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L23:
	ret
	.cfi_endproc
.LFE4377:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.text._ZNSt6vectorIP6float2SaIS1_EED2Ev,"axG",@progbits,_ZNSt6vectorIP6float2SaIS1_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIP6float2SaIS1_EED2Ev
	.type	_ZNSt6vectorIP6float2SaIS1_EED2Ev, @function
_ZNSt6vectorIP6float2SaIS1_EED2Ev:
.LFB4391:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L25
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L25:
	ret
	.cfi_endproc
.LFE4391:
	.size	_ZNSt6vectorIP6float2SaIS1_EED2Ev, .-_ZNSt6vectorIP6float2SaIS1_EED2Ev
	.weak	_ZNSt6vectorIP6float2SaIS1_EED1Ev
	.set	_ZNSt6vectorIP6float2SaIS1_EED1Ev,_ZNSt6vectorIP6float2SaIS1_EED2Ev
	.section	.text._ZNSt6vectorIPiSaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorIPiSaIS0_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIPiSaIS0_EED2Ev
	.type	_ZNSt6vectorIPiSaIS0_EED2Ev, @function
_ZNSt6vectorIPiSaIS0_EED2Ev:
.LFB4403:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L27
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L27:
	ret
	.cfi_endproc
.LFE4403:
	.size	_ZNSt6vectorIPiSaIS0_EED2Ev, .-_ZNSt6vectorIPiSaIS0_EED2Ev
	.weak	_ZNSt6vectorIPiSaIS0_EED1Ev
	.set	_ZNSt6vectorIPiSaIS0_EED1Ev,_ZNSt6vectorIPiSaIS0_EED2Ev
	.section	.rodata.str1.1
.LC4:
	.string	"Using device "
.LC5:
	.string	": "
.LC7:
	.string	"cudaMalloc d_data"
.LC8:
	.string	"cudaMalloc d_indices"
.LC9:
	.string	"cudaMemcpy d_data"
.LC10:
	.string	"cudaMemcpy d_indices"
.LC11:
	.string	"cufftPlan1d"
.LC12:
	.string	"sparse_fft_kernel launch failed"
.LC13:
	.string	"cudaDeviceSynchronize failed"
.LC14:
	.string	"cufftExecC2C"
.LC15:
	.string	"cudaMemcpy h_data"
.LC16:
	.string	"First 10 transformed elements:"
.LC17:
	.string	" + "
.LC18:
	.string	"i"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4024:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4024
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	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
	leaq	.LC4(%rip), %rbx
	subq	$1240, %rsp
	.cfi_def_cfa_offset 1296
	movq	%fs:40, %rax
	movq	%rax, 1224(%rsp)
	xorl	%eax, %eax
.L30:
	movl	%r15d, %edi
	leaq	192(%rsp), %rbp
.LEHB0:
	call	cudaSetDevice@PLT
	movl	%r15d, %esi
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movq	%rbx, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r15d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC5(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	testl	%r15d, %r15d
	jne	.L62
	movl	$1, %r15d
	jmp	.L30
.L62:
	movl	$8192, %edi
	xorl	%r13d, %r13d
	call	_Znwm@PLT
.LEHE0:
	leaq	8192(%rax), %rdx
	movq	%rax, 72(%rsp)
	movq	%rax, %rbx
	movq	%rdx, 88(%rsp)
	movq	%r13, (%rax)
	xorl	%eax, %eax
.L31:
	addq	$8, %rax
	cmpq	$8192, %rax
	je	.L63
	movq	(%rbx), %rcx
	movq	%rcx, (%rbx,%rax)
	jmp	.L31
.L63:
	xorl	%r12d, %r12d
	movl	$4096, %edi
	movq	%rdx, 80(%rsp)
	movq	%r12, 104(%rsp)
	movq	%r12, 112(%rsp)
.LEHB1:
	call	_Znwm@PLT
.LEHE1:
	leaq	4096(%rax), %rdx
	xorl	%ebp, %ebp
	movq	%rax, 96(%rsp)
	movq	%rax, %r14
	movq	%rdx, 112(%rsp)
	movl	%ebp, (%rax)
	xorl	%eax, %eax
.L33:
	addq	$4, %rax
	cmpq	$4096, %rax
	je	.L64
	xorl	%r11d, %r11d
	movl	%r11d, (%r14,%rax)
	jmp	.L33
.L64:
	movq	%rdx, 104(%rsp)
	xorl	%eax, %eax
.L35:
	cvtsi2ssl	%eax, %xmm0
	movl	$0x00000000, 4(%rbx,%rax,8)
	movl	%eax, (%r14,%rax,4)
	movss	%xmm0, (%rbx,%rax,8)
	incq	%rax
	cmpq	$1024, %rax
	jne	.L35
	xorl	%r10d, %r10d
	movl	$16, %edi
	movq	%r10, 128(%rsp)
	movq	%r10, 136(%rsp)
.LEHB2:
	call	_Znwm@PLT
.LEHE2:
	movq	%rax, %rbp
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	movq	%rax, 120(%rsp)
	movq	%r8, 0(%rbp)
	leaq	16(%rax), %rax
	movl	$16, %edi
	movq	%r8, 8(%rbp)
	movq	%rax, 136(%rsp)
	movq	%rax, 128(%rsp)
	movq	%r9, 152(%rsp)
	movq	%r9, 160(%rsp)
.LEHB3:
	call	_Znwm@PLT
.LEHE3:
	movq	%rax, %r13
	xorl	%esi, %esi
	xorl	%edi, %edi
	movq	%rax, 144(%rsp)
	movq	%rsi, 0(%r13)
	leaq	16(%rax), %rax
	movq	%rsi, 8(%r13)
	movq	%rdi, 176(%rsp)
	movq	%rdi, 184(%rsp)
	movl	$8, %edi
	movq	%rax, 160(%rsp)
	movq	%rax, 152(%rsp)
.LEHB4:
	call	_Znwm@PLT
.LEHE4:
	movq	%rax, %r12
	movq	%rax, 168(%rsp)
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	leaq	8(%rax), %rax
	movq	%rdx, (%r12)
	movq	%rax, 184(%rsp)
	movq	%rax, 176(%rsp)
	movq	%r12, 40(%rsp)
	movq	%r13, 8(%rsp)
	movq	%rbx, 24(%rsp)
	movl	%ecx, 20(%rsp)
	movq	%r14, 32(%rsp)
	movq	%rbp, %r14
.L36:
	movl	20(%rsp), %edi
.LEHB5:
	call	cudaSetDevice@PLT
	movl	$4096, %esi
	movq	%r14, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	leaq	.LC7(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	8(%rsp), %rdi
	movl	$2048, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	leaq	.LC8(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	24(%rsp), %rsi
	movq	(%r14), %rdi
	movl	$1, %ecx
	movl	$4096, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	leaq	.LC9(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	8(%rsp), %rax
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movl	$2048, %edx
	movq	(%rax), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	leaq	.LC10(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$41, %edx
	movl	$512, %esi
	call	cufftPlan1d@PLT
	movl	%eax, %edi
	leaq	.LC11(%rip), %rsi
	call	_Z15checkCufftError13cufftResult_tPKc
	addq	$4, 40(%rsp)
	addq	$8, %r14
	addq	$8, 8(%rsp)
	addq	$2048, 32(%rsp)
	addq	$4096, 24(%rsp)
	cmpl	$0, 20(%rsp)
	jne	.L65
	movl	%r15d, 20(%rsp)
	jmp	.L36
.L65:
	movabsq	$4294967552, %r15
	xorl	%r14d, %r14d
.L40:
	movl	%r14d, %edi
	call	cudaSetDevice@PLT
	movl	$2147483649, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movl	$1, %ecx
	addq	%rdi, %rdi
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L37
.L39:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	leaq	.LC12(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	jmp	.L66
.L37:
	movq	0(%r13,%r14,8), %rsi
	movq	0(%rbp,%r14,8), %rdi
	movl	$1024, %ecx
	movl	$512, %edx
	call	_Z47__device_stub__Z17sparse_fft_kernelP6float2PiiiP6float2Piii
	jmp	.L39
.L66:
	call	cudaDeviceSynchronize@PLT
	movl	%eax, %edi
	leaq	.LC13(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	testq	%r14, %r14
	jne	.L67
	movl	$1, %r14d
	jmp	.L40
.L67:
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movq	0(%rbp), %rsi
	movl	(%r12), %edi
	orl	$-1, %ecx
	movq	%rsi, %rdx
	call	cufftExecC2C@PLT
	leaq	.LC14(%rip), %r14
	movl	%eax, %edi
	movq	%r14, %rsi
	call	_Z15checkCufftError13cufftResult_tPKc
	movl	$1, %edi
	call	cudaSetDevice@PLT
	movq	8(%rbp), %rsi
	movl	4(%r12), %edi
	orl	$-1, %ecx
	movq	%rsi, %rdx
	call	cufftExecC2C@PLT
	movl	%eax, %edi
	movq	%r14, %rsi
	call	_Z15checkCufftError13cufftResult_tPKc
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movq	0(%rbp), %rsi
	movl	$2, %ecx
	movl	$4096, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	leaq	.LC15(%rip), %r14
	movl	%eax, %edi
	movq	%r14, %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movl	$1, %edi
	call	cudaSetDevice@PLT
	movq	8(%rbp), %rsi
	movl	$2, %ecx
	movl	$4096, %edx
	leaq	4096(%rbx), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	movq	%r14, %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movq	0(%rbp), %rdi
	call	cudaFree@PLT
	movq	0(%r13), %rdi
	call	cudaFree@PLT
	movl	(%r12), %edi
	call	cufftDestroy@PLT
	movl	$1, %edi
	call	cudaSetDevice@PLT
	movq	8(%rbp), %rdi
	call	cudaFree@PLT
	movq	8(%r13), %rdi
	call	cudaFree@PLT
	movl	4(%r12), %edi
	call	cufftDestroy@PLT
	leaq	_ZSt4cout(%rip), %r12
	leaq	.LC16(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	xorl	%ebp, %ebp
	leaq	.LC17(%rip), %r13
.L41:
	movq	%r12, %rdi
	cvtss2sd	(%rbx,%rbp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	4(%rbx,%rbp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC18(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE5:
	addq	$8, %rbp
	cmpq	$80, %rbp
	jne	.L41
	leaq	168(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	leaq	144(%rsp), %rdi
	call	_ZNSt6vectorIPiSaIS0_EED1Ev
	leaq	120(%rsp), %rdi
	call	_ZNSt6vectorIP6float2SaIS1_EED1Ev
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorI6float2SaIS0_EED1Ev
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	jmp	.L60
.L56:
	endbr64
	movq	%rax, %rbx
.L42:
	leaq	168(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L43
.L55:
	endbr64
	movq	%rax, %rbx
.L43:
	leaq	144(%rsp), %rdi
	call	_ZNSt6vectorIPiSaIS0_EED1Ev
	jmp	.L44
.L54:
	endbr64
	movq	%rax, %rbx
.L44:
	leaq	120(%rsp), %rdi
	call	_ZNSt6vectorIP6float2SaIS1_EED1Ev
	jmp	.L45
.L53:
	endbr64
	movq	%rax, %rbx
.L45:
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L46
.L52:
	endbr64
	movq	%rax, %rbx
.L46:
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorI6float2SaIS0_EED1Ev
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L60:
	call	__stack_chk_fail@PLT
.L48:
	addq	$1240, %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
.LFE4024:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4024:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4024-.LLSDACSB4024
.LLSDACSB4024:
	.uleb128 .LEHB0-.LFB4024
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4024
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L52-.LFB4024
	.uleb128 0
	.uleb128 .LEHB2-.LFB4024
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L53-.LFB4024
	.uleb128 0
	.uleb128 .LEHB3-.LFB4024
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L54-.LFB4024
	.uleb128 0
	.uleb128 .LEHB4-.LFB4024
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L55-.LFB4024
	.uleb128 0
	.uleb128 .LEHB5-.LFB4024
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L56-.LFB4024
	.uleb128 0
	.uleb128 .LEHB6-.LFB4024
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE4024:
	.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
	.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 <iostream>
#include <hip/hip_runtime.h>
#include <hipfft/hipfft.h>
#include <hipfft/hipfftXt.h>
#include <vector>

// Define a complex number type for convenience
typedef float2 Complex;

// CUDA kernel for sparse FFT computation
__global__ void sparse_fft_kernel(Complex* d_data, int* d_indices, int num_elements, int N) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < num_elements) {
        int index = d_indices[idx];
        // Perform a simple transformation, in practice this would be more complex
        d_data[index].x *= 0.5f;
        d_data[index].y *= 0.5f;
    }
}

// Function to check CUDA errors
void checkCudaError(hipError_t err, const char* msg) {
    if (err != hipSuccess) {
        std::cerr << "CUDA error: " << msg << " - " << hipGetErrorString(err) << std::endl;
        exit(EXIT_FAILURE);
    }
}

// Function to check cuFFT errors
void checkCufftError(hipfftResult err, const char* msg) {
    if (err != HIPFFT_SUCCESS) {
        std::cerr << "cuFFT error: " << msg << std::endl;
        exit(EXIT_FAILURE);
    }
}

int main() {
    // Problem size and number of GPUs
    int N = 1024;
    int num_gpus = 2;

    // Initialize CUDA devices
    hipDeviceProp_t prop;
    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        hipGetDeviceProperties(&prop, i);
        std::cout << "Using device " << i << ": " << prop.name << std::endl;
    }

    // Allocate host memory
    std::vector<Complex> h_data(N);
    std::vector<int> h_indices(N);
    for (int i = 0; i < N; ++i) {
        h_data[i].x = static_cast<float>(i);
        h_data[i].y = 0.0f;
        h_indices[i] = i; // In practice, these would be non-sequential
    }

    // Allocate device memory and copy data
    std::vector<Complex*> d_data(num_gpus);
    std::vector<int*> d_indices(num_gpus);
    std::vector<hipfftHandle> fft_plans(num_gpus);
    int elements_per_gpu = N / num_gpus;

    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        checkCudaError(hipMalloc(&d_data[i], elements_per_gpu * sizeof(Complex)), "hipMalloc d_data");
        checkCudaError(hipMalloc(&d_indices[i], elements_per_gpu * sizeof(int)), "hipMalloc d_indices");
        checkCudaError(hipMemcpy(d_data[i], h_data.data() + i * elements_per_gpu, elements_per_gpu * sizeof(Complex), hipMemcpyHostToDevice), "hipMemcpy d_data");
        checkCudaError(hipMemcpy(d_indices[i], h_indices.data() + i * elements_per_gpu, elements_per_gpu * sizeof(int), hipMemcpyHostToDevice), "hipMemcpy d_indices");

        // Create cuFFT plan
        checkCufftError(hipfftPlan1d(&fft_plans[i], elements_per_gpu, HIPFFT_C2C, 1), "hipfftPlan1d");
    }

    // Launch kernel for sparse FFT computation
    int blockSize = 256;
    int numBlocks = (elements_per_gpu + blockSize - 1) / blockSize;

    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        sparse_fft_kernel<<<numBlocks, blockSize>>>(d_data[i], d_indices[i], elements_per_gpu, N);
        checkCudaError(hipGetLastError(), "sparse_fft_kernel launch failed");
        checkCudaError(hipDeviceSynchronize(), "hipDeviceSynchronize failed");
    }

    // Execute FFT on each GPU
    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        checkCufftError(hipfftExecC2C(fft_plans[i], reinterpret_cast<hipfftComplex*>(d_data[i]), reinterpret_cast<hipfftComplex*>(d_data[i]), HIPFFT_FORWARD), "hipfftExecC2C");
    }

    // Copy results back to host
    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        checkCudaError(hipMemcpy(h_data.data() + i * elements_per_gpu, d_data[i], elements_per_gpu * sizeof(Complex), hipMemcpyDeviceToHost), "hipMemcpy h_data");
    }

    // Clean up
    for (int i = 0; i < num_gpus; ++i) {
        hipSetDevice(i);
        hipFree(d_data[i]);
        hipFree(d_indices[i]);
        hipfftDestroy(fft_plans[i]);
    }

    // Output results (first few elements)
    std::cout << "First 10 transformed elements:" << std::endl;
    for (int i = 0; i < 10; ++i) {
        std::cout << h_data[i].x << " + " << h_data[i].y << "i" << std::endl;
    }

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

                                        # End of file scope inline assembly
	.globl	_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii # -- Begin function _Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.type	_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii,@function
_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii: # @_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.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	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%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	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	$_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii, %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	_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii, .Lfunc_end0-_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z14checkCudaError10hipError_tPKc # -- Begin function _Z14checkCudaError10hipError_tPKc
	.type	_Z14checkCudaError10hipError_tPKc,@function
_Z14checkCudaError10hipError_tPKc:      # @_Z14checkCudaError10hipError_tPKc
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB1_2
# %bb.1:
	retq
.LBB1_2:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rsi, %r14
	movl	%edi, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z14checkCudaError10hipError_tPKc, .Lfunc_end1-_Z14checkCudaError10hipError_tPKc
	.cfi_endproc
                                        # -- End function
	.globl	_Z15checkCufftError14hipfftResult_tPKc # -- Begin function _Z15checkCufftError14hipfftResult_tPKc
	.type	_Z15checkCufftError14hipfftResult_tPKc,@function
_Z15checkCufftError14hipfftResult_tPKc: # @_Z15checkCufftError14hipfftResult_tPKc
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB2_2
# %bb.1:
	retq
.LBB2_2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.2, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z15checkCufftError14hipfftResult_tPKc, .Lfunc_end2-_Z15checkCufftError14hipfftResult_tPKc
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI3_0:
	.zero	16
	.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	$1496, %rsp                     # imm = 0x5D8
	.cfi_def_cfa_offset 1552
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%ebp, %ebp
	movb	$1, %r15b
	leaq	24(%rsp), %rbx
.LBB3_1:                                # =>This Inner Loop Header: Depth=1
	movl	%ebp, %edi
	callq	hipSetDevice
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movl	$.L.str.4, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	callq	strlen
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$1, %ebp
	testb	$1, %r15b
	movl	$0, %r15d
	jne	.LBB3_1
# %bb.2:
	movl	$8192, %edi                     # imm = 0x2000
	callq	_Znwm
	movq	%rax, %rbx
	movl	$8192, %edx                     # imm = 0x2000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
.Ltmp0:
	movl	$4096, %edi                     # imm = 0x1000
	callq	_Znwm
.Ltmp1:
# %bb.3:
	movq	%rax, %r15
	xorl	%r14d, %r14d
	movl	$4096, %edx                     # imm = 0x1000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
.LBB3_4:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r14d, %xmm0
	movss	%xmm0, (%rbx,%r14,8)
	movl	$0, 4(%rbx,%r14,8)
	movl	%r14d, (%r15,%r14,4)
	incq	%r14
	cmpq	$1024, %r14                     # imm = 0x400
	jne	.LBB3_4
# %bb.5:
.Ltmp3:
	movq	%r15, 16(%rsp)                  # 8-byte Spill
	movl	$16, %edi
	callq	_Znwm
.Ltmp4:
# %bb.6:
	movq	%rax, %r15
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
.Ltmp6:
	movl	$16, %edi
	callq	_Znwm
.Ltmp7:
# %bb.7:
	movq	%rax, (%rsp)                    # 8-byte Spill
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
.Ltmp9:
	movl	$16, %edi
	callq	_Znwm
.Ltmp10:
# %bb.8:
	xorps	%xmm0, %xmm0
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movups	%xmm0, (%rax)
	movb	$1, %r13b
	xorl	%ebp, %ebp
.LBB3_9:                                # =>This Inner Loop Header: Depth=1
.Ltmp12:
	movl	%ebp, %edi
	callq	hipSetDevice
.Ltmp13:
# %bb.10:                               #   in Loop: Header=BB3_9 Depth=1
	leaq	(%r15,%rbp,8), %r12
.Ltmp14:
	movl	$4096, %esi                     # imm = 0x1000
	movq	%r12, %rdi
	callq	hipMalloc
.Ltmp15:
# %bb.11:                               # %_ZL9hipMallocI15HIP_vector_typeIfLj2EEE10hipError_tPPT_m.exit
                                        #   in Loop: Header=BB3_9 Depth=1
.Ltmp16:
	movl	$.L.str.5, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp17:
# %bb.12:                               #   in Loop: Header=BB3_9 Depth=1
	movq	(%rsp), %rax                    # 8-byte Reload
	leaq	(%rax,%rbp,8), %r14
.Ltmp18:
	movl	$2048, %esi                     # imm = 0x800
	movq	%r14, %rdi
	callq	hipMalloc
.Ltmp19:
# %bb.13:                               # %_ZL9hipMallocIiE10hipError_tPPT_m.exit
                                        #   in Loop: Header=BB3_9 Depth=1
.Ltmp20:
	movl	$.L.str.6, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp21:
# %bb.14:                               #   in Loop: Header=BB3_9 Depth=1
	movq	(%r12), %rdi
	movq	%rbp, %rsi
	shlq	$12, %rsi
	addq	%rbx, %rsi
.Ltmp22:
	movl	$4096, %edx                     # imm = 0x1000
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp23:
# %bb.15:                               #   in Loop: Header=BB3_9 Depth=1
.Ltmp24:
	movl	$.L.str.7, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp25:
# %bb.16:                               #   in Loop: Header=BB3_9 Depth=1
	movq	%rbp, %rax
	shlq	$9, %rax
	movq	(%r14), %rdi
	movq	16(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
.Ltmp26:
	movl	$2048, %edx                     # imm = 0x800
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp27:
# %bb.17:                               #   in Loop: Header=BB3_9 Depth=1
.Ltmp28:
	movl	$.L.str.8, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp29:
# %bb.18:                               #   in Loop: Header=BB3_9 Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	leaq	(%rax,%rbp,8), %rdi
.Ltmp30:
	movl	$512, %esi                      # imm = 0x200
	movl	$41, %edx
	movl	$1, %ecx
	callq	hipfftPlan1d
.Ltmp31:
# %bb.19:                               #   in Loop: Header=BB3_9 Depth=1
.Ltmp32:
	movl	$.L.str.9, %esi
	movl	%eax, %edi
	callq	_Z15checkCufftError14hipfftResult_tPKc
.Ltmp33:
# %bb.20:                               #   in Loop: Header=BB3_9 Depth=1
	movl	$1, %ebp
	testb	$1, %r13b
	movl	$0, %r13d
	jne	.LBB3_9
# %bb.21:                               # %.preheader174.preheader
	movb	$1, %r13b
	xorl	%r12d, %r12d
	movabsq	$4294967298, %rbp               # imm = 0x100000002
	movabsq	$4294967552, %r14               # imm = 0x100000100
.LBB3_22:                               # %.preheader174
                                        # =>This Inner Loop Header: Depth=1
.Ltmp35:
	movl	%r12d, %edi
	callq	hipSetDevice
.Ltmp36:
# %bb.23:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp37:
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp38:
# %bb.24:                               #   in Loop: Header=BB3_22 Depth=1
	testl	%eax, %eax
	jne	.LBB3_26
# %bb.25:                               #   in Loop: Header=BB3_22 Depth=1
	movq	(%r15,%r12,8), %rdi
	movq	(%rsp), %rax                    # 8-byte Reload
	movq	(%rax,%r12,8), %rsi
.Ltmp39:
	movl	$512, %edx                      # imm = 0x200
	movl	$1024, %ecx                     # imm = 0x400
	callq	_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
.Ltmp40:
.LBB3_26:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp41:
	callq	hipGetLastError
.Ltmp42:
# %bb.27:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp43:
	movl	$.L.str.10, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp44:
# %bb.28:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp45:
	callq	hipDeviceSynchronize
.Ltmp46:
# %bb.29:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp47:
	movl	$.L.str.11, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp48:
# %bb.30:                               #   in Loop: Header=BB3_22 Depth=1
	movl	$1, %r12d
	testb	$1, %r13b
	movl	$0, %r13d
	jne	.LBB3_22
# %bb.31:                               # %.preheader173.preheader
	movb	$1, %bpl
	xorl	%r14d, %r14d
	movq	(%rsp), %r12                    # 8-byte Reload
.LBB3_32:                               # %.preheader173
                                        # =>This Inner Loop Header: Depth=1
.Ltmp50:
	movl	%r14d, %edi
	callq	hipSetDevice
.Ltmp51:
# %bb.33:                               #   in Loop: Header=BB3_32 Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	(%rax,%r14,8), %rdi
	movq	(%r15,%r14,8), %rdx
.Ltmp52:
	movq	%rdx, %rsi
	movl	$-1, %ecx
	callq	hipfftExecC2C
.Ltmp53:
# %bb.34:                               #   in Loop: Header=BB3_32 Depth=1
.Ltmp54:
	movl	$.L.str.12, %esi
	movl	%eax, %edi
	callq	_Z15checkCufftError14hipfftResult_tPKc
.Ltmp55:
# %bb.35:                               #   in Loop: Header=BB3_32 Depth=1
	movl	$1, %r14d
	testb	$1, %bpl
	movl	$0, %ebp
	jne	.LBB3_32
# %bb.36:                               # %.preheader172.preheader
	movb	$1, %bpl
	xorl	%r14d, %r14d
.LBB3_37:                               # %.preheader172
                                        # =>This Inner Loop Header: Depth=1
.Ltmp57:
	movl	%r14d, %edi
	callq	hipSetDevice
.Ltmp58:
# %bb.38:                               #   in Loop: Header=BB3_37 Depth=1
	movq	%r14, %rdi
	shlq	$12, %rdi
	addq	%rbx, %rdi
	movq	(%r15,%r14,8), %rsi
.Ltmp59:
	movl	$4096, %edx                     # imm = 0x1000
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp60:
# %bb.39:                               #   in Loop: Header=BB3_37 Depth=1
.Ltmp61:
	movl	$.L.str.13, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp62:
# %bb.40:                               #   in Loop: Header=BB3_37 Depth=1
	movl	$1, %r14d
	testb	$1, %bpl
	movl	$0, %ebp
	jne	.LBB3_37
# %bb.41:                               # %.preheader.preheader
	movb	$1, %bpl
	xorl	%r14d, %r14d
.LBB3_42:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
.Ltmp64:
	movl	%r14d, %edi
	callq	hipSetDevice
.Ltmp65:
# %bb.43:                               #   in Loop: Header=BB3_42 Depth=1
	movq	(%r15,%r14,8), %rdi
.Ltmp66:
	callq	hipFree
.Ltmp67:
# %bb.44:                               #   in Loop: Header=BB3_42 Depth=1
	movq	(%r12,%r14,8), %rdi
.Ltmp68:
	callq	hipFree
.Ltmp69:
# %bb.45:                               #   in Loop: Header=BB3_42 Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	(%rax,%r14,8), %rdi
.Ltmp70:
	callq	hipfftDestroy
.Ltmp71:
# %bb.46:                               #   in Loop: Header=BB3_42 Depth=1
	movl	$1, %r14d
	testb	$1, %bpl
	movl	$0, %ebp
	jne	.LBB3_42
# %bb.47:
.Ltmp73:
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$30, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp74:
# %bb.48:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r14
.Ltmp75:
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp76:
# %bb.49:                               # %.noexc
.Ltmp77:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp78:
# %bb.50:                               # %.noexc123
.Ltmp79:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp80:
# %bb.51:                               # %_ZNSolsEPFRSoS_E.exit.preheader.preheader
	xorl	%r12d, %r12d
.LBB3_52:                               # %_ZNSolsEPFRSoS_E.exit.preheader
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r12,8), %xmm0
.Ltmp82:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp83:
# %bb.53:                               # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB3_52 Depth=1
.Ltmp84:
	movq	%rax, %r14
	movl	$.L.str.15, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp85:
# %bb.54:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit109
                                        #   in Loop: Header=BB3_52 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rbx,%r12,8), %xmm0
.Ltmp86:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp87:
# %bb.55:                               # %_ZNSolsEf.exit110
                                        #   in Loop: Header=BB3_52 Depth=1
.Ltmp88:
	movq	%rax, %r14
	movl	$.L.str.16, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp89:
# %bb.56:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit111
                                        #   in Loop: Header=BB3_52 Depth=1
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp90:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp91:
# %bb.57:                               # %.noexc125
                                        #   in Loop: Header=BB3_52 Depth=1
.Ltmp92:
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp93:
# %bb.58:                               # %.noexc126
                                        #   in Loop: Header=BB3_52 Depth=1
.Ltmp94:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp95:
# %bb.59:                               # %_ZNSolsEPFRSoS_E.exit112
                                        #   in Loop: Header=BB3_52 Depth=1
	incq	%r12
	cmpq	$10, %r12
	jne	.LBB3_52
# %bb.60:                               # %_ZNSt6vectorI15HIP_vector_typeIfLj2EESaIS1_EED2Ev.exit
	movq	8(%rsp), %rdi                   # 8-byte Reload
	callq	_ZdlPv
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	_ZdlPv
	movq	%r15, %rdi
	callq	_ZdlPv
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
	movq	%rbx, %rdi
	callq	_ZdlPv
	xorl	%eax, %eax
	addq	$1496, %rsp                     # imm = 0x5D8
	.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_61:
	.cfi_def_cfa_offset 1552
.Ltmp11:
	movq	%rax, %r14
	movq	(%rsp), %r12                    # 8-byte Reload
	jmp	.LBB3_75
.LBB3_62:
.Ltmp8:
	movq	%rax, %r14
	jmp	.LBB3_76
.LBB3_63:
.Ltmp5:
	movq	%rax, %r14
	jmp	.LBB3_77
.LBB3_64:
.Ltmp2:
	movq	%rax, %r14
	jmp	.LBB3_78
.LBB3_65:
.Ltmp81:
	jmp	.LBB3_73
.LBB3_66:
.Ltmp63:
	jmp	.LBB3_68
.LBB3_67:
.Ltmp56:
	jmp	.LBB3_68
.LBB3_69:
.Ltmp72:
.LBB3_68:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit114
	movq	%rax, %r14
	jmp	.LBB3_74
.LBB3_70:
.Ltmp49:
	jmp	.LBB3_73
.LBB3_71:
.Ltmp96:
	jmp	.LBB3_73
.LBB3_72:
.Ltmp34:
.LBB3_73:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit114
	movq	%rax, %r14
	movq	(%rsp), %r12                    # 8-byte Reload
.LBB3_74:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit114
	movq	8(%rsp), %rdi                   # 8-byte Reload
	callq	_ZdlPv
.LBB3_75:                               # %_ZNSt6vectorIPiSaIS0_EED2Ev.exit116
	movq	%r12, %rdi
	callq	_ZdlPv
.LBB3_76:                               # %_ZNSt6vectorIP15HIP_vector_typeIfLj2EESaIS2_EED2Ev.exit118
	movq	%r15, %rdi
	callq	_ZdlPv
.LBB3_77:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit120
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
.LBB3_78:                               # %_ZNSt6vectorI15HIP_vector_typeIfLj2EESaIS1_EED2Ev.exit122
	movq	%rbx, %rdi
	callq	_ZdlPv
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.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 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp1-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp3-.Ltmp1                  #   Call between .Ltmp1 and .Ltmp3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 6 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp33-.Ltmp12                #   Call between .Ltmp12 and .Ltmp33
	.uleb128 .Ltmp34-.Lfunc_begin0          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp48-.Ltmp35                #   Call between .Ltmp35 and .Ltmp48
	.uleb128 .Ltmp49-.Lfunc_begin0          #     jumps to .Ltmp49
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp50-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp55-.Ltmp50                #   Call between .Ltmp50 and .Ltmp55
	.uleb128 .Ltmp56-.Lfunc_begin0          #     jumps to .Ltmp56
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp57-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp62-.Ltmp57                #   Call between .Ltmp57 and .Ltmp62
	.uleb128 .Ltmp63-.Lfunc_begin0          #     jumps to .Ltmp63
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp64-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp71-.Ltmp64                #   Call between .Ltmp64 and .Ltmp71
	.uleb128 .Ltmp72-.Lfunc_begin0          #     jumps to .Ltmp72
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp73-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp80-.Ltmp73                #   Call between .Ltmp73 and .Ltmp80
	.uleb128 .Ltmp81-.Lfunc_begin0          #     jumps to .Ltmp81
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp82-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp95-.Ltmp82                #   Call between .Ltmp82 and .Ltmp95
	.uleb128 .Ltmp96-.Lfunc_begin0          #     jumps to .Ltmp96
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp95-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Lfunc_end3-.Ltmp95            #   Call between .Ltmp95 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.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	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii, %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_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii,@object # @_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.section	.rodata,"a",@progbits
	.globl	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.p2align	3, 0x0
_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii:
	.quad	_Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.size	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"CUDA error: "
	.size	.L.str, 13

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" - "
	.size	.L.str.1, 4

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"cuFFT error: "
	.size	.L.str.2, 14

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Using device "
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	": "
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"hipMalloc d_data"
	.size	.L.str.5, 17

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipMalloc d_indices"
	.size	.L.str.6, 20

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"hipMemcpy d_data"
	.size	.L.str.7, 17

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"hipMemcpy d_indices"
	.size	.L.str.8, 20

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"hipfftPlan1d"
	.size	.L.str.9, 13

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"sparse_fft_kernel launch failed"
	.size	.L.str.10, 32

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"hipDeviceSynchronize failed"
	.size	.L.str.11, 28

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"hipfftExecC2C"
	.size	.L.str.12, 14

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"hipMemcpy h_data"
	.size	.L.str.13, 17

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"First 10 transformed elements:"
	.size	.L.str.14, 31

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	" + "
	.size	.L.str.15, 4

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"i"
	.size	.L.str.16, 2

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii"
	.size	.L__unnamed_1, 51

	.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 _Z32__device_stub__sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.addrsig_sym _ZSt4cerr
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii ; -- Begin function _Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.globl	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
	.p2align	8
	.type	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii,@function
_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii: ; @_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[0:3], 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], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[0:1], 3, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt vmcnt(0)
	v_dual_mul_f32 v2, 0.5, v2 :: v_dual_mul_f32 v3, 0.5, v3
	global_store_b64 v[0:1], v[2:3], off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
		.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 4
		.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	_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii, .Lfunc_end0-_Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 184
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 1
; 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:           _Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17sparse_fft_kernelP15HIP_vector_typeIfLj2EEPiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
