#include <cassert>
#include <cstdlib>
#include <iostream>

void print_matrix(int *m, int y, int x) {
  for(int i = 0; i < y; i++) {
    printf("[");
    for(int j = 0; j < x; j ++)
      printf("%d, ", m[i * x + j]);
    printf("]\n");
  }
  printf("\n");
}

void init_matrix(int *m, int l) {
  for (int i = 0; i < l; i++) {
    m[i] = rand() % 100;
  }
}

__global__ void matmul2d(int *a, int *b, int *c, int m, int n) {
  int i = blockIdx.y * blockDim.y + threadIdx.y; 
  int j = blockIdx.x * blockDim.x + threadIdx.x;
  
  int temp = 0;
  for (int k = 0; k < m; k++) {
    temp += a[i * m + k] * b[k * n + j];
  }
  c[i * n + j] = temp;
}

void verify_result(int *a, int *b, int *c, int l, int m, int n) {
  int temp = 0;
  for(int i = 0; i < l; i++) {
    for(int j = 0; j < n; j++) {
      temp = 0;
      for(int k = 0; k < m; k++) {
        temp += a[i * m + k] * b[k * n + j]; //c[i][j] += a[i][k] * b[k][j]
      }
      assert(c[i * n + j] == temp); 
    }
  }

  printf("result[%d] = %d == %d = temp \n", l * n - 1, c[l * n - 1], temp);
}

int main() {
  //a of size l * m and b of size m * n
  //a @ b is of size l * n

  int L = 1 << 9; //512
  int M = 1 << 8; //256
  int N = 1 << 10; //1024

  size_t bytes_a = sizeof(int) * L * M;
  size_t bytes_b = sizeof(int) * M * N;
  size_t bytes_c = sizeof(int) * L * N;

  int *a = new int[L * M];
  int *b = new int[M * N];
  int *c = new int[L * N];

  init_matrix(a, L * M);
  init_matrix(b, M * N);

  int *d_a, *d_b, *d_c;
  cudaMalloc(&d_a, bytes_a); cudaMalloc(&d_b, bytes_b); cudaMalloc(&d_c, bytes_c);
  cudaMemcpy(d_a, a, bytes_a, cudaMemcpyHostToDevice);
  cudaMemcpy(d_b, b, bytes_b, cudaMemcpyHostToDevice);
  cudaMemcpy(d_c, c, bytes_c, cudaMemcpyHostToDevice);
  
  int n_threads = 32;

  dim3 block_dim(n_threads, n_threads);
  dim3 grid_dim(N/n_threads, L/n_threads);

  matmul2d<<<grid_dim, block_dim>>>(d_a, d_b, d_c, M, N);
  cudaMemcpy(c, d_c, bytes_c, cudaMemcpyDeviceToHost); 

  verify_result(a, b, c, L, M, N);

  std::cout << "COMPLETED SUCCESSFULLY! \n";

  delete[] a; delete[] b; delete[] c;
  cudaFree(d_a); cudaFree(d_b); cudaFree(d_c);

  return 0;
}



	.file	"tmpxft_0025580a_00000000-6_mmul.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3641:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3641:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"["
.LC1:
	.string	"%d, "
.LC2:
	.string	"]\n"
.LC3:
	.string	"\n"
	.text
	.globl	_Z12print_matrixPiii
	.type	_Z12print_matrixPiii, @function
_Z12print_matrixPiii:
.LFB3635:
	.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	%rdi, %r14
	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
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L3:
	cmpl	%ebp, %r12d
	jge	.L9
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
	movslq	%r13d, %rax
	leaq	(%r14,%rax,4), %r8
.L4:
	cmpl	%r15d, %ebx
	jle	.L10
	movl	(%r8,%r15,4), %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	incq	%r15
	movl	$2, %edi
	movq	%r8, 8(%rsp)
	call	__printf_chk@PLT
	movq	8(%rsp), %r8
	jmp	.L4
.L10:
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	incl	%r12d
	addl	%ebx, %r13d
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L3
.L9:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	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
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE3635:
	.size	_Z12print_matrixPiii, .-_Z12print_matrixPiii
	.globl	_Z11init_matrixPii
	.type	_Z11init_matrixPii, @function
_Z11init_matrixPii:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$100, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L12:
	cmpl	%ebx, %ebp
	jle	.L15
	call	rand@PLT
	cltd
	idivl	%r13d
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L12
.L15:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3636:
	.size	_Z11init_matrixPii, .-_Z11init_matrixPii
	.section	.rodata.str1.1
.LC4:
	.string	"result[%d] = %d == %d = temp \n"
	.text
	.globl	_Z13verify_resultPiS_S_iii
	.type	_Z13verify_resultPiS_S_iii, @function
_Z13verify_resultPiS_S_iii:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %eax
	movq	%rdi, %r10
	xorl	%r11d, %r11d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r8d, %r8d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%r9d, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	salq	$2, %r12
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, -16(%rsp)
	movl	%ecx, %edx
.L17:
	cmpl	%edx, %ebp
	jge	.L20
	movslq	%r11d, %rcx
	movq	%rsi, %rbx
	xorl	%edi, %edi
	leaq	(%r10,%rcx,4), %r15
.L21:
	cmpl	%r9d, %edi
	jge	.L24
	movq	%rbx, %r13
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
.L19:
	cmpl	%ecx, %eax
	jle	.L25
	movl	(%r15,%rcx,4), %r14d
	imull	0(%r13), %r14d
	incq	%rcx
	addq	%r12, %r13
	addl	%r14d, %r8d
	jmp	.L19
.L25:
	incl	%edi
	addq	$4, %rbx
	jmp	.L21
.L24:
	incl	%ebp
	addl	%eax, %r11d
	jmp	.L17
.L20:
	imull	%r9d, %edx
	movq	-16(%rsp), %rbx
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
	movslq	%edx, %rax
	decl	%edx
	movl	-4(%rbx,%rax,4), %ecx
	popq	%rbx
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	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	__printf_chk@PLT
	.cfi_endproc
.LFE3637:
	.size	_Z13verify_resultPiS_S_iii, .-_Z13verify_resultPiS_S_iii
	.globl	_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii
	.type	_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii, @function
_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii:
.LFB3663:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z8matmul2dPiS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L26:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii, .-_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii
	.globl	_Z8matmul2dPiS_S_ii
	.type	_Z8matmul2dPiS_S_ii, @function
_Z8matmul2dPiS_S_ii:
.LFB3664:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii
	.cfi_endproc
.LFE3664:
	.size	_Z8matmul2dPiS_S_ii, .-_Z8matmul2dPiS_S_ii
	.section	.rodata.str1.1
.LC5:
	.string	"COMPLETED SUCCESSFULLY! \n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$524288, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$64, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	_Znam@PLT
	movl	$1048576, %edi
	movq	%rax, %r12
	call	_Znam@PLT
	movl	$2097152, %edi
	movq	%rax, %rbp
	call	_Znam@PLT
	movl	$131072, %esi
	movq	%r12, %rdi
	movq	%rax, %rbx
	call	_Z11init_matrixPii
	movl	$262144, %esi
	movq	%rbp, %rdi
	call	_Z11init_matrixPii
	leaq	8(%rsp), %rdi
	movl	$524288, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1048576, %esi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$2097152, %esi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$524288, %edx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$1048576, %edx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$2097152, %edx
	call	cudaMemcpy@PLT
	movl	$2147483649, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$5, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$137438953504, %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$256, %ecx
	movl	$1024, %r8d
	movq	8(%rsp), %rdi
	call	_Z33__device_stub__Z8matmul2dPiS_S_iiPiS_S_ii
.L32:
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movl	$2097152, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movl	$512, %ecx
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movl	$1024, %r9d
	movl	$256, %r8d
	movq	%r12, %rdi
	call	_Z13verify_resultPiS_S_iii
	movl	$25, %edx
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	movq	%r12, %rdi
	call	_ZdaPv@PLT
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$64, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	main, .-main
	.section	.rodata.str1.1
.LC6:
	.string	"_Z8matmul2dPiS_S_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3666:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC6(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z8matmul2dPiS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	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	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3666:
	.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 <cassert>
#include <cstdlib>
#include <iostream>

void print_matrix(int *m, int y, int x) {
  for(int i = 0; i < y; i++) {
    printf("[");
    for(int j = 0; j < x; j ++)
      printf("%d, ", m[i * x + j]);
    printf("]\n");
  }
  printf("\n");
}

void init_matrix(int *m, int l) {
  for (int i = 0; i < l; i++) {
    m[i] = rand() % 100;
  }
}

__global__ void matmul2d(int *a, int *b, int *c, int m, int n) {
  int i = blockIdx.y * blockDim.y + threadIdx.y; 
  int j = blockIdx.x * blockDim.x + threadIdx.x;
  
  int temp = 0;
  for (int k = 0; k < m; k++) {
    temp += a[i * m + k] * b[k * n + j];
  }
  c[i * n + j] = temp;
}

void verify_result(int *a, int *b, int *c, int l, int m, int n) {
  int temp = 0;
  for(int i = 0; i < l; i++) {
    for(int j = 0; j < n; j++) {
      temp = 0;
      for(int k = 0; k < m; k++) {
        temp += a[i * m + k] * b[k * n + j]; //c[i][j] += a[i][k] * b[k][j]
      }
      assert(c[i * n + j] == temp); 
    }
  }

  printf("result[%d] = %d == %d = temp \n", l * n - 1, c[l * n - 1], temp);
}

int main() {
  //a of size l * m and b of size m * n
  //a @ b is of size l * n

  int L = 1 << 9; //512
  int M = 1 << 8; //256
  int N = 1 << 10; //1024

  size_t bytes_a = sizeof(int) * L * M;
  size_t bytes_b = sizeof(int) * M * N;
  size_t bytes_c = sizeof(int) * L * N;

  int *a = new int[L * M];
  int *b = new int[M * N];
  int *c = new int[L * N];

  init_matrix(a, L * M);
  init_matrix(b, M * N);

  int *d_a, *d_b, *d_c;
  hipMalloc(&d_a, bytes_a); hipMalloc(&d_b, bytes_b); hipMalloc(&d_c, bytes_c);
  hipMemcpy(d_a, a, bytes_a, hipMemcpyHostToDevice);
  hipMemcpy(d_b, b, bytes_b, hipMemcpyHostToDevice);
  hipMemcpy(d_c, c, bytes_c, hipMemcpyHostToDevice);
  
  int n_threads = 32;

  dim3 block_dim(n_threads, n_threads);
  dim3 grid_dim(N/n_threads, L/n_threads);

  matmul2d<<<grid_dim, block_dim>>>(d_a, d_b, d_c, M, N);
  hipMemcpy(c, d_c, bytes_c, hipMemcpyDeviceToHost); 

  verify_result(a, b, c, L, M, N);

  std::cout << "COMPLETED SUCCESSFULLY! \n";

  delete[] a; delete[] b; delete[] c;
  hipFree(d_a); hipFree(d_b); hipFree(d_c);

  return 0;
}



	.text
	.file	"mmul.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z12print_matrixPiii            # -- Begin function _Z12print_matrixPiii
	.type	_Z12print_matrixPiii,@function
_Z12print_matrixPiii:                   # @_Z12print_matrixPiii
	.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	.LBB0_6
# %bb.1:                                # %.lr.ph15
	movl	%edx, %ebx
	movl	%esi, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%edx, %r12d
	xorl	%ebp, %ebp
	xorl	%r13d, %r13d
.LBB0_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	movl	$91, %edi
	callq	putchar@PLT
	testl	%ebx, %ebx
	jle	.LBB0_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	%ebp, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r14
	xorl	%r15d, %r15d
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r14,%r15,4), %esi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB0_4
.LBB0_5:                                # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	$.Lstr, %edi
	callq	puts@PLT
	incq	%r13
	addl	%ebx, %ebp
	cmpq	16(%rsp), %r13                  # 8-byte Folded Reload
	jne	.LBB0_2
.LBB0_6:                                # %._crit_edge16
	movl	$10, %edi
	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	putchar@PLT                     # TAILCALL
.Lfunc_end0:
	.size	_Z12print_matrixPiii, .Lfunc_end0-_Z12print_matrixPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z11init_matrixPii              # -- Begin function _Z11init_matrixPii
	.type	_Z11init_matrixPii,@function
_Z11init_matrixPii:                     # @_Z11init_matrixPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB1_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1374389535, %rax, %rcx         # imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$37, %rcx
	addl	%edx, %ecx
	imull	$100, %ecx, %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_4:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z11init_matrixPii, .Lfunc_end1-_Z11init_matrixPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z23__device_stub__matmul2dPiS_S_ii # -- Begin function _Z23__device_stub__matmul2dPiS_S_ii
	.type	_Z23__device_stub__matmul2dPiS_S_ii,@function
_Z23__device_stub__matmul2dPiS_S_ii:    # @_Z23__device_stub__matmul2dPiS_S_ii
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z8matmul2dPiS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z23__device_stub__matmul2dPiS_S_ii, .Lfunc_end2-_Z23__device_stub__matmul2dPiS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z13verify_resultPiS_S_iii      # -- Begin function _Z13verify_resultPiS_S_iii
	.type	_Z13verify_resultPiS_S_iii,@function
_Z13verify_resultPiS_S_iii:             # @_Z13verify_resultPiS_S_iii
	.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	%rsi, -8(%rsp)                  # 8-byte Spill
	movq	%rdi, -16(%rsp)                 # 8-byte Spill
	testl	%ecx, %ecx
	movq	%rdx, -24(%rsp)                 # 8-byte Spill
	movl	%ecx, -28(%rsp)                 # 4-byte Spill
	jle	.LBB3_1
# %bb.2:                                # %.preheader29.lr.ph
	movslq	%r9d, %r10
	movl	%ecx, %edi
	movl	%r10d, %ebx
	movl	%r8d, %r14d
	shlq	$2, %r10
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
	xorl	%eax, %eax
.LBB3_3:                                # %.preheader29
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_5 Depth 2
                                        #       Child Loop BB3_10 Depth 3
	testl	%r9d, %r9d
	jle	.LBB3_7
# %bb.4:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB3_3 Depth=1
	movl	%r15d, %eax
	movq	-16(%rsp), %rcx                 # 8-byte Reload
	leaq	(%rcx,%rax,4), %r13
	movq	-8(%rsp), %rsi                  # 8-byte Reload
	xorl	%r11d, %r11d
.LBB3_5:                                # %.preheader
                                        #   Parent Loop BB3_3 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_10 Depth 3
	testl	%r8d, %r8d
	jle	.LBB3_6
# %bb.9:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB3_5 Depth=2
	xorl	%edx, %edx
	movq	%rsi, %rbp
	xorl	%eax, %eax
.LBB3_10:                               # %.lr.ph
                                        #   Parent Loop BB3_3 Depth=1
                                        #     Parent Loop BB3_5 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%rbp), %ecx
	imull	(%r13,%rdx,4), %ecx
	addl	%ecx, %eax
	incq	%rdx
	addq	%r10, %rbp
	cmpq	%rdx, %r14
	jne	.LBB3_10
	jmp	.LBB3_11
.LBB3_6:                                #   in Loop: Header=BB3_5 Depth=2
	xorl	%eax, %eax
.LBB3_11:                               # %._crit_edge
                                        #   in Loop: Header=BB3_5 Depth=2
	incq	%r11
	addq	$4, %rsi
	cmpq	%rbx, %r11
	jne	.LBB3_5
.LBB3_7:                                # %._crit_edge33
                                        #   in Loop: Header=BB3_3 Depth=1
	incq	%r12
	addl	%r8d, %r15d
	cmpq	%rdi, %r12
	jne	.LBB3_3
	jmp	.LBB3_8
.LBB3_1:
	xorl	%eax, %eax
.LBB3_8:                                # %._crit_edge37
	imull	-28(%rsp), %r9d                 # 4-byte Folded Reload
	movslq	%r9d, %rcx
	decl	%r9d
	movq	-24(%rsp), %rdx                 # 8-byte Reload
	movl	-4(%rdx,%rcx,4), %edx
	movl	$.L.str.4, %edi
	movl	%r9d, %esi
	movl	%eax, %ecx
	xorl	%eax, %eax
	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	printf                          # TAILCALL
.Lfunc_end3:
	.size	_Z13verify_resultPiS_S_iii, .Lfunc_end3-_Z13verify_resultPiS_S_iii
	.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	$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
	movl	$524288, %edi                   # imm = 0x80000
	callq	_Znam
	movq	%rax, %rbx
	movl	$1048576, %edi                  # imm = 0x100000
	callq	_Znam
	movq	%rax, %r14
	movl	$2097152, %edi                  # imm = 0x200000
	callq	_Znam
	movq	%rax, %r15
	xorl	%r12d, %r12d
.LBB4_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1374389535, %rax, %rcx         # imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$37, %rcx
	addl	%edx, %ecx
	imull	$100, %ecx, %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r12,4)
	incq	%r12
	cmpq	$131072, %r12                   # imm = 0x20000
	jne	.LBB4_1
# %bb.2:                                # %.lr.ph.i51.preheader
	xorl	%r12d, %r12d
.LBB4_3:                                # %.lr.ph.i51
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1374389535, %rax, %rcx         # imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$37, %rcx
	addl	%edx, %ecx
	imull	$100, %ecx, %ecx
	subl	%ecx, %eax
	movl	%eax, (%r14,%r12,4)
	incq	%r12
	cmpq	$262144, %r12                   # imm = 0x40000
	jne	.LBB4_3
# %bb.4:                                # %_Z11init_matrixPii.exit55
	leaq	16(%rsp), %r12
	movl	$524288, %esi                   # imm = 0x80000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %r13
	movl	$1048576, %esi                  # imm = 0x100000
	movq	%r13, %rdi
	callq	hipMalloc
	movq	%rsp, %rbp
	movl	$2097152, %esi                  # imm = 0x200000
	movq	%rbp, %rdi
	callq	hipMalloc
	movq	(%r12), %rdi
	movl	$524288, %edx                   # imm = 0x80000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r13), %rdi
	movl	$1048576, %edx                  # imm = 0x100000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbp), %rdi
	movl	$2097152, %edx                  # imm = 0x200000
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$68719476768, %rdi              # imm = 0x1000000020
	movabsq	$137438953504, %rdx             # imm = 0x2000000020
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_6
# %bb.5:
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	movl	$256, %ecx                      # imm = 0x100
	movl	$1024, %r8d                     # imm = 0x400
	callq	_Z23__device_stub__matmul2dPiS_S_ii
.LBB4_6:
	movq	(%rsp), %rsi
	movl	$2097152, %edx                  # imm = 0x200000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	$512, %ecx                      # imm = 0x200
	movl	$256, %r8d                      # imm = 0x100
	movl	$1024, %r9d                     # imm = 0x400
	callq	_Z13verify_resultPiS_S_iii
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r14, %rdi
	callq	_ZdaPv
	movq	%r15, %rdi
	callq	_ZdaPv
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	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	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z8matmul2dPiS_S_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB6_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"%d, "
	.size	.L.str.1, 5

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

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"result[%d] = %d == %d = temp \n"
	.size	.L.str.4, 31

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"COMPLETED SUCCESSFULLY! \n"
	.size	.L.str.5, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z8matmul2dPiS_S_ii"
	.size	.L__unnamed_1, 20

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"]"
	.size	.Lstr, 2

	.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 _Z23__device_stub__matmul2dPiS_S_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z8matmul2dPiS_S_ii
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z8matmul2dPiS_S_ii     ; -- Begin function _Z8matmul2dPiS_S_ii
	.globl	_Z8matmul2dPiS_S_ii
	.p2align	8
	.type	_Z8matmul2dPiS_S_ii,@function
_Z8matmul2dPiS_S_ii:                    ; @_Z8matmul2dPiS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x2c
	s_load_b256 s[0:7], s[0:1], 0x0
	v_bfe_u32 v2, v0, 10, 10
	v_and_b32_e32 v3, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s9, s8, 16
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_u64_u32 v[0:1], null, s15, s9, v[2:3]
	v_mad_u64_u32 v[1:2], null, s14, s8, v[3:4]
	s_cmp_lt_i32 s6, 1
	s_cbranch_scc1 .LBB0_3
; %bb.1:                                ; %.lr.ph
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v2, v0, s6
	v_mov_b32_e32 v5, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[3:4], 2, v[2:3]
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_ashrrev_i32_e32 v6, 31, v5
	s_add_i32 s6, s6, -1
	s_cmp_eq_u32 s6, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 2, v[5:6]
	v_add_co_u32 v6, vcc_lo, s2, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v7, vcc_lo, s3, v7, vcc_lo
	global_load_b32 v8, v[3:4], off
	global_load_b32 v9, v[6:7], off
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[6:7], null, v9, v8, v[2:3]
	v_add_co_u32 v3, vcc_lo, v3, 4
	v_add_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3)
	v_dual_mov_b32 v2, v6 :: v_dual_add_nc_u32 v5, s7, v5
	s_cbranch_scc0 .LBB0_2
	s_branch .LBB0_4
.LBB0_3:
	v_mov_b32_e32 v2, 0
.LBB0_4:                                ; %Flow44
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v0, s7, v[1:2]
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8matmul2dPiS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 10
		.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	_Z8matmul2dPiS_S_ii, .Lfunc_end0-_Z8matmul2dPiS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 304
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; 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:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z8matmul2dPiS_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z8matmul2dPiS_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
