/*
 * dpdems_cuda.cu
 * Copyright (C) 2016  <@A0835-PC>
 *
 * Distributed under terms of the MIT license.
 */
#include <iostream>
#include <cctype>
#include <ctime>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

const int maxdim = 100;
const int maxThreads = 21504;
const int threadPerBlock = 512;
int blockPerGrid(const int dim, const int threadPerBlock)
{
   return (dim + threadPerBlock - 1) / threadPerBlock;
}

inline void checkCudaError(cudaError_t error, const char *file, const int line)
{
   if (error != cudaSuccess) {
      std::cerr << "CUDA CALL FAILED: " << file << "( " << line << " )- " <<
         cudaGetErrorString(error) << std::endl;
      exit(EXIT_FAILURE);
   }
//   else
//      std::cout << "cuda call success" << std::endl;
}

inline void checkCudaState(const char *msg, const char *file, const int line)
{
   cudaError_t error = cudaGetLastError();
   if (error != cudaSuccess) {
      std::cerr << "---" << msg << " Error--" << std::endl;
      std::cerr << file << "( " << line << " )- " << 
         cudaGetErrorString(error) << std::endl;
      exit(EXIT_FAILURE);
   }
//   else
//      std::cout << "cuda state Success: " << msg << std::endl;
}

#define CHECK_ERROR(error) checkCudaError(error, __FILE__, __LINE__);
#define CHECK_STATE(msg) checkCudaState(msg, __FILE__, __LINE__);

void print_device(const int id)
{
   cudaDeviceProp props;
   CHECK_ERROR(cudaGetDeviceProperties(&props, id));
   std::cout << "---Property of currently device used---" << std::endl;
   std::cout << "Device " << id << ": " << props.name << std::endl;
   std::cout << "CUDA Capability: " << props.major << "." << props.minor
      << std::endl;
   std::cout << "MultiProcessor count: " << props.multiProcessorCount << std::endl;
}

void setCudaDevice(int id)
{
   int numDevice = 0;
   CHECK_ERROR(cudaGetDeviceCount(&numDevice));
   std::cout << "Total CUDA device number: " << numDevice << std::endl;
   if (numDevice > 1) {
      cudaDeviceProp props;
      cudaGetDeviceProperties(&props, id);
      int maxMultiProcessors = props.multiProcessorCount;
      for (int device = 1; device < numDevice; ++device) {
         CHECK_ERROR(cudaGetDeviceProperties(&props, device));
         if (maxMultiProcessors < props.multiProcessorCount) {
            maxMultiProcessors = props.multiProcessorCount;
            id = device;
         }
      }
   }
   CHECK_ERROR(cudaSetDevice(id));
   print_device(id);
}

__global__ void cudaScale(double *dev_xt, double *dev_yt, double *dev_zt, int *dev_x, int *dev_y, int *dev_z, int readnum, int maxdim)
{
   int tid = threadIdx.x + blockIdx.x * blockDim.x;
   while (tid < readnum) {
      dev_x[tid] = dev_xt[tid] * dev_xt[readnum] + maxdim;
      dev_y[tid] = dev_yt[tid] * dev_yt[readnum] + maxdim;
      dev_z[tid] = dev_zt[tid] * dev_zt[readnum] + maxdim;
      tid += blockDim.x * gridDim.x;
   }
}

double scalev(double &, const double &);
void swapv(double *, double *, double *, int, int, double);
bool isInGrid(const int &, const int &, const int &, const int &);
unsigned updatePosition(int *, int *, int *, double *, double *, double *, const int &, const int &, int ***, const unsigned long &);
unsigned long long collision(int *, int *, int *, double *, double *, double *, const int &, const int &, int ***, const unsigned long &, std::ostream &);

int main(int argc, char **argv)
{
   std::cout.setf(std::ios::scientific);
   std::cout.precision(19);

   int device_id = 0;
   setCudaDevice(device_id);
   std::size_t readnum = 100;

   clock_t t;
   t = clock();

   cudaEvent_t start, stop;
   CHECK_STATE("cudaEvent1");
   CHECK_ERROR(cudaEventCreate(&start));
   CHECK_STATE("cudaEvent2");
   CHECK_ERROR(cudaEventCreate(&stop));
   CHECK_ERROR(cudaEventRecord(start, 0));
   CHECK_ERROR(cudaEventSynchronize(start));

   int *x = new int[readnum];
   int *y = new int[readnum];
   int *z = new int[readnum];
   int *dev_x;
   int *dev_y;
   int *dev_z;
   double *dev_xt;
   double *dev_yt;
   double *dev_zt;
   CHECK_ERROR(cudaMalloc((void**)&dev_x, readnum * sizeof(int)));
   CHECK_ERROR(cudaMalloc((void**)&dev_y, readnum * sizeof(int)));
   CHECK_ERROR(cudaMalloc((void**)&dev_z, readnum * sizeof(int)));
   CHECK_ERROR(cudaMalloc((void**)&dev_xt, (readnum + 1) * sizeof(double)));
   CHECK_ERROR(cudaMalloc((void**)&dev_yt, (readnum + 1) * sizeof(double)));
   CHECK_ERROR(cudaMalloc((void**)&dev_zt, (readnum + 1) * sizeof(double)));

   int threads = threadPerBlock;
   int blocks = blockPerGrid(readnum, threads);
//   cudaScale<<<blocks, threads>>>(dev_xt, dev_yt, dev_zt, dev_x, dev_y, dev_z, readnum, maxdim);
   CHECK_STATE("cudaScale call");
   CHECK_ERROR(cudaMemcpy(x, dev_x, readnum * sizeof(int), cudaMemcpyDeviceToHost));
   CHECK_ERROR(cudaMemcpy(y, dev_y, readnum * sizeof(int), cudaMemcpyDeviceToHost));
   CHECK_ERROR(cudaMemcpy(z, dev_z, readnum * sizeof(int), cudaMemcpyDeviceToHost));
   CHECK_ERROR(cudaFree(dev_x));
   CHECK_ERROR(cudaFree(dev_y));
   CHECK_ERROR(cudaFree(dev_z));
   CHECK_ERROR(cudaFree(dev_xt));
   CHECK_ERROR(cudaFree(dev_yt));
   CHECK_ERROR(cudaFree(dev_zt));

   CHECK_ERROR(cudaEventRecord(stop, 0));
   CHECK_ERROR(cudaEventSynchronize(stop));
   float elapsedTime;
   CHECK_ERROR(cudaEventElapsedTime(&elapsedTime, start, stop));
   CHECK_ERROR(cudaEventDestroy(start));
   CHECK_ERROR(cudaEventDestroy(stop));
   std::cout << "CUDA elapsed: " << elapsedTime / 1000.0 << std::endl;

   int ***grid;
   grid = new int **[maxdim];
   for (int i = 0; i < maxdim; ++i) {
      grid[i] = new int *[maxdim];
      for (int j = 0; j < maxdim; ++j) {
         grid[i][j] = new int[maxdim];
         for (int k = 0; k < maxdim; ++k)
            grid[i][j][k] = 0;
      }
   }
   std::cout << *(x + 0) << " " << *(y + 0) << " " << *(z + 0) << std::endl;
   for (int i = 0; i < readnum; ++i) {
      grid[*(x + i)][*(y + i)][*(z + i)] = i;
   }

   std::cout << x[0] << " : " << y[0] << " : " << z[0] << std::endl;

   t = clock() - t;
   double seconds = (double)t / CLOCKS_PER_SEC;

   std::cout << std::endl << "Total time consumed: " << seconds << " seconds" << std::endl;

   delete [] x;
   std::cout << "delete x" << std::endl;
//   delete [] y;
   std::cout << "delete y" << std::endl;
//   delete [] z;
   std::cout << "delete z" << std::endl;
   for (int i = 0; i < maxdim; ++i) {
      for (int j = 0; j < maxdim; ++j) {
         delete[] grid[i][j];
      }
      delete[] grid[i];
   }
   delete[] grid;
   std::cout << "delete grid" << std::endl;
   std::cout << std::endl;
   return 0;
}

	.file	"tmpxft_0022aefa_00000000-6_dpdems_cuda_test.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3643:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3643:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z12blockPerGridii
	.type	_Z12blockPerGridii, @function
_Z12blockPerGridii:
.LFB3635:
	.cfi_startproc
	endbr64
	leal	-1(%rsi,%rdi), %eax
	cltd
	idivl	%esi
	ret
	.cfi_endproc
.LFE3635:
	.size	_Z12blockPerGridii, .-_Z12blockPerGridii
	.section	.rodata._Z14checkCudaError9cudaErrorPKci.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA CALL FAILED: "
.LC1:
	.string	"( "
.LC2:
	.string	" )- "
	.section	.text._Z14checkCudaError9cudaErrorPKci,"axG",@progbits,_Z14checkCudaError9cudaErrorPKci,comdat
	.weak	_Z14checkCudaError9cudaErrorPKci
	.type	_Z14checkCudaError9cudaErrorPKci, @function
_Z14checkCudaError9cudaErrorPKci:
.LFB3636:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L3
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	leaq	.LC0(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
.L3:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE3636:
	.size	_Z14checkCudaError9cudaErrorPKci, .-_Z14checkCudaError9cudaErrorPKci
	.section	.rodata._Z14checkCudaStatePKcS0_i.str1.1,"aMS",@progbits,1
.LC3:
	.string	"---"
.LC4:
	.string	" Error--"
	.section	.text._Z14checkCudaStatePKcS0_i,"axG",@progbits,_Z14checkCudaStatePKcS0_i,comdat
	.weak	_Z14checkCudaStatePKcS0_i
	.type	_Z14checkCudaStatePKcS0_i, @function
_Z14checkCudaStatePKcS0_i:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L9
	leaq	_ZSt4cerr(%rip), %r13
	leaq	.LC3(%rip), %rsi
	movl	%eax, %ebx
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	%r12, %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
.L9:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3637:
	.size	_Z14checkCudaStatePKcS0_i, .-_Z14checkCudaStatePKcS0_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC5:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/blueyi/dpdems/master/test/dpdems_cuda_test.cu"
.LC6:
	.string	"---Property of currently device used---"
.LC7:
	.string	"Device "
.LC8:
	.string	": "
.LC9:
	.string	"CUDA Capability: "
.LC10:
	.string	"."
.LC11:
	.string	"MultiProcessor count: "
	.text
	.globl	_Z12print_devicei
	.type	_Z12print_devicei, @function
_Z12print_devicei:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edi, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	_ZSt4cout(%rip), %rbx
	subq	$1040, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1032(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	movq	%r12, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	$51, %edx
	leaq	.LC5(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	.LC6(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC7(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC8(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	360(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC10(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	364(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC11(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	388(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	1032(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	addq	$1040, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	_Z12print_devicei, .-_Z12print_devicei
	.section	.rodata.str1.1
.LC12:
	.string	"Total CUDA device number: "
	.text
	.globl	_Z13setCudaDevicei
	.type	_Z13setCudaDevicei, @function
_Z13setCudaDevicei:
.LFB3639:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC5(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edi, %ebx
	subq	$1056, %rsp
	.cfi_def_cfa_offset 1104
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	xorl	%eax, %eax
	movl	%eax, 12(%rsp)
	call	cudaGetDeviceCount@PLT
	movl	$62, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	.LC12(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	cmpl	$1, 12(%rsp)
	jle	.L16
	leaq	16(%rsp), %r14
	movl	%ebx, %esi
	movl	$1, %ebp
	movq	%r14, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	404(%rsp), %r13d
.L17:
	cmpl	%ebp, 12(%rsp)
	jle	.L16
	movl	%ebp, %esi
	movq	%r14, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	$69, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movl	404(%rsp), %eax
	cmpl	%r13d, %eax
	jg	.L21
	movl	%r13d, %eax
	jmp	.L18
.L21:
	movl	%ebp, %ebx
.L18:
	incl	%ebp
	movl	%eax, %r13d
	jmp	.L17
.L16:
	movl	%ebx, %edi
	call	cudaSetDevice@PLT
	movl	$76, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movl	%ebx, %edi
	call	_Z12print_devicei
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	addq	$1056, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3639:
	.size	_Z13setCudaDevicei, .-_Z13setCudaDevicei
	.section	.rodata.str1.1
.LC13:
	.string	"cudaEvent1"
.LC14:
	.string	"cudaEvent2"
.LC15:
	.string	"cudaScale call"
.LC16:
	.string	"CUDA elapsed: "
.LC18:
	.string	" "
.LC19:
	.string	" : "
.LC21:
	.string	"Total time consumed: "
.LC22:
	.string	" seconds"
.LC23:
	.string	"delete x"
.LC24:
	.string	"delete y"
.LC25:
	.string	"delete z"
.LC26:
	.string	"delete grid"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3640:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC5(%rip), %rbp
	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
	orl	$256, 32+_ZSt4cout(%rip)
	movq	$19, 16+_ZSt4cout(%rip)
	call	_Z13setCudaDevicei
	call	clock@PLT
	movq	%rbp, %rsi
	movl	$110, %edx
	leaq	.LC13(%rip), %rdi
	movq	%rax, %r15
	call	_Z14checkCudaStatePKcS0_i
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	%rbp, %rsi
	movl	$111, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	%rbp, %rsi
	movl	$112, %edx
	leaq	.LC14(%rip), %rdi
	call	_Z14checkCudaStatePKcS0_i
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$113, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbp, %rsi
	movl	$114, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$115, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movl	$400, %edi
	call	_Znam@PLT
	movl	$400, %edi
	movq	%rax, %rbx
	call	_Znam@PLT
	movl	$400, %edi
	movq	%rax, %r13
	call	_Znam@PLT
	leaq	40(%rsp), %rdi
	movl	$400, %esi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	movl	$126, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	48(%rsp), %rdi
	movl	$400, %esi
	call	cudaMalloc@PLT
	movl	$127, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	56(%rsp), %rdi
	movl	$400, %esi
	call	cudaMalloc@PLT
	movl	$128, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	64(%rsp), %rdi
	movl	$808, %esi
	call	cudaMalloc@PLT
	movl	$129, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	72(%rsp), %rdi
	movl	$808, %esi
	call	cudaMalloc@PLT
	movl	$130, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	80(%rsp), %rdi
	movl	$808, %esi
	call	cudaMalloc@PLT
	movq	%rbp, %rsi
	movl	$131, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	%rbp, %rsi
	movl	$136, %edx
	leaq	.LC15(%rip), %rdi
	call	_Z14checkCudaStatePKcS0_i
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$400, %edx
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$137, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	movl	$400, %edx
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$138, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	%r12, %rdi
	movl	$400, %edx
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$139, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movl	$140, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movl	$141, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movl	$142, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movl	$143, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movl	$144, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movl	$145, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbp, %rsi
	movl	$147, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	%rbp, %rsi
	movl	$148, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%rbp, %rsi
	movl	$150, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	%rbp, %rsi
	movl	$151, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movl	$152, %edx
	movq	%rbp, %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	.LC16(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	20(%rsp), %xmm0
	divsd	.LC17(%rip), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$800, %edi
	xorl	%r14d, %r14d
	call	_Znam@PLT
	movq	%rax, %rbp
.L25:
	movl	$800, %edi
	call	_Znam@PLT
	xorl	%esi, %esi
	movq	%rax, 0(%rbp,%r14,8)
	movq	%rax, %r8
.L24:
	movl	$400, %edi
	movq	%rsi, 8(%rsp)
	movq	%r8, (%rsp)
	call	_Znam@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %r8
	movl	$100, %ecx
	movq	%rax, %rdi
	movq	%rax, (%r8,%rsi,8)
	xorl	%eax, %eax
	incq	%rsi
	rep stosl
	cmpq	$100, %rsi
	jne	.L24
	incq	%r14
	cmpq	$100, %r14
	jne	.L25
	movl	(%rbx), %esi
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC18(%rip), %r14
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	0(%r13), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	(%r12), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	xorl	%eax, %eax
.L26:
	movslq	(%rbx,%rax,4), %rdx
	movslq	0(%r13,%rax,4), %rsi
	movslq	(%r12,%rax,4), %rcx
	movq	0(%rbp,%rdx,8), %rdx
	movq	(%rdx,%rsi,8), %rdx
	movl	%eax, (%rdx,%rcx,4)
	incq	%rax
	cmpq	$100, %rax
	jne	.L26
	movl	(%rbx), %esi
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC19(%rip), %r14
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	0(%r13), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	(%r12), %esi
	xorl	%r12d, %r12d
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	call	clock@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	subq	%r15, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC20(%rip), %xmm0
	movsd	%xmm0, (%rsp)
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC21(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC22(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	leaq	.LC23(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC24(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC25(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
.L27:
	xorl	%ebx, %ebx
.L29:
	movq	0(%rbp,%r12,8), %r13
	movq	0(%r13,%rbx), %rdi
	testq	%rdi, %rdi
	je	.L28
	call	_ZdaPv@PLT
.L28:
	addq	$8, %rbx
	cmpq	$800, %rbx
	jne	.L29
	testq	%r13, %r13
	je	.L30
	movq	%r13, %rdi
	call	_ZdaPv@PLT
.L30:
	incq	%r12
	cmpq	$100, %r12
	jne	.L27
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
	leaq	.LC26(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	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
.LFE3640:
	.size	main, .-main
	.text
	.globl	_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii
	.type	_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii, @function
_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii:
.LFB3665:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	leaq	208(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	216(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	pushq	64(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z9cudaScalePdS_S_PiS0_S0_ii(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 224
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L44:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3665:
	.size	_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii, .-_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii
	.globl	_Z9cudaScalePdS_S_PiS0_S0_ii
	.type	_Z9cudaScalePdS_S_PiS0_S0_ii, @function
_Z9cudaScalePdS_S_PiS0_S0_ii:
.LFB3666:
	.cfi_startproc
	endbr64
	jmp	_Z42__device_stub__Z9cudaScalePdS_S_PiS0_S0_iiPdS_S_PiS0_S0_ii
	.cfi_endproc
.LFE3666:
	.size	_Z9cudaScalePdS_S_PiS0_S0_ii, .-_Z9cudaScalePdS_S_PiS0_S0_ii
	.section	.rodata.str1.1
.LC27:
	.string	"_Z9cudaScalePdS_S_PiS0_S0_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3668:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC27(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9cudaScalePdS_S_PiS0_S0_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3668:
	.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
.LC17:
	.long	0
	.long	1083129856
	.align 8
.LC20:
	.long	0
	.long	1093567616
	.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:

/*
 * dpdems_cuda.cu
 * Copyright (C) 2016  <@A0835-PC>
 *
 * Distributed under terms of the MIT license.
 */
#include <iostream>
#include <cctype>
#include <ctime>
#include "hip/hip_runtime.h"


const int maxdim = 100;
const int maxThreads = 21504;
const int threadPerBlock = 512;
int blockPerGrid(const int dim, const int threadPerBlock)
{
   return (dim + threadPerBlock - 1) / threadPerBlock;
}

inline void checkCudaError(hipError_t error, const char *file, const int line)
{
   if (error != hipSuccess) {
      std::cerr << "CUDA CALL FAILED: " << file << "( " << line << " )- " <<
         hipGetErrorString(error) << std::endl;
      exit(EXIT_FAILURE);
   }
//   else
//      std::cout << "cuda call success" << std::endl;
}

inline void checkCudaState(const char *msg, const char *file, const int line)
{
   hipError_t error = hipGetLastError();
   if (error != hipSuccess) {
      std::cerr << "---" << msg << " Error--" << std::endl;
      std::cerr << file << "( " << line << " )- " << 
         hipGetErrorString(error) << std::endl;
      exit(EXIT_FAILURE);
   }
//   else
//      std::cout << "cuda state Success: " << msg << std::endl;
}

#define CHECK_ERROR(error) checkCudaError(error, __FILE__, __LINE__);
#define CHECK_STATE(msg) checkCudaState(msg, __FILE__, __LINE__);

void print_device(const int id)
{
   hipDeviceProp_t props;
   CHECK_ERROR(hipGetDeviceProperties(&props, id));
   std::cout << "---Property of currently device used---" << std::endl;
   std::cout << "Device " << id << ": " << props.name << std::endl;
   std::cout << "CUDA Capability: " << props.major << "." << props.minor
      << std::endl;
   std::cout << "MultiProcessor count: " << props.multiProcessorCount << std::endl;
}

void setCudaDevice(int id)
{
   int numDevice = 0;
   CHECK_ERROR(hipGetDeviceCount(&numDevice));
   std::cout << "Total CUDA device number: " << numDevice << std::endl;
   if (numDevice > 1) {
      hipDeviceProp_t props;
      hipGetDeviceProperties(&props, id);
      int maxMultiProcessors = props.multiProcessorCount;
      for (int device = 1; device < numDevice; ++device) {
         CHECK_ERROR(hipGetDeviceProperties(&props, device));
         if (maxMultiProcessors < props.multiProcessorCount) {
            maxMultiProcessors = props.multiProcessorCount;
            id = device;
         }
      }
   }
   CHECK_ERROR(hipSetDevice(id));
   print_device(id);
}

__global__ void cudaScale(double *dev_xt, double *dev_yt, double *dev_zt, int *dev_x, int *dev_y, int *dev_z, int readnum, int maxdim)
{
   int tid = threadIdx.x + blockIdx.x * blockDim.x;
   while (tid < readnum) {
      dev_x[tid] = dev_xt[tid] * dev_xt[readnum] + maxdim;
      dev_y[tid] = dev_yt[tid] * dev_yt[readnum] + maxdim;
      dev_z[tid] = dev_zt[tid] * dev_zt[readnum] + maxdim;
      tid += blockDim.x * gridDim.x;
   }
}

double scalev(double &, const double &);
void swapv(double *, double *, double *, int, int, double);
bool isInGrid(const int &, const int &, const int &, const int &);
unsigned updatePosition(int *, int *, int *, double *, double *, double *, const int &, const int &, int ***, const unsigned long &);
unsigned long long collision(int *, int *, int *, double *, double *, double *, const int &, const int &, int ***, const unsigned long &, std::ostream &);

int main(int argc, char **argv)
{
   std::cout.setf(std::ios::scientific);
   std::cout.precision(19);

   int device_id = 0;
   setCudaDevice(device_id);
   std::size_t readnum = 100;

   clock_t t;
   t = clock();

   hipEvent_t start, stop;
   CHECK_STATE("cudaEvent1");
   CHECK_ERROR(hipEventCreate(&start));
   CHECK_STATE("cudaEvent2");
   CHECK_ERROR(hipEventCreate(&stop));
   CHECK_ERROR(hipEventRecord(start, 0));
   CHECK_ERROR(hipEventSynchronize(start));

   int *x = new int[readnum];
   int *y = new int[readnum];
   int *z = new int[readnum];
   int *dev_x;
   int *dev_y;
   int *dev_z;
   double *dev_xt;
   double *dev_yt;
   double *dev_zt;
   CHECK_ERROR(hipMalloc((void**)&dev_x, readnum * sizeof(int)));
   CHECK_ERROR(hipMalloc((void**)&dev_y, readnum * sizeof(int)));
   CHECK_ERROR(hipMalloc((void**)&dev_z, readnum * sizeof(int)));
   CHECK_ERROR(hipMalloc((void**)&dev_xt, (readnum + 1) * sizeof(double)));
   CHECK_ERROR(hipMalloc((void**)&dev_yt, (readnum + 1) * sizeof(double)));
   CHECK_ERROR(hipMalloc((void**)&dev_zt, (readnum + 1) * sizeof(double)));

   int threads = threadPerBlock;
   int blocks = blockPerGrid(readnum, threads);
//   cudaScale<<<blocks, threads>>>(dev_xt, dev_yt, dev_zt, dev_x, dev_y, dev_z, readnum, maxdim);
   CHECK_STATE("cudaScale call");
   CHECK_ERROR(hipMemcpy(x, dev_x, readnum * sizeof(int), hipMemcpyDeviceToHost));
   CHECK_ERROR(hipMemcpy(y, dev_y, readnum * sizeof(int), hipMemcpyDeviceToHost));
   CHECK_ERROR(hipMemcpy(z, dev_z, readnum * sizeof(int), hipMemcpyDeviceToHost));
   CHECK_ERROR(hipFree(dev_x));
   CHECK_ERROR(hipFree(dev_y));
   CHECK_ERROR(hipFree(dev_z));
   CHECK_ERROR(hipFree(dev_xt));
   CHECK_ERROR(hipFree(dev_yt));
   CHECK_ERROR(hipFree(dev_zt));

   CHECK_ERROR(hipEventRecord(stop, 0));
   CHECK_ERROR(hipEventSynchronize(stop));
   float elapsedTime;
   CHECK_ERROR(hipEventElapsedTime(&elapsedTime, start, stop));
   CHECK_ERROR(hipEventDestroy(start));
   CHECK_ERROR(hipEventDestroy(stop));
   std::cout << "CUDA elapsed: " << elapsedTime / 1000.0 << std::endl;

   int ***grid;
   grid = new int **[maxdim];
   for (int i = 0; i < maxdim; ++i) {
      grid[i] = new int *[maxdim];
      for (int j = 0; j < maxdim; ++j) {
         grid[i][j] = new int[maxdim];
         for (int k = 0; k < maxdim; ++k)
            grid[i][j][k] = 0;
      }
   }
   std::cout << *(x + 0) << " " << *(y + 0) << " " << *(z + 0) << std::endl;
   for (int i = 0; i < readnum; ++i) {
      grid[*(x + i)][*(y + i)][*(z + i)] = i;
   }

   std::cout << x[0] << " : " << y[0] << " : " << z[0] << std::endl;

   t = clock() - t;
   double seconds = (double)t / CLOCKS_PER_SEC;

   std::cout << std::endl << "Total time consumed: " << seconds << " seconds" << std::endl;

   delete [] x;
   std::cout << "delete x" << std::endl;
//   delete [] y;
   std::cout << "delete y" << std::endl;
//   delete [] z;
   std::cout << "delete z" << std::endl;
   for (int i = 0; i < maxdim; ++i) {
      for (int j = 0; j < maxdim; ++j) {
         delete[] grid[i][j];
      }
      delete[] grid[i];
   }
   delete[] grid;
   std::cout << "delete grid" << std::endl;
   std::cout << std::endl;
   return 0;
}

	.text
	.file	"dpdems_cuda_test.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z12blockPerGridii              # -- Begin function _Z12blockPerGridii
	.type	_Z12blockPerGridii,@function
_Z12blockPerGridii:                     # @_Z12blockPerGridii
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
                                        # kill: def $edi killed $edi def $rdi
	leal	(%rdi,%rsi), %eax
	decl	%eax
	cltd
	idivl	%esi
	retq
.Lfunc_end0:
	.size	_Z12blockPerGridii, .Lfunc_end0-_Z12blockPerGridii
	.cfi_endproc
                                        # -- End function
	.globl	_Z12print_devicei               # -- Begin function _Z12print_devicei
	.type	_Z12print_devicei,@function
_Z12print_devicei:                      # @_Z12print_devicei
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$1472, %rsp                     # imm = 0x5C0
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebx
	movq	%rsp, %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB1_2
# %bb.1:                                # %_Z14checkCudaError10hipError_tPKci.exit
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$39, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%ebx, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movl	$.L.str.3, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rsp, %rbx
	movq	%rbx, %rdi
	callq	strlen
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	360(%rbx), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movl	$.L.str.5, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	364(%rbx), %esi
	movq	%r14, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	388(%rbx), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	addq	$1472, %rsp                     # imm = 0x5C0
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_2:
	.cfi_def_cfa_offset 1504
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$51, %esi
	callq	_ZNSolsEi
	movl	$.L.str.22, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rbx
	movl	%ebp, %edi
	callq	hipGetErrorString
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z12print_devicei, .Lfunc_end1-_Z12print_devicei
	.cfi_endproc
                                        # -- End function
	.globl	_Z13setCudaDevicei              # -- Begin function _Z13setCudaDevicei
	.type	_Z13setCudaDevicei,@function
_Z13setCudaDevicei:                     # @_Z13setCudaDevicei
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 1536
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebx
	leaq	12(%rsp), %rdi
	movl	$0, (%rdi)
	callq	hipGetDeviceCount
	testl	%eax, %eax
	jne	.LBB2_1
# %bb.3:                                # %_Z14checkCudaError10hipError_tPKci.exit
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$26, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	12(%rsp), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	cmpl	$2, 12(%rsp)
	jl	.LBB2_9
# %bb.4:
	leaq	16(%rsp), %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
	cmpl	$2, 12(%rsp)
	jl	.LBB2_9
# %bb.5:                                # %.lr.ph.preheader
	movl	$1, %r14d
	leaq	16(%rsp), %r15
	movl	388(%r15), %r12d
.LBB2_6:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB2_7
# %bb.8:                                # %_Z14checkCudaError10hipError_tPKci.exit14
                                        #   in Loop: Header=BB2_6 Depth=1
	movl	404(%rsp), %eax
	cmpl	%eax, %r12d
	cmovll	%r14d, %ebx
	cmovlel	%eax, %r12d
	incl	%r14d
	cmpl	12(%rsp), %r14d
	jl	.LBB2_6
.LBB2_9:
	movl	%ebx, %edi
	callq	hipSetDevice
	testl	%eax, %eax
	jne	.LBB2_10
# %bb.11:                               # %_Z14checkCudaError10hipError_tPKci.exit16
	movl	%ebx, %edi
	callq	_Z12print_devicei
	addq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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
.LBB2_7:
	.cfi_def_cfa_offset 1536
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$69, %esi
.LBB2_2:
	callq	_ZNSolsEi
	movl	$.L.str.22, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rbx
	movl	%ebp, %edi
	callq	hipGetErrorString
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.LBB2_1:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$62, %esi
	jmp	.LBB2_2
.LBB2_10:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$76, %esi
	jmp	.LBB2_2
.Lfunc_end2:
	.size	_Z13setCudaDevicei, .Lfunc_end2-_Z13setCudaDevicei
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii # -- Begin function _Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii
	.type	_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii,@function
_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii: # @_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z9cudaScalePdS_S_PiS0_S0_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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_end3:
	.size	_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii, .Lfunc_end3-_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI4_0:
	.quad	0x408f400000000000              # double 1000
.LCPI4_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	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
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rcx
	orl	$256, _ZSt4cout+24(%rcx)        # imm = 0x100
	movq	-24(%rax), %rax
	movq	$19, _ZSt4cout+8(%rax)
	xorl	%edi, %edi
	callq	_Z13setCudaDevicei
	callq	clock
	movq	%rax, %r14
	movl	$.L.str.8, %edi
	movl	$.L.str, %esi
	movl	$110, %edx
	callq	_Z14checkCudaStatePKcS0_i
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB4_1
# %bb.4:                                # %_Z14checkCudaError10hipError_tPKci.exit
	movl	$.L.str.9, %edi
	movl	$.L.str, %esi
	movl	$112, %edx
	callq	_Z14checkCudaStatePKcS0_i
	movq	%rsp, %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB4_5
# %bb.6:                                # %_Z14checkCudaError10hipError_tPKci.exit73
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB4_7
# %bb.8:                                # %_Z14checkCudaError10hipError_tPKci.exit75
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	jne	.LBB4_9
# %bb.10:                               # %_Z14checkCudaError10hipError_tPKci.exit77
	movl	$400, %edi                      # imm = 0x190
	callq	_Znam
	movq	%rax, %rbx
	movl	$400, %edi                      # imm = 0x190
	callq	_Znam
	movq	%rax, %r12
	movl	$400, %edi                      # imm = 0x190
	callq	_Znam
	movq	%rax, %r15
	leaq	48(%rsp), %rdi
	movl	$400, %esi                      # imm = 0x190
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.13:                               # %_Z14checkCudaError10hipError_tPKci.exit79
	leaq	40(%rsp), %rdi
	movl	$400, %esi                      # imm = 0x190
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_14
# %bb.15:                               # %_Z14checkCudaError10hipError_tPKci.exit81
	leaq	32(%rsp), %rdi
	movl	$400, %esi                      # imm = 0x190
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_16
# %bb.17:                               # %_Z14checkCudaError10hipError_tPKci.exit83
	leaq	80(%rsp), %rdi
	movl	$808, %esi                      # imm = 0x328
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_18
# %bb.19:                               # %_Z14checkCudaError10hipError_tPKci.exit85
	leaq	72(%rsp), %rdi
	movl	$808, %esi                      # imm = 0x328
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_20
# %bb.21:                               # %_Z14checkCudaError10hipError_tPKci.exit87
	leaq	64(%rsp), %rdi
	movl	$808, %esi                      # imm = 0x328
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_22
# %bb.23:                               # %_Z14checkCudaError10hipError_tPKci.exit89
	movl	$.L.str.10, %edi
	movl	$.L.str, %esi
	movl	$136, %edx
	callq	_Z14checkCudaStatePKcS0_i
	movq	48(%rsp), %rsi
	movl	$400, %edx                      # imm = 0x190
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_24
# %bb.25:                               # %_Z14checkCudaError10hipError_tPKci.exit91
	movq	40(%rsp), %rsi
	movl	$400, %edx                      # imm = 0x190
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_26
# %bb.27:                               # %_Z14checkCudaError10hipError_tPKci.exit93
	movq	32(%rsp), %rsi
	movl	$400, %edx                      # imm = 0x190
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_28
# %bb.29:                               # %_Z14checkCudaError10hipError_tPKci.exit95
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_30
# %bb.31:                               # %_Z14checkCudaError10hipError_tPKci.exit97
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_32
# %bb.33:                               # %_Z14checkCudaError10hipError_tPKci.exit99
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_34
# %bb.35:                               # %_Z14checkCudaError10hipError_tPKci.exit101
	movq	80(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_36
# %bb.37:                               # %_Z14checkCudaError10hipError_tPKci.exit103
	movq	72(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_38
# %bb.39:                               # %_Z14checkCudaError10hipError_tPKci.exit105
	movq	64(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_40
# %bb.41:                               # %_Z14checkCudaError10hipError_tPKci.exit107
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB4_42
# %bb.43:                               # %_Z14checkCudaError10hipError_tPKci.exit109
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	jne	.LBB4_44
# %bb.45:                               # %_Z14checkCudaError10hipError_tPKci.exit111
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	testl	%eax, %eax
	jne	.LBB4_46
# %bb.47:                               # %_Z14checkCudaError10hipError_tPKci.exit113
	movq	%rbx, 56(%rsp)                  # 8-byte Spill
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	testl	%eax, %eax
	jne	.LBB4_48
# %bb.49:                               # %_Z14checkCudaError10hipError_tPKci.exit115
	movq	%r14, 16(%rsp)                  # 8-byte Spill
	movq	(%rsp), %rdi
	callq	hipEventDestroy
	testl	%eax, %eax
	jne	.LBB4_50
# %bb.51:                               # %_Z14checkCudaError10hipError_tPKci.exit117
	movl	$_ZSt4cout, %edi
	movl	$.L.str.11, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	cvtss2sd	28(%rsp), %xmm0
	divsd	.LCPI4_0(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$800, %edi                      # imm = 0x320
	callq	_Znam
	movq	%rax, %r13
	xorl	%r14d, %r14d
.LBB4_52:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_53 Depth 2
	movl	$800, %edi                      # imm = 0x320
	callq	_Znam
	movq	%rax, %rbp
	movq	%rax, (%r13,%r14,8)
	xorl	%ebx, %ebx
.LBB4_53:                               #   Parent Loop BB4_52 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$400, %edi                      # imm = 0x190
	callq	_Znam
	movq	%rax, (%rbp,%rbx,8)
	movl	$400, %edx                      # imm = 0x190
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	incq	%rbx
	cmpq	$100, %rbx
	jne	.LBB4_53
# %bb.54:                               #   in Loop: Header=BB4_52 Depth=1
	incq	%r14
	cmpq	$100, %r14
	jne	.LBB4_52
# %bb.55:
	movq	56(%rsp), %rbx                  # 8-byte Reload
	movl	(%rbx), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %rbp
	movl	$.L.str.12, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	(%r12), %esi
	movq	%rbp, %rdi
	callq	_ZNSolsEi
	movq	%rax, %rbp
	movl	$.L.str.12, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	(%r15), %esi
	movq	%rbp, %rdi
	callq	_ZNSolsEi
	movq	%rax, %rbp
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbp, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
.LBB4_56:                               # =>This Inner Loop Header: Depth=1
	movslq	(%rbx,%rax,4), %rcx
	movq	(%r13,%rcx,8), %rcx
	movslq	(%r12,%rax,4), %rdx
	movq	(%rcx,%rdx,8), %rcx
	movslq	(%r15,%rax,4), %rdx
	movl	%eax, (%rcx,%rdx,4)
	incq	%rax
	cmpq	$100, %rax
	jne	.LBB4_56
# %bb.57:
	movl	(%rbx), %esi
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %rbp
	movl	$.L.str.13, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	(%r12), %esi
	movq	%rbp, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movl	$.L.str.13, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	(%r15), %esi
	movq	%r12, %rdi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	callq	clock
	subq	16(%rsp), %rax                  # 8-byte Folded Reload
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI4_1(%rip), %xmm0
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %r14
	movl	$.L.str.14, %esi
	movl	$21, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str.15, %esi
	movl	$8, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rbx, %rdi
	callq	_ZdaPv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.16, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %ebx
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.17, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$_ZSt4cout, %ebx
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.18, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%r14d, %r14d
.LBB4_58:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_59 Depth 2
	movq	(%r13,%r14,8), %rbx
	xorl	%r15d, %r15d
.LBB4_59:                               #   Parent Loop BB4_58 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%rbx,%r15,8), %rdi
	testq	%rdi, %rdi
	je	.LBB4_61
# %bb.60:                               #   in Loop: Header=BB4_59 Depth=2
	callq	_ZdaPv
.LBB4_61:                               #   in Loop: Header=BB4_59 Depth=2
	incq	%r15
	cmpq	$100, %r15
	jne	.LBB4_59
# %bb.62:                               #   in Loop: Header=BB4_58 Depth=1
	movq	%rbx, %rdi
	callq	_ZdaPv
	incq	%r14
	cmpq	$100, %r14
	jne	.LBB4_58
# %bb.63:
	movq	%r13, %rdi
	callq	_ZdaPv
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.19, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	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
.LBB4_1:
	.cfi_def_cfa_offset 144
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$111, %esi
	jmp	.LBB4_2
.LBB4_5:
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$113, %esi
	jmp	.LBB4_2
.LBB4_7:
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$114, %esi
	jmp	.LBB4_2
.LBB4_9:
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$115, %esi
.LBB4_2:
	callq	_ZNSolsEi
	movl	$.L.str.22, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movq	%r14, %rdi
	jmp	.LBB4_3
.LBB4_11:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$126, %esi
	jmp	.LBB4_12
.LBB4_14:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$127, %esi
	jmp	.LBB4_12
.LBB4_16:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$128, %esi
	jmp	.LBB4_12
.LBB4_18:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$129, %esi
	jmp	.LBB4_12
.LBB4_20:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$130, %esi
	jmp	.LBB4_12
.LBB4_22:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$131, %esi
	jmp	.LBB4_12
.LBB4_24:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$137, %esi
	jmp	.LBB4_12
.LBB4_26:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$138, %esi
	jmp	.LBB4_12
.LBB4_28:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$139, %esi
	jmp	.LBB4_12
.LBB4_30:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$140, %esi
	jmp	.LBB4_12
.LBB4_32:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$141, %esi
	jmp	.LBB4_12
.LBB4_34:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$142, %esi
	jmp	.LBB4_12
.LBB4_36:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$143, %esi
	jmp	.LBB4_12
.LBB4_38:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$144, %esi
	jmp	.LBB4_12
.LBB4_40:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$145, %esi
	jmp	.LBB4_12
.LBB4_42:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$147, %esi
	jmp	.LBB4_12
.LBB4_44:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$148, %esi
	jmp	.LBB4_12
.LBB4_46:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$150, %esi
	jmp	.LBB4_12
.LBB4_48:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$151, %esi
	jmp	.LBB4_12
.LBB4_50:
	movl	%eax, %ebp
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.20, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	$152, %esi
.LBB4_12:
	callq	_ZNSolsEi
	movl	$.L.str.22, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rbx
	movl	%ebp, %edi
	callq	hipGetErrorString
	movq	%rbx, %rdi
.LBB4_3:
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.section	.text._Z14checkCudaStatePKcS0_i,"axG",@progbits,_Z14checkCudaStatePKcS0_i,comdat
	.weak	_Z14checkCudaStatePKcS0_i       # -- Begin function _Z14checkCudaStatePKcS0_i
	.type	_Z14checkCudaStatePKcS0_i,@function
_Z14checkCudaStatePKcS0_i:              # @_Z14checkCudaStatePKcS0_i
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %r14
	movq	%rdi, %r15
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB5_2
# %bb.1:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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
.LBB5_2:
	.cfi_def_cfa_offset 48
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.23, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.24, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$_ZSt4cerr, %edi
	movq	%r14, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.21, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movl	$.L.str.22, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end5:
	.size	_Z14checkCudaStatePKcS0_i, .Lfunc_end5-_Z14checkCudaStatePKcS0_i
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9cudaScalePdS_S_PiS0_S0_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/blueyi/dpdems/master/test/dpdems_cuda_test.hip"
	.size	.L.str, 109

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"---Property of currently device used---"
	.size	.L.str.1, 40

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

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"CUDA Capability: "
	.size	.L.str.4, 18

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"MultiProcessor count: "
	.size	.L.str.6, 23

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Total CUDA device number: "
	.size	.L.str.7, 27

	.type	_Z9cudaScalePdS_S_PiS0_S0_ii,@object # @_Z9cudaScalePdS_S_PiS0_S0_ii
	.section	.rodata,"a",@progbits
	.globl	_Z9cudaScalePdS_S_PiS0_S0_ii
	.p2align	3, 0x0
_Z9cudaScalePdS_S_PiS0_S0_ii:
	.quad	_Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii
	.size	_Z9cudaScalePdS_S_PiS0_S0_ii, 8

	.type	.L.str.8,@object                # @.str.8
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.8:
	.asciz	"cudaEvent1"
	.size	.L.str.8, 11

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"cudaEvent2"
	.size	.L.str.9, 11

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"cudaScale call"
	.size	.L.str.10, 15

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"CUDA elapsed: "
	.size	.L.str.11, 15

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

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

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Total time consumed: "
	.size	.L.str.14, 22

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	" seconds"
	.size	.L.str.15, 9

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"delete x"
	.size	.L.str.16, 9

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"delete y"
	.size	.L.str.17, 9

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"delete z"
	.size	.L.str.18, 9

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"delete grid"
	.size	.L.str.19, 12

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"CUDA CALL FAILED: "
	.size	.L.str.20, 19

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

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	" )- "
	.size	.L.str.22, 5

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

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	" Error--"
	.size	.L.str.24, 9

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9cudaScalePdS_S_PiS0_S0_ii"
	.size	.L__unnamed_1, 29

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z24__device_stub__cudaScalePdS_S_PiS0_S0_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z9cudaScalePdS_S_PiS0_S0_ii
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9cudaScalePdS_S_PiS0_S0_ii ; -- Begin function _Z9cudaScalePdS_S_PiS0_S0_ii
	.globl	_Z9cudaScalePdS_S_PiS0_S0_ii
	.p2align	8
	.type	_Z9cudaScalePdS_S_PiS0_S0_ii,@function
_Z9cudaScalePdS_S_PiS0_S0_ii:           ; @_Z9cudaScalePdS_S_PiS0_S0_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x44
	s_load_b64 s[2:3], s[0:1], 0x30
	s_add_u32 s16, s0, 56
	s_addc_u32 s17, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s22, s4, 0xffff
	s_mov_b32 s4, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s22, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s2, v1
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph
	s_load_b256 s[4:11], s[0:1], 0x0
	v_cvt_f64_i32_e32 v[3:4], s3
	s_ashr_i32 s19, s2, 31
	s_mov_b32 s18, s2
	s_load_b128 s[12:15], s[0:1], 0x20
	s_lshl_b64 s[0:1], s[18:19], 3
	s_load_b32 s3, s[16:17], 0x0
	s_waitcnt lgkmcnt(0)
	s_add_u32 s16, s4, s0
	s_addc_u32 s17, s5, s1
	s_add_u32 s18, s6, s0
	s_addc_u32 s19, s7, s1
	s_add_u32 s0, s8, s0
	s_addc_u32 s1, s9, s1
	s_load_b64 s[16:17], s[16:17], 0x0
	s_load_b64 s[18:19], s[18:19], 0x0
	s_load_b64 s[20:21], s[0:1], 0x0
	s_mul_i32 s1, s3, s22
	s_mov_b32 s3, 0
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[5:6], 3, v[1:2]
	v_add_co_u32 v7, vcc_lo, s4, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v6, vcc_lo
	v_add_co_u32 v9, vcc_lo, s6, v5
	v_add_co_ci_u32_e32 v10, vcc_lo, s7, v6, vcc_lo
	v_add_co_u32 v5, vcc_lo, s8, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v6, vcc_lo
	global_load_b64 v[7:8], v[7:8], off
	global_load_b64 v[9:10], v[9:10], off
	global_load_b64 v[5:6], v[5:6], off
	s_waitcnt vmcnt(2) lgkmcnt(0)
	v_fma_f64 v[7:8], v[7:8], s[16:17], v[3:4]
	s_waitcnt vmcnt(1)
	v_fma_f64 v[9:10], v[9:10], s[18:19], v[3:4]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[5:6], v[5:6], s[20:21], v[3:4]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_i32_f64_e32 v0, v[7:8]
	v_cvt_i32_f64_e32 v11, v[9:10]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_cvt_i32_f64_e32 v12, v[5:6]
	v_lshlrev_b64 v[5:6], 2, v[1:2]
	v_add_nc_u32_e32 v1, s1, v1
	v_cmp_le_i32_e32 vcc_lo, s2, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v7, s0, s10, v5
	v_add_co_ci_u32_e64 v8, s0, s11, v6, s0
	v_add_co_u32 v9, s0, s12, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v10, s0, s13, v6, s0
	v_add_co_u32 v5, s0, s14, v5
	v_add_co_ci_u32_e64 v6, s0, s15, v6, s0
	s_or_b32 s3, vcc_lo, s3
	global_store_b32 v[7:8], v0, off
	global_store_b32 v[9:10], v11, off
	global_store_b32 v[5:6], v12, off
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9cudaScalePdS_S_PiS0_S0_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.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 13
		.amdhsa_next_free_sgpr 23
		.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	_Z9cudaScalePdS_S_PiS0_S0_ii, .Lfunc_end0-_Z9cudaScalePdS_S_PiS0_S0_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 424
; NumSgprs: 25
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 25
; NumVGPRsForWavesPerEU: 13
; 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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     by_value
      - .offset:         52
        .size:           4
        .value_kind:     by_value
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9cudaScalePdS_S_PiS0_S0_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     25
    .sgpr_spill_count: 0
    .symbol:         _Z9cudaScalePdS_S_PiS0_S0_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
