#include <stdio.h>
#include <cuda.h>
#include <cmath>

float * mat_1d;
float * mat_2d;
float * mat_3d;

float * mat_1;
float * mat_2;
float * mat_3;

const int N = 5;

// initialize function
void init() {
	int size = N*N;

	// Allocate CPU Memory
	mat_1 = (float*) malloc(size*sizeof(float));
	mat_2 = (float*) malloc(size*sizeof(float));
	mat_3 = (float*) malloc(size*sizeof(float));

	// Allocate GPU Memory
    cudaMalloc((void**)&mat_1d, size*sizeof(float));
	cudaMalloc((void**)&mat_2d, size*sizeof(float));
	cudaMalloc((void**)&mat_3d, size*sizeof(float));

	// Initialize CPU Memory
	for (size_t i = 0; i < size; i++) {
		mat_1[i] = 3.2*(i/5) - 1.2*(i%5) + 7.5;
		mat_2[i] = 1.6*(i/5) + 5.5*(i%5) - 2.2;
		mat_3[i] = 0;
	}

	// Initialize GPU Memory
	cudaMemcpy(mat_1d, mat_1, size*sizeof(float), cudaMemcpyHostToDevice);
	cudaMemcpy(mat_2d, mat_2, size*sizeof(float), cudaMemcpyHostToDevice);
	cudaMemcpy(mat_3d, mat_3, size*sizeof(float), cudaMemcpyHostToDevice);
}

void cleanUp() {
	free(mat_1);
	free(mat_2);
	free(mat_3);

	cudaFree(mat_1d);
	cudaFree(mat_2d);
	cudaFree(mat_3d);
}

void printResults(float* m) {
	for (size_t i = 0; i < N; i++) {
		fprintf(stdout, "[%f, %f, %f, %f, %f] \n", m[i*N], m[i*N+1], m[i*N+2], m[i*N+3], m[i*N+4]);
	}
	fprintf(stdout, "\n");
}

void printResultsGPU(float* md) {
	float* temp = (float*) malloc(N*N*sizeof(float));

	cudaMemcpy(temp, md, N*N*sizeof(float), cudaMemcpyDeviceToHost);

	printResults(temp);

	free(temp);
}

__global__ void mat_add(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	m3[index] = m1[index] + m2[index];
}

__global__ void mat_sub(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	m3[index] = m1[index] - m2[index];
}

__global__ void mat_mult(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	// Initialize the result value
	float value = 0.0f;

	// Determine the row and column number of the current element
	int row = threadIdx.x;
	int col = threadIdx.y;

	// Loop through and compute the dot product needed for this element
	for (size_t i = 0; i < N; i++) {
		value += m1[row*N + i] * m2[i*N + col];
	}

	m3[index] = value;
}

void mat_add_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			m3[N*i+j] = m1[N*i+j] + m2[N*i+j];
		}
	}
}

void mat_sub_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			m3[N*i+j] = m1[N*i+j] - m2[N*i+j];
		}
	}
}

void mat_mult_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			float sum = 0;
			for (size_t k = 0; k < N; k++) {
				float a = m1[N*i + k];
				float b = m2[k*N + j];
				sum += a * b;
			}
			m3[N*i+j] = sum;
		}
	}
}

int main(int argc, char** argv) {
	init();

	dim3 dimBlock(N,N);

	// Add events for profiling
	cudaEvent_t beginEvent;
	cudaEvent_t endEvent;
	cudaEventCreate( &beginEvent );
	cudaEventCreate( &endEvent );
	float timeValue;

	//fprintf(stdout, "GPU: \n");

	// Do matrix addition on the GPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_add<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	cudaThreadSynchronize();
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_add kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	// Do matrix subtraction on the GPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_sub<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	cudaThreadSynchronize();
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_sub kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	// Do matrix multiplication on the GPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_mult<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	cudaThreadSynchronize();
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_mult kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	//fprintf(stdout, "CPU: \n");

	// Do matrix addition on the CPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_add_cpu(mat_1, mat_2, mat_3);
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_add kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	// Do matrix subtraction on the CPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_sub_cpu(mat_1, mat_2, mat_3);
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_sub kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	// Do matrix multiplication on the CPU and see the result
	cudaEventRecord(beginEvent, 0);
	mat_mult_cpu(mat_1, mat_2, mat_3);
	cudaEventRecord(endEvent, 0);
	cudaEventSynchronize(endEvent);
	cudaEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_mult kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	cleanUp();

	while (true) {

	}

	return 0;
}

	.file	"tmpxft_00254505_00000000-6_matrix_math.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2037:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2037:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z4initv
	.type	_Z4initv, @function
_Z4initv:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rdx
	.cfi_def_cfa_offset 16
	movl	$100, %edi
	call	malloc@PLT
	movl	$100, %edi
	movq	%rax, mat_1(%rip)
	call	malloc@PLT
	movl	$100, %edi
	movq	%rax, mat_2(%rip)
	call	malloc@PLT
	movl	$100, %esi
	leaq	mat_1d(%rip), %rdi
	movq	%rax, mat_3(%rip)
	call	cudaMalloc@PLT
	movl	$100, %esi
	leaq	mat_2d(%rip), %rdi
	call	cudaMalloc@PLT
	movl	$100, %esi
	leaq	mat_3d(%rip), %rdi
	call	cudaMalloc@PLT
	movq	mat_1(%rip), %rsi
	xorl	%ecx, %ecx
	movq	mat_2(%rip), %r9
	movq	mat_3(%rip), %r8
	movsd	.LC1(%rip), %xmm7
	movl	$5, %edi
	movsd	.LC2(%rip), %xmm6
	movsd	.LC3(%rip), %xmm5
	movsd	.LC4(%rip), %xmm4
	movsd	.LC5(%rip), %xmm3
	movsd	.LC0(%rip), %xmm8
.L3:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%rdi
	cvtsi2sdq	%rax, %xmm0
	cvtsi2sdq	%rdx, %xmm2
	movaps	%xmm0, %xmm1
	mulsd	%xmm8, %xmm1
	movaps	%xmm2, %xmm9
	mulsd	%xmm7, %xmm9
	mulsd	%xmm5, %xmm0
	mulsd	%xmm4, %xmm2
	subsd	%xmm9, %xmm1
	addsd	%xmm2, %xmm0
	addsd	%xmm6, %xmm1
	subsd	%xmm3, %xmm0
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, (%rsi,%rcx,4)
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r9,%rcx,4)
	movl	$0x00000000, (%r8,%rcx,4)
	incq	%rcx
	cmpq	$25, %rcx
	jne	.L3
	movq	mat_1d(%rip), %rdi
	movl	$1, %ecx
	movl	$100, %edx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$100, %edx
	movq	mat_2(%rip), %rsi
	movq	mat_2d(%rip), %rdi
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$100, %edx
	movq	mat_3(%rip), %rsi
	movq	mat_3d(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z4initv, .-_Z4initv
	.globl	_Z7cleanUpv
	.type	_Z7cleanUpv, @function
_Z7cleanUpv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	mat_1(%rip), %rdi
	call	free@PLT
	movq	mat_2(%rip), %rdi
	call	free@PLT
	movq	mat_3(%rip), %rdi
	call	free@PLT
	movq	mat_1d(%rip), %rdi
	call	cudaFree@PLT
	movq	mat_2d(%rip), %rdi
	call	cudaFree@PLT
	movq	mat_3d(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	cudaFree@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z7cleanUpv, .-_Z7cleanUpv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC7:
	.string	"[%f, %f, %f, %f, %f] \n"
.LC8:
	.string	"\n"
	.text
	.globl	_Z12printResultsPf
	.type	_Z12printResultsPf, @function
_Z12printResultsPf:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC7(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	100(%rdi), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
.L10:
	cvtss2sd	(%rbx), %xmm0
	cvtss2sd	16(%rbx), %xmm4
	movq	%r12, %rdx
	movb	$5, %al
	movq	stdout(%rip), %rdi
	cvtss2sd	12(%rbx), %xmm3
	cvtss2sd	8(%rbx), %xmm2
	cvtss2sd	4(%rbx), %xmm1
	movl	$2, %esi
	addq	$20, %rbx
	call	__fprintf_chk@PLT
	cmpq	%rbx, %rbp
	jne	.L10
	movq	stdout(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	movl	$2, %esi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	leaq	.LC8(%rip), %rdx
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	__fprintf_chk@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z12printResultsPf, .-_Z12printResultsPf
	.globl	_Z15printResultsGPUPf
	.type	_Z15printResultsGPUPf, @function
_Z15printResultsGPUPf:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	movl	$100, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movl	$100, %edx
	movq	%rbp, %rsi
	movl	$2, %ecx
	movq	%rax, %rbx
	movq	%rax, %rdi
	call	cudaMemcpy@PLT
	movq	%rbx, %rdi
	call	_Z12printResultsPf
	popq	%rdx
	.cfi_def_cfa_offset 24
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z15printResultsGPUPf, .-_Z15printResultsGPUPf
	.globl	_Z11mat_add_cpuPfS_S_
	.type	_Z11mat_add_cpuPfS_S_, @function
_Z11mat_add_cpuPfS_S_:
.LFB2031:
	.cfi_startproc
	endbr64
	xorl	%ecx, %ecx
.L16:
	leaq	0(,%rcx,4), %rax
	xorl	%r8d, %r8d
.L17:
	movss	(%rdi,%rax), %xmm0
	addss	(%rsi,%rax), %xmm0
	incq	%r8
	movss	%xmm0, (%rdx,%rax)
	addq	$4, %rax
	cmpq	$5, %r8
	jne	.L17
	addq	$5, %rcx
	cmpq	$25, %rcx
	jne	.L16
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z11mat_add_cpuPfS_S_, .-_Z11mat_add_cpuPfS_S_
	.globl	_Z11mat_sub_cpuPfS_S_
	.type	_Z11mat_sub_cpuPfS_S_, @function
_Z11mat_sub_cpuPfS_S_:
.LFB2032:
	.cfi_startproc
	endbr64
	xorl	%ecx, %ecx
.L21:
	leaq	0(,%rcx,4), %rax
	xorl	%r8d, %r8d
.L22:
	movss	(%rdi,%rax), %xmm0
	subss	(%rsi,%rax), %xmm0
	incq	%r8
	movss	%xmm0, (%rdx,%rax)
	addq	$4, %rax
	cmpq	$5, %r8
	jne	.L22
	addq	$5, %rcx
	cmpq	$25, %rcx
	jne	.L21
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z11mat_sub_cpuPfS_S_, .-_Z11mat_sub_cpuPfS_S_
	.globl	_Z12mat_mult_cpuPfS_S_
	.type	_Z12mat_mult_cpuPfS_S_, @function
_Z12mat_mult_cpuPfS_S_:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
.L26:
	xorl	%eax, %eax
	leaq	(%rdi,%rcx), %rbx
	leaq	(%rdx,%rcx), %r11
.L30:
	leaq	(%rsi,%rax,4), %r10
	xorl	%r8d, %r8d
	xorps	%xmm0, %xmm0
.L27:
	movss	(%rbx,%r8,4), %xmm1
	mulss	(%r10), %xmm1
	incq	%r8
	addq	$20, %r10
	addss	%xmm1, %xmm0
	cmpq	$5, %r8
	jne	.L27
	movss	%xmm0, (%r11,%rax,4)
	incq	%rax
	cmpq	$5, %rax
	jne	.L30
	addq	$5, %r9
	addq	$20, %rcx
	cmpq	$25, %r9
	jne	.L26
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z12mat_mult_cpuPfS_S_, .-_Z12mat_mult_cpuPfS_S_
	.globl	_Z30__device_stub__Z7mat_addPfS_S_PfS_S_
	.type	_Z30__device_stub__Z7mat_addPfS_S_PfS_S_, @function
_Z30__device_stub__Z7mat_addPfS_S_PfS_S_:
.LFB2059:
	.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
	movq	%rdx, 8(%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	8(%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	.L33
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7mat_addPfS_S_(%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
.L33:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z30__device_stub__Z7mat_addPfS_S_PfS_S_, .-_Z30__device_stub__Z7mat_addPfS_S_PfS_S_
	.globl	_Z7mat_addPfS_S_
	.type	_Z7mat_addPfS_S_, @function
_Z7mat_addPfS_S_:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z30__device_stub__Z7mat_addPfS_S_PfS_S_
	.cfi_endproc
.LFE2060:
	.size	_Z7mat_addPfS_S_, .-_Z7mat_addPfS_S_
	.globl	_Z30__device_stub__Z7mat_subPfS_S_PfS_S_
	.type	_Z30__device_stub__Z7mat_subPfS_S_PfS_S_, @function
_Z30__device_stub__Z7mat_subPfS_S_PfS_S_:
.LFB2061:
	.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
	movq	%rdx, 8(%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	8(%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	.L38
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7mat_subPfS_S_(%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
.L38:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z30__device_stub__Z7mat_subPfS_S_PfS_S_, .-_Z30__device_stub__Z7mat_subPfS_S_PfS_S_
	.globl	_Z7mat_subPfS_S_
	.type	_Z7mat_subPfS_S_, @function
_Z7mat_subPfS_S_:
.LFB2062:
	.cfi_startproc
	endbr64
	jmp	_Z30__device_stub__Z7mat_subPfS_S_PfS_S_
	.cfi_endproc
.LFE2062:
	.size	_Z7mat_subPfS_S_, .-_Z7mat_subPfS_S_
	.globl	_Z31__device_stub__Z8mat_multPfS_S_PfS_S_
	.type	_Z31__device_stub__Z8mat_multPfS_S_PfS_S_, @function
_Z31__device_stub__Z8mat_multPfS_S_PfS_S_:
.LFB2063:
	.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
	movq	%rdx, 8(%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	8(%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	.L43
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z8mat_multPfS_S_(%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
.L43:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_Z31__device_stub__Z8mat_multPfS_S_PfS_S_, .-_Z31__device_stub__Z8mat_multPfS_S_PfS_S_
	.globl	_Z8mat_multPfS_S_
	.type	_Z8mat_multPfS_S_, @function
_Z8mat_multPfS_S_:
.LFB2064:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z8mat_multPfS_S_PfS_S_
	.cfi_endproc
.LFE2064:
	.size	_Z8mat_multPfS_S_, .-_Z8mat_multPfS_S_
	.section	.rodata.str1.1
.LC9:
	.string	"GPU mat_add kernel time: %f.\n"
.LC10:
	.string	"GPU mat_sub kernel time: %f.\n"
.LC11:
	.string	"GPU mat_mult kernel time: %f.\n"
.LC12:
	.string	"CPU mat_add kernel time: %f.\n"
.LC13:
	.string	"CPU mat_sub kernel time: %f.\n"
.LC14:
	.string	"CPU mat_mult kernel time: %f.\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	_Z4initv
	leaq	16(%rsp), %rdi
	movabsq	$21474836485, %rax
	movl	$1, 40(%rsp)
	movq	%rax, 32(%rsp)
	call	cudaEventCreate@PLT
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	40(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 52(%rsp)
	movq	%rdi, 44(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L49
	movq	mat_3d(%rip), %rdx
	movq	mat_2d(%rip), %rsi
	movq	mat_1d(%rip), %rdi
	call	_Z30__device_stub__Z7mat_addPfS_S_PfS_S_
.L49:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	leaq	12(%rsp), %rbx
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC9(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3d(%rip), %rdi
	call	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	40(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 52(%rsp)
	movq	%rdi, 44(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L50
	movq	mat_3d(%rip), %rdx
	movq	mat_2d(%rip), %rsi
	movq	mat_1d(%rip), %rdi
	call	_Z30__device_stub__Z7mat_subPfS_S_PfS_S_
.L50:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC10(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3d(%rip), %rdi
	call	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	40(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 52(%rsp)
	movq	%rdi, 44(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L51
	movq	mat_3d(%rip), %rdx
	movq	mat_2d(%rip), %rsi
	movq	mat_1d(%rip), %rdi
	call	_Z31__device_stub__Z8mat_multPfS_S_PfS_S_
.L51:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC11(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3d(%rip), %rdi
	call	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	mat_3(%rip), %rdx
	movq	mat_2(%rip), %rsi
	movq	mat_1(%rip), %rdi
	call	_Z11mat_add_cpuPfS_S_
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC12(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3(%rip), %rdi
	call	_Z12printResultsPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	mat_3(%rip), %rdx
	movq	mat_2(%rip), %rsi
	movq	mat_1(%rip), %rdi
	call	_Z11mat_sub_cpuPfS_S_
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC13(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3(%rip), %rdi
	call	_Z12printResultsPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	mat_3(%rip), %rdx
	movq	mat_2(%rip), %rsi
	movq	mat_1(%rip), %rdi
	call	_Z12mat_mult_cpuPfS_S_
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	call	cudaEventElapsedTime@PLT
	movq	stdout(%rip), %rdi
	leaq	.LC14(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	mat_3(%rip), %rdi
	call	_Z12printResultsPf
	call	_Z7cleanUpv
.L52:
	jmp	.L52
	.cfi_endproc
.LFE2034:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"_Z8mat_multPfS_S_"
.LC16:
	.string	"_Z7mat_subPfS_S_"
.LC17:
	.string	"_Z7mat_addPfS_S_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2066:
	.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	.LC15(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z8mat_multPfS_S_(%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	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7mat_subPfS_S_(%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	.LC17(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7mat_addPfS_S_(%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
.LFE2066:
	.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
	.globl	mat_3
	.bss
	.align 8
	.type	mat_3, @object
	.size	mat_3, 8
mat_3:
	.zero	8
	.globl	mat_2
	.align 8
	.type	mat_2, @object
	.size	mat_2, 8
mat_2:
	.zero	8
	.globl	mat_1
	.align 8
	.type	mat_1, @object
	.size	mat_1, 8
mat_1:
	.zero	8
	.globl	mat_3d
	.align 8
	.type	mat_3d, @object
	.size	mat_3d, 8
mat_3d:
	.zero	8
	.globl	mat_2d
	.align 8
	.type	mat_2d, @object
	.size	mat_2d, 8
mat_2d:
	.zero	8
	.globl	mat_1d
	.align 8
	.type	mat_1d, @object
	.size	mat_1d, 8
mat_1d:
	.zero	8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	-1717986918
	.long	1074370969
	.align 8
.LC1:
	.long	858993459
	.long	1072902963
	.align 8
.LC2:
	.long	0
	.long	1075707904
	.align 8
.LC3:
	.long	-1717986918
	.long	1073322393
	.align 8
.LC4:
	.long	0
	.long	1075183616
	.align 8
.LC5:
	.long	-1717986918
	.long	1073846681
	.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 <cmath>

float * mat_1d;
float * mat_2d;
float * mat_3d;

float * mat_1;
float * mat_2;
float * mat_3;

const int N = 5;

// initialize function
void init() {
	int size = N*N;

	// Allocate CPU Memory
	mat_1 = (float*) malloc(size*sizeof(float));
	mat_2 = (float*) malloc(size*sizeof(float));
	mat_3 = (float*) malloc(size*sizeof(float));

	// Allocate GPU Memory
    hipMalloc((void**)&mat_1d, size*sizeof(float));
	hipMalloc((void**)&mat_2d, size*sizeof(float));
	hipMalloc((void**)&mat_3d, size*sizeof(float));

	// Initialize CPU Memory
	for (size_t i = 0; i < size; i++) {
		mat_1[i] = 3.2*(i/5) - 1.2*(i%5) + 7.5;
		mat_2[i] = 1.6*(i/5) + 5.5*(i%5) - 2.2;
		mat_3[i] = 0;
	}

	// Initialize GPU Memory
	hipMemcpy(mat_1d, mat_1, size*sizeof(float), hipMemcpyHostToDevice);
	hipMemcpy(mat_2d, mat_2, size*sizeof(float), hipMemcpyHostToDevice);
	hipMemcpy(mat_3d, mat_3, size*sizeof(float), hipMemcpyHostToDevice);
}

void cleanUp() {
	free(mat_1);
	free(mat_2);
	free(mat_3);

	hipFree(mat_1d);
	hipFree(mat_2d);
	hipFree(mat_3d);
}

void printResults(float* m) {
	for (size_t i = 0; i < N; i++) {
		fprintf(stdout, "[%f, %f, %f, %f, %f] \n", m[i*N], m[i*N+1], m[i*N+2], m[i*N+3], m[i*N+4]);
	}
	fprintf(stdout, "\n");
}

void printResultsGPU(float* md) {
	float* temp = (float*) malloc(N*N*sizeof(float));

	hipMemcpy(temp, md, N*N*sizeof(float), hipMemcpyDeviceToHost);

	printResults(temp);

	free(temp);
}

__global__ void mat_add(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	m3[index] = m1[index] + m2[index];
}

__global__ void mat_sub(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	m3[index] = m1[index] - m2[index];
}

__global__ void mat_mult(float* m1, float* m2, float* m3) {
    int index = (threadIdx.x * blockDim.x) + threadIdx.y;

	// Initialize the result value
	float value = 0.0f;

	// Determine the row and column number of the current element
	int row = threadIdx.x;
	int col = threadIdx.y;

	// Loop through and compute the dot product needed for this element
	for (size_t i = 0; i < N; i++) {
		value += m1[row*N + i] * m2[i*N + col];
	}

	m3[index] = value;
}

void mat_add_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			m3[N*i+j] = m1[N*i+j] + m2[N*i+j];
		}
	}
}

void mat_sub_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			m3[N*i+j] = m1[N*i+j] - m2[N*i+j];
		}
	}
}

void mat_mult_cpu(float* m1, float* m2, float* m3) {
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < N; j++) {
			float sum = 0;
			for (size_t k = 0; k < N; k++) {
				float a = m1[N*i + k];
				float b = m2[k*N + j];
				sum += a * b;
			}
			m3[N*i+j] = sum;
		}
	}
}

int main(int argc, char** argv) {
	init();

	dim3 dimBlock(N,N);

	// Add events for profiling
	hipEvent_t beginEvent;
	hipEvent_t endEvent;
	hipEventCreate( &beginEvent );
	hipEventCreate( &endEvent );
	float timeValue;

	//fprintf(stdout, "GPU: \n");

	// Do matrix addition on the GPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_add<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	hipDeviceSynchronize();
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_add kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	// Do matrix subtraction on the GPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_sub<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	hipDeviceSynchronize();
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_sub kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	// Do matrix multiplication on the GPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_mult<<<1,dimBlock>>>(mat_1d, mat_2d, mat_3d);
	hipDeviceSynchronize();
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "GPU mat_mult kernel time: %f.\n", timeValue); 
	printResultsGPU(mat_3d);

	//fprintf(stdout, "CPU: \n");

	// Do matrix addition on the CPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_add_cpu(mat_1, mat_2, mat_3);
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_add kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	// Do matrix subtraction on the CPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_sub_cpu(mat_1, mat_2, mat_3);
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_sub kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	// Do matrix multiplication on the CPU and see the result
	hipEventRecord(beginEvent, 0);
	mat_mult_cpu(mat_1, mat_2, mat_3);
	hipEventRecord(endEvent, 0);
	hipEventSynchronize(endEvent);
	hipEventElapsedTime(&timeValue, beginEvent, endEvent);
	fprintf(stdout, "CPU mat_mult kernel time: %f.\n", timeValue); 
	printResults(mat_3);

	cleanUp();

	while (true) {

	}

	return 0;
}

	.text
	.file	"matrix_math.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z4initv
.LCPI0_0:
	.quad	0x400999999999999a              # double 3.2000000000000002
.LCPI0_1:
	.quad	0xbff3333333333333              # double -1.2
.LCPI0_2:
	.quad	0x401e000000000000              # double 7.5
.LCPI0_3:
	.quad	0x3ff999999999999a              # double 1.6000000000000001
.LCPI0_4:
	.quad	0x4016000000000000              # double 5.5
.LCPI0_5:
	.quad	0xc00199999999999a              # double -2.2000000000000002
	.text
	.globl	_Z4initv
	.type	_Z4initv,@function
_Z4initv:                               # @_Z4initv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$100, %edi
	callq	malloc
	movq	%rax, mat_1(%rip)
	movl	$100, %edi
	callq	malloc
	movq	%rax, mat_2(%rip)
	movl	$100, %edi
	callq	malloc
	movq	%rax, mat_3(%rip)
	movl	$mat_1d, %edi
	movl	$100, %esi
	callq	hipMalloc
	movl	$mat_2d, %edi
	movl	$100, %esi
	callq	hipMalloc
	movl	$mat_3d, %edi
	movl	$100, %esi
	callq	hipMalloc
	movq	mat_1(%rip), %rsi
	movq	mat_2(%rip), %rax
	xorl	%ecx, %ecx
	movq	mat_3(%rip), %rdx
	movl	$255, %edi
	movsd	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero
	movsd	.LCPI0_2(%rip), %xmm2           # xmm2 = mem[0],zero
	movsd	.LCPI0_3(%rip), %xmm3           # xmm3 = mem[0],zero
	movsd	.LCPI0_4(%rip), %xmm4           # xmm4 = mem[0],zero
	movsd	.LCPI0_5(%rip), %xmm5           # xmm5 = mem[0],zero
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
	movl	%ecx, %r8d
	andl	%edi, %r8d
	imull	$205, %r8d, %r8d
	shrl	$10, %r8d
	leal	(%r8,%r8,4), %r9d
	xorps	%xmm6, %xmm6
	cvtsi2sd	%r8d, %xmm6
	movapd	%xmm6, %xmm7
	mulsd	%xmm0, %xmm7
	movl	%ecx, %r8d
	subl	%r9d, %r8d
	andl	%edi, %r8d
	xorps	%xmm8, %xmm8
	cvtsi2sd	%r8d, %xmm8
	movapd	%xmm8, %xmm9
	mulsd	%xmm1, %xmm9
	addsd	%xmm7, %xmm9
	addsd	%xmm2, %xmm9
	xorps	%xmm7, %xmm7
	cvtsd2ss	%xmm9, %xmm7
	movss	%xmm7, (%rsi,%rcx,4)
	mulsd	%xmm3, %xmm6
	mulsd	%xmm4, %xmm8
	addsd	%xmm6, %xmm8
	addsd	%xmm5, %xmm8
	xorps	%xmm6, %xmm6
	cvtsd2ss	%xmm8, %xmm6
	movss	%xmm6, (%rax,%rcx,4)
	movl	$0, (%rdx,%rcx,4)
	incq	%rcx
	cmpq	$25, %rcx
	jne	.LBB0_1
# %bb.2:
	movq	mat_1d(%rip), %rdi
	movl	$100, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	mat_2d(%rip), %rdi
	movq	mat_2(%rip), %rsi
	movl	$100, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	mat_3d(%rip), %rdi
	movq	mat_3(%rip), %rsi
	movl	$100, %edx
	movl	$1, %ecx
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end0:
	.size	_Z4initv, .Lfunc_end0-_Z4initv
	.cfi_endproc
                                        # -- End function
	.globl	_Z7cleanUpv                     # -- Begin function _Z7cleanUpv
	.type	_Z7cleanUpv,@function
_Z7cleanUpv:                            # @_Z7cleanUpv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	mat_1(%rip), %rdi
	callq	free
	movq	mat_2(%rip), %rdi
	callq	free
	movq	mat_3(%rip), %rdi
	callq	free
	movq	mat_1d(%rip), %rdi
	callq	hipFree
	movq	mat_2d(%rip), %rdi
	callq	hipFree
	movq	mat_3d(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	hipFree                         # TAILCALL
.Lfunc_end1:
	.size	_Z7cleanUpv, .Lfunc_end1-_Z7cleanUpv
	.cfi_endproc
                                        # -- End function
	.globl	_Z12printResultsPf              # -- Begin function _Z12printResultsPf
	.type	_Z12printResultsPf,@function
_Z12printResultsPf:                     # @_Z12printResultsPf
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movl	$16, %r14d
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	-16(%rbx,%r14), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	-12(%rbx,%r14), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	-8(%rbx,%r14), %xmm2
	xorps	%xmm3, %xmm3
	cvtss2sd	-4(%rbx,%r14), %xmm3
	xorps	%xmm4, %xmm4
	cvtss2sd	(%rbx,%r14), %xmm4
	movl	$.L.str, %esi
	movb	$5, %al
	callq	fprintf
	addq	$20, %r14
	cmpq	$116, %r14
	jne	.LBB2_1
# %bb.2:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	fputc@PLT                       # TAILCALL
.Lfunc_end2:
	.size	_Z12printResultsPf, .Lfunc_end2-_Z12printResultsPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z15printResultsGPUPf           # -- Begin function _Z15printResultsGPUPf
	.type	_Z15printResultsGPUPf,@function
_Z15printResultsGPUPf:                  # @_Z15printResultsGPUPf
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	movl	$100, %edi
	callq	malloc
	movq	%rax, %r14
	movl	$100, %edx
	movq	%rax, %rdi
	movq	%rbx, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r14, %rdi
	callq	_Z12printResultsPf
	movq	%r14, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end3:
	.size	_Z15printResultsGPUPf, .Lfunc_end3-_Z15printResultsGPUPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__mat_addPfS_S_ # -- Begin function _Z22__device_stub__mat_addPfS_S_
	.type	_Z22__device_stub__mat_addPfS_S_,@function
_Z22__device_stub__mat_addPfS_S_:       # @_Z22__device_stub__mat_addPfS_S_
	.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	24(%rsp), %rsi
	movq	%rdx, (%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	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	$_Z7mat_addPfS_S_, %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_end4:
	.size	_Z22__device_stub__mat_addPfS_S_, .Lfunc_end4-_Z22__device_stub__mat_addPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__mat_subPfS_S_ # -- Begin function _Z22__device_stub__mat_subPfS_S_
	.type	_Z22__device_stub__mat_subPfS_S_,@function
_Z22__device_stub__mat_subPfS_S_:       # @_Z22__device_stub__mat_subPfS_S_
	.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	24(%rsp), %rsi
	movq	%rdx, (%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	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	$_Z7mat_subPfS_S_, %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_end5:
	.size	_Z22__device_stub__mat_subPfS_S_, .Lfunc_end5-_Z22__device_stub__mat_subPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z23__device_stub__mat_multPfS_S_ # -- Begin function _Z23__device_stub__mat_multPfS_S_
	.type	_Z23__device_stub__mat_multPfS_S_,@function
_Z23__device_stub__mat_multPfS_S_:      # @_Z23__device_stub__mat_multPfS_S_
	.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	24(%rsp), %rsi
	movq	%rdx, (%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	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	$_Z8mat_multPfS_S_, %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_end6:
	.size	_Z23__device_stub__mat_multPfS_S_, .Lfunc_end6-_Z23__device_stub__mat_multPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z11mat_add_cpuPfS_S_           # -- Begin function _Z11mat_add_cpuPfS_S_
	.type	_Z11mat_add_cpuPfS_S_,@function
_Z11mat_add_cpuPfS_S_:                  # @_Z11mat_add_cpuPfS_S_
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
.LBB7_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_2 Depth 2
	xorl	%ecx, %ecx
.LBB7_2:                                #   Parent Loop BB7_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rdi,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	(%rsi,%rcx,4), %xmm0
	movss	%xmm0, (%rdx,%rcx,4)
	incq	%rcx
	cmpq	$5, %rcx
	jne	.LBB7_2
# %bb.3:                                #   in Loop: Header=BB7_1 Depth=1
	incq	%rax
	addq	$20, %rdx
	addq	$20, %rsi
	addq	$20, %rdi
	cmpq	$5, %rax
	jne	.LBB7_1
# %bb.4:
	retq
.Lfunc_end7:
	.size	_Z11mat_add_cpuPfS_S_, .Lfunc_end7-_Z11mat_add_cpuPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z11mat_sub_cpuPfS_S_           # -- Begin function _Z11mat_sub_cpuPfS_S_
	.type	_Z11mat_sub_cpuPfS_S_,@function
_Z11mat_sub_cpuPfS_S_:                  # @_Z11mat_sub_cpuPfS_S_
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
.LBB8_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB8_2 Depth 2
	xorl	%ecx, %ecx
.LBB8_2:                                #   Parent Loop BB8_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rdi,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	subss	(%rsi,%rcx,4), %xmm0
	movss	%xmm0, (%rdx,%rcx,4)
	incq	%rcx
	cmpq	$5, %rcx
	jne	.LBB8_2
# %bb.3:                                #   in Loop: Header=BB8_1 Depth=1
	incq	%rax
	addq	$20, %rdx
	addq	$20, %rsi
	addq	$20, %rdi
	cmpq	$5, %rax
	jne	.LBB8_1
# %bb.4:
	retq
.Lfunc_end8:
	.size	_Z11mat_sub_cpuPfS_S_, .Lfunc_end8-_Z11mat_sub_cpuPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z12mat_mult_cpuPfS_S_          # -- Begin function _Z12mat_mult_cpuPfS_S_
	.type	_Z12mat_mult_cpuPfS_S_,@function
_Z12mat_mult_cpuPfS_S_:                 # @_Z12mat_mult_cpuPfS_S_
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
.LBB9_1:                                # %.preheader21
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_2 Depth 2
                                        #       Child Loop BB9_3 Depth 3
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rdx,%rcx,4), %rcx
	movq	%rsi, %r8
	xorl	%r9d, %r9d
.LBB9_2:                                # %.preheader
                                        #   Parent Loop BB9_1 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_3 Depth 3
	xorps	%xmm0, %xmm0
	movq	%r8, %r10
	xorl	%r11d, %r11d
.LBB9_3:                                #   Parent Loop BB9_1 Depth=1
                                        #     Parent Loop BB9_2 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%rdi,%r11,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r10), %xmm1
	addss	%xmm1, %xmm0
	incq	%r11
	addq	$20, %r10
	cmpq	$5, %r11
	jne	.LBB9_3
# %bb.4:                                #   in Loop: Header=BB9_2 Depth=2
	movss	%xmm0, (%rcx,%r9,4)
	incq	%r9
	addq	$4, %r8
	cmpq	$5, %r9
	jne	.LBB9_2
# %bb.5:                                #   in Loop: Header=BB9_1 Depth=1
	incq	%rax
	addq	$20, %rdi
	cmpq	$5, %rax
	jne	.LBB9_1
# %bb.6:
	retq
.Lfunc_end9:
	.size	_Z12mat_mult_cpuPfS_S_, .Lfunc_end9-_Z12mat_mult_cpuPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movabsq	$21474836485, %rbx              # imm = 0x500000005
	movabsq	$4294967297, %r14               # imm = 0x100000001
	callq	_Z4initv
	leaq	16(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movq	(%r15), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_2
# %bb.1:
	movq	mat_1d(%rip), %rdi
	movq	mat_2d(%rip), %rsi
	movq	mat_3d(%rip), %rdx
	callq	_Z22__device_stub__mat_addPfS_S_
.LBB10_2:
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	cvtss2sd	(%r15), %xmm0
	movl	$.L.str.2, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3d(%rip), %rdi
	callq	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_4
# %bb.3:
	movq	mat_1d(%rip), %rdi
	movq	mat_2d(%rip), %rsi
	movq	mat_3d(%rip), %rdx
	callq	_Z22__device_stub__mat_subPfS_S_
.LBB10_4:
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15), %xmm0
	movl	$.L.str.3, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3d(%rip), %rdi
	callq	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB10_6
# %bb.5:
	movq	mat_1d(%rip), %rdi
	movq	mat_2d(%rip), %rsi
	movq	mat_3d(%rip), %rdx
	callq	_Z23__device_stub__mat_multPfS_S_
.LBB10_6:
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.4, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3d(%rip), %rdi
	callq	_Z15printResultsGPUPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	mat_1(%rip), %rax
	movq	mat_2(%rip), %rcx
	movq	mat_3(%rip), %rdx
.LBB10_7:                               # %.preheader.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_8 Depth 2
	xorl	%esi, %esi
.LBB10_8:                               #   Parent Loop BB10_7 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rax,%rsi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	(%rcx,%rsi,4), %xmm0
	movss	%xmm0, (%rdx,%rsi,4)
	incq	%rsi
	cmpq	$5, %rsi
	jne	.LBB10_8
# %bb.9:                                #   in Loop: Header=BB10_7 Depth=1
	incq	%r14
	addq	$20, %rdx
	addq	$20, %rcx
	addq	$20, %rax
	cmpq	$5, %r14
	jne	.LBB10_7
# %bb.10:                               # %_Z11mat_add_cpuPfS_S_.exit
	movq	8(%rsp), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.5, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3(%rip), %rdi
	callq	_Z12printResultsPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	mat_1(%rip), %rax
	movq	mat_2(%rip), %rcx
	movq	mat_3(%rip), %rdx
.LBB10_11:                              # %.preheader.i19
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_12 Depth 2
	xorl	%esi, %esi
.LBB10_12:                              #   Parent Loop BB10_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rax,%rsi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	subss	(%rcx,%rsi,4), %xmm0
	movss	%xmm0, (%rdx,%rsi,4)
	incq	%rsi
	cmpq	$5, %rsi
	jne	.LBB10_12
# %bb.13:                               #   in Loop: Header=BB10_11 Depth=1
	incq	%r14
	addq	$20, %rdx
	addq	$20, %rcx
	addq	$20, %rax
	cmpq	$5, %r14
	jne	.LBB10_11
# %bb.14:                               # %_Z11mat_sub_cpuPfS_S_.exit
	movq	8(%rsp), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.6, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3(%rip), %rdi
	callq	_Z12printResultsPf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	mat_1(%rip), %rax
	movq	mat_2(%rip), %rcx
	movq	mat_3(%rip), %rdx
.LBB10_15:                              # %.preheader21.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_16 Depth 2
                                        #       Child Loop BB10_17 Depth 3
	leaq	(%r14,%r14,4), %rsi
	leaq	(%rdx,%rsi,4), %rsi
	movq	%rcx, %rdi
	xorl	%r8d, %r8d
.LBB10_16:                              # %.preheader.i24
                                        #   Parent Loop BB10_15 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB10_17 Depth 3
	xorps	%xmm0, %xmm0
	movq	%rdi, %r9
	xorl	%r10d, %r10d
.LBB10_17:                              #   Parent Loop BB10_15 Depth=1
                                        #     Parent Loop BB10_16 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%rax,%r10,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r9), %xmm1
	addss	%xmm1, %xmm0
	incq	%r10
	addq	$20, %r9
	cmpq	$5, %r10
	jne	.LBB10_17
# %bb.18:                               #   in Loop: Header=BB10_16 Depth=2
	movss	%xmm0, (%rsi,%r8,4)
	incq	%r8
	addq	$4, %rdi
	cmpq	$5, %r8
	jne	.LBB10_16
# %bb.19:                               #   in Loop: Header=BB10_15 Depth=1
	incq	%r14
	addq	$20, %rax
	cmpq	$5, %r14
	jne	.LBB10_15
# %bb.20:                               # %_Z12mat_mult_cpuPfS_S_.exit
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.7, %esi
	movb	$1, %al
	callq	fprintf
	movq	mat_3(%rip), %rdi
	callq	_Z12printResultsPf
	callq	_Z7cleanUpv
.Lfunc_end10:
	.size	main, .Lfunc_end10-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	.LBB11_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB11_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7mat_addPfS_S_, %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	$_Z7mat_subPfS_S_, %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	$_Z8mat_multPfS_S_, %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_end11:
	.size	__hip_module_ctor, .Lfunc_end11-__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	.LBB12_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
.LBB12_2:
	retq
.Lfunc_end12:
	.size	__hip_module_dtor, .Lfunc_end12-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	mat_1d,@object                  # @mat_1d
	.bss
	.globl	mat_1d
	.p2align	3, 0x0
mat_1d:
	.quad	0
	.size	mat_1d, 8

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

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

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

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"[%f, %f, %f, %f, %f] \n"
	.size	.L.str, 23

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

	.type	_Z7mat_subPfS_S_,@object        # @_Z7mat_subPfS_S_
	.globl	_Z7mat_subPfS_S_
	.p2align	3, 0x0
_Z7mat_subPfS_S_:
	.quad	_Z22__device_stub__mat_subPfS_S_
	.size	_Z7mat_subPfS_S_, 8

	.type	_Z8mat_multPfS_S_,@object       # @_Z8mat_multPfS_S_
	.globl	_Z8mat_multPfS_S_
	.p2align	3, 0x0
_Z8mat_multPfS_S_:
	.quad	_Z23__device_stub__mat_multPfS_S_
	.size	_Z8mat_multPfS_S_, 8

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"GPU mat_add kernel time: %f.\n"
	.size	.L.str.2, 30

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"GPU mat_sub kernel time: %f.\n"
	.size	.L.str.3, 30

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"GPU mat_mult kernel time: %f.\n"
	.size	.L.str.4, 31

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"CPU mat_add kernel time: %f.\n"
	.size	.L.str.5, 30

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"CPU mat_sub kernel time: %f.\n"
	.size	.L.str.6, 30

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"CPU mat_mult kernel time: %f.\n"
	.size	.L.str.7, 31

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z7mat_addPfS_S_"
	.size	.L__unnamed_1, 17

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z7mat_subPfS_S_"
	.size	.L__unnamed_2, 17

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z8mat_multPfS_S_"
	.size	.L__unnamed_3, 18

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z22__device_stub__mat_addPfS_S_
	.addrsig_sym _Z22__device_stub__mat_subPfS_S_
	.addrsig_sym _Z23__device_stub__mat_multPfS_S_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym mat_1d
	.addrsig_sym mat_2d
	.addrsig_sym mat_3d
	.addrsig_sym _Z7mat_addPfS_S_
	.addrsig_sym _Z7mat_subPfS_S_
	.addrsig_sym _Z8mat_multPfS_S_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7mat_addPfS_S_        ; -- Begin function _Z7mat_addPfS_S_
	.globl	_Z7mat_addPfS_S_
	.p2align	8
	.type	_Z7mat_addPfS_S_,@function
_Z7mat_addPfS_S_:                       ; @_Z7mat_addPfS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x0
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_u32_u24_e32 v1, s2, v1
	v_add_lshl_u32 v0, v1, v0, 2
	s_clause 0x1
	global_load_b32 v1, v0, s[4:5]
	global_load_b32 v2, v0, s[6:7]
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v1, v1, v2
	global_store_b32 v0, v1, s[0:1]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7mat_addPfS_S_
		.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 1
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.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	_Z7mat_addPfS_S_, .Lfunc_end0-_Z7mat_addPfS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 120
; NumSgprs: 8
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; 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: 1
	.text
	.protected	_Z7mat_subPfS_S_        ; -- Begin function _Z7mat_subPfS_S_
	.globl	_Z7mat_subPfS_S_
	.p2align	8
	.type	_Z7mat_subPfS_S_,@function
_Z7mat_subPfS_S_:                       ; @_Z7mat_subPfS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x0
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_u32_u24_e32 v1, s2, v1
	v_add_lshl_u32 v0, v1, v0, 2
	s_clause 0x1
	global_load_b32 v1, v0, s[4:5]
	global_load_b32 v2, v0, s[6:7]
	s_waitcnt vmcnt(0)
	v_sub_f32_e32 v1, v1, v2
	global_store_b32 v0, v1, s[0:1]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7mat_subPfS_S_
		.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 1
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.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	_Z7mat_subPfS_S_, .Lfunc_end1-_Z7mat_subPfS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 120
; NumSgprs: 8
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; 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: 1
	.text
	.protected	_Z8mat_multPfS_S_       ; -- Begin function _Z8mat_multPfS_S_
	.globl	_Z8mat_multPfS_S_
	.p2align	8
	.type	_Z8mat_multPfS_S_,@function
_Z8mat_multPfS_S_:                      ; @_Z8mat_multPfS_S_
; %bb.0:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	v_and_b32_e32 v4, 0x3ff, v0
	v_bfe_u32 v5, v0, 10, 10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_u32_u24_e32 v1, 5, v4
	v_lshlrev_b32_e32 v7, 2, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_lshlrev_b32_e32 v6, 2, v1
	s_waitcnt lgkmcnt(0)
	global_load_b128 v[0:3], v6, s[4:5]
	s_clause 0x3
	global_load_b32 v8, v7, s[6:7]
	global_load_b32 v9, v7, s[6:7] offset:20
	global_load_b32 v10, v7, s[6:7] offset:40
	global_load_b32 v11, v7, s[6:7] offset:60
	global_load_b32 v6, v6, s[4:5] offset:16
	global_load_b32 v7, v7, s[6:7] offset:80
	s_load_b32 s0, s[0:1], 0x24
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, s0, 0xffff
	s_waitcnt vmcnt(5)
	v_fma_f32 v0, v0, v8, 0
	s_waitcnt vmcnt(4)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v0, v1, v9
	v_mul_u32_u24_e32 v1, s0, v4
	s_waitcnt vmcnt(3)
	v_fmac_f32_e32 v0, v2, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_lshl_u32 v1, v1, v5, 2
	s_waitcnt vmcnt(2)
	v_fmac_f32_e32 v0, v3, v11
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v0, v6, v7
	global_store_b32 v1, v0, s[2:3]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8mat_multPfS_S_
		.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 1
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.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	_Z8mat_multPfS_S_, .Lfunc_end2-_Z8mat_multPfS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 228
; NumSgprs: 8
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 12
; 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: 1
	.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:     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:           _Z7mat_addPfS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z7mat_addPfS_S_.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
      - .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:     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:           _Z7mat_subPfS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z7mat_subPfS_S_.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
      - .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:     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:           _Z8mat_multPfS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z8mat_multPfS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
