#include <iostream>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>

// Define a simple structure to hold COO matrix data
typedef struct {
    int nnz; // Number of non-zero elements
    int *row; // Row indices
    int *col; // Column indices
    float *val; // Non-zero values
} COOMatrix;

// Kernel for sparse matrix-matrix multiplication in COO format
__global__ void cooSpMMKernel(const COOMatrix A, const COOMatrix B, COOMatrix C) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < A.nnz) {
        int rowA = A.row[idx];
        int colA = A.col[idx];
        float valA = A.val[idx];

        // Iterate over all non-zero elements in row B.col[idx] of matrix B
        for (int j = 0; j < B.nnz; ++j) {
            if (B.row[j] == colA) {
                atomicAdd(&C.val[rowA * C.nnz + B.col[j]], valA * B.val[j]);
            }
        }
    }
}

// Function to initialize COO matrix with some values
void initializeMatrix(COOMatrix &mat, int nnz, int *row, int *col, float *val) {
    mat.nnz = nnz;
    cudaMalloc(&mat.row, nnz * sizeof(int));
    cudaMalloc(&mat.col, nnz * sizeof(int));
    cudaMalloc(&mat.val, nnz * sizeof(float));
    cudaMemcpy(mat.row, row, nnz * sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy(mat.col, col, nnz * sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy(mat.val, val, nnz * sizeof(float), cudaMemcpyHostToDevice);
}

// Function to free COO matrix
void freeMatrix(COOMatrix &mat) {
    cudaFree(mat.row);
    cudaFree(mat.col);
    cudaFree(mat.val);
}

int main() {
    // Define dimensions and data for matrix A (3x3)
    int nnzA = 4;
    int rowA[] = {0, 0, 1, 2};
    int colA[] = {0, 2, 1, 2};
    float valA[] = {1.0, 2.0, 3.0, 4.0};

    // Define dimensions and data for matrix B (3x3)
    int nnzB = 4;
    int rowB[] = {0, 1, 1, 2};
    int colB[] = {1, 0, 2, 2};
    float valB[] = {5.0, 6.0, 7.0, 8.0};

    // Define dimensions and data for matrix C (3x3)
    int nnzC = 9; // Assuming C is dense for simplicity
    int rowC[] = {0, 0, 0, 1, 1, 1, 2, 2, 2};
    int colC[] = {0, 1, 2, 0, 1, 2, 0, 1, 2};
    float valC[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

    // Initialize matrices A, B, and C
    COOMatrix A, B, C;
    initializeMatrix(A, nnzA, rowA, colA, valA);
    initializeMatrix(B, nnzB, rowB, colB, valB);
    initializeMatrix(C, nnzC, rowC, colC, valC);

    // Launch the kernel with persistent threads
    int blockSize = 256;
    int numBlocks = (A.nnz + blockSize - 1) / blockSize;
    cooSpMMKernel<<<numBlocks, blockSize>>>(A, B, C);
    cudaDeviceSynchronize();

    // Copy the result matrix C back to host
    float *h_valC = new float[nnzC];
    cudaMemcpy(h_valC, C.val, nnzC * sizeof(float), cudaMemcpyDeviceToHost);

    // Print the result matrix C
    std::cout << "Result Matrix C:\n";
    for (int i = 0; i < nnzC; ++i) {
        std::cout << h_valC[i] << " ";
        if ((i + 1) % 3 == 0) std::cout << "\n";
    }

    // Free allocated memory
    delete[] h_valC;
    freeMatrix(A);
    freeMatrix(B);
    freeMatrix(C);

    return 0;
}
	.file	"tmpxft_0000663f_00000000-6_cuda_code_057341.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3640:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3640:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	.type	_Z16initializeMatrixR9COOMatrixiPiS1_Pf, @function
_Z16initializeMatrixR9COOMatrixiPiS1_Pf:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rcx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r8, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	leaq	8(%rdi), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%esi, -8(%rdi)
	movslq	%esi, %rsi
	leaq	0(,%rsi,4), %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rbp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	24(%rbp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	8(%rbp), %rdi
	movq	%rbx, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	16(%rbp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	24(%rbp), %rdi
	movq	%rbx, %rdx
	movq	%r12, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 40
	movl	$1, %ecx
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE3635:
	.size	_Z16initializeMatrixR9COOMatrixiPiS1_Pf, .-_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	.globl	_Z10freeMatrixR9COOMatrix
	.type	_Z10freeMatrixR9COOMatrix, @function
_Z10freeMatrixR9COOMatrix:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	call	cudaFree@PLT
	movq	16(%rbx), %rdi
	call	cudaFree@PLT
	movq	24(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	cudaFree@PLT
	.cfi_endproc
.LFE3636:
	.size	_Z10freeMatrixR9COOMatrix, .-_Z10freeMatrixR9COOMatrix
	.globl	_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_
	.type	_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_, @function
_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_:
.LFB3662:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	movq	%rdi, 64(%rsp)
	movabsq	$4294967297, %rax
	movq	%rsi, 72(%rsp)
	leaq	16(%rsp), %rdi
	leaq	28(%rsp), %rsi
	movq	%rdx, 80(%rsp)
	movq	%rsp, %rdx
	movq	%rax, 16(%rsp)
	movl	$1, 24(%rsp)
	movq	%rax, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L6
	pushq	8(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z13cooSpMMKernel9COOMatrixS_S_(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 128
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L6:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3662:
	.size	_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_, .-_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_
	.globl	_Z13cooSpMMKernel9COOMatrixS_S_
	.type	_Z13cooSpMMKernel9COOMatrixS_S_, @function
_Z13cooSpMMKernel9COOMatrixS_S_:
.LFB3663:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	80(%rsp), %rdx
	leaq	48(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z13cooSpMMKernel9COOMatrixS_S_, .-_Z13cooSpMMKernel9COOMatrixS_S_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"Result Matrix C:\n"
.LC3:
	.string	" "
.LC4:
	.string	"\n"
	.section	.rodata
	.align 32
.LC0:
	.long	0
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	2
	.long	2
	.long	2
	.align 32
.LC1:
	.long	0
	.long	1
	.long	2
	.long	0
	.long	1
	.long	2
	.long	0
	.long	1
	.long	2
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rsi
	movl	$9, %ecx
	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
	movl	$1, %ebx
	salq	$33, %rbx
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rbx, 252(%rsp)
	movabsq	$4611686019492741120, %rbx
	movq	%rax, 236(%rsp)
	leaq	40(%rsp), %r13
	movabsq	$8589934593, %rax
	leaq	332(%rsp), %rdi
	movq	%rax, 244(%rsp)
	leaq	236(%rsp), %rdx
	leaq	268(%rsp), %r8
	rep movsl
	movq	%rax, 260(%rsp)
	movl	$9, %ecx
	leaq	368(%rsp), %rdi
	movq	%rax, 292(%rsp)
	incq	%rax
	leaq	.LC1(%rip), %rsi
	leaq	72(%rsp), %r12
	rep movsl
	movq	%rbx, 268(%rsp)
	movabsq	$4647714816524288000, %rbx
	leaq	404(%rsp), %rdi
	movq	%rax, 308(%rsp)
	movl	$9, %ecx
	movl	$4, %esi
	movabsq	$4665729215040061440, %rax
	movq	%rbx, 276(%rsp)
	movl	$1, %ebx
	movq	%rax, 316(%rsp)
	salq	$32, %rbx
	movabsq	$4683743613553737728, %rax
	movq	%rax, 324(%rsp)
	xorl	%eax, %eax
	movq	%rbx, 284(%rsp)
	movq	$1, 300(%rsp)
	rep stosl
	leaq	252(%rsp), %rcx
	movq	%r13, %rdi
	call	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	leaq	300(%rsp), %rcx
	movl	$4, %esi
	movq	%r12, %rdi
	leaq	284(%rsp), %rdx
	leaq	316(%rsp), %r8
	call	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	leaq	104(%rsp), %rax
	leaq	368(%rsp), %rcx
	movl	$9, %esi
	movq	%rax, %rdi
	leaq	332(%rsp), %rdx
	movq	%rax, 8(%rsp)
	leaq	404(%rsp), %r8
	call	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	movl	40(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$256, %ecx
	addl	$255, %eax
	cltd
	idivl	%ecx
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	movups	40(%rsp), %xmm1
	movups	56(%rsp), %xmm2
	leaq	200(%rsp), %rdx
	leaq	168(%rsp), %rsi
	movups	72(%rsp), %xmm3
	movups	88(%rsp), %xmm4
	leaq	136(%rsp), %rdi
	movups	104(%rsp), %xmm5
	movups	120(%rsp), %xmm6
	movups	%xmm1, 136(%rsp)
	movups	%xmm2, 152(%rsp)
	movups	%xmm3, 168(%rsp)
	movups	%xmm4, 184(%rsp)
	movups	%xmm5, 200(%rsp)
	movups	%xmm6, 216(%rsp)
	call	_Z45__device_stub__Z13cooSpMMKernel9COOMatrixS_S_RK9COOMatrixS1_RS_
.L14:
	call	cudaDeviceSynchronize@PLT
	movl	$36, %edi
	leaq	_ZSt4cout(%rip), %r14
	movl	$1, %ebp
	call	_Znam@PLT
	movl	$2, %ecx
	movq	128(%rsp), %rsi
	movl	$36, %edx
	movq	%rax, %rdi
	movq	%rax, %rbx
	leaq	.LC3(%rip), %r15
	call	cudaMemcpy@PLT
	movl	$17, %edx
	leaq	.LC2(%rip), %rsi
	movq	%r14, %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
.L16:
	movq	%r14, %rdi
	cvtss2sd	-4(%rbx,%rbp,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movl	$1, %edx
	movq	%r15, %rsi
	movq	%rax, %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	imull	$-1431655765, %ebp, %eax
	cmpl	$1431655765, %eax
	ja	.L15
	movl	$1, %edx
	leaq	.LC4(%rip), %rsi
	movq	%r14, %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
.L15:
	incq	%rbp
	cmpq	$10, %rbp
	jne	.L16
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	%r13, %rdi
	call	_Z10freeMatrixR9COOMatrix
	movq	%r12, %rdi
	call	_Z10freeMatrixR9COOMatrix
	movq	8(%rsp), %rdi
	call	_Z10freeMatrixR9COOMatrix
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$456, %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
.LFE3637:
	.size	main, .-main
	.section	.rodata.str1.1
.LC5:
	.string	"_Z13cooSpMMKernel9COOMatrixS_S_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3665:
	.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	.LC5(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z13cooSpMMKernel9COOMatrixS_S_(%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
.LFE3665:
	.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 <iostream>
#include <hip/hip_runtime.h>


// Define a simple structure to hold COO matrix data
typedef struct {
    int nnz; // Number of non-zero elements
    int *row; // Row indices
    int *col; // Column indices
    float *val; // Non-zero values
} COOMatrix;

// Kernel for sparse matrix-matrix multiplication in COO format
__global__ void cooSpMMKernel(const COOMatrix A, const COOMatrix B, COOMatrix C) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < A.nnz) {
        int rowA = A.row[idx];
        int colA = A.col[idx];
        float valA = A.val[idx];

        // Iterate over all non-zero elements in row B.col[idx] of matrix B
        for (int j = 0; j < B.nnz; ++j) {
            if (B.row[j] == colA) {
                atomicAdd(&C.val[rowA * C.nnz + B.col[j]], valA * B.val[j]);
            }
        }
    }
}

// Function to initialize COO matrix with some values
void initializeMatrix(COOMatrix &mat, int nnz, int *row, int *col, float *val) {
    mat.nnz = nnz;
    hipMalloc(&mat.row, nnz * sizeof(int));
    hipMalloc(&mat.col, nnz * sizeof(int));
    hipMalloc(&mat.val, nnz * sizeof(float));
    hipMemcpy(mat.row, row, nnz * sizeof(int), hipMemcpyHostToDevice);
    hipMemcpy(mat.col, col, nnz * sizeof(int), hipMemcpyHostToDevice);
    hipMemcpy(mat.val, val, nnz * sizeof(float), hipMemcpyHostToDevice);
}

// Function to free COO matrix
void freeMatrix(COOMatrix &mat) {
    hipFree(mat.row);
    hipFree(mat.col);
    hipFree(mat.val);
}

int main() {
    // Define dimensions and data for matrix A (3x3)
    int nnzA = 4;
    int rowA[] = {0, 0, 1, 2};
    int colA[] = {0, 2, 1, 2};
    float valA[] = {1.0, 2.0, 3.0, 4.0};

    // Define dimensions and data for matrix B (3x3)
    int nnzB = 4;
    int rowB[] = {0, 1, 1, 2};
    int colB[] = {1, 0, 2, 2};
    float valB[] = {5.0, 6.0, 7.0, 8.0};

    // Define dimensions and data for matrix C (3x3)
    int nnzC = 9; // Assuming C is dense for simplicity
    int rowC[] = {0, 0, 0, 1, 1, 1, 2, 2, 2};
    int colC[] = {0, 1, 2, 0, 1, 2, 0, 1, 2};
    float valC[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

    // Initialize matrices A, B, and C
    COOMatrix A, B, C;
    initializeMatrix(A, nnzA, rowA, colA, valA);
    initializeMatrix(B, nnzB, rowB, colB, valB);
    initializeMatrix(C, nnzC, rowC, colC, valC);

    // Launch the kernel with persistent threads
    int blockSize = 256;
    int numBlocks = (A.nnz + blockSize - 1) / blockSize;
    cooSpMMKernel<<<numBlocks, blockSize>>>(A, B, C);
    hipDeviceSynchronize();

    // Copy the result matrix C back to host
    float *h_valC = new float[nnzC];
    hipMemcpy(h_valC, C.val, nnzC * sizeof(float), hipMemcpyDeviceToHost);

    // Print the result matrix C
    std::cout << "Result Matrix C:\n";
    for (int i = 0; i < nnzC; ++i) {
        std::cout << h_valC[i] << " ";
        if ((i + 1) % 3 == 0) std::cout << "\n";
    }

    // Free allocated memory
    delete[] h_valC;
    freeMatrix(A);
    freeMatrix(B);
    freeMatrix(C);

    return 0;
}
	.text
	.file	"cuda_code_057341.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_ # -- Begin function _Z28__device_stub__cooSpMMKernel9COOMatrixS_S_
	.type	_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_,@function
_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_: # @_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	128(%rsp), %rax
	leaq	48(%rsp), %rbx
	movq	%rax, (%rbx)
	leaq	160(%rsp), %rax
	movq	%rax, 8(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 16(%rbx)
	leaq	32(%rsp), %r14
	leaq	16(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z13cooSpMMKernel9COOMatrixS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_, .Lfunc_end0-_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z16initializeMatrixR9COOMatrixiPiS1_Pf # -- Begin function _Z16initializeMatrixR9COOMatrixiPiS1_Pf
	.type	_Z16initializeMatrixR9COOMatrixiPiS1_Pf,@function
_Z16initializeMatrixR9COOMatrixiPiS1_Pf: # @_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%r8, %rbx
	movq	%rcx, %r12
	movq	%rdx, %r13
	movq	%rdi, %r14
	movl	%esi, (%rdi)
	addq	$8, %rdi
	movslq	%esi, %r15
	shlq	$2, %r15
	movq	%r15, %rsi
	callq	hipMalloc
	leaq	16(%r14), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	leaq	24(%r14), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movq	8(%r14), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	16(%r14), %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%r14), %rdi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	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
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end1:
	.size	_Z16initializeMatrixR9COOMatrixiPiS1_Pf, .Lfunc_end1-_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	.cfi_endproc
                                        # -- End function
	.globl	_Z10freeMatrixR9COOMatrix       # -- Begin function _Z10freeMatrixR9COOMatrix
	.type	_Z10freeMatrixR9COOMatrix,@function
_Z10freeMatrixR9COOMatrix:              # @_Z10freeMatrixR9COOMatrix
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	8(%rdi), %rdi
	callq	hipFree
	movq	16(%rbx), %rdi
	callq	hipFree
	movq	24(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	hipFree                         # TAILCALL
.Lfunc_end2:
	.size	_Z10freeMatrixR9COOMatrix, .Lfunc_end2-_Z10freeMatrixR9COOMatrix
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	1                               # 0x1
	.long	2                               # 0x2
.LCPI3_1:
	.long	0                               # 0x0
	.long	2                               # 0x2
	.long	1                               # 0x1
	.long	2                               # 0x2
.LCPI3_2:
	.long	0x3f800000                      # float 1
	.long	0x40000000                      # float 2
	.long	0x40400000                      # float 3
	.long	0x40800000                      # float 4
.LCPI3_3:
	.long	0                               # 0x0
	.long	1                               # 0x1
	.long	1                               # 0x1
	.long	2                               # 0x2
.LCPI3_4:
	.long	1                               # 0x1
	.long	0                               # 0x0
	.long	2                               # 0x2
	.long	2                               # 0x2
.LCPI3_5:
	.long	0x40a00000                      # float 5
	.long	0x40c00000                      # float 6
	.long	0x40e00000                      # float 7
	.long	0x41000000                      # float 8
.LCPI3_6:
	.long	1                               # 0x1
	.long	1                               # 0x1
	.long	2                               # 0x2
	.long	2                               # 0x2
	.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	$504, %rsp                      # imm = 0x1F8
	.cfi_def_cfa_offset 560
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movaps	.LCPI3_0(%rip), %xmm0           # xmm0 = [0,0,1,2]
	leaq	224(%rsp), %rdx
	movaps	%xmm0, (%rdx)
	movaps	.LCPI3_1(%rip), %xmm0           # xmm0 = [0,2,1,2]
	leaq	208(%rsp), %rcx
	movaps	%xmm0, (%rcx)
	movaps	.LCPI3_2(%rip), %xmm0           # xmm0 = [1.0E+0,2.0E+0,3.0E+0,4.0E+0]
	leaq	192(%rsp), %r8
	movaps	%xmm0, (%r8)
	movaps	.LCPI3_3(%rip), %xmm0           # xmm0 = [0,1,1,2]
	leaq	96(%rsp), %rax
	movaps	%xmm0, (%rax)
	movaps	.LCPI3_4(%rip), %xmm0           # xmm0 = [1,0,2,2]
	leaq	176(%rsp), %r15
	movaps	%xmm0, (%r15)
	movaps	.LCPI3_5(%rip), %xmm0           # xmm0 = [5.0E+0,6.0E+0,7.0E+0,8.0E+0]
	leaq	160(%rsp), %r12
	movaps	%xmm0, (%r12)
	xorps	%xmm0, %xmm0
	leaq	464(%rsp), %r14
	movaps	%xmm0, (%r14)
	movl	$1, %eax
	movl	%eax, 12(%r14)
	movaps	.LCPI3_6(%rip), %xmm1           # xmm1 = [1,1,2,2]
	movaps	%xmm1, 16(%r14)
	movl	$2, %esi
	movl	%esi, 32(%r14)
	leaq	416(%rsp), %r13
	movaps	%xmm0, (%r13)
	movaps	%xmm0, 16(%r13)
	movabsq	$8589934593, %rdi               # imm = 0x200000001
	movq	%rdi, 4(%r13)
	movq	%rdi, 16(%r13)
	movl	%eax, 28(%r13)
	movl	%esi, 32(%r13)
	leaq	368(%rsp), %rbp
	movaps	%xmm0, 16(%rbp)
	movaps	%xmm0, (%rbp)
	movl	$0, 32(%rbp)
	leaq	64(%rsp), %rbx
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	leaq	32(%rsp), %rdi
	movl	$4, %esi
	leaq	96(%rsp), %rdx
	movq	%r15, %rcx
	movq	%r12, %r8
	callq	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	movq	%rsp, %rdi
	movl	$9, %esi
	movq	%r14, %rdx
	movq	%r13, %rcx
	movq	%rbp, %r8
	callq	_Z16initializeMatrixR9COOMatrixiPiS1_Pf
	movl	(%rbx), %edi
	leal	255(%rdi), %eax
	addl	$510, %edi                      # imm = 0x1FE
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$8, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_2
# %bb.1:
	movups	64(%rsp), %xmm0
	movups	80(%rsp), %xmm1
	leaq	272(%rsp), %rax
	movaps	%xmm1, 16(%rax)
	movaps	%xmm0, (%rax)
	movups	32(%rsp), %xmm0
	movups	48(%rsp), %xmm1
	leaq	304(%rsp), %rcx
	movaps	%xmm1, 16(%rcx)
	movaps	%xmm0, (%rcx)
	movups	(%rsp), %xmm0
	movups	16(%rsp), %xmm1
	leaq	336(%rsp), %rdx
	movaps	%xmm1, 16(%rdx)
	movaps	%xmm0, (%rdx)
	leaq	240(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	144(%rsp), %r14
	leaq	128(%rsp), %r15
	leaq	120(%rsp), %r12
	leaq	112(%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	$_Z13cooSpMMKernel9COOMatrixS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB3_2:
	callq	hipDeviceSynchronize
	movl	$36, %edi
	callq	_Znam
	movq	%rax, %rbx
	movq	24(%rsp), %rsi
	movl	$36, %edx
	movq	%rax, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$1, %r14d
	xorl	%r12d, %r12d
	movabsq	$-6148914691236517205, %r13     # imm = 0xAAAAAAAAAAAAAAAB
.LBB3_3:                                # =>This Inner Loop Header: Depth=1
	movq	%r14, %rax
	mulq	%r13
	movq	%rdx, %r15
	shrl	%r15d
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r12,4), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	leal	(%r15,%r15,2), %eax
	decb	%al
	cmpb	%r12b, %al
	jne	.LBB3_5
# %bb.4:                                #   in Loop: Header=BB3_3 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB3_5:                                #   in Loop: Header=BB3_3 Depth=1
	incq	%r12
	incq	%r14
	cmpq	$9, %r12
	jne	.LBB3_3
# %bb.6:
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	80(%rsp), %rdi
	callq	hipFree
	movq	88(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$504, %rsp                      # imm = 0x1F8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-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	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13cooSpMMKernel9COOMatrixS_S_, %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_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13cooSpMMKernel9COOMatrixS_S_,@object # @_Z13cooSpMMKernel9COOMatrixS_S_
	.section	.rodata,"a",@progbits
	.globl	_Z13cooSpMMKernel9COOMatrixS_S_
	.p2align	3, 0x0
_Z13cooSpMMKernel9COOMatrixS_S_:
	.quad	_Z28__device_stub__cooSpMMKernel9COOMatrixS_S_
	.size	_Z13cooSpMMKernel9COOMatrixS_S_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Result Matrix C:\n"
	.size	.L.str, 18

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" "
	.size	.L.str.1, 2

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"\n"
	.size	.L.str.2, 2

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13cooSpMMKernel9COOMatrixS_S_"
	.size	.L__unnamed_1, 32

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13cooSpMMKernel9COOMatrixS_S_ ; -- Begin function _Z13cooSpMMKernel9COOMatrixS_S_
	.globl	_Z13cooSpMMKernel9COOMatrixS_S_
	.p2align	8
	.type	_Z13cooSpMMKernel9COOMatrixS_S_,@function
_Z13cooSpMMKernel9COOMatrixS_S_:        ; @_Z13cooSpMMKernel9COOMatrixS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x6c
	s_load_b32 s3, s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_7
; %bb.1:
	s_load_b32 s12, s[0:1], 0x20
	s_add_u32 s2, s0, 32
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s12, 1
	s_cbranch_scc1 .LBB0_7
; %bb.2:                                ; %.lr.ph
	s_clause 0x1
	s_load_b64 s[8:9], s[0:1], 0x8
	s_load_b128 s[4:7], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	v_mov_b32_e32 v7, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s8, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[0:1], off
	s_clause 0x3
	s_load_b32 s8, s[0:1], 0x40
	s_load_b128 s[4:7], s[2:3], 0x8
	s_load_b64 s[2:3], s[2:3], 0x18
	s_load_b64 s[0:1], s[0:1], 0x58
	s_mov_b32 s9, 0
	s_waitcnt vmcnt(2) lgkmcnt(0)
	v_mul_lo_u32 v6, v2, s8
	s_mov_b32 s8, s9
.LBB0_3:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[10:11], s[8:9], 2
	s_mov_b32 s13, exec_lo
	s_add_u32 s14, s4, s10
	s_addc_u32 s15, s5, s11
	global_load_b32 v0, v7, s[14:15]
	s_waitcnt vmcnt(0)
	v_cmpx_eq_u32_e64 v0, v4
	s_cbranch_execz .LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	s_add_u32 s14, s6, s10
	s_addc_u32 s15, s7, s11
	s_add_u32 s10, s2, s10
	global_load_b32 v0, v7, s[14:15]
	s_addc_u32 s11, s3, s11
	global_load_b32 v2, v7, s[10:11]
	s_mov_b32 s10, 0
	s_waitcnt vmcnt(1)
	v_add_nc_u32_e32 v0, v0, v6
	s_waitcnt vmcnt(0)
	v_mul_f32_e32 v8, v5, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v3, v[0:1], off
.LBB0_5:                                ; %atomicrmw.start
                                        ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v3, v8
	global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v2, v3
	v_mov_b32_e32 v3, v2
	s_or_b32 s10, vcc_lo, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s10
	s_cbranch_execnz .LBB0_5
.LBB0_6:                                ; %Flow30
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	s_add_i32 s8, s8, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s8, s12
	s_cbranch_scc1 .LBB0_3
.LBB0_7:                                ; %.loopexit
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13cooSpMMKernel9COOMatrixS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 352
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.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	_Z13cooSpMMKernel9COOMatrixS_S_, .Lfunc_end0-_Z13cooSpMMKernel9COOMatrixS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 456
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           32
        .value_kind:     by_value
      - .offset:         32
        .size:           32
        .value_kind:     by_value
      - .offset:         64
        .size:           32
        .value_kind:     by_value
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         100
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         104
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         108
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         110
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         112
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         114
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         116
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         118
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         152
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         160
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 352
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13cooSpMMKernel9COOMatrixS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13cooSpMMKernel9COOMatrixS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
