#include <chrono>
#include <iostream>



//Kernel definition
template<typename T>
__global__
void copyKernel (T* out,
		T* in,
		const unsigned int N)
{
	const unsigned int id = threadIdx.x + blockIdx.x * blockDim.x;
	for (unsigned int i= id; i < N; i = i + blockDim.x * gridDim.x)
	{
		const unsigned el_id = i;
		((T*) out)[el_id] = ((T*) in)[el_id];
	
//		((T*) out)[(1<<29) + 100] = ((T*) in)[0];

	}
}

//template<typename T>
//__global__
//void initKernel (T* out)
//{
//	((T*) out)[threadIdx.x] = threadIdx.x;
//}


//Kernel definition
template<typename T>
__global__
void plusKernel (T* out,
		T* in,
		const unsigned int N)
{
	const unsigned int id = threadIdx.x + blockIdx.x * blockDim.x;
	for (unsigned int i= id; i < N; i = i + blockDim.x * gridDim.x)
	{
		const unsigned el_id = i;
		((T*) out)[el_id] += ((T*) in)[el_id];


	}
}


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

	std::cout<<"Arguments:";
	for (int i = 0; i <argc; i++)
	{
		std::cout<<argv[i];
	}	
	std::cout<<std::endl;
	if(
		argc != 4
	)
	{
		std::cout<<"Error: InvalidArguments" << std::endl;
	}
	
	
	using namespace std::chrono;

	unsigned int N = 1<<29; //N is the Number of elements in the Array
	double lastMeasurementTimeSpan = 100.0f;//we are not expecting measurements greater 100 s
	bool stopMeasurement = false;
	std::cout << "np.array("; //output the results so that they can be read easily by python
	bool usePlusKernel = false;
		
	std::cout << "(";
	for (int M = 1; M <= 4; M++)
	{			
		std::cout << "(";

		for(int i = 1; i <= 32; i++)
		{
	
			if(!stopMeasurement) 
			{
				unsigned int m = 32 * i; 
			//	int* carray;
				void* out;
				void* in;
				void* deviceArray;
				void* hostArray;
			//	malloc(carray);
					
				cudaError_t err1 = cudaSuccess;
				cudaError_t err2 = cudaSuccess;	  
				
				
				//standard allocation
				if(strcmp(argv[2],"-standard") == 0)
				{
					err1 = cudaMallocHost(&hostArray, N*4);
					err2 = cudaMalloc(&deviceArray, N*4);	  
				}
				
				//writeCombined
				if(strcmp(argv[2],"-writecombined") == 0)
				{
					err1 = cudaHostAlloc(&hostArray, N*4, cudaHostAllocWriteCombined);
					err2 = cudaMalloc(&deviceArray, N*4);	  
				}
	
				//unifiedMemorz
				if(strcmp(argv[2],"-unified") == 0)
				{
					err1 = cudaMallocManaged(&hostArray, N*4);
					err2 = cudaMallocManaged(&deviceArray, N*4);	  
				}

				if (err1 != cudaSuccess)
				{	
					std::cout << "Allocation ERROR: " << cudaGetErrorString(err1) << std::endl;
				}
		
				if (err2 != cudaSuccess)
				{	
					std::cout << "Allocation ERROR2: " << cudaGetErrorString(err2) << std::endl;
				}	

				
				if(strcmp(argv[1],"-h2d") == 0)
				{
					in = hostArray;
					out = deviceArray;	  
				}
				
				else
				{
					in = deviceArray;
					out = hostArray;
				
				}
		
		
				if(strcmp(argv[3],"-plus") == 0)
				{
					usePlusKernel = true;
				}
	
				if(strcmp(argv[3],"-copy") == 0)
				{
					usePlusKernel = false;
				}

				//std::cout << "in:" << in << "out:" << out << "hostArray:" << hostArray << "deviceArray:" << deviceArray;	
	

				//make a warmup 
			//	copyKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
			//	cudaDeviceSynchronize();

				double currentTimeSum = 0;
				
				for(int x = 1; x <= 5; x++)//run 10 times for better measurement accuracy
				{
				//	if(strcmp(argv[2],"-unified") == 0)
				//	{
						if(strcmp(argv[1],"-h2d") == 0)
						{
							cudaMemset(out, 4, N*4);
							cudaDeviceSynchronize();
							memset(in, 111, N*4);
							cudaDeviceSynchronize();	
						}
					
						if(strcmp(argv[1],"-d2h") == 0)
						{
							cudaMemset(in, 111, N*4);
							cudaDeviceSynchronize();
							memset(out, 4, N*4);
							cudaDeviceSynchronize();
						}
				//	}

					//Time Measururement Point 1
					high_resolution_clock::time_point timeBefore = high_resolution_clock::now();

					//run kernel here
					if (usePlusKernel)
					{
						plusKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
					}
					else
					{
						copyKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
					}

					cudaDeviceSynchronize();
				
					//Time Measurement Point 2
					high_resolution_clock::time_point timeAfter = high_resolution_clock::now();			
			
					auto lstErr = cudaGetLastError();
					if ( cudaSuccess != lstErr )
					{
						std::cout << lstErr  << ": " << cudaGetErrorString(lstErr)  << std::endl;
					}
						
					//Output Time Measurement Result
					duration<double> time_span = duration_cast<duration<double>>(timeAfter - timeBefore);
					currentTimeSum += time_span.count();

					cudaDeviceSynchronize();
				
				}
				
				if(false)
				{	
				//perform error checking
					void* checkAry = out;
					if(strcmp(argv[1],"-h2d") == 0)
					{
					//copy Out to In so we can read it on the host
				//	
						cudaMemcpy(in, out, N*4, cudaMemcpyDeviceToHost); 
						cudaDeviceSynchronize();
						checkAry = in;//as we copied to in, we need to check this now
						
					}

					char targetChar = 111;
					if(strcmp(argv[3],"-plus") == 0)
					{
						targetChar = 111 + 4;	
					}

					for (int pos = 0; pos < N*4; pos++)
					{

						if (static_cast<char*> (checkAry)[pos] != targetChar)
						{
							std::cout << "Copy Misstake at:" << pos <<"with:"<< static_cast<int>(static_cast<char*> (checkAry)[pos])
							<< "instead of:" <<static_cast<int>( targetChar) << std::endl;
						}
						
					}	
				}

				if(strcmp(argv[2],"-unified") == 0)
				{
					cudaFree(deviceArray);
					cudaFree(hostArray);
				
				}
				else
				{
					cudaFreeHost(hostArray);
					cudaFree(deviceArray);
				}
					
				//it seems we cant use automatic measurement stops
				if(false)// (lastMeasurementTimeSpan- time_span.count()  < 0.01 && i=1)
				{
					stopMeasurement = true;

				}
				else
				{
				//	lastMeasurementTimeSpan = time_span.count();
					std::cout << currentTimeSum;
				
				}

			}
		
			else
			{
				std::cout << 0.0;
			}

			if( i != 32) {std::cout << ",";} //output a , if we aren't the last element of the for loop	
		}
		
		std::cout << ")";

				
		if( M != 4) {std::cout << ",";} //output a , if we aren't the last element of the for loop	
	}
	
	std::cout << ")";
	
	std::cout << ")" << std::endl;


			
	return 0;
}



	.file	"tmpxft_00324945_00000000-6_pagelockedinon.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3744:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3744:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j, @function
_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j:
.LFB3768:
	.cfi_startproc
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z10copyKernelIiEvPT_S1_j(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L2:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3768:
	.size	_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j, .-_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4454:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4454:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.text._Z10copyKernelIiEvPT_S1_j,"axG",@progbits,_Z10copyKernelIiEvPT_S1_j,comdat
	.weak	_Z10copyKernelIiEvPT_S1_j
	.type	_Z10copyKernelIiEvPT_S1_j, @function
_Z10copyKernelIiEvPT_S1_j:
.LFB4102:
	.cfi_startproc
	endbr64
	jmp	_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j
	.cfi_endproc
.LFE4102:
	.size	_Z10copyKernelIiEvPT_S1_j, .-_Z10copyKernelIiEvPT_S1_j
	.text
	.type	_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j, @function
_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j:
.LFB3766:
	.cfi_startproc
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z10plusKernelIiEvPT_S1_j(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L9:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3766:
	.size	_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j, .-_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j
	.section	.text._Z10plusKernelIiEvPT_S1_j,"axG",@progbits,_Z10plusKernelIiEvPT_S1_j,comdat
	.weak	_Z10plusKernelIiEvPT_S1_j
	.type	_Z10plusKernelIiEvPT_S1_j, @function
_Z10plusKernelIiEvPT_S1_j:
.LFB4101:
	.cfi_startproc
	endbr64
	jmp	_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j
	.cfi_endproc
.LFE4101:
	.size	_Z10plusKernelIiEvPT_S1_j, .-_Z10plusKernelIiEvPT_S1_j
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"Arguments:"
.LC2:
	.string	"Error: InvalidArguments"
.LC3:
	.string	"np.array("
.LC4:
	.string	"("
.LC5:
	.string	"-standard"
.LC6:
	.string	"-writecombined"
.LC7:
	.string	"-unified"
.LC8:
	.string	"Allocation ERROR: "
.LC9:
	.string	"Allocation ERROR2: "
.LC10:
	.string	"-h2d"
.LC11:
	.string	"-plus"
.LC12:
	.string	"-copy"
.LC13:
	.string	"-d2h"
.LC14:
	.string	": "
.LC16:
	.string	")"
.LC17:
	.string	","
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3738:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	leaq	_ZSt4cout(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	leaq	.LC1(%rip), %rsi
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L15:
	cmpl	%r12d, %ebp
	jle	.L65
	movq	(%rbx,%r12,8), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	incq	%r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L15
.L65:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	cmpl	$4, %ebp
	je	.L17
	leaq	.LC2(%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.isra.0
.L17:
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	xorl	%r13d, %r13d
	movl	$1, %r15d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC4(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L40:
	leaq	.LC4(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movl	$32, %r14d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L39:
	movq	16(%rbx), %rdi
	leaq	.LC5(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L42
	leaq	56(%rsp), %rdi
	movl	$2147483648, %esi
	call	cudaMallocHost@PLT
	leaq	48(%rsp), %rdi
	movl	$2147483648, %esi
	movl	%eax, %r12d
	call	cudaMalloc@PLT
	movl	%eax, %ebp
	jmp	.L18
.L42:
	xorl	%ebp, %ebp
	xorl	%r12d, %r12d
.L18:
	movq	16(%rbx), %rdi
	leaq	.LC6(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L19
	leaq	56(%rsp), %rdi
	movl	$4, %edx
	movl	$2147483648, %esi
	call	cudaHostAlloc@PLT
	leaq	48(%rsp), %rdi
	movl	$2147483648, %esi
	movl	%eax, %r12d
	call	cudaMalloc@PLT
	movl	%eax, %ebp
.L19:
	movq	16(%rbx), %rdi
	leaq	.LC7(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L20
	leaq	56(%rsp), %rdi
	movl	$1, %edx
	movl	$2147483648, %esi
	call	cudaMallocManaged@PLT
	leaq	48(%rsp), %rdi
	movl	$1, %edx
	movl	$2147483648, %esi
	movl	%eax, %r12d
	call	cudaMallocManaged@PLT
	movl	%eax, %ebp
.L20:
	testl	%r12d, %r12d
	je	.L21
	leaq	.LC8(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %edi
	movq	%rax, 8(%rsp)
	call	cudaGetErrorString@PLT
	movq	8(%rsp), %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.isra.0
.L21:
	testl	%ebp, %ebp
	je	.L22
	leaq	.LC9(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %edi
	movq	%rax, %r12
	call	cudaGetErrorString@PLT
	movq	%r12, %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.isra.0
.L22:
	movq	8(%rbx), %rdi
	leaq	.LC10(%rip), %rsi
	call	strcmp@PLT
	movq	56(%rsp), %rcx
	movq	48(%rsp), %r12
	movq	%rcx, 8(%rsp)
	testl	%eax, %eax
	je	.L23
	movq	%r12, %rax
	movq	%rcx, %r12
	movq	%rax, 8(%rsp)
.L23:
	movq	24(%rbx), %rbp
	leaq	.LC11(%rip), %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	leaq	.LC12(%rip), %rsi
	movq	%rbp, %rdi
	testl	%eax, %eax
	movb	$1, %al
	cmove	%eax, %r13d
	call	strcmp@PLT
	movl	$5, 40(%rsp)
	movq	$0x000000000, 16(%rsp)
	testl	%eax, %eax
	movb	$0, %al
	cmove	%eax, %r13d
.L33:
	movq	8(%rbx), %rdi
	leaq	.LC10(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L26
	movl	$2147483648, %edx
	movl	$4, %esi
	movq	%r12, %rdi
	call	cudaMemset@PLT
	call	cudaDeviceSynchronize@PLT
	movq	8(%rsp), %rdi
	movl	$2147483648, %edx
	movl	$111, %esi
	call	memset@PLT
	call	cudaDeviceSynchronize@PLT
.L26:
	movq	8(%rbx), %rdi
	leaq	.LC13(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L27
	movq	8(%rsp), %rdi
	movl	$2147483648, %edx
	movl	$111, %esi
	call	cudaMemset@PLT
	call	cudaDeviceSynchronize@PLT
	movl	$2147483648, %edx
	movl	$4, %esi
	movq	%r12, %rdi
	call	memset@PLT
	call	cudaDeviceSynchronize@PLT
.L27:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	%r14d, 76(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, 32(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movl	84(%rsp), %ecx
	movq	%rax, 68(%rsp)
	movq	76(%rsp), %rdx
	movl	%r15d, 64(%rsp)
	movl	72(%rsp), %esi
	movq	64(%rsp), %rdi
	testb	%r13b, %r13b
	je	.L28
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	movq	8(%rsp), %rsi
	movl	$536870912, %edx
	movq	%r12, %rdi
	call	_ZL39__device_stub__Z10plusKernelIiEvPT_S1_jPiS_j
	jmp	.L30
.L28:
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	movq	8(%rsp), %rsi
	movl	$536870912, %edx
	movq	%r12, %rdi
	call	_ZL39__device_stub__Z10copyKernelIiEvPT_S1_jPiS_j
.L30:
	call	cudaDeviceSynchronize@PLT
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	%rax, %rbp
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L32
	movl	%eax, %esi
	leaq	_ZSt4cout(%rip), %rdi
	movl	%eax, 44(%rsp)
	call	_ZNSolsEi@PLT
	leaq	.LC14(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	44(%rsp), %edi
	movq	%rax, 24(%rsp)
	call	cudaGetErrorString@PLT
	movq	24(%rsp), %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.isra.0
.L32:
	movq	32(%rsp), %rax
	subq	%rax, %rbp
	cvtsi2sdq	%rbp, %xmm0
	divsd	.LC15(%rip), %xmm0
	addsd	16(%rsp), %xmm0
	movsd	%xmm0, 16(%rsp)
	call	cudaDeviceSynchronize@PLT
	decl	40(%rsp)
	jne	.L33
	movq	16(%rbx), %rdi
	leaq	.LC7(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L34
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	jmp	.L64
.L34:
	movq	56(%rsp), %rdi
	call	cudaFreeHost@PLT
	movq	48(%rsp), %rdi
.L64:
	call	cudaFree@PLT
	movsd	16(%rsp), %xmm0
	addl	$32, %r14d
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	cmpl	$1056, %r14d
	jne	.L36
	leaq	.LC16(%rip), %rbp
	leaq	_ZSt4cout(%rip), %rdi
	movq	%rbp, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cmpl	$4, %r15d
	jne	.L37
	jmp	.L66
.L36:
	leaq	.LC17(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L39
.L66:
	movq	%rbp, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %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.isra.0
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	call	__stack_chk_fail@PLT
.L37:
	leaq	.LC17(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	incl	%r15d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L40
.L41:
	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
.LFE3738:
	.size	main, .-main
	.section	.rodata.str1.1
.LC18:
	.string	"_Z10copyKernelIiEvPT_S1_j"
.LC19:
	.string	"_Z10plusKernelIiEvPT_S1_j"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3771:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC18(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10copyKernelIiEvPT_S1_j(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC19(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10plusKernelIiEvPT_S1_j(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3771:
	.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
.LC15:
	.long	0
	.long	1104006501
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <chrono>
#include <iostream>



//Kernel definition
template<typename T>
__global__
void copyKernel (T* out,
		T* in,
		const unsigned int N)
{
	const unsigned int id = threadIdx.x + blockIdx.x * blockDim.x;
	for (unsigned int i= id; i < N; i = i + blockDim.x * gridDim.x)
	{
		const unsigned el_id = i;
		((T*) out)[el_id] = ((T*) in)[el_id];
	
//		((T*) out)[(1<<29) + 100] = ((T*) in)[0];

	}
}

//template<typename T>
//__global__
//void initKernel (T* out)
//{
//	((T*) out)[threadIdx.x] = threadIdx.x;
//}


//Kernel definition
template<typename T>
__global__
void plusKernel (T* out,
		T* in,
		const unsigned int N)
{
	const unsigned int id = threadIdx.x + blockIdx.x * blockDim.x;
	for (unsigned int i= id; i < N; i = i + blockDim.x * gridDim.x)
	{
		const unsigned el_id = i;
		((T*) out)[el_id] += ((T*) in)[el_id];


	}
}


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

	std::cout<<"Arguments:";
	for (int i = 0; i <argc; i++)
	{
		std::cout<<argv[i];
	}	
	std::cout<<std::endl;
	if(
		argc != 4
	)
	{
		std::cout<<"Error: InvalidArguments" << std::endl;
	}
	
	
	using namespace std::chrono;

	unsigned int N = 1<<29; //N is the Number of elements in the Array
	double lastMeasurementTimeSpan = 100.0f;//we are not expecting measurements greater 100 s
	bool stopMeasurement = false;
	std::cout << "np.array("; //output the results so that they can be read easily by python
	bool usePlusKernel = false;
		
	std::cout << "(";
	for (int M = 1; M <= 4; M++)
	{			
		std::cout << "(";

		for(int i = 1; i <= 32; i++)
		{
	
			if(!stopMeasurement) 
			{
				unsigned int m = 32 * i; 
			//	int* carray;
				void* out;
				void* in;
				void* deviceArray;
				void* hostArray;
			//	malloc(carray);
					
				hipError_t err1 = hipSuccess;
				hipError_t err2 = hipSuccess;	  
				
				
				//standard allocation
				if(strcmp(argv[2],"-standard") == 0)
				{
					err1 = hipHostMalloc(&hostArray, N*4, hipHostMallocDefault);
					err2 = hipMalloc(&deviceArray, N*4);	  
				}
				
				//writeCombined
				if(strcmp(argv[2],"-writecombined") == 0)
				{
					err1 = hipHostAlloc(&hostArray, N*4, hipHostMallocWriteCombined);
					err2 = hipMalloc(&deviceArray, N*4);	  
				}
	
				//unifiedMemorz
				if(strcmp(argv[2],"-unified") == 0)
				{
					err1 = hipMallocManaged(&hostArray, N*4);
					err2 = hipMallocManaged(&deviceArray, N*4);	  
				}

				if (err1 != hipSuccess)
				{	
					std::cout << "Allocation ERROR: " << hipGetErrorString(err1) << std::endl;
				}
		
				if (err2 != hipSuccess)
				{	
					std::cout << "Allocation ERROR2: " << hipGetErrorString(err2) << std::endl;
				}	

				
				if(strcmp(argv[1],"-h2d") == 0)
				{
					in = hostArray;
					out = deviceArray;	  
				}
				
				else
				{
					in = deviceArray;
					out = hostArray;
				
				}
		
		
				if(strcmp(argv[3],"-plus") == 0)
				{
					usePlusKernel = true;
				}
	
				if(strcmp(argv[3],"-copy") == 0)
				{
					usePlusKernel = false;
				}

				//std::cout << "in:" << in << "out:" << out << "hostArray:" << hostArray << "deviceArray:" << deviceArray;	
	

				//make a warmup 
			//	copyKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
			//	cudaDeviceSynchronize();

				double currentTimeSum = 0;
				
				for(int x = 1; x <= 5; x++)//run 10 times for better measurement accuracy
				{
				//	if(strcmp(argv[2],"-unified") == 0)
				//	{
						if(strcmp(argv[1],"-h2d") == 0)
						{
							hipMemset(out, 4, N*4);
							hipDeviceSynchronize();
							memset(in, 111, N*4);
							hipDeviceSynchronize();	
						}
					
						if(strcmp(argv[1],"-d2h") == 0)
						{
							hipMemset(in, 111, N*4);
							hipDeviceSynchronize();
							memset(out, 4, N*4);
							hipDeviceSynchronize();
						}
				//	}

					//Time Measururement Point 1
					high_resolution_clock::time_point timeBefore = high_resolution_clock::now();

					//run kernel here
					if (usePlusKernel)
					{
						plusKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
					}
					else
					{
						copyKernel<<<M, m>>> (static_cast<int*> (out), static_cast<int*> (in), N);
					}

					hipDeviceSynchronize();
				
					//Time Measurement Point 2
					high_resolution_clock::time_point timeAfter = high_resolution_clock::now();			
			
					auto lstErr = hipGetLastError();
					if ( hipSuccess != lstErr )
					{
						std::cout << lstErr  << ": " << hipGetErrorString(lstErr)  << std::endl;
					}
						
					//Output Time Measurement Result
					duration<double> time_span = duration_cast<duration<double>>(timeAfter - timeBefore);
					currentTimeSum += time_span.count();

					hipDeviceSynchronize();
				
				}
				
				if(false)
				{	
				//perform error checking
					void* checkAry = out;
					if(strcmp(argv[1],"-h2d") == 0)
					{
					//copy Out to In so we can read it on the host
				//	
						hipMemcpy(in, out, N*4, hipMemcpyDeviceToHost); 
						hipDeviceSynchronize();
						checkAry = in;//as we copied to in, we need to check this now
						
					}

					char targetChar = 111;
					if(strcmp(argv[3],"-plus") == 0)
					{
						targetChar = 111 + 4;	
					}

					for (int pos = 0; pos < N*4; pos++)
					{

						if (static_cast<char*> (checkAry)[pos] != targetChar)
						{
							std::cout << "Copy Misstake at:" << pos <<"with:"<< static_cast<int>(static_cast<char*> (checkAry)[pos])
							<< "instead of:" <<static_cast<int>( targetChar) << std::endl;
						}
						
					}	
				}

				if(strcmp(argv[2],"-unified") == 0)
				{
					hipFree(deviceArray);
					hipFree(hostArray);
				
				}
				else
				{
					hipHostFree(hostArray);
					hipFree(deviceArray);
				}
					
				//it seems we cant use automatic measurement stops
				if(false)// (lastMeasurementTimeSpan- time_span.count()  < 0.01 && i=1)
				{
					stopMeasurement = true;

				}
				else
				{
				//	lastMeasurementTimeSpan = time_span.count();
					std::cout << currentTimeSum;
				
				}

			}
		
			else
			{
				std::cout << 0.0;
			}

			if( i != 32) {std::cout << ",";} //output a , if we aren't the last element of the for loop	
		}
		
		std::cout << ")";

				
		if( M != 4) {std::cout << ",";} //output a , if we aren't the last element of the for loop	
	}
	
	std::cout << ")";
	
	std::cout << ")" << std::endl;


			
	return 0;
}



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

                                        # End of file scope inline assembly
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI0_0:
	.quad	0x41cdcd6500000000              # double 1.0E+9
	.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	%rsi, 8(%rsp)                   # 8-byte Spill
	movl	%edi, %ebp
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	testl	%ebp, %ebp
	jle	.LBB0_6
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r15d
	xorl	%r12d, %r12d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	(%rax,%r12,8), %rbx
	testq	%rbx, %rbx
	je	.LBB0_3
# %bb.4:                                #   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_5
.LBB0_3:                                #   in Loop: Header=BB0_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB0_5:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB0_2
.LBB0_6:                                # %._crit_edge
	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
	cmpl	$4, %ebp
	je	.LBB0_8
# %bb.7:
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$23, %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
.LBB0_8:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$1, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorl	%eax, %eax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
.LBB0_9:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_10 Depth 2
                                        #       Child Loop BB0_29 Depth 3
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, 64(%rsp)                  # 8-byte Spill
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rbx
	movq	%rbx, 72(%rsp)                  # 8-byte Spill
	movl	$1, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
.LBB0_10:                               #   Parent Loop BB0_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_29 Depth 3
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	16(%rax), %rbx
	movl	$.L.str.4, %esi
	movq	%rbx, %rdi
	callq	strcmp
	xorl	%ebp, %ebp
	movl	$0, %r14d
	testl	%eax, %eax
	jne	.LBB0_12
# %bb.11:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	16(%rsp), %rdi
	xorl	%edx, %edx
	callq	hipHostMalloc
	movl	%eax, %r14d
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	24(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %ebp
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	16(%rax), %rbx
.LBB0_12:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$.L.str.5, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB0_14
# %bb.13:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	16(%rsp), %rdi
	movl	$4, %edx
	callq	hipHostAlloc
	movl	%eax, %r14d
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	24(%rsp), %rdi
	callq	hipMalloc
	movl	%eax, %ebp
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	16(%rax), %rbx
.LBB0_14:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$.L.str.6, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB0_16
# %bb.15:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	16(%rsp), %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	movl	%eax, %r14d
	movl	$2147483648, %esi               # imm = 0x80000000
	leaq	24(%rsp), %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	movl	%eax, %ebp
.LBB0_16:                               #   in Loop: Header=BB0_10 Depth=2
	testl	%r14d, %r14d
	je	.LBB0_23
# %bb.17:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r14d, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB0_18
# %bb.21:                               #   in Loop: Header=BB0_10 Depth=2
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_22
.LBB0_18:                               #   in Loop: Header=BB0_10 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB0_22:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit90
                                        #   in Loop: Header=BB0_10 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB0_23:                               #   in Loop: Header=BB0_10 Depth=2
	testl	%ebp, %ebp
	movq	32(%rsp), %r14                  # 8-byte Reload
	je	.LBB0_28
# %bb.24:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB0_25
# %bb.26:                               #   in Loop: Header=BB0_10 Depth=2
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_27
.LBB0_25:                               #   in Loop: Header=BB0_10 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB0_27:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit92
                                        #   in Loop: Header=BB0_10 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB0_28:                               #   in Loop: Header=BB0_10 Depth=2
	movq	%r14, %r15
	shlq	$5, %r15
	movq	8(%rsp), %rbx                   # 8-byte Reload
	movq	8(%rbx), %rdi
	movl	$.L.str.9, %esi
	callq	strcmp
	testl	%eax, %eax
	movq	24(%rsp), %rbp
	movq	16(%rsp), %rax
	movq	%rax, %rcx
	cmoveq	%rbp, %rcx
	movq	%rcx, 40(%rsp)                  # 8-byte Spill
	cmoveq	%rax, %rbp
	movq	24(%rbx), %rbx
	movl	$.L.str.10, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	movq	48(%rsp), %r14                  # 8-byte Reload
	movzbl	%r14b, %r14d
	movl	$1, %eax
	cmovel	%eax, %r14d
	movl	$.L.str.11, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	cmovel	%eax, %r14d
	movq	%r14, 48(%rsp)                  # 8-byte Spill
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %r15
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	movl	$5, %r14d
.LBB0_29:                               #   Parent Loop BB0_9 Depth=1
                                        #     Parent Loop BB0_10 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	8(%rax), %rbx
	movl	$.L.str.9, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB0_31
# %bb.30:                               #   in Loop: Header=BB0_29 Depth=3
	movl	$2147483648, %edx               # imm = 0x80000000
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movl	$4, %esi
	callq	hipMemset
	callq	hipDeviceSynchronize
	movl	$2147483648, %edx               # imm = 0x80000000
	movq	%rbp, %rdi
	movl	$111, %esi
	callq	memset@PLT
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	8(%rax), %rbx
.LBB0_31:                               #   in Loop: Header=BB0_29 Depth=3
	movl	$.L.str.12, %esi
	movq	%rbx, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB0_33
# %bb.32:                               #   in Loop: Header=BB0_29 Depth=3
	movl	$2147483648, %edx               # imm = 0x80000000
	movq	%rbp, %rdi
	movl	$111, %esi
	callq	hipMemset
	callq	hipDeviceSynchronize
	movl	$2147483648, %edx               # imm = 0x80000000
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movl	$4, %esi
	callq	memset@PLT
	callq	hipDeviceSynchronize
.LBB0_33:                               #   in Loop: Header=BB0_29 Depth=3
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r15
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	80(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testb	$1, 48(%rsp)                    # 1-byte Folded Reload
	jne	.LBB0_34
# %bb.36:                               #   in Loop: Header=BB0_29 Depth=3
	testl	%eax, %eax
	jne	.LBB0_38
# %bb.37:                               #   in Loop: Header=BB0_29 Depth=3
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movq	%rbp, %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	callq	_Z25__device_stub__copyKernelIiEvPT_S1_j
	jmp	.LBB0_38
.LBB0_34:                               #   in Loop: Header=BB0_29 Depth=3
	testl	%eax, %eax
	jne	.LBB0_38
# %bb.35:                               #   in Loop: Header=BB0_29 Depth=3
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movq	%rbp, %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	callq	_Z25__device_stub__plusKernelIiEvPT_S1_j
.LBB0_38:                               #   in Loop: Header=BB0_29 Depth=3
	callq	hipDeviceSynchronize
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r12
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB0_43
# %bb.39:                               #   in Loop: Header=BB0_29 Depth=3
	movl	%eax, %r13d
	movl	$_ZSt4cout, %edi
	movl	%eax, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.13, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r13d, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB0_40
# %bb.41:                               #   in Loop: Header=BB0_29 Depth=3
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	strlen
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_42
.LBB0_40:                               #   in Loop: Header=BB0_29 Depth=3
	movq	(%rbx), %rax
	movq	-24(%rax), %rax
	movq	%rbx, %rdi
	addq	%rax, %rdi
	movl	32(%rbx,%rax), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB0_42:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit94
                                        #   in Loop: Header=BB0_29 Depth=3
	movq	(%rbx), %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
.LBB0_43:                               #   in Loop: Header=BB0_29 Depth=3
	subq	%r15, %r12
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r12, %xmm0
	divsd	.LCPI0_0(%rip), %xmm0
	movsd	56(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 56(%rsp)                 # 8-byte Spill
	callq	hipDeviceSynchronize
	decl	%r14d
	jne	.LBB0_29
# %bb.44:                               #   in Loop: Header=BB0_10 Depth=2
	movq	8(%rsp), %rax                   # 8-byte Reload
	movq	16(%rax), %rdi
	movl	$.L.str.6, %esi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB0_45
# %bb.46:                               #   in Loop: Header=BB0_10 Depth=2
	movq	16(%rsp), %rdi
	callq	hipHostFree
	leaq	24(%rsp), %rax
	jmp	.LBB0_47
.LBB0_45:                               #   in Loop: Header=BB0_10 Depth=2
	movq	24(%rsp), %rdi
	callq	hipFree
	leaq	16(%rsp), %rax
.LBB0_47:                               #   in Loop: Header=BB0_10 Depth=2
	movq	32(%rsp), %rbx                  # 8-byte Reload
	movq	(%rax), %rdi
	callq	hipFree
	movl	$_ZSt4cout, %edi
	movsd	56(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$_ZSt4cout, %edi
	cmpq	$32, %rbx
	je	.LBB0_19
# %bb.48:                               #   in Loop: Header=BB0_10 Depth=2
	movl	$.L.str.14, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%rbx
	movq	%rbx, 32(%rsp)                  # 8-byte Spill
	jmp	.LBB0_10
.LBB0_19:                               #   in Loop: Header=BB0_9 Depth=1
	movl	$.L.str.15, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	64(%rsp), %rbx                  # 8-byte Reload
	cmpq	$4, %rbx
	je	.LBB0_20
# %bb.49:                               #   in Loop: Header=BB0_9 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%rbx
	jmp	.LBB0_9
.LBB0_20:
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.15, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.15, %esi
	movl	$1, %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	%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
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.section	.text._Z25__device_stub__plusKernelIiEvPT_S1_j,"axG",@progbits,_Z25__device_stub__plusKernelIiEvPT_S1_j,comdat
	.weak	_Z25__device_stub__plusKernelIiEvPT_S1_j # -- Begin function _Z25__device_stub__plusKernelIiEvPT_S1_j
	.type	_Z25__device_stub__plusKernelIiEvPT_S1_j,@function
_Z25__device_stub__plusKernelIiEvPT_S1_j: # @_Z25__device_stub__plusKernelIiEvPT_S1_j
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10plusKernelIiEvPT_S1_j, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z25__device_stub__plusKernelIiEvPT_S1_j, .Lfunc_end1-_Z25__device_stub__plusKernelIiEvPT_S1_j
	.cfi_endproc
                                        # -- End function
	.section	.text._Z25__device_stub__copyKernelIiEvPT_S1_j,"axG",@progbits,_Z25__device_stub__copyKernelIiEvPT_S1_j,comdat
	.weak	_Z25__device_stub__copyKernelIiEvPT_S1_j # -- Begin function _Z25__device_stub__copyKernelIiEvPT_S1_j
	.type	_Z25__device_stub__copyKernelIiEvPT_S1_j,@function
_Z25__device_stub__copyKernelIiEvPT_S1_j: # @_Z25__device_stub__copyKernelIiEvPT_S1_j
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10copyKernelIiEvPT_S1_j, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z25__device_stub__copyKernelIiEvPT_S1_j, .Lfunc_end2-_Z25__device_stub__copyKernelIiEvPT_S1_j
	.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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10plusKernelIiEvPT_S1_j, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10copyKernelIiEvPT_S1_j, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__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	.LBB4_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
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Arguments:"
	.size	.L.str, 11

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error: InvalidArguments"
	.size	.L.str.1, 24

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"np.array("
	.size	.L.str.2, 10

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"-writecombined"
	.size	.L.str.5, 15

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"-unified"
	.size	.L.str.6, 9

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Allocation ERROR: "
	.size	.L.str.7, 19

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Allocation ERROR2: "
	.size	.L.str.8, 20

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"-h2d"
	.size	.L.str.9, 5

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"-plus"
	.size	.L.str.10, 6

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"-copy"
	.size	.L.str.11, 6

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"-d2h"
	.size	.L.str.12, 5

	.type	_Z10plusKernelIiEvPT_S1_j,@object # @_Z10plusKernelIiEvPT_S1_j
	.section	.rodata._Z10plusKernelIiEvPT_S1_j,"aG",@progbits,_Z10plusKernelIiEvPT_S1_j,comdat
	.weak	_Z10plusKernelIiEvPT_S1_j
	.p2align	3, 0x0
_Z10plusKernelIiEvPT_S1_j:
	.quad	_Z25__device_stub__plusKernelIiEvPT_S1_j
	.size	_Z10plusKernelIiEvPT_S1_j, 8

	.type	_Z10copyKernelIiEvPT_S1_j,@object # @_Z10copyKernelIiEvPT_S1_j
	.section	.rodata._Z10copyKernelIiEvPT_S1_j,"aG",@progbits,_Z10copyKernelIiEvPT_S1_j,comdat
	.weak	_Z10copyKernelIiEvPT_S1_j
	.p2align	3, 0x0
_Z10copyKernelIiEvPT_S1_j:
	.quad	_Z25__device_stub__copyKernelIiEvPT_S1_j
	.size	_Z10copyKernelIiEvPT_S1_j, 8

	.type	.L.str.13,@object               # @.str.13
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.13:
	.asciz	": "
	.size	.L.str.13, 3

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

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10plusKernelIiEvPT_S1_j"
	.size	.L__unnamed_1, 26

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z10copyKernelIiEvPT_S1_j"
	.size	.L__unnamed_2, 26

	.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 _Z25__device_stub__plusKernelIiEvPT_S1_j
	.addrsig_sym _Z25__device_stub__copyKernelIiEvPT_S1_j
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z10plusKernelIiEvPT_S1_j
	.addrsig_sym _Z10copyKernelIiEvPT_S1_j
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.section	.text._Z10plusKernelIiEvPT_S1_j,"axG",@progbits,_Z10plusKernelIiEvPT_S1_j,comdat
	.protected	_Z10plusKernelIiEvPT_S1_j ; -- Begin function _Z10plusKernelIiEvPT_S1_j
	.globl	_Z10plusKernelIiEvPT_S1_j
	.p2align	8
	.type	_Z10plusKernelIiEvPT_S1_j,@function
_Z10plusKernelIiEvPT_S1_j:              ; @_Z10plusKernelIiEvPT_S1_j
; %bb.0:
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x24
	s_load_b32 s4, s[0:1], 0x10
	s_add_u32 s2, s0, 24
	s_addc_u32 s3, s1, 0
	s_mov_b32 s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s5, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s5, v[0:1]
	v_cmpx_gt_u32_e64 s4, v1
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph
	s_load_b32 s6, s[2:3], 0x0
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s5, s6, s5
	s_mov_b32 s6, 0
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	v_add_nc_u32_e32 v1, s5, v1
	v_add_co_u32 v5, vcc_lo, s2, v3
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v4, vcc_lo
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s4, v1
	global_load_b32 v0, v[5:6], off
	global_load_b32 v5, v[3:4], off
	s_or_b32 s6, vcc_lo, s6
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v5, v0
	global_store_b32 v[3:4], v0, off
	s_and_not1_b32 exec_lo, exec_lo, s6
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %Flow18
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10plusKernelIiEvPT_S1_j
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 7
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.section	.text._Z10plusKernelIiEvPT_S1_j,"axG",@progbits,_Z10plusKernelIiEvPT_S1_j,comdat
.Lfunc_end0:
	.size	_Z10plusKernelIiEvPT_S1_j, .Lfunc_end0-_Z10plusKernelIiEvPT_S1_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 204
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; 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
	.section	.text._Z10copyKernelIiEvPT_S1_j,"axG",@progbits,_Z10copyKernelIiEvPT_S1_j,comdat
	.protected	_Z10copyKernelIiEvPT_S1_j ; -- Begin function _Z10copyKernelIiEvPT_S1_j
	.globl	_Z10copyKernelIiEvPT_S1_j
	.p2align	8
	.type	_Z10copyKernelIiEvPT_S1_j,@function
_Z10copyKernelIiEvPT_S1_j:              ; @_Z10copyKernelIiEvPT_S1_j
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b32 s8, s[0:1], 0x10
	s_add_u32 s2, s0, 24
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s9, s4, 0xffff
	s_mov_b32 s4, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s8, v1
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.lr.ph
	s_load_b32 s2, s[2:3], 0x0
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s2, s9
	s_mov_b32 s2, 0
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	v_add_nc_u32_e32 v1, s1, v1
	v_add_co_u32 v5, vcc_lo, s6, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v4, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s8, v1
	v_add_co_u32 v3, s0, s4, v3
	global_load_b32 v0, v[5:6], off
	v_add_co_ci_u32_e64 v4, s0, s5, v4, s0
	s_or_b32 s2, vcc_lo, s2
	s_waitcnt vmcnt(0)
	global_store_b32 v[3:4], v0, off
	s_and_not1_b32 exec_lo, exec_lo, s2
	s_cbranch_execnz .LBB1_2
.LBB1_3:                                ; %Flow18
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10copyKernelIiEvPT_S1_j
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 7
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.section	.text._Z10copyKernelIiEvPT_S1_j,"axG",@progbits,_Z10copyKernelIiEvPT_S1_j,comdat
.Lfunc_end1:
	.size	_Z10copyKernelIiEvPT_S1_j, .Lfunc_end1-_Z10copyKernelIiEvPT_S1_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 196
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10plusKernelIiEvPT_S1_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10plusKernelIiEvPT_S1_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10copyKernelIiEvPT_S1_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10copyKernelIiEvPT_S1_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
