//This file contains wrappers for C/CUDA functions to be called from Fortran.
#include <stdio.h>

#ifndef NO_GPU

#include <cuda.h>
#include <cuda_runtime.h>
//Protect the C function names from name mangling:
#ifdef __cplusplus
extern "C"{
#endif
 void cudagetdevicecount(int* count, int* err_code);
 void cudasetdevice(int device, int* err_code);
 void cudagetdeviceproperties(int device, size_t *totalGlobalMem_, size_t *sharedMemPerBlock_,
       int *regsPerBlock_, int *warpSize_, int *maxThreadsPerBlock_, int *maxThreadsDim_, int *maxGridSize_,
       int *clockRate_, size_t *totalConstMem_, int *major_, int *minor_, int *deviceOverlap_,
       int *multiProcessorCount_, int *concurrentKernels_, int *ECCEnabled_, int *asyncEngineCount_,
       int *memoryClockRate_, int *memoryBusWidth_, int *maxThreadsPerMultiProcessor_, int* err_code);
 void cudadevicesynchronize(int *err_code);
#ifdef __cplusplus
}
#endif

#endif

#ifdef __cplusplus
extern "C"{
#endif
 int string_len(const char * str);
 char * ptr_offset(char * byte_ptr, size_t byte_offset);
 size_t c_ptr_value(void * c_ptr);
 void c_ptr_set(size_t cpval, void ** cptr);
 void print_c_ptr(void * c_ptr);
#ifdef __cplusplus
}
#endif
//-------------------------------------------------------------------
#ifndef NO_GPU
//C Wrappers (called from Fortran to invoke CUDA run-time functions):
void cudagetdevicecount(int* count, int* err_code){
 cudaError_t err; const char* err_msg;
 *err_code=0;
 err=cudaGetDeviceCount(count); if(err!=cudaSuccess){
  err_msg=cudaGetErrorString(err);
  printf("#ERROR(cudagetdevicecount): %s \n",err_msg);
  *err_code=1;
 };
 return;
}

void cudasetdevice(int device, int* err_code){
 cudaError_t err; const char* err_msg;
 *err_code=0;
 err=cudaSetDevice(device); if(err!=cudaSuccess){
  err_msg=cudaGetErrorString(err);
  printf("#ERROR(cudasetdevice): %s \n",err_msg);
  *err_code=1;
 };
 return;
}

void cudagetdeviceproperties(int device, size_t *totalGlobalMem_, size_t *sharedMemPerBlock_,
               int *regsPerBlock_, int *warpSize_, int *maxThreadsPerBlock_, int *maxThreadsDim_, int *maxGridSize_,
               int *clockRate_, size_t *totalConstMem_, int *major_, int *minor_, int *deviceOverlap_,
               int *multiProcessorCount_, int *concurrentKernels_, int *ECCEnabled_, int *asyncEngineCount_,
               int *memoryClockRate_, int *memoryBusWidth_, int *maxThreadsPerMultiProcessor_, int* err_code){
 cudaError_t err; const char* err_msg; cudaDeviceProp prop;
 *err_code=0;
 err=cudaGetDeviceProperties(&prop,device);
 if(err!=cudaSuccess){
  err_msg=cudaGetErrorString(err);
  printf("#ERROR(cudagetdeviceproperties): %s \n",err_msg);
  *err_code=1;
 }else{
  *totalGlobalMem_=prop.totalGlobalMem;
  *sharedMemPerBlock_=prop.sharedMemPerBlock;
  *regsPerBlock_=prop.regsPerBlock;
  *warpSize_=prop.warpSize;
  *maxThreadsPerBlock_=prop.maxThreadsPerBlock;
  maxThreadsDim_[0]=prop.maxThreadsDim[0]; maxThreadsDim_[1]=prop.maxThreadsDim[1]; maxThreadsDim_[2]=prop.maxThreadsDim[2];
  maxGridSize_[0]=prop.maxGridSize[0]; maxGridSize_[1]=prop.maxGridSize[1]; maxGridSize_[2]=prop.maxGridSize[2];
  *clockRate_=prop.clockRate;
  *totalConstMem_=prop.totalConstMem;
  *major_=prop.major; *minor_=prop.minor;
  *deviceOverlap_=prop.deviceOverlap;
  *multiProcessorCount_=prop.multiProcessorCount;
  *concurrentKernels_=prop.concurrentKernels;
  *ECCEnabled_=prop.ECCEnabled;
  *asyncEngineCount_=prop.asyncEngineCount;
  *memoryClockRate_=prop.memoryClockRate;
  *memoryBusWidth_=prop.memoryBusWidth;
  *maxThreadsPerMultiProcessor_=prop.maxThreadsPerMultiProcessor;
 };
 return;
}

void cudadevicesynchronize(int *err_code)
{
 *err_code=0;
 cudaError_t err=cudaDeviceSynchronize(); if(err != cudaSuccess){*err_code=1;}
 return;
}
#endif
//----------------------------------------------------------------------------
//Auxiliary functions:
int string_len(const char* str){ //get the length of a C string
 const int max_string_len=2147483647;
 int i;
 for(i=0;i<max_string_len;i++){if(str[i]==0) break;};
 return i;
}

char* ptr_offset(char *byte_ptr, size_t byte_offset){ //offsets a C pointer by a number of bytes
 char *addr=&byte_ptr[byte_offset];
 return addr;
}

size_t c_ptr_value(void * c_ptr){ //returns a C pointer as an integer
 return (size_t)c_ptr;
}

void c_ptr_set(size_t cpval, void ** cptr){ //sets a C pointer to a specific integer address
 *cptr=(void*)cpval;
 return;
}

void print_c_ptr(void * c_ptr){ //prints a C-pointer
 printf("%p",c_ptr);
 return;
}

	.file	"tmpxft_00220980_00000000-6_c2fortran.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2038:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2038:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"#ERROR(cudagetdevicecount): %s \n"
	.text
	.globl	cudagetdevicecount
	.type	cudagetdevicecount, @function
cudagetdevicecount:
.LFB2027:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	movl	%eax, (%rsi)
	call	cudaGetDeviceCount@PLT
	testl	%eax, %eax
	je	.L2
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, (%rbx)
.L2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	cudagetdevicecount, .-cudagetdevicecount
	.section	.rodata.str1.1
.LC1:
	.string	"#ERROR(cudasetdevice): %s \n"
	.text
	.globl	cudasetdevice
	.type	cudasetdevice, @function
cudasetdevice:
.LFB2028:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	movl	%eax, (%rsi)
	call	cudaSetDevice@PLT
	testl	%eax, %eax
	je	.L9
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, (%rbx)
.L9:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	cudasetdevice, .-cudasetdevice
	.section	.rodata.str1.1
.LC2:
	.string	"#ERROR(cudagetdeviceproperties): %s \n"
	.text
	.globl	cudagetdeviceproperties
	.type	cudagetdeviceproperties, @function
cudagetdeviceproperties:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r9, %rbx
	subq	$1160, %rsp
	.cfi_def_cfa_offset 1216
	movq	1216(%rsp), %rcx
	movq	1224(%rsp), %rdx
	movq	1240(%rsp), %rsi
	movq	1272(%rsp), %rdi
	movq	%rcx, 104(%rsp)
	movq	1232(%rsp), %rcx
	movq	%rdx, 96(%rsp)
	movq	1264(%rsp), %rdx
	movq	%rcx, (%rsp)
	movq	1248(%rsp), %rcx
	movq	%rsi, 8(%rsp)
	movq	1256(%rsp), %rsi
	movq	%rcx, 16(%rsp)
	movq	1280(%rsp), %rcx
	movq	%rdx, 32(%rsp)
	xorl	%edx, %edx
	movq	%rcx, 48(%rsp)
	movq	%rdi, 40(%rsp)
	leaq	112(%rsp), %rdi
	movq	%rsi, 24(%rsp)
	movq	1288(%rsp), %rsi
	movq	1296(%rsp), %r11
	movq	1304(%rsp), %r10
	movq	1312(%rsp), %r9
	movq	1320(%rsp), %r8
	movq	%rsi, 56(%rsp)
	movq	%r11, 88(%rsp)
	movq	1328(%rsp), %r15
	movq	%r10, 80(%rsp)
	movq	%r9, 72(%rsp)
	movq	%r8, 64(%rsp)
	movq	%fs:40, %rsi
	movq	%rsi, 1144(%rsp)
	xorl	%esi, %esi
	movl	%edx, (%r15)
	movl	%eax, %esi
	call	cudaGetDeviceProperties_v2@PLT
	movq	64(%rsp), %r8
	movq	72(%rsp), %r9
	testl	%eax, %eax
	movq	80(%rsp), %r10
	movq	88(%rsp), %r11
	movq	96(%rsp), %rdx
	movq	104(%rsp), %rcx
	je	.L16
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, (%r15)
	jmp	.L15
.L16:
	movq	400(%rsp), %rax
	movq	%rax, (%r14)
	movq	408(%rsp), %rax
	movq	%rax, 0(%r13)
	movl	416(%rsp), %eax
	movl	%eax, (%r12)
	movl	420(%rsp), %eax
	movl	%eax, 0(%rbp)
	movl	432(%rsp), %eax
	movl	%eax, (%rbx)
	movq	436(%rsp), %rax
	movq	(%rsp), %rbx
	movq	%rax, (%rcx)
	movl	444(%rsp), %eax
	movl	%eax, 8(%rcx)
	movq	448(%rsp), %rax
	movq	%rax, (%rdx)
	movl	456(%rsp), %eax
	movl	%eax, 8(%rdx)
	movl	460(%rsp), %eax
	movl	%eax, (%rbx)
	movq	464(%rsp), %rax
	movq	8(%rsp), %rbx
	movq	%rax, (%rbx)
	movl	472(%rsp), %eax
	movq	16(%rsp), %rbx
	movl	%eax, (%rbx)
	movl	476(%rsp), %eax
	movq	24(%rsp), %rbx
	movl	%eax, (%rbx)
	movl	496(%rsp), %eax
	movq	32(%rsp), %rbx
	movl	%eax, (%rbx)
	movl	500(%rsp), %eax
	movq	40(%rsp), %rbx
	movq	48(%rsp), %rdx
	movq	56(%rsp), %rdi
	movl	%eax, (%rbx)
	movl	688(%rsp), %eax
	movl	%eax, (%rdx)
	movl	692(%rsp), %eax
	movl	%eax, (%rdi)
	movl	712(%rsp), %eax
	movl	%eax, (%r11)
	movl	720(%rsp), %eax
	movl	%eax, (%r10)
	movl	724(%rsp), %eax
	movl	%eax, (%r9)
	movl	736(%rsp), %eax
	movl	%eax, (%r8)
.L15:
	movq	1144(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$1160, %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
.LFE2029:
	.size	cudagetdeviceproperties, .-cudagetdeviceproperties
	.globl	cudadevicesynchronize
	.type	cudadevicesynchronize, @function
cudadevicesynchronize:
.LFB2030:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movl	%eax, (%rdi)
	call	cudaDeviceSynchronize@PLT
	testl	%eax, %eax
	je	.L20
	movl	$1, (%rbx)
.L20:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	cudadevicesynchronize, .-cudadevicesynchronize
	.globl	string_len
	.type	string_len, @function
string_len:
.LFB2031:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L28:
	cmpb	$0, (%rdi,%rax)
	je	.L26
	incq	%rax
	cmpq	$2147483647, %rax
	jne	.L28
.L26:
	ret
	.cfi_endproc
.LFE2031:
	.size	string_len, .-string_len
	.globl	ptr_offset
	.type	ptr_offset, @function
ptr_offset:
.LFB2032:
	.cfi_startproc
	endbr64
	leaq	(%rdi,%rsi), %rax
	ret
	.cfi_endproc
.LFE2032:
	.size	ptr_offset, .-ptr_offset
	.globl	c_ptr_value
	.type	c_ptr_value, @function
c_ptr_value:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	ret
	.cfi_endproc
.LFE2033:
	.size	c_ptr_value, .-c_ptr_value
	.globl	c_ptr_set
	.type	c_ptr_set, @function
c_ptr_set:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	%rdi, (%rsi)
	ret
	.cfi_endproc
.LFE2034:
	.size	c_ptr_set, .-c_ptr_set
	.section	.rodata.str1.1
.LC3:
	.string	"%p"
	.text
	.globl	print_c_ptr
	.type	print_c_ptr, @function
print_c_ptr:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2035:
	.size	print_c_ptr, .-print_c_ptr
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.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
.LFE2061:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

//This file contains wrappers for C/CUDA functions to be called from Fortran.
#include <stdio.h>

#ifndef NO_GPU

#include <hip/hip_runtime.h>

//Protect the C function names from name mangling:
#ifdef __cplusplus
extern "C"{
#endif
 void cudagetdevicecount(int* count, int* err_code);
 void cudasetdevice(int device, int* err_code);
 void cudagetdeviceproperties(int device, size_t *totalGlobalMem_, size_t *sharedMemPerBlock_,
       int *regsPerBlock_, int *warpSize_, int *maxThreadsPerBlock_, int *maxThreadsDim_, int *maxGridSize_,
       int *clockRate_, size_t *totalConstMem_, int *major_, int *minor_, int *deviceOverlap_,
       int *multiProcessorCount_, int *concurrentKernels_, int *ECCEnabled_, int *asyncEngineCount_,
       int *memoryClockRate_, int *memoryBusWidth_, int *maxThreadsPerMultiProcessor_, int* err_code);
 void cudadevicesynchronize(int *err_code);
#ifdef __cplusplus
}
#endif

#endif

#ifdef __cplusplus
extern "C"{
#endif
 int string_len(const char * str);
 char * ptr_offset(char * byte_ptr, size_t byte_offset);
 size_t c_ptr_value(void * c_ptr);
 void c_ptr_set(size_t cpval, void ** cptr);
 void print_c_ptr(void * c_ptr);
#ifdef __cplusplus
}
#endif
//-------------------------------------------------------------------
#ifndef NO_GPU
//C Wrappers (called from Fortran to invoke CUDA run-time functions):
void cudagetdevicecount(int* count, int* err_code){
 hipError_t err; const char* err_msg;
 *err_code=0;
 err=hipGetDeviceCount(count); if(err!=hipSuccess){
  err_msg=hipGetErrorString(err);
  printf("#ERROR(cudagetdevicecount): %s \n",err_msg);
  *err_code=1;
 };
 return;
}

void cudasetdevice(int device, int* err_code){
 hipError_t err; const char* err_msg;
 *err_code=0;
 err=hipSetDevice(device); if(err!=hipSuccess){
  err_msg=hipGetErrorString(err);
  printf("#ERROR(cudasetdevice): %s \n",err_msg);
  *err_code=1;
 };
 return;
}

void cudagetdeviceproperties(int device, size_t *totalGlobalMem_, size_t *sharedMemPerBlock_,
               int *regsPerBlock_, int *warpSize_, int *maxThreadsPerBlock_, int *maxThreadsDim_, int *maxGridSize_,
               int *clockRate_, size_t *totalConstMem_, int *major_, int *minor_, int *deviceOverlap_,
               int *multiProcessorCount_, int *concurrentKernels_, int *ECCEnabled_, int *asyncEngineCount_,
               int *memoryClockRate_, int *memoryBusWidth_, int *maxThreadsPerMultiProcessor_, int* err_code){
 hipError_t err; const char* err_msg; hipDeviceProp_t prop;
 *err_code=0;
 err=hipGetDeviceProperties(&prop,device);
 if(err!=hipSuccess){
  err_msg=hipGetErrorString(err);
  printf("#ERROR(cudagetdeviceproperties): %s \n",err_msg);
  *err_code=1;
 }else{
  *totalGlobalMem_=prop.totalGlobalMem;
  *sharedMemPerBlock_=prop.sharedMemPerBlock;
  *regsPerBlock_=prop.regsPerBlock;
  *warpSize_=prop.warpSize;
  *maxThreadsPerBlock_=prop.maxThreadsPerBlock;
  maxThreadsDim_[0]=prop.maxThreadsDim[0]; maxThreadsDim_[1]=prop.maxThreadsDim[1]; maxThreadsDim_[2]=prop.maxThreadsDim[2];
  maxGridSize_[0]=prop.maxGridSize[0]; maxGridSize_[1]=prop.maxGridSize[1]; maxGridSize_[2]=prop.maxGridSize[2];
  *clockRate_=prop.clockRate;
  *totalConstMem_=prop.totalConstMem;
  *major_=prop.major; *minor_=prop.minor;
  *deviceOverlap_=prop.deviceOverlap;
  *multiProcessorCount_=prop.multiProcessorCount;
  *concurrentKernels_=prop.concurrentKernels;
  *ECCEnabled_=prop.ECCEnabled;
  *asyncEngineCount_=prop.asyncEngineCount;
  *memoryClockRate_=prop.memoryClockRate;
  *memoryBusWidth_=prop.memoryBusWidth;
  *maxThreadsPerMultiProcessor_=prop.maxThreadsPerMultiProcessor;
 };
 return;
}

void cudadevicesynchronize(int *err_code)
{
 *err_code=0;
 hipError_t err=hipDeviceSynchronize(); if(err != hipSuccess){*err_code=1;}
 return;
}
#endif
//----------------------------------------------------------------------------
//Auxiliary functions:
int string_len(const char* str){ //get the length of a C string
 const int max_string_len=2147483647;
 int i;
 for(i=0;i<max_string_len;i++){if(str[i]==0) break;};
 return i;
}

char* ptr_offset(char *byte_ptr, size_t byte_offset){ //offsets a C pointer by a number of bytes
 char *addr=&byte_ptr[byte_offset];
 return addr;
}

size_t c_ptr_value(void * c_ptr){ //returns a C pointer as an integer
 return (size_t)c_ptr;
}

void c_ptr_set(size_t cpval, void ** cptr){ //sets a C pointer to a specific integer address
 *cptr=(void*)cpval;
 return;
}

void print_c_ptr(void * c_ptr){ //prints a C-pointer
 printf("%p",c_ptr);
 return;
}

	.text
	.file	"c2fortran.hip"
	.globl	cudagetdevicecount              # -- Begin function cudagetdevicecount
	.type	cudagetdevicecount,@function
cudagetdevicecount:                     # @cudagetdevicecount
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	movl	$0, (%rsi)
	callq	hipGetDeviceCount
	testl	%eax, %eax
	je	.LBB0_2
# %bb.1:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, (%rbx)
.LBB0_2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	cudagetdevicecount, .Lfunc_end0-cudagetdevicecount
	.cfi_endproc
                                        # -- End function
	.globl	cudasetdevice                   # -- Begin function cudasetdevice
	.type	cudasetdevice,@function
cudasetdevice:                          # @cudasetdevice
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	movl	$0, (%rsi)
	callq	hipSetDevice
	testl	%eax, %eax
	je	.LBB1_2
# %bb.1:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, (%rbx)
.LBB1_2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	cudasetdevice, .Lfunc_end1-cudasetdevice
	.cfi_endproc
                                        # -- End function
	.globl	cudagetdeviceproperties         # -- Begin function cudagetdeviceproperties
	.type	cudagetdeviceproperties,@function
cudagetdeviceproperties:                # @cudagetdeviceproperties
	.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	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 1536
	.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	%r9, %rbx
	movq	%r8, %r14
	movq	%rcx, %r15
	movq	%rdx, %r12
	movq	%rsi, %r13
	movl	%edi, %esi
	movq	1648(%rsp), %rbp
	movl	$0, (%rbp)
	leaq	8(%rsp), %rdi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	je	.LBB2_2
# %bb.1:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, (%rbp)
	jmp	.LBB2_3
.LBB2_2:
	movq	296(%rsp), %rax
	movq	%rax, (%r13)
	movq	304(%rsp), %rax
	movq	%rax, (%r12)
	movl	312(%rsp), %eax
	movl	%eax, (%r15)
	movl	316(%rsp), %eax
	movl	%eax, (%r14)
	movl	328(%rsp), %eax
	movl	%eax, (%rbx)
	movq	1536(%rsp), %rax
	movl	332(%rsp), %ecx
	movl	%ecx, (%rax)
	movl	336(%rsp), %ecx
	movl	%ecx, 4(%rax)
	movl	340(%rsp), %ecx
	movl	%ecx, 8(%rax)
	movq	1544(%rsp), %rax
	movl	344(%rsp), %ecx
	movl	%ecx, (%rax)
	movl	348(%rsp), %ecx
	movl	%ecx, 4(%rax)
	movl	352(%rsp), %ecx
	movl	%ecx, 8(%rax)
	movq	1552(%rsp), %rax
	movl	356(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1560(%rsp), %rax
	movq	360(%rsp), %rcx
	movq	%rcx, (%rax)
	movq	1568(%rsp), %rax
	movl	368(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1576(%rsp), %rax
	movl	372(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1584(%rsp), %rax
	movl	392(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1592(%rsp), %rax
	movl	396(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1600(%rsp), %rax
	movl	584(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1608(%rsp), %rax
	movl	588(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1616(%rsp), %rax
	movl	608(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1624(%rsp), %rax
	movl	616(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1632(%rsp), %rax
	movl	620(%rsp), %ecx
	movl	%ecx, (%rax)
	movq	1640(%rsp), %rax
	movl	632(%rsp), %ecx
	movl	%ecx, (%rax)
.LBB2_3:
	addq	$1480, %rsp                     # imm = 0x5C8
	.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
.Lfunc_end2:
	.size	cudagetdeviceproperties, .Lfunc_end2-cudagetdeviceproperties
	.cfi_endproc
                                        # -- End function
	.globl	cudadevicesynchronize           # -- Begin function cudadevicesynchronize
	.type	cudadevicesynchronize,@function
cudadevicesynchronize:                  # @cudadevicesynchronize
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movl	$0, (%rdi)
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	je	.LBB3_2
# %bb.1:
	movl	$1, (%rbx)
.LBB3_2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	cudadevicesynchronize, .Lfunc_end3-cudadevicesynchronize
	.cfi_endproc
                                        # -- End function
	.globl	string_len                      # -- Begin function string_len
	.type	string_len,@function
string_len:                             # @string_len
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
	cmpb	$0, (%rdi,%rax)
	je	.LBB4_4
# %bb.2:                                #   in Loop: Header=BB4_1 Depth=1
	incq	%rax
	cmpq	$2147483647, %rax               # imm = 0x7FFFFFFF
	jne	.LBB4_1
# %bb.3:
	movl	$2147483647, %eax               # imm = 0x7FFFFFFF
.LBB4_4:                                # %.split.loop.exit6
                                        # kill: def $eax killed $eax killed $rax
	retq
.Lfunc_end4:
	.size	string_len, .Lfunc_end4-string_len
	.cfi_endproc
                                        # -- End function
	.globl	ptr_offset                      # -- Begin function ptr_offset
	.type	ptr_offset,@function
ptr_offset:                             # @ptr_offset
	.cfi_startproc
# %bb.0:
	leaq	(%rdi,%rsi), %rax
	retq
.Lfunc_end5:
	.size	ptr_offset, .Lfunc_end5-ptr_offset
	.cfi_endproc
                                        # -- End function
	.globl	c_ptr_value                     # -- Begin function c_ptr_value
	.type	c_ptr_value,@function
c_ptr_value:                            # @c_ptr_value
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	retq
.Lfunc_end6:
	.size	c_ptr_value, .Lfunc_end6-c_ptr_value
	.cfi_endproc
                                        # -- End function
	.globl	c_ptr_set                       # -- Begin function c_ptr_set
	.type	c_ptr_set,@function
c_ptr_set:                              # @c_ptr_set
	.cfi_startproc
# %bb.0:
	movq	%rdi, (%rsi)
	retq
.Lfunc_end7:
	.size	c_ptr_set, .Lfunc_end7-c_ptr_set
	.cfi_endproc
                                        # -- End function
	.globl	print_c_ptr                     # -- Begin function print_c_ptr
	.type	print_c_ptr,@function
print_c_ptr:                            # @print_c_ptr
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rsi
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	jmp	printf                          # TAILCALL
.Lfunc_end8:
	.size	print_c_ptr, .Lfunc_end8-print_c_ptr
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"#ERROR(cudagetdevicecount): %s \n"
	.size	.L.str, 33

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"#ERROR(cudasetdevice): %s \n"
	.size	.L.str.1, 28

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"#ERROR(cudagetdeviceproperties): %s \n"
	.size	.L.str.2, 38

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

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