#include <stdio.h>
#include <stdint.h>

const int MILLION = 1000000; //define the constant million
const int thread_per_block = 1000;

#define time_record_begin(start){ \
	cudaEventCreate(&start);	  \
	cudaEventRecord(start, 0);	  \
}
#define time_record_end(start, stop, time){ \
	cudaEventCreate(&stop);		\
	cudaEventRecord(stop, 0);	\
	cudaEventSynchronize(stop);	\
	cudaEventElapsedTime(&time, start, stop);\
}

__global__	void arradd(float *A, float target, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void darradd(double *A, double target, int numElements){
	int idx= blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void iarradd(int32_t *A, int32_t target, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void xarradd(float *A, float target, int times, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		for(int j = 0; j < times; j++){
			A[idx] = A[idx] + target;
		}
	}
}

/***  Time measure for single precision floating-point numbers  ***/
void measure_float(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	float *A;
	float X = 10.0f;
	float *d_A;

	cudaEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outA.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <=256; j *= 2){
		//Malloc for the input array A on CPU
		int size = j * MILLION;
		A = (float *) malloc(size * sizeof(float));

		//Initialize the array
		for(int i = 0; i < size; i++){
			A[i] = (float)i / 3.0f;
		}

		//Malloc array on GPU
		cudaMalloc((void**)&d_A, size * sizeof(float));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		cudaMemcpy(d_A, A, size * sizeof(float), cudaMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		arradd<<<gridDim, blockDim>>>(d_A, X, size);
		cudaDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		cudaMemcpy(A, d_A, size * sizeof(float), cudaMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		//free memory on GPU and CPU
		cudaFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for double precision floating-point numbers  ***/
void measure_double(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	double *A;
	double X = 10.0;
	double *d_A;

	cudaEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outB.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		int size = j * MILLION;
		A = (double *) malloc(size * sizeof(double));

		for(int i = 0; i < size; i++){
			A[i] = (double)i / 3.0f;
		}

		cudaMalloc((void**)&d_A, size * sizeof(double));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		cudaMemcpy(d_A, A, size * sizeof(double), cudaMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		darradd<<<gridDim, blockDim>>>(d_A, X, size);
		cudaDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		cudaMemcpy(A, d_A, size * sizeof(double), cudaMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		cudaFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for 32-bit integers  ***/
void measure_int32(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	int32_t *A;
	int32_t X = 10;
	int32_t *d_A;

	cudaEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outC.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		int size = j * MILLION;
		A = (int32_t *) malloc(size * sizeof(int32_t));

		for(int i = 0; i < size; i++){
			A[i] = (int32_t)(i / 3);
		}

		cudaMalloc((void**)&d_A, size * sizeof(int32_t));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		cudaMemcpy(d_A, A, size * sizeof(int32_t), cudaMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		iarradd<<<gridDim, blockDim>>>(d_A, X, size);
		cudaDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		cudaMemcpy(A, d_A, size * sizeof(int32_t), cudaMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		cudaFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for diffrent adding times  ***/
void measure_xaddtimes(){
	printf("XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	float *A;
	float X = 10.0;
	float *d_A;

	cudaEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	int size = 128 * MILLION;
	//Initialize the size of grid and block
	dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
	dim3 blockDim(thread_per_block);

	FILE* fp;
	fp = fopen("outD.txt", "w+");
	fprintf(fp,"XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		A = (float *) malloc(size * sizeof(float));
		for(int i = 0; i < size; i++){
			A[i] = (float) i / 3.0f;
		}

		cudaMalloc((void**)&d_A, size * sizeof(float));
		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		cudaMemcpy(d_A, A, size * sizeof(float), cudaMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		xarradd<<<gridDim, blockDim>>>(d_A, X, j, size);
		cudaDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		cudaMemcpy(A, d_A, size * sizeof(float), cudaMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t .\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t .\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		cudaFree(d_A);
		free(A);
	}
	fclose(fp);
}

int main(int argc, char ** argv){
	printf("Part A\n");
	measure_float();

	printf("Part B\n");
	measure_double();

	printf("Part C\n");
	measure_int32();

	printf("Part D\n");
	measure_xaddtimes();

	printf("Done.\n");
}


	.file	"tmpxft_00279d09_00000000-6_hw1.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z27__device_stub__Z6arraddPffiPffi
	.type	_Z27__device_stub__Z6arraddPffiPffi, @function
_Z27__device_stub__Z6arraddPffiPffi:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	movl	%esi, (%rsp)
	leaq	32(%rsp), %rdi
	leaq	44(%rsp), %rsi
	movss	%xmm0, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z6arraddPffi(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L2:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z27__device_stub__Z6arraddPffiPffi, .-_Z27__device_stub__Z6arraddPffiPffi
	.globl	_Z6arraddPffi
	.type	_Z6arraddPffi, @function
_Z6arraddPffi:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z6arraddPffiPffi
	.cfi_endproc
.LFE2057:
	.size	_Z6arraddPffi, .-_Z6arraddPffi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n"
.LC1:
	.string	"w+"
.LC2:
	.string	"outA.txt"
.LC5:
	.string	"%d\t\t %f\t %f\t %f\n"
	.text
	.globl	_Z13measure_floatv
	.type	_Z13measure_floatv, @function
_Z13measure_floatv:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$9, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rsi
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC1(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	call	fopen@PLT
	movq	%rbx, %rdx
	movl	$2, %esi
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L12:
	imull	$1000000, %ebp, %r12d
	movslq	%r12d, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.L9:
	cmpl	%eax, %r12d
	jle	.L16
	cvtsi2ssl	%eax, %xmm0
	divss	.LC3(%rip), %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	jmp	.L9
.L16:
	movq	(%rsp), %rsi
	leaq	40(%rsp), %rdi
	leaq	48(%rsp), %r15
	leaq	56(%rsp), %r14
	call	cudaMalloc@PLT
	leal	999(%r12), %eax
	movq	%r15, %rdi
	movl	$1000, %ecx
	cltd
	movl	$1, 84(%rsp)
	idivl	%ecx
	movl	%eax, 64(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 68(%rsp)
	addq	$999, %rax
	movq	%rax, 76(%rsp)
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdx
	movq	40(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	28(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	84(%rsp), %ecx
	movl	72(%rsp), %esi
	xorl	%r9d, %r9d
	movq	76(%rsp), %rdx
	movq	64(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L11
	movss	.LC4(%rip), %xmm0
	movq	40(%rsp), %rdi
	movl	%r12d, %esi
	call	_Z27__device_stub__Z6arraddPffiPffi
.L11:
	call	cudaDeviceSynchronize@PLT
	movq	%r14, %rdi
	leaq	.LC5(%rip), %r12
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	32(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	36(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	8(%rsp), %rdi
	movl	%ebp, %ecx
	movq	%r12, %rdx
	movl	$2, %esi
	movb	$3, %al
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	36(%rsp), %xmm2
	cvtss2sd	32(%rsp), %xmm1
	call	__fprintf_chk@PLT
	movl	%ebp, %edx
	movq	%r12, %rsi
	movl	$2, %edi
	movb	$3, %al
	addl	%ebp, %ebp
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	36(%rsp), %xmm2
	cvtss2sd	32(%rsp), %xmm1
	call	__printf_chk@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	decl	%r13d
	jne	.L12
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z13measure_floatv, .-_Z13measure_floatv
	.globl	_Z28__device_stub__Z7darraddPddiPddi
	.type	_Z28__device_stub__Z7darraddPddiPddi, @function
_Z28__device_stub__Z7darraddPddiPddi:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	32(%rsp), %rdx
	movl	%esi, 12(%rsp)
	leaq	48(%rsp), %rdi
	leaq	60(%rsp), %rsi
	movsd	%xmm0, 16(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L17
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7darraddPddi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L17:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z28__device_stub__Z7darraddPddiPddi, .-_Z28__device_stub__Z7darraddPddiPddi
	.globl	_Z7darraddPddi
	.type	_Z7darraddPddi, @function
_Z7darraddPddi:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z28__device_stub__Z7darraddPddiPddi
	.cfi_endproc
.LFE2059:
	.size	_Z7darraddPddi, .-_Z7darraddPddi
	.section	.rodata.str1.1
.LC6:
	.string	"outB.txt"
.LC9:
	.string	"%d\t\t %f\t %f\t %f\t\n"
	.text
	.globl	_Z14measure_doublev
	.type	_Z14measure_doublev, @function
_Z14measure_doublev:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$9, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rsi
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC1(%rip), %rsi
	leaq	.LC6(%rip), %rdi
	call	fopen@PLT
	movq	%rbx, %rdx
	movl	$2, %esi
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L26:
	imull	$1000000, %ebp, %r12d
	movslq	%r12d, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.L23:
	cmpl	%eax, %r12d
	jle	.L30
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC7(%rip), %xmm0
	movsd	%xmm0, (%rbx,%rax,8)
	incq	%rax
	jmp	.L23
.L30:
	movq	(%rsp), %rsi
	leaq	40(%rsp), %rdi
	leaq	48(%rsp), %r15
	leaq	56(%rsp), %r14
	call	cudaMalloc@PLT
	leal	999(%r12), %eax
	movq	%r15, %rdi
	movl	$1000, %ecx
	cltd
	movl	$1, 84(%rsp)
	idivl	%ecx
	movl	%eax, 64(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 68(%rsp)
	addq	$999, %rax
	movq	%rax, 76(%rsp)
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdx
	movq	40(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	28(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	84(%rsp), %ecx
	movl	72(%rsp), %esi
	xorl	%r9d, %r9d
	movq	76(%rsp), %rdx
	movq	64(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L25
	movsd	.LC8(%rip), %xmm0
	movq	40(%rsp), %rdi
	movl	%r12d, %esi
	call	_Z28__device_stub__Z7darraddPddiPddi
.L25:
	call	cudaDeviceSynchronize@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	32(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	36(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	8(%rsp), %rdi
	movl	%ebp, %ecx
	movb	$3, %al
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	36(%rsp), %xmm2
	cvtss2sd	32(%rsp), %xmm1
	call	__fprintf_chk@PLT
	movl	%ebp, %edx
	movb	$3, %al
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	addl	%ebp, %ebp
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	36(%rsp), %xmm2
	cvtss2sd	32(%rsp), %xmm1
	call	__printf_chk@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	decl	%r13d
	jne	.L26
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z14measure_doublev, .-_Z14measure_doublev
	.globl	_Z28__device_stub__Z7iarraddPiiiPiii
	.type	_Z28__device_stub__Z7iarraddPiiiPiii, @function
_Z28__device_stub__Z7iarraddPiiiPiii:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movl	%edx, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z7iarraddPiii(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L31:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z28__device_stub__Z7iarraddPiiiPiii, .-_Z28__device_stub__Z7iarraddPiiiPiii
	.globl	_Z7iarraddPiii
	.type	_Z7iarraddPiii, @function
_Z7iarraddPiii:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z28__device_stub__Z7iarraddPiiiPiii
	.cfi_endproc
.LFE2061:
	.size	_Z7iarraddPiii, .-_Z7iarraddPiii
	.section	.rodata.str1.1
.LC10:
	.string	"outC.txt"
	.text
	.globl	_Z13measure_int32v
	.type	_Z13measure_int32v, @function
_Z13measure_int32v:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %edi
	movabsq	$4294967297, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$9, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rsi
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC1(%rip), %rsi
	leaq	.LC10(%rip), %rdi
	call	fopen@PLT
	movq	%rbx, %rdx
	movl	$2, %esi
	movq	%rax, 16(%rsp)
	movq	%rax, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L40:
	imull	$1000000, %ebp, %r12d
	movslq	%r12d, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	xorl	%ecx, %ecx
	movl	$3, %esi
	movq	%rax, %rbx
.L37:
	movl	%ecx, %eax
	cmpl	%ecx, %r12d
	jle	.L44
	cltd
	idivl	%esi
	movl	%eax, (%rbx,%rcx,4)
	incq	%rcx
	jmp	.L37
.L44:
	movq	8(%rsp), %rsi
	leaq	56(%rsp), %rdi
	leaq	64(%rsp), %r14
	call	cudaMalloc@PLT
	leal	999(%r12), %eax
	movl	$1000, %ecx
	movq	%r14, %rdi
	cltd
	movq	%r15, 84(%rsp)
	idivl	%ecx
	movl	$1, 100(%rsp)
	movl	%eax, 80(%rsp)
	movl	$536871037, %eax
	salq	$3, %rax
	movq	%rax, 92(%rsp)
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	leaq	72(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	cudaEventCreate@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	44(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	100(%rsp), %ecx
	movl	88(%rsp), %esi
	xorl	%r9d, %r9d
	movq	92(%rsp), %rdx
	movq	80(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	56(%rsp), %rdi
	movl	%r12d, %edx
	movl	$10, %esi
	call	_Z28__device_stub__Z7iarraddPiiiPiii
.L39:
	call	cudaDeviceSynchronize@PLT
	movq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	48(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	52(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	16(%rsp), %rdi
	movl	%ebp, %ecx
	movb	$3, %al
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	cvtss2sd	44(%rsp), %xmm0
	cvtss2sd	52(%rsp), %xmm2
	cvtss2sd	48(%rsp), %xmm1
	call	__fprintf_chk@PLT
	movl	%ebp, %edx
	movb	$3, %al
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	addl	%ebp, %ebp
	cvtss2sd	44(%rsp), %xmm0
	cvtss2sd	52(%rsp), %xmm2
	cvtss2sd	48(%rsp), %xmm1
	call	__printf_chk@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	decl	%r13d
	jne	.L40
	movq	16(%rsp), %rdi
	call	fclose@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z13measure_int32v, .-_Z13measure_int32v
	.globl	_Z29__device_stub__Z7xarraddPffiiPffii
	.type	_Z29__device_stub__Z7xarraddPffiiPffii, @function
_Z29__device_stub__Z7xarraddPffiiPffii:
.LFB2062:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rcx
	leaq	56(%rsp), %rdi
	movl	%esi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movss	%xmm0, 20(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z7xarraddPffii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L45:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2062:
	.size	_Z29__device_stub__Z7xarraddPffiiPffii, .-_Z29__device_stub__Z7xarraddPffiiPffii
	.globl	_Z7xarraddPffii
	.type	_Z7xarraddPffii, @function
_Z7xarraddPffii:
.LFB2063:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7xarraddPffiiPffii
	.cfi_endproc
.LFE2063:
	.size	_Z7xarraddPffii, .-_Z7xarraddPffii
	.section	.rodata.str1.1
.LC11:
	.string	"XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n"
.LC12:
	.string	"outD.txt"
.LC13:
	.string	"%d\t\t .\t\t %f\t %f\t %f\t\n"
	.text
	.globl	_Z17measure_xaddtimesv
	.type	_Z17measure_xaddtimesv, @function
_Z17measure_xaddtimesv:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$9, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	$1, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC11(%rip), %rbx
	movq	%rbx, %rsi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$4194429, %eax
	leaq	.LC1(%rip), %rsi
	leaq	.LC12(%rip), %rdi
	salq	$10, %rax
	movl	$1, 56(%rsp)
	movq	%rax, 48(%rsp)
	subq	$127000, %rax
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	fopen@PLT
	movq	%rbx, %rdx
	movl	$2, %esi
	movq	%rax, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L53:
	movl	$512000000, %edi
	call	malloc@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.L51:
	cvtsi2ssl	%eax, %xmm0
	divss	.LC3(%rip), %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$128000000, %rax
	jne	.L51
	movl	$512000000, %esi
	leaq	24(%rsp), %rdi
	leaq	32(%rsp), %r15
	call	cudaMalloc@PLT
	movq	%r15, %rdi
	leaq	40(%rsp), %r14
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$512000000, %edx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	68(%rsp), %ecx
	movl	56(%rsp), %esi
	xorl	%r9d, %r9d
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L52
	movss	.LC4(%rip), %xmm0
	movq	24(%rsp), %rdi
	movl	$128000000, %edx
	movl	%r12d, %esi
	call	_Z29__device_stub__Z7xarraddPffiiPffii
.L52:
	call	cudaDeviceSynchronize@PLT
	movq	%r14, %rdi
	call	cudaEventCreate@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%r15, %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$512000000, %edx
	call	cudaMemcpy@PLT
	movq	%r14, %rdi
	leaq	.LC13(%rip), %r14
	call	cudaEventCreate@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	%r12d, %ecx
	movq	%r14, %rdx
	movl	$2, %esi
	movq	%rbp, %rdi
	movb	$3, %al
	cvtss2sd	12(%rsp), %xmm0
	cvtss2sd	20(%rsp), %xmm2
	cvtss2sd	16(%rsp), %xmm1
	call	__fprintf_chk@PLT
	movl	%r12d, %edx
	movq	%r14, %rsi
	movl	$2, %edi
	movb	$3, %al
	addl	%r12d, %r12d
	cvtss2sd	12(%rsp), %xmm0
	cvtss2sd	20(%rsp), %xmm2
	cvtss2sd	16(%rsp), %xmm1
	call	__printf_chk@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	decl	%r13d
	jne	.L53
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L54
	call	__stack_chk_fail@PLT
.L54:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z17measure_xaddtimesv, .-_Z17measure_xaddtimesv
	.section	.rodata.str1.1
.LC14:
	.string	"Part A\n"
.LC15:
	.string	"Part B\n"
.LC16:
	.string	"Part C\n"
.LC17:
	.string	"Part D\n"
.LC18:
	.string	"Done.\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z13measure_floatv
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z14measure_doublev
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z13measure_int32v
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z17measure_xaddtimesv
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC19:
	.string	"_Z7xarraddPffii"
.LC20:
	.string	"_Z7iarraddPiii"
.LC21:
	.string	"_Z7darraddPddi"
.LC22:
	.string	"_Z6arraddPffi"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2065:
	.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	.LC19(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z7xarraddPffii(%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	.LC20(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7iarraddPiii(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC21(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7darraddPddi(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6arraddPffi(%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
.LFE2065:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC3:
	.long	1077936128
	.align 4
.LC4:
	.long	1092616192
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	0
	.long	1074266112
	.align 8
.LC8:
	.long	0
	.long	1076101120
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdint.h>

const int MILLION = 1000000; //define the constant million
const int thread_per_block = 1000;

#define time_record_begin(start){ \
	hipEventCreate(&start);	  \
	hipEventRecord(start, 0);	  \
}
#define time_record_end(start, stop, time){ \
	hipEventCreate(&stop);		\
	hipEventRecord(stop, 0);	\
	hipEventSynchronize(stop);	\
	hipEventElapsedTime(&time, start, stop);\
}

__global__	void arradd(float *A, float target, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void darradd(double *A, double target, int numElements){
	int idx= blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void iarradd(int32_t *A, int32_t target, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		A[idx] = A[idx] + target;
	}
}

__global__	void xarradd(float *A, float target, int times, int numElements){
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < numElements){
		for(int j = 0; j < times; j++){
			A[idx] = A[idx] + target;
		}
	}
}

/***  Time measure for single precision floating-point numbers  ***/
void measure_float(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	float *A;
	float X = 10.0f;
	float *d_A;

	hipEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outA.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <=256; j *= 2){
		//Malloc for the input array A on CPU
		int size = j * MILLION;
		A = (float *) malloc(size * sizeof(float));

		//Initialize the array
		for(int i = 0; i < size; i++){
			A[i] = (float)i / 3.0f;
		}

		//Malloc array on GPU
		hipMalloc((void**)&d_A, size * sizeof(float));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		hipMemcpy(d_A, A, size * sizeof(float), hipMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		arradd<<<gridDim, blockDim>>>(d_A, X, size);
		hipDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		hipMemcpy(A, d_A, size * sizeof(float), hipMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		//free memory on GPU and CPU
		hipFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for double precision floating-point numbers  ***/
void measure_double(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	double *A;
	double X = 10.0;
	double *d_A;

	hipEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outB.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		int size = j * MILLION;
		A = (double *) malloc(size * sizeof(double));

		for(int i = 0; i < size; i++){
			A[i] = (double)i / 3.0f;
		}

		hipMalloc((void**)&d_A, size * sizeof(double));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		hipMemcpy(d_A, A, size * sizeof(double), hipMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		darradd<<<gridDim, blockDim>>>(d_A, X, size);
		hipDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		hipMemcpy(A, d_A, size * sizeof(double), hipMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		hipFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for 32-bit integers  ***/
void measure_int32(){
	printf("Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	int32_t *A;
	int32_t X = 10;
	int32_t *d_A;

	hipEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	FILE* fp;
	fp = fopen("outC.txt", "w+");
	fprintf(fp,"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		int size = j * MILLION;
		A = (int32_t *) malloc(size * sizeof(int32_t));

		for(int i = 0; i < size; i++){
			A[i] = (int32_t)(i / 3);
		}

		hipMalloc((void**)&d_A, size * sizeof(int32_t));
		//Initialize the size of grid and block
		dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
		dim3 blockDim(thread_per_block);

		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		hipMemcpy(d_A, A, size * sizeof(int32_t), hipMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		iarradd<<<gridDim, blockDim>>>(d_A, X, size);
		hipDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		hipMemcpy(A, d_A, size * sizeof(int32_t), hipMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t %f\t %f\t %f\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		hipFree(d_A);
		free(A);
	}
	fclose(fp);
}

/***  Time measure for diffrent adding times  ***/
void measure_xaddtimes(){
	printf("XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	float *A;
	float X = 10.0;
	float *d_A;

	hipEvent_t start,stop;
	float time_cpu_to_gpu, time_kernel, time_gpu_to_cpu;

	int size = 128 * MILLION;
	//Initialize the size of grid and block
	dim3 gridDim((size + thread_per_block - 1)/thread_per_block);
	dim3 blockDim(thread_per_block);

	FILE* fp;
	fp = fopen("outD.txt", "w+");
	fprintf(fp,"XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n");
	for(int j = 1; j <= 256; j *= 2){
		A = (float *) malloc(size * sizeof(float));
		for(int i = 0; i < size; i++){
			A[i] = (float) i / 3.0f;
		}

		hipMalloc((void**)&d_A, size * sizeof(float));
		//Measure time for Memcpy from CPU to GPU
		time_record_begin(start);
		hipMemcpy(d_A, A, size * sizeof(float), hipMemcpyHostToDevice);
		time_record_end(start, stop, time_cpu_to_gpu);

		//Measure time for kernel
		time_record_begin(start);
		xarradd<<<gridDim, blockDim>>>(d_A, X, j, size);
		hipDeviceSynchronize();
		time_record_end(start, stop, time_kernel);

		//Measure time for Memcpy from GPU to CPU
		time_record_begin(start);
		hipMemcpy(A, d_A, size * sizeof(float), hipMemcpyDeviceToHost);
		time_record_end(start, stop, time_gpu_to_cpu);

		fprintf(fp,"%d\t\t .\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);
		printf("%d\t\t .\t\t %f\t %f\t %f\t\n", j, time_cpu_to_gpu, time_kernel, time_gpu_to_cpu);

		hipFree(d_A);
		free(A);
	}
	fclose(fp);
}

int main(int argc, char ** argv){
	printf("Part A\n");
	measure_float();

	printf("Part B\n");
	measure_double();

	printf("Part C\n");
	measure_int32();

	printf("Part D\n");
	measure_xaddtimes();

	printf("Done.\n");
}


	.text
	.file	"hw1.hip"
	.globl	_Z21__device_stub__arraddPffi   # -- Begin function _Z21__device_stub__arraddPffi
	.type	_Z21__device_stub__arraddPffi,@function
_Z21__device_stub__arraddPffi:          # @_Z21__device_stub__arraddPffi
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movss	%xmm0, (%rcx)
	movq	%rsp, %rdx
	movl	%esi, (%rdx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z6arraddPffi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z21__device_stub__arraddPffi, .Lfunc_end0-_Z21__device_stub__arraddPffi
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__darraddPddi  # -- Begin function _Z22__device_stub__darraddPddi
	.type	_Z22__device_stub__darraddPddi,@function
_Z22__device_stub__darraddPddi:         # @_Z22__device_stub__darraddPddi
	.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
	movsd	%xmm0, (%rcx)
	leaq	12(%rsp), %rdx
	movl	%esi, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 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	$_Z7darraddPddi, %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	_Z22__device_stub__darraddPddi, .Lfunc_end1-_Z22__device_stub__darraddPddi
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__iarraddPiii  # -- Begin function _Z22__device_stub__iarraddPiii
	.type	_Z22__device_stub__iarraddPiii,@function
_Z22__device_stub__iarraddPiii:         # @_Z22__device_stub__iarraddPiii
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	movq	%rsp, %rsi
	movl	%edx, (%rsi)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z7iarraddPiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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	_Z22__device_stub__iarraddPiii, .Lfunc_end2-_Z22__device_stub__iarraddPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__xarraddPffii # -- Begin function _Z22__device_stub__xarraddPffii
	.type	_Z22__device_stub__xarraddPffii,@function
_Z22__device_stub__xarraddPffii:        # @_Z22__device_stub__xarraddPffii
	.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	20(%rsp), %rcx
	movss	%xmm0, (%rcx)
	leaq	16(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdi, 16(%rbx)
	movq	%rsi, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z7xarraddPffii, %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_end3:
	.size	_Z22__device_stub__xarraddPffii, .Lfunc_end3-_Z22__device_stub__xarraddPffii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z13measure_floatv
.LCPI4_0:
	.long	0x40400000                      # float 3
.LCPI4_1:
	.long	0x41200000                      # float 10
	.text
	.globl	_Z13measure_floatv
	.type	_Z13measure_floatv,@function
_Z13measure_floatv:                     # @_Z13measure_floatv
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967296, %rbx               # imm = 0x100000000
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.L.str.1, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movl	$.L.str, %edi
	movl	$52, %esi
	movl	$1, %edx
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rax, %rcx
	callq	fwrite@PLT
	movl	$1, %r14d
	leaq	8(%rsp), %r13
	leaq	1000(%rbx), %rax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
.LBB4_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_2 Depth 2
	imull	$1000000, %r14d, %r15d          # imm = 0xF4240
	imull	$4000000, %r14d, %ebx           # imm = 0x3D0900
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %rbp
	xorl	%eax, %eax
	movss	.LCPI4_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
.LBB4_2:                                #   Parent Loop BB4_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rbp,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB4_2
# %bb.3:                                #   in Loop: Header=BB4_1 Depth=1
	leaq	32(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leal	999(%r15), %eax
	imulq	$274877907, %rax, %r12          # imm = 0x10624DD3
	shrq	$38, %r12
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %r12
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rsp, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r12, %rdi
	movl	$1, %esi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_5
# %bb.4:                                #   in Loop: Header=BB4_1 Depth=1
	movq	32(%rsp), %rdi
	movss	.LCPI4_1(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movl	%r15d, %esi
	callq	_Z21__device_stub__arraddPffi
.LBB4_5:                                #   in Loop: Header=BB4_1 Depth=1
	callq	hipDeviceSynchronize
	movq	%rsp, %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	24(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rsi
	movq	%rbp, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	24(%rsp), %xmm1
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.3, %esi
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movl	%r14d, %edx
	movb	$3, %al
	callq	fprintf
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	24(%rsp), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.3, %edi
	movl	%r14d, %esi
	movb	$3, %al
	callq	printf
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	%rbp, %rdi
	callq	free
	leal	(%r14,%r14), %eax
	cmpl	$129, %r14d
	movl	%eax, %r14d
	jb	.LBB4_1
# %bb.6:
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	addq	$56, %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_end4:
	.size	_Z13measure_floatv, .Lfunc_end4-_Z13measure_floatv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14measure_doublev
.LCPI5_0:
	.quad	0x4008000000000000              # double 3
.LCPI5_1:
	.quad	0x4024000000000000              # double 10
	.text
	.globl	_Z14measure_doublev
	.type	_Z14measure_doublev,@function
_Z14measure_doublev:                    # @_Z14measure_doublev
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967296, %rbx               # imm = 0x100000000
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.L.str.4, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movl	$.L.str, %edi
	movl	$52, %esi
	movl	$1, %edx
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rax, %rcx
	callq	fwrite@PLT
	movl	$1, %r14d
	leaq	8(%rsp), %r13
	leaq	1000(%rbx), %rax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
.LBB5_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_2 Depth 2
	imull	$1000000, %r14d, %r15d          # imm = 0xF4240
	imull	$8000000, %r14d, %ebx           # imm = 0x7A1200
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %rbp
	xorl	%eax, %eax
	movsd	.LCPI5_0(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB5_2:                                #   Parent Loop BB5_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rbp,%rax,8)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB5_2
# %bb.3:                                #   in Loop: Header=BB5_1 Depth=1
	leaq	32(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	leal	999(%r15), %eax
	imulq	$274877907, %rax, %r12          # imm = 0x10624DD3
	shrq	$38, %r12
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %r12
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rsp, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r12, %rdi
	movl	$1, %esi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_5
# %bb.4:                                #   in Loop: Header=BB5_1 Depth=1
	movq	32(%rsp), %rdi
	movsd	.LCPI5_1(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	%r15d, %esi
	callq	_Z22__device_stub__darraddPddi
.LBB5_5:                                #   in Loop: Header=BB5_1 Depth=1
	callq	hipDeviceSynchronize
	movq	%rsp, %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	24(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rsi
	movq	%rbp, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	24(%rsp), %xmm1
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.3, %esi
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movl	%r14d, %edx
	movb	$3, %al
	callq	fprintf
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	24(%rsp), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.5, %edi
	movl	%r14d, %esi
	movb	$3, %al
	callq	printf
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	%rbp, %rdi
	callq	free
	leal	(%r14,%r14), %eax
	cmpl	$129, %r14d
	movl	%eax, %r14d
	jb	.LBB5_1
# %bb.6:
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	addq	$56, %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_end5:
	.size	_Z14measure_doublev, .Lfunc_end5-_Z14measure_doublev
	.cfi_endproc
                                        # -- End function
	.globl	_Z13measure_int32v              # -- Begin function _Z13measure_int32v
	.type	_Z13measure_int32v,@function
_Z13measure_int32v:                     # @_Z13measure_int32v
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967296, %rbx               # imm = 0x100000000
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.L.str.6, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movl	$.L.str, %edi
	movl	$52, %esi
	movl	$1, %edx
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rax, %rcx
	callq	fwrite@PLT
	movl	$1, %edx
	movl	$2863311531, %r12d              # imm = 0xAAAAAAAB
	leaq	8(%rsp), %r13
	leaq	1000(%rbx), %rcx
	movq	%rcx, 48(%rsp)                  # 8-byte Spill
.LBB6_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_2 Depth 2
	imull	$1000000, %edx, %r15d           # imm = 0xF4240
	movq	%rdx, 64(%rsp)                  # 8-byte Spill
	imull	$4000000, %edx, %r14d           # imm = 0x3D0900
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %rbp
	xorl	%eax, %eax
.LBB6_2:                                #   Parent Loop BB6_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%eax, %ecx
	imulq	%r12, %rcx
	shrq	$33, %rcx
	movl	%ecx, (%rbp,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB6_2
# %bb.3:                                #   in Loop: Header=BB6_1 Depth=1
	leaq	32(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leal	999(%r15), %eax
	imulq	$274877907, %rax, %r12          # imm = 0x10624DD3
	shrq	$38, %r12
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %r12
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, 56(%rsp)                  # 8-byte Spill
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rsp, %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rbx
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r12, %rdi
	movl	$1, %esi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_5
# %bb.4:                                #   in Loop: Header=BB6_1 Depth=1
	movq	32(%rsp), %rdi
	movl	$10, %esi
	movl	%r15d, %edx
	callq	_Z22__device_stub__iarraddPiii
.LBB6_5:                                #   in Loop: Header=BB6_1 Depth=1
	callq	hipDeviceSynchronize
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	24(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%rbx, %r13
	movq	%rbx, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rsi
	movq	%rbp, %rdi
	movq	56(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	24(%rsp), %xmm1
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.3, %esi
	movq	40(%rsp), %rdi                  # 8-byte Reload
	movq	64(%rsp), %rbx                  # 8-byte Reload
	movl	%ebx, %edx
	movb	$3, %al
	callq	fprintf
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	24(%rsp), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	movb	$3, %al
	callq	printf
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	%rbp, %rdi
	callq	free
	leal	(%rbx,%rbx), %eax
	cmpl	$129, %ebx
	movl	%eax, %edx
	movl	$2863311531, %r12d              # imm = 0xAAAAAAAB
	jb	.LBB6_1
# %bb.6:
	movq	40(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	addq	$72, %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_end6:
	.size	_Z13measure_int32v, .Lfunc_end6-_Z13measure_int32v
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z17measure_xaddtimesv
.LCPI7_0:
	.long	0x40400000                      # float 3
.LCPI7_1:
	.long	0x41200000                      # float 10
	.text
	.globl	_Z17measure_xaddtimesv
	.type	_Z17measure_xaddtimesv,@function
_Z17measure_xaddtimesv:                 # @_Z17measure_xaddtimesv
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294968296, %rbx               # imm = 0x1000003E8
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	$.L.str.8, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movq	%rax, %r14
	movl	$.L.str.7, %edi
	movl	$65, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	callq	fwrite@PLT
	movl	$1, %r15d
	leaq	8(%rsp), %r13
	movq	%rsp, %rbp
	leaq	127000(%rbx), %r12
.LBB7_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_2 Depth 2
	movl	$512000000, %edi                # imm = 0x1E848000
	callq	malloc
	movq	%rax, %rbx
	xorl	%eax, %eax
	movss	.LCPI7_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
.LBB7_2:                                #   Parent Loop BB7_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$128000000, %rax                # imm = 0x7A12000
	jne	.LBB7_2
# %bb.3:                                #   in Loop: Header=BB7_1 Depth=1
	movl	$512000000, %esi                # imm = 0x1E848000
	leaq	32(%rsp), %rdi
	callq	hipMalloc
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rdi
	movl	$512000000, %edx                # imm = 0x1E848000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rbp, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r12, %rdi
	movl	$1, %esi
	movabsq	$4294968296, %rdx               # imm = 0x1000003E8
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_5
# %bb.4:                                #   in Loop: Header=BB7_1 Depth=1
	movq	32(%rsp), %rdi
	movss	.LCPI7_1(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movl	%r15d, %esi
	movl	$128000000, %edx                # imm = 0x7A12000
	callq	_Z22__device_stub__xarraddPffii
.LBB7_5:                                #   in Loop: Header=BB7_1 Depth=1
	callq	hipDeviceSynchronize
	movq	%rbp, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	24(%rsp), %rdi
	callq	hipEventElapsedTime
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	32(%rsp), %rsi
	movl	$512000000, %edx                # imm = 0x1E848000
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%rbp, %rdi
	callq	hipEventCreate
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	cvtss2sd	24(%rsp), %xmm1
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.9, %esi
	movq	%r14, %rdi
	movl	%r15d, %edx
	movb	$3, %al
	callq	fprintf
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	24(%rsp), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	20(%rsp), %xmm2
	movl	$.L.str.9, %edi
	movl	%r15d, %esi
	movb	$3, %al
	callq	printf
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	free
	leal	(%r15,%r15), %eax
	cmpl	$129, %r15d
	movl	%eax, %r15d
	jb	.LBB7_1
# %bb.6:
	movq	%r14, %rdi
	callq	fclose
	addq	$40, %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_end7:
	.size	_Z17measure_xaddtimesv, .Lfunc_end7-_Z17measure_xaddtimesv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	callq	_Z13measure_floatv
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	callq	_Z14measure_doublev
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	callq	_Z13measure_int32v
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	callq	_Z17measure_xaddtimesv
	movl	$.Lstr.8, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	main, .Lfunc_end8-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6arraddPffi, %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	$_Z7darraddPddi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7iarraddPiii, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7xarraddPffii, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %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_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z6arraddPffi,@object           # @_Z6arraddPffi
	.section	.rodata,"a",@progbits
	.globl	_Z6arraddPffi
	.p2align	3, 0x0
_Z6arraddPffi:
	.quad	_Z21__device_stub__arraddPffi
	.size	_Z6arraddPffi, 8

	.type	_Z7darraddPddi,@object          # @_Z7darraddPddi
	.globl	_Z7darraddPddi
	.p2align	3, 0x0
_Z7darraddPddi:
	.quad	_Z22__device_stub__darraddPddi
	.size	_Z7darraddPddi, 8

	.type	_Z7iarraddPiii,@object          # @_Z7iarraddPiii
	.globl	_Z7iarraddPiii
	.p2align	3, 0x0
_Z7iarraddPiii:
	.quad	_Z22__device_stub__iarraddPiii
	.size	_Z7iarraddPiii, 8

	.type	_Z7xarraddPffii,@object         # @_Z7xarraddPffii
	.globl	_Z7xarraddPffii
	.p2align	3, 0x0
_Z7xarraddPffii:
	.quad	_Z22__device_stub__xarraddPffii
	.size	_Z7xarraddPffii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n"
	.size	.L.str, 53

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"outA.txt"
	.size	.L.str.1, 9

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%d\t\t %f\t %f\t %f\n"
	.size	.L.str.3, 17

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"outB.txt"
	.size	.L.str.4, 9

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%d\t\t %f\t %f\t %f\t\n"
	.size	.L.str.5, 18

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"outC.txt"
	.size	.L.str.6, 9

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)\n"
	.size	.L.str.7, 66

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"outD.txt"
	.size	.L.str.8, 9

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%d\t\t .\t\t %f\t %f\t %f\t\n"
	.size	.L.str.9, 22

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z6arraddPffi"
	.size	.L__unnamed_1, 14

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z7darraddPddi"
	.size	.L__unnamed_2, 15

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z7iarraddPiii"
	.size	.L__unnamed_3, 15

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z7xarraddPffii"
	.size	.L__unnamed_4, 16

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

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

	.type	.Lstr.2,@object                 # @str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.2:
	.asciz	"Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)"
	.size	.Lstr.2, 52

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"XaddedTimes\t Elements(M)\t CPUtoGPU(ms)\t Kernel(ms)\t GPUtoCPU(ms)"
	.size	.Lstr.3, 65

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Part A"
	.size	.Lstr.4, 7

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Part B"
	.size	.Lstr.5, 7

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Part C"
	.size	.Lstr.6, 7

	.type	.Lstr.7,@object                 # @str.7
.Lstr.7:
	.asciz	"Part D"
	.size	.Lstr.7, 7

	.type	.Lstr.8,@object                 # @str.8
.Lstr.8:
	.asciz	"Done."
	.size	.Lstr.8, 6

	.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 _Z21__device_stub__arraddPffi
	.addrsig_sym _Z22__device_stub__darraddPddi
	.addrsig_sym _Z22__device_stub__iarraddPiii
	.addrsig_sym _Z22__device_stub__xarraddPffii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z6arraddPffi
	.addrsig_sym _Z7darraddPddi
	.addrsig_sym _Z7iarraddPiii
	.addrsig_sym _Z7xarraddPffii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6arraddPffi           ; -- Begin function _Z6arraddPffi
	.globl	_Z6arraddPffi
	.p2align	8
	.type	_Z6arraddPffi,@function
_Z6arraddPffi:                          ; @_Z6arraddPffi
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b64 s[2:3], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, s2, v2
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6arraddPffi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z6arraddPffi, .Lfunc_end0-_Z6arraddPffi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 136
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7darraddPddi          ; -- Begin function _Z7darraddPddi
	.globl	_Z7darraddPddi
	.p2align	8
	.type	_Z7darraddPddi,@function
_Z7darraddPddi:                         ; @_Z7darraddPddi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[2:3], v[2:3], s[2:3]
	global_store_b64 v[0:1], v[2:3], off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7darraddPddi
		.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 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z7darraddPddi, .Lfunc_end1-_Z7darraddPddi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 144
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7iarraddPiii          ; -- Begin function _Z7iarraddPiii
	.globl	_Z7iarraddPiii
	.p2align	8
	.type	_Z7iarraddPiii,@function
_Z7iarraddPiii:                         ; @_Z7iarraddPiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b64 s[2:3], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, s2, v2
	global_store_b32 v[0:1], v2, off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7iarraddPiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z7iarraddPiii, .Lfunc_end2-_Z7iarraddPiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 136
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7xarraddPffii         ; -- Begin function _Z7xarraddPffii
	.globl	_Z7xarraddPffii
	.p2align	8
	.type	_Z7xarraddPffii,@function
_Z7xarraddPffii:                        ; @_Z7xarraddPffii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_cmp_gt_i32 s5, 0
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_cselect_b32 s2, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s6, v1
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB3_4
; %bb.1:                                ; %.lr.ph
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[0:1], off
.LBB3_2:                                ; =>This Inner Loop Header: Depth=1
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, s4, v2
	s_add_i32 s5, s5, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s5, 0
	s_cbranch_scc1 .LBB3_2
; %bb.3:                                ; %..loopexit_crit_edge
	global_store_b32 v[0:1], v2, off
.LBB3_4:                                ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7xarraddPffii
		.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 3
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z7xarraddPffii, .Lfunc_end3-_Z7xarraddPffii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 164
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6arraddPffi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z6arraddPffi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .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:           _Z7darraddPddi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7darraddPddi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z7iarraddPiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7iarraddPiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .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:           _Z7xarraddPffii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7xarraddPffii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
