#include <stdlib.h>
//#include <float.h>
#include <stdio.h>
//#include <string.h>
//#include <math.h>
#include <time.h>

typedef struct {
  int width;
  int height;
  float *elements;
} Matrix;

void startSeed()
{
    srand(time(NULL));
    int seed = rand();
    srand(seed);
}

void draw_random(Matrix mat) {
     for (int i = 0; i < mat.height*mat.width; i++)
     {
	    mat.elements[i] = (float) (rand() % 10);
     }
}

void disp_img(Matrix mat) {
    for (int i = 0; i < mat.height; i++)
     {
        for (int j = 0; j < mat.width; j++)
        {
	        printf("%5.0f", mat.elements[i*mat.width + j]);
        }
        printf("\n");
     }
     printf("\n");
}

Matrix createMatrix(int height, int width)
{
    Matrix mat;

    mat.width = width;
    mat.height = height;
    mat.elements = (float*) malloc(mat.width*mat.height*sizeof(float));

    for(int i = 0; i < mat.height; i++)
      for(int j = 0; j < mat.width; j++)
        mat.elements[i*mat.width + j] = 0;
    
    return mat;
}

void multiMatrix(Matrix A, Matrix B, Matrix C)
{
    for (int i = 0; i < A.height; i++) {
        for (int j = 0; j < B.width; j++) {
            C.elements[j + i * B.width] = 0;
            for (int k = 0; k < A.width; k++) {
                C.elements[j + i * C.width] += A.elements[k + i * A.width] * B.elements[j + k * B.width];
            }
        }
    }
}

long timediff(clock_t t1, clock_t t2) {
    long elapsed;
    elapsed = ((double)t2 - t1) / CLOCKS_PER_SEC * 1000;
    return elapsed;
}

int main(int argc, char* argv[])
{
  int a = 4;
  int b = 4;
  int c = 8;
  
  Matrix A;
  Matrix B;
  Matrix C;

  A = createMatrix(a, b);
  B = createMatrix(b, c);
  C = createMatrix(A.height, B.width);

  startSeed();
  
  draw_random(A);
  draw_random(B);

  printf(" Matriz A \n");
  disp_img(A);
  printf(" Matriz B \n");
  disp_img(B);
  multiMatrix(A, B, C);
  printf(" Matriz C \n");
  disp_img(C);
}



	.file	"tmpxft_00205267_00000000-6_multiplicaMatrizCPU.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z9startSeedv
	.type	_Z9startSeedv, @function
_Z9startSeedv:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	call	rand@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	movl	%eax, %edi
	jmp	srand@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z9startSeedv, .-_Z9startSeedv
	.globl	_Z11draw_random6Matrix
	.type	_Z11draw_random6Matrix, @function
_Z11draw_random6Matrix:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	shrq	$32, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	imull	%edi, %ebp
.L5:
	cmpl	%ebx, %ebp
	jle	.L9
	call	rand@PLT
	movl	$10, %ecx
	cltd
	idivl	%ecx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L5
.L9:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z11draw_random6Matrix, .-_Z11draw_random6Matrix
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%5.0f"
.LC1:
	.string	"\n"
	.text
	.globl	_Z8disp_img6Matrix
	.type	_Z8disp_img6Matrix, @function
_Z8disp_img6Matrix:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%edi, %r14d
	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
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	sarq	$32, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L11:
	cmpl	%ebx, %r12d
	jge	.L13
	movslq	%ebp, %rdx
	xorl	%ecx, %ecx
	salq	$2, %rdx
.L14:
	cmpl	%r14d, %ecx
	jge	.L16
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movl	%ecx, 12(%rsp)
	movq	%rdx, (%rsp)
	cvtss2sd	(%rdx,%r13), %xmm0
	call	__printf_chk@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %rdx
	incl	%ecx
	addq	$4, %rdx
	jmp	.L14
.L16:
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	incl	%r12d
	addl	%r15d, %ebp
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L11
.L13:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z8disp_img6Matrix, .-_Z8disp_img6Matrix
	.globl	_Z12createMatrixii
	.type	_Z12createMatrixii, @function
_Z12createMatrixii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	movl	%esi, %edi
	imull	%ebp, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%esi, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 32
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	movq	%rax, %rdx
.L18:
	cmpl	%ebp, %esi
	jge	.L20
	movslq	%ecx, %rax
	leaq	(%rdx,%rax,4), %rdi
	xorl	%eax, %eax
.L21:
	cmpl	%eax, %ebx
	jle	.L23
	movl	$0x00000000, (%rdi,%rax,4)
	incq	%rax
	jmp	.L21
.L23:
	incl	%esi
	addl	%ebx, %ecx
	jmp	.L18
.L20:
	salq	$32, %rbp
	movl	%ebx, %eax
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	orq	%rbp, %rax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z12createMatrixii, .-_Z12createMatrixii
	.globl	_Z11multiMatrix6MatrixS_S_
	.type	_Z11multiMatrix6MatrixS_S_, @function
_Z11multiMatrix6MatrixS_S_:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edx, %r15d
	xorl	%r11d, %r11d
	xorl	%r10d, %r10d
	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
	movq	%rdi, %rbx
	shrq	$32, %rbx
	movl	%edx, -16(%rsp)
	movslq	%edx, %rdx
	movq	%rcx, -8(%rsp)
	movl	%edi, -28(%rsp)
	movl	%edi, -12(%rsp)
	leaq	0(,%rdx,4), %rdi
	movl	%ebx, -32(%rsp)
	xorl	%ebx, %ebx
	movq	%rdi, -24(%rsp)
	xorl	%edi, %edi
.L25:
	cmpl	%r10d, -32(%rsp)
	jle	.L24
	movslq	%edi, %rdx
	leaq	(%r9,%rdx,4), %r14
	movslq	%ebx, %rdx
	leaq	(%rsi,%rdx,4), %r13
	xorl	%edx, %edx
.L30:
	cmpl	%edx, -16(%rsp)
	jle	.L32
	leal	(%r11,%rdx), %ecx
	movl	$0x00000000, (%r14,%rdx,4)
	movslq	%ecx, %rcx
	leaq	(%r9,%rcx,4), %r12
	movq	-8(%rsp), %rcx
	leaq	(%rcx,%rdx,4), %rbp
	xorl	%ecx, %ecx
.L26:
	cmpl	%ecx, -28(%rsp)
	jle	.L33
	movss	0(%r13,%rcx,4), %xmm0
	mulss	0(%rbp), %xmm0
	incq	%rcx
	addss	(%r12), %xmm0
	movq	-24(%rsp), %rax
	addq	%rax, %rbp
	movss	%xmm0, (%r12)
	jmp	.L26
.L33:
	incq	%rdx
	jmp	.L30
.L32:
	movl	-12(%rsp), %eax
	incl	%r10d
	addl	%r15d, %edi
	addl	%r8d, %r11d
	addl	%eax, %ebx
	jmp	.L25
.L24:
	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
.LFE2031:
	.size	_Z11multiMatrix6MatrixS_S_, .-_Z11multiMatrix6MatrixS_S_
	.globl	_Z8timediffll
	.type	_Z8timediffll, @function
_Z8timediffll:
.LFB2032:
	.cfi_startproc
	endbr64
	cvtsi2sdq	%rsi, %xmm0
	cvtsi2sdq	%rdi, %xmm1
	subsd	%xmm1, %xmm0
	divsd	.LC3(%rip), %xmm0
	mulsd	.LC4(%rip), %xmm0
	cvttsd2siq	%xmm0, %rax
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z8timediffll, .-_Z8timediffll
	.section	.rodata.str1.1
.LC5:
	.string	" Matriz A \n"
.LC6:
	.string	" Matriz B \n"
.LC7:
	.string	" Matriz C \n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$4, %esi
	movl	$4, %edi
	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
	pushq	%rax
	.cfi_def_cfa_offset 64
	call	_Z12createMatrixii
	movl	$8, %esi
	movl	$4, %edi
	movq	%rax, %rbx
	movq	%rdx, %r12
	call	_Z12createMatrixii
	movq	%rax, %rbp
	movl	%eax, %esi
	movq	%rbx, %rax
	movq	%rdx, %r13
	shrq	$32, %rax
	movl	%eax, %edi
	call	_Z12createMatrixii
	movq	%rdx, %r14
	movq	%rax, %r15
	call	_Z9startSeedv
	movq	%rbx, %rdi
	movq	%r12, %rsi
	call	_Z11draw_random6Matrix
	movq	%rbp, %rdi
	movq	%r13, %rsi
	call	_Z11draw_random6Matrix
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	movq	%r12, %rsi
	call	_Z8disp_img6Matrix
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	movq	%r13, %rsi
	call	_Z8disp_img6Matrix
	movq	%rbp, %rdx
	movq	%r15, %r8
	movq	%r14, %r9
	movq	%r13, %rcx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	call	_Z11multiMatrix6MatrixS_S_
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r15, %rdi
	movq	%r14, %rsi
	call	_Z8disp_img6Matrix
	popq	%rdx
	.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
.LFE2033:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2059:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2059:
	.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.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.long	0
	.long	1093567616
	.align 8
.LC4:
	.long	0
	.long	1083129856
	.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 <stdlib.h>
//#include <float.h>
#include <stdio.h>
//#include <string.h>
//#include <math.h>
#include <time.h>

typedef struct {
  int width;
  int height;
  float *elements;
} Matrix;

void startSeed()
{
    srand(time(NULL));
    int seed = rand();
    srand(seed);
}

void draw_random(Matrix mat) {
     for (int i = 0; i < mat.height*mat.width; i++)
     {
	    mat.elements[i] = (float) (rand() % 10);
     }
}

void disp_img(Matrix mat) {
    for (int i = 0; i < mat.height; i++)
     {
        for (int j = 0; j < mat.width; j++)
        {
	        printf("%5.0f", mat.elements[i*mat.width + j]);
        }
        printf("\n");
     }
     printf("\n");
}

Matrix createMatrix(int height, int width)
{
    Matrix mat;

    mat.width = width;
    mat.height = height;
    mat.elements = (float*) malloc(mat.width*mat.height*sizeof(float));

    for(int i = 0; i < mat.height; i++)
      for(int j = 0; j < mat.width; j++)
        mat.elements[i*mat.width + j] = 0;
    
    return mat;
}

void multiMatrix(Matrix A, Matrix B, Matrix C)
{
    for (int i = 0; i < A.height; i++) {
        for (int j = 0; j < B.width; j++) {
            C.elements[j + i * B.width] = 0;
            for (int k = 0; k < A.width; k++) {
                C.elements[j + i * C.width] += A.elements[k + i * A.width] * B.elements[j + k * B.width];
            }
        }
    }
}

long timediff(clock_t t1, clock_t t2) {
    long elapsed;
    elapsed = ((double)t2 - t1) / CLOCKS_PER_SEC * 1000;
    return elapsed;
}

int main(int argc, char* argv[])
{
  int a = 4;
  int b = 4;
  int c = 8;
  
  Matrix A;
  Matrix B;
  Matrix C;

  A = createMatrix(a, b);
  B = createMatrix(b, c);
  C = createMatrix(A.height, B.width);

  startSeed();
  
  draw_random(A);
  draw_random(B);

  printf(" Matriz A \n");
  disp_img(A);
  printf(" Matriz B \n");
  disp_img(B);
  multiMatrix(A, B, C);
  printf(" Matriz C \n");
  disp_img(C);
}



	.text
	.file	"multiplicaMatrizCPU.hip"
	.globl	_Z9startSeedv                   # -- Begin function _Z9startSeedv
	.type	_Z9startSeedv,@function
_Z9startSeedv:                          # @_Z9startSeedv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	callq	rand
	movl	%eax, %edi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	srand                           # TAILCALL
.Lfunc_end0:
	.size	_Z9startSeedv, .Lfunc_end0-_Z9startSeedv
	.cfi_endproc
                                        # -- End function
	.globl	_Z11draw_random6Matrix          # -- Begin function _Z11draw_random6Matrix
	.type	_Z11draw_random6Matrix,@function
_Z11draw_random6Matrix:                 # @_Z11draw_random6Matrix
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	shrq	$32, %rax
	imull	%edi, %eax
	testl	%eax, %eax
	jle	.LBB1_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movl	%eax, %r14d
	xorl	%r15d, %r15d
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_4:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z11draw_random6Matrix, .Lfunc_end1-_Z11draw_random6Matrix
	.cfi_endproc
                                        # -- End function
	.globl	_Z8disp_img6Matrix              # -- Begin function _Z8disp_img6Matrix
	.type	_Z8disp_img6Matrix,@function
_Z8disp_img6Matrix:                     # @_Z8disp_img6Matrix
	.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, 8(%rsp)                   # 8-byte Spill
	movq	%rdi, %rax
	shrq	$32, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB2_6
# %bb.1:                                # %.preheader.lr.ph
	movq	%rdi, %r14
	movl	%r14d, %r12d
	xorl	%r13d, %r13d
	xorl	%ebp, %ebp
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
	testl	%r14d, %r14d
	jle	.LBB2_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	%r13d, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbx
	xorl	%r15d, %r15d
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB2_4
.LBB2_5:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbp
	addl	%r14d, %r13d
	cmpq	16(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB2_2
.LBB2_6:                                # %._crit_edge11
	movl	$10, %edi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT                     # TAILCALL
.Lfunc_end2:
	.size	_Z8disp_img6Matrix, .Lfunc_end2-_Z8disp_img6Matrix
	.cfi_endproc
                                        # -- End function
	.globl	_Z12createMatrixii              # -- Begin function _Z12createMatrixii
	.type	_Z12createMatrixii,@function
_Z12createMatrixii:                     # @_Z12createMatrixii
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	%esi, %ebp
	movl	%edi, %r14d
	movl	%esi, %eax
	imull	%edi, %eax
	movslq	%eax, %rdi
	shlq	$2, %rdi
	callq	malloc
	movq	%rax, %rbx
	movl	%ebp, %eax
	testl	%r14d, %r14d
	jle	.LBB3_1
# %bb.3:                                # %.preheader.lr.ph
	movq	%rax, (%rsp)                    # 8-byte Spill
	leaq	(,%rax,4), %r15
	movl	%r14d, %r12d
	xorl	%r13d, %r13d
	movq	%r12, %r14
.LBB3_4:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	testl	%ebp, %ebp
	jle	.LBB3_6
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB3_4 Depth=1
	movl	%r13d, %eax
	leaq	(%rbx,%rax,4), %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	memset@PLT
.LBB3_6:                                # %._crit_edge
                                        #   in Loop: Header=BB3_4 Depth=1
	addl	%ebp, %r13d
	decq	%r14
	jne	.LBB3_4
# %bb.7:
	movq	(%rsp), %rax                    # 8-byte Reload
	jmp	.LBB3_2
.LBB3_1:                                # %.._crit_edge16_crit_edge
	movl	%r14d, %r12d
.LBB3_2:                                # %._crit_edge16
	shlq	$32, %r12
	orq	%rax, %r12
	movq	%r12, %rax
	movq	%rbx, %rdx
	addq	$8, %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_end3:
	.size	_Z12createMatrixii, .Lfunc_end3-_Z12createMatrixii
	.cfi_endproc
                                        # -- End function
	.globl	_Z11multiMatrix6MatrixS_S_      # -- Begin function _Z11multiMatrix6MatrixS_S_
	.type	_Z11multiMatrix6MatrixS_S_,@function
_Z11multiMatrix6MatrixS_S_:             # @_Z11multiMatrix6MatrixS_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
	.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, -8(%rsp)                  # 8-byte Spill
	movq	%rdx, -40(%rsp)                 # 8-byte Spill
	movq	%rsi, -16(%rsp)                 # 8-byte Spill
	movq	%rdi, %rdx
	shrq	$32, %rdx
	testl	%edx, %edx
	jle	.LBB4_9
# %bb.1:                                # %.preheader.lr.ph
	movslq	-40(%rsp), %rax                 # 4-byte Folded Reload
	movslq	%r8d, %rcx
	movq	%rcx, -32(%rsp)                 # 8-byte Spill
	movl	%eax, %r11d
	movl	%edi, %ebx
	movq	%rax, -24(%rsp)                 # 8-byte Spill
	leaq	(,%rax,4), %r14
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB4_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_4 Depth 2
                                        #       Child Loop BB4_6 Depth 3
	cmpl	$0, -40(%rsp)                   # 4-byte Folded Reload
	jle	.LBB4_8
# %bb.3:                                # %.lr.ph27
                                        #   in Loop: Header=BB4_2 Depth=1
	movl	%r15d, %eax
	movq	-16(%rsp), %rcx                 # 8-byte Reload
	leaq	(%rcx,%rax,4), %r13
	movq	%r12, %rax
	imulq	-24(%rsp), %rax                 # 8-byte Folded Reload
	movq	%r12, %rcx
	imulq	-32(%rsp), %rcx                 # 8-byte Folded Reload
	leaq	(%r9,%rax,4), %rbp
	leaq	(%r9,%rcx,4), %r8
	movq	-8(%rsp), %r10                  # 8-byte Reload
	xorl	%esi, %esi
.LBB4_4:                                #   Parent Loop BB4_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB4_6 Depth 3
	movl	$0, (%rbp,%rsi,4)
	testl	%edi, %edi
	jle	.LBB4_7
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB4_4 Depth=2
	movss	(%r8,%rsi,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	movq	%r10, %rcx
	xorl	%eax, %eax
.LBB4_6:                                #   Parent Loop BB4_2 Depth=1
                                        #     Parent Loop BB4_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r13,%rax,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%rcx), %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r8,%rsi,4)
	incq	%rax
	addq	%r14, %rcx
	cmpq	%rax, %rbx
	jne	.LBB4_6
.LBB4_7:                                # %._crit_edge
                                        #   in Loop: Header=BB4_4 Depth=2
	incq	%rsi
	addq	$4, %r10
	cmpq	%r11, %rsi
	jne	.LBB4_4
.LBB4_8:                                # %._crit_edge28
                                        #   in Loop: Header=BB4_2 Depth=1
	incq	%r12
	addl	%edi, %r15d
	cmpq	%rdx, %r12
	jne	.LBB4_2
.LBB4_9:                                # %._crit_edge30
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z11multiMatrix6MatrixS_S_, .Lfunc_end4-_Z11multiMatrix6MatrixS_S_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z8timediffll
.LCPI5_0:
	.quad	0x412e848000000000              # double 1.0E+6
.LCPI5_1:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	_Z8timediffll
	.type	_Z8timediffll,@function
_Z8timediffll:                          # @_Z8timediffll
	.cfi_startproc
# %bb.0:
	cvtsi2sd	%rsi, %xmm0
	cvtsi2sd	%rdi, %xmm1
	subsd	%xmm1, %xmm0
	divsd	.LCPI5_0(%rip), %xmm0
	mulsd	.LCPI5_1(%rip), %xmm0
	cvttsd2si	%xmm0, %rax
	retq
.Lfunc_end5:
	.size	_Z8timediffll, .Lfunc_end5-_Z8timediffll
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:                                # %_Z12createMatrixii.exit
	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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	$1, %edi
	movl	$64, %esi
	callq	calloc@PLT
	movq	%rax, %rbx
	movl	$1, %edi
	movl	$128, %esi
	callq	calloc@PLT
	movq	%rax, %r12
	movl	$4, %edi
	movl	$8, %esi
	callq	_Z12createMatrixii
	movq	%rax, %r14
	movq	%rdx, %r15
	callq	_Z9startSeedv
	xorl	%r13d, %r13d
.LBB6_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%rbx,%r13,4)
	incq	%r13
	cmpq	$16, %r13
	jne	.LBB6_1
# %bb.2:                                # %.lr.ph.i50.preheader
	xorl	%r13d, %r13d
.LBB6_3:                                # %.lr.ph.i50
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r12,%r13,4)
	incq	%r13
	cmpq	$32, %r13
	jne	.LBB6_3
# %bb.4:                                # %_Z11draw_random6Matrix.exit54
	movl	$.Lstr, %edi
	callq	puts@PLT
	movabsq	$17179869188, %r13              # imm = 0x400000004
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_Z8disp_img6Matrix
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	leaq	4(%r13), %rbp
	movq	%rbp, %rdi
	movq	%r12, %rsi
	callq	_Z8disp_img6Matrix
	movq	%r13, %rdi
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	movq	%r12, %rcx
	movq	%r14, %r8
	movq	%r15, %r9
	callq	_Z11multiMatrix6MatrixS_S_
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_Z8disp_img6Matrix
	xorl	%eax, %eax
	addq	$8, %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_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%5.0f"
	.size	.L.str, 6

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	" Matriz A "
	.size	.Lstr, 11

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	" Matriz B "
	.size	.Lstr.1, 11

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	" Matriz C "
	.size	.Lstr.2, 11

	.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_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
