#include <stdio.h>
#include <cuda.h>
#include <stdlib.h>
#include <time.h>
#include <driver_types.h>
//Performs inner product of vectors on CPU
void multiply_cpu(int *a, int *b, int* c, int N)
{
	int d[N];
	for (int i = 0; i < N; ++i)
	{
		d[i] = a[i]*b[i];
	}	
	for (int i = 0; i < N; ++i)
	{
		*c += d[i];
	}

} 
//Performs inner product of vectors on device
__global__ void multiply_kernel(int *a,int *b, int *c, int N) 
{
	int id = blockIdx.x *  blockDim.x + threadIdx.x;
	int val;
  if(id < N)
	{
    val = a[id]*b[id];
		atomicAdd(c, val);
  }
	
}
//Inner Product of vectors a = (a1,...,an), b = (b1,...,bn) can be written as a1b1+...+anbn
//This computes the vector {a1b1,...,anbn} where the sum is carried out on the CPU
__global__ void multiply_kernel_add_cpu(int *a, int* b, int* c, int N)
{
	int id = blockIdx.x * blockDim.x + threadIdx.x;
	if (id < N)
	{
		c[id] = a[id] * b[id];
	}	
}
//Inner Product of vectors a = (a1,...,an), b = (b1,...,bn) can be written as a1b1+...+anbn
//This computes the sum, where a is assumed to contain {a1b1,...,anbn} where the product has already
//been computed on the CPU
__global__ void multiply_cpu_add_kernel(int* a, int* b, int N)
{
	int id = blockIdx.x * blockDim.x + threadIdx.x;
	if (id < N)
	{
		int val = a[id];
		atomicAdd(b, val);	
	}
}

int main(int argc, char *argv[])  {
	int N = 4096;
	int T = 10, B = 1;            // threads per block and blocks per grid
	int c[1];
	int *dev_a, *dev_b, *dev_c, *dev_d;
	cudaDeviceProp device;
	cudaGetDeviceProperties(&device, 0);
	int maxthreadsperblock = device.maxThreadsPerBlock;
	long memory = device.totalGlobalMem;
	size_t shared_mem = device.sharedMemPerBlock;
	int major = device.major;
	int minor = device.minor;
	printf("Max Threads per Block: %d\n", maxthreadsperblock);
	printf("Total Global Memory: %d\n", (int)memory);
	printf("Shared Memory: %d\n", (int)shared_mem);
	printf("Major Compute Capability: %d\n", major);
	printf("Minor Compute Capability: %d\n", minor);
	do {
		printf("Enter size of array: ");
		scanf("%d", &N);
		long memory_required = 3*(long)N + 1;
		if (memory_required > memory)
		{
			printf("Too big to fit on Device!\n");
			continue;
		}
		printf("Enter number of threads per block: ");
		scanf("%d",&T);
		if (T > maxthreadsperblock)
		{
			printf("Max threads per block exceeded\n");
			continue;
		}
		printf("\nEnter number of blocks per grid: ");
		scanf("%d",&B);
		if (T * B < N) printf("Error T x B < N, try again\n");
	} while (T * B < N);

	int a[N],b[N], d[N];
	cudaEvent_t start, stop;     // using cuda events to measure time
	float elapsed_time_ms;       // which is applicable for asynchronous code also
//allocate memory on device and check for errors
	if (cudaMalloc((void**)&dev_a,N * sizeof(int)) != cudaSuccess) {	
		puts("Not enough Space on Device!");
		return 0;
	}
	if (cudaMalloc((void**)&dev_b,N * sizeof(int)) != cudaSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_a;
	}
	if (cudaMalloc((void**)&dev_c,sizeof(int)) != cudaSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_b;
	}
	if (cudaMalloc((void**)&dev_d, N * sizeof(int)) != cudaSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_c;
	}

	for(int i=0;i<N;i++) {    // load arrays with some numbers
		a[i] = i;
		b[i] = i*1;
	}
	*c = 0;
	cudaMemcpy(dev_a, a , N*sizeof(int),cudaMemcpyHostToDevice);
	cudaMemcpy(dev_b, b , N*sizeof(int),cudaMemcpyHostToDevice);
	cudaMemcpy(dev_c, c , sizeof(int),cudaMemcpyHostToDevice);
	

	cudaEventCreate( &start );     // instrument code to measure start time
	cudaEventCreate( &stop );
// Do Inner product on the Device
	cudaEventRecord( start, 0 );

	multiply_kernel<<<B,T>>>(dev_a,dev_b,dev_c, N);

	cudaMemcpy(c,dev_c,sizeof(int),cudaMemcpyDeviceToHost);

	cudaEventRecord( stop, 0 );     // instrument code to measue end time
	cudaEventSynchronize( stop );
	cudaEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Device Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Inner product on the CPU
	cudaEventRecord( start, 0 );
	multiply_cpu(a,b,c, N);		
	cudaEventRecord( stop, 0 );     // instrument code to measue end time
	cudaEventSynchronize( stop );
	cudaEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("CPU Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Multiplication on the Device, and addition on the CPU
	cudaEventRecord( start, 0 );

	multiply_kernel_add_cpu<<<B,T>>>(dev_a,dev_b,dev_d, N);
	cudaMemcpy(d, dev_d, sizeof(int)*N, cudaMemcpyDeviceToHost);
	for (int i = 0; i < N; ++i)
	{
		*c += d[i];
	}
	cudaEventRecord( stop, 0 );     // instrument code to measue end time
	cudaEventSynchronize( stop );
	cudaEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Multiplication on Device. Addition on CPU. Inner product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Multiplication on the CPU and addition on the Device
	cudaEventRecord( start, 0 );
	for (int i = 0; i < N; ++i)
	{
		d[i] = a[i] * b[i];
	}
	cudaMemcpy(dev_d, d, sizeof(int)*N, cudaMemcpyHostToDevice);
	cudaMemcpy(dev_c, c, sizeof(int), cudaMemcpyHostToDevice);
	multiply_cpu_add_kernel<<<B,T>>>(dev_d, dev_c, N);
	
	cudaMemcpy(c, dev_c, sizeof(int), cudaMemcpyDeviceToHost);	
	cudaEventRecord( stop, 0 );     // instrument code to measue end time
	cudaEventSynchronize( stop );
	cudaEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Multiplication on CPU. Addition on Device. Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	// clean up

	cudaEventDestroy(start);
	cudaEventDestroy(stop);
	cudaFree(dev_d);
cleanup_c:
	cudaFree(dev_c);
cleanup_b:
	cudaFree(dev_b);
cleanup_a:
	cudaFree(dev_a);	

	return 0;
}


	.file	"tmpxft_00361dca_00000000-6_innerproduct.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z12multiply_cpuPiS_S_i
	.type	_Z12multiply_cpuPiS_S_i, @function
_Z12multiply_cpuPiS_S_i:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %r8
	movq	%rdx, %rsi
	movl	%ecx, %edx
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movslq	%ecx, %rax
	movq	%rsp, %r9
	leaq	15(,%rax,4), %rcx
	movq	%rcx, %rax
	andq	$-4096, %rcx
	andq	$-16, %rax
	subq	%rcx, %r9
.L3:
	cmpq	%r9, %rsp
	je	.L4
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L3
.L4:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L5
	orq	$0, -8(%rsp,%rax)
.L5:
	movq	%rsp, %r9
	xorl	%eax, %eax
.L6:
	cmpl	%eax, %edx
	jle	.L16
	movl	(%rdi,%rax,4), %ecx
	imull	(%r8,%rax,4), %ecx
	movl	%ecx, (%r9,%rax,4)
	incq	%rax
	jmp	.L6
.L16:
	xorl	%eax, %eax
.L8:
	cmpl	%eax, %edx
	jle	.L17
	movl	(%r9,%rax,4), %ecx
	incq	%rax
	addl	%ecx, (%rsi)
	jmp	.L8
.L17:
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z12multiply_cpuPiS_S_i, .-_Z12multiply_cpuPiS_S_i
	.globl	_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i
	.type	_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i, @function
_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i:
.LFB2053:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L18
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z15multiply_kernelPiS_S_i(%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
.L18:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2053:
	.size	_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i, .-_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i
	.globl	_Z15multiply_kernelPiS_S_i
	.type	_Z15multiply_kernelPiS_S_i, @function
_Z15multiply_kernelPiS_S_i:
.LFB2054:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i
	.cfi_endproc
.LFE2054:
	.size	_Z15multiply_kernelPiS_S_i, .-_Z15multiply_kernelPiS_S_i
	.globl	_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i
	.type	_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i, @function
_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L23
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z23multiply_kernel_add_cpuPiS_S_i(%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
.L23:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i, .-_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i
	.globl	_Z23multiply_kernel_add_cpuPiS_S_i
	.type	_Z23multiply_kernel_add_cpuPiS_S_i, @function
_Z23multiply_kernel_add_cpuPiS_S_i:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i
	.cfi_endproc
.LFE2056:
	.size	_Z23multiply_kernel_add_cpuPiS_S_i, .-_Z23multiply_kernel_add_cpuPiS_S_i
	.globl	_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i
	.type	_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i, @function
_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z23multiply_cpu_add_kernelPiS_i(%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
.L28:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i, .-_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i
	.globl	_Z23multiply_cpu_add_kernelPiS_i
	.type	_Z23multiply_cpu_add_kernelPiS_i, @function
_Z23multiply_cpu_add_kernelPiS_i:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i
	.cfi_endproc
.LFE2058:
	.size	_Z23multiply_cpu_add_kernelPiS_i, .-_Z23multiply_cpu_add_kernelPiS_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Max Threads per Block: %d\n"
.LC1:
	.string	"Total Global Memory: %d\n"
.LC2:
	.string	"Shared Memory: %d\n"
.LC3:
	.string	"Major Compute Capability: %d\n"
.LC4:
	.string	"Minor Compute Capability: %d\n"
.LC5:
	.string	"Enter size of array: "
.LC6:
	.string	"%d"
.LC7:
	.string	"Too big to fit on Device!\n"
.LC8:
	.string	"Enter number of threads per block: "
.LC9:
	.string	"Max threads per block exceeded\n"
.LC10:
	.string	"\nEnter number of blocks per grid: "
.LC11:
	.string	"Error T x B < N, try again\n"
.LC12:
	.string	"Not enough Space on Device!"
.LC13:
	.string	"Device Inner Product: %d "
.LC14:
	.string	"Time: %f ms.\n"
.LC15:
	.string	"CPU Inner Product: %d "
.LC16:
	.string	"Multiplication on Device. Addition on CPU. Inner product: %d "
.LC17:
	.string	"Multiplication on CPU. Addition on Device. Inner Product: %d "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%esi, %esi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-1088(%rbp), %rdi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$1144, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movl	$4096, -1184(%rbp)
	movl	$10, -1180(%rbp)
	movl	$1, -1176(%rbp)
	call	cudaGetDeviceProperties_v2@PLT
	movl	-768(%rbp), %ebx
	xorl	%eax, %eax
	movq	-800(%rbp), %r12
	movq	-792(%rbp), %r13
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	movl	-728(%rbp), %r15d
	movl	%ebx, %edx
	movl	-724(%rbp), %r14d
	call	__printf_chk@PLT
	movl	%r12d, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movl	%r13d, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	leaq	.LC5(%rip), %r13
	call	__printf_chk@PLT
	movl	%r15d, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movl	%r14d, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
.L37:
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC6(%rip), %r14
	leaq	-1184(%rbp), %rsi
	xorl	%eax, %eax
	movq	%r14, %rdi
	call	__isoc23_scanf@PLT
	movslq	-1184(%rbp), %rax
	leaq	.LC7(%rip), %rsi
	leaq	(%rax,%rax,2), %rax
	cmpq	%r12, %rax
	jge	.L80
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	-1180(%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC9(%rip), %rsi
	cmpl	%ebx, -1180(%rbp)
	jg	.L80
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	-1176(%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	-1180(%rbp), %eax
	imull	-1176(%rbp), %eax
	cmpl	-1184(%rbp), %eax
	jge	.L35
	leaq	.LC11(%rip), %rsi
.L80:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L35:
	movl	-1180(%rbp), %eax
	imull	-1176(%rbp), %eax
	movslq	-1184(%rbp), %rsi
	cmpl	%esi, %eax
	jl	.L37
	salq	$2, %rsi
	movq	%rsp, %rcx
	leaq	15(%rsi), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rcx
.L38:
	cmpq	%rcx, %rsp
	je	.L39
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L38
.L39:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L40
	orq	$0, -8(%rsp,%rdx)
.L40:
	movq	%rax, %rdi
	movq	%rax, %rdx
	movq	%rsp, %rcx
	movq	%rsp, %r14
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rcx
.L41:
	cmpq	%rcx, %rsp
	je	.L42
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L41
.L42:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L43
	orq	$0, -8(%rsp,%rdx)
.L43:
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	movq	%rsp, %r15
	andq	$-16, %rdx
	subq	%rax, %rcx
.L44:
	cmpq	%rcx, %rsp
	je	.L45
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L44
.L45:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L46
	orq	$0, -8(%rsp,%rax)
.L46:
	leaq	-1168(%rbp), %rdi
	movq	%rsp, %r13
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L47
	leaq	.LC12(%rip), %rdi
	call	puts@PLT
	jmp	.L48
.L47:
	movslq	-1184(%rbp), %rsi
	leaq	-1160(%rbp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L49
	leaq	.LC12(%rip), %rdi
	call	puts@PLT
	jmp	.L50
.L49:
	leaq	-1152(%rbp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L51
	leaq	.LC12(%rip), %rdi
	call	puts@PLT
	jmp	.L52
.L51:
	movslq	-1184(%rbp), %rsi
	leaq	-1144(%rbp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L53
	movslq	-1184(%rbp), %rdx
	xorl	%eax, %eax
	jmp	.L54
.L53:
	leaq	.LC12(%rip), %rdi
	call	puts@PLT
	jmp	.L55
.L54:
	cmpl	%eax, %edx
	jle	.L81
	movl	%eax, (%r14,%rax,4)
	movl	%eax, (%r15,%rax,4)
	incq	%rax
	jmp	.L54
.L81:
	xorl	%esi, %esi
	movq	-1168(%rbp), %rdi
	salq	$2, %rdx
	movl	$1, %ecx
	movl	%esi, -1092(%rbp)
	movq	%r14, %rsi
	leaq	-1092(%rbp), %rbx
	call	cudaMemcpy@PLT
	movslq	-1184(%rbp), %rdx
	movl	$1, %ecx
	movq	%r15, %rsi
	movq	-1160(%rbp), %rdi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movq	-1152(%rbp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$4, %edx
	call	cudaMemcpy@PLT
	leaq	-1136(%rbp), %rdi
	call	cudaEventCreate@PLT
	leaq	-1128(%rbp), %rdi
	call	cudaEventCreate@PLT
	movq	-1136(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	-1180(%rbp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	-1176(%rbp), %edx
	movl	%eax, -1104(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -1100(%rbp)
	movl	-1096(%rbp), %ecx
	movl	%edx, -1116(%rbp)
	movq	-1104(%rbp), %rdx
	movq	%rax, -1112(%rbp)
	movq	-1116(%rbp), %rdi
	movl	-1108(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L57
	movl	-1184(%rbp), %ecx
	movq	-1152(%rbp), %rdx
	movq	-1160(%rbp), %rsi
	movq	-1168(%rbp), %rdi
	call	_Z40__device_stub__Z15multiply_kernelPiS_S_iPiS_S_i
.L57:
	movq	-1152(%rbp), %rsi
	movl	$2, %ecx
	movl	$4, %edx
	movq	%rbx, %rdi
	leaq	-1172(%rbp), %r12
	call	cudaMemcpy@PLT
	movq	-1128(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-1128(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-1128(%rbp), %rdx
	movq	-1136(%rbp), %rsi
	movq	%r12, %rdi
	call	cudaEventElapsedTime@PLT
	movl	-1092(%rbp), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	cvtss2sd	-1172(%rbp), %xmm0
	call	__printf_chk@PLT
	xorl	%edx, %edx
	movq	-1136(%rbp), %rdi
	xorl	%esi, %esi
	movl	%edx, -1092(%rbp)
	call	cudaEventRecord@PLT
	movq	%rbx, %rdx
	movq	%r15, %rsi
	movq	%r14, %rdi
	movl	-1184(%rbp), %ecx
	call	_Z12multiply_cpuPiS_S_i
	movq	-1128(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-1128(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-1128(%rbp), %rdx
	movq	-1136(%rbp), %rsi
	movq	%r12, %rdi
	call	cudaEventElapsedTime@PLT
	movl	-1092(%rbp), %edx
	leaq	.LC15(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	cvtss2sd	-1172(%rbp), %xmm0
	call	__printf_chk@PLT
	xorl	%ecx, %ecx
	movq	-1136(%rbp), %rdi
	xorl	%esi, %esi
	movl	%ecx, -1092(%rbp)
	call	cudaEventRecord@PLT
	movl	-1180(%rbp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	-1176(%rbp), %edx
	movl	%eax, -1104(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -1100(%rbp)
	movl	-1096(%rbp), %ecx
	movl	%edx, -1116(%rbp)
	movq	-1104(%rbp), %rdx
	movq	%rax, -1112(%rbp)
	movq	-1116(%rbp), %rdi
	movl	-1108(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L58
	movl	-1184(%rbp), %ecx
	movq	-1144(%rbp), %rdx
	movq	-1160(%rbp), %rsi
	movq	-1168(%rbp), %rdi
	call	_Z48__device_stub__Z23multiply_kernel_add_cpuPiS_S_iPiS_S_i
.L58:
	movslq	-1184(%rbp), %rdx
	movq	-1144(%rbp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	-1184(%rbp), %esi
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	movl	-1092(%rbp), %edx
.L59:
	cmpl	%eax, %esi
	jle	.L82
	addl	0(%r13,%rax,4), %edx
	movb	$1, %cl
	incq	%rax
	jmp	.L59
.L82:
	testb	%cl, %cl
	je	.L61
	movl	%edx, -1092(%rbp)
.L61:
	movq	-1128(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-1128(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-1128(%rbp), %rdx
	movq	-1136(%rbp), %rsi
	movq	%r12, %rdi
	call	cudaEventElapsedTime@PLT
	movl	-1092(%rbp), %edx
	leaq	.LC16(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	cvtss2sd	-1172(%rbp), %xmm0
	call	__printf_chk@PLT
	xorl	%eax, %eax
	movq	-1136(%rbp), %rdi
	xorl	%esi, %esi
	movl	%eax, -1092(%rbp)
	call	cudaEventRecord@PLT
	movslq	-1184(%rbp), %rdx
	xorl	%eax, %eax
.L62:
	cmpl	%eax, %edx
	jle	.L83
	movl	(%r14,%rax,4), %ecx
	imull	(%r15,%rax,4), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	incq	%rax
	jmp	.L62
.L83:
	movq	-1144(%rbp), %rdi
	salq	$2, %rdx
	movl	$1, %ecx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movq	-1152(%rbp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	-1180(%rbp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	-1176(%rbp), %edx
	movl	%eax, -1104(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -1100(%rbp)
	movl	-1096(%rbp), %ecx
	movl	%edx, -1116(%rbp)
	movq	-1104(%rbp), %rdx
	movq	%rax, -1112(%rbp)
	movq	-1116(%rbp), %rdi
	movl	-1108(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L64
	movl	-1184(%rbp), %edx
	movq	-1152(%rbp), %rsi
	movq	-1144(%rbp), %rdi
	call	_Z46__device_stub__Z23multiply_cpu_add_kernelPiS_iPiS_i
.L64:
	movq	-1152(%rbp), %rsi
	movl	$2, %ecx
	movl	$4, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movq	-1128(%rbp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	-1128(%rbp), %rdi
	call	cudaEventSynchronize@PLT
	movq	-1128(%rbp), %rdx
	movq	-1136(%rbp), %rsi
	movq	%r12, %rdi
	call	cudaEventElapsedTime@PLT
	movl	-1092(%rbp), %edx
	leaq	.LC17(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	cvtss2sd	-1172(%rbp), %xmm0
	call	__printf_chk@PLT
	movq	-1136(%rbp), %rdi
	call	cudaEventDestroy@PLT
	movq	-1128(%rbp), %rdi
	call	cudaEventDestroy@PLT
	movq	-1144(%rbp), %rdi
	call	cudaFree@PLT
.L55:
	movq	-1152(%rbp), %rdi
	call	cudaFree@PLT
.L52:
	movq	-1160(%rbp), %rdi
	call	cudaFree@PLT
.L50:
	movq	-1168(%rbp), %rdi
	call	cudaFree@PLT
.L48:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L65
	call	__stack_chk_fail@PLT
.L65:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2028:
	.size	main, .-main
	.section	.rodata.str1.1
.LC18:
	.string	"_Z23multiply_cpu_add_kernelPiS_i"
.LC19:
	.string	"_Z23multiply_kernel_add_cpuPiS_S_i"
.LC20:
	.string	"_Z15multiply_kernelPiS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC18(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z23multiply_cpu_add_kernelPiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC19(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z23multiply_kernel_add_cpuPiS_S_i(%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	.LC20(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15multiply_kernelPiS_S_i(%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
.LFE2060:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <time.h>
#include <hip/driver_types.h>
//Performs inner product of vectors on CPU
void multiply_cpu(int *a, int *b, int* c, int N)
{
	int d[N];
	for (int i = 0; i < N; ++i)
	{
		d[i] = a[i]*b[i];
	}	
	for (int i = 0; i < N; ++i)
	{
		*c += d[i];
	}

} 
//Performs inner product of vectors on device
__global__ void multiply_kernel(int *a,int *b, int *c, int N) 
{
	int id = blockIdx.x *  blockDim.x + threadIdx.x;
	int val;
  if(id < N)
	{
    val = a[id]*b[id];
		atomicAdd(c, val);
  }
	
}
//Inner Product of vectors a = (a1,...,an), b = (b1,...,bn) can be written as a1b1+...+anbn
//This computes the vector {a1b1,...,anbn} where the sum is carried out on the CPU
__global__ void multiply_kernel_add_cpu(int *a, int* b, int* c, int N)
{
	int id = blockIdx.x * blockDim.x + threadIdx.x;
	if (id < N)
	{
		c[id] = a[id] * b[id];
	}	
}
//Inner Product of vectors a = (a1,...,an), b = (b1,...,bn) can be written as a1b1+...+anbn
//This computes the sum, where a is assumed to contain {a1b1,...,anbn} where the product has already
//been computed on the CPU
__global__ void multiply_cpu_add_kernel(int* a, int* b, int N)
{
	int id = blockIdx.x * blockDim.x + threadIdx.x;
	if (id < N)
	{
		int val = a[id];
		atomicAdd(b, val);	
	}
}

int main(int argc, char *argv[])  {
	int N = 4096;
	int T = 10, B = 1;            // threads per block and blocks per grid
	int c[1];
	int *dev_a, *dev_b, *dev_c, *dev_d;
	hipDeviceProp_t device;
	hipGetDeviceProperties(&device, 0);
	int maxthreadsperblock = device.maxThreadsPerBlock;
	long memory = device.totalGlobalMem;
	size_t shared_mem = device.sharedMemPerBlock;
	int major = device.major;
	int minor = device.minor;
	printf("Max Threads per Block: %d\n", maxthreadsperblock);
	printf("Total Global Memory: %d\n", (int)memory);
	printf("Shared Memory: %d\n", (int)shared_mem);
	printf("Major Compute Capability: %d\n", major);
	printf("Minor Compute Capability: %d\n", minor);
	do {
		printf("Enter size of array: ");
		scanf("%d", &N);
		long memory_required = 3*(long)N + 1;
		if (memory_required > memory)
		{
			printf("Too big to fit on Device!\n");
			continue;
		}
		printf("Enter number of threads per block: ");
		scanf("%d",&T);
		if (T > maxthreadsperblock)
		{
			printf("Max threads per block exceeded\n");
			continue;
		}
		printf("\nEnter number of blocks per grid: ");
		scanf("%d",&B);
		if (T * B < N) printf("Error T x B < N, try again\n");
	} while (T * B < N);

	int a[N],b[N], d[N];
	hipEvent_t start, stop;     // using cuda events to measure time
	float elapsed_time_ms;       // which is applicable for asynchronous code also
//allocate memory on device and check for errors
	if (hipMalloc((void**)&dev_a,N * sizeof(int)) != hipSuccess) {	
		puts("Not enough Space on Device!");
		return 0;
	}
	if (hipMalloc((void**)&dev_b,N * sizeof(int)) != hipSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_a;
	}
	if (hipMalloc((void**)&dev_c,sizeof(int)) != hipSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_b;
	}
	if (hipMalloc((void**)&dev_d, N * sizeof(int)) != hipSuccess) {
		puts("Not enough Space on Device!");
		goto cleanup_c;
	}

	for(int i=0;i<N;i++) {    // load arrays with some numbers
		a[i] = i;
		b[i] = i*1;
	}
	*c = 0;
	hipMemcpy(dev_a, a , N*sizeof(int),hipMemcpyHostToDevice);
	hipMemcpy(dev_b, b , N*sizeof(int),hipMemcpyHostToDevice);
	hipMemcpy(dev_c, c , sizeof(int),hipMemcpyHostToDevice);
	

	hipEventCreate( &start );     // instrument code to measure start time
	hipEventCreate( &stop );
// Do Inner product on the Device
	hipEventRecord( start, 0 );

	multiply_kernel<<<B,T>>>(dev_a,dev_b,dev_c, N);

	hipMemcpy(c,dev_c,sizeof(int),hipMemcpyDeviceToHost);

	hipEventRecord( stop, 0 );     // instrument code to measue end time
	hipEventSynchronize( stop );
	hipEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Device Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Inner product on the CPU
	hipEventRecord( start, 0 );
	multiply_cpu(a,b,c, N);		
	hipEventRecord( stop, 0 );     // instrument code to measue end time
	hipEventSynchronize( stop );
	hipEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("CPU Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Multiplication on the Device, and addition on the CPU
	hipEventRecord( start, 0 );

	multiply_kernel_add_cpu<<<B,T>>>(dev_a,dev_b,dev_d, N);
	hipMemcpy(d, dev_d, sizeof(int)*N, hipMemcpyDeviceToHost);
	for (int i = 0; i < N; ++i)
	{
		*c += d[i];
	}
	hipEventRecord( stop, 0 );     // instrument code to measue end time
	hipEventSynchronize( stop );
	hipEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Multiplication on Device. Addition on CPU. Inner product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	*c = 0;
//Do Multiplication on the CPU and addition on the Device
	hipEventRecord( start, 0 );
	for (int i = 0; i < N; ++i)
	{
		d[i] = a[i] * b[i];
	}
	hipMemcpy(dev_d, d, sizeof(int)*N, hipMemcpyHostToDevice);
	hipMemcpy(dev_c, c, sizeof(int), hipMemcpyHostToDevice);
	multiply_cpu_add_kernel<<<B,T>>>(dev_d, dev_c, N);
	
	hipMemcpy(c, dev_c, sizeof(int), hipMemcpyDeviceToHost);	
	hipEventRecord( stop, 0 );     // instrument code to measue end time
	hipEventSynchronize( stop );
	hipEventElapsedTime( &elapsed_time_ms, start, stop );

	printf("Multiplication on CPU. Addition on Device. Inner Product: %d ", *c);
	
	printf("Time: %f ms.\n", elapsed_time_ms);  // print out execution time
	// clean up

	hipEventDestroy(start);
	hipEventDestroy(stop);
	hipFree(dev_d);
cleanup_c:
	hipFree(dev_c);
cleanup_b:
	hipFree(dev_b);
cleanup_a:
	hipFree(dev_a);	

	return 0;
}


	.text
	.file	"innerproduct.hip"
	.globl	_Z12multiply_cpuPiS_S_i         # -- Begin function _Z12multiply_cpuPiS_S_i
	.type	_Z12multiply_cpuPiS_S_i,@function
_Z12multiply_cpuPiS_S_i:                # @_Z12multiply_cpuPiS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movl	%ecx, %eax
	movq	%rsp, %r8
	leaq	15(,%rax,4), %r9
	andq	$-16, %r9
	subq	%r9, %r8
	movq	%r8, %rsp
	testl	%ecx, %ecx
	jle	.LBB0_7
# %bb.1:                                # %.lr.ph.preheader
	xorl	%r9d, %r9d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rsi,%r9,4), %r10d
	imull	(%rdi,%r9,4), %r10d
	movl	%r10d, (%r8,%r9,4)
	incq	%r9
	cmpq	%r9, %rax
	jne	.LBB0_2
# %bb.3:                                # %.preheader
	testl	%ecx, %ecx
	jle	.LBB0_7
# %bb.4:                                # %.lr.ph18
	movl	(%rdx), %ecx
	xorl	%esi, %esi
.LBB0_5:                                # =>This Inner Loop Header: Depth=1
	addl	(%r8,%rsi,4), %ecx
	incq	%rsi
	cmpq	%rsi, %rax
	jne	.LBB0_5
# %bb.6:                                # %._crit_edge
	movl	%ecx, (%rdx)
.LBB0_7:                                # %.preheader.thread
	movq	%rbp, %rsp
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end0:
	.size	_Z12multiply_cpuPiS_S_i, .Lfunc_end0-_Z12multiply_cpuPiS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__multiply_kernelPiS_S_i # -- Begin function _Z30__device_stub__multiply_kernelPiS_S_i
	.type	_Z30__device_stub__multiply_kernelPiS_S_i,@function
_Z30__device_stub__multiply_kernelPiS_S_i: # @_Z30__device_stub__multiply_kernelPiS_S_i
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%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	$_Z15multiply_kernelPiS_S_i, %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	_Z30__device_stub__multiply_kernelPiS_S_i, .Lfunc_end1-_Z30__device_stub__multiply_kernelPiS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i # -- Begin function _Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
	.type	_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i,@function
_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i: # @_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%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	$_Z23multiply_kernel_add_cpuPiS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i, .Lfunc_end2-_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__multiply_cpu_add_kernelPiS_i # -- Begin function _Z38__device_stub__multiply_cpu_add_kernelPiS_i
	.type	_Z38__device_stub__multiply_cpu_add_kernelPiS_i,@function
_Z38__device_stub__multiply_cpu_add_kernelPiS_i: # @_Z38__device_stub__multiply_cpu_add_kernelPiS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23multiply_cpu_add_kernelPiS_i, %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	_Z38__device_stub__multiply_cpu_add_kernelPiS_i, .Lfunc_end3-_Z38__device_stub__multiply_cpu_add_kernelPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$1560, %rsp                     # imm = 0x618
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	leaq	-44(%rbp), %rbx
	movl	$4096, (%rbx)                   # imm = 0x1000
	leaq	-64(%rbp), %r14
	movl	$10, (%r14)
	leaq	-60(%rbp), %rax
	movl	$1, (%rax)
	leaq	-1592(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	movl	320(%r15), %r12d
	movq	288(%r15), %r13
	movl	296(%r15), %eax
	movl	%eax, -116(%rbp)                # 4-byte Spill
	movl	360(%r15), %eax
	movl	%eax, -120(%rbp)                # 4-byte Spill
	movl	364(%r15), %r15d
	movl	$.L.str, %edi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.1, %edi
	movl	%r13d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.2, %edi
	movl	-116(%rbp), %esi                # 4-byte Reload
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	movl	-120(%rbp), %esi                # 4-byte Reload
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.6, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movslq	-44(%rbp), %rax
	leaq	(%rax,%rax,2), %rax
	movl	$.Lstr.2, %edi
	cmpq	%r13, %rax
	jge	.LBB4_4
# %bb.2:                                #   in Loop: Header=BB4_1 Depth=1
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.6, %edi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$.Lstr.1, %edi
	cmpl	%r12d, -64(%rbp)
	jg	.LBB4_4
# %bb.3:                                #   in Loop: Header=BB4_1 Depth=1
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.6, %edi
	leaq	-60(%rbp), %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	-60(%rbp), %eax
	imull	-64(%rbp), %eax
	movl	$.Lstr, %edi
	cmpl	-44(%rbp), %eax
	jge	.LBB4_5
.LBB4_4:                                # %.sink.split
                                        #   in Loop: Header=BB4_1 Depth=1
	callq	puts
.LBB4_5:                                #   in Loop: Header=BB4_1 Depth=1
	movl	-60(%rbp), %ecx
	imull	-64(%rbp), %ecx
	movl	-44(%rbp), %eax
	cmpl	%eax, %ecx
	jl	.LBB4_1
# %bb.6:
	movq	%rsp, %r13
	movq	%rsp, %rbx
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %rbx
	movq	%rbx, %rsp
	movslq	-44(%rbp), %rsi
	movl	%esi, %eax
	movq	%rsp, %r15
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %r15
	movq	%r15, %rsp
	movq	%rsp, %r14
	subq	%rax, %r14
	movq	%r14, %rsp
	shlq	$2, %rsi
	leaq	-112(%rbp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB4_8
# %bb.7:
	movl	$.L.str.12, %edi
	callq	puts
	jmp	.LBB4_33
.LBB4_8:
	movslq	-44(%rbp), %rsi
	shlq	$2, %rsi
	leaq	-104(%rbp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB4_10
# %bb.9:
	movl	$.L.str.12, %edi
	callq	puts
	jmp	.LBB4_32
.LBB4_10:
	leaq	-88(%rbp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB4_12
# %bb.11:
	movl	$.L.str.12, %edi
	callq	puts
	jmp	.LBB4_31
.LBB4_12:
	movslq	-44(%rbp), %rsi
	shlq	$2, %rsi
	leaq	-96(%rbp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB4_13
# %bb.34:
	movl	$.L.str.12, %edi
	callq	puts
	jmp	.LBB4_30
.LBB4_13:                               # %.preheader
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB4_16
# %bb.14:                               # %.lr.ph.preheader
	xorl	%ecx, %ecx
.LBB4_15:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%ecx, (%rbx,%rcx,4)
	movl	%ecx, (%r15,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB4_15
.LBB4_16:                               # %._crit_edge
	leaq	-48(%rbp), %r12
	movl	$0, (%r12)
	movq	-112(%rbp), %rdi
	movslq	%eax, %rdx
	shlq	$2, %rdx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	-104(%rbp), %rdi
	movslq	-44(%rbp), %rdx
	shlq	$2, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	-88(%rbp), %rdi
	movl	$4, %edx
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	-80(%rbp), %r12
	movq	%r12, %rdi
	callq	hipEventCreate
	leaq	-56(%rbp), %rdi
	callq	hipEventCreate
	movq	(%r12), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	-60(%rbp), %edi
	movl	-64(%rbp), %edx
	btsq	$32, %rdi
	btsq	$32, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_18
# %bb.17:
	movq	-112(%rbp), %rdi
	movq	-104(%rbp), %rsi
	movq	-88(%rbp), %rdx
	movl	-44(%rbp), %ecx
	callq	_Z30__device_stub__multiply_kernelPiS_S_i
.LBB4_18:
	movq	-88(%rbp), %rsi
	leaq	-48(%rbp), %rdi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	-56(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-56(%rbp), %rdi
	callq	hipEventSynchronize
	movq	-80(%rbp), %rsi
	movq	-56(%rbp), %rdx
	leaq	-68(%rbp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	leaq	-48(%rbp), %rax
	movl	(%rax), %esi
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	xorl	%eax, %eax
	leaq	-48(%rbp), %rcx
	movl	%eax, (%rcx)
	movq	-80(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	-44(%rbp), %ecx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	leaq	-48(%rbp), %rdx
	movq	%rdx, %r12
	callq	_Z12multiply_cpuPiS_S_i
	movq	-56(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-56(%rbp), %rdi
	callq	hipEventSynchronize
	movq	-80(%rbp), %rsi
	movq	-56(%rbp), %rdx
	leaq	-68(%rbp), %rdi
	callq	hipEventElapsedTime
	movl	(%r12), %esi
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	-68(%rbp), %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rax), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	xorl	%eax, %eax
	movl	%eax, (%r12)
	movq	-80(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	-60(%rbp), %edi
	movl	-64(%rbp), %edx
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdi
	orq	%rax, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_20
# %bb.19:
	movq	-112(%rbp), %rdi
	movq	-104(%rbp), %rsi
	movq	-96(%rbp), %rdx
	movl	-44(%rbp), %ecx
	callq	_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
.LBB4_20:
	movq	-96(%rbp), %rsi
	movslq	-44(%rbp), %rdx
	shlq	$2, %rdx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB4_24
# %bb.21:                               # %.lr.ph66.preheader
	movl	-48(%rbp), %ecx
	xorl	%edx, %edx
.LBB4_22:                               # %.lr.ph66
                                        # =>This Inner Loop Header: Depth=1
	addl	(%r14,%rdx,4), %ecx
	incq	%rdx
	cmpq	%rdx, %rax
	jne	.LBB4_22
# %bb.23:                               # %._crit_edge67
	movl	%ecx, -48(%rbp)
.LBB4_24:
	movq	-56(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-56(%rbp), %rdi
	callq	hipEventSynchronize
	movq	-80(%rbp), %rsi
	movq	-56(%rbp), %rdx
	leaq	-68(%rbp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	movl	-48(%rbp), %esi
	movl	$.L.str.16, %edi
	xorl	%eax, %eax
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movl	$0, -48(%rbp)
	movq	-80(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB4_27
# %bb.25:                               # %.lr.ph71.preheader
	xorl	%ecx, %ecx
.LBB4_26:                               # %.lr.ph71
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r15,%rcx,4), %edx
	imull	(%rbx,%rcx,4), %edx
	movl	%edx, (%r14,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB4_26
.LBB4_27:                               # %._crit_edge72
	movq	-96(%rbp), %rdi
	movslq	%eax, %rdx
	shlq	$2, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	-88(%rbp), %rdi
	leaq	-48(%rbp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	-60(%rbp), %edi
	movl	-64(%rbp), %edx
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdi
	orq	%rax, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_29
# %bb.28:
	movq	-96(%rbp), %rdi
	movq	-88(%rbp), %rsi
	movl	-44(%rbp), %edx
	callq	_Z38__device_stub__multiply_cpu_add_kernelPiS_i
.LBB4_29:
	movq	-88(%rbp), %rsi
	leaq	-48(%rbp), %rbx
	movl	$4, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	-56(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-56(%rbp), %rdi
	callq	hipEventSynchronize
	movq	-80(%rbp), %rsi
	movq	-56(%rbp), %rdx
	leaq	-68(%rbp), %r14
	movq	%r14, %rdi
	callq	hipEventElapsedTime
	movl	(%rbx), %esi
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14), %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movq	-80(%rbp), %rdi
	callq	hipEventDestroy
	movq	-56(%rbp), %rdi
	callq	hipEventDestroy
	movq	-96(%rbp), %rdi
	callq	hipFree
.LBB4_30:
	movq	-88(%rbp), %rdi
	callq	hipFree
.LBB4_31:
	movq	-104(%rbp), %rdi
	callq	hipFree
.LBB4_32:
	movq	-112(%rbp), %rdi
	callq	hipFree
.LBB4_33:
	movq	%r13, %rsp
	xorl	%eax, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15multiply_kernelPiS_S_i, %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	$_Z23multiply_kernel_add_cpuPiS_S_i, %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	$_Z23multiply_cpu_add_kernelPiS_i, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z15multiply_kernelPiS_S_i,@object # @_Z15multiply_kernelPiS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z15multiply_kernelPiS_S_i
	.p2align	3, 0x0
_Z15multiply_kernelPiS_S_i:
	.quad	_Z30__device_stub__multiply_kernelPiS_S_i
	.size	_Z15multiply_kernelPiS_S_i, 8

	.type	_Z23multiply_kernel_add_cpuPiS_S_i,@object # @_Z23multiply_kernel_add_cpuPiS_S_i
	.globl	_Z23multiply_kernel_add_cpuPiS_S_i
	.p2align	3, 0x0
_Z23multiply_kernel_add_cpuPiS_S_i:
	.quad	_Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
	.size	_Z23multiply_kernel_add_cpuPiS_S_i, 8

	.type	_Z23multiply_cpu_add_kernelPiS_i,@object # @_Z23multiply_cpu_add_kernelPiS_i
	.globl	_Z23multiply_cpu_add_kernelPiS_i
	.p2align	3, 0x0
_Z23multiply_cpu_add_kernelPiS_i:
	.quad	_Z38__device_stub__multiply_cpu_add_kernelPiS_i
	.size	_Z23multiply_cpu_add_kernelPiS_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Max Threads per Block: %d\n"
	.size	.L.str, 27

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Total Global Memory: %d\n"
	.size	.L.str.1, 25

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Shared Memory: %d\n"
	.size	.L.str.2, 19

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Major Compute Capability: %d\n"
	.size	.L.str.3, 30

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Minor Compute Capability: %d\n"
	.size	.L.str.4, 30

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Enter size of array: "
	.size	.L.str.5, 22

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Enter number of threads per block: "
	.size	.L.str.8, 36

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"\nEnter number of blocks per grid: "
	.size	.L.str.10, 35

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Not enough Space on Device!"
	.size	.L.str.12, 28

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Device Inner Product: %d "
	.size	.L.str.13, 26

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Time: %f ms.\n"
	.size	.L.str.14, 14

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"CPU Inner Product: %d "
	.size	.L.str.15, 23

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Multiplication on Device. Addition on CPU. Inner product: %d "
	.size	.L.str.16, 62

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Multiplication on CPU. Addition on Device. Inner Product: %d "
	.size	.L.str.17, 62

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15multiply_kernelPiS_S_i"
	.size	.L__unnamed_1, 27

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z23multiply_kernel_add_cpuPiS_S_i"
	.size	.L__unnamed_2, 35

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z23multiply_cpu_add_kernelPiS_i"
	.size	.L__unnamed_3, 33

	.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,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Error T x B < N, try again"
	.size	.Lstr, 27

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Max threads per block exceeded"
	.size	.Lstr.1, 31

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Too big to fit on Device!"
	.size	.Lstr.2, 26

	.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 _Z30__device_stub__multiply_kernelPiS_S_i
	.addrsig_sym _Z38__device_stub__multiply_kernel_add_cpuPiS_S_i
	.addrsig_sym _Z38__device_stub__multiply_cpu_add_kernelPiS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z15multiply_kernelPiS_S_i
	.addrsig_sym _Z23multiply_kernel_add_cpuPiS_S_i
	.addrsig_sym _Z23multiply_cpu_add_kernelPiS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15multiply_kernelPiS_S_i ; -- Begin function _Z15multiply_kernelPiS_S_i
	.globl	_Z15multiply_kernelPiS_S_i
	.p2align	8
	.type	_Z15multiply_kernelPiS_S_i,@function
_Z15multiply_kernelPiS_S_i:             ; @_Z15multiply_kernelPiS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	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 .LBB0_5
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b64 s[0:1], s[0:1], 0x10
	s_mov_b32 s2, exec_lo
	s_mov_b32 s3, 0
	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 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v0, v0, v2
.LBB0_2:                                ; %ComputeLoop
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s4, s2
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s5, v0, s4
	s_lshl_b32 s4, 1, s4
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 s2, s2, s4
	s_add_i32 s3, s3, s5
	s_cmp_lg_u32 s2, 0
	s_cbranch_scc1 .LBB0_2
; %bb.3:                                ; %ComputeEnd
	v_mbcnt_lo_u32_b32 v0, exec_lo, 0
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v0
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB0_5
; %bb.4:
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s3
	global_atomic_add_u32 v0, v1, s[0:1]
.LBB0_5:                                ; %Flow20
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15multiply_kernelPiS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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_end0:
	.size	_Z15multiply_kernelPiS_S_i, .Lfunc_end0-_Z15multiply_kernelPiS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 256
; 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	_Z23multiply_kernel_add_cpuPiS_S_i ; -- Begin function _Z23multiply_kernel_add_cpuPiS_S_i
	.globl	_Z23multiply_kernel_add_cpuPiS_S_i
	.p2align	8
	.type	_Z23multiply_kernel_add_cpuPiS_S_i,@function
_Z23multiply_kernel_add_cpuPiS_S_i:     ; @_Z23multiply_kernel_add_cpuPiS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	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[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b64 s[0:1], s[0:1], 0x10
	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 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v2, v3, v2
	global_store_b32 v[0:1], v2, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23multiply_kernel_add_cpuPiS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 6
		.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	_Z23multiply_kernel_add_cpuPiS_S_i, .Lfunc_end1-_Z23multiply_kernel_add_cpuPiS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 184
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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	_Z23multiply_cpu_add_kernelPiS_i ; -- Begin function _Z23multiply_cpu_add_kernelPiS_i
	.globl	_Z23multiply_cpu_add_kernelPiS_i
	.p2align	8
	.type	_Z23multiply_cpu_add_kernelPiS_i,@function
_Z23multiply_cpu_add_kernelPiS_i:       ; @_Z23multiply_cpu_add_kernelPiS_i
; %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 .LBB2_5
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_mov_b32 s4, exec_lo
	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
	s_mov_b32 s0, 0
	global_load_b32 v0, v[0:1], off
.LBB2_2:                                ; %ComputeLoop
                                        ; =>This Inner Loop Header: Depth=1
	s_ctz_i32_b32 s1, s4
	s_waitcnt vmcnt(0)
	v_readlane_b32 s5, v0, s1
	s_lshl_b32 s1, 1, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 s4, s4, s1
	s_add_i32 s0, s0, s5
	s_cmp_lg_u32 s4, 0
	s_cbranch_scc1 .LBB2_2
; %bb.3:                                ; %ComputeEnd
	v_mbcnt_lo_u32_b32 v0, exec_lo, 0
	s_mov_b32 s1, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v0
	s_xor_b32 s1, exec_lo, s1
	s_cbranch_execz .LBB2_5
; %bb.4:
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s0
	global_atomic_add_u32 v0, v1, s[2:3]
.LBB2_5:                                ; %Flow14
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23multiply_cpu_add_kernelPiS_i
		.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_end2:
	.size	_Z23multiply_cpu_add_kernelPiS_i, .Lfunc_end2-_Z23multiply_cpu_add_kernelPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 216
; 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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15multiply_kernelPiS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15multiply_kernelPiS_S_i.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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23multiply_kernel_add_cpuPiS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23multiply_kernel_add_cpuPiS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23multiply_cpu_add_kernelPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23multiply_cpu_add_kernelPiS_i.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
