#include "cuda_runtime.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
//int N = 0;

__global__
void matrix_mult_1(int *a, int ra, int ca, int *b, int rb, int cb, int *c )
{
   
   for( int i = 0;i<ra;i++)
   {
		for(int j=0;j<cb;j++)
		{
		
		   int prod = a[i * ca + threadIdx.x] * b[threadIdx.x * cb + j];
		   atomicAdd(c + (i * cb + j), prod);
		}
   }
}

__global__
void matrix_mult_2(int *a, int ra, int ca, int *b, int rb, int cb, int *c )
{
   
   for(int k = 0;k<ca;k++)
   {
		c[blockIdx.x * cb + blockIdx.y] += a[blockIdx.x * ca + k] * b[k * cb + blockIdx.y]; 
   }
}

void cpu_matrix_multiplication(int *A, int *B, int *C, int ra, int ca, int rb, int cb)
{
	for(int i=0 ; i < ra;i++)
	{
		for( int j=0; j < cb; j++)
		{
			C[i*cb + j] = 0;
			for(int k=0; k<ca;k++)
			{
				C[i*cb + j] += A[i*ca + k] * B[ k * cb + j];
			}
		}
	}
} 
 
 
 
void fillMatrix(int *mat, int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			mat[i*columns + j] = rand( ) % 10;
		}
    }
}
 
void printMatrix(int *mat,int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			printf("%d ",mat[i*columns + j]);
		}
		printf("\n");
    }
}

int verifyGPUMultiplication(int *c,int *d, int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			if(c[i*columns + j] != d[i*columns + j])
			{
				printf("C: %d, D: %d ",c[i*columns + j], d[i*columns + j]);
				return 0;
			}
		}
	}
	return 1;
}
 
int main( int argc, char *argv[] )
{

   int *a, *b, *c, *d,*e;			// host copies of a, b, c
   int *dev_a, *dev_b, *dev_c,*dev_d;		// device copies of a, b, c
   
   /*  My Code */
	//int size = N * sizeof( int );	// space for N integers

	if(argc < 5) {
      printf("The number of arguments is insufficient.");
      return -1;
   }

   
   // dimensions of the matrices
	int ra = atoi(argv[1]);
	int ca = atoi(argv[2]);
	
	//N = ca;
	
	int a_size = ra * ca * sizeof(int);
	
	int rb = atoi(argv[3]);
	int cb = atoi(argv[4]);
	
	int b_size = rb * cb * sizeof(int);
	
	int c_size = ra * cb; 
   
   
   

   // allocate host copies of a, b, c
   a = ( int * ) malloc( a_size );
   b = ( int * ) malloc( b_size );
   c = ( int * ) calloc( c_size, sizeof(int));
   d = ( int * ) calloc( c_size, sizeof(int));
   e = ( int * ) calloc( c_size, sizeof(int));

   // allocate device copies of a, b, c
   cudaMalloc( ( void** ) &dev_a, a_size );
   cudaMalloc( ( void** ) &dev_b, b_size );
   cudaMalloc( ( void** ) &dev_c, c_size * sizeof(int) );
   cudaMalloc( ( void** ) &dev_d, c_size * sizeof(int) );

   // initialize host copies of a, b
   fillMatrix(a,ra,ca);
   fillMatrix(b,rb,cb);

   /*
   //printing Matrices
   printf("Matrix A: \n");
   printMatrix(a,ra,ca);
   printf("\n");
   
   printf("Matrix B: \n");
   printMatrix(b,rb,cb);
   printf("\n");
   */
   // copy inputs to device
   cudaMemcpy( dev_a, a, a_size, cudaMemcpyHostToDevice );
   cudaMemcpy( dev_b, b, b_size, cudaMemcpyHostToDevice );

   // launch add( ) kernel on GPU, passing parameters
	
   int start = clock();
   matrix_mult_1<<< 1,ca>>>(dev_a, ra, ca, dev_b, rb, cb, dev_c );    
   int end = clock();
   printf("Time taken for GPU Multiplication flavor 1: %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   
   // copy device result back to host copy of c
   cudaMemcpy( c, dev_c, c_size * sizeof(int) , cudaMemcpyDeviceToHost );
   
   
   dim3 blocks(ra, cb);
   start = clock();
   matrix_mult_2<<< blocks,1>>>(dev_a, ra, ca, dev_b, rb, cb, dev_d );    
   end = clock();
   printf("Time taken for GPU Multiplication flavor 2: %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   
   // copy device result back to host copy of c
   cudaMemcpy( d, dev_d, c_size * sizeof(int) , cudaMemcpyDeviceToHost );
   
   
   start = clock();
   cpu_matrix_multiplication(a,b,e,ra,ca,rb,cb);
   end = clock();
   printf("Time taken for CPU Multiplication : %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   if (verifyGPUMultiplication(c,e,ra,cb)==1)
   {
	printf("GPU multiplication flavor 1 is performed without any error\n");
   }
   else
   {
	printf("GPU multiplication has some error(s)\n");
   }
   
   
   if (verifyGPUMultiplication(d,e,ra,cb)==1)
   {
	printf("GPU multiplication flavor 2 is performed without any error\n");
   }
   else
   {
	printf("GPU multiplication has some error(s)\n");
   }
   
   // deallocate host copies of a, b, c
   free( a );
   free( b );
   free( c );
   free( d );
   free(e);

   // deallocate device copies of a, b, c
   cudaFree( dev_a ); 
   cudaFree( dev_b );
   cudaFree( dev_c );
   cudaFree( dev_d );

   return 0;

}

	.file	"tmpxft_0024f652_00000000-6_matrix_multiplication.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z25cpu_matrix_multiplicationPiS_S_iiii
	.type	_Z25cpu_matrix_multiplicationPiS_S_iiii, @function
_Z25cpu_matrix_multiplicationPiS_S_iiii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r9
	xorl	%r10d, %r10d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	xorl	%ecx, %ecx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	56(%rsp), %rax
	xorl	%ebx, %ebx
	salq	$2, %rax
	movq	%rsi, -8(%rsp)
	movq	%rax, -16(%rsp)
.L3:
	cmpl	%ebp, %ebx
	jge	.L2
	movslq	%r10d, %rax
	movq	-8(%rsp), %r11
	xorl	%edx, %edx
	leaq	(%r9,%rax,4), %rsi
	movslq	%ecx, %rax
	leaq	(%rdi,%rax,4), %r15
.L7:
	cmpl	56(%rsp), %edx
	jge	.L11
	movq	%r11, %r13
	xorl	%eax, %eax
	xorl	%r12d, %r12d
.L5:
	movl	%r12d, (%rsi)
	cmpl	%eax, %r8d
	jle	.L12
	movl	(%r15,%rax,4), %r14d
	imull	0(%r13), %r14d
	incq	%rax
	addl	%r14d, %r12d
	movq	-16(%rsp), %r14
	addq	%r14, %r13
	jmp	.L5
.L12:
	incl	%edx
	addq	$4, %r11
	addq	$4, %rsi
	jmp	.L7
.L11:
	incl	%ebx
	addl	56(%rsp), %r10d
	addl	%r8d, %ecx
	jmp	.L3
.L2:
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z25cpu_matrix_multiplicationPiS_S_iiii, .-_Z25cpu_matrix_multiplicationPiS_S_iiii
	.globl	_Z10fillMatrixPiii
	.type	_Z10fillMatrixPiii, @function
_Z10fillMatrixPiii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L14:
	cmpl	%esi, %r14d
	jge	.L13
	movslq	%r13d, %rax
	xorl	%ebx, %ebx
	leaq	(%r12,%rax,4), %r15
.L17:
	cmpl	%ebx, %ebp
	jle	.L19
	movl	%esi, 12(%rsp)
	call	rand@PLT
	movl	$10, %ecx
	movl	12(%rsp), %esi
	cltd
	idivl	%ecx
	movl	%edx, (%r15,%rbx,4)
	incq	%rbx
	jmp	.L17
.L19:
	incl	%r14d
	addl	%ebp, %r13d
	jmp	.L14
.L13:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z10fillMatrixPiii, .-_Z10fillMatrixPiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d "
.LC1:
	.string	"\n"
	.text
	.globl	_Z11printMatrixPiii
	.type	_Z11printMatrixPiii, @function
_Z11printMatrixPiii:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L21:
	cmpl	%r14d, %r13d
	jge	.L20
	movslq	%r12d, %rax
	xorl	%r15d, %r15d
	leaq	0(%rbp,%rax,4), %r8
.L24:
	cmpl	%r15d, %ebx
	jle	.L26
	movl	(%r8,%r15,4), %edx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	incq	%r15
	movl	$2, %edi
	movq	%r8, 8(%rsp)
	call	__printf_chk@PLT
	movq	8(%rsp), %r8
	jmp	.L24
.L26:
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	incl	%r13d
	addl	%ebx, %r12d
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L21
.L20:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z11printMatrixPiii, .-_Z11printMatrixPiii
	.section	.rodata.str1.1
.LC2:
	.string	"C: %d, D: %d "
	.text
	.globl	_Z23verifyGPUMultiplicationPiS_ii
	.type	_Z23verifyGPUMultiplicationPiS_ii, @function
_Z23verifyGPUMultiplicationPiS_ii:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	%rdi, %r10
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.L35:
	cmpl	%edx, %r9d
	jge	.L43
	movslq	%r8d, %rax
	xorl	%edi, %edi
	salq	$2, %rax
	cmpl	%ecx, %edi
	jl	.L41
	incl	%r9d
	addl	%ecx, %r8d
	jmp	.L35
.L43:
	movl	$1, %eax
	ret
.L41:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
.L31:
	movl	(%r10,%rax), %r11d
	addq	$4, %rax
	movl	-4(%rsi,%rax), %ebx
	cmpl	%ebx, %r11d
	je	.L29
	movl	%ebx, %ecx
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L27
.L29:
	incl	%edi
.L32:
	cmpl	%ecx, %edi
	jl	.L31
	incl	%r9d
	addl	%ecx, %r8d
	cmpl	%edx, %r9d
	jge	.L33
	movslq	%r8d, %rax
	xorl	%edi, %edi
	salq	$2, %rax
	jmp	.L32
.L33:
	movl	$1, %eax
.L27:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z23verifyGPUMultiplicationPiS_ii, .-_Z23verifyGPUMultiplicationPiS_ii
	.globl	_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_
	.type	_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_, @function
_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	192(%rsp), %rax
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movl	%esi, 36(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 32(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 24(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movl	%r9d, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z13matrix_mult_1PiiiS_iiS_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L44:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_, .-_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_
	.globl	_Z13matrix_mult_1PiiiS_iiS_
	.type	_Z13matrix_mult_1PiiiS_iiS_, @function
_Z13matrix_mult_1PiiiS_iiS_:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_
	.cfi_endproc
.LFE2057:
	.size	_Z13matrix_mult_1PiiiS_iiS_, .-_Z13matrix_mult_1PiiiS_iiS_
	.globl	_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_
	.type	_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_, @function
_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	192(%rsp), %rax
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movl	%esi, 36(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 32(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 24(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movl	%r9d, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L49
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z13matrix_mult_2PiiiS_iiS_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L49:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L51
	call	__stack_chk_fail@PLT
.L51:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_, .-_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_
	.globl	_Z13matrix_mult_2PiiiS_iiS_
	.type	_Z13matrix_mult_2PiiiS_iiS_, @function
_Z13matrix_mult_2PiiiS_iiS_:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_
	.cfi_endproc
.LFE2059:
	.size	_Z13matrix_mult_2PiiiS_iiS_, .-_Z13matrix_mult_2PiiiS_iiS_
	.section	.rodata.str1.1
.LC3:
	.string	"The number of arguments is insufficient."
.LC4:
	.string	"Time taken for GPU Multiplication flavor 1: %d seconds "
.LC5:
	.string	"Time taken for GPU Multiplication flavor 2: %d seconds "
.LC6:
	.string	"Time taken for CPU Multiplication : %d seconds "
.LC7:
	.string	"GPU multiplication flavor 1 is performed without any error\n"
.LC8:
	.string	"GPU multiplication has some error(s)\n"
.LC9:
	.string	"GPU multiplication flavor 2 is performed without any error\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	cmpl	$4, %edi
	jg	.L55
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	orl	$-1, %eax
	jmp	.L54
.L55:
	movq	8(%rsi), %rdi
	movq	%rsi, %rbx
	call	atoi@PLT
	movq	16(%rbx), %rdi
	movl	%eax, %r12d
	call	atoi@PLT
	movl	%r12d, %r14d
	movq	24(%rbx), %rdi
	movl	%r12d, %r15d
	movl	%eax, %ebp
	call	atoi@PLT
	imull	%ebp, %r14d
	movq	32(%rbx), %rdi
	movl	%eax, 4(%rsp)
	call	atoi@PLT
	sall	$2, %r14d
	movl	%eax, %ebx
	movslq	%r14d, %r14
	imull	%ebx, %r15d
	movq	%r14, %rdi
	call	malloc@PLT
	movl	4(%rsp), %r13d
	movslq	%r15d, %r15
	movq	%rax, 8(%rsp)
	imull	%ebx, %r13d
	sall	$2, %r13d
	movslq	%r13d, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r15, %rdi
	movl	$4, %esi
	movq	%rax, 16(%rsp)
	call	calloc@PLT
	movq	%r15, %rdi
	movl	$4, %esi
	movq	%rax, 32(%rsp)
	call	calloc@PLT
	movq	%r15, %rdi
	movl	$4, %esi
	salq	$2, %r15
	movq	%rax, 40(%rsp)
	call	calloc@PLT
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	movq	%rax, 24(%rsp)
	call	cudaMalloc@PLT
	movq	%r13, %rsi
	leaq	56(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	64(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	leaq	72(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movl	%ebp, %edx
	movl	%r12d, %esi
	call	_Z10fillMatrixPiii
	movl	4(%rsp), %esi
	movq	16(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z10fillMatrixPiii
	movq	8(%rsp), %rsi
	movq	48(%rsp), %rdi
	movq	%r14, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rsi
	movq	56(%rsp), %rdi
	movq	%r13, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	call	clock@PLT
	movl	%ebp, 92(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %esi
	movl	$1, 88(%rsp)
	movq	%rax, %r13
	movabsq	$4294967297, %rdi
	movq	%rdi, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	92(%rsp), %rdx
	movq	%rdi, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L57
	pushq	%r9
	.cfi_def_cfa_offset 184
	movl	%ebp, %edx
	movl	%ebx, %r9d
	movl	%r12d, %esi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 192
	movl	20(%rsp), %r8d
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rdi
	call	_Z41__device_stub__Z13matrix_mult_1PiiiS_iiS_PiiiS_iiS_
	popq	%r10
	.cfi_def_cfa_offset 184
	popq	%r11
	.cfi_def_cfa_offset 176
.L57:
	call	clock@PLT
	movl	$1000000, %ecx
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
	subl	%r13d, %eax
	cltd
	idivl	%ecx
	movslq	%eax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	64(%rsp), %rsi
	movq	32(%rsp), %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	%r12d, 80(%rsp)
	movl	%ebx, 84(%rsp)
	movl	$1, 88(%rsp)
	call	clock@PLT
	movq	80(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	88(%rsp), %esi
	movl	$1, %ecx
	movq	%rax, %r13
	movabsq	$4294967297, %rdx
	movq	%rdx, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L58
	pushq	%rsi
	.cfi_def_cfa_offset 184
	movl	%ebx, %r9d
	movl	%ebp, %edx
	movl	%r12d, %esi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 192
	movl	20(%rsp), %r8d
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rdi
	call	_Z41__device_stub__Z13matrix_mult_2PiiiS_iiS_PiiiS_iiS_
	popq	%rdi
	.cfi_def_cfa_offset 184
	popq	%r8
	.cfi_def_cfa_offset 176
.L58:
	call	clock@PLT
	movl	$1000000, %r14d
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	subl	%r13d, %eax
	leaq	.LC1(%rip), %r13
	cltd
	idivl	%r14d
	movslq	%eax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	72(%rsp), %rsi
	movq	40(%rsp), %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	call	clock@PLT
	movl	%ebp, %r8d
	movl	%r12d, %ecx
	movq	%rax, %r15
	pushq	%rax
	.cfi_def_cfa_offset 184
	pushq	%rbx
	.cfi_def_cfa_offset 192
	movl	20(%rsp), %r9d
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdi
	movq	40(%rsp), %rdx
	call	_Z25cpu_matrix_multiplicationPiS_S_iiii
	call	clock@PLT
	popq	%rdx
	.cfi_def_cfa_offset 184
	movl	$2, %edi
	popq	%rcx
	.cfi_def_cfa_offset 176
	subl	%r15d, %eax
	leaq	.LC6(%rip), %rsi
	cltd
	idivl	%r14d
	movslq	%eax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rsi
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movq	32(%rsp), %rdi
	call	_Z23verifyGPUMultiplicationPiS_ii
	leaq	.LC7(%rip), %rsi
	decl	%eax
	je	.L65
	leaq	.LC8(%rip), %rsi
.L65:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rsi
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movq	40(%rsp), %rdi
	call	_Z23verifyGPUMultiplicationPiS_ii
	leaq	.LC9(%rip), %rsi
	decl	%eax
	je	.L66
	leaq	.LC8(%rip), %rsi
.L66:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%eax, %eax
.L54:
	movq	104(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L63
	call	__stack_chk_fail@PLT
.L63:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z13matrix_mult_2PiiiS_iiS_"
.LC11:
	.string	"_Z13matrix_mult_1PiiiS_iiS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.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	.LC10(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z13matrix_mult_2PiiiS_iiS_(%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	.LC11(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13matrix_mult_1PiiiS_iiS_(%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
.LFE2061:
	.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 "hip/hip_runtime.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
//int N = 0;

__global__
void matrix_mult_1(int *a, int ra, int ca, int *b, int rb, int cb, int *c )
{
   
   for( int i = 0;i<ra;i++)
   {
		for(int j=0;j<cb;j++)
		{
		
		   int prod = a[i * ca + threadIdx.x] * b[threadIdx.x * cb + j];
		   atomicAdd(c + (i * cb + j), prod);
		}
   }
}

__global__
void matrix_mult_2(int *a, int ra, int ca, int *b, int rb, int cb, int *c )
{
   
   for(int k = 0;k<ca;k++)
   {
		c[blockIdx.x * cb + blockIdx.y] += a[blockIdx.x * ca + k] * b[k * cb + blockIdx.y]; 
   }
}

void cpu_matrix_multiplication(int *A, int *B, int *C, int ra, int ca, int rb, int cb)
{
	for(int i=0 ; i < ra;i++)
	{
		for( int j=0; j < cb; j++)
		{
			C[i*cb + j] = 0;
			for(int k=0; k<ca;k++)
			{
				C[i*cb + j] += A[i*ca + k] * B[ k * cb + j];
			}
		}
	}
} 
 
 
 
void fillMatrix(int *mat, int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			mat[i*columns + j] = rand( ) % 10;
		}
    }
}
 
void printMatrix(int *mat,int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			printf("%d ",mat[i*columns + j]);
		}
		printf("\n");
    }
}

int verifyGPUMultiplication(int *c,int *d, int rows, int columns)
{
	for( int i = 0; i < rows; i++ )
    {
		for(int j = 0; j < columns ; j++)
		{
			if(c[i*columns + j] != d[i*columns + j])
			{
				printf("C: %d, D: %d ",c[i*columns + j], d[i*columns + j]);
				return 0;
			}
		}
	}
	return 1;
}
 
int main( int argc, char *argv[] )
{

   int *a, *b, *c, *d,*e;			// host copies of a, b, c
   int *dev_a, *dev_b, *dev_c,*dev_d;		// device copies of a, b, c
   
   /*  My Code */
	//int size = N * sizeof( int );	// space for N integers

	if(argc < 5) {
      printf("The number of arguments is insufficient.");
      return -1;
   }

   
   // dimensions of the matrices
	int ra = atoi(argv[1]);
	int ca = atoi(argv[2]);
	
	//N = ca;
	
	int a_size = ra * ca * sizeof(int);
	
	int rb = atoi(argv[3]);
	int cb = atoi(argv[4]);
	
	int b_size = rb * cb * sizeof(int);
	
	int c_size = ra * cb; 
   
   
   

   // allocate host copies of a, b, c
   a = ( int * ) malloc( a_size );
   b = ( int * ) malloc( b_size );
   c = ( int * ) calloc( c_size, sizeof(int));
   d = ( int * ) calloc( c_size, sizeof(int));
   e = ( int * ) calloc( c_size, sizeof(int));

   // allocate device copies of a, b, c
   hipMalloc( ( void** ) &dev_a, a_size );
   hipMalloc( ( void** ) &dev_b, b_size );
   hipMalloc( ( void** ) &dev_c, c_size * sizeof(int) );
   hipMalloc( ( void** ) &dev_d, c_size * sizeof(int) );

   // initialize host copies of a, b
   fillMatrix(a,ra,ca);
   fillMatrix(b,rb,cb);

   /*
   //printing Matrices
   printf("Matrix A: \n");
   printMatrix(a,ra,ca);
   printf("\n");
   
   printf("Matrix B: \n");
   printMatrix(b,rb,cb);
   printf("\n");
   */
   // copy inputs to device
   hipMemcpy( dev_a, a, a_size, hipMemcpyHostToDevice );
   hipMemcpy( dev_b, b, b_size, hipMemcpyHostToDevice );

   // launch add( ) kernel on GPU, passing parameters
	
   int start = clock();
   matrix_mult_1<<< 1,ca>>>(dev_a, ra, ca, dev_b, rb, cb, dev_c );    
   int end = clock();
   printf("Time taken for GPU Multiplication flavor 1: %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   
   // copy device result back to host copy of c
   hipMemcpy( c, dev_c, c_size * sizeof(int) , hipMemcpyDeviceToHost );
   
   
   dim3 blocks(ra, cb);
   start = clock();
   matrix_mult_2<<< blocks,1>>>(dev_a, ra, ca, dev_b, rb, cb, dev_d );    
   end = clock();
   printf("Time taken for GPU Multiplication flavor 2: %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   
   // copy device result back to host copy of c
   hipMemcpy( d, dev_d, c_size * sizeof(int) , hipMemcpyDeviceToHost );
   
   
   start = clock();
   cpu_matrix_multiplication(a,b,e,ra,ca,rb,cb);
   end = clock();
   printf("Time taken for CPU Multiplication : %d seconds ",(end-start)/CLOCKS_PER_SEC);
   printf("\n");
   
   if (verifyGPUMultiplication(c,e,ra,cb)==1)
   {
	printf("GPU multiplication flavor 1 is performed without any error\n");
   }
   else
   {
	printf("GPU multiplication has some error(s)\n");
   }
   
   
   if (verifyGPUMultiplication(d,e,ra,cb)==1)
   {
	printf("GPU multiplication flavor 2 is performed without any error\n");
   }
   else
   {
	printf("GPU multiplication has some error(s)\n");
   }
   
   // deallocate host copies of a, b, c
   free( a );
   free( b );
   free( c );
   free( d );
   free(e);

   // deallocate device copies of a, b, c
   hipFree( dev_a ); 
   hipFree( dev_b );
   hipFree( dev_c );
   hipFree( dev_d );

   return 0;

}

	.text
	.file	"matrix_multiplication.hip"
	.globl	_Z28__device_stub__matrix_mult_1PiiiS_iiS_ # -- Begin function _Z28__device_stub__matrix_mult_1PiiiS_iiS_
	.type	_Z28__device_stub__matrix_mult_1PiiiS_iiS_,@function
_Z28__device_stub__matrix_mult_1PiiiS_iiS_: # @_Z28__device_stub__matrix_mult_1PiiiS_iiS_
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%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	$_Z13matrix_mult_1PiiiS_iiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__matrix_mult_1PiiiS_iiS_, .Lfunc_end0-_Z28__device_stub__matrix_mult_1PiiiS_iiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__matrix_mult_2PiiiS_iiS_ # -- Begin function _Z28__device_stub__matrix_mult_2PiiiS_iiS_
	.type	_Z28__device_stub__matrix_mult_2PiiiS_iiS_,@function
_Z28__device_stub__matrix_mult_2PiiiS_iiS_: # @_Z28__device_stub__matrix_mult_2PiiiS_iiS_
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%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	$_Z13matrix_mult_2PiiiS_iiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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	_Z28__device_stub__matrix_mult_2PiiiS_iiS_, .Lfunc_end1-_Z28__device_stub__matrix_mult_2PiiiS_iiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25cpu_matrix_multiplicationPiS_S_iiii # -- Begin function _Z25cpu_matrix_multiplicationPiS_S_iiii
	.type	_Z25cpu_matrix_multiplicationPiS_S_iiii,@function
_Z25cpu_matrix_multiplicationPiS_S_iiii: # @_Z25cpu_matrix_multiplicationPiS_S_iiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, -8(%rsp)                  # 8-byte Spill
	movq	%rsi, -16(%rsp)                 # 8-byte Spill
	movq	%rdi, -24(%rsp)                 # 8-byte Spill
	testl	%ecx, %ecx
	jle	.LBB2_9
# %bb.1:                                # %.preheader.lr.ph
	movslq	56(%rsp), %rax
	movl	%ecx, %ecx
	movl	%eax, %r10d
	movl	%r8d, %r11d
	movq	%rax, -32(%rsp)                 # 8-byte Spill
	leaq	(,%rax,4), %rbx
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
                                        #       Child Loop BB2_6 Depth 3
	cmpl	$0, 56(%rsp)
	jle	.LBB2_8
# %bb.3:                                # %.lr.ph30
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	%r14d, %eax
	movq	-24(%rsp), %rdx                 # 8-byte Reload
	leaq	(%rdx,%rax,4), %r12
	movq	%r15, %rax
	imulq	-32(%rsp), %rax                 # 8-byte Folded Reload
	movq	-8(%rsp), %rdx                  # 8-byte Reload
	leaq	(%rdx,%rax,4), %r13
	movq	-16(%rsp), %rsi                 # 8-byte Reload
	xorl	%eax, %eax
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_6 Depth 3
	movl	$0, (%r13,%rax,4)
	testl	%r8d, %r8d
	jle	.LBB2_7
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB2_4 Depth=2
	xorl	%r9d, %r9d
	movq	%rsi, %rbp
	xorl	%edx, %edx
.LBB2_6:                                #   Parent Loop BB2_2 Depth=1
                                        #     Parent Loop BB2_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%rbp), %edi
	imull	(%r12,%r9,4), %edi
	addl	%edi, %edx
	movl	%edx, (%r13,%rax,4)
	incq	%r9
	addq	%rbx, %rbp
	cmpq	%r9, %r11
	jne	.LBB2_6
.LBB2_7:                                # %._crit_edge
                                        #   in Loop: Header=BB2_4 Depth=2
	incq	%rax
	addq	$4, %rsi
	cmpq	%r10, %rax
	jne	.LBB2_4
.LBB2_8:                                # %._crit_edge31
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r15
	addl	%r8d, %r14d
	cmpq	%rcx, %r15
	jne	.LBB2_2
.LBB2_9:                                # %._crit_edge33
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z25cpu_matrix_multiplicationPiS_S_iiii, .Lfunc_end2-_Z25cpu_matrix_multiplicationPiS_S_iiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10fillMatrixPiii              # -- Begin function _Z10fillMatrixPiii
	.type	_Z10fillMatrixPiii,@function
_Z10fillMatrixPiii:                     # @_Z10fillMatrixPiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB3_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%edx, %ebx
	movl	%esi, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%edx, %r12d
	xorl	%r13d, %r13d
	xorl	%ebp, %ebp
.LBB3_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
	testl	%ebx, %ebx
	jle	.LBB3_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	movl	%r13d, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r14
	xorl	%r15d, %r15d
.LBB3_4:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	movl	%eax, (%r14,%r15,4)
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB3_4
.LBB3_5:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%rbp
	addl	%ebx, %r13d
	cmpq	16(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB3_2
.LBB3_6:                                # %._crit_edge13
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z10fillMatrixPiii, .Lfunc_end3-_Z10fillMatrixPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z11printMatrixPiii             # -- Begin function _Z11printMatrixPiii
	.type	_Z11printMatrixPiii,@function
_Z11printMatrixPiii:                    # @_Z11printMatrixPiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB4_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%edx, %ebx
	movl	%esi, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%edx, %r12d
	xorl	%ebp, %ebp
	xorl	%r13d, %r13d
.LBB4_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_4 Depth 2
	testl	%ebx, %ebx
	jle	.LBB4_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB4_2 Depth=1
	movl	%ebp, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r14
	xorl	%r15d, %r15d
.LBB4_4:                                #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r14,%r15,4), %esi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB4_4
.LBB4_5:                                # %._crit_edge
                                        #   in Loop: Header=BB4_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r13
	addl	%ebx, %ebp
	cmpq	16(%rsp), %r13                  # 8-byte Folded Reload
	jne	.LBB4_2
.LBB4_6:                                # %._crit_edge13
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z11printMatrixPiii, .Lfunc_end4-_Z11printMatrixPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z23verifyGPUMultiplicationPiS_ii # -- Begin function _Z23verifyGPUMultiplicationPiS_ii
	.type	_Z23verifyGPUMultiplicationPiS_ii,@function
_Z23verifyGPUMultiplicationPiS_ii:      # @_Z23verifyGPUMultiplicationPiS_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	testl	%edx, %edx
	jle	.LBB5_1
# %bb.2:                                # %.preheader.lr.ph
	movl	%edx, %r8d
	movl	%ecx, %r9d
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	xorl	%ebx, %ebx
.LBB5_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_6 Depth 2
	testl	%ecx, %ecx
	jle	.LBB5_8
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB5_3 Depth=1
	movl	%r10d, %eax
	leaq	(%rsi,%rax,4), %r14
	leaq	(%rdi,%rax,4), %r15
	xorl	%r12d, %r12d
.LBB5_6:                                #   Parent Loop BB5_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r15,%r12,4), %eax
	movl	(%r14,%r12,4), %edx
	cmpl	%edx, %eax
	jne	.LBB5_7
# %bb.5:                                #   in Loop: Header=BB5_6 Depth=2
	incq	%r12
	cmpq	%r12, %r9
	jne	.LBB5_6
.LBB5_8:                                # %._crit_edge
                                        #   in Loop: Header=BB5_3 Depth=1
	incq	%r11
	cmpq	%r8, %r11
	setae	%bl
	addl	%ecx, %r10d
	cmpq	%r8, %r11
	jne	.LBB5_3
	jmp	.LBB5_9
.LBB5_7:                                # %.thread
	movl	$.L.str.2, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB5_9
.LBB5_1:
	movb	$1, %bl
.LBB5_9:                                # %.loopexit
	movzbl	%bl, %eax
	andl	$1, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z23verifyGPUMultiplicationPiS_ii, .Lfunc_end5-_Z23verifyGPUMultiplicationPiS_ii
	.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
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$4, %edi
	jg	.LBB6_2
# %bb.1:
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %eax
	jmp	.LBB6_7
.LBB6_2:
	movq	%rsi, %r14
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %r15d
	movq	16(%r14), %rdi
	callq	atoi
	movl	%eax, 20(%rsp)                  # 4-byte Spill
	movl	%r15d, %ebp
	imull	%eax, %ebp
	shll	$2, %ebp
	movq	24(%r14), %rdi
	callq	atoi
	movl	%eax, %ebx
	movl	%eax, 28(%rsp)                  # 4-byte Spill
	movq	32(%r14), %rdi
	callq	atoi
	movl	%eax, %r13d
	movl	%ebx, %r14d
	imull	%eax, %r14d
	shll	$2, %r14d
	movl	%eax, %ebx
	imull	%r15d, %ebx
	movslq	%ebp, %rdi
	movq	%rdi, 80(%rsp)                  # 8-byte Spill
	callq	malloc
	movq	%rax, %rbp
	movslq	%r14d, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movslq	%ebx, %r12
	movl	$4, %esi
	movq	%r12, %rdi
	callq	calloc
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movl	$4, %esi
	movq	%r12, %rdi
	callq	calloc
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	movl	$4, %esi
	movq	%r12, %rdi
	callq	calloc
	movq	%rax, 104(%rsp)                 # 8-byte Spill
	leaq	48(%rsp), %rdi
	movq	80(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r14, %rbx
	callq	hipMalloc
	shlq	$2, %r12
	leaq	72(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	64(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	movq	%rbp, %rdi
	movl	%r15d, 24(%rsp)                 # 4-byte Spill
	movl	%r15d, %esi
	movl	20(%rsp), %r15d                 # 4-byte Reload
	movl	%r15d, %edx
	callq	_Z10fillMatrixPiii
	movq	56(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movl	28(%rsp), %esi                  # 4-byte Reload
	movq	%r13, 32(%rsp)                  # 8-byte Spill
	movl	%r13d, %edx
	callq	_Z10fillMatrixPiii
	leaq	48(%rsp), %rax
	movq	(%rax), %rdi
	movq	%rbp, 96(%rsp)                  # 8-byte Spill
	movq	%rbp, %rsi
	movq	80(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	40(%rsp), %rax
	movq	(%rax), %rdi
	movq	%r14, %rsi
	movabsq	$4294967297, %r14               # imm = 0x100000001
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	callq	clock
	movq	%rax, %rbx
	movl	%r15d, %eax
	leaq	(%rax,%r14), %rdx
	decq	%rdx
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_4
# %bb.3:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rcx
	movq	72(%rsp), %rax
	movq	%rax, (%rsp)
	movl	24(%rsp), %esi                  # 4-byte Reload
	movl	20(%rsp), %edx                  # 4-byte Reload
	movl	28(%rsp), %r8d                  # 4-byte Reload
	movq	32(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	callq	_Z28__device_stub__matrix_mult_1PiiiS_iiS_
.LBB6_4:
	callq	clock
	subl	%ebx, %eax
	cltq
	imulq	$1125899907, %rax, %rax         # imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	addl	%ecx, %eax
	movslq	%eax, %rsi
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	movq	72(%rsp), %rsi
	movq	88(%rsp), %rdi                  # 8-byte Reload
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	24(%rsp), %eax                  # 4-byte Reload
	movq	32(%rsp), %rbp                  # 8-byte Reload
	shlq	$32, %rbp
	orq	%rax, %rbp
	callq	clock
	movq	%rax, %rbx
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_6
# %bb.5:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rcx
	movq	64(%rsp), %rax
	movq	%rax, (%rsp)
	movl	24(%rsp), %esi                  # 4-byte Reload
	movl	20(%rsp), %edx                  # 4-byte Reload
	movl	28(%rsp), %r8d                  # 4-byte Reload
	movq	32(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	callq	_Z28__device_stub__matrix_mult_2PiiiS_iiS_
.LBB6_6:
	callq	clock
	subl	%ebx, %eax
	cltq
	imulq	$1125899907, %rax, %rax         # imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	addl	%ecx, %eax
	movslq	%eax, %rsi
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	movq	64(%rsp), %rsi
	movq	112(%rsp), %r15                 # 8-byte Reload
	movq	%r15, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	clock
	movq	%rax, %r14
	movq	32(%rsp), %r13                  # 8-byte Reload
	movl	%r13d, (%rsp)
	movq	96(%rsp), %rdi                  # 8-byte Reload
	movq	56(%rsp), %rsi                  # 8-byte Reload
	movq	104(%rsp), %r12                 # 8-byte Reload
	movq	%r12, %rdx
	movl	24(%rsp), %ebp                  # 4-byte Reload
	movl	%ebp, %ecx
	movl	20(%rsp), %r8d                  # 4-byte Reload
	callq	_Z25cpu_matrix_multiplicationPiS_S_iiii
	callq	clock
	subl	%r14d, %eax
	cltq
	imulq	$1125899907, %rax, %rax         # imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	addl	%ecx, %eax
	movslq	%eax, %rsi
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	movq	88(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	%ebp, %edx
	movl	%r13d, %ecx
	callq	_Z23verifyGPUMultiplicationPiS_ii
	cmpl	$1, %eax
	movl	$.Lstr.1, %edi
	movl	$.Lstr.2, %ebx
	cmovneq	%rbx, %rdi
	callq	puts@PLT
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%ebp, %edx
	movl	%r13d, %ecx
	callq	_Z23verifyGPUMultiplicationPiS_ii
	cmpl	$1, %eax
	movl	$.Lstr.3, %edi
	cmovneq	%rbx, %rdi
	callq	puts@PLT
	movq	96(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	64(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
.LBB6_7:
                                        # kill: def $eax killed $eax killed $rax
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	main, .Lfunc_end6-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	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13matrix_mult_1PiiiS_iiS_, %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	$_Z13matrix_mult_2PiiiS_iiS_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13matrix_mult_1PiiiS_iiS_,@object # @_Z13matrix_mult_1PiiiS_iiS_
	.section	.rodata,"a",@progbits
	.globl	_Z13matrix_mult_1PiiiS_iiS_
	.p2align	3, 0x0
_Z13matrix_mult_1PiiiS_iiS_:
	.quad	_Z28__device_stub__matrix_mult_1PiiiS_iiS_
	.size	_Z13matrix_mult_1PiiiS_iiS_, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%d "
	.size	.L.str, 4

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"C: %d, D: %d "
	.size	.L.str.2, 14

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"The number of arguments is insufficient."
	.size	.L.str.3, 41

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Time taken for GPU Multiplication flavor 1: %d seconds "
	.size	.L.str.4, 56

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Time taken for GPU Multiplication flavor 2: %d seconds "
	.size	.L.str.5, 56

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Time taken for CPU Multiplication : %d seconds "
	.size	.L.str.6, 48

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13matrix_mult_1PiiiS_iiS_"
	.size	.L__unnamed_1, 28

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z13matrix_mult_2PiiiS_iiS_"
	.size	.L__unnamed_2, 28

	.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.1,@object                 # @str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.1:
	.asciz	"GPU multiplication flavor 1 is performed without any error"
	.size	.Lstr.1, 59

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"GPU multiplication has some error(s)"
	.size	.Lstr.2, 37

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"GPU multiplication flavor 2 is performed without any error"
	.size	.Lstr.3, 59

	.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 _Z28__device_stub__matrix_mult_1PiiiS_iiS_
	.addrsig_sym _Z28__device_stub__matrix_mult_2PiiiS_iiS_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z13matrix_mult_1PiiiS_iiS_
	.addrsig_sym _Z13matrix_mult_2PiiiS_iiS_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13matrix_mult_1PiiiS_iiS_ ; -- Begin function _Z13matrix_mult_1PiiiS_iiS_
	.globl	_Z13matrix_mult_1PiiiS_iiS_
	.p2align	8
	.type	_Z13matrix_mult_1PiiiS_iiS_,@function
_Z13matrix_mult_1PiiiS_iiS_:            ; @_Z13matrix_mult_1PiiiS_iiS_
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB0_10
; %bb.1:                                ; %.preheader.lr.ph
	s_clause 0x3
	s_load_b32 s10, s[0:1], 0x1c
	s_load_b64 s[4:5], s[0:1], 0x0
	s_load_b64 s[6:7], s[0:1], 0x10
	s_load_b64 s[0:1], s[0:1], 0x20
	v_mov_b32_e32 v2, 0
	s_mov_b32 s9, 0
	s_mov_b32 s12, 0
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v5, v0, s10
	s_cmp_gt_i32 s10, 0
	s_cselect_b32 s11, -1, 0
.LBB0_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
                                        ;       Child Loop BB0_5 Depth 3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 vcc_lo, exec_lo, s11
	s_cbranch_vccnz .LBB0_9
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_mad_u64_u32 v[3:4], null, s12, s3, v[0:1]
	v_mov_b32_e32 v4, v2
	s_mul_i32 s13, s12, s10
	s_mov_b32 s14, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_add_co_u32 v3, vcc_lo, s4, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
.LBB0_4:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_5 Depth 3
	v_add_nc_u32_e32 v1, s14, v5
	s_mov_b32 s8, exec_lo
	s_mov_b32 s15, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 2, v[1:2]
	v_add_co_u32 v6, vcc_lo, s6, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v7, vcc_lo
	global_load_b32 v1, v[3:4], off
	global_load_b32 v6, v[6:7], off
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v1, v6, v1
.LBB0_5:                                ; %ComputeLoop
                                        ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_4 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_ctz_i32_b32 s16, s8
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_readlane_b32 s17, v1, s16
	s_lshl_b32 s16, 1, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 s8, s8, s16
	s_add_i32 s15, s15, s17
	s_cmp_lg_u32 s8, 0
	s_cbranch_scc1 .LBB0_5
; %bb.6:                                ; %ComputeEnd
                                        ;   in Loop: Header=BB0_4 Depth=2
	v_mbcnt_lo_u32_b32 v1, exec_lo, 0
	s_mov_b32 s8, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v1
	s_xor_b32 s16, exec_lo, s8
	s_cbranch_execz .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=2
	s_add_i32 s8, s14, s13
	v_mov_b32_e32 v1, s15
	s_lshl_b64 s[18:19], s[8:9], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s18, s0, s18
	s_addc_u32 s19, s1, s19
	global_atomic_add_u32 v2, v1, s[18:19]
.LBB0_8:                                ;   in Loop: Header=BB0_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s16
	s_add_i32 s14, s14, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s14, s10
	s_cbranch_scc0 .LBB0_4
.LBB0_9:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s12, s12, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s12, s2
	s_cbranch_scc0 .LBB0_2
.LBB0_10:                               ; %._crit_edge23
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13matrix_mult_1PiiiS_iiS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 40
		.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 8
		.amdhsa_next_free_sgpr 20
		.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	_Z13matrix_mult_1PiiiS_iiS_, .Lfunc_end0-_Z13matrix_mult_1PiiiS_iiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 364
; NumSgprs: 22
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 8
; 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	_Z13matrix_mult_2PiiiS_iiS_ ; -- Begin function _Z13matrix_mult_2PiiiS_iiS_
	.globl	_Z13matrix_mult_2PiiiS_iiS_
	.p2align	8
	.type	_Z13matrix_mult_2PiiiS_iiS_,@function
_Z13matrix_mult_2PiiiS_iiS_:            ; @_Z13matrix_mult_2PiiiS_iiS_
; %bb.0:
	s_load_b32 s10, s[0:1], 0xc
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s10, 1
	s_cbranch_scc1 .LBB1_3
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b32 s11, s[0:1], 0x1c
	s_load_b64 s[6:7], s[0:1], 0x20
	s_mov_b32 s5, 0
	s_mov_b32 s2, s15
	v_mov_b32_e32 v1, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s3, s14, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s4, s3, s15
	s_lshl_b64 s[8:9], s[4:5], 2
	s_mul_i32 s4, s14, s10
	s_add_u32 s6, s6, s8
	s_addc_u32 s7, s7, s9
	s_load_b32 s3, s[6:7], 0x0
	s_clause 0x1
	s_load_b64 s[8:9], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v0, s3
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_lshl_b64 s[12:13], s[4:5], 2
	s_mov_b32 s3, s5
	s_add_u32 s12, s8, s12
	s_addc_u32 s13, s9, s13
	s_lshl_b64 s[14:15], s[2:3], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s14, s0, s14
	s_addc_u32 s15, s1, s15
	s_clause 0x1
	global_load_b32 v2, v1, s[12:13]
	global_load_b32 v3, v1, s[14:15]
	s_add_i32 s10, s10, -1
	s_add_i32 s2, s2, s11
	s_add_i32 s4, s4, 1
	s_cmp_eq_u32 s10, 0
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v2, v3, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v0, v2
	global_store_b32 v1, v0, s[6:7]
	s_cbranch_scc0 .LBB1_2
.LBB1_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13matrix_mult_2PiiiS_iiS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 40
		.amdhsa_user_sgpr_count 14
		.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 1
		.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_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	_Z13matrix_mult_2PiiiS_iiS_, .Lfunc_end1-_Z13matrix_mult_2PiiiS_iiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 232
; NumSgprs: 16
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 16
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 40
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13matrix_mult_1PiiiS_iiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z13matrix_mult_1PiiiS_iiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 40
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13matrix_mult_2PiiiS_iiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     16
    .sgpr_spill_count: 0
    .symbol:         _Z13matrix_mult_2PiiiS_iiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
