#include <cassert>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <random>

constexpr int TILE_DIM = 32;

__global__
void multiplication( int * a, int * b, int * c, int dim) {
    // create shared memory
    __shared__ int m[TILE_DIM][TILE_DIM];
    __shared__ int n[TILE_DIM][TILE_DIM];
    // indices will be stored in registers (automatic variables)
    int bx = blockIdx.x, by = blockIdx.y;
    int tx = threadIdx.x, ty = threadIdx.y;
    // compute the columns and row (TILE_DIM == blockDim.x/y)
    int column = tx + bx * TILE_DIM;
    int row = ty + by * TILE_DIM;
    int value = 0;
    int limit = std::ceil( dim/static_cast< float >( TILE_DIM) );
    // loop over the m and n tiles
    // strip-mining: break a long-running loop into phases
    //               each phase consists of an inner loop
    //               that executes a number of consecutive
    //               steps of the original loop
    for ( int phase = 0; phase < limit; ++phase) {
        // load tiles into shared memory
        m[ty][tx] = a[row * dim + phase * TILE_DIM + tx];
        n[ty][tx] = b[(phase * TILE_DIM + ty) * dim + column];
        // wait till all threads in the block have finished loading
        // the tiles into shared memory
        __syncthreads();
        // compute the dot product 
        for ( int k = 0; k < TILE_DIM; ++k) {
            value += m[ty][k] * n[k][tx];
        }
        // wait till all threads in the block have finished
        // computing the dot product
        __syncthreads();
    }
    c[row * dim + column] = value;
}

void compute_on_device( int dim, int * host_a, int * host_b, int * host_c) {
    constexpr int tile_dim = 32;
    // allocate device memory
    int * device_a, * device_b, * device_c;
    cudaMalloc( & device_a, dim * dim * sizeof( int) );
    cudaMalloc( & device_b, dim * dim * sizeof( int) );
    cudaMalloc( & device_c, dim * dim * sizeof( int) );
    // copy input matrices from host to device memory
    cudaMemcpy( device_a, host_a, dim * dim * sizeof( int), cudaMemcpyHostToDevice);
    cudaMemcpy( device_b, host_b, dim * dim * sizeof( int), cudaMemcpyHostToDevice);
    dim3 block_dim{ tile_dim, tile_dim };
    dim3 grid_dim{ static_cast< unsigned int >( std::ceil( dim/static_cast< float >( block_dim.x) ) ),
                   static_cast< unsigned int >( std::ceil( dim/static_cast< float >( block_dim.y) ) ) };
    auto start = std::chrono::high_resolution_clock::now();
    multiplication<<< grid_dim, block_dim >>>( device_a, device_b, device_c, dim);
    cudaDeviceSynchronize();
    auto duration = std::chrono::high_resolution_clock::now() - start;
    std::cout << "device: " << std::chrono::duration_cast< std::chrono::microseconds >( duration).count() << " ms\n";
    cudaMemcpy( host_c, device_c, dim * dim * sizeof( int), cudaMemcpyDeviceToHost);
    cudaFree( device_a);
    cudaFree( device_b);
    cudaFree( device_c);
}

void compute_on_host( int dim, int * a, int * b, int * c) {
    auto start = std::chrono::high_resolution_clock::now();
    for ( int row = 0; row < dim; ++row) {
        for ( int column = 0; column < dim; ++column) {
            for ( int k = 0; k < dim; ++k) {
                c[row * dim + column] += a[row * dim + k] * b[k * dim + column];
            }
        }
    }
    auto duration = std::chrono::high_resolution_clock::now() - start;
    std::cout << "host: " << std::chrono::duration_cast< std::chrono::microseconds >( duration).count() << " ms\n";
}

bool equal( int dim, int * host, int * device) {
    for ( int row = 0; row < dim; ++row) {
        for ( int column = 0; column < dim; ++column) {
            if ( host[row * dim + column] != device[row * dim + column]) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    constexpr int dim = 1024;
    // allocate host memory
    int * host_a = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    int * host_b = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    // initialize input matrices
    std::minstd_rand generator;
    std::uniform_int_distribution<> distribution{ 0, 255 };
    for ( unsigned int i = 0; i < dim*dim; ++i) {
        host_a[i] = distribution( generator); 
        host_b[i] = host_a[i];
    }
    // multiplication on host
    int * host_c = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    compute_on_host( dim, host_a, host_b, host_c);
    // multiplication on device
    int * device_c = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    compute_on_device( dim, host_a, host_b, device_c);
    if ( ! equal( dim, host_c, device_c) ) {
        std::cout << "matrices are not equal" << std::endl;
    }
    std::free( host_a);
    std::free( host_b);
    std::free( host_c);
    std::free( device_c);
    return EXIT_SUCCESS;
}

	.file	"tmpxft_00313e42_00000000-6_matrix.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4827:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4827:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0, @function
_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0:
.LFB5594:
	.cfi_startproc
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %rax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rax, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edx, %rbp
	subq	%rax, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	cmpq	$2147483644, %rbp
	ja	.L3
	incq	%rbp
	movl	$2147483645, %eax
	xorl	%edx, %edx
	movl	$2147483647, %esi
	divq	%rbp
	movq	(%rdi), %rdx
	imulq	%rax, %rbp
	movq	%rax, %rcx
.L4:
	imulq	$48271, %rdx, %rax
	xorl	%edx, %edx
	divq	%rsi
	leaq	-1(%rdx), %rax
	cmpq	%rbp, %rax
	jnb	.L4
	movq	%rdx, 0(%r13)
	xorl	%edx, %edx
	divq	%rcx
	jmp	.L5
.L3:
	cmpq	$2147483645, %rbp
	je	.L6
	movl	$2147483646, %ecx
	movq	%rbp, %rax
	xorl	%edx, %edx
	movl	$2147483647, %ebx
	divq	%rcx
	movq	%rax, %r14
.L11:
	movl	%r14d, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	xorl	%edx, %edx
	movl	%eax, %ecx
	imulq	$48271, 0(%r13), %rax
	divq	%rbx
	movslq	%ecx, %rax
	imulq	$2147483646, %rax, %rax
	movq	%rdx, 0(%r13)
	decq	%rdx
	addq	%rdx, %rax
	setc	%dl
	movzbl	%dl, %edx
	cmpq	%rax, %rbp
	jb	.L11
	testq	%rdx, %rdx
	jne	.L11
	jmp	.L5
.L6:
	imulq	$48271, (%rdi), %rax
	movl	$2147483647, %ecx
	xorl	%edx, %edx
	divq	%rcx
	movq	%rdx, (%rdi)
	leaq	-1(%rdx), %rax
.L5:
	popq	%rbx
	.cfi_def_cfa_offset 40
	addl	%r12d, %eax
	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
	ret
	.cfi_endproc
.LFE5594:
	.size	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0, .-_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"host: "
.LC1:
	.string	" ms\n"
	.text
	.globl	_Z15compute_on_hostiPiS_S_
	.type	_Z15compute_on_hostiPiS_S_, @function
_Z15compute_on_hostiPiS_S_:
.LFB4822:
	.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
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	movl	%edi, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movslq	%ebx, %rcx
	xorl	%r9d, %r9d
	movq	%rax, %r12
	salq	$2, %rcx
	xorl	%eax, %eax
.L15:
	cmpl	%ebx, %r9d
	jge	.L18
	movq	%rbp, %r8
	leaq	(%r14,%rax), %rdx
	leaq	0(%r13,%rax), %r15
	xorl	%edi, %edi
.L19:
	movq	%r8, %r10
	xorl	%esi, %esi
.L16:
	movl	(%r15,%rsi,4), %r11d
	incq	%rsi
	imull	(%r10), %r11d
	addq	%rcx, %r10
	addl	%r11d, (%rdx)
	cmpl	%esi, %ebx
	jg	.L16
	incl	%edi
	addq	$4, %r8
	addq	$4, %rdx
	cmpl	%edi, %ebx
	jne	.L19
	incl	%r9d
	addq	%rcx, %rax
	jmp	.L15
.L18:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	subq	%r12, %rax
	movq	%rax, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1000, %ecx
	movq	%rax, %rdi
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	popq	%rax
	.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	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	.cfi_endproc
.LFE4822:
	.size	_Z15compute_on_hostiPiS_S_, .-_Z15compute_on_hostiPiS_S_
	.globl	_Z5equaliPiS_
	.type	_Z5equaliPiS_, @function
_Z5equaliPiS_:
.LFB4823:
	.cfi_startproc
	endbr64
	movslq	%edi, %r8
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	salq	$2, %r8
.L23:
	cmpl	%edi, %ecx
	jge	.L29
	movq	%r9, %rax
	xorl	%r10d, %r10d
.L25:
	movl	(%rdx,%rax), %r11d
	cmpl	%r11d, (%rsi,%rax)
	jne	.L26
	incl	%r10d
	addq	$4, %rax
	cmpl	%r10d, %edi
	jne	.L25
	incl	%ecx
	addq	%r8, %r9
	jmp	.L23
.L29:
	movb	$1, %al
	ret
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE4823:
	.size	_Z5equaliPiS_, .-_Z5equaliPiS_
	.globl	_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i
	.type	_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i, @function
_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i:
.LFB4849:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z14multiplicationPiS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L30:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4849:
	.size	_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i, .-_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i
	.globl	_Z14multiplicationPiS_S_i
	.type	_Z14multiplicationPiS_S_i, @function
_Z14multiplicationPiS_S_i:
.LFB4850:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i
	.cfi_endproc
.LFE4850:
	.size	_Z14multiplicationPiS_S_i, .-_Z14multiplicationPiS_S_i
	.section	.rodata.str1.1
.LC3:
	.string	"device: "
	.text
	.globl	_Z17compute_on_deviceiPiS_S_
	.type	_Z17compute_on_deviceiPiS_S_, @function
_Z17compute_on_deviceiPiS_S_:
.LFB4818:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edi, %ebx
	imull	%edi, %ebx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movslq	%ebx, %rbx
	leaq	8(%rsp), %rdi
	salq	$2, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	cvtsi2ssl	%ebp, %xmm0
	mulss	.LC2(%rip), %xmm0
	call	ceilf@PLT
	movl	$1, 52(%rsp)
	cvttss2siq	%xmm0, %rax
	movl	%eax, 44(%rsp)
	movl	%eax, 48(%rsp)
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	44(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	52(%rsp), %esi
	movl	$1, %ecx
	movq	%rax, %r13
	movabsq	$137438953504, %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	%ebp, %ecx
	movq	8(%rsp), %rdi
	call	_Z39__device_stub__Z14multiplicationPiS_S_iPiS_S_i
.L36:
	call	cudaDeviceSynchronize@PLT
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	.LC3(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	subq	%r13, %rax
	movq	%rax, %rbp
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1000, %ecx
	movq	%rax, %rdi
	movq	%rbp, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	24(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@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	.L37
	call	__stack_chk_fail@PLT
.L37:
	addq	$64, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
	ret
	.cfi_endproc
.LFE4818:
	.size	_Z17compute_on_deviceiPiS_S_, .-_Z17compute_on_deviceiPiS_S_
	.section	.rodata.str1.1
.LC4:
	.string	"matrices are not equal"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB4824:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$4194304, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$4194304, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	$1, (%rsp)
	xorl	%r8d, %r8d
	movq	%rsp, %r9
	movq	%rax, %rbx
.L40:
	movl	$255, %edx
	xorl	%esi, %esi
	movq	%r9, %rdi
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	%eax, 0(%rbp,%r8)
	movl	%eax, (%rbx,%r8)
	addq	$4, %r8
	cmpq	$4194304, %r8
	jne	.L40
	movl	$4194304, %edi
	call	malloc@PLT
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movl	$1024, %edi
	movq	%rax, %rcx
	movq	%rax, %r13
	call	_Z15compute_on_hostiPiS_S_
	movl	$4194304, %edi
	call	malloc@PLT
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movl	$1024, %edi
	movq	%rax, %r12
	movq	%rax, %rcx
	call	_Z17compute_on_deviceiPiS_S_
	movq	%r12, %rdx
	movq	%r13, %rsi
	movl	$1024, %edi
	call	_Z5equaliPiS_
	testb	%al, %al
	jne	.L41
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC4(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L41:
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.LFE4824:
	.size	main, .-main
	.section	.rodata.str1.1
.LC5:
	.string	"_Z14multiplicationPiS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4852:
	.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	_Z14multiplicationPiS_S_i(%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
.LFE4852:
	.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
.LC2:
	.long	1023410176
	.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 <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <random>

constexpr int TILE_DIM = 32;

__global__
void multiplication( int * a, int * b, int * c, int dim) {
    // create shared memory
    __shared__ int m[TILE_DIM][TILE_DIM];
    __shared__ int n[TILE_DIM][TILE_DIM];
    // indices will be stored in registers (automatic variables)
    int bx = blockIdx.x, by = blockIdx.y;
    int tx = threadIdx.x, ty = threadIdx.y;
    // compute the columns and row (TILE_DIM == blockDim.x/y)
    int column = tx + bx * TILE_DIM;
    int row = ty + by * TILE_DIM;
    int value = 0;
    int limit = std::ceil( dim/static_cast< float >( TILE_DIM) );
    // loop over the m and n tiles
    // strip-mining: break a long-running loop into phases
    //               each phase consists of an inner loop
    //               that executes a number of consecutive
    //               steps of the original loop
    for ( int phase = 0; phase < limit; ++phase) {
        // load tiles into shared memory
        m[ty][tx] = a[row * dim + phase * TILE_DIM + tx];
        n[ty][tx] = b[(phase * TILE_DIM + ty) * dim + column];
        // wait till all threads in the block have finished loading
        // the tiles into shared memory
        __syncthreads();
        // compute the dot product 
        for ( int k = 0; k < TILE_DIM; ++k) {
            value += m[ty][k] * n[k][tx];
        }
        // wait till all threads in the block have finished
        // computing the dot product
        __syncthreads();
    }
    c[row * dim + column] = value;
}

void compute_on_device( int dim, int * host_a, int * host_b, int * host_c) {
    constexpr int tile_dim = 32;
    // allocate device memory
    int * device_a, * device_b, * device_c;
    hipMalloc( & device_a, dim * dim * sizeof( int) );
    hipMalloc( & device_b, dim * dim * sizeof( int) );
    hipMalloc( & device_c, dim * dim * sizeof( int) );
    // copy input matrices from host to device memory
    hipMemcpy( device_a, host_a, dim * dim * sizeof( int), hipMemcpyHostToDevice);
    hipMemcpy( device_b, host_b, dim * dim * sizeof( int), hipMemcpyHostToDevice);
    dim3 block_dim{ tile_dim, tile_dim };
    dim3 grid_dim{ static_cast< unsigned int >( std::ceil( dim/static_cast< float >( block_dim.x) ) ),
                   static_cast< unsigned int >( std::ceil( dim/static_cast< float >( block_dim.y) ) ) };
    auto start = std::chrono::high_resolution_clock::now();
    multiplication<<< grid_dim, block_dim >>>( device_a, device_b, device_c, dim);
    hipDeviceSynchronize();
    auto duration = std::chrono::high_resolution_clock::now() - start;
    std::cout << "device: " << std::chrono::duration_cast< std::chrono::microseconds >( duration).count() << " ms\n";
    hipMemcpy( host_c, device_c, dim * dim * sizeof( int), hipMemcpyDeviceToHost);
    hipFree( device_a);
    hipFree( device_b);
    hipFree( device_c);
}

void compute_on_host( int dim, int * a, int * b, int * c) {
    auto start = std::chrono::high_resolution_clock::now();
    for ( int row = 0; row < dim; ++row) {
        for ( int column = 0; column < dim; ++column) {
            for ( int k = 0; k < dim; ++k) {
                c[row * dim + column] += a[row * dim + k] * b[k * dim + column];
            }
        }
    }
    auto duration = std::chrono::high_resolution_clock::now() - start;
    std::cout << "host: " << std::chrono::duration_cast< std::chrono::microseconds >( duration).count() << " ms\n";
}

bool equal( int dim, int * host, int * device) {
    for ( int row = 0; row < dim; ++row) {
        for ( int column = 0; column < dim; ++column) {
            if ( host[row * dim + column] != device[row * dim + column]) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    constexpr int dim = 1024;
    // allocate host memory
    int * host_a = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    int * host_b = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    // initialize input matrices
    std::minstd_rand generator;
    std::uniform_int_distribution<> distribution{ 0, 255 };
    for ( unsigned int i = 0; i < dim*dim; ++i) {
        host_a[i] = distribution( generator); 
        host_b[i] = host_a[i];
    }
    // multiplication on host
    int * host_c = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    compute_on_host( dim, host_a, host_b, host_c);
    // multiplication on device
    int * device_c = static_cast< int * >( std::malloc( dim * dim * sizeof( int) ) );
    compute_on_device( dim, host_a, host_b, device_c);
    if ( ! equal( dim, host_c, device_c) ) {
        std::cout << "matrices are not equal" << std::endl;
    }
    std::free( host_a);
    std::free( host_b);
    std::free( host_c);
    std::free( device_c);
    return EXIT_SUCCESS;
}

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

                                        # End of file scope inline assembly
	.globl	_Z29__device_stub__multiplicationPiS_S_i # -- Begin function _Z29__device_stub__multiplicationPiS_S_i
	.type	_Z29__device_stub__multiplicationPiS_S_i,@function
_Z29__device_stub__multiplicationPiS_S_i: # @_Z29__device_stub__multiplicationPiS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%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	$_Z14multiplicationPiS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z29__device_stub__multiplicationPiS_S_i, .Lfunc_end0-_Z29__device_stub__multiplicationPiS_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z17compute_on_deviceiPiS_S_
.LCPI1_0:
	.long	0x3d000000                      # float 0.03125
	.text
	.globl	_Z17compute_on_deviceiPiS_S_
	.type	_Z17compute_on_deviceiPiS_S_,@function
_Z17compute_on_deviceiPiS_S_:           # @_Z17compute_on_deviceiPiS_S_
	.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, 32(%rsp)                  # 8-byte Spill
	movq	%rdx, %r15
	movq	%rsi, %r12
	movl	%edi, %ebp
	movl	%edi, %r14d
	imull	%r14d, %r14d
	shlq	$2, %r14
	leaq	24(%rsp), %r13
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%r13), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	cvtsi2ss	%ebp, %xmm0
	mulss	.LCPI1_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %rbx
	movl	%ebx, %eax
	shlq	$32, %rbx
	orq	%rax, %rbx
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r15
	movabsq	$137438953504, %rdx             # imm = 0x2000000020
	movq	%rbx, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_2
# %bb.1:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	%ebp, %ecx
	callq	_Z29__device_stub__multiplicationPiS_S_i
.LBB1_2:
	callq	hipDeviceSynchronize
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	subq	%r15, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	movq	%rbx, %rax
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIlEERSoT_
	movl	$.L.str.1, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	8(%rsp), %rsi
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	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
.Lfunc_end1:
	.size	_Z17compute_on_deviceiPiS_S_, .Lfunc_end1-_Z17compute_on_deviceiPiS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z15compute_on_hostiPiS_S_      # -- Begin function _Z15compute_on_hostiPiS_S_
	.type	_Z15compute_on_hostiPiS_S_,@function
_Z15compute_on_hostiPiS_S_:             # @_Z15compute_on_hostiPiS_S_
	.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, 16(%rsp)                  # 8-byte Spill
	movq	%rdx, %r15
	movq	%rsi, %r12
	movl	%edi, %ebp
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	testl	%ebp, %ebp
	jle	.LBB2_7
# %bb.1:                                # %.preheader26.lr.ph
	movl	%ebp, %eax
	leaq	(,%rax,4), %rcx
	xorl	%edx, %edx
	xorl	%esi, %esi
.LBB2_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_3 Depth 2
                                        #       Child Loop BB2_4 Depth 3
	movl	%edx, %edi
	leaq	(%r12,%rdi,4), %rdi
	movq	%rsi, %r8
	imulq	%rax, %r8
	movq	16(%rsp), %r9                   # 8-byte Reload
	leaq	(%r9,%r8,4), %r8
	movq	%r15, %r9
	xorl	%r10d, %r10d
.LBB2_3:                                # %.preheader
                                        #   Parent Loop BB2_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_4 Depth 3
	movl	(%r8,%r10,4), %r11d
	movq	%r9, %r13
	xorl	%r14d, %r14d
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        #     Parent Loop BB2_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%r13), %ebx
	imull	(%rdi,%r14,4), %ebx
	addl	%ebx, %r11d
	movl	%r11d, (%r8,%r10,4)
	incq	%r14
	addq	%rcx, %r13
	cmpq	%r14, %rax
	jne	.LBB2_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB2_3 Depth=2
	incq	%r10
	addq	$4, %r9
	cmpq	%rax, %r10
	jne	.LBB2_3
# %bb.6:                                # %._crit_edge29
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%rsi
	addl	%ebp, %edx
	cmpq	%rax, %rsi
	jne	.LBB2_2
.LBB2_7:                                # %._crit_edge31
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	subq	8(%rsp), %rbx                   # 8-byte Folded Reload
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	movq	%rbx, %rax
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIlEERSoT_
	movl	$.L.str.1, %esi
	movl	$4, %edx
	movq	%rax, %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	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l # TAILCALL
.Lfunc_end2:
	.size	_Z15compute_on_hostiPiS_S_, .Lfunc_end2-_Z15compute_on_hostiPiS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z5equaliPiS_                   # -- Begin function _Z5equaliPiS_
	.type	_Z5equaliPiS_,@function
_Z5equaliPiS_:                          # @_Z5equaliPiS_
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB3_1
# %bb.3:                                # %.preheader.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	xorl	%eax, %eax
.LBB3_4:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_6 Depth 2
	movl	%r8d, %r11d
	leaq	(%rdx,%r11,4), %r10
	leaq	(%rsi,%r11,4), %r11
	xorl	%ebx, %ebx
.LBB3_6:                                #   Parent Loop BB3_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r11,%rbx,4), %ebp
	cmpl	(%r10,%rbx,4), %ebp
	jne	.LBB3_8
# %bb.5:                                #   in Loop: Header=BB3_6 Depth=2
	incq	%rbx
	cmpq	%rbx, %rcx
	jne	.LBB3_6
# %bb.7:                                # %._crit_edge
                                        #   in Loop: Header=BB3_4 Depth=1
	incq	%r9
	cmpq	%rcx, %r9
	setae	%al
	addl	%edi, %r8d
	cmpq	%rcx, %r9
	jne	.LBB3_4
.LBB3_8:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %rbp
	jmp	.LBB3_2
.LBB3_1:
	movb	$1, %al
.LBB3_2:                                # %.thread
	andb	$1, %al
                                        # kill: def $al killed $al killed $rax
	retq
.Lfunc_end3:
	.size	_Z5equaliPiS_, .Lfunc_end3-_Z5equaliPiS_
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %rbx
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r14
	movq	%rsp, %r15
	movq	$1, (%r15)
	movabsq	$1095216660480, %rax            # imm = 0xFF00000000
	leaq	8(%rsp), %r12
	movq	%rax, (%r12)
	xorl	%r13d, %r13d
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	movl	%eax, (%rbx,%r13,4)
	movl	%eax, (%r14,%r13,4)
	incq	%r13
	cmpq	$1048576, %r13                  # imm = 0x100000
	jne	.LBB4_1
# %bb.2:
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r15
	movl	$1024, %edi                     # imm = 0x400
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	%rax, %rcx
	callq	_Z15compute_on_hostiPiS_S_
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r12
	movl	$1024, %edi                     # imm = 0x400
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	%rax, %rcx
	callq	_Z17compute_on_deviceiPiS_S_
	xorl	%eax, %eax
	movl	$1024, %ecx                     # imm = 0x400
	xorl	%esi, %esi
	xorl	%edx, %edx
.LBB4_3:                                # %.lr.ph.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_5 Depth 2
	movl	%eax, %edi
	shrl	$10, %edi
	shlq	$12, %rdi
	leaq	(%r12,%rdi), %r8
	addq	%r15, %rdi
	xorl	%r9d, %r9d
.LBB4_5:                                #   Parent Loop BB4_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rdi,%r9,4), %r10d
	cmpl	(%r8,%r9,4), %r10d
	jne	.LBB4_7
# %bb.4:                                #   in Loop: Header=BB4_5 Depth=2
	incq	%r9
	cmpq	$1024, %r9                      # imm = 0x400
	jne	.LBB4_5
# %bb.6:                                # %._crit_edge.i
                                        #   in Loop: Header=BB4_3 Depth=1
	cmpq	$1023, %rsi                     # imm = 0x3FF
	leaq	1(%rsi), %rdi
	setae	%dl
	addq	%rcx, %rax
	movq	%rdi, %rsi
	cmpq	%rcx, %rdi
	jne	.LBB4_3
.LBB4_7:                                # %_Z5equaliPiS_.exit
	testb	$1, %dl
	jne	.LBB4_9
# %bb.8:
	movl	$_ZSt4cout, %r13d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB4_9:
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,"axG",@progbits,_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,comdat
	.weak	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE # -- Begin function _ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.p2align	1, 0x90
	.type	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,@function
_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE: # @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.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	%rsi, %rbx
	movq	%rdi, %r15
	movslq	4(%rdx), %rbp
	movslq	(%rdx), %rdi
	subq	%rdi, %rbp
	cmpq	$2147483644, %rbp               # imm = 0x7FFFFFFC
	ja	.LBB5_4
# %bb.1:
	incq	%rbp
	movl	$2147483645, %eax               # imm = 0x7FFFFFFD
	xorl	%edx, %edx
	divl	%ebp
	movl	%eax, %ecx
	imulq	%rcx, %rbp
	movq	(%rbx), %rdx
	movabsq	$8589934597, %r8                # imm = 0x200000005
.LBB5_2:                                # =>This Inner Loop Header: Depth=1
	imulq	$48271, %rdx, %rsi              # imm = 0xBC8F
	movq	%rsi, %rax
	mulq	%r8
	movq	%rsi, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	leaq	(%rsi,%rax), %rdx
	addq	%rsi, %rax
	decq	%rax
	cmpq	%rbp, %rax
	jae	.LBB5_2
# %bb.3:
	movq	%rdx, (%rbx)
	xorl	%edx, %edx
	divq	%rcx
	jmp	.LBB5_9
.LBB5_4:
	cmpq	$2147483645, %rbp               # imm = 0x7FFFFFFD
	jne	.LBB5_5
# %bb.10:
	imulq	$48271, (%rbx), %rcx            # imm = 0xBC8F
	movabsq	$8589934597, %rdx               # imm = 0x200000005
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	leaq	(%rcx,%rax), %rdx
	movq	%rdx, (%rbx)
	addq	%rcx, %rax
	decq	%rax
	jmp	.LBB5_9
.LBB5_5:                                # %.preheader
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movq	%rbp, %rax
	shrq	%rax
	movabsq	$-9223372028264841207, %rcx     # imm = 0x8000000200000009
	mulq	%rcx
	movq	%rdx, %r12
	shrq	$29, %r12
	leaq	8(%rsp), %r13
	movabsq	$8589934597, %r14               # imm = 0x200000005
.LBB5_6:                                # =>This Inner Loop Header: Depth=1
	movl	$0, 8(%rsp)
	movl	%r12d, 12(%rsp)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	movslq	%eax, %rsi
	leaq	(%rsi,%rsi), %rax
	shlq	$31, %rsi
	subq	%rax, %rsi
	imulq	$48271, (%rbx), %rcx            # imm = 0xBC8F
	movq	%rcx, %rax
	mulq	%r14
	movq	%rcx, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, (%rbx)
	addq	%rsi, %rax
	decq	%rax
	cmpq	%rbp, %rax
	ja	.LBB5_6
# %bb.7:                                #   in Loop: Header=BB5_6 Depth=1
	cmpq	%rsi, %rax
	jb	.LBB5_6
# %bb.8:                                # %.loopexit.loopexit
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movl	(%rcx), %edi
.LBB5_9:                                # %.loopexit
	addl	%edi, %eax
                                        # kill: def $eax killed $eax killed $rax
	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_end5:
	.size	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE, .Lfunc_end5-_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm48271ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.cfi_endproc
                                        # -- End function
	.text
	.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	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14multiplicationPiS_S_i, %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_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z14multiplicationPiS_S_i,@object # @_Z14multiplicationPiS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z14multiplicationPiS_S_i
	.p2align	3, 0x0
_Z14multiplicationPiS_S_i:
	.quad	_Z29__device_stub__multiplicationPiS_S_i
	.size	_Z14multiplicationPiS_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"device: "
	.size	.L.str, 9

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" ms\n"
	.size	.L.str.1, 5

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"matrices are not equal"
	.size	.L.str.3, 23

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z14multiplicationPiS_S_i"
	.size	.L__unnamed_1, 26

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z14multiplicationPiS_S_i ; -- Begin function _Z14multiplicationPiS_S_i
	.globl	_Z14multiplicationPiS_S_i
	.p2align	8
	.type	_Z14multiplicationPiS_S_i,@function
_Z14multiplicationPiS_S_i:              ; @_Z14multiplicationPiS_S_i
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_bfe_u32 v3, v0, 10, 10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v2, s15, 5, v3
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_i32_e32 v1, s2
	v_mul_lo_u32 v2, v2, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v1, 0x3d000000, v1
	v_ceil_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cvt_i32_f32_e32 v4, v1
	v_and_b32_e32 v1, 0x3ff, v0
	v_cmp_gt_i32_e32 vcc_lo, 1, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_lshl_add_u32 v0, s14, 5, v1
	s_cbranch_vccnz .LBB0_5
; %bb.1:                                ; %.lr.ph
	v_lshlrev_b32_e32 v8, 2, v1
	v_lshlrev_b32_e32 v5, 7, v3
	v_add_nc_u32_e32 v7, v2, v1
	v_mov_b32_e32 v1, 0
	s_mov_b32 s3, 0
	v_or_b32_e32 v6, 0x1000, v8
	v_add_nc_u32_e32 v8, v5, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_nc_u32_e32 v9, v6, v5
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	s_lshl_b32 s8, s3, 5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v11, s8, v3
	v_add_nc_u32_e32 v10, s8, v7
	s_mov_b32 s8, 0
	v_mad_u64_u32 v[12:13], null, v11, s2, v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | 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_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v13, 31, v12
	v_add_co_u32 v10, vcc_lo, s4, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_lshlrev_b64 v[12:13], 2, v[12:13]
	v_add_co_ci_u32_e32 v11, vcc_lo, s5, v11, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v12, vcc_lo, s6, v12
	v_add_co_ci_u32_e32 v13, vcc_lo, s7, v13, vcc_lo
	global_load_b32 v11, v[10:11], off
	global_load_b32 v12, v[12:13], off
	v_mov_b32_e32 v10, v6
	s_waitcnt vmcnt(1)
	ds_store_b32 v8, v11
	s_waitcnt vmcnt(0)
	ds_store_b32 v9, v12
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v11, s8, v5
	s_add_i32 s8, s8, 4
	ds_load_b32 v13, v10
	ds_load_b32 v14, v11
	s_cmpk_eq_i32 s8, 0x80
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[11:12], null, v13, v14, v[1:2]
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v1, v11 :: v_dual_add_nc_u32 v10, 0x80, v10
	s_cbranch_scc0 .LBB0_3
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	v_cmp_eq_u32_e32 vcc_lo, s3, v4
	s_barrier
	buffer_gl0_inv
	s_cbranch_vccz .LBB0_2
	s_branch .LBB0_6
.LBB0_5:
	v_mov_b32_e32 v1, 0
.LBB0_6:                                ; %Flow57
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v2, v2, v0
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s0, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	global_store_b32 v[2:3], v1, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14multiplicationPiS_S_i
		.amdhsa_group_segment_fixed_size 8192
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 28
		.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	_Z14multiplicationPiS_S_i, .Lfunc_end0-_Z14multiplicationPiS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 464
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8192 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
	.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
    .group_segment_fixed_size: 8192
    .kernarg_segment_align: 8
    .kernarg_segment_size: 28
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14multiplicationPiS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14multiplicationPiS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
