#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda.h>
#include <cuda_runtime.h>

#define BLOCKSIZE 16

__global__ void MatrixMultiplyI(int *matrix1, int *matrix2, int *matrix3, int m1, int n1, int m2, int n2)
{
  int i, j;

  __shared__ int ds_M[BLOCKSIZE][BLOCKSIZE];
  __shared__ int ds_N[BLOCKSIZE][BLOCKSIZE];
  
  int bx = blockIdx.x;
  int by = blockIdx.y;
  int tx = threadIdx.x;
  int ty = threadIdx.y;

  int row = by * blockDim.y + ty;
  int col = bx * blockDim.x + tx;

  int sum = 0;
  for (i = 0; i < (n2-1)/BLOCKSIZE+1; i++)
  {
    if(row < n2 && i*BLOCKSIZE+tx < n2)
    {
      ds_M[ty][tx] = matrix1[row*n2 + i*BLOCKSIZE+tx];
    }
    else
    {
      ds_M[ty][tx] = 0;
    }
    if(i*BLOCKSIZE+ty < n2 && col < n2)
    {
      ds_N[ty][tx] = matrix2[(i*BLOCKSIZE+ty)*n2 + col];
    }
    else
    {
      ds_N[ty][tx] = 0;
    }
    __syncthreads();
    if(row < n2 && col < n2)
    {
      for (j = 0; j < BLOCKSIZE; j++)
      {
        sum = sum + (ds_M[ty][j] * ds_N[j][tx]);
      }
    }
    __syncthreads();
  }
  if(row < n2 && col < n2)
    matrix3[row*n2+col] = sum;
}

__global__ void MatrixMultiplyF(float *matrix1, float *matrix2, float *matrix3, int m1, int n1, int m2, int n2)
{
  int i, j;

  __shared__ float ds_M[BLOCKSIZE][BLOCKSIZE];
  __shared__ float ds_N[BLOCKSIZE][BLOCKSIZE];

  int bx = blockIdx.x;
  int by = blockIdx.y;
  int tx = threadIdx.x;
  int ty = threadIdx.y;

  int row = by * blockDim.y + ty;
  int col = bx * blockDim.x + tx;

  float sum = 0.0;

  for (i = 0; i < n2/BLOCKSIZE; i++)
  {
    if(row < n2 && i*BLOCKSIZE+tx < n2)
    {
      ds_M[ty][tx] = matrix1[row*n2 + i*BLOCKSIZE+tx];
    }
    else
    {
      ds_M[ty][tx] = 0.0;
    }
    if(i*BLOCKSIZE+ty < n2 && col < n2)
    {
      ds_N[ty][tx] = matrix2[(i*BLOCKSIZE+ty)*n2 + col];
    }
    else
    {
      ds_N[ty][tx] = 0.0;
    }
    __syncthreads();
    if(row < n2 && col < n2)
    {
      for (j = 0; j < BLOCKSIZE; j++)
      {
        sum = sum + (ds_M[ty][j] * ds_N[j][tx]);
      }
    }
    __syncthreads();
  }
  if(row < n2 && col < n2)
    matrix3[row*n2+col] = sum;
}

void read_imatrix(char *filename, int *m, int *n, int **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2, t3;
  name = fopen(filename, "r+");
  if(name != NULL)
  {
    k = 0;
    fscanf(name, "%d %d\n", &t1, &t2);
    *m = t1;
    *n = t2;
    *values = (int *)calloc(t1*t2, sizeof(int));
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          fscanf(name, "%d,", &t3);
          *(*values+k) = t3;
          k++;
        }
        else
        {
          fscanf(name, "%d\n", &t3);
          *(*values+k) = t3;
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File read failed\n");
    exit(1);
  }
}

void read_fmatrix(char *filename, int *m, int *n, float **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2;
  float t3;
  name = fopen(filename, "r+");
  if(name != NULL)
  {
    k = 0;
    fscanf(name, "%d %d\n", &t1, &t2);
    *m = t1;
    *n = t2;
    *values = (float *)calloc(t1*t2, sizeof(float));
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          fscanf(name, "%f,", &t3);
          *(*values+k) = t3;
          k++;
        }
        else
        {
          fscanf(name, "%f\n", &t3);
          *(*values+k) = t3;
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File read failed\n");
    exit(1);
  }
}

void write_imatrix(char *filename, int *m, int *n, int **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2, t3;
  name = fopen(filename, "w+");
  if(name != NULL)
  {
    k = 0;
    t1 = *m;
    t2 = *n;
    fprintf(name, "%d %d\n", t1, t2);
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          t3 = *(*values+k);
          fprintf(name, "%d,", t3);
          k++;
        }
        else
        {
          t3 = *(*values+k);
          fprintf(name, "%d\n", t3);
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File write failed\n");
    exit(1);
  }
}

void write_fmatrix(char *filename, int *m, int *n, float **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2;
  float t3;
  name = fopen(filename, "w+");
  if(name != NULL)
  {
    k = 0;
    t1 = *m;
    t2 = *n;
    fprintf(name, "%d %d\n", t1, t2);
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          t3 = *(*values+k);
          fprintf(name, "%f,", t3);
          k++;
        }
        else
        {
          t3 = *(*values+k);
          fprintf(name, "%f\n", t3);
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File write failed\n");
    exit(1);
  }
}

void matrix_check(int m1, int n1, int m2, int n2)
{
  if ((n1-m2) != 0)
  {
    printf("Matrix dimensions must be PxQ and QxR respectively\n");
    exit(1);
  }
}

int main(int argc, char *argv[])
{
  int m1, n1, m2, n2, GRIDX, GRIDY;

  if (argc != 5)
  {
    printf("Usage: ./matrix-multiplication matrix1.mat matrix2.mat matrix3.mat float/int \n");
    exit(1);
  }

  if (strcmp(argv[4], "float") == 0)
  {
    float *hostmatrix1, *hostmatrix2, *hostmatrix3;
    float *devicematrix1, *devicematrix2, *devicematrix3;
    read_fmatrix(argv[1], &m1, &n1, &hostmatrix1);
    read_fmatrix(argv[2], &m2, &n2, &hostmatrix2);
    matrix_check(m1, n1, m2, n2);
    size_t matrix_size = m1*n1*sizeof(float);
    hostmatrix3 = (float *)calloc(m1*n1, sizeof(float));
    cudaMalloc(&devicematrix1, matrix_size);
    cudaMalloc(&devicematrix2, matrix_size);
    cudaMalloc(&devicematrix3, matrix_size);
    cudaMemcpy(devicematrix1, hostmatrix1, matrix_size, cudaMemcpyHostToDevice);
    cudaMemcpy(devicematrix2, hostmatrix2, matrix_size, cudaMemcpyHostToDevice);
    GRIDX = (int)ceil((float)m1/BLOCKSIZE);
    GRIDY = (int)ceil((float)n2/BLOCKSIZE);
    dim3 dimGrid(GRIDX, GRIDY, 1);
    dim3 dimBlock(BLOCKSIZE, BLOCKSIZE, 1);
    MatrixMultiplyF <<< dimGrid, dimBlock >>> (devicematrix1, devicematrix2, devicematrix3, m1, n1, m2, n2);
    cudaMemcpy(hostmatrix3, devicematrix3, matrix_size, cudaMemcpyDeviceToHost);
    write_fmatrix(argv[3], &m1, &n1, &hostmatrix3);
    cudaFree(devicematrix1);
    cudaFree(devicematrix2);
    cudaFree(devicematrix3);
    free(hostmatrix1);
    free(hostmatrix2);
    free(hostmatrix3);
  }

  if (strcmp(argv[4], "int") == 0)
  {
    int *hostmatrix1, *hostmatrix2, *hostmatrix3;
    int *devicematrix1, *devicematrix2, *devicematrix3;
    read_imatrix(argv[1], &m1, &n1, &hostmatrix1);
    read_imatrix(argv[2], &m2, &n2, &hostmatrix2);
    matrix_check(m1, n1, m2, n2);
    size_t matrix_size = m1*n1*sizeof(int);
    hostmatrix3 = (int *)calloc(m1*n1, sizeof(int));
    cudaMalloc(&devicematrix1, matrix_size);
    cudaMalloc(&devicematrix2, matrix_size);
    cudaMalloc(&devicematrix3, matrix_size);
    cudaMemcpy(devicematrix1, hostmatrix1, matrix_size, cudaMemcpyHostToDevice);
    cudaMemcpy(devicematrix2, hostmatrix2, matrix_size, cudaMemcpyHostToDevice);
    GRIDX = (int)ceil((float)m1/BLOCKSIZE);
    GRIDY = (int)ceil((float)n2/BLOCKSIZE);
    dim3 dimGrid(GRIDX, GRIDY, 1);
    dim3 dimBlock(BLOCKSIZE, BLOCKSIZE, 1);
    MatrixMultiplyI <<< dimGrid, dimBlock >>> (devicematrix1, devicematrix2, devicematrix3, m1, n1, m2, n2);
    cudaMemcpy(hostmatrix3, devicematrix3, matrix_size, cudaMemcpyDeviceToHost);
    write_imatrix(argv[3], &m1, &n1, &hostmatrix3);
    cudaFree(devicematrix1);
    cudaFree(devicematrix2);
    cudaFree(devicematrix3);
    free(hostmatrix1);
    free(hostmatrix2);
    free(hostmatrix3);
  }

  return 0;
}

	.file	"tmpxft_0025ac84_00000000-6_matrix-multiplication.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Matrix dimensions must be PxQ and QxR respectively\n"
	.text
	.type	_Z12matrix_checkiiii.part.0, @function
_Z12matrix_checkiiii.part.0:
.LFB2180:
	.cfi_startproc
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE2180:
	.size	_Z12matrix_checkiiii.part.0, .-_Z12matrix_checkiiii.part.0
	.section	.rodata.str1.1
.LC1:
	.string	"r+"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d,"
.LC4:
	.string	"%d\n"
.LC5:
	.string	"File read failed\n"
	.text
	.globl	_Z12read_imatrixPcPiS0_PS0_
	.type	_Z12read_imatrixPcPiS0_PS0_, @function
_Z12read_imatrixPcPiS0_PS0_:
.LFB2027:
	.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
	movq	%rsi, %r13
	leaq	.LC1(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	testq	%rax, %rax
	je	.L5
	movq	%rax, %rdi
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	movq	%rax, %rbx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %r14d
	call	__isoc23_fscanf@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %eax
	movl	$4, %esi
	movl	%edi, 0(%r13)
	imull	%eax, %edi
	xorl	%r13d, %r13d
	movl	%eax, 0(%rbp)
	movslq	%edi, %rdi
	call	calloc@PLT
	movq	%rax, (%r12)
.L6:
	cmpl	%r14d, 12(%rsp)
	jl	.L10
	movslq	%r13d, %rbp
	movl	$1, %r15d
	salq	$2, %rbp
.L11:
	cmpl	%r15d, 16(%rsp)
	jl	.L17
	leaq	20(%rsp), %rdx
	leaq	.LC3(%rip), %rsi
	jg	.L15
	leaq	.LC4(%rip), %rsi
.L15:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	incl	%r15d
	call	__isoc23_fscanf@PLT
	movq	(%r12), %rax
	movl	20(%rsp), %edx
	movl	%edx, (%rax,%rbp)
	addq	$4, %rbp
	jmp	.L11
.L17:
	leal	-1(%r15,%r13), %r13d
	incl	%r14d
	jmp	.L6
.L10:
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L5:
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z12read_imatrixPcPiS0_PS0_, .-_Z12read_imatrixPcPiS0_PS0_
	.section	.rodata.str1.1
.LC6:
	.string	"%f,"
.LC7:
	.string	"%f\n"
	.text
	.globl	_Z12read_fmatrixPcPiS0_PPf
	.type	_Z12read_fmatrixPcPiS0_PPf, @function
_Z12read_fmatrixPcPiS0_PPf:
.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
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	leaq	.LC1(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	testq	%rax, %rax
	je	.L19
	movq	%rax, %rdi
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	movq	%rax, %rbx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %r14d
	call	__isoc23_fscanf@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %eax
	movl	$4, %esi
	movl	%edi, 0(%r13)
	imull	%eax, %edi
	xorl	%r13d, %r13d
	movl	%eax, 0(%rbp)
	movslq	%edi, %rdi
	call	calloc@PLT
	movq	%rax, (%r12)
.L20:
	cmpl	%r14d, 12(%rsp)
	jl	.L24
	movslq	%r13d, %rbp
	movl	$1, %r15d
	salq	$2, %rbp
.L25:
	cmpl	%r15d, 16(%rsp)
	jl	.L30
	leaq	20(%rsp), %rdx
	leaq	.LC6(%rip), %rsi
	jg	.L29
	leaq	.LC7(%rip), %rsi
.L29:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	incl	%r15d
	call	__isoc23_fscanf@PLT
	movq	(%r12), %rax
	movss	20(%rsp), %xmm0
	movss	%xmm0, (%rax,%rbp)
	addq	$4, %rbp
	jmp	.L25
.L30:
	leal	-1(%r15,%r13), %r13d
	incl	%r14d
	jmp	.L20
.L24:
	movq	%rbx, %rdi
	call	fclose@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L19:
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L26:
	addq	$40, %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	_Z12read_fmatrixPcPiS0_PPf, .-_Z12read_fmatrixPcPiS0_PPf
	.section	.rodata.str1.1
.LC8:
	.string	"w+"
.LC9:
	.string	"File write failed\n"
	.text
	.globl	_Z13write_imatrixPcPiS0_PS0_
	.type	_Z13write_imatrixPcPiS0_PS0_, @function
_Z13write_imatrixPcPiS0_PS0_:
.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
	movq	%rcx, %r14
	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
	movq	%rsi, %rbp
	leaq	.LC8(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	fopen@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	je	.L32
	movl	0(%rbp), %eax
	movl	(%rbx), %r15d
	leaq	.LC2(%rip), %rdx
	xorl	%r12d, %r12d
	movq	(%rsp), %rdi
	movl	$2, %esi
	movl	$1, %r13d
	movl	%eax, 12(%rsp)
	movl	%eax, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L33:
	movl	12(%rsp), %eax
	cmpl	%eax, %r13d
	jg	.L37
	movslq	%r12d, %rbx
	movl	$1, %ebp
	salq	$2, %rbx
.L38:
	cmpl	%r15d, %ebp
	jg	.L41
	movq	(%r14), %rax
	leaq	.LC3(%rip), %rdx
	movl	(%rax,%rbx), %ecx
	jl	.L40
	leaq	.LC4(%rip), %rdx
.L40:
	movq	(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	incl	%ebp
	addq	$4, %rbx
	call	__fprintf_chk@PLT
	jmp	.L38
.L41:
	leal	-1(%rbp,%r12), %r12d
	incl	%r13d
	jmp	.L33
.L37:
	movq	(%rsp), %rdi
	addq	$24, %rsp
	.cfi_remember_state
	.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
	jmp	fclose@PLT
.L32:
	.cfi_restore_state
	movl	$2, %edi
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z13write_imatrixPcPiS0_PS0_, .-_Z13write_imatrixPcPiS0_PS0_
	.globl	_Z13write_fmatrixPcPiS0_PPf
	.type	_Z13write_fmatrixPcPiS0_PPf, @function
_Z13write_fmatrixPcPiS0_PPf:
.LFB2030:
	.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
	movq	%rcx, %r14
	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
	movq	%rsi, %rbp
	leaq	.LC8(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	fopen@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	je	.L43
	movl	0(%rbp), %eax
	movl	(%rbx), %r15d
	leaq	.LC2(%rip), %rdx
	xorl	%r12d, %r12d
	movq	(%rsp), %rdi
	movl	$2, %esi
	movl	$1, %r13d
	movl	%eax, 12(%rsp)
	movl	%eax, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L44:
	movl	12(%rsp), %eax
	cmpl	%eax, %r13d
	jg	.L48
	movslq	%r12d, %rbx
	movl	$1, %ebp
	salq	$2, %rbx
.L49:
	cmpl	%r15d, %ebp
	jg	.L52
	movq	(%r14), %rax
	leaq	.LC6(%rip), %rdx
	cvtss2sd	(%rax,%rbx), %xmm0
	jl	.L51
	leaq	.LC7(%rip), %rdx
.L51:
	movq	(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	incl	%ebp
	addq	$4, %rbx
	call	__fprintf_chk@PLT
	jmp	.L49
.L52:
	leal	-1(%rbp,%r12), %r12d
	incl	%r13d
	jmp	.L44
.L48:
	movq	(%rsp), %rdi
	addq	$24, %rsp
	.cfi_remember_state
	.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
	jmp	fclose@PLT
.L43:
	.cfi_restore_state
	movl	$2, %edi
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z13write_fmatrixPcPiS0_PPf, .-_Z13write_fmatrixPcPiS0_PPf
	.globl	_Z12matrix_checkiiii
	.type	_Z12matrix_checkiiii, @function
_Z12matrix_checkiiii:
.LFB2031:
	.cfi_startproc
	endbr64
	cmpl	%edx, %esi
	je	.L53
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z12matrix_checkiiii.part.0
.L53:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z12matrix_checkiiii, .-_Z12matrix_checkiiii
	.globl	_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii
	.type	_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii, @function
_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 20(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 16(%rsp)
	movl	%r9d, 12(%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	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	192(%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	.L58
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z15MatrixMultiplyIPiS_S_iiii(%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
.L58:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii, .-_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii
	.globl	_Z15MatrixMultiplyIPiS_S_iiii
	.type	_Z15MatrixMultiplyIPiS_S_iiii, @function
_Z15MatrixMultiplyIPiS_S_iiii:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii
	.cfi_endproc
.LFE2058:
	.size	_Z15MatrixMultiplyIPiS_S_iiii, .-_Z15MatrixMultiplyIPiS_S_iiii
	.globl	_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii
	.type	_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii, @function
_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 20(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 16(%rsp)
	movl	%r9d, 12(%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	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	192(%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	.L63
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z15MatrixMultiplyFPfS_S_iiii(%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
.L63:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L65
	call	__stack_chk_fail@PLT
.L65:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii, .-_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii
	.globl	_Z15MatrixMultiplyFPfS_S_iiii
	.type	_Z15MatrixMultiplyFPfS_S_iiii, @function
_Z15MatrixMultiplyFPfS_S_iiii:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii
	.cfi_endproc
.LFE2060:
	.size	_Z15MatrixMultiplyFPfS_S_iiii, .-_Z15MatrixMultiplyFPfS_S_iiii
	.section	.rodata.str1.1
.LC10:
	.string	"Usage: ./matrix-multiplication matrix1.mat matrix2.mat matrix3.mat float/int \n"
.LC11:
	.string	"float"
.LC13:
	.string	"int"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2032:
	.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	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	cmpl	$5, %edi
	je	.L69
	movl	$2, %edi
	leaq	.LC10(%rip), %rsi
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L69:
	movq	32(%rsi), %rdi
	movq	%rsi, %rbx
	leaq	.LC11(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L70
	movq	8(%rbx), %rdi
	leaq	36(%rsp), %r15
	leaq	48(%rsp), %rcx
	leaq	32(%rsp), %rsi
	movq	%r15, %rdx
	call	_Z12read_fmatrixPcPiS0_PPf
	movq	16(%rbx), %rdi
	leaq	56(%rsp), %rcx
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
	call	_Z12read_fmatrixPcPiS0_PPf
	movl	40(%rsp), %ebp
	cmpl	36(%rsp), %ebp
	je	.L71
.L75:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L79
	call	_Z12matrix_checkiiii.part.0
.L71:
	movl	32(%rsp), %r13d
	movl	%ebp, %edi
	movl	$4, %esi
	imull	%r13d, %edi
	movslq	%edi, %rdi
	leaq	0(,%rdi,4), %rax
	movq	%rax, (%rsp)
	call	calloc@PLT
	movq	(%rsp), %rsi
	leaq	88(%rsp), %rdi
	movq	%rax, 80(%rsp)
	movq	%rax, %r12
	call	cudaMalloc@PLT
	movq	(%rsp), %rsi
	leaq	96(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	(%rsp), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	48(%rsp), %rax
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	88(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMemcpy@PLT
	movq	56(%rsp), %rax
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	96(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	call	cudaMemcpy@PLT
	cvtsi2ssl	%r13d, %xmm0
	mulss	.LC12(%rip), %xmm0
	call	ceilf@PLT
	movl	44(%rsp), %r14d
	movss	%xmm0, 28(%rsp)
	cvtsi2ssl	%r14d, %xmm0
	mulss	.LC12(%rip), %xmm0
	call	ceilf@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movss	28(%rsp), %xmm1
	movl	$1, %esi
	movabsq	$68719476752, %rdx
	movl	$1, 120(%rsp)
	movq	%rdx, 124(%rsp)
	movl	$1, 132(%rsp)
	cvttss2sil	%xmm1, %eax
	movl	%eax, 112(%rsp)
	cvttss2sil	%xmm0, %eax
	movl	%eax, 116(%rsp)
	movq	112(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L73
	pushq	%rsi
	.cfi_def_cfa_offset 216
	movl	%ebp, %r8d
	movl	%ebp, %r9d
	movl	%r13d, %ecx
	pushq	%r14
	.cfi_def_cfa_offset 224
	movq	120(%rsp), %rdx
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdi
	call	_Z43__device_stub__Z15MatrixMultiplyFPfS_S_iiiiPfS_S_iiii
	popq	%rdi
	.cfi_def_cfa_offset 216
	popq	%r8
	.cfi_def_cfa_offset 208
.L73:
	movq	(%rsp), %rdx
	movq	104(%rsp), %rsi
	movl	$2, %ecx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movq	24(%rbx), %rdi
	leaq	80(%rsp), %rcx
	movq	%r15, %rdx
	leaq	32(%rsp), %rsi
	call	_Z13write_fmatrixPcPiS0_PPf
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
.L70:
	movq	32(%rbx), %rdi
	leaq	.LC13(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L74
	movq	8(%rbx), %rdi
	leaq	36(%rsp), %r15
	leaq	64(%rsp), %rcx
	leaq	32(%rsp), %rsi
	movq	%r15, %rdx
	call	_Z12read_imatrixPcPiS0_PS0_
	movq	16(%rbx), %rdi
	leaq	72(%rsp), %rcx
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
	call	_Z12read_imatrixPcPiS0_PS0_
	movl	40(%rsp), %ebp
	cmpl	36(%rsp), %ebp
	jne	.L75
	movl	32(%rsp), %r13d
	movl	%ebp, %edi
	movl	$4, %esi
	imull	%r13d, %edi
	movslq	%edi, %rdi
	leaq	0(,%rdi,4), %rax
	movq	%rax, (%rsp)
	call	calloc@PLT
	movq	(%rsp), %rsi
	leaq	88(%rsp), %rdi
	movq	%rax, 80(%rsp)
	movq	%rax, %r12
	call	cudaMalloc@PLT
	movq	(%rsp), %rsi
	leaq	96(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	(%rsp), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	64(%rsp), %rax
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	88(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMemcpy@PLT
	movq	72(%rsp), %rax
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	96(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	call	cudaMemcpy@PLT
	cvtsi2ssl	%r13d, %xmm0
	mulss	.LC12(%rip), %xmm0
	call	ceilf@PLT
	movl	44(%rsp), %r14d
	movss	%xmm0, 28(%rsp)
	cvtsi2ssl	%r14d, %xmm0
	mulss	.LC12(%rip), %xmm0
	call	ceilf@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movss	28(%rsp), %xmm1
	movl	$1, %esi
	movabsq	$68719476752, %rdx
	movl	$1, 120(%rsp)
	movq	%rdx, 124(%rsp)
	movl	$1, 132(%rsp)
	cvttss2sil	%xmm1, %eax
	movl	%eax, 112(%rsp)
	cvttss2sil	%xmm0, %eax
	movl	%eax, 116(%rsp)
	movq	112(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L76
	pushq	%rax
	.cfi_def_cfa_offset 216
	movl	%r13d, %ecx
	movl	%ebp, %r9d
	movl	%ebp, %r8d
	pushq	%r14
	.cfi_def_cfa_offset 224
	movq	120(%rsp), %rdx
	movq	112(%rsp), %rsi
	movq	104(%rsp), %rdi
	call	_Z43__device_stub__Z15MatrixMultiplyIPiS_S_iiiiPiS_S_iiii
	popq	%rdx
	.cfi_def_cfa_offset 216
	popq	%rcx
	.cfi_def_cfa_offset 208
.L76:
	movq	(%rsp), %rdx
	movq	104(%rsp), %rsi
	movl	$2, %ecx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movq	24(%rbx), %rdi
	leaq	80(%rsp), %rcx
	movq	%r15, %rdx
	leaq	32(%rsp), %rsi
	call	_Z13write_imatrixPcPiS0_PS0_
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
.L74:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L77
.L79:
	call	__stack_chk_fail@PLT
.L77:
	addq	$152, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	main, .-main
	.section	.rodata.str1.1
.LC14:
	.string	"_Z15MatrixMultiplyFPfS_S_iiii"
.LC15:
	.string	"_Z15MatrixMultiplyIPiS_S_iiii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2062:
	.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	.LC14(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z15MatrixMultiplyFPfS_S_iiii(%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	.LC15(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15MatrixMultiplyIPiS_S_iiii(%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
.LFE2062:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC12:
	.long	1031798784
	.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 <stdlib.h>
#include <math.h>
#include <hip/hip_runtime.h>


#define BLOCKSIZE 16

__global__ void MatrixMultiplyI(int *matrix1, int *matrix2, int *matrix3, int m1, int n1, int m2, int n2)
{
  int i, j;

  __shared__ int ds_M[BLOCKSIZE][BLOCKSIZE];
  __shared__ int ds_N[BLOCKSIZE][BLOCKSIZE];
  
  int bx = blockIdx.x;
  int by = blockIdx.y;
  int tx = threadIdx.x;
  int ty = threadIdx.y;

  int row = by * blockDim.y + ty;
  int col = bx * blockDim.x + tx;

  int sum = 0;
  for (i = 0; i < (n2-1)/BLOCKSIZE+1; i++)
  {
    if(row < n2 && i*BLOCKSIZE+tx < n2)
    {
      ds_M[ty][tx] = matrix1[row*n2 + i*BLOCKSIZE+tx];
    }
    else
    {
      ds_M[ty][tx] = 0;
    }
    if(i*BLOCKSIZE+ty < n2 && col < n2)
    {
      ds_N[ty][tx] = matrix2[(i*BLOCKSIZE+ty)*n2 + col];
    }
    else
    {
      ds_N[ty][tx] = 0;
    }
    __syncthreads();
    if(row < n2 && col < n2)
    {
      for (j = 0; j < BLOCKSIZE; j++)
      {
        sum = sum + (ds_M[ty][j] * ds_N[j][tx]);
      }
    }
    __syncthreads();
  }
  if(row < n2 && col < n2)
    matrix3[row*n2+col] = sum;
}

__global__ void MatrixMultiplyF(float *matrix1, float *matrix2, float *matrix3, int m1, int n1, int m2, int n2)
{
  int i, j;

  __shared__ float ds_M[BLOCKSIZE][BLOCKSIZE];
  __shared__ float ds_N[BLOCKSIZE][BLOCKSIZE];

  int bx = blockIdx.x;
  int by = blockIdx.y;
  int tx = threadIdx.x;
  int ty = threadIdx.y;

  int row = by * blockDim.y + ty;
  int col = bx * blockDim.x + tx;

  float sum = 0.0;

  for (i = 0; i < n2/BLOCKSIZE; i++)
  {
    if(row < n2 && i*BLOCKSIZE+tx < n2)
    {
      ds_M[ty][tx] = matrix1[row*n2 + i*BLOCKSIZE+tx];
    }
    else
    {
      ds_M[ty][tx] = 0.0;
    }
    if(i*BLOCKSIZE+ty < n2 && col < n2)
    {
      ds_N[ty][tx] = matrix2[(i*BLOCKSIZE+ty)*n2 + col];
    }
    else
    {
      ds_N[ty][tx] = 0.0;
    }
    __syncthreads();
    if(row < n2 && col < n2)
    {
      for (j = 0; j < BLOCKSIZE; j++)
      {
        sum = sum + (ds_M[ty][j] * ds_N[j][tx]);
      }
    }
    __syncthreads();
  }
  if(row < n2 && col < n2)
    matrix3[row*n2+col] = sum;
}

void read_imatrix(char *filename, int *m, int *n, int **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2, t3;
  name = fopen(filename, "r+");
  if(name != NULL)
  {
    k = 0;
    fscanf(name, "%d %d\n", &t1, &t2);
    *m = t1;
    *n = t2;
    *values = (int *)calloc(t1*t2, sizeof(int));
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          fscanf(name, "%d,", &t3);
          *(*values+k) = t3;
          k++;
        }
        else
        {
          fscanf(name, "%d\n", &t3);
          *(*values+k) = t3;
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File read failed\n");
    exit(1);
  }
}

void read_fmatrix(char *filename, int *m, int *n, float **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2;
  float t3;
  name = fopen(filename, "r+");
  if(name != NULL)
  {
    k = 0;
    fscanf(name, "%d %d\n", &t1, &t2);
    *m = t1;
    *n = t2;
    *values = (float *)calloc(t1*t2, sizeof(float));
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          fscanf(name, "%f,", &t3);
          *(*values+k) = t3;
          k++;
        }
        else
        {
          fscanf(name, "%f\n", &t3);
          *(*values+k) = t3;
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File read failed\n");
    exit(1);
  }
}

void write_imatrix(char *filename, int *m, int *n, int **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2, t3;
  name = fopen(filename, "w+");
  if(name != NULL)
  {
    k = 0;
    t1 = *m;
    t2 = *n;
    fprintf(name, "%d %d\n", t1, t2);
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          t3 = *(*values+k);
          fprintf(name, "%d,", t3);
          k++;
        }
        else
        {
          t3 = *(*values+k);
          fprintf(name, "%d\n", t3);
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File write failed\n");
    exit(1);
  }
}

void write_fmatrix(char *filename, int *m, int *n, float **values)
{
  FILE* name;
  int i, j, k;
  int t1, t2;
  float t3;
  name = fopen(filename, "w+");
  if(name != NULL)
  {
    k = 0;
    t1 = *m;
    t2 = *n;
    fprintf(name, "%d %d\n", t1, t2);
    for(i = 1; i <= t1; i++)
    {
      for(j = 1; j <= t2; j++)
      {
        if(j < t2)
        {
          t3 = *(*values+k);
          fprintf(name, "%f,", t3);
          k++;
        }
        else
        {
          t3 = *(*values+k);
          fprintf(name, "%f\n", t3);
          k++;
        }
      }
    }
    fclose(name);
  }
  else
  {
    printf("File write failed\n");
    exit(1);
  }
}

void matrix_check(int m1, int n1, int m2, int n2)
{
  if ((n1-m2) != 0)
  {
    printf("Matrix dimensions must be PxQ and QxR respectively\n");
    exit(1);
  }
}

int main(int argc, char *argv[])
{
  int m1, n1, m2, n2, GRIDX, GRIDY;

  if (argc != 5)
  {
    printf("Usage: ./matrix-multiplication matrix1.mat matrix2.mat matrix3.mat float/int \n");
    exit(1);
  }

  if (strcmp(argv[4], "float") == 0)
  {
    float *hostmatrix1, *hostmatrix2, *hostmatrix3;
    float *devicematrix1, *devicematrix2, *devicematrix3;
    read_fmatrix(argv[1], &m1, &n1, &hostmatrix1);
    read_fmatrix(argv[2], &m2, &n2, &hostmatrix2);
    matrix_check(m1, n1, m2, n2);
    size_t matrix_size = m1*n1*sizeof(float);
    hostmatrix3 = (float *)calloc(m1*n1, sizeof(float));
    hipMalloc(&devicematrix1, matrix_size);
    hipMalloc(&devicematrix2, matrix_size);
    hipMalloc(&devicematrix3, matrix_size);
    hipMemcpy(devicematrix1, hostmatrix1, matrix_size, hipMemcpyHostToDevice);
    hipMemcpy(devicematrix2, hostmatrix2, matrix_size, hipMemcpyHostToDevice);
    GRIDX = (int)ceil((float)m1/BLOCKSIZE);
    GRIDY = (int)ceil((float)n2/BLOCKSIZE);
    dim3 dimGrid(GRIDX, GRIDY, 1);
    dim3 dimBlock(BLOCKSIZE, BLOCKSIZE, 1);
    MatrixMultiplyF <<< dimGrid, dimBlock >>> (devicematrix1, devicematrix2, devicematrix3, m1, n1, m2, n2);
    hipMemcpy(hostmatrix3, devicematrix3, matrix_size, hipMemcpyDeviceToHost);
    write_fmatrix(argv[3], &m1, &n1, &hostmatrix3);
    hipFree(devicematrix1);
    hipFree(devicematrix2);
    hipFree(devicematrix3);
    free(hostmatrix1);
    free(hostmatrix2);
    free(hostmatrix3);
  }

  if (strcmp(argv[4], "int") == 0)
  {
    int *hostmatrix1, *hostmatrix2, *hostmatrix3;
    int *devicematrix1, *devicematrix2, *devicematrix3;
    read_imatrix(argv[1], &m1, &n1, &hostmatrix1);
    read_imatrix(argv[2], &m2, &n2, &hostmatrix2);
    matrix_check(m1, n1, m2, n2);
    size_t matrix_size = m1*n1*sizeof(int);
    hostmatrix3 = (int *)calloc(m1*n1, sizeof(int));
    hipMalloc(&devicematrix1, matrix_size);
    hipMalloc(&devicematrix2, matrix_size);
    hipMalloc(&devicematrix3, matrix_size);
    hipMemcpy(devicematrix1, hostmatrix1, matrix_size, hipMemcpyHostToDevice);
    hipMemcpy(devicematrix2, hostmatrix2, matrix_size, hipMemcpyHostToDevice);
    GRIDX = (int)ceil((float)m1/BLOCKSIZE);
    GRIDY = (int)ceil((float)n2/BLOCKSIZE);
    dim3 dimGrid(GRIDX, GRIDY, 1);
    dim3 dimBlock(BLOCKSIZE, BLOCKSIZE, 1);
    MatrixMultiplyI <<< dimGrid, dimBlock >>> (devicematrix1, devicematrix2, devicematrix3, m1, n1, m2, n2);
    hipMemcpy(hostmatrix3, devicematrix3, matrix_size, hipMemcpyDeviceToHost);
    write_imatrix(argv[3], &m1, &n1, &hostmatrix3);
    hipFree(devicematrix1);
    hipFree(devicematrix2);
    hipFree(devicematrix3);
    free(hostmatrix1);
    free(hostmatrix2);
    free(hostmatrix3);
  }

  return 0;
}

	.text
	.file	"matrix-multiplication.hip"
	.globl	_Z30__device_stub__MatrixMultiplyIPiS_S_iiii # -- Begin function _Z30__device_stub__MatrixMultiplyIPiS_S_iiii
	.type	_Z30__device_stub__MatrixMultiplyIPiS_S_iiii,@function
_Z30__device_stub__MatrixMultiplyIPiS_S_iiii: # @_Z30__device_stub__MatrixMultiplyIPiS_S_iiii
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	20(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	16(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%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	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15MatrixMultiplyIPiS_S_iiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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	_Z30__device_stub__MatrixMultiplyIPiS_S_iiii, .Lfunc_end0-_Z30__device_stub__MatrixMultiplyIPiS_S_iiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__MatrixMultiplyFPfS_S_iiii # -- Begin function _Z30__device_stub__MatrixMultiplyFPfS_S_iiii
	.type	_Z30__device_stub__MatrixMultiplyFPfS_S_iiii,@function
_Z30__device_stub__MatrixMultiplyFPfS_S_iiii: # @_Z30__device_stub__MatrixMultiplyFPfS_S_iiii
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	20(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	16(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%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	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15MatrixMultiplyFPfS_S_iiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z30__device_stub__MatrixMultiplyFPfS_S_iiii, .Lfunc_end1-_Z30__device_stub__MatrixMultiplyFPfS_S_iiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z12read_imatrixPcPiS0_PS0_     # -- Begin function _Z12read_imatrixPcPiS0_PS0_
	.type	_Z12read_imatrixPcPiS0_PS0_,@function
_Z12read_imatrixPcPiS0_PS0_:            # @_Z12read_imatrixPcPiS0_PS0_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %rbx
	movq	%rdx, 8(%rsp)                   # 8-byte Spill
	movq	%rsi, %r15
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB2_11
# %bb.1:
	movq	%rax, %r14
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %rbp
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	movq	%r13, %rdx
	movq	%rbp, %rcx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	(%r13), %r12d
	movl	%r12d, (%r15)
	movl	(%rbp), %ebp
	movq	8(%rsp), %rax                   # 8-byte Reload
	movl	%ebp, (%rax)
	movl	%ebp, %eax
	imull	%r12d, %eax
	movslq	%eax, %rdi
	movl	$4, %esi
	callq	calloc
	movq	%rax, (%rbx)
	testl	%r12d, %r12d
	jle	.LBB2_10
# %bb.2:                                # %.preheader.preheader
	movl	$1, %edx
	xorl	%ecx, %ecx
.LBB2_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_5 Depth 2
	testl	%ebp, %ebp
	jle	.LBB2_9
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB2_3 Depth=1
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	movl	%ecx, 8(%rsp)                   # 4-byte Spill
	movslq	%ecx, %r12
	shlq	$2, %r12
	xorl	%r13d, %r13d
.LBB2_5:                                # %.lr.ph
                                        #   Parent Loop BB2_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	1(%r13), %r15
	movl	$.L.str.2, %esi
	cmpl	%ebp, %r15d
	jl	.LBB2_7
# %bb.6:                                # %.lr.ph
                                        #   in Loop: Header=BB2_5 Depth=2
	movl	$.L.str.3, %esi
.LBB2_7:                                # %.lr.ph
                                        #   in Loop: Header=BB2_5 Depth=2
	movq	%r14, %rdi
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	20(%rsp), %eax
	movq	(%rbx), %rcx
	addq	%r12, %rcx
	movl	%eax, (%rcx,%r13,4)
	movl	24(%rsp), %ebp
	movq	%r15, %r13
	cmpl	%ebp, %r15d
	jl	.LBB2_5
# %bb.8:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB2_3 Depth=1
	movl	8(%rsp), %ecx                   # 4-byte Reload
	addl	%r15d, %ecx
	movl	28(%rsp), %r12d
	movq	32(%rsp), %rdx                  # 8-byte Reload
.LBB2_9:                                # %._crit_edge
                                        #   in Loop: Header=BB2_3 Depth=1
	leal	1(%rdx), %eax
	cmpl	%r12d, %edx
	movl	%eax, %edx
	jl	.LBB2_3
.LBB2_10:                               # %._crit_edge31
	movq	%r14, %rdi
	callq	fclose
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_11:
	.cfi_def_cfa_offset 96
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z12read_imatrixPcPiS0_PS0_, .Lfunc_end2-_Z12read_imatrixPcPiS0_PS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z12read_fmatrixPcPiS0_PPf      # -- Begin function _Z12read_fmatrixPcPiS0_PPf
	.type	_Z12read_fmatrixPcPiS0_PPf,@function
_Z12read_fmatrixPcPiS0_PPf:             # @_Z12read_fmatrixPcPiS0_PPf
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %rbx
	movq	%rdx, 8(%rsp)                   # 8-byte Spill
	movq	%rsi, %r15
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB3_11
# %bb.1:
	movq	%rax, %r14
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %rbp
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	movq	%r13, %rdx
	movq	%rbp, %rcx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	(%r13), %r12d
	movl	%r12d, (%r15)
	movl	(%rbp), %ebp
	movq	8(%rsp), %rax                   # 8-byte Reload
	movl	%ebp, (%rax)
	movl	%ebp, %eax
	imull	%r12d, %eax
	movslq	%eax, %rdi
	movl	$4, %esi
	callq	calloc
	movq	%rax, (%rbx)
	testl	%r12d, %r12d
	jle	.LBB3_10
# %bb.2:                                # %.preheader.preheader
	movl	$1, %edx
	xorl	%ecx, %ecx
.LBB3_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_5 Depth 2
	testl	%ebp, %ebp
	jle	.LBB3_9
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB3_3 Depth=1
	movq	%rdx, 32(%rsp)                  # 8-byte Spill
	movl	%ecx, 8(%rsp)                   # 4-byte Spill
	movslq	%ecx, %r12
	shlq	$2, %r12
	xorl	%r13d, %r13d
.LBB3_5:                                # %.lr.ph
                                        #   Parent Loop BB3_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	1(%r13), %r15
	movl	$.L.str.5, %esi
	cmpl	%ebp, %r15d
	jl	.LBB3_7
# %bb.6:                                # %.lr.ph
                                        #   in Loop: Header=BB3_5 Depth=2
	movl	$.L.str.6, %esi
.LBB3_7:                                # %.lr.ph
                                        #   in Loop: Header=BB3_5 Depth=2
	movq	%r14, %rdi
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movss	20(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movq	(%rbx), %rax
	addq	%r12, %rax
	movss	%xmm0, (%rax,%r13,4)
	movl	24(%rsp), %ebp
	movq	%r15, %r13
	cmpl	%ebp, %r15d
	jl	.LBB3_5
# %bb.8:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB3_3 Depth=1
	movl	8(%rsp), %ecx                   # 4-byte Reload
	addl	%r15d, %ecx
	movl	28(%rsp), %r12d
	movq	32(%rsp), %rdx                  # 8-byte Reload
.LBB3_9:                                # %._crit_edge
                                        #   in Loop: Header=BB3_3 Depth=1
	leal	1(%rdx), %eax
	cmpl	%r12d, %edx
	movl	%eax, %edx
	jl	.LBB3_3
.LBB3_10:                               # %._crit_edge31
	movq	%r14, %rdi
	callq	fclose
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB3_11:
	.cfi_def_cfa_offset 96
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end3:
	.size	_Z12read_fmatrixPcPiS0_PPf, .Lfunc_end3-_Z12read_fmatrixPcPiS0_PPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z13write_imatrixPcPiS0_PS0_    # -- Begin function _Z13write_imatrixPcPiS0_PS0_
	.type	_Z13write_imatrixPcPiS0_PS0_,@function
_Z13write_imatrixPcPiS0_PS0_:           # @_Z13write_imatrixPcPiS0_PS0_
	.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	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, %r12
	movl	$.L.str.7, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB4_9
# %bb.1:
	movq	%rax, %r14
	movl	(%r12), %ebp
	movl	(%r15), %r15d
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	movl	%ebp, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movl	%ebp, 12(%rsp)                  # 4-byte Spill
	testl	%ebp, %ebp
	jle	.LBB4_8
# %bb.2:                                # %.preheader.lr.ph
	movl	%r15d, %r12d
	negl	%r12d
	movl	$1, %edx
	movl	$.L.str.2, %ecx
	xorl	%ebp, %ebp
.LBB4_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_5 Depth 2
	testl	%r15d, %r15d
	jle	.LBB4_7
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB4_3 Depth=1
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movslq	%ebp, %rbp
	movl	$1, %r13d
.LBB4_5:                                # %.lr.ph
                                        #   Parent Loop BB4_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	%r15d, %r13d
	movq	(%rbx), %rax
	movl	(%rax,%rbp,4), %edx
	movl	$.L.str.3, %esi
	cmovlq	%rcx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	fprintf
	incq	%rbp
	leal	(%r12,%r13), %eax
	incl	%eax
	movl	%r13d, %ecx
	incl	%ecx
	movl	%ecx, %r13d
	movl	$.L.str.2, %ecx
	cmpl	$1, %eax
	jne	.LBB4_5
# %bb.6:                                #   in Loop: Header=BB4_3 Depth=1
	movq	16(%rsp), %rdx                  # 8-byte Reload
.LBB4_7:                                # %._crit_edge
                                        #   in Loop: Header=BB4_3 Depth=1
	leal	1(%rdx), %eax
	cmpl	12(%rsp), %edx                  # 4-byte Folded Reload
	movl	%eax, %edx
	jne	.LBB4_3
.LBB4_8:                                # %._crit_edge37
	movq	%r14, %rdi
	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
	jmp	fclose                          # TAILCALL
.LBB4_9:
	.cfi_def_cfa_offset 80
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z13write_imatrixPcPiS0_PS0_, .Lfunc_end4-_Z13write_imatrixPcPiS0_PS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13write_fmatrixPcPiS0_PPf     # -- Begin function _Z13write_fmatrixPcPiS0_PPf
	.type	_Z13write_fmatrixPcPiS0_PPf,@function
_Z13write_fmatrixPcPiS0_PPf:            # @_Z13write_fmatrixPcPiS0_PPf
	.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	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, %r12
	movl	$.L.str.7, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_9
# %bb.1:
	movq	%rax, %r14
	movl	(%r12), %ebp
	movl	(%r15), %r15d
	xorl	%r12d, %r12d
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	movl	%ebp, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movl	%ebp, 12(%rsp)                  # 4-byte Spill
	testl	%ebp, %ebp
	jle	.LBB5_8
# %bb.2:                                # %.preheader.lr.ph
	movl	%r15d, %r13d
	negl	%r13d
	movl	$1, %edx
	movl	$.L.str.5, %ecx
.LBB5_3:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_5 Depth 2
	testl	%r15d, %r15d
	jle	.LBB5_7
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB5_3 Depth=1
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movslq	%r12d, %r12
	movl	$1, %ebp
.LBB5_5:                                # %.lr.ph
                                        #   Parent Loop BB5_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%rbx), %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rax,%r12,4), %xmm0
	cmpl	%r15d, %ebp
	movl	$.L.str.6, %esi
	cmovlq	%rcx, %rsi
	movq	%r14, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	leal	1(%r13,%rbp), %eax
	movl	%ebp, %ecx
	incl	%ecx
	movl	%ecx, %ebp
	movl	$.L.str.5, %ecx
	cmpl	$1, %eax
	jne	.LBB5_5
# %bb.6:                                #   in Loop: Header=BB5_3 Depth=1
	movq	16(%rsp), %rdx                  # 8-byte Reload
.LBB5_7:                                # %._crit_edge
                                        #   in Loop: Header=BB5_3 Depth=1
	leal	1(%rdx), %eax
	cmpl	12(%rsp), %edx                  # 4-byte Folded Reload
	movl	%eax, %edx
	jne	.LBB5_3
.LBB5_8:                                # %._crit_edge37
	movq	%r14, %rdi
	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
	jmp	fclose                          # TAILCALL
.LBB5_9:
	.cfi_def_cfa_offset 80
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end5:
	.size	_Z13write_fmatrixPcPiS0_PPf, .Lfunc_end5-_Z13write_fmatrixPcPiS0_PPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z12matrix_checkiiii            # -- Begin function _Z12matrix_checkiiii
	.type	_Z12matrix_checkiiii,@function
_Z12matrix_checkiiii:                   # @_Z12matrix_checkiiii
	.cfi_startproc
# %bb.0:
	cmpl	%edx, %esi
	jne	.LBB6_2
# %bb.1:
	retq
.LBB6_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	_Z12matrix_checkiiii, .Lfunc_end6-_Z12matrix_checkiiii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI7_0:
	.long	0x3d800000                      # float 0.0625
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.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	$5, %edi
	jne	.LBB7_1
# %bb.3:
	movq	%rsi, %rbx
	movq	32(%rsi), %r14
	movl	$.L.str.11, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB7_9
# %bb.4:
	movq	8(%rbx), %rdi
	leaq	12(%rsp), %rsi
	leaq	28(%rsp), %r14
	leaq	88(%rsp), %rcx
	movq	%r14, %rdx
	callq	_Z12read_fmatrixPcPiS0_PPf
	movq	16(%rbx), %rdi
	leaq	100(%rsp), %r15
	leaq	24(%rsp), %rdx
	leaq	80(%rsp), %rcx
	movq	%r15, %rsi
	callq	_Z12read_fmatrixPcPiS0_PPf
	movl	(%r14), %ebp
	cmpl	(%r15), %ebp
	jne	.LBB7_5
# %bb.6:                                # %_Z12matrix_checkiiii.exit
	movl	12(%rsp), %r15d
	movl	%r15d, %eax
	imull	%ebp, %eax
	movslq	%eax, %rdi
	leaq	(,%rdi,4), %r12
	movl	$4, %esi
	callq	calloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	%rax, 72(%rsp)
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	32(%rsp), %r14
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	movq	(%r13), %rdi
	movq	88(%rsp), %rsi
	movq	%rsi, 56(%rsp)                  # 8-byte Spill
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r14), %rdi
	movq	80(%rsp), %rsi
	movq	%rsi, 48(%rsp)                  # 8-byte Spill
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	cvtsi2ss	%r15d, %xmm0
	mulss	.LCPI7_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %r13d
	movl	24(%rsp), %r14d
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r14d, %xmm0
	mulss	.LCPI7_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %edi
	shlq	$32, %rdi
	orq	%r13, %rdi
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_8
# %bb.7:
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	%r14d, (%rsp)
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	movl	%ebp, %r9d
	callq	_Z30__device_stub__MatrixMultiplyFPfS_S_iiii
.LBB7_8:
	movq	16(%rsp), %rsi
	movq	64(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rbx), %rdi
	leaq	12(%rsp), %rsi
	leaq	28(%rsp), %rdx
	leaq	72(%rsp), %rcx
	callq	_Z13write_fmatrixPcPiS0_PPf
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	32(%rbx), %r14
.LBB7_9:
	movl	$.L.str.12, %esi
	movq	%r14, %rdi
	callq	strcmp
	testl	%eax, %eax
	jne	.LBB7_14
# %bb.10:
	movq	8(%rbx), %rdi
	leaq	12(%rsp), %rsi
	leaq	28(%rsp), %r14
	leaq	88(%rsp), %rcx
	movq	%r14, %rdx
	callq	_Z12read_imatrixPcPiS0_PS0_
	movq	16(%rbx), %rdi
	leaq	100(%rsp), %r15
	leaq	24(%rsp), %rdx
	leaq	80(%rsp), %rcx
	movq	%r15, %rsi
	callq	_Z12read_imatrixPcPiS0_PS0_
	movl	(%r14), %ebp
	cmpl	(%r15), %ebp
	jne	.LBB7_5
# %bb.11:                               # %_Z12matrix_checkiiii.exit42
	movl	12(%rsp), %r15d
	movl	%r15d, %eax
	imull	%ebp, %eax
	movslq	%eax, %rdi
	leaq	(,%rdi,4), %r12
	movl	$4, %esi
	callq	calloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movq	%rax, 72(%rsp)
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	32(%rsp), %r14
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	movq	(%r13), %rdi
	movq	88(%rsp), %rsi
	movq	%rsi, 56(%rsp)                  # 8-byte Spill
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r14), %rdi
	movq	80(%rsp), %rsi
	movq	%rsi, 48(%rsp)                  # 8-byte Spill
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	cvtsi2ss	%r15d, %xmm0
	mulss	.LCPI7_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %r13d
	movl	24(%rsp), %r14d
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r14d, %xmm0
	mulss	.LCPI7_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %edi
	shlq	$32, %rdi
	orq	%r13, %rdi
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_13
# %bb.12:
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	%r14d, (%rsp)
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	movl	%ebp, %r9d
	callq	_Z30__device_stub__MatrixMultiplyIPiS_S_iiii
.LBB7_13:
	movq	16(%rsp), %rsi
	movq	64(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rbx), %rdi
	leaq	12(%rsp), %rsi
	leaq	28(%rsp), %rdx
	leaq	72(%rsp), %rcx
	callq	_Z13write_imatrixPcPiS0_PS0_
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r14, %rdi
	callq	free
.LBB7_14:
	xorl	%eax, %eax
	addq	$104, %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
.LBB7_1:
	.cfi_def_cfa_offset 160
	movl	$.Lstr.5, %edi
	jmp	.LBB7_2
.LBB7_5:
	movl	$.Lstr.4, %edi
.LBB7_2:
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end7:
	.size	main, .Lfunc_end7-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	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15MatrixMultiplyIPiS_S_iiii, %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	$_Z15MatrixMultiplyFPfS_S_iiii, %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_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z15MatrixMultiplyIPiS_S_iiii,@object # @_Z15MatrixMultiplyIPiS_S_iiii
	.section	.rodata,"a",@progbits
	.globl	_Z15MatrixMultiplyIPiS_S_iiii
	.p2align	3, 0x0
_Z15MatrixMultiplyIPiS_S_iiii:
	.quad	_Z30__device_stub__MatrixMultiplyIPiS_S_iiii
	.size	_Z15MatrixMultiplyIPiS_S_iiii, 8

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

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%d %d\n"
	.size	.L.str.1, 7

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%d,"
	.size	.L.str.2, 4

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%f,"
	.size	.L.str.5, 4

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"%f\n"
	.size	.L.str.6, 4

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

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

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"int"
	.size	.L.str.12, 4

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15MatrixMultiplyIPiS_S_iiii"
	.size	.L__unnamed_1, 30

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z15MatrixMultiplyFPfS_S_iiii"
	.size	.L__unnamed_2, 30

	.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	"File read failed"
	.size	.Lstr.1, 17

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"File write failed"
	.size	.Lstr.3, 18

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Matrix dimensions must be PxQ and QxR respectively"
	.size	.Lstr.4, 51

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Usage: ./matrix-multiplication matrix1.mat matrix2.mat matrix3.mat float/int "
	.size	.Lstr.5, 78

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z30__device_stub__MatrixMultiplyIPiS_S_iiii
	.addrsig_sym _Z30__device_stub__MatrixMultiplyFPfS_S_iiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z15MatrixMultiplyIPiS_S_iiii
	.addrsig_sym _Z15MatrixMultiplyFPfS_S_iiii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15MatrixMultiplyIPiS_S_iiii ; -- Begin function _Z15MatrixMultiplyIPiS_S_iiii
	.globl	_Z15MatrixMultiplyIPiS_S_iiii
	.p2align	8
	.type	_Z15MatrixMultiplyIPiS_S_iiii,@function
_Z15MatrixMultiplyIPiS_S_iiii:          ; @_Z15MatrixMultiplyIPiS_S_iiii
; %bb.0:
	s_clause 0x3
	s_load_b32 s9, s[0:1], 0x34
	s_load_b32 s8, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	v_bfe_u32 v3, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s0, s9, 16
	s_and_b32 s1, s9, 0xffff
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_u64_u32 v[0:1], null, s15, s0, v[3:4]
	v_mad_u64_u32 v[1:2], null, s14, s1, v[4:5]
	v_mov_b32_e32 v2, 0
	s_cmp_lt_i32 s8, -14
	s_cbranch_scc1 .LBB0_11
; %bb.1:                                ; %.lr.ph
	v_lshlrev_b32_e32 v2, 2, v4
	s_add_i32 s0, s8, -1
	v_lshlrev_b32_e32 v5, 6, v3
	s_ashr_i32 s1, s0, 31
	v_mul_lo_u32 v7, v0, s8
	v_add_nc_u32_e32 v6, 0x400, v2
	s_lshr_b32 s1, s1, 28
	v_cmp_gt_i32_e32 vcc_lo, s8, v0
	s_add_i32 s1, s0, s1
	v_cmp_gt_i32_e64 s0, s8, v1
	v_add_nc_u32_e32 v8, v5, v2
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v9, v6, v5
	s_ashr_i32 s9, s1, 4
	s_delay_alu instid0(VALU_DEP_3)
	s_and_b32 s10, vcc_lo, s0
	s_mov_b32 s11, 0
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b32 s12, s11, 4
	v_dual_mov_b32 v10, 0 :: v_dual_add_nc_u32 v11, s12, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s1, s8, v11
	s_and_b32 s1, vcc_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s13, s1
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	v_add_nc_u32_e32 v10, v11, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v11, 31, v10
	v_lshlrev_b64 v[10:11], 2, v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s1, s4, v10
	v_add_co_ci_u32_e64 v11, s1, s5, v11, s1
	global_load_b32 v10, v[10:11], off
.LBB0_4:                                ; %._crit_edge75
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	v_dual_mov_b32 v12, 0 :: v_dual_add_nc_u32 v11, s12, v3
	s_waitcnt vmcnt(0)
	ds_store_b32 v8, v10
	v_cmp_gt_i32_e64 s1, s8, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s0, s1
	s_and_saveexec_b32 s12, s1
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	v_mad_u64_u32 v[12:13], null, v11, s8, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v13, 31, v12
	v_lshlrev_b64 v[10:11], 2, v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s1, s6, v10
	v_add_co_ci_u32_e64 v11, s1, s7, v11, s1
	global_load_b32 v12, v[10:11], off
.LBB0_6:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s12
	s_waitcnt vmcnt(0)
	ds_store_b32 v9, v12
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s1, s10
	s_cbranch_execz .LBB0_9
; %bb.7:                                ; %.preheader.preheader
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_mov_b32_e32 v10, v6
	s_mov_b32 s12, 0
.LBB0_8:                                ; %.preheader
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_nc_u32_e32 v11, s12, v5
	s_add_i32 s12, s12, 4
	ds_load_b32 v13, v10
	ds_load_b32 v14, v11
	v_add_nc_u32_e32 v10, 64, v10
	s_cmp_lg_u32 s12, 64
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[11:12], null, v13, v14, v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v2, v11
	s_cbranch_scc1 .LBB0_8
.LBB0_9:                                ; %Flow96
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_add_i32 s1, s11, 1
	s_cmp_lg_u32 s11, s9
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_2 Depth=1
	s_mov_b32 s11, s1
	s_branch .LBB0_2
.LBB0_11:                               ; %._crit_edge
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_max_i32_e32 v3, v0, v1
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_i32_e64 s8, v3
	s_cbranch_execz .LBB0_13
; %bb.12:
	v_mad_u64_u32 v[3:4], null, v0, s8, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB0_13:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15MatrixMultiplyIPiS_S_iiii
		.amdhsa_group_segment_fixed_size 2048
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 1
		.amdhsa_next_free_vgpr 15
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z15MatrixMultiplyIPiS_S_iiii, .Lfunc_end0-_Z15MatrixMultiplyIPiS_S_iiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 600
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 2048 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 15
; 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: 1
	.text
	.protected	_Z15MatrixMultiplyFPfS_S_iiii ; -- Begin function _Z15MatrixMultiplyFPfS_S_iiii
	.globl	_Z15MatrixMultiplyFPfS_S_iiii
	.p2align	8
	.type	_Z15MatrixMultiplyFPfS_S_iiii,@function
_Z15MatrixMultiplyFPfS_S_iiii:          ; @_Z15MatrixMultiplyFPfS_S_iiii
; %bb.0:
	s_clause 0x3
	s_load_b32 s9, s[0:1], 0x34
	s_load_b32 s8, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	v_bfe_u32 v3, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s0, s9, 16
	s_and_b32 s1, s9, 0xffff
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_u64_u32 v[0:1], null, s15, s0, v[3:4]
	v_mad_u64_u32 v[1:2], null, s14, s1, v[4:5]
	v_mov_b32_e32 v2, 0
	s_cmp_lt_i32 s8, 16
	s_cbranch_scc1 .LBB1_10
; %bb.1:                                ; %.lr.ph
	v_lshlrev_b32_e32 v2, 2, v4
	v_lshlrev_b32_e32 v5, 6, v3
	s_ashr_i32 s0, s8, 31
	v_mul_lo_u32 v6, v0, s8
	v_cmp_gt_i32_e32 vcc_lo, s8, v0
	v_add_nc_u32_e32 v7, 0x400, v2
	s_lshr_b32 s1, s0, 28
	v_cmp_gt_i32_e64 s0, s8, v1
	v_add_nc_u32_e32 v8, v5, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v9, v7, v5
	s_add_i32 s1, s8, s1
	s_and_b32 s10, vcc_lo, s0
	s_ashr_i32 s9, s1, 4
	s_mov_b32 s11, 0
.LBB1_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_8 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b32 s12, s11, 4
	v_dual_mov_b32 v10, 0 :: v_dual_add_nc_u32 v11, s12, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s1, s8, v11
	s_and_b32 s1, vcc_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s13, s1
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	v_add_nc_u32_e32 v10, v11, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v11, 31, v10
	v_lshlrev_b64 v[10:11], 2, v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s1, s4, v10
	v_add_co_ci_u32_e64 v11, s1, s5, v11, s1
	global_load_b32 v10, v[10:11], off
.LBB1_4:                                ; %._crit_edge74
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	v_dual_mov_b32 v12, 0 :: v_dual_add_nc_u32 v11, s12, v3
	s_waitcnt vmcnt(0)
	ds_store_b32 v8, v10
	v_cmp_gt_i32_e64 s1, s8, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s0, s1
	s_and_saveexec_b32 s12, s1
	s_cbranch_execz .LBB1_6
; %bb.5:                                ;   in Loop: Header=BB1_2 Depth=1
	v_mad_u64_u32 v[12:13], null, v11, s8, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v13, 31, v12
	v_lshlrev_b64 v[10:11], 2, v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s1, s6, v10
	v_add_co_ci_u32_e64 v11, s1, s7, v11, s1
	global_load_b32 v12, v[10:11], off
.LBB1_6:                                ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s12
	s_waitcnt vmcnt(0)
	ds_store_b32 v9, v12
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s1, s10
	s_cbranch_execz .LBB1_9
; %bb.7:                                ; %.preheader.preheader
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_mov_b32_e32 v10, v7
	s_mov_b32 s12, 0
.LBB1_8:                                ; %.preheader
                                        ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_nc_u32_e32 v11, s12, v5
	s_add_i32 s12, s12, 4
	ds_load_b32 v12, v10
	ds_load_b32 v11, v11
	v_add_nc_u32_e32 v10, 64, v10
	s_cmp_lg_u32 s12, 64
	s_waitcnt lgkmcnt(0)
	v_fmac_f32_e32 v2, v11, v12
	s_cbranch_scc1 .LBB1_8
.LBB1_9:                                ; %Flow95
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_add_i32 s11, s11, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s11, s9
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_2
.LBB1_10:                               ; %._crit_edge
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_max_i32_e32 v3, v0, v1
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_i32_e64 s8, v3
	s_cbranch_execz .LBB1_12
; %bb.11:
	v_mad_u64_u32 v[3:4], null, v0, s8, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB1_12:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15MatrixMultiplyFPfS_S_iiii
		.amdhsa_group_segment_fixed_size 2048
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 1
		.amdhsa_next_free_vgpr 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z15MatrixMultiplyFPfS_S_iiii, .Lfunc_end1-_Z15MatrixMultiplyFPfS_S_iiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 580
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 2048 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; 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: 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:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 2048
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15MatrixMultiplyIPiS_S_iiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15MatrixMultiplyIPiS_S_iiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 2048
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15MatrixMultiplyFPfS_S_iiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15MatrixMultiplyFPfS_S_iiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
