#include <cuda.h>
#include <stdio.h>
#define SIZE 10

int main(int argc,char *argv[]){

  if(argc<3){
    printf("Usage: ./test.cu <ptx_file> <cuda_device>\n");
    exit(0);
  }
  
  // Error code
  CUresult error;

  int i;

  // Host variables
  float *h_A, *h_B, *h_C;
  h_A = (float *)malloc(sizeof(float)*SIZE);
  h_B = (float *)malloc(sizeof(float)*SIZE);
  h_C = (float *)malloc(sizeof(float)*SIZE);
  for (i=0;i<SIZE;i++){
    h_A[i] = 12;
    h_B[i] = i;
    h_C[i] = 0;
  }

  // Initialize driver API
  error = cuInit(0);
  if((int)error!=0){
    printf("Error! cuInit returned: %d\n",(int)error); 
    exit(0);
  }

  // Get Cuda Device and give handle
  CUdevice cu_device;
  error = cuDeviceGet(&cu_device,atoi(argv[2]));
  if((int)error!=0){
    printf("Error! cuDeviceGet returned: %d\n",(int)error);
    exit(0);
  }

  // Create context to run on device 
  CUcontext cu_context;
  error = cuCtxCreate(&cu_context, 0, cu_device);
  if((int)error!=0){
    printf("Error! cuCtxCreate returned: %d\n",(int)error);
    exit(0);
  }

  // Load ptx code
  CUmodule cu_module;
  error = cuModuleLoad(&cu_module,argv[1]);
  if((int)error!=0){
    printf("Error! cuModuleLoad returned: %d\n",(int)error);
    exit(0);
  }

  // Get kernel function
  CUfunction func;
  error = cuModuleGetFunction(&func,cu_module,"VectorAdd"); 
  if((int)error!=0){
    printf("Error! cuModuleGetFunction returned: %d\n",(int)error);
    exit(0);
  }

  CUdeviceptr var1,var2,var3;

  // Allocate device memory
  unsigned int size = sizeof(float)*SIZE;

  error = cuMemAlloc(&var1, size);
  error = cuMemAlloc(&var2, size);
  error = cuMemAlloc(&var3, size);
  if((int)error!=0){
    printf("Error! cuMemAlloc returned: %d\n",(int)error);
    exit(0);
  }

  // Copy variables to host
  error = cuMemcpyHtoD(var1,h_C,size);
  error = cuMemcpyHtoD(var2,h_A,size);
  error = cuMemcpyHtoD(var3,h_B,size);
  if((int)error!=0){
    printf("Error! cuMemcpyHtoD returned: %d\n",(int)error);
    exit(0);
  }

  // Lauch kernel
  void *args[] = {&var1, &var2, &var3};
  error = cuLaunchKernel(func, 10, 1, 1, 1, 1, 1, 0, NULL, args, NULL);
  if((int)error!=0){
    printf("Error! cuLaunchKernel returned: %d\n",(int)error);
    exit(0);
  }

  // Get result to host
  error = cuMemcpyDtoH(h_C,var1,size);
  if((int)error!=0){
    printf("Error! cuMemcpyDtoH returned: %d\n",(int)error);
    exit(0);
  }

  // Free device memory
  error = cuMemFree(var1);
  error = cuMemFree(var2);
  error = cuMemFree(var3);
  if((int)error!=0){
    printf("Error! cuMemFree returned: %d\n",(int)error);
    exit(0);
  }

  // Destroy context
  error = cuCtxDestroy(cu_context);
  if((int)error!=0){
    printf("Error! cuCtxDestroy returned: %d\n",(int)error);
    exit(0);
  }


  // Print result
  for (i=0;i<SIZE;i++)
    printf("%f\n",h_C[i]);
}

	.file	"tmpxft_00268d87_00000000-6_main.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Usage: ./test.cu <ptx_file> <cuda_device>\n"
.LC2:
	.string	"Error! cuInit returned: %d\n"
.LC3:
	.string	"Error! cuDeviceGet returned: %d\n"
.LC4:
	.string	"Error! cuCtxCreate returned: %d\n"
.LC5:
	.string	"Error! cuModuleLoad returned: %d\n"
.LC6:
	.string	"VectorAdd"
.LC7:
	.string	"Error! cuModuleGetFunction returned: %d\n"
.LC8:
	.string	"Error! cuMemAlloc returned: %d\n"
.LC9:
	.string	"Error! cuMemcpyHtoD returned: %d\n"
.LC10:
	.string	"Error! cuLaunchKernel returned: %d\n"
.LC11:
	.string	"Error! cuMemcpyDtoH returned: %d\n"
.LC12:
	.string	"Error! cuMemFree returned: %d\n"
.LC13:
	.string	"Error! cuCtxDestroy returned: %d\n"
.LC14:
	.string	"%f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	cmpl	$2, %edi
	jg	.L3
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L22
.L3:
	movl	$40, %edi
	movq	%rsi, %r13
	call	malloc@PLT
	movl	$40, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$40, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movss	.LC1(%rip), %xmm1
	xorl	%ecx, %ecx
	movq	%rax, %rbx
.L4:
	cvtsi2ssl	%ecx, %xmm0
	movss	%xmm1, (%r12,%rcx,4)
	movss	%xmm0, 0(%rbp,%rcx,4)
	incq	%rcx
	cmpq	$10, %rcx
	jne	.L4
	xorl	%eax, %eax
	movq	%rbx, %rdi
	rep stosl
	xorl	%edi, %edi
	call	cuInit@PLT
	movl	%eax, %edx
	testl	%eax, %eax
	je	.L5
	leaq	.LC2(%rip), %rsi
.L23:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L22:
	xorl	%edi, %edi
	call	exit@PLT
.L5:
	movq	16(%r13), %rdi
	call	atoi@PLT
	leaq	12(%rsp), %rdi
	movl	%eax, %esi
	call	cuDeviceGet@PLT
	leaq	.LC3(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movl	12(%rsp), %edx
	xorl	%esi, %esi
	leaq	16(%rsp), %rdi
	call	cuCtxCreate_v2@PLT
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	8(%r13), %rsi
	leaq	24(%rsp), %rdi
	call	cuModuleLoad@PLT
	leaq	.LC5(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	24(%rsp), %rsi
	leaq	.LC6(%rip), %rdx
	leaq	32(%rsp), %rdi
	call	cuModuleGetFunction@PLT
	leaq	.LC7(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	leaq	40(%rsp), %r15
	movl	$40, %esi
	leaq	48(%rsp), %r14
	movq	%r15, %rdi
	leaq	56(%rsp), %r13
	call	cuMemAlloc_v2@PLT
	movl	$40, %esi
	movq	%r14, %rdi
	call	cuMemAlloc_v2@PLT
	movl	$40, %esi
	movq	%r13, %rdi
	call	cuMemAlloc_v2@PLT
	leaq	.LC8(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	40(%rsp), %rdi
	movl	$40, %edx
	movq	%rbx, %rsi
	call	cuMemcpyHtoD_v2@PLT
	movq	48(%rsp), %rdi
	movl	$40, %edx
	movq	%r12, %rsi
	call	cuMemcpyHtoD_v2@PLT
	movq	56(%rsp), %rdi
	movl	$40, %edx
	movq	%rbp, %rsi
	call	cuMemcpyHtoD_v2@PLT
	leaq	.LC9(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	%r13, 80(%rsp)
	movl	$1, %edx
	movl	$10, %esi
	movl	$1, %r9d
	movq	%r15, 64(%rsp)
	movl	$1, %r8d
	movl	$1, %ecx
	movq	%r14, 72(%rsp)
	pushq	%rax
	.cfi_def_cfa_offset 168
	pushq	$0
	.cfi_def_cfa_offset 176
	leaq	80(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 184
	pushq	$0
	.cfi_def_cfa_offset 192
	pushq	$0
	.cfi_def_cfa_offset 200
	pushq	$1
	.cfi_def_cfa_offset 208
	movq	80(%rsp), %rdi
	call	cuLaunchKernel@PLT
	addq	$48, %rsp
	.cfi_def_cfa_offset 160
	leaq	.LC10(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	40(%rsp), %rsi
	movl	$40, %edx
	movq	%rbx, %rdi
	call	cuMemcpyDtoH_v2@PLT
	leaq	.LC11(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	40(%rsp), %rdi
	call	cuMemFree_v2@PLT
	movq	48(%rsp), %rdi
	call	cuMemFree_v2@PLT
	movq	56(%rsp), %rdi
	call	cuMemFree_v2@PLT
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
	movq	16(%rsp), %rdi
	xorl	%ebp, %ebp
	leaq	.LC14(%rip), %r12
	call	cuCtxDestroy_v2@PLT
	leaq	.LC13(%rip), %rsi
	movl	%eax, %edx
	testl	%eax, %eax
	jne	.L23
.L15:
	cvtss2sd	(%rbx,%rbp,4), %xmm0
	movq	%r12, %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	incq	%rbp
	cmpq	$10, %rbp
	jne	.L15
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$104, %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
.LFE2027:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2053:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2053:
	.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.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	1094713344
	.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>
#define SIZE 10

int main(int argc,char *argv[]){

  if(argc<3){
    printf("Usage: ./test.cu <ptx_file> <cuda_device>\n");
    exit(0);
  }
  
  // Error code
  hipError_t error;

  int i;

  // Host variables
  float *h_A, *h_B, *h_C;
  h_A = (float *)malloc(sizeof(float)*SIZE);
  h_B = (float *)malloc(sizeof(float)*SIZE);
  h_C = (float *)malloc(sizeof(float)*SIZE);
  for (i=0;i<SIZE;i++){
    h_A[i] = 12;
    h_B[i] = i;
    h_C[i] = 0;
  }

  // Initialize driver API
  error = hipInit(0);
  if((int)error!=0){
    printf("Error! hipInit returned: %d\n",(int)error); 
    exit(0);
  }

  // Get Cuda Device and give handle
  hipDevice_t cu_device;
  error = hipDeviceGet(&cu_device,atoi(argv[2]));
  if((int)error!=0){
    printf("Error! hipDeviceGet returned: %d\n",(int)error);
    exit(0);
  }

  // Create context to run on device 
  hipCtx_t cu_context;
  error = hipCtxCreate(&cu_context, 0, cu_device);
  if((int)error!=0){
    printf("Error! hipCtxCreate returned: %d\n",(int)error);
    exit(0);
  }

  // Load ptx code
  hipModule_t cu_module;
  error = hipModuleLoad(&cu_module,argv[1]);
  if((int)error!=0){
    printf("Error! hipModuleLoad returned: %d\n",(int)error);
    exit(0);
  }

  // Get kernel function
  hipFunction_t func;
  error = hipModuleGetFunction(&func,cu_module,"VectorAdd"); 
  if((int)error!=0){
    printf("Error! hipModuleGetFunction returned: %d\n",(int)error);
    exit(0);
  }

  hipDeviceptr_t var1,var2,var3;

  // Allocate device memory
  unsigned int size = sizeof(float)*SIZE;

  error = hipMalloc(&var1, size);
  error = hipMalloc(&var2, size);
  error = hipMalloc(&var3, size);
  if((int)error!=0){
    printf("Error! hipMalloc returned: %d\n",(int)error);
    exit(0);
  }

  // Copy variables to host
  error = hipMemcpyHtoD(var1,h_C,size);
  error = hipMemcpyHtoD(var2,h_A,size);
  error = hipMemcpyHtoD(var3,h_B,size);
  if((int)error!=0){
    printf("Error! hipMemcpyHtoD returned: %d\n",(int)error);
    exit(0);
  }

  // Lauch kernel
  void *args[] = {&var1, &var2, &var3};
  error = hipModuleLaunchKernel(func, 10, 1, 1, 1, 1, 1, 0, NULL, args, NULL);
  if((int)error!=0){
    printf("Error! hipModuleLaunchKernel returned: %d\n",(int)error);
    exit(0);
  }

  // Get result to host
  error = hipMemcpyDtoH(h_C,var1,size);
  if((int)error!=0){
    printf("Error! hipMemcpyDtoH returned: %d\n",(int)error);
    exit(0);
  }

  // Free device memory
  error = hipFree(var1);
  error = hipFree(var2);
  error = hipFree(var3);
  if((int)error!=0){
    printf("Error! hipFree returned: %d\n",(int)error);
    exit(0);
  }

  // Destroy context
  error = hipCtxDestroy(cu_context);
  if((int)error!=0){
    printf("Error! hipCtxDestroy returned: %d\n",(int)error);
    exit(0);
  }


  // Print result
  for (i=0;i<SIZE;i++)
    printf("%f\n",h_C[i]);
}

	.text
	.file	"main.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %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	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$2, %edi
	jle	.LBB0_17
# %bb.1:
	movq	%rsi, %r12
	movl	$40, %edi
	callq	malloc
	movq	%rax, %r15
	movl	$40, %edi
	callq	malloc
	movq	%rax, %r14
	movl	$1, %edi
	movl	$40, %esi
	callq	calloc@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.LBB0_2:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movl	$1094713344, (%r15,%rax,4)      # imm = 0x41400000
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	cmpq	$10, %rax
	jne	.LBB0_2
# %bb.3:
	xorl	%edi, %edi
	callq	hipInit
	testl	%eax, %eax
	jne	.LBB0_19
# %bb.4:
	movq	16(%r12), %rdi
	callq	atoi
	leaq	20(%rsp), %rdi
	movl	%eax, %esi
	callq	hipDeviceGet
	testl	%eax, %eax
	jne	.LBB0_20
# %bb.5:
	movl	20(%rsp), %edx
	leaq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipCtxCreate
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.6:
	movq	8(%r12), %rsi
	leaq	48(%rsp), %rdi
	callq	hipModuleLoad
	testl	%eax, %eax
	jne	.LBB0_22
# %bb.7:
	movq	48(%rsp), %rsi
	leaq	40(%rsp), %rdi
	movl	$.L.str.5, %edx
	callq	hipModuleGetFunction
	testl	%eax, %eax
	jne	.LBB0_23
# %bb.8:
	leaq	8(%rsp), %r12
	movl	$40, %esi
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	32(%rsp), %r13
	movl	$40, %esi
	movq	%r13, %rdi
	callq	hipMalloc
	leaq	24(%rsp), %rbp
	movl	$40, %esi
	movq	%rbp, %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_24
# %bb.9:
	movq	8(%rsp), %rdi
	movl	$40, %edx
	movq	%rbx, %rsi
	callq	hipMemcpyHtoD
	movq	32(%rsp), %rdi
	movl	$40, %edx
	movq	%r15, %rsi
	callq	hipMemcpyHtoD
	movq	24(%rsp), %rdi
	movl	$40, %edx
	movq	%r14, %rsi
	callq	hipMemcpyHtoD
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.10:
	leaq	64(%rsp), %rax
	movq	%r12, (%rax)
	movq	%r13, 8(%rax)
	movq	%rbp, 16(%rax)
	movq	40(%rsp), %rdi
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	xorl	%r10d, %r10d
	movl	$10, %esi
	movl	$1, %edx
	movl	$1, %ecx
	movl	$1, %r8d
	movl	$1, %r9d
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	hipModuleLaunchKernel
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
	testl	%eax, %eax
	jne	.LBB0_26
# %bb.11:
	movq	8(%rsp), %rsi
	movl	$40, %edx
	movq	%rbx, %rdi
	callq	hipMemcpyDtoH
	testl	%eax, %eax
	jne	.LBB0_27
# %bb.12:
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB0_28
# %bb.13:
	movq	56(%rsp), %rdi
	callq	hipCtxDestroy
	testl	%eax, %eax
	jne	.LBB0_29
# %bb.14:                               # %.preheader.preheader
	xorl	%r14d, %r14d
.LBB0_15:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r14,4), %xmm0
	movl	$.L.str.13, %edi
	movb	$1, %al
	callq	printf
	incq	%r14
	cmpq	$10, %r14
	jne	.LBB0_15
# %bb.16:
	xorl	%eax, %eax
	addq	$88, %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
	retq
.LBB0_17:
	.cfi_def_cfa_offset 144
	movl	$.Lstr, %edi
	callq	puts@PLT
	jmp	.LBB0_18
.LBB0_19:
	movl	$.L.str.1, %edi
	jmp	.LBB0_30
.LBB0_20:
	movl	$.L.str.2, %edi
	jmp	.LBB0_30
.LBB0_21:
	movl	$.L.str.3, %edi
	jmp	.LBB0_30
.LBB0_22:
	movl	$.L.str.4, %edi
	jmp	.LBB0_30
.LBB0_23:
	movl	$.L.str.6, %edi
	jmp	.LBB0_30
.LBB0_24:
	movl	$.L.str.7, %edi
	jmp	.LBB0_30
.LBB0_25:
	movl	$.L.str.8, %edi
	jmp	.LBB0_30
.LBB0_26:
	movl	$.L.str.9, %edi
	jmp	.LBB0_30
.LBB0_27:
	movl	$.L.str.10, %edi
	jmp	.LBB0_30
.LBB0_28:
	movl	$.L.str.11, %edi
	jmp	.LBB0_30
.LBB0_29:
	movl	$.L.str.12, %edi
.LBB0_30:
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
.LBB0_18:
	xorl	%edi, %edi
	callq	exit
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"Error! hipInit returned: %d\n"
	.size	.L.str.1, 29

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Error! hipDeviceGet returned: %d\n"
	.size	.L.str.2, 34

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Error! hipCtxCreate returned: %d\n"
	.size	.L.str.3, 34

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Error! hipModuleLoad returned: %d\n"
	.size	.L.str.4, 35

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"VectorAdd"
	.size	.L.str.5, 10

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Error! hipModuleGetFunction returned: %d\n"
	.size	.L.str.6, 42

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Error! hipMalloc returned: %d\n"
	.size	.L.str.7, 31

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Error! hipMemcpyHtoD returned: %d\n"
	.size	.L.str.8, 35

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Error! hipModuleLaunchKernel returned: %d\n"
	.size	.L.str.9, 43

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Error! hipMemcpyDtoH returned: %d\n"
	.size	.L.str.10, 35

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Error! hipFree returned: %d\n"
	.size	.L.str.11, 29

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Error! hipCtxDestroy returned: %d\n"
	.size	.L.str.12, 35

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

	.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	"Usage: ./test.cu <ptx_file> <cuda_device>"
	.size	.Lstr, 42

	.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_

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

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

	.end_amdgpu_metadata
