#include <cuda.h>
#include <stdio.h>
#include <sys/time.h>

#define CHECK(call) { \
	cudaError_t err; \
	if ( (err = (call)) != cudaSuccess) { \
		fprintf(stderr, "Got error %s at %s:%d\n", cudaGetErrorString(err), \
				__FILE__, __LINE__); \
		exit(1); \
	} \
}

__global__ void kernel2(int *a, int *b, int c)
{
	int tx = threadIdx.x;
	switch (tx)
	{
		case 0:
			a[tx] = a[tx] + 2;
			break;
		case 1:
			a[tx] = a[tx] + 3;
			break;
		default:
			break;
	}
}
__global__ void kernel(float *g_data, float value)
{
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    g_data[idx] = g_data[idx] + value;
	// printf("%f+g_data[%d]=%f\n", value, idx, g_data[idx]);
}

int checkResult(float *data, const int n, const float x)
{
    for (int i = 0; i < n; i++)
    {
        if (data[i] != x)
        {
            printf("Error! data[%d] = %f, ref = %f\n", i, data[i], x);
            return 0;
        }
    }

    return 1;
}

void test()
{
	printf("sizeof(cudaEvent_t)=%lu\n", sizeof(cudaEvent_t));
	printf("sizeof(cudaStream_t)=%lu\n", sizeof(cudaStream_t));
	printf("sizeof(cudaError_t)=%lu\n", sizeof(cudaError_t));
	printf("sizeof(uint64_t)=%lu\n", sizeof(uint64_t));
	printf("sizeof(uint32_t)=%lu\n", sizeof(uint32_t));
}

#define  TIMING

static double tvsub(struct timeval start, struct timeval end)
{
	return (double)(end.tv_usec - start.tv_usec)/1000000 +
                        (double)(end.tv_sec - start.tv_sec);
}

int main()
{
	/* test case 1
	* for 	__cudaRegisterFatBinary
			__cudaUnregisterFatBinary
			__cudaRegisterFunction
	*/
	// return 0;
	int devID=1;
	int count = 0;
	struct cudaDeviceProp props;
	float *d_a=0;
	float *h_a=0;
	dim3 block, grid;
	int num = 1 << 24;
    int nbytes = num * sizeof(float);
    int value=41;
    struct timeval malloc_start, malloc_end;
    struct timeval meminit_start, meminit_end;
    struct timeval free_start, free_end;
    struct timeval d_malloc_start, d_malloc_end;
    struct timeval d_meminit_start, d_meminit_end;
    struct timeval d_free_start, d_free_end;
    struct timeval HtoD_start, HtoD_end;
    struct timeval DtoH_start, DtoH_end;
    struct timeval kernel_start, kernel_end;
    struct timeval total_start, total_end;
	//test();
	/* test case 2
	* add 	cudaGetDeviceCount
			cudaGetDevice
			cudaGetDeviceProperties
	*/
	devID = 0;
	CHECK(cudaSetDevice(devID));
	CHECK(cudaGetDeviceCount(&count));
	printf("cuda count=%d\n", count);
	// CHECK(cudaGetDevice(&devID));
	CHECK(cudaGetDeviceProperties(&props, devID));
	printf("Device %d: \"%s\" with Compute %d.%d capability\n",devID, props.name, props.major, props.minor);

	// printf("num 0x%x\n", num);
	#ifdef  TIMING
		gettimeofday(&total_start, NULL);
	#endif

    printf("sending 0x%x\n", nbytes);
	printf("allocating 0x%x\n", nbytes);
    #ifdef  TIMING
		gettimeofday(&malloc_start, NULL);
	#endif
	h_a=(float*)malloc(nbytes);
	#ifdef  TIMING
		gettimeofday(&malloc_end, NULL);
	#endif

	printf("initing mem\n");
	#ifdef  TIMING
		gettimeofday(&meminit_start, NULL);
	#endif
	memset(h_a, 0, nbytes);
	#ifdef  TIMING
		gettimeofday(&meminit_end, NULL);
	#endif
	printf("h_a=%p\n", h_a);
	// h_a[0] = 1;
	// start

	#ifdef  TIMING
		gettimeofday(&d_malloc_start, NULL);
	#endif
	CHECK(cudaMalloc((void**)&d_a, nbytes));
	#ifdef  TIMING
		gettimeofday(&d_malloc_end, NULL);
	#endif
	printf("d_a address = %p\n", d_a);
	#ifdef  TIMING
		gettimeofday(&d_meminit_start, NULL);
	#endif
	CHECK(cudaMemset(d_a, 0, nbytes));
	#ifdef  TIMING
		gettimeofday(&d_meminit_end, NULL);
	#endif
	
	// set kernel launch configuration
    block = dim3(4);
    grid  = dim3((num + block.x - 1) / block.x);

	#ifdef  TIMING
		gettimeofday(&HtoD_start, NULL);
	#endif
	// CHECK(cudaMemcpy(d_a, h_a, nbytes, cudaMemcpyHostToDevice));
	CHECK(cudaMemcpy(d_a, h_a, nbytes, cudaMemcpyDefault));
	#ifdef  TIMING
		gettimeofday(&HtoD_end, NULL);
	#endif
	#ifdef  TIMING
		gettimeofday(&kernel_start, NULL);
	#endif
	kernel<<<grid, block>>>(d_a, value);
	#ifdef  TIMING
		gettimeofday(&kernel_end, NULL);
	#endif

	#ifdef  TIMING
		gettimeofday(&DtoH_start, NULL);
	#endif
	// CHECK(cudaMemcpy(h_a, d_a, nbytes, cudaMemcpyDeviceToHost));
	CHECK(cudaMemcpy(h_a, d_a, nbytes, cudaMemcpyDefault));
	#ifdef  TIMING
		gettimeofday(&DtoH_end, NULL);
	#endif

 	bool bFinalResults = (bool) checkResult(h_a, num, value);
	printf("result:%s\n", bFinalResults? "PASS" : "FAILED");
	// end
	#ifdef  TIMING
		gettimeofday(&d_free_start, NULL);
	#endif
	CHECK(cudaFree(d_a));
	#ifdef  TIMING
		gettimeofday(&d_free_end, NULL);
	#endif

	#ifdef  TIMING
		gettimeofday(&free_start, NULL);
	#endif
	free(h_a);
	#ifdef  TIMING
		gettimeofday(&free_end, NULL);
	#endif

	/* test case 3
	* add 	cudaMalloc
			cudaMemset
			cudaMemcpy
			cudaLaunch
			cudaFree
	*/
	#ifdef  TIMING
	gettimeofday(&total_end, NULL);
	double total_time 	= tvsub(total_start, total_end);
	double malloc_time 	= tvsub(malloc_start, malloc_end);
	double meminit_time 	= tvsub(meminit_start, meminit_end);
	double free_time 	= tvsub(free_start, free_end);
	double d_malloc_time 	= tvsub(d_malloc_start, d_malloc_end);
	double d_meminit_time 	= tvsub(d_meminit_start, d_meminit_end);
	double d_free_time 	= tvsub(d_free_start, d_free_end);
	double HtoD_time 	= tvsub(HtoD_start, HtoD_end);
	double DtoH_time 	= tvsub(DtoH_start, DtoH_end);
	double kernel_time 	= tvsub(kernel_start, kernel_end);

	printf("================\n");
	printf("total_time : \t\t%f\n", total_time);
	printf("host malloc: \t\t%f\n", malloc_time);
	printf("host mem init: \t\t%f\n", meminit_time);
	printf("device malloc: \t\t%f\n", d_malloc_time);
	printf("device mem init: \t%f\n", d_meminit_time);
	printf("HtoD: \t\t\t%f\n", HtoD_time);
	printf("Exec: \t\t\t%f\n", kernel_time);
	printf("DtoH: \t\t\t%f\n", DtoH_time);
	printf("device free: \t\t%f\n", d_free_time);
	printf("host free: \t\t%f\n", free_time);
	printf("================\n");
	#endif

	return EXIT_SUCCESS;
}

	.file	"tmpxft_00384b32_00000000-6_launchkernel.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL5tvsub7timevalS_, @function
_ZL5tvsub7timevalS_:
.LFB2029:
	.cfi_startproc
	subq	%rdi, %rdx
	subq	%rsi, %rcx
	cvtsi2sdq	%rdx, %xmm1
	cvtsi2sdq	%rcx, %xmm0
	divsd	.LC0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2029:
	.size	_ZL5tvsub7timevalS_, .-_ZL5tvsub7timevalS_
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"Error! data[%d] = %f, ref = %f\n"
	.text
	.globl	_Z11checkResultPfif
	.type	_Z11checkResultPfif, @function
_Z11checkResultPfif:
.LFB2027:
	.cfi_startproc
	endbr64
	xorl	%edx, %edx
.L4:
	cmpl	%edx, %esi
	jle	.L14
	leaq	1(%rdx), %rax
	movss	-4(%rdi,%rax,4), %xmm2
	ucomiss	%xmm0, %xmm2
	jp	.L9
	je	.L8
.L9:
	pushq	%rax
	.cfi_def_cfa_offset 16
	cvtss2sd	%xmm2, %xmm2
	cvtss2sd	%xmm0, %xmm1
	movb	$2, %al
	movaps	%xmm2, %xmm0
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
.L8:
	movq	%rax, %rdx
	jmp	.L4
.L14:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z11checkResultPfif, .-_Z11checkResultPfif
	.section	.rodata.str1.1
.LC2:
	.string	"sizeof(cudaEvent_t)=%lu\n"
.LC3:
	.string	"sizeof(cudaStream_t)=%lu\n"
.LC4:
	.string	"sizeof(cudaError_t)=%lu\n"
.LC5:
	.string	"sizeof(uint64_t)=%lu\n"
.LC6:
	.string	"sizeof(uint32_t)=%lu\n"
	.text
	.globl	_Z4testv
	.type	_Z4testv, @function
_Z4testv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$8, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$8, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$4, %edx
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$8, %edx
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$4, %edx
	movl	$2, %edi
	popq	%rcx
	.cfi_def_cfa_offset 8
	leaq	.LC6(%rip), %rsi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z4testv, .-_Z4testv
	.globl	_Z29__device_stub__Z7kernel2PiS_iPiS_i
	.type	_Z29__device_stub__Z7kernel2PiS_iPiS_i, @function
_Z29__device_stub__Z7kernel2PiS_iPiS_i:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L17
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel2PiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L17:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z29__device_stub__Z7kernel2PiS_iPiS_i, .-_Z29__device_stub__Z7kernel2PiS_iPiS_i
	.globl	_Z7kernel2PiS_i
	.type	_Z7kernel2PiS_i, @function
_Z7kernel2PiS_i:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel2PiS_iPiS_i
	.cfi_endproc
.LFE2056:
	.size	_Z7kernel2PiS_i, .-_Z7kernel2PiS_i
	.globl	_Z26__device_stub__Z6kernelPffPff
	.type	_Z26__device_stub__Z6kernelPffPff, @function
_Z26__device_stub__Z6kernelPffPff:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movss	%xmm0, 4(%rsp)
	leaq	52(%rsp), %rsi
	leaq	40(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	leaq	4(%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	.L22
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z6kernelPff(%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
.L22:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z26__device_stub__Z6kernelPffPff, .-_Z26__device_stub__Z6kernelPffPff
	.globl	_Z6kernelPff
	.type	_Z6kernelPff, @function
_Z6kernelPff:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z26__device_stub__Z6kernelPffPff
	.cfi_endproc
.LFE2058:
	.size	_Z6kernelPff, .-_Z6kernelPff
	.section	.rodata.str1.1
.LC7:
	.string	"PASS"
.LC8:
	.string	"FAILED"
.LC9:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/juniorprincewang/virtio-cuda-module/master/test/launchkernel/launchkernel.cu"
.LC10:
	.string	"Got error %s at %s:%d\n"
.LC11:
	.string	"cuda count=%d\n"
.LC12:
	.string	"Device %d: \"%s\" with Compute %d.%d capability\n"
.LC13:
	.string	"sending 0x%x\n"
.LC14:
	.string	"allocating 0x%x\n"
.LC15:
	.string	"initing mem\n"
.LC16:
	.string	"h_a=%p\n"
.LC17:
	.string	"d_a address = %p\n"
.LC19:
	.string	"result:%s\n"
.LC20:
	.string	"================\n"
.LC21:
	.string	"total_time : \t\t%f\n"
.LC22:
	.string	"host malloc: \t\t%f\n"
.LC23:
	.string	"host mem init: \t\t%f\n"
.LC24:
	.string	"device malloc: \t\t%f\n"
.LC25:
	.string	"device mem init: \t%f\n"
.LC26:
	.string	"HtoD: \t\t\t%f\n"
.LC27:
	.string	"Exec: \t\t\t%f\n"
.LC28:
	.string	"DtoH: \t\t\t%f\n"
.LC29:
	.string	"device free: \t\t%f\n"
.LC30:
	.string	"host free: \t\t%f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edx, %edx
	xorl	%edi, %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	$1464, %rsp
	.cfi_def_cfa_offset 1520
	movq	%fs:40, %rax
	movq	%rax, 1448(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rdx, 64(%rsp)
	movl	%eax, 60(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 76(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	cudaSetDevice@PLT
	testl	%eax, %eax
	je	.L28
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$101, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L28:
	leaq	60(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L29
	call	cudaGetErrorString@PLT
	movl	$102, %r9d
	movq	%rax, %rcx
.L41:
	movq	stderr(%rip), %rdi
	leaq	.LC9(%rip), %r8
	leaq	.LC10(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L29:
	movl	60(%rsp), %edx
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	416(%rsp), %rbx
	call	__printf_chk@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L30
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$105, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L30:
	movl	780(%rsp), %r9d
	movq	%rbx, %rcx
	xorl	%edx, %edx
	xorl	%eax, %eax
	movl	776(%rsp), %r8d
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	384(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movl	$67108864, %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$67108864, %edx
	leaq	.LC14(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%esi, %esi
	leaq	96(%rsp), %rdi
	call	gettimeofday@PLT
	movl	$67108864, %edi
	call	malloc@PLT
	leaq	112(%rsp), %rdi
	xorl	%esi, %esi
	movq	%rax, %rbx
	call	gettimeofday@PLT
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	128(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movl	%ebp, %eax
	movl	$16777216, %ecx
	movq	%rbx, %rdi
	rep stosl
	xorl	%esi, %esi
	leaq	144(%rsp), %rdi
	call	gettimeofday@PLT
	movq	%rbx, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC16(%rip), %rsi
	call	__printf_chk@PLT
	leaq	192(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	64(%rsp), %rdi
	movl	$67108864, %esi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L31
	call	cudaGetErrorString@PLT
	movl	$138, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L31:
	leaq	208(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	64(%rsp), %rdx
	leaq	.LC17(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	224(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	64(%rsp), %rdi
	movl	$67108864, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L32
	call	cudaGetErrorString@PLT
	movl	$146, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L32:
	leaq	240(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	288(%rsp), %rdi
	xorl	%esi, %esi
	movl	$4, 72(%rsp)
	movl	$4194304, 84(%rsp)
	call	gettimeofday@PLT
	movq	64(%rsp), %rdi
	movl	$4, %ecx
	movq	%rbx, %rsi
	movl	$67108864, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L33
	call	cudaGetErrorString@PLT
	movl	$159, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L33:
	xorl	%esi, %esi
	leaq	304(%rsp), %rdi
	call	gettimeofday@PLT
	xorl	%esi, %esi
	leaq	352(%rsp), %rdi
	call	gettimeofday@PLT
	movl	80(%rsp), %ecx
	movl	92(%rsp), %esi
	xorl	%r9d, %r9d
	movq	72(%rsp), %rdx
	movq	84(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	movss	.LC18(%rip), %xmm0
	movq	64(%rsp), %rdi
	call	_Z26__device_stub__Z6kernelPffPff
.L34:
	leaq	368(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	320(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	64(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$4, %ecx
	movl	$67108864, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L35
	call	cudaGetErrorString@PLT
	movl	$175, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L35:
	xorl	%esi, %esi
	leaq	336(%rsp), %rdi
	call	gettimeofday@PLT
	movss	.LC18(%rip), %xmm0
	movl	$16777216, %esi
	movq	%rbx, %rdi
	call	_Z11checkResultPfif
	leaq	.LC8(%rip), %rdx
	movl	$2, %edi
	leaq	.LC19(%rip), %rsi
	testl	%eax, %eax
	leaq	.LC7(%rip), %rax
	cmovne	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	256(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$186, %r9d
	movq	%rax, %rcx
	jmp	.L41
.L37:
	leaq	272(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	xorl	%esi, %esi
	leaq	160(%rsp), %rdi
	call	gettimeofday@PLT
	movq	%rbx, %rdi
	leaq	.LC20(%rip), %rbx
	call	free@PLT
	leaq	176(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	400(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	400(%rsp), %rdx
	xorl	%eax, %eax
	movq	408(%rsp), %rcx
	movq	384(%rsp), %rdi
	movq	392(%rsp), %rsi
	call	_ZL5tvsub7timevalS_
	movq	112(%rsp), %rdx
	movq	120(%rsp), %rcx
	movq	96(%rsp), %rdi
	movq	104(%rsp), %rsi
	movq	%xmm0, %rbp
	call	_ZL5tvsub7timevalS_
	movq	144(%rsp), %rdx
	movq	152(%rsp), %rcx
	movq	128(%rsp), %rdi
	movq	136(%rsp), %rsi
	movq	%xmm0, %r14
	call	_ZL5tvsub7timevalS_
	movq	176(%rsp), %rdx
	movq	184(%rsp), %rcx
	movq	160(%rsp), %rdi
	movq	168(%rsp), %rsi
	movq	%xmm0, %r15
	call	_ZL5tvsub7timevalS_
	movq	208(%rsp), %rdx
	movq	216(%rsp), %rcx
	movq	192(%rsp), %rdi
	movq	200(%rsp), %rsi
	movq	%xmm0, %r12
	call	_ZL5tvsub7timevalS_
	movq	240(%rsp), %rdx
	movq	224(%rsp), %rdi
	movq	232(%rsp), %rsi
	movq	248(%rsp), %rcx
	movq	%xmm0, %r13
	call	_ZL5tvsub7timevalS_
	movq	272(%rsp), %rdx
	movsd	%xmm0, 8(%rsp)
	movq	280(%rsp), %rcx
	movq	256(%rsp), %rdi
	movq	264(%rsp), %rsi
	call	_ZL5tvsub7timevalS_
	movq	304(%rsp), %rdx
	movq	312(%rsp), %rcx
	movq	288(%rsp), %rdi
	movq	296(%rsp), %rsi
	movsd	%xmm0, 16(%rsp)
	call	_ZL5tvsub7timevalS_
	movq	336(%rsp), %rdx
	movq	344(%rsp), %rcx
	movq	320(%rsp), %rdi
	movq	328(%rsp), %rsi
	movsd	%xmm0, 24(%rsp)
	call	_ZL5tvsub7timevalS_
	movq	368(%rsp), %rdx
	movq	376(%rsp), %rcx
	movq	352(%rsp), %rdi
	movq	360(%rsp), %rsi
	movsd	%xmm0, 32(%rsp)
	call	_ZL5tvsub7timevalS_
	movq	%rbx, %rsi
	movl	$2, %edi
	movsd	%xmm0, 40(%rsp)
	call	__printf_chk@PLT
	movq	%rbp, %xmm0
	leaq	.LC21(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%r14, %xmm0
	leaq	.LC22(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%r15, %xmm0
	leaq	.LC23(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%r13, %xmm0
	leaq	.LC24(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movsd	8(%rsp), %xmm0
	leaq	.LC25(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movsd	24(%rsp), %xmm0
	leaq	.LC26(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movsd	40(%rsp), %xmm0
	leaq	.LC27(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movsd	32(%rsp), %xmm0
	leaq	.LC28(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movsd	16(%rsp), %xmm0
	leaq	.LC29(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC30(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movq	%r12, %xmm0
	call	__printf_chk@PLT
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	1448(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$1464, %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
.LFE2030:
	.size	main, .-main
	.section	.rodata.str1.1
.LC31:
	.string	"_Z6kernelPff"
.LC32:
	.string	"_Z7kernel2PiS_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -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	.LC31(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z6kernelPff(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC32(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7kernel2PiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	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	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2060:
	.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1093567616
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC18:
	.long	1109655552
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <hip/hip_runtime.h>
#include <stdio.h>
#include <sys/time.h>

#define CHECK(call) { \
	hipError_t err; \
	if ( (err = (call)) != hipSuccess) { \
		fprintf(stderr, "Got error %s at %s:%d\n", hipGetErrorString(err), \
				__FILE__, __LINE__); \
		exit(1); \
	} \
}

__global__ void kernel2(int *a, int *b, int c)
{
	int tx = threadIdx.x;
	switch (tx)
	{
		case 0:
			a[tx] = a[tx] + 2;
			break;
		case 1:
			a[tx] = a[tx] + 3;
			break;
		default:
			break;
	}
}
__global__ void kernel(float *g_data, float value)
{
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    g_data[idx] = g_data[idx] + value;
	// printf("%f+g_data[%d]=%f\n", value, idx, g_data[idx]);
}

int checkResult(float *data, const int n, const float x)
{
    for (int i = 0; i < n; i++)
    {
        if (data[i] != x)
        {
            printf("Error! data[%d] = %f, ref = %f\n", i, data[i], x);
            return 0;
        }
    }

    return 1;
}

void test()
{
	printf("sizeof(cudaEvent_t)=%lu\n", sizeof(hipEvent_t));
	printf("sizeof(cudaStream_t)=%lu\n", sizeof(hipStream_t));
	printf("sizeof(cudaError_t)=%lu\n", sizeof(hipError_t));
	printf("sizeof(uint64_t)=%lu\n", sizeof(uint64_t));
	printf("sizeof(uint32_t)=%lu\n", sizeof(uint32_t));
}

#define  TIMING

static double tvsub(struct timeval start, struct timeval end)
{
	return (double)(end.tv_usec - start.tv_usec)/1000000 +
                        (double)(end.tv_sec - start.tv_sec);
}

int main()
{
	/* test case 1
	* for 	__cudaRegisterFatBinary
			__cudaUnregisterFatBinary
			__cudaRegisterFunction
	*/
	// return 0;
	int devID=1;
	int count = 0;
	struct hipDeviceProp_t props;
	float *d_a=0;
	float *h_a=0;
	dim3 block, grid;
	int num = 1 << 24;
    int nbytes = num * sizeof(float);
    int value=41;
    struct timeval malloc_start, malloc_end;
    struct timeval meminit_start, meminit_end;
    struct timeval free_start, free_end;
    struct timeval d_malloc_start, d_malloc_end;
    struct timeval d_meminit_start, d_meminit_end;
    struct timeval d_free_start, d_free_end;
    struct timeval HtoD_start, HtoD_end;
    struct timeval DtoH_start, DtoH_end;
    struct timeval kernel_start, kernel_end;
    struct timeval total_start, total_end;
	//test();
	/* test case 2
	* add 	cudaGetDeviceCount
			cudaGetDevice
			cudaGetDeviceProperties
	*/
	devID = 0;
	CHECK(hipSetDevice(devID));
	CHECK(hipGetDeviceCount(&count));
	printf("cuda count=%d\n", count);
	// CHECK(cudaGetDevice(&devID));
	CHECK(hipGetDeviceProperties(&props, devID));
	printf("Device %d: \"%s\" with Compute %d.%d capability\n",devID, props.name, props.major, props.minor);

	// printf("num 0x%x\n", num);
	#ifdef  TIMING
		gettimeofday(&total_start, NULL);
	#endif

    printf("sending 0x%x\n", nbytes);
	printf("allocating 0x%x\n", nbytes);
    #ifdef  TIMING
		gettimeofday(&malloc_start, NULL);
	#endif
	h_a=(float*)malloc(nbytes);
	#ifdef  TIMING
		gettimeofday(&malloc_end, NULL);
	#endif

	printf("initing mem\n");
	#ifdef  TIMING
		gettimeofday(&meminit_start, NULL);
	#endif
	memset(h_a, 0, nbytes);
	#ifdef  TIMING
		gettimeofday(&meminit_end, NULL);
	#endif
	printf("h_a=%p\n", h_a);
	// h_a[0] = 1;
	// start

	#ifdef  TIMING
		gettimeofday(&d_malloc_start, NULL);
	#endif
	CHECK(hipMalloc((void**)&d_a, nbytes));
	#ifdef  TIMING
		gettimeofday(&d_malloc_end, NULL);
	#endif
	printf("d_a address = %p\n", d_a);
	#ifdef  TIMING
		gettimeofday(&d_meminit_start, NULL);
	#endif
	CHECK(hipMemset(d_a, 0, nbytes));
	#ifdef  TIMING
		gettimeofday(&d_meminit_end, NULL);
	#endif
	
	// set kernel launch configuration
    block = dim3(4);
    grid  = dim3((num + block.x - 1) / block.x);

	#ifdef  TIMING
		gettimeofday(&HtoD_start, NULL);
	#endif
	// CHECK(cudaMemcpy(d_a, h_a, nbytes, cudaMemcpyHostToDevice));
	CHECK(hipMemcpy(d_a, h_a, nbytes, hipMemcpyDefault));
	#ifdef  TIMING
		gettimeofday(&HtoD_end, NULL);
	#endif
	#ifdef  TIMING
		gettimeofday(&kernel_start, NULL);
	#endif
	kernel<<<grid, block>>>(d_a, value);
	#ifdef  TIMING
		gettimeofday(&kernel_end, NULL);
	#endif

	#ifdef  TIMING
		gettimeofday(&DtoH_start, NULL);
	#endif
	// CHECK(cudaMemcpy(h_a, d_a, nbytes, cudaMemcpyDeviceToHost));
	CHECK(hipMemcpy(h_a, d_a, nbytes, hipMemcpyDefault));
	#ifdef  TIMING
		gettimeofday(&DtoH_end, NULL);
	#endif

 	bool bFinalResults = (bool) checkResult(h_a, num, value);
	printf("result:%s\n", bFinalResults? "PASS" : "FAILED");
	// end
	#ifdef  TIMING
		gettimeofday(&d_free_start, NULL);
	#endif
	CHECK(hipFree(d_a));
	#ifdef  TIMING
		gettimeofday(&d_free_end, NULL);
	#endif

	#ifdef  TIMING
		gettimeofday(&free_start, NULL);
	#endif
	free(h_a);
	#ifdef  TIMING
		gettimeofday(&free_end, NULL);
	#endif

	/* test case 3
	* add 	cudaMalloc
			cudaMemset
			cudaMemcpy
			cudaLaunch
			cudaFree
	*/
	#ifdef  TIMING
	gettimeofday(&total_end, NULL);
	double total_time 	= tvsub(total_start, total_end);
	double malloc_time 	= tvsub(malloc_start, malloc_end);
	double meminit_time 	= tvsub(meminit_start, meminit_end);
	double free_time 	= tvsub(free_start, free_end);
	double d_malloc_time 	= tvsub(d_malloc_start, d_malloc_end);
	double d_meminit_time 	= tvsub(d_meminit_start, d_meminit_end);
	double d_free_time 	= tvsub(d_free_start, d_free_end);
	double HtoD_time 	= tvsub(HtoD_start, HtoD_end);
	double DtoH_time 	= tvsub(DtoH_start, DtoH_end);
	double kernel_time 	= tvsub(kernel_start, kernel_end);

	printf("================\n");
	printf("total_time : \t\t%f\n", total_time);
	printf("host malloc: \t\t%f\n", malloc_time);
	printf("host mem init: \t\t%f\n", meminit_time);
	printf("device malloc: \t\t%f\n", d_malloc_time);
	printf("device mem init: \t%f\n", d_meminit_time);
	printf("HtoD: \t\t\t%f\n", HtoD_time);
	printf("Exec: \t\t\t%f\n", kernel_time);
	printf("DtoH: \t\t\t%f\n", DtoH_time);
	printf("device free: \t\t%f\n", d_free_time);
	printf("host free: \t\t%f\n", free_time);
	printf("================\n");
	#endif

	return EXIT_SUCCESS;
}

	.text
	.file	"launchkernel.hip"
	.globl	_Z22__device_stub__kernel2PiS_i # -- Begin function _Z22__device_stub__kernel2PiS_i
	.type	_Z22__device_stub__kernel2PiS_i,@function
_Z22__device_stub__kernel2PiS_i:        # @_Z22__device_stub__kernel2PiS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%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	$_Z7kernel2PiS_i, %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	_Z22__device_stub__kernel2PiS_i, .Lfunc_end0-_Z22__device_stub__kernel2PiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z21__device_stub__kernelPff    # -- Begin function _Z21__device_stub__kernelPff
	.type	_Z21__device_stub__kernelPff,@function
_Z21__device_stub__kernelPff:           # @_Z21__device_stub__kernelPff
	.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	4(%rsp), %rcx
	movss	%xmm0, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%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	$_Z6kernelPff, %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_end1:
	.size	_Z21__device_stub__kernelPff, .Lfunc_end1-_Z21__device_stub__kernelPff
	.cfi_endproc
                                        # -- End function
	.globl	_Z11checkResultPfif             # -- Begin function _Z11checkResultPfif
	.type	_Z11checkResultPfif,@function
_Z11checkResultPfif:                    # @_Z11checkResultPfif
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	testl	%esi, %esi
	jle	.LBB2_1
# %bb.2:                                # %.lr.ph.preheader
	movl	%esi, %eax
	movss	(%rdi), %xmm1                   # xmm1 = mem[0],zero,zero,zero
	xorl	%esi, %esi
	ucomiss	%xmm0, %xmm1
	movl	$0, %ebx
	jne	.LBB2_7
	jp	.LBB2_7
# %bb.3:                                # %.lr.ph31.preheader
	movl	%eax, %eax
	leaq	-1(%rax), %rcx
	xorl	%esi, %esi
.LBB2_4:                                # %.lr.ph31
                                        # =>This Inner Loop Header: Depth=1
	cmpq	%rsi, %rcx
	je	.LBB2_8
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB2_4 Depth=1
	movss	4(%rdi,%rsi,4), %xmm1           # xmm1 = mem[0],zero,zero,zero
	incq	%rsi
	ucomiss	%xmm0, %xmm1
	jne	.LBB2_6
	jnp	.LBB2_4
.LBB2_6:                                # %.lr.ph._crit_edge
	cmpq	%rax, %rsi
	setae	%bl
.LBB2_7:
	cvtss2sd	%xmm1, %xmm2
	xorps	%xmm1, %xmm1
	cvtss2sd	%xmm0, %xmm1
	movl	$.L.str, %edi
                                        # kill: def $esi killed $esi killed $rsi
	movaps	%xmm2, %xmm0
	movb	$2, %al
	callq	printf
	jmp	.LBB2_9
.LBB2_1:
	movb	$1, %bl
	jmp	.LBB2_9
.LBB2_8:                                # %.loopexit.loopexit
	incq	%rsi
	cmpq	%rax, %rsi
	setae	%bl
.LBB2_9:                                # %.loopexit
	movzbl	%bl, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z11checkResultPfif, .Lfunc_end2-_Z11checkResultPfif
	.cfi_endproc
                                        # -- End function
	.globl	_Z4testv                        # -- Begin function _Z4testv
	.type	_Z4testv,@function
_Z4testv:                               # @_Z4testv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$.L.str.1, %edi
	movl	$8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.2, %edi
	movl	$8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	movl	$4, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movl	$8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.5, %edi
	movl	$4, %esi
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end3:
	.size	_Z4testv, .Lfunc_end3-_Z4testv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI4_0:
	.long	0x42240000                      # float 41
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI4_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	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	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$1896, %rsp                     # imm = 0x768
	.cfi_def_cfa_offset 1936
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$0, 20(%rsp)
	movq	$0, 8(%rsp)
	xorl	%edi, %edi
	callq	hipSetDevice
	testl	%eax, %eax
	jne	.LBB4_1
# %bb.3:
	leaq	20(%rsp), %rdi
	callq	hipGetDeviceCount
	testl	%eax, %eax
	jne	.LBB4_4
# %bb.5:
	movl	20(%rsp), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	424(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB4_6
# %bb.7:
	leaq	424(%rsp), %rdx
	movl	360(%rdx), %ecx
	movl	364(%rdx), %r8d
	movl	$.L.str.9, %edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	printf
	leaq	104(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movl	$.L.str.10, %edi
	movl	$67108864, %esi                 # imm = 0x4000000
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.11, %edi
	movl	$67108864, %esi                 # imm = 0x4000000
	xorl	%eax, %eax
	callq	printf
	leaq	344(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movl	$1, %edi
	movl	$67108864, %esi                 # imm = 0x4000000
	callq	calloc@PLT
	movq	%rax, %rbx
	leaq	328(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	312(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	296(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movl	$.L.str.13, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	leaq	280(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	8(%rsp), %rdi
	movl	$67108864, %esi                 # imm = 0x4000000
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_8
# %bb.9:
	leaq	264(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rsi
	movl	$.L.str.14, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	248(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rdi
	movl	$67108864, %edx                 # imm = 0x4000000
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB4_10
# %bb.11:
	leaq	232(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	200(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rdi
	movl	$67108864, %edx                 # imm = 0x4000000
	movq	%rbx, %rsi
	movl	$4, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_12
# %bb.13:
	leaq	184(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	136(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movabsq	$4294967300, %rdx               # imm = 0x100000004
	leaq	4194300(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_15
# %bb.14:
	movq	8(%rsp), %rdi
	movss	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	callq	_Z21__device_stub__kernelPff
.LBB4_15:
	leaq	120(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	168(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rsi
	movl	$67108864, %edx                 # imm = 0x4000000
	movq	%rbx, %rdi
	movl	$4, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_16
# %bb.17:
	leaq	152(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movss	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movq	%rbx, %rdi
	movl	$16777216, %esi                 # imm = 0x1000000
	callq	_Z11checkResultPfif
	testl	%eax, %eax
	movl	$.L.str.17, %eax
	movl	$.L.str.16, %esi
	cmoveq	%rax, %rsi
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	216(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_18
# %bb.19:
	leaq	376(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	408(%rsp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	%rbx, %rdi
	callq	free
	leaq	392(%rsp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	leaq	360(%rsp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	8(%r12), %rax
	subq	112(%rsp), %rax
	cvtsi2sd	%rax, %xmm1
	movq	(%r12), %rax
	movsd	.LCPI4_1(%rip), %xmm0           # xmm0 = mem[0],zero
	subq	104(%rsp), %rax
	divsd	%xmm0, %xmm1
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 88(%rsp)                 # 8-byte Spill
	movq	328(%rsp), %rax
	movq	336(%rsp), %rcx
	subq	352(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	344(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 80(%rsp)                 # 8-byte Spill
	movq	296(%rsp), %rax
	movq	304(%rsp), %rcx
	subq	320(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	312(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 72(%rsp)                 # 8-byte Spill
	movq	(%rbx), %rax
	movq	8(%rbx), %rcx
	subq	8(%r15), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	(%r15), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 96(%rsp)                 # 8-byte Spill
	movq	264(%rsp), %rax
	movq	272(%rsp), %rcx
	subq	288(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	280(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 56(%rsp)                 # 8-byte Spill
	movq	232(%rsp), %rax
	movq	240(%rsp), %rcx
	subq	256(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	248(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 48(%rsp)                 # 8-byte Spill
	movq	(%r14), %rax
	movq	8(%r14), %rcx
	subq	224(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	216(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 64(%rsp)                 # 8-byte Spill
	movq	184(%rsp), %rax
	movq	192(%rsp), %rcx
	subq	208(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	200(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 32(%rsp)                 # 8-byte Spill
	movq	152(%rsp), %rax
	movq	160(%rsp), %rcx
	subq	176(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	168(%rsp), %rax
	divsd	%xmm0, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rax, %xmm2
	addsd	%xmm1, %xmm2
	movsd	%xmm2, 40(%rsp)                 # 8-byte Spill
	movq	120(%rsp), %rax
	movq	128(%rsp), %rcx
	subq	144(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	subq	136(%rsp), %rax
	divsd	%xmm0, %xmm1
	cvtsi2sd	%rax, %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.L.str.19, %edi
	movsd	88(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.20, %edi
	movsd	80(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.21, %edi
	movsd	72(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.22, %edi
	movsd	56(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.23, %edi
	movsd	48(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.24, %edi
	movsd	32(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.25, %edi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.26, %edi
	movsd	40(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.27, %edi
	movsd	64(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.L.str.28, %edi
	movsd	96(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	addq	$1896, %rsp                     # imm = 0x768
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB4_1:
	.cfi_def_cfa_offset 1936
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$101, %r8d
	jmp	.LBB4_2
.LBB4_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$102, %r8d
	jmp	.LBB4_2
.LBB4_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$105, %r8d
	jmp	.LBB4_2
.LBB4_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$138, %r8d
	jmp	.LBB4_2
.LBB4_10:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$146, %r8d
	jmp	.LBB4_2
.LBB4_12:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$159, %r8d
	jmp	.LBB4_2
.LBB4_16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$175, %r8d
	jmp	.LBB4_2
.LBB4_18:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.6, %esi
	movl	$.L.str.7, %ecx
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$186, %r8d
.LBB4_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7kernel2PiS_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6kernelPff, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.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	_Z7kernel2PiS_i,@object         # @_Z7kernel2PiS_i
	.section	.rodata,"a",@progbits
	.globl	_Z7kernel2PiS_i
	.p2align	3, 0x0
_Z7kernel2PiS_i:
	.quad	_Z22__device_stub__kernel2PiS_i
	.size	_Z7kernel2PiS_i, 8

	.type	_Z6kernelPff,@object            # @_Z6kernelPff
	.globl	_Z6kernelPff
	.p2align	3, 0x0
_Z6kernelPff:
	.quad	_Z21__device_stub__kernelPff
	.size	_Z6kernelPff, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error! data[%d] = %f, ref = %f\n"
	.size	.L.str, 32

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"sizeof(cudaEvent_t)=%lu\n"
	.size	.L.str.1, 25

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"sizeof(cudaStream_t)=%lu\n"
	.size	.L.str.2, 26

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"sizeof(cudaError_t)=%lu\n"
	.size	.L.str.3, 25

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"sizeof(uint64_t)=%lu\n"
	.size	.L.str.4, 22

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"sizeof(uint32_t)=%lu\n"
	.size	.L.str.5, 22

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Got error %s at %s:%d\n"
	.size	.L.str.6, 23

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/juniorprincewang/virtio-cuda-module/master/test/launchkernel/launchkernel.hip"
	.size	.L.str.7, 140

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"cuda count=%d\n"
	.size	.L.str.8, 15

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Device %d: \"%s\" with Compute %d.%d capability\n"
	.size	.L.str.9, 47

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"sending 0x%x\n"
	.size	.L.str.10, 14

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"allocating 0x%x\n"
	.size	.L.str.11, 17

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"h_a=%p\n"
	.size	.L.str.13, 8

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"d_a address = %p\n"
	.size	.L.str.14, 18

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"result:%s\n"
	.size	.L.str.15, 11

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"PASS"
	.size	.L.str.16, 5

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

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"total_time : \t\t%f\n"
	.size	.L.str.19, 19

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"host malloc: \t\t%f\n"
	.size	.L.str.20, 19

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"host mem init: \t\t%f\n"
	.size	.L.str.21, 21

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"device malloc: \t\t%f\n"
	.size	.L.str.22, 21

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"device mem init: \t%f\n"
	.size	.L.str.23, 22

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"HtoD: \t\t\t%f\n"
	.size	.L.str.24, 13

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"Exec: \t\t\t%f\n"
	.size	.L.str.25, 13

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	"DtoH: \t\t\t%f\n"
	.size	.L.str.26, 13

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"device free: \t\t%f\n"
	.size	.L.str.27, 19

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"host free: \t\t%f\n"
	.size	.L.str.28, 17

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z7kernel2PiS_i"
	.size	.L__unnamed_1, 16

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z6kernelPff"
	.size	.L__unnamed_2, 13

	.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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"initing mem"
	.size	.Lstr, 12

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"================"
	.size	.Lstr.2, 17

	.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 _Z22__device_stub__kernel2PiS_i
	.addrsig_sym _Z21__device_stub__kernelPff
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z7kernel2PiS_i
	.addrsig_sym _Z6kernelPff
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7kernel2PiS_i         ; -- Begin function _Z7kernel2PiS_i
	.globl	_Z7kernel2PiS_i
	.p2align	8
	.type	_Z7kernel2PiS_i,@function
_Z7kernel2PiS_i:                        ; @_Z7kernel2PiS_i
; %bb.0:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_mov_b32_e32 v3, 2
	s_mov_b32 s5, 0
	s_mov_b32 s2, -1
	s_mov_b32 s4, exec_lo
	s_waitcnt lgkmcnt(0)
	v_dual_mov_b32 v2, s1 :: v_dual_mov_b32 v1, s0
	v_cmpx_lt_i32_e32 0, v0
	s_cbranch_execz .LBB0_4
; %bb.1:                                ; %LeafBlock
	v_mov_b32_e32 v3, 2
	s_mov_b32 s6, exec_lo
                                        ; implicit-def: $sgpr2_sgpr3
	v_cmpx_eq_u32_e32 1, v0
; %bb.2:
	v_mov_b32_e32 v3, 3
	s_add_u32 s2, s0, 4
	s_mov_b32 s5, exec_lo
	s_addc_u32 s3, s1, 0
; %bb.3:                                ; %Flow14
	s_or_b32 exec_lo, exec_lo, s6
	v_dual_mov_b32 v1, s2 :: v_dual_mov_b32 v2, s3
	s_or_not1_b32 s2, s5, exec_lo
.LBB0_4:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s4
	s_and_saveexec_b32 s0, s2
	s_cbranch_execz .LBB0_6
; %bb.5:                                ; %.sink.split
	global_load_b32 v0, v[1:2], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v3
	global_store_b32 v[1:2], v0, off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel2PiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 7
		.amdhsa_reserve_vcc 0
		.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	_Z7kernel2PiS_i, .Lfunc_end0-_Z7kernel2PiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 136
; NumSgprs: 7
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 7
; NumVGPRsForWavesPerEU: 4
; 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
	.protected	_Z6kernelPff            ; -- Begin function _Z6kernelPff
	.globl	_Z6kernelPff
	.p2align	8
	.type	_Z6kernelPff,@function
_Z6kernelPff:                           ; @_Z6kernelPff
; %bb.0:
	s_load_b32 s2, s[0:1], 0x1c
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s2, 0xffff
	s_load_b64 s[2:3], s[0:1], 0x0
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_load_b32 s0, s[0:1], 0x8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	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
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, s0, v2
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6kernelPff
		.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 3
		.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_end1:
	.size	_Z6kernelPff, .Lfunc_end1-_Z6kernelPff
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 116
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z7kernel2PiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     7
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel2PiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .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
    .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:           _Z6kernelPff
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6kernelPff.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
