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

#define BLOCK_SIZE 256
#define DCT_SIZE 1024
#define NUM_GPUS 2

__global__ void dct1024Kernel(float *d_input, float *d_output) {
    extern __shared__ float shared_mem[];
    int tid = threadIdx.x;
    int bid = blockIdx.x;
    int idx = bid * blockDim.x + tid;

    // Load data into shared memory
    if (idx < DCT_SIZE) {
        shared_mem[tid] = d_input[idx];
    }
    __syncthreads();

    // Perform DCT using shared memory
    // This is a simplified example and does not implement the full DCT algorithm
    // In practice, you would implement the DCT algorithm here
    // For demonstration, we will just square the input as a placeholder
    if (idx < DCT_SIZE) {
        d_output[idx] = shared_mem[tid] * shared_mem[tid];
    }
}

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

void checkCufftError(cufftResult err, const char *msg) {
    if (err != CUFFT_SUCCESS) {
        std::cerr << "CUFFT error: " << msg << " (" << err << ")" << std::endl;
        exit(EXIT_FAILURE);
    }
}

void dct1024GPU(float *h_input, float *h_output) {
    int nDevices = NUM_GPUS;
    int device;
    std::vector<cudaStream_t> streams(nDevices);
    std::vector<cudaEvent_t> start(nDevices), stop(nDevices);
    std::vector<float*> d_input(nDevices), d_output(nDevices);
    std::vector<cufftHandle> plan(nDevices);

    for (device = 0; device < nDevices; ++device) {
        cudaSetDevice(device);
        cudaStreamCreate(&streams[device]);
        cudaEventCreate(&start[device]);
        cudaEventCreate(&stop[device]);

        // Allocate device memory
        checkCudaError(cudaMalloc(&d_input[device], DCT_SIZE * sizeof(float)), "Failed to allocate d_input");
        checkCudaError(cudaMalloc(&d_output[device], DCT_SIZE * sizeof(float)), "Failed to allocate d_output");

        // Copy data to device
        checkCudaError(cudaMemcpyAsync(d_input[device], h_input + device * DCT_SIZE, DCT_SIZE * sizeof(float), cudaMemcpyHostToDevice, streams[device]), "Failed to copy data to device");

        // Create CUFFT plan
        checkCufftError(cufftPlan1d(&plan[device], DCT_SIZE, CUFFT_R2C, 1), "Failed to create CUFFT plan");

        // Record start event
        cudaEventRecord(start[device], streams[device]);

        // Launch kernel
        dct1024Kernel<<<(DCT_SIZE + BLOCK_SIZE - 1) / BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE * sizeof(float), streams[device]>>>(d_input[device], d_output[device]);

        // Record stop event
        cudaEventRecord(stop[device], streams[device]);
    }

    for (device = 0; device < nDevices; ++device) {
        cudaSetDevice(device);
        // Wait for the kernel to finish
        cudaEventSynchronize(stop[device]);

        // Copy data back to host
        checkCudaError(cudaMemcpyAsync(h_output + device * DCT_SIZE, d_output[device], DCT_SIZE * sizeof(float), cudaMemcpyDeviceToHost, streams[device]), "Failed to copy data back to host");

        // Destroy CUFFT plan
        checkCufftError(cufftDestroy(plan[device]), "Failed to destroy CUFFT plan");

        // Free device memory
        checkCudaError(cudaFree(d_input[device]), "Failed to free d_input");
        checkCudaError(cudaFree(d_output[device]), "Failed to free d_output");

        // Destroy streams and events
        cudaStreamDestroy(streams[device]);
        cudaEventDestroy(start[device]);
        cudaEventDestroy(stop[device]);
    }
}

int main() {
    // Initialize input data
    std::vector<float> h_input(DCT_SIZE * NUM_GPUS);
    std::vector<float> h_output(DCT_SIZE * NUM_GPUS);
    for (size_t i = 0; i < h_input.size(); ++i) {
        h_input[i] = static_cast<float>(i);
    }

    // Perform DCT on multiple GPUs
    dct1024GPU(h_input.data(), h_output.data());

    // Verify results (simple check)
    for (size_t i = 0; i < h_output.size(); ++i) {
        assert(h_output[i] == h_input[i] * h_input[i]);
    }

    std::cout << "DCT computation completed successfully." << std::endl;

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

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4028:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4028:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA error: "
.LC1:
	.string	" ("
.LC2:
	.string	")"
	.text
	.globl	_Z14checkCudaError9cudaErrorPKc
	.type	_Z14checkCudaError9cudaErrorPKc, @function
_Z14checkCudaError9cudaErrorPKc:
.LFB4022:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	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
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	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
	ret
	.cfi_endproc
.LFE4022:
	.size	_Z14checkCudaError9cudaErrorPKc, .-_Z14checkCudaError9cudaErrorPKc
	.section	.rodata.str1.1
.LC3:
	.string	"CUFFT error: "
	.text
	.globl	_Z15checkCufftError13cufftResult_tPKc
	.type	_Z15checkCufftError13cufftResult_tPKc, @function
_Z15checkCufftError13cufftResult_tPKc:
.LFB4023:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L8
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	leaq	.LC3(%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, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@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
.LFE4023:
	.size	_Z15checkCufftError13cufftResult_tPKc, .-_Z15checkCufftError13cufftResult_tPKc
	.globl	_Z35__device_stub__Z13dct1024KernelPfS_PfS_
	.type	_Z35__device_stub__Z13dct1024KernelPfS_PfS_, @function
_Z35__device_stub__Z13dct1024KernelPfS_PfS_:
.LFB4050:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z13dct1024KernelPfS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L13:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4050:
	.size	_Z35__device_stub__Z13dct1024KernelPfS_PfS_, .-_Z35__device_stub__Z13dct1024KernelPfS_PfS_
	.globl	_Z13dct1024KernelPfS_
	.type	_Z13dct1024KernelPfS_, @function
_Z13dct1024KernelPfS_:
.LFB4051:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z13dct1024KernelPfS_PfS_
	.cfi_endproc
.LFE4051:
	.size	_Z13dct1024KernelPfS_, .-_Z13dct1024KernelPfS_
	.section	.rodata.str1.1
.LC4:
	.string	"_Z13dct1024KernelPfS_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4053:
	.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	.LC4(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z13dct1024KernelPfS_(%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
.LFE4053:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev,"axG",@progbits,_ZNSt6vectorIP11CUstream_stSaIS1_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev
	.type	_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev, @function
_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev:
.LFB4366:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L20
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L20:
	ret
	.cfi_endproc
.LFE4366:
	.size	_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev, .-_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev
	.weak	_ZNSt6vectorIP11CUstream_stSaIS1_EED1Ev
	.set	_ZNSt6vectorIP11CUstream_stSaIS1_EED1Ev,_ZNSt6vectorIP11CUstream_stSaIS1_EED2Ev
	.section	.text._ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev,"axG",@progbits,_ZNSt6vectorIP10CUevent_stSaIS1_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev
	.type	_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev, @function
_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev:
.LFB4378:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L22
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L22:
	ret
	.cfi_endproc
.LFE4378:
	.size	_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev, .-_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev
	.weak	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev
	.set	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev,_ZNSt6vectorIP10CUevent_stSaIS1_EED2Ev
	.section	.text._ZNSt6vectorIPfSaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorIPfSaIS0_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIPfSaIS0_EED2Ev
	.type	_ZNSt6vectorIPfSaIS0_EED2Ev, @function
_ZNSt6vectorIPfSaIS0_EED2Ev:
.LFB4390:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L24
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L24:
	ret
	.cfi_endproc
.LFE4390:
	.size	_ZNSt6vectorIPfSaIS0_EED2Ev, .-_ZNSt6vectorIPfSaIS0_EED2Ev
	.weak	_ZNSt6vectorIPfSaIS0_EED1Ev
	.set	_ZNSt6vectorIPfSaIS0_EED1Ev,_ZNSt6vectorIPfSaIS0_EED2Ev
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB4402:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L26
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L26:
	ret
	.cfi_endproc
.LFE4402:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.rodata.str1.1
.LC5:
	.string	"Failed to allocate d_input"
.LC6:
	.string	"Failed to allocate d_output"
.LC7:
	.string	"Failed to copy data to device"
.LC8:
	.string	"Failed to create CUFFT plan"
.LC9:
	.string	"Failed to copy data back to host"
.LC10:
	.string	"Failed to destroy CUFFT plan"
.LC11:
	.string	"Failed to free d_input"
.LC12:
	.string	"Failed to free d_output"
	.text
	.globl	_Z10dct1024GPUPfS_
	.type	_Z10dct1024GPUPfS_, @function
_Z10dct1024GPUPfS_:
.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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	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	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%rdi, 32(%rsp)
	movl	$16, %edi
	movq	%rsi, 40(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
.LEHB0:
	call	_Znwm@PLT
.LEHE0:
	movl	$16, %edi
	movq	%r14, 104(%rsp)
	movq	%rax, %rbp
	movq	%rax, 72(%rsp)
	leaq	16(%rax), %rax
	movq	%r13, 0(%rbp)
	movq	%r13, 8(%rbp)
	movq	%rax, 88(%rsp)
	movq	%rax, 80(%rsp)
	movq	%r14, 112(%rsp)
.LEHB1:
	call	_Znwm@PLT
.LEHE1:
	movq	%rax, %r15
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	movq	%rax, 96(%rsp)
	movq	%rbx, (%r15)
	leaq	16(%rax), %rax
	movl	$16, %edi
	movq	%rbx, 8(%r15)
	movq	%rax, 112(%rsp)
	movq	%rax, 104(%rsp)
	movq	%r12, 128(%rsp)
	movq	%r12, 136(%rsp)
.LEHB2:
	call	_Znwm@PLT
.LEHE2:
	movq	%rax, %r12
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	movq	%rax, 120(%rsp)
	movq	%r10, (%r12)
	leaq	16(%rax), %rax
	movl	$16, %edi
	movq	%r10, 8(%r12)
	movq	%rax, 136(%rsp)
	movq	%rax, 128(%rsp)
	movq	%r11, 152(%rsp)
	movq	%r11, 160(%rsp)
.LEHB3:
	call	_Znwm@PLT
.LEHE3:
	movq	%rax, %r13
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	movl	$16, %edi
	movq	%r8, 0(%r13)
	movq	%r8, 8(%r13)
	movq	%rax, 144(%rsp)
	leaq	16(%rax), %rax
	movq	%rax, 160(%rsp)
	movq	%rax, 152(%rsp)
	movq	%r9, 176(%rsp)
	movq	%r9, 184(%rsp)
.LEHB4:
	call	_Znwm@PLT
.LEHE4:
	movq	%rax, %r14
	xorl	%esi, %esi
	xorl	%edi, %edi
	movq	%rax, 168(%rsp)
	movq	%rsi, (%r14)
	leaq	16(%rax), %rax
	movq	%rsi, 8(%r14)
	movq	%rdi, 200(%rsp)
	movq	%rdi, 208(%rsp)
	movl	$8, %edi
	movq	%rax, 184(%rsp)
	movq	%rax, 176(%rsp)
.LEHB5:
	call	_Znwm@PLT
.LEHE5:
	movq	%rax, 8(%rsp)
	movq	8(%rsp), %rcx
	xorl	%edx, %edx
	xorl	%ebx, %ebx
	movq	%rax, 192(%rsp)
	addq	$8, %rax
	movq	%rdx, (%rcx)
	movq	%rcx, 24(%rsp)
	xorl	%ecx, %ecx
	movq	%rax, 208(%rsp)
	movq	%rax, 200(%rsp)
	movl	%ecx, 20(%rsp)
.L32:
	movl	20(%rsp), %edi
.LEHB6:
	call	cudaSetDevice@PLT
	leaq	0(%rbp,%rbx), %rdi
	call	cudaStreamCreate@PLT
	leaq	(%r15,%rbx), %rdi
	call	cudaEventCreate@PLT
	leaq	(%r12,%rbx), %rdi
	call	cudaEventCreate@PLT
	leaq	0(%r13,%rbx), %rdi
	movl	$4096, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	leaq	.LC5(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	leaq	(%r14,%rbx), %rdi
	movl	$4096, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	leaq	.LC6(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	32(%rsp), %rax
	movq	%rbx, %rsi
	movq	0(%r13,%rbx), %rdi
	movl	$1, %ecx
	salq	$9, %rsi
	movq	0(%rbp,%rbx), %r8
	movl	$4096, %edx
	addq	%rax, %rsi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %edi
	leaq	.LC7(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$42, %edx
	movl	$1024, %esi
	call	cufftPlan1d@PLT
	movl	%eax, %edi
	leaq	.LC8(%rip), %rsi
	call	_Z15checkCufftError13cufftResult_tPKc
	movq	0(%rbp,%rbx), %rsi
	movq	(%r15,%rbx), %rdi
	call	cudaEventRecord@PLT
	movl	$16777217, %edx
	movl	$1073741825, %edi
	movq	0(%rbp,%rbx), %r9
	movl	$1024, %r8d
	salq	$8, %rdx
	movl	$1, %ecx
	salq	$2, %rdi
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L29
.L31:
	movq	0(%rbp,%rbx), %rsi
	movq	(%r12,%rbx), %rdi
	call	cudaEventRecord@PLT
	jmp	.L53
.L29:
	movq	(%r14,%rbx), %rsi
	movq	0(%r13,%rbx), %rdi
	call	_Z35__device_stub__Z13dct1024KernelPfS_PfS_
	jmp	.L31
.L53:
	addq	$4, 24(%rsp)
	addq	$8, %rbx
	cmpl	$0, 20(%rsp)
	jne	.L54
	movl	$1, 20(%rsp)
	jmp	.L32
.L54:
	xorl	%ebx, %ebx
.L33:
	movl	%ebx, %edi
	call	cudaSetDevice@PLT
	movq	(%r12,%rbx,8), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rax
	movq	%rbx, %rdi
	movq	(%r14,%rbx,8), %rsi
	movl	$2, %ecx
	salq	$12, %rdi
	movq	0(%rbp,%rbx,8), %r8
	movl	$4096, %edx
	addq	%rax, %rdi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %edi
	leaq	.LC9(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	8(%rsp), %rax
	movl	(%rax,%rbx,4), %edi
	call	cufftDestroy@PLT
	movl	%eax, %edi
	leaq	.LC10(%rip), %rsi
	call	_Z15checkCufftError13cufftResult_tPKc
	movq	0(%r13,%rbx,8), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	leaq	.LC11(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	(%r14,%rbx,8), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	leaq	.LC12(%rip), %rsi
	call	_Z14checkCudaError9cudaErrorPKc
	movq	0(%rbp,%rbx,8), %rdi
	call	cudaStreamDestroy@PLT
	movq	(%r15,%rbx,8), %rdi
	call	cudaEventDestroy@PLT
	movq	(%r12,%rbx,8), %rdi
	call	cudaEventDestroy@PLT
.LEHE6:
	testq	%rbx, %rbx
	jne	.L55
	movl	$1, %ebx
	jmp	.L33
.L55:
	leaq	192(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	leaq	168(%rsp), %rdi
	call	_ZNSt6vectorIPfSaIS0_EED1Ev
	leaq	144(%rsp), %rdi
	call	_ZNSt6vectorIPfSaIS0_EED1Ev
	leaq	120(%rsp), %rdi
	call	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIP11CUstream_stSaIS1_EED1Ev
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	jmp	.L51
.L49:
	endbr64
	movq	%rax, %rbx
.L34:
	leaq	192(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L35
.L48:
	endbr64
	movq	%rax, %rbx
.L35:
	leaq	168(%rsp), %rdi
	call	_ZNSt6vectorIPfSaIS0_EED1Ev
	jmp	.L36
.L47:
	endbr64
	movq	%rax, %rbx
.L36:
	leaq	144(%rsp), %rdi
	call	_ZNSt6vectorIPfSaIS0_EED1Ev
	jmp	.L37
.L46:
	endbr64
	movq	%rax, %rbx
.L37:
	leaq	120(%rsp), %rdi
	call	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev
	jmp	.L38
.L45:
	endbr64
	movq	%rax, %rbx
.L38:
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIP10CUevent_stSaIS1_EED1Ev
	jmp	.L39
.L44:
	endbr64
	movq	%rax, %rbx
.L39:
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIP11CUstream_stSaIS1_EED1Ev
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	movq	%rbx, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L51:
	call	__stack_chk_fail@PLT
.L41:
	addq	$232, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.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 .L44-.LFB4024
	.uleb128 0
	.uleb128 .LEHB2-.LFB4024
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L45-.LFB4024
	.uleb128 0
	.uleb128 .LEHB3-.LFB4024
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L46-.LFB4024
	.uleb128 0
	.uleb128 .LEHB4-.LFB4024
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L47-.LFB4024
	.uleb128 0
	.uleb128 .LEHB5-.LFB4024
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L48-.LFB4024
	.uleb128 0
	.uleb128 .LEHB6-.LFB4024
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L49-.LFB4024
	.uleb128 0
	.uleb128 .LEHB7-.LFB4024
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE4024:
	.text
	.size	_Z10dct1024GPUPfS_, .-_Z10dct1024GPUPfS_
	.section	.text._ZNSt6vectorIfSaIfEED2Ev,"axG",@progbits,_ZNSt6vectorIfSaIfEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEED2Ev
	.type	_ZNSt6vectorIfSaIfEED2Ev, @function
_ZNSt6vectorIfSaIfEED2Ev:
.LFB4419:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L56
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L56:
	ret
	.cfi_endproc
.LFE4419:
	.size	_ZNSt6vectorIfSaIfEED2Ev, .-_ZNSt6vectorIfSaIfEED2Ev
	.weak	_ZNSt6vectorIfSaIfEED1Ev
	.set	_ZNSt6vectorIfSaIfEED1Ev,_ZNSt6vectorIfSaIfEED2Ev
	.section	.rodata.str1.1
.LC14:
	.string	"DCT computation completed successfully."
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4025:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4025
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$8192, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$72, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
.LEHB8:
	call	_Znwm@PLT
.LEHE8:
	leaq	8192(%rax), %rdx
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	movq	%rdx, 24(%rsp)
	movl	$0x00000000, (%rax)
	xorl	%eax, %eax
.L59:
	addq	$4, %rax
	cmpq	$8192, %rax
	je	.L73
	movl	$0x00000000, (%rbx,%rax)
	jmp	.L59
.L73:
	xorl	%eax, %eax
	movl	$8192, %edi
	movq	%rdx, 16(%rsp)
	movq	%rax, 40(%rsp)
	movq	%rax, 48(%rsp)
.LEHB9:
	call	_Znwm@PLT
.LEHE9:
	leaq	8192(%rax), %rdx
	movq	%rax, 32(%rsp)
	movq	%rax, %rsi
	movq	%rdx, 48(%rsp)
	movl	$0x00000000, (%rax)
	xorl	%eax, %eax
.L61:
	addq	$4, %rax
	cmpq	$8192, %rax
	je	.L74
	movl	$0x00000000, (%rsi,%rax)
	jmp	.L61
.L74:
	movq	%rdx, 40(%rsp)
	xorl	%eax, %eax
.L63:
	cvtsi2ssq	%rax, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$2048, %rax
	jne	.L63
	movq	%rbx, %rdi
	leaq	32(%rsp), %rbp
.LEHB10:
	call	_Z10dct1024GPUPfS_
	leaq	.LC14(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE10:
	movq	%rbp, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	leaq	8(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L67
	jmp	.L71
.L69:
	endbr64
	movq	%rax, %rbx
.L64:
	movq	%rbp, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L65
.L68:
	endbr64
	movq	%rax, %rbx
.L65:
	leaq	8(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L71
	movq	%rbx, %rdi
.LEHB11:
	call	_Unwind_Resume@PLT
.LEHE11:
.L71:
	call	__stack_chk_fail@PLT
.L67:
	addq	$72, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4025:
	.section	.gcc_except_table
.LLSDA4025:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4025-.LLSDACSB4025
.LLSDACSB4025:
	.uleb128 .LEHB8-.LFB4025
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB9-.LFB4025
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L68-.LFB4025
	.uleb128 0
	.uleb128 .LEHB10-.LFB4025
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L69-.LFB4025
	.uleb128 0
	.uleb128 .LEHB11-.LFB4025
	.uleb128 .LEHE11-.LEHB11
	.uleb128 0
	.uleb128 0
.LLSDACSE4025:
	.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>
#include <cassert>

#define BLOCK_SIZE 256
#define DCT_SIZE 1024
#define NUM_GPUS 2

__global__ void dct1024Kernel(float *d_input, float *d_output) {
    extern __shared__ float shared_mem[];
    int tid = threadIdx.x;
    int bid = blockIdx.x;
    int idx = bid * blockDim.x + tid;

    // Load data into shared memory
    if (idx < DCT_SIZE) {
        shared_mem[tid] = d_input[idx];
    }
    __syncthreads();

    // Perform DCT using shared memory
    // This is a simplified example and does not implement the full DCT algorithm
    // In practice, you would implement the DCT algorithm here
    // For demonstration, we will just square the input as a placeholder
    if (idx < DCT_SIZE) {
        d_output[idx] = shared_mem[tid] * shared_mem[tid];
    }
}

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

void checkCufftError(hipfftResult err, const char *msg) {
    if (err != HIPFFT_SUCCESS) {
        std::cerr << "CUFFT error: " << msg << " (" << err << ")" << std::endl;
        exit(EXIT_FAILURE);
    }
}

void dct1024GPU(float *h_input, float *h_output) {
    int nDevices = NUM_GPUS;
    int device;
    std::vector<hipStream_t> streams(nDevices);
    std::vector<hipEvent_t> start(nDevices), stop(nDevices);
    std::vector<float*> d_input(nDevices), d_output(nDevices);
    std::vector<hipfftHandle> plan(nDevices);

    for (device = 0; device < nDevices; ++device) {
        hipSetDevice(device);
        hipStreamCreate(&streams[device]);
        hipEventCreate(&start[device]);
        hipEventCreate(&stop[device]);

        // Allocate device memory
        checkCudaError(hipMalloc(&d_input[device], DCT_SIZE * sizeof(float)), "Failed to allocate d_input");
        checkCudaError(hipMalloc(&d_output[device], DCT_SIZE * sizeof(float)), "Failed to allocate d_output");

        // Copy data to device
        checkCudaError(hipMemcpyAsync(d_input[device], h_input + device * DCT_SIZE, DCT_SIZE * sizeof(float), hipMemcpyHostToDevice, streams[device]), "Failed to copy data to device");

        // Create CUFFT plan
        checkCufftError(hipfftPlan1d(&plan[device], DCT_SIZE, HIPFFT_R2C, 1), "Failed to create CUFFT plan");

        // Record start event
        hipEventRecord(start[device], streams[device]);

        // Launch kernel
        dct1024Kernel<<<(DCT_SIZE + BLOCK_SIZE - 1) / BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE * sizeof(float), streams[device]>>>(d_input[device], d_output[device]);

        // Record stop event
        hipEventRecord(stop[device], streams[device]);
    }

    for (device = 0; device < nDevices; ++device) {
        hipSetDevice(device);
        // Wait for the kernel to finish
        hipEventSynchronize(stop[device]);

        // Copy data back to host
        checkCudaError(hipMemcpyAsync(h_output + device * DCT_SIZE, d_output[device], DCT_SIZE * sizeof(float), hipMemcpyDeviceToHost, streams[device]), "Failed to copy data back to host");

        // Destroy CUFFT plan
        checkCufftError(hipfftDestroy(plan[device]), "Failed to destroy CUFFT plan");

        // Free device memory
        checkCudaError(hipFree(d_input[device]), "Failed to free d_input");
        checkCudaError(hipFree(d_output[device]), "Failed to free d_output");

        // Destroy streams and events
        hipStreamDestroy(streams[device]);
        hipEventDestroy(start[device]);
        hipEventDestroy(stop[device]);
    }
}

int main() {
    // Initialize input data
    std::vector<float> h_input(DCT_SIZE * NUM_GPUS);
    std::vector<float> h_output(DCT_SIZE * NUM_GPUS);
    for (size_t i = 0; i < h_input.size(); ++i) {
        h_input[i] = static_cast<float>(i);
    }

    // Perform DCT on multiple GPUs
    dct1024GPU(h_input.data(), h_output.data());

    // Verify results (simple check)
    for (size_t i = 0; i < h_output.size(); ++i) {
        assert(h_output[i] == h_input[i] * h_input[i]);
    }

    std::cout << "DCT computation completed successfully." << std::endl;

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

                                        # End of file scope inline assembly
	.globl	_Z28__device_stub__dct1024KernelPfS_ # -- Begin function _Z28__device_stub__dct1024KernelPfS_
	.type	_Z28__device_stub__dct1024KernelPfS_,@function
_Z28__device_stub__dct1024KernelPfS_:   # @_Z28__device_stub__dct1024KernelPfS_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z13dct1024KernelPfS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__dct1024KernelPfS_, .Lfunc_end0-_Z28__device_stub__dct1024KernelPfS_
	.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
	movl	$.L.str.2, %esi
	movq	%rax, %rdi
	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	%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.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
	movl	$.L.str.2, %esi
	movq	%rax, %rdi
	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 _Z10dct1024GPUPfS_
.LCPI3_0:
	.zero	16
	.text
	.globl	_Z10dct1024GPUPfS_
	.type	_Z10dct1024GPUPfS_,@function
_Z10dct1024GPUPfS_:                     # @_Z10dct1024GPUPfS_
.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, 56(%rsp)                  # 8-byte Spill
	movq	%rdi, 64(%rsp)                  # 8-byte Spill
	movl	$16, %edi
	callq	_Znwm
	xorps	%xmm0, %xmm0
	movq	%rax, (%rsp)                    # 8-byte Spill
	movups	%xmm0, (%rax)
.Ltmp0:
	movl	$16, %edi
	callq	_Znwm
.Ltmp1:
# %bb.1:
	movq	%rax, %r15
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
.Ltmp3:
	movl	$16, %edi
	callq	_Znwm
.Ltmp4:
# %bb.2:
	movq	%rax, %r12
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
.Ltmp6:
	movl	$16, %edi
	callq	_Znwm
.Ltmp7:
# %bb.3:
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
.Ltmp9:
	movl	$16, %edi
	callq	_Znwm
.Ltmp10:
# %bb.4:
	movq	%r12, 24(%rsp)                  # 8-byte Spill
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movups	%xmm0, (%rax)
.Ltmp12:
	movl	$16, %edi
	callq	_Znwm
.Ltmp13:
# %bb.5:
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
	movb	$1, %al
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	xorl	%r13d, %r13d
.LBB3_6:                                # =>This Inner Loop Header: Depth=1
.Ltmp15:
	movl	%r13d, %edi
	callq	hipSetDevice
.Ltmp16:
# %bb.7:                                #   in Loop: Header=BB3_6 Depth=1
	movq	(%rsp), %rax                    # 8-byte Reload
	leaq	(%rax,%r13,8), %r14
.Ltmp17:
	movq	%r14, %rdi
	callq	hipStreamCreate
.Ltmp18:
# %bb.8:                                #   in Loop: Header=BB3_6 Depth=1
	movq	32(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r13,8), %r15
.Ltmp19:
	movq	%r15, %rdi
	callq	hipEventCreate
.Ltmp20:
# %bb.9:                                #   in Loop: Header=BB3_6 Depth=1
	movq	24(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r13,8), %r12
.Ltmp21:
	movq	%r12, %rdi
	callq	hipEventCreate
.Ltmp22:
# %bb.10:                               #   in Loop: Header=BB3_6 Depth=1
	movq	40(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r13,8), %rbx
.Ltmp23:
	movl	$4096, %esi                     # imm = 0x1000
	movq	%rbx, %rdi
	callq	hipMalloc
.Ltmp24:
# %bb.11:                               # %_ZL9hipMallocIfE10hipError_tPPT_m.exit
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp25:
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp26:
# %bb.12:                               #   in Loop: Header=BB3_6 Depth=1
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r13,8), %rbp
.Ltmp27:
	movl	$4096, %esi                     # imm = 0x1000
	movq	%rbp, %rdi
	callq	hipMalloc
.Ltmp28:
# %bb.13:                               # %_ZL9hipMallocIfE10hipError_tPPT_m.exit61
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp29:
	movl	$.L.str.5, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp30:
# %bb.14:                               #   in Loop: Header=BB3_6 Depth=1
	movq	(%rbx), %rdi
	movq	%r13, %rsi
	shlq	$12, %rsi
	addq	64(%rsp), %rsi                  # 8-byte Folded Reload
	movq	(%r14), %r8
.Ltmp31:
	movl	$4096, %edx                     # imm = 0x1000
	movl	$1, %ecx
	callq	hipMemcpyAsync
.Ltmp32:
# %bb.15:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp33:
	movl	$.L.str.6, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp34:
# %bb.16:                               #   in Loop: Header=BB3_6 Depth=1
	movq	48(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r13,8), %rdi
.Ltmp35:
	movl	$1024, %esi                     # imm = 0x400
	movl	$42, %edx
	movl	$1, %ecx
	callq	hipfftPlan1d
.Ltmp36:
# %bb.17:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp37:
	movl	$.L.str.7, %esi
	movl	%eax, %edi
	callq	_Z15checkCufftError14hipfftResult_tPKc
.Ltmp38:
# %bb.18:                               #   in Loop: Header=BB3_6 Depth=1
	movq	(%r15), %rdi
	movq	(%r14), %rsi
.Ltmp39:
	callq	hipEventRecord
.Ltmp40:
# %bb.19:                               #   in Loop: Header=BB3_6 Depth=1
	movq	(%r14), %r9
.Ltmp41:
	movl	$1024, %r8d                     # imm = 0x400
	movabsq	$4294967300, %rdi               # imm = 0x100000004
	movl	$1, %esi
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %ecx
	callq	__hipPushCallConfiguration
.Ltmp42:
# %bb.20:                               #   in Loop: Header=BB3_6 Depth=1
	testl	%eax, %eax
	jne	.LBB3_22
# %bb.21:                               #   in Loop: Header=BB3_6 Depth=1
	movq	(%rbx), %rdi
	movq	(%rbp), %rsi
.Ltmp43:
	callq	_Z28__device_stub__dct1024KernelPfS_
.Ltmp44:
.LBB3_22:                               #   in Loop: Header=BB3_6 Depth=1
	movq	(%r12), %rdi
	movq	(%r14), %rsi
.Ltmp45:
	callq	hipEventRecord
.Ltmp46:
# %bb.23:                               #   in Loop: Header=BB3_6 Depth=1
	movl	$1, %r13d
	testb	$1, 12(%rsp)                    # 1-byte Folded Reload
	movl	$0, 12(%rsp)                    # 4-byte Folded Spill
	jne	.LBB3_6
# %bb.24:                               # %.preheader.preheader
	movb	$1, %bl
	xorl	%r14d, %r14d
	movq	32(%rsp), %r15                  # 8-byte Reload
	movq	24(%rsp), %r12                  # 8-byte Reload
	movq	16(%rsp), %r13                  # 8-byte Reload
	movq	48(%rsp), %rbp                  # 8-byte Reload
.LBB3_25:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
.Ltmp48:
	movl	%r14d, %edi
	callq	hipSetDevice
.Ltmp49:
# %bb.26:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%r12,%r14,8), %rdi
.Ltmp50:
	callq	hipEventSynchronize
.Ltmp51:
# %bb.27:                               #   in Loop: Header=BB3_25 Depth=1
	movq	%r14, %rdi
	shlq	$12, %rdi
	addq	56(%rsp), %rdi                  # 8-byte Folded Reload
	movq	(%r13,%r14,8), %rsi
	movq	(%rsp), %rax                    # 8-byte Reload
	movq	(%rax,%r14,8), %r8
.Ltmp52:
	movl	$4096, %edx                     # imm = 0x1000
	movl	$2, %ecx
	callq	hipMemcpyAsync
.Ltmp53:
# %bb.28:                               #   in Loop: Header=BB3_25 Depth=1
.Ltmp54:
	movl	$.L.str.8, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp55:
# %bb.29:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%rbp,%r14,8), %rdi
.Ltmp56:
	callq	hipfftDestroy
.Ltmp57:
# %bb.30:                               #   in Loop: Header=BB3_25 Depth=1
.Ltmp58:
	movl	$.L.str.9, %esi
	movl	%eax, %edi
	callq	_Z15checkCufftError14hipfftResult_tPKc
.Ltmp59:
# %bb.31:                               #   in Loop: Header=BB3_25 Depth=1
	movq	40(%rsp), %rax                  # 8-byte Reload
	movq	(%rax,%r14,8), %rdi
.Ltmp60:
	callq	hipFree
.Ltmp61:
# %bb.32:                               #   in Loop: Header=BB3_25 Depth=1
.Ltmp62:
	movl	$.L.str.10, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp63:
# %bb.33:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%r13,%r14,8), %rdi
.Ltmp64:
	callq	hipFree
.Ltmp65:
# %bb.34:                               #   in Loop: Header=BB3_25 Depth=1
.Ltmp66:
	movl	$.L.str.11, %esi
	movl	%eax, %edi
	callq	_Z14checkCudaError10hipError_tPKc
.Ltmp67:
# %bb.35:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%rsp), %rax                    # 8-byte Reload
	movq	(%rax,%r14,8), %rdi
.Ltmp68:
	callq	hipStreamDestroy
.Ltmp69:
# %bb.36:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%r15,%r14,8), %rdi
.Ltmp70:
	callq	hipEventDestroy
.Ltmp71:
# %bb.37:                               #   in Loop: Header=BB3_25 Depth=1
	movq	(%r12,%r14,8), %rdi
.Ltmp72:
	callq	hipEventDestroy
.Ltmp73:
# %bb.38:                               #   in Loop: Header=BB3_25 Depth=1
	movl	$1, %r14d
	testb	$1, %bl
	movl	$0, %ebx
	jne	.LBB3_25
# %bb.39:                               # %_ZNSt6vectorIP12ihipStream_tSaIS1_EED2Ev.exit
	movq	%rbp, %rdi
	callq	_ZdlPv
	movq	%r13, %rdi
	callq	_ZdlPv
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
	movq	%r12, %rdi
	callq	_ZdlPv
	movq	%r15, %rdi
	callq	_ZdlPv
	movq	(%rsp), %rdi                    # 8-byte Reload
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZdlPv                          # TAILCALL
.LBB3_47:
	.cfi_def_cfa_offset 128
.Ltmp14:
	movq	%rax, %rbx
	movq	32(%rsp), %r15                  # 8-byte Reload
	movq	24(%rsp), %r12                  # 8-byte Reload
	movq	16(%rsp), %r13                  # 8-byte Reload
	jmp	.LBB3_48
.LBB3_43:
.Ltmp11:
	movq	%rax, %rbx
	jmp	.LBB3_49
.LBB3_42:
.Ltmp8:
	movq	%rax, %rbx
	jmp	.LBB3_50
.LBB3_41:
.Ltmp5:
	movq	%rax, %rbx
	jmp	.LBB3_51
.LBB3_40:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB3_52
.LBB3_44:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit.loopexit
.Ltmp74:
	movq	%rax, %rbx
	jmp	.LBB3_46
.LBB3_45:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit.loopexit.split-lp
.Ltmp47:
	movq	%rax, %rbx
	movq	32(%rsp), %r15                  # 8-byte Reload
	movq	24(%rsp), %r12                  # 8-byte Reload
	movq	16(%rsp), %r13                  # 8-byte Reload
	movq	48(%rsp), %rbp                  # 8-byte Reload
.LBB3_46:                               # %_ZNSt6vectorIP14hipfftHandle_tSaIS1_EED2Ev.exit
	movq	%rbp, %rdi
	callq	_ZdlPv
.LBB3_48:                               # %_ZNSt6vectorIPfSaIS0_EED2Ev.exit72
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB3_49:                               # %_ZNSt6vectorIPfSaIS0_EED2Ev.exit74
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdlPv
.LBB3_50:                               # %_ZNSt6vectorIP11ihipEvent_tSaIS1_EED2Ev.exit76
	movq	%r12, %rdi
	callq	_ZdlPv
.LBB3_51:                               # %_ZNSt6vectorIP11ihipEvent_tSaIS1_EED2Ev.exit78
	movq	%r15, %rdi
	callq	_ZdlPv
.LBB3_52:                               # %_ZNSt6vectorIP12ihipStream_tSaIS1_EED2Ev.exit80
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	_ZdlPv
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z10dct1024GPUPfS_, .Lfunc_end3-_Z10dct1024GPUPfS_
	.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 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.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 4 <<
	.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 5 <<
	.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 6 <<
	.uleb128 .Ltmp13-.Ltmp12                #   Call between .Ltmp12 and .Ltmp13
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp46-.Ltmp15                #   Call between .Ltmp15 and .Ltmp46
	.uleb128 .Ltmp47-.Lfunc_begin0          #     jumps to .Ltmp47
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp48-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp73-.Ltmp48                #   Call between .Ltmp48 and .Ltmp73
	.uleb128 .Ltmp74-.Lfunc_begin0          #     jumps to .Ltmp74
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp73-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Lfunc_end3-.Ltmp73            #   Call between .Ltmp73 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r15
	.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 %r15, -16
	movl	$8192, %edi                     # imm = 0x2000
	callq	_Znwm
	movq	%rax, %rbx
	movl	$8192, %edx                     # imm = 0x2000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
.Ltmp75:
	movl	$8192, %edi                     # imm = 0x2000
	callq	_Znwm
.Ltmp76:
# %bb.1:
	movq	%rax, %r14
	xorl	%r15d, %r15d
	movl	$8192, %edx                     # imm = 0x2000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
.LBB4_2:                                # =>This Inner Loop Header: Depth=1
	testq	%r15, %r15
	js	.LBB4_3
# %bb.10:                               #   in Loop: Header=BB4_2 Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r15, %xmm0
	jmp	.LBB4_11
.LBB4_3:                                #   in Loop: Header=BB4_2 Depth=1
	movq	%r15, %rax
	shrq	%rax
	movl	%r15d, %ecx
	andl	$1, %ecx
	orq	%rax, %rcx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rcx, %xmm0
	addss	%xmm0, %xmm0
.LBB4_11:                               #   in Loop: Header=BB4_2 Depth=1
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	$2048, %r15                     # imm = 0x800
	jne	.LBB4_2
# %bb.4:
.Ltmp78:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_Z10dct1024GPUPfS_
.Ltmp79:
# %bb.5:                                # %.preheader.preheader
.Ltmp80:
	movl	$_ZSt4cout, %r15d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.12, %esi
	movl	$39, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp81:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r15
.Ltmp82:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp83:
# %bb.7:                                # %.noexc
.Ltmp84:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp85:
# %bb.8:                                # %.noexc22
.Ltmp86:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp87:
# %bb.9:                                # %_ZNSt6vectorIfSaIfEED2Ev.exit18
	movq	%r14, %rdi
	callq	_ZdlPv
	movq	%rbx, %rdi
	callq	_ZdlPv
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB4_13:
	.cfi_def_cfa_offset 32
.Ltmp77:
	movq	%rax, %r15
	jmp	.LBB4_14
.LBB4_12:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit
.Ltmp88:
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_ZdlPv
.LBB4_14:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit20
	movq	%rbx, %rdi
	callq	_ZdlPv
	movq	%r15, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp75-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp75
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp75-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp76-.Ltmp75                #   Call between .Ltmp75 and .Ltmp76
	.uleb128 .Ltmp77-.Lfunc_begin1          #     jumps to .Ltmp77
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp76-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp78-.Ltmp76                #   Call between .Ltmp76 and .Ltmp78
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp78-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp87-.Ltmp78                #   Call between .Ltmp78 and .Ltmp87
	.uleb128 .Ltmp88-.Lfunc_begin1          #     jumps to .Ltmp88
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp87-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Lfunc_end4-.Ltmp87            #   Call between .Ltmp87 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13dct1024KernelPfS_, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB6_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13dct1024KernelPfS_,@object   # @_Z13dct1024KernelPfS_
	.section	.rodata,"a",@progbits
	.globl	_Z13dct1024KernelPfS_
	.p2align	3, 0x0
_Z13dct1024KernelPfS_:
	.quad	_Z28__device_stub__dct1024KernelPfS_
	.size	_Z13dct1024KernelPfS_, 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, 3

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"CUFFT error: "
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Failed to allocate d_input"
	.size	.L.str.4, 27

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Failed to allocate d_output"
	.size	.L.str.5, 28

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Failed to copy data to device"
	.size	.L.str.6, 30

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Failed to create CUFFT plan"
	.size	.L.str.7, 28

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Failed to copy data back to host"
	.size	.L.str.8, 33

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Failed to destroy CUFFT plan"
	.size	.L.str.9, 29

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Failed to free d_input"
	.size	.L.str.10, 23

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Failed to free d_output"
	.size	.L.str.11, 24

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"DCT computation completed successfully."
	.size	.L.str.12, 40

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13dct1024KernelPfS_"
	.size	.L__unnamed_1, 22

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z28__device_stub__dct1024KernelPfS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z13dct1024KernelPfS_
	.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	_Z13dct1024KernelPfS_   ; -- Begin function _Z13dct1024KernelPfS_
	.globl	_Z13dct1024KernelPfS_
	.p2align	8
	.type	_Z13dct1024KernelPfS_,@function
_Z13dct1024KernelPfS_:                  ; @_Z13dct1024KernelPfS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_lshl_add_u32 v0, v0, 2, 0
	v_cmp_gt_i32_e32 vcc_lo, 0x400, v1
	v_ashrrev_i32_e32 v2, 31, v1
	s_and_saveexec_b32 s4, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	v_add_co_u32 v3, s0, s0, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v4, s0, s1, v4, s0
	global_load_b32 v3, v[3:4], off
	s_waitcnt vmcnt(0)
	ds_store_b32 v0, v3
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s0, vcc_lo
	s_cbranch_execz .LBB0_4
; %bb.3:
	ds_load_b32 v3, v0
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_waitcnt lgkmcnt(0)
	v_mul_f32_e32 v2, v3, v3
	global_store_b32 v[0:1], v2, off
.LBB0_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13dct1024KernelPfS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.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
	.text
.Lfunc_end0:
	.size	_Z13dct1024KernelPfS_, .Lfunc_end0-_Z13dct1024KernelPfS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 212
; 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:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         136
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13dct1024KernelPfS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13dct1024KernelPfS_.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
