#include <iostream>
#include <string>
#include <stdio.h>
#include <cuda.h>
#include <fstream>

using namespace std;

__global__ void MatrixMulKernel(float *d_M, float *d_N, float *d_P,int width){
	int Row = blockIdx.y*blockDim.y + threadIdx.y;
	int Col = blockIdx.x*blockDim.x + threadIdx.x;
	
	if ((Row < width)&&(Col < width)){
		float Pvalue = 0;
		for (int i = 0; i < width; ++i){
			Pvalue += d_M[Row*width+i]*d_N[i*width+Col];
		}
		d_P[Row*width + Col] = Pvalue;
	}
}

int matrixMulHost(float *h_M, float *h_N, float *h_P, int width){
    int Pvalue;

    for(int row = 0; row < width ; ++row){
        for(int col = 0; col < width ; ++col){
            Pvalue = 0;
            for(int k = 0; k < width ; ++k){
                Pvalue += h_M[row*width+k] * h_N[k*width+col];
            }
            h_P[row*width+col] = Pvalue;
        }
    }
    return 0;
}

int initValues(float *data, int width){
    for(int i = 0; i < width*width; i++)
        data[i] = 2;
    return 0;
}

int main(int argc, char const *argv[])
{
	float *h_M, *h_N, *h_P,*h_P_d;
    float *d_M, *d_N,*d_P;
    std::string num = argv[1];
    int width = std::stoi(num);
    int size = width * width * sizeof(float);
    clock_t start, end, startGPU, endGPU;
    double cpu_time_used, gpu_time_used, aceleration;

   for (int times = 0; times < 20; times++){
        h_M = (float*)malloc(size);
        h_N = (float*)malloc(size);
        h_P = (float*)malloc(size);
        h_P_d = (float*)malloc(size);

        initValues(h_M, width);
        initValues(h_N, width);

        /////////Algoritmo Secuencial////////////////////////////////////////////
        start = clock();
        matrixMulHost(h_M, h_N, h_P, width);
        end = clock();
        cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
        printf("Tiempo algoritmo secuencial: %.10f\n", cpu_time_used);
        /////////Algoritmo Secuencial/////////////////////////////////////////////

        cudaMalloc((void**)&d_M,size);
        cudaMalloc((void**)&d_N,size);
        cudaMalloc((void**)&d_P,size);
        //////////////////////Algoritmo Paralelo///////////////////////////
        startGPU = clock();
        cudaMemcpy(d_M, h_M, size, cudaMemcpyHostToDevice);
        cudaMemcpy(d_N, h_N, size, cudaMemcpyHostToDevice);

        int blockSize = 32;
        dim3 dimBlock(blockSize,blockSize,1);
        dim3 dimGrid(ceil(width/float(blockSize)),ceil(width/float(blockSize)),1);
        MatrixMulKernel<<<dimGrid,dimBlock>>>(d_M,d_N,d_P,width);
        cudaDeviceSynchronize();
        cudaMemcpy(h_P_d,d_P,size,cudaMemcpyDeviceToHost);
        endGPU = clock();
        gpu_time_used = ((double) (endGPU - startGPU)) / CLOCKS_PER_SEC;
        aceleration = cpu_time_used/gpu_time_used;
        printf("Tiempo algoritmo paralelo: %.10f\n", gpu_time_used);
        printf("La aceleración obtenida es de %.10fX\n",aceleration);

        std::string name =  "TimesMult.txt"+num;

        ofstream outfile(name,ios::binary | ios::app);
        outfile << gpu_time_used<<" "<< cpu_time_used <<" "<< aceleration << "\n";
        outfile.close();

        free(h_M);
        free(h_N);
        free(h_P);
        cudaFree(d_M);
        cudaFree(d_N);
        cudaFree(d_P);
    }

	return 0;
}

	.file	"tmpxft_00358b18_00000000-6_matrixMult.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3771:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3771:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"basic_string::append"
	.text
	.align 2
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0:
.LFB4491:
	.cfi_startproc
	movabsq	$4611686018427387903, %rax
	subq	8(%rdi), %rax
	cmpq	%rdx, %rax
	jnb	.L3
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L3:
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm@PLT
	.cfi_endproc
.LFE4491:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	.globl	_Z13matrixMulHostPfS_S_i
	.type	_Z13matrixMulHostPfS_S_i, @function
_Z13matrixMulHostPfS_S_i:
.LFB3766:
	.cfi_startproc
	endbr64
	movslq	%ecx, %rcx
	xorl	%r8d, %r8d
	movq	%rsi, %r10
	movq	%rdi, %r9
	movq	%rcx, %rax
	movq	%rdx, %r11
	salq	$2, %rcx
	xorl	%esi, %esi
	cmpl	%eax, %r8d
	jl	.L18
	xorl	%eax, %eax
	ret
.L18:
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	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
.L13:
	xorl	%edx, %edx
	leaq	(%r9,%rsi), %r12
	leaq	(%r11,%rsi), %r13
.L12:
	leaq	(%r10,%rdx,4), %rbp
	xorl	%edi, %edi
	xorl	%ebx, %ebx
.L10:
	movss	(%r12,%rdi,4), %xmm0
	mulss	0(%rbp), %xmm0
	cvtsi2ssl	%ebx, %xmm1
	incq	%rdi
	addq	%rcx, %rbp
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %ebx
	cmpl	%edi, %eax
	jg	.L10
	cvtsi2ssl	%ebx, %xmm0
	movss	%xmm0, 0(%r13,%rdx,4)
	incq	%rdx
	cmpl	%edx, %eax
	jg	.L12
	incl	%r8d
	addq	%rcx, %rsi
	cmpl	%eax, %r8d
	jl	.L13
	popq	%rbx
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3766:
	.size	_Z13matrixMulHostPfS_S_i, .-_Z13matrixMulHostPfS_S_i
	.globl	_Z10initValuesPfi
	.type	_Z10initValuesPfi, @function
_Z10initValuesPfi:
.LFB3767:
	.cfi_startproc
	endbr64
	imull	%esi, %esi
	movss	.LC1(%rip), %xmm0
	xorl	%eax, %eax
.L20:
	cmpl	%eax, %esi
	jle	.L22
	movss	%xmm0, (%rdi,%rax,4)
	incq	%rax
	jmp	.L20
.L22:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE3767:
	.size	_Z10initValuesPfi, .-_Z10initValuesPfi
	.globl	_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i
	.type	_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i, @function
_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i:
.LFB3793:
	.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	.L23
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z15MatrixMulKernelPfS_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
.L23:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3793:
	.size	_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i, .-_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i
	.globl	_Z15MatrixMulKernelPfS_S_i
	.type	_Z15MatrixMulKernelPfS_S_i, @function
_Z15MatrixMulKernelPfS_S_i:
.LFB3794:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i
	.cfi_endproc
.LFE3794:
	.size	_Z15MatrixMulKernelPfS_S_i, .-_Z15MatrixMulKernelPfS_S_i
	.section	.rodata.str1.1
.LC2:
	.string	"_Z15MatrixMulKernelPfS_S_i"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3796:
	.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	.LC2(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z15MatrixMulKernelPfS_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
.LFE3796:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB3875:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L30
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L30:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3875:
	.size	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.rodata.str1.1
.LC3:
	.string	"basic_string: construction from null is not valid"
.LC4:
	.string	"stoi"
.LC6:
	.string	"Tiempo algoritmo secuencial: %.10f\n"
.LC8:
	.string	"Tiempo algoritmo paralelo: %.10f\n"
.LC9:
	.string	"La aceleraci\303\263n obtenida es de %.10fX\n"
.LC10:
	.string	"TimesMult.txt"
.LC11:
	.string	" "
.LC12:
	.string	"\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3768:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3768
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$696, %rsp
	.cfi_def_cfa_offset 752
	movq	8(%rsi), %rbx
	movq	%fs:40, %rax
	movq	%rax, 680(%rsp)
	xorl	%eax, %eax
	leaq	120(%rsp), %rax
	movq	%rax, 104(%rsp)
	testq	%rbx, %rbx
	jne	.L34
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	leaq	.LC3(%rip), %rdi
.LEHB0:
	call	_ZSt19__throw_logic_errorPKc@PLT
.L34:
	movq	%rbx, %rdi
	leaq	88(%rsp), %r13
	call	strlen@PLT
	cmpq	$15, %rax
	movq	%rax, 88(%rsp)
	leaq	(%rbx,%rax), %rbp
	jbe	.L36
	leaq	104(%rsp), %r12
	xorl	%edx, %edx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
.LEHE0:
	movq	%rax, 104(%rsp)
	movq	88(%rsp), %rax
	movq	%rax, 120(%rsp)
.L36:
	movq	104(%rsp), %rdi
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	88(%rsp), %rax
	movq	104(%rsp), %rdx
	movq	%rax, 112(%rsp)
	movb	$0, (%rdx,%rax)
	movq	104(%rsp), %r12
	call	__errno_location@PLT
	xorl	%edx, %edx
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%rax, %rbp
	movl	(%rax), %eax
	movl	%edx, 0(%rbp)
	movl	$10, %edx
	movl	%eax, 76(%rsp)
	call	__isoc23_strtol@PLT
	cmpq	88(%rsp), %r12
	leaq	76(%rsp), %r12
	movq	%rax, %rbx
	jne	.L37
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	leaq	.LC4(%rip), %rdi
.LEHB1:
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L37:
	cmpl	$34, 0(%rbp)
	je	.L39
	movl	$2147483648, %eax
	movl	$4294967295, %edx
	addq	%rbx, %rax
	cmpq	%rax, %rdx
	jnb	.L40
.L39:
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	leaq	.LC4(%rip), %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE1:
.L40:
	movl	%ebx, %ebp
	imull	%ebx, %ebx
	movq	%r12, %rdi
	movl	$20, %r12d
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	sall	$2, %ebx
	movslq	%ebx, %rbx
	jmp	.L42
.L57:
	endbr64
	movq	%rax, %rbx
.L43:
	movq	%r12, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	jmp	.L44
.L67:
	leaq	48(%rsp), %rdi
	movq	%rbx, %rsi
.LEHB2:
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	64(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	call	clock@PLT
	movq	8(%rsp), %rsi
	movq	48(%rsp), %rdi
	movq	%rbx, %rdx
	movl	$1, %ecx
	movq	%rax, %r13
	call	cudaMemcpy@PLT
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rdx
	movq	%r15, %rsi
	call	cudaMemcpy@PLT
	cvtsi2ssl	%ebp, %xmm0
	mulss	.LC7(%rip), %xmm0
	movabsq	$137438953504, %rdx
	movl	$1, 84(%rsp)
	movq	%rdx, 76(%rsp)
	call	ceilf@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	cvttss2siq	%xmm0, %rax
	movl	$1, %esi
	movabsq	$137438953504, %rdx
	movl	$1, 96(%rsp)
	movl	%eax, 88(%rsp)
	movl	%eax, 92(%rsp)
	movq	88(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L45
.L47:
	call	cudaDeviceSynchronize@PLT
	movq	64(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%r14, %rdi
	call	cudaMemcpy@PLT
	call	clock@PLT
	movsd	16(%rsp), %xmm1
	movl	$2, %edi
	leaq	.LC8(%rip), %rsi
	subq	%r13, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC5(%rip), %xmm0
	movb	$1, %al
	movsd	%xmm0, 24(%rsp)
	divsd	%xmm0, %xmm1
	movsd	%xmm1, 40(%rsp)
	call	__printf_chk@PLT
	movsd	40(%rsp), %xmm0
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
.LEHE2:
	leaq	136(%rsp), %rax
	movq	112(%rsp), %r13
	movq	104(%rsp), %r14
	movb	$0, 152(%rsp)
	movq	%rax, (%rsp)
	leaq	152(%rsp), %rax
	movq	(%rsp), %rdi
	movq	%rax, 136(%rsp)
	leaq	13(%r13), %rsi
	xorl	%eax, %eax
	movq	%rax, 144(%rsp)
.LEHB3:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm@PLT
	movq	(%rsp), %rdi
	movl	$13, %edx
	leaq	.LC10(%rip), %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	movq	(%rsp), %rdi
	movq	%r13, %rdx
	movq	%r14, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
.LEHE3:
	leaq	168(%rsp), %r14
	movq	(%rsp), %rsi
	movl	$5, %edx
	movq	%r14, %rdi
.LEHB4:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE4:
	movsd	24(%rsp), %xmm0
	movq	%r14, %rdi
.LEHB5:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC11(%rip), %r13
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	40(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC12(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	%r15, %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
.LEHE5:
	movq	%r14, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	decl	%r12d
	je	.L66
.L42:
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, 32(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movl	%ebp, %esi
	movq	%rax, %r14
	call	_Z10initValuesPfi
	movl	%ebp, %esi
	movq	%r15, %rdi
	call	_Z10initValuesPfi
	call	clock@PLT
	movq	8(%rsp), %rdi
	movq	%r15, %rsi
	movl	%ebp, %ecx
	movq	32(%rsp), %rdx
	movq	%rax, %r13
	call	_Z13matrixMulHostPfS_S_i
	call	clock@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	subq	%r13, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC5(%rip), %xmm0
	movsd	%xmm0, 16(%rsp)
.LEHB6:
	call	__printf_chk@PLT
	jmp	.L67
.L45:
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movl	%ebp, %ecx
	movq	48(%rsp), %rdi
	call	_Z40__device_stub__Z15MatrixMulKernelPfS_S_iPfS_S_i
.LEHE6:
	jmp	.L47
.L58:
	endbr64
	jmp	.L65
.L66:
	leaq	104(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	jmp	.L62
.L56:
	endbr64
	movq	%rax, %rbx
.L50:
	movq	%r14, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L51
.L55:
	endbr64
.L65:
	movq	%rax, %rbx
.L51:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L44
.L54:
	endbr64
	movq	%rax, %rbx
.L44:
	leaq	104(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	movq	%rbx, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L62:
	call	__stack_chk_fail@PLT
.L53:
	addq	$696, %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
.LFE3768:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3768:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3768-.LLSDACSB3768
.LLSDACSB3768:
	.uleb128 .LEHB0-.LFB3768
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3768
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L57-.LFB3768
	.uleb128 0
	.uleb128 .LEHB2-.LFB3768
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L54-.LFB3768
	.uleb128 0
	.uleb128 .LEHB3-.LFB3768
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L58-.LFB3768
	.uleb128 0
	.uleb128 .LEHB4-.LFB3768
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L55-.LFB3768
	.uleb128 0
	.uleb128 .LEHB5-.LFB3768
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L56-.LFB3768
	.uleb128 0
	.uleb128 .LEHB6-.LFB3768
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L54-.LFB3768
	.uleb128 0
	.uleb128 .LEHB7-.LFB3768
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE3768:
	.section	.text.startup
	.size	main, .-main
	.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
.LC1:
	.long	1073741824
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	0
	.long	1093567616
	.section	.rodata.cst4
	.align 4
.LC7:
	.long	1023410176
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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 <string>
#include <stdio.h>
#include <hip/hip_runtime.h>
#include <fstream>

using namespace std;

__global__ void MatrixMulKernel(float *d_M, float *d_N, float *d_P,int width){
	int Row = blockIdx.y*blockDim.y + threadIdx.y;
	int Col = blockIdx.x*blockDim.x + threadIdx.x;
	
	if ((Row < width)&&(Col < width)){
		float Pvalue = 0;
		for (int i = 0; i < width; ++i){
			Pvalue += d_M[Row*width+i]*d_N[i*width+Col];
		}
		d_P[Row*width + Col] = Pvalue;
	}
}

int matrixMulHost(float *h_M, float *h_N, float *h_P, int width){
    int Pvalue;

    for(int row = 0; row < width ; ++row){
        for(int col = 0; col < width ; ++col){
            Pvalue = 0;
            for(int k = 0; k < width ; ++k){
                Pvalue += h_M[row*width+k] * h_N[k*width+col];
            }
            h_P[row*width+col] = Pvalue;
        }
    }
    return 0;
}

int initValues(float *data, int width){
    for(int i = 0; i < width*width; i++)
        data[i] = 2;
    return 0;
}

int main(int argc, char const *argv[])
{
	float *h_M, *h_N, *h_P,*h_P_d;
    float *d_M, *d_N,*d_P;
    std::string num = argv[1];
    int width = std::stoi(num);
    int size = width * width * sizeof(float);
    clock_t start, end, startGPU, endGPU;
    double cpu_time_used, gpu_time_used, aceleration;

   for (int times = 0; times < 20; times++){
        h_M = (float*)malloc(size);
        h_N = (float*)malloc(size);
        h_P = (float*)malloc(size);
        h_P_d = (float*)malloc(size);

        initValues(h_M, width);
        initValues(h_N, width);

        /////////Algoritmo Secuencial////////////////////////////////////////////
        start = clock();
        matrixMulHost(h_M, h_N, h_P, width);
        end = clock();
        cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
        printf("Tiempo algoritmo secuencial: %.10f\n", cpu_time_used);
        /////////Algoritmo Secuencial/////////////////////////////////////////////

        hipMalloc((void**)&d_M,size);
        hipMalloc((void**)&d_N,size);
        hipMalloc((void**)&d_P,size);
        //////////////////////Algoritmo Paralelo///////////////////////////
        startGPU = clock();
        hipMemcpy(d_M, h_M, size, hipMemcpyHostToDevice);
        hipMemcpy(d_N, h_N, size, hipMemcpyHostToDevice);

        int blockSize = 32;
        dim3 dimBlock(blockSize,blockSize,1);
        dim3 dimGrid(ceil(width/float(blockSize)),ceil(width/float(blockSize)),1);
        MatrixMulKernel<<<dimGrid,dimBlock>>>(d_M,d_N,d_P,width);
        hipDeviceSynchronize();
        hipMemcpy(h_P_d,d_P,size,hipMemcpyDeviceToHost);
        endGPU = clock();
        gpu_time_used = ((double) (endGPU - startGPU)) / CLOCKS_PER_SEC;
        aceleration = cpu_time_used/gpu_time_used;
        printf("Tiempo algoritmo paralelo: %.10f\n", gpu_time_used);
        printf("La aceleración obtenida es de %.10fX\n",aceleration);

        std::string name =  "TimesMult.txt"+num;

        ofstream outfile(name,ios::binary | ios::app);
        outfile << gpu_time_used<<" "<< cpu_time_used <<" "<< aceleration << "\n";
        outfile.close();

        free(h_M);
        free(h_N);
        free(h_P);
        hipFree(d_M);
        hipFree(d_N);
        hipFree(d_P);
    }

	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z30__device_stub__MatrixMulKernelPfS_S_i # -- Begin function _Z30__device_stub__MatrixMulKernelPfS_S_i
	.type	_Z30__device_stub__MatrixMulKernelPfS_S_i,@function
_Z30__device_stub__MatrixMulKernelPfS_S_i: # @_Z30__device_stub__MatrixMulKernelPfS_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	$_Z15MatrixMulKernelPfS_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	_Z30__device_stub__MatrixMulKernelPfS_S_i, .Lfunc_end0-_Z30__device_stub__MatrixMulKernelPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z13matrixMulHostPfS_S_i        # -- Begin function _Z13matrixMulHostPfS_S_i
	.type	_Z13matrixMulHostPfS_S_i,@function
_Z13matrixMulHostPfS_S_i:               # @_Z13matrixMulHostPfS_S_i
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB1_8
# %bb.1:                                # %.preheader26.lr.ph
	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
	movl	%ecx, %eax
	leaq	(,%rax,4), %r8
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB1_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_3 Depth 2
                                        #       Child Loop BB1_4 Depth 3
	movl	%r9d, %r11d
	leaq	(%rdi,%r11,4), %r11
	movq	%r10, %rbx
	imulq	%rax, %rbx
	leaq	(%rdx,%rbx,4), %rbx
	movq	%rsi, %r14
	xorl	%r15d, %r15d
.LBB1_3:                                # %.preheader
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_4 Depth 3
	xorl	%r12d, %r12d
	movq	%r14, %r13
	xorl	%ebp, %ebp
.LBB1_4:                                #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r11,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	mulss	(%r13), %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2ss	%ebp, %xmm1
	addss	%xmm0, %xmm1
	cvttss2si	%xmm1, %ebp
	incq	%r12
	addq	%r8, %r13
	cmpq	%r12, %rax
	jne	.LBB1_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB1_3 Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebp, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	addq	$4, %r14
	cmpq	%rax, %r15
	jne	.LBB1_3
# %bb.6:                                # %._crit_edge30
                                        #   in Loop: Header=BB1_2 Depth=1
	incq	%r10
	addl	%ecx, %r9d
	cmpq	%rax, %r10
	jne	.LBB1_2
# %bb.7:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB1_8:                                # %._crit_edge32
	xorl	%eax, %eax
	retq
.Lfunc_end1:
	.size	_Z13matrixMulHostPfS_S_i, .Lfunc_end1-_Z13matrixMulHostPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z10initValuesPfi               # -- Begin function _Z10initValuesPfi
	.type	_Z10initValuesPfi,@function
_Z10initValuesPfi:                      # @_Z10initValuesPfi
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
	testl	%esi, %esi
	je	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	imull	%esi, %esi
	cmpl	$1, %esi
	adcl	$0, %esi
	xorl	%eax, %eax
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$1073741824, (%rdi,%rax,4)      # imm = 0x40000000
	incq	%rax
	cmpq	%rax, %rsi
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	xorl	%eax, %eax
	retq
.Lfunc_end2:
	.size	_Z10initValuesPfi, .Lfunc_end2-_Z10initValuesPfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	0x3d000000                      # float 0.03125
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %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	$664, %rsp                      # imm = 0x298
	.cfi_def_cfa_offset 720
	.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	8(%rsi), %rsi
	leaq	120(%rsp), %rbx
	leaq	152(%rsp), %rdx
	movq	%rbx, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	movq	(%rbx), %rbx
	callq	__errno_location
	movq	%rax, %r14
	movl	(%rax), %ebp
	movl	$0, (%rax)
	leaq	152(%rsp), %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%rbx, (%r15)
	je	.LBB3_41
# %bb.1:
	movslq	%eax, %rcx
	cmpq	%rax, %rcx
	jne	.LBB3_43
# %bb.2:
	movl	(%r14), %ecx
	cmpl	$34, %ecx
	je	.LBB3_43
# %bb.3:
	testl	%ecx, %ecx
	jne	.LBB3_5
# %bb.4:
	movl	%ebp, (%r14)
.LBB3_5:
	movl	%eax, %r13d
	imull	%r13d, %r13d
	leal	(,%r13,4), %ecx
	movslq	%ecx, %rbx
	cmpl	$1, %r13d
	movq	%rax, (%rsp)                    # 8-byte Spill
	cvtsi2ss	%eax, %xmm0
	adcl	$0, %r13d
	mulss	.LCPI3_0(%rip), %xmm0
	callq	ceilf@PLT
	cvttss2si	%xmm0, %rcx
	movl	%ecx, %eax
	shlq	$32, %rcx
	orq	%rax, %rcx
	movq	%rcx, 96(%rsp)                  # 8-byte Spill
	xorl	%eax, %eax
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
.LBB3_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_8 Depth 2
                                        #     Child Loop BB3_10 Depth 2
	movq	%rax, 104(%rsp)                 # 8-byte Spill
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %rbp
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r14
	cmpl	$0, (%rsp)                      # 4-byte Folded Reload
	je	.LBB3_11
# %bb.7:                                # %.lr.ph.i.preheader
                                        #   in Loop: Header=BB3_6 Depth=1
	xorl	%eax, %eax
.LBB3_8:                                # %.lr.ph.i
                                        #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$1073741824, (%rbp,%rax,4)      # imm = 0x40000000
	incq	%rax
	cmpq	%rax, %r13
	jne	.LBB3_8
# %bb.9:                                # %.lr.ph.i73.preheader
                                        #   in Loop: Header=BB3_6 Depth=1
	xorl	%eax, %eax
.LBB3_10:                               # %.lr.ph.i73
                                        #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$1073741824, (%r15,%rax,4)      # imm = 0x40000000
	incq	%rax
	cmpq	%rax, %r13
	jne	.LBB3_10
.LBB3_11:                               # %_Z10initValuesPfi.exit77
                                        #   in Loop: Header=BB3_6 Depth=1
	callq	clock
	movq	%rax, %rbx
	movq	%rbp, %rdi
	movq	%r15, %rsi
	movq	56(%rsp), %rdx                  # 8-byte Reload
	movq	(%rsp), %rcx                    # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	callq	_Z13matrixMulHostPfS_S_i
	callq	clock
	subq	%rbx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI3_1(%rip), %xmm0
	movl	$.L.str, %edi
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
	movb	$1, %al
	callq	printf
.Ltmp0:
	leaq	32(%rsp), %rdi
	movq	8(%rsp), %r12                   # 8-byte Reload
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp1:
# %bb.12:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp2:
	leaq	24(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp3:
# %bb.13:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp4:
	leaq	16(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp5:
# %bb.14:                               #   in Loop: Header=BB3_6 Depth=1
	callq	clock
	movq	%rax, %rbx
	movq	32(%rsp), %rdi
.Ltmp6:
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp7:
# %bb.15:                               #   in Loop: Header=BB3_6 Depth=1
	movq	24(%rsp), %rdi
.Ltmp8:
	movq	%r15, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp9:
# %bb.16:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp11:
	movq	96(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movabsq	$137438953504, %rdx             # imm = 0x2000000020
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp12:
# %bb.17:                               #   in Loop: Header=BB3_6 Depth=1
	testl	%eax, %eax
	jne	.LBB3_19
# %bb.18:                               #   in Loop: Header=BB3_6 Depth=1
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp13:
	movq	(%rsp), %rcx                    # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	callq	_Z30__device_stub__MatrixMulKernelPfS_S_i
.Ltmp14:
.LBB3_19:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp15:
	callq	hipDeviceSynchronize
.Ltmp16:
# %bb.20:                               #   in Loop: Header=BB3_6 Depth=1
	movq	16(%rsp), %rsi
.Ltmp17:
	movq	%r14, %rdi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp18:
# %bb.21:                               #   in Loop: Header=BB3_6 Depth=1
	callq	clock
	subq	%rbx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI3_1(%rip), %xmm0
	movsd	48(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movsd	%xmm1, 40(%rsp)                 # 8-byte Spill
	movl	$.L.str.1, %edi
	movsd	%xmm0, 112(%rsp)                # 8-byte Spill
	movb	$1, %al
	callq	printf
	movl	$.L.str.2, %edi
	movsd	40(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movq	120(%rsp), %rbx
	movq	128(%rsp), %r12
	leaq	80(%rsp), %rax
	movq	%rax, 64(%rsp)
	movq	$0, 72(%rsp)
	movb	$0, 80(%rsp)
	leaq	13(%r12), %rsi
.Ltmp20:
	leaq	64(%rsp), %r14
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm
.Ltmp21:
# %bb.22:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp22:
	movl	$.L.str.3, %esi
	movl	$13, %edx
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp23:
# %bb.23:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp24:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp25:
# %bb.24:                               # %_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_.exit
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp27:
	leaq	152(%rsp), %r12
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	$5, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
.Ltmp28:
# %bb.25:                               #   in Loop: Header=BB3_6 Depth=1
.Ltmp30:
	movq	%r12, %rdi
	movsd	112(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp31:
# %bb.26:                               # %_ZNSolsEd.exit
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp32:
	movq	%rax, %rbx
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp33:
# %bb.27:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp34:
	movq	%rbx, %rdi
	movsd	48(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp35:
# %bb.28:                               # %_ZNSolsEd.exit80
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp36:
	movq	%rax, %rbx
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp37:
# %bb.29:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit81
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp38:
	movq	%rbx, %rdi
	movsd	40(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp39:
# %bb.30:                               # %_ZNSolsEd.exit82
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp40:
	movl	$.L.str.5, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp41:
# %bb.31:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit83
                                        #   in Loop: Header=BB3_6 Depth=1
.Ltmp42:
	movq	%r12, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp43:
# %bb.32:                               #   in Loop: Header=BB3_6 Depth=1
	movq	%rbp, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	32(%rsp), %rdi
.Ltmp44:
	callq	hipFree
.Ltmp45:
# %bb.33:                               #   in Loop: Header=BB3_6 Depth=1
	movq	24(%rsp), %rdi
.Ltmp46:
	callq	hipFree
.Ltmp47:
# %bb.34:                               #   in Loop: Header=BB3_6 Depth=1
	movq	16(%rsp), %rdi
.Ltmp48:
	callq	hipFree
.Ltmp49:
# %bb.35:                               #   in Loop: Header=BB3_6 Depth=1
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	movq	%rax, 152(%rsp)
	movq	-24(%rax), %rax
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	%rcx, 152(%rsp,%rax)
	leaq	160(%rsp), %rdi
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	400(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	64(%rsp), %rdi
	leaq	80(%rsp), %rax
	cmpq	%rax, %rdi
	movq	104(%rsp), %rbx                 # 8-byte Reload
	je	.LBB3_37
# %bb.36:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i84
                                        #   in Loop: Header=BB3_6 Depth=1
	callq	_ZdlPv
.LBB3_37:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit86
                                        #   in Loop: Header=BB3_6 Depth=1
	incl	%ebx
	cmpl	$20, %ebx
	movq	%rbx, %rax
	movq	8(%rsp), %rbx                   # 8-byte Reload
	jne	.LBB3_6
# %bb.38:
	leaq	136(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB3_40
# %bb.39:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB3_40:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	xorl	%eax, %eax
	addq	$664, %rsp                      # imm = 0x298
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB3_41:
	.cfi_def_cfa_offset 720
.Ltmp53:
	movl	$.L.str.6, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp54:
# %bb.42:
.LBB3_43:                               # %.critedge.i.i
.Ltmp51:
	movl	$.L.str.6, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp52:
# %bb.44:
.LBB3_45:
.Ltmp55:
	movq	%rax, %rbx
	cmpl	$0, (%r14)
	jne	.LBB3_56
# %bb.46:
	movl	%ebp, (%r14)
	jmp	.LBB3_56
.LBB3_47:
.Ltmp29:
	jmp	.LBB3_49
.LBB3_48:
.Ltmp26:
.LBB3_49:
	movq	%rax, %rbx
	jmp	.LBB3_54
.LBB3_50:
.Ltmp19:
	jmp	.LBB3_52
.LBB3_51:
.Ltmp10:
.LBB3_52:                               # %.body
	movq	%rax, %rbx
	jmp	.LBB3_56
.LBB3_53:
.Ltmp50:
	movq	%rax, %rbx
	leaq	152(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB3_54:
	movq	64(%rsp), %rdi
	leaq	80(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_56
# %bb.55:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i87
	callq	_ZdlPv
.LBB3_56:                               # %.body
	leaq	136(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB3_58
# %bb.57:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i90
	callq	_ZdlPv
.LBB3_58:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit92
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp9-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp18-.Ltmp11                #   Call between .Ltmp11 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin0          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp25-.Ltmp20                #   Call between .Ltmp20 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin0          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp49-.Ltmp30                #   Call between .Ltmp30 and .Ltmp49
	.uleb128 .Ltmp50-.Lfunc_begin0          #     jumps to .Ltmp50
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp53-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp52-.Ltmp53                #   Call between .Ltmp53 and .Ltmp52
	.uleb128 .Ltmp55-.Lfunc_begin0          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp52-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Lfunc_end3-.Ltmp52            #   Call between .Ltmp52 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB4_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB4_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.7, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end4:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end4-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB5_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB5_3
.LBB5_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB5_3:
	testq	%r14, %r14
	je	.LBB5_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB5_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB5_7
.LBB5_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB5_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end5-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.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	$_Z15MatrixMulKernelPfS_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	_Z15MatrixMulKernelPfS_S_i,@object # @_Z15MatrixMulKernelPfS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z15MatrixMulKernelPfS_S_i
	.p2align	3, 0x0
_Z15MatrixMulKernelPfS_S_i:
	.quad	_Z30__device_stub__MatrixMulKernelPfS_S_i
	.size	_Z15MatrixMulKernelPfS_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Tiempo algoritmo secuencial: %.10f\n"
	.size	.L.str, 36

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Tiempo algoritmo paralelo: %.10f\n"
	.size	.L.str.1, 34

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"La aceleraci\303\263n obtenida es de %.10fX\n"
	.size	.L.str.2, 39

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"TimesMult.txt"
	.size	.L.str.3, 14

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

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"stoi"
	.size	.L.str.6, 5

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.7, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15MatrixMulKernelPfS_S_i"
	.size	.L__unnamed_1, 27

	.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 _Z30__device_stub__MatrixMulKernelPfS_S_i
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z15MatrixMulKernelPfS_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15MatrixMulKernelPfS_S_i ; -- Begin function _Z15MatrixMulKernelPfS_S_i
	.globl	_Z15MatrixMulKernelPfS_S_i
	.p2align	8
	.type	_Z15MatrixMulKernelPfS_S_i,@function
_Z15MatrixMulKernelPfS_S_i:             ; @_Z15MatrixMulKernelPfS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x2c
	s_load_b32 s2, s[0:1], 0x18
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s3, 16
	s_and_b32 s3, s3, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s4, v[1:2]
	v_mad_u64_u32 v[0:1], null, s14, s3, v[4:5]
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_i32_e32 v1, v2, v0
	v_cmpx_gt_i32_e64 s2, v1
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_mul_lo_u32 v1, v2, s2
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB0_4
; %bb.2:                                ; %.lr.ph.preheader
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v2, 31, v1
	v_mov_b32_e32 v6, 0
	v_mov_b32_e32 v4, v0
	s_mov_b32 s3, s2
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
.LBB0_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v5, 31, v4
	s_add_i32 s3, s3, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_eq_u32 s3, 0
	v_lshlrev_b64 v[7:8], 2, v[4:5]
	v_add_nc_u32_e32 v4, s2, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v7, vcc_lo, s6, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s7, v8, vcc_lo
	global_load_b32 v5, v[2:3], off
	global_load_b32 v7, v[7:8], off
	v_add_co_u32 v2, vcc_lo, v2, 4
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v5, v7
	s_cbranch_scc0 .LBB0_3
	s_branch .LBB0_5
.LBB0_4:
	v_mov_b32_e32 v6, 0
.LBB0_5:                                ; %Flow46
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v1, v0
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v6, off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15MatrixMulKernelPfS_S_i
		.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 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	_Z15MatrixMulKernelPfS_S_i, .Lfunc_end0-_Z15MatrixMulKernelPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 332
; 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 : 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:         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:           _Z15MatrixMulKernelPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15MatrixMulKernelPfS_S_i.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
