// fft_4096d.cu
// CUDA implementation of a 4096D FFT with optimizations for memory bandwidth and register usage.
// Target architecture: Hopper

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

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

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

#define CHECK_CUDA_ERROR(err) checkCudaError(err, __FILE__, __LINE__)
#define CHECK_CUFFT_ERROR(err) checkCufftError(err, __FILE__, __LINE__)

int main() {
    // Define the size of the FFT
    const int N = 4096;

    // Allocate host memory for the input and output data
    cufftComplex *h_input = (cufftComplex*)malloc(N * sizeof(cufftComplex));
    cufftComplex *h_output = (cufftComplex*)malloc(N * sizeof(cufftComplex));

    // Initialize the input data with some values
    for (int i = 0; i < N; i++) {
        h_input[i].x = static_cast<float>(i); // Real part
        h_input[i].y = 0.0f; // Imaginary part
    }

    // Allocate device memory for the input and output data
    cufftComplex *d_input, *d_output;
    CHECK_CUDA_ERROR(cudaMalloc((void**)&d_input, N * sizeof(cufftComplex)));
    CHECK_CUDA_ERROR(cudaMalloc((void**)&d_output, N * sizeof(cufftComplex)));

    // Copy the input data from host to device
    CHECK_CUDA_ERROR(cudaMemcpy(d_input, h_input, N * sizeof(cufftComplex), cudaMemcpyHostToDevice));

    // Create a cuFFT plan
    cufftHandle plan;
    CHECK_CUFFT_ERROR(cufftPlan1d(&plan, N, CUFFT_C2C, 1));

    // Execute the FFT on the device
    CHECK_CUFFT_ERROR(cufftExecC2C(plan, d_input, d_output, CUFFT_FORWARD));

    // Copy the output data from device to host
    CHECK_CUDA_ERROR(cudaMemcpy(h_output, d_output, N * sizeof(cufftComplex), cudaMemcpyDeviceToHost));

    // Print the first 10 results to verify correctness
    std::cout << "First 10 results of the FFT:" << std::endl;
    for (int i = 0; i < 10; i++) {
        std::cout << "h_output[" << i << "] = (" << h_output[i].x << ", " << h_output[i].y << ")" << std::endl;
    }

    // Destroy the cuFFT plan
    CHECK_CUFFT_ERROR(cufftDestroy(plan));

    // Free device memory
    CHECK_CUDA_ERROR(cudaFree(d_input));
    CHECK_CUDA_ERROR(cudaFree(d_output));

    // Free host memory
    free(h_input);
    free(h_output);

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

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3663:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3663:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA error at "
.LC1:
	.string	":"
.LC2:
	.string	" - "
	.text
	.globl	_Z14checkCudaError9cudaErrorPKci
	.type	_Z14checkCudaError9cudaErrorPKci, @function
_Z14checkCudaError9cudaErrorPKci:
.LFB3658:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	leaq	.LC0(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %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	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%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	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE3658:
	.size	_Z14checkCudaError9cudaErrorPKci, .-_Z14checkCudaError9cudaErrorPKci
	.section	.rodata.str1.1
.LC3:
	.string	"cuFFT error at "
	.text
	.globl	_Z15checkCufftError13cufftResult_tPKci
	.type	_Z15checkCufftError13cufftResult_tPKci, @function
_Z15checkCufftError13cufftResult_tPKci:
.LFB3659:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L8
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	leaq	_ZSt4cerr(%rip), %rdi
	leaq	.LC3(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edx, %ebx
	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, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE3659:
	.size	_Z15checkCufftError13cufftResult_tPKci, .-_Z15checkCufftError13cufftResult_tPKci
	.section	.rodata.str1.1
.LC5:
	.string	"/home/ubuntu/Datasets/cuda-codes-80k-from-llm-dedup/cuda_code_043836.cu"
.LC6:
	.string	"First 10 results of the FFT:"
.LC7:
	.string	"h_output["
.LC8:
	.string	"] = ("
.LC9:
	.string	", "
.LC10:
	.string	")"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3660:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$32768, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$32768, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, %rbp
	xorl	%eax, %eax
.L14:
	movl	$0x00000000, 4(%r12,%rax,8)
	cvtsi2ssl	%eax, %xmm0
	movss	%xmm0, (%r12,%rax,8)
	incq	%rax
	cmpq	$4096, %rax
	jne	.L14
	leaq	8(%rsp), %rdi
	movl	$32768, %esi
	xorl	%r13d, %r13d
	call	cudaMalloc@PLT
	leaq	.LC5(%rip), %rbx
	movl	$44, %edx
	leaq	_ZSt4cout(%rip), %r14
	movl	%eax, %edi
	movq	%rbx, %rsi
	leaq	.LC7(%rip), %r15
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	16(%rsp), %rdi
	movl	$32768, %esi
	call	cudaMalloc@PLT
	movl	$45, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$32768, %edx
	call	cudaMemcpy@PLT
	movl	$48, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movl	$1, %ecx
	leaq	4(%rsp), %rdi
	movl	$41, %edx
	movl	$4096, %esi
	call	cufftPlan1d@PLT
	movl	$52, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z15checkCufftError13cufftResult_tPKci
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	orl	$-1, %ecx
	movl	4(%rsp), %edi
	call	cufftExecC2C@PLT
	movl	$55, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z15checkCufftError13cufftResult_tPKci
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movl	$32768, %edx
	call	cudaMemcpy@PLT
	movl	$58, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	.LC6(%rip), %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L15:
	movq	%r15, %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r13d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC8(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	0(%rbp,%r13,8), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	4(%rbp,%r13,8), %xmm0
	incq	%r13
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC10(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	cmpq	$10, %r13
	jne	.L15
	movl	4(%rsp), %edi
	call	cufftDestroy@PLT
	movl	$67, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z15checkCufftError13cufftResult_tPKci
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movl	$70, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movl	$71, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$40, %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
.LFE3660:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3686:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3686:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

// fft_4096d.cu
// CUDA implementation of a 4096D FFT with optimizations for memory bandwidth and register usage.
// Target architecture: Hopper

#include <hip/hip_runtime.h>
#include <hipfft/hipfft.h>
#include <iostream>

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

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

#define CHECK_CUDA_ERROR(err) checkCudaError(err, __FILE__, __LINE__)
#define CHECK_CUFFT_ERROR(err) checkCufftError(err, __FILE__, __LINE__)

int main() {
    // Define the size of the FFT
    const int N = 4096;

    // Allocate host memory for the input and output data
    hipfftComplex *h_input = (hipfftComplex*)malloc(N * sizeof(hipfftComplex));
    hipfftComplex *h_output = (hipfftComplex*)malloc(N * sizeof(hipfftComplex));

    // Initialize the input data with some values
    for (int i = 0; i < N; i++) {
        h_input[i].x = static_cast<float>(i); // Real part
        h_input[i].y = 0.0f; // Imaginary part
    }

    // Allocate device memory for the input and output data
    hipfftComplex *d_input, *d_output;
    CHECK_CUDA_ERROR(hipMalloc((void**)&d_input, N * sizeof(hipfftComplex)));
    CHECK_CUDA_ERROR(hipMalloc((void**)&d_output, N * sizeof(hipfftComplex)));

    // Copy the input data from host to device
    CHECK_CUDA_ERROR(hipMemcpy(d_input, h_input, N * sizeof(hipfftComplex), hipMemcpyHostToDevice));

    // Create a cuFFT plan
    hipfftHandle plan;
    CHECK_CUFFT_ERROR(hipfftPlan1d(&plan, N, HIPFFT_C2C, 1));

    // Execute the FFT on the device
    CHECK_CUFFT_ERROR(hipfftExecC2C(plan, d_input, d_output, HIPFFT_FORWARD));

    // Copy the output data from device to host
    CHECK_CUDA_ERROR(hipMemcpy(h_output, d_output, N * sizeof(hipfftComplex), hipMemcpyDeviceToHost));

    // Print the first 10 results to verify correctness
    std::cout << "First 10 results of the FFT:" << std::endl;
    for (int i = 0; i < 10; i++) {
        std::cout << "h_output[" << i << "] = (" << h_output[i].x << ", " << h_output[i].y << ")" << std::endl;
    }

    // Destroy the cuFFT plan
    CHECK_CUFFT_ERROR(hipfftDestroy(plan));

    // Free device memory
    CHECK_CUDA_ERROR(hipFree(d_input));
    CHECK_CUDA_ERROR(hipFree(d_output));

    // Free host memory
    free(h_input);
    free(h_output);

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

                                        # End of file scope inline assembly
	.globl	_Z14checkCudaError10hipError_tPKci # -- Begin function _Z14checkCudaError10hipError_tPKci
	.type	_Z14checkCudaError10hipError_tPKci,@function
_Z14checkCudaError10hipError_tPKci:     # @_Z14checkCudaError10hipError_tPKci
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB0_2
# %bb.1:
	retq
.LBB0_2:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	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, %rdi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movl	$.L.str.2, %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_end0:
	.size	_Z14checkCudaError10hipError_tPKci, .Lfunc_end0-_Z14checkCudaError10hipError_tPKci
	.cfi_endproc
                                        # -- End function
	.globl	_Z15checkCufftError14hipfftResult_tPKci # -- Begin function _Z15checkCufftError14hipfftResult_tPKci
	.type	_Z15checkCufftError14hipfftResult_tPKci,@function
_Z15checkCufftError14hipfftResult_tPKci: # @_Z15checkCufftError14hipfftResult_tPKci
	.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
	movl	%edx, %ebx
	movq	%rsi, %r14
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.3, %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, %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z15checkCufftError14hipfftResult_tPKci, .Lfunc_end1-_Z15checkCufftError14hipfftResult_tPKci
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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	$32, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$32768, %edi                    # imm = 0x8000
	callq	malloc
	movq	%rax, %rbx
	movl	$32768, %edi                    # imm = 0x8000
	callq	malloc
	movq	%rax, %r14
	xorl	%eax, %eax
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%rbx,%rax,8)
	movl	$0, 4(%rbx,%rax,8)
	incq	%rax
	cmpq	$4096, %rax                     # imm = 0x1000
	jne	.LBB2_1
# %bb.2:
	leaq	24(%rsp), %r15
	movl	$32768, %esi                    # imm = 0x8000
	movq	%r15, %rdi
	callq	hipMalloc
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$44, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	leaq	16(%rsp), %r12
	movl	$32768, %esi                    # imm = 0x8000
	movq	%r12, %rdi
	callq	hipMalloc
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$45, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	(%r15), %rdi
	movl	$32768, %edx                    # imm = 0x8000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$48, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	leaq	8(%rsp), %r13
	movq	%r13, %rdi
	movl	$4096, %esi                     # imm = 0x1000
	movl	$41, %edx
	movl	$1, %ecx
	callq	hipfftPlan1d
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$52, %edx
	callq	_Z15checkCufftError14hipfftResult_tPKci
	movq	(%r13), %rdi
	movq	(%r15), %rsi
	movq	(%r12), %rdx
	movl	$-1, %ecx
	callq	hipfftExecC2C
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$55, %edx
	callq	_Z15checkCufftError14hipfftResult_tPKci
	movq	(%r12), %rsi
	movl	$32768, %edx                    # imm = 0x8000
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$58, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movl	$_ZSt4cout, %r15d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$28, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%r15d, %r15d
.LBB2_3:                                # =>This Inner Loop Header: Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movl	$.L.str.7, %esi
	movl	$5, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r15,8), %xmm0
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movl	$.L.str.8, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%r14,%r15,8), %xmm0
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movl	$.L.str.9, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r12), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%r15
	cmpq	$10, %r15
	jne	.LBB2_3
# %bb.4:
	movq	8(%rsp), %rdi
	callq	hipfftDestroy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$67, %edx
	callq	_Z15checkCufftError14hipfftResult_tPKci
	movq	24(%rsp), %rdi
	callq	hipFree
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$70, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	16(%rsp), %rdi
	callq	hipFree
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$71, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"CUDA error at "
	.size	.L.str, 15

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

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"cuFFT error at "
	.size	.L.str.3, 16

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/ubuntu/Datasets/hip-codes-80k-from-llm-dedup-disassemble-sm89/cuda_code_043836.hip"
	.size	.L.str.4, 89

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"First 10 results of the FFT:"
	.size	.L.str.5, 29

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"h_output["
	.size	.L.str.6, 10

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"] = ("
	.size	.L.str.7, 6

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

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	")"
	.size	.L.str.9, 2

	.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 _ZSt4cerr
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
