#include<iostream>
#include<stdio.h>
#include<malloc.h>
#include<cuda.h>
using namespace std;

#define TILE_WIDTH 32

__global__ 
void MultiplicaMatricesCU(int* A,int filA,int colA,int* B,int filB,int colB,int* C){//filC=filA,colC=colB

	//Tamaño total de los elementos con que vamos a trabajar
	__shared__ float A_s[TILE_WIDTH][TILE_WIDTH];
	__shared__ float B_s[TILE_WIDTH][TILE_WIDTH];

	//Para saber en qué bloque y qué hilo estamos
	int bx = blockIdx.x;
	int by = blockIdx.y;
	int tx = threadIdx.x;
	int ty = threadIdx.y;
	int gx = gridDim.x;
	int gy = gridDim.y;

	//Para el resultado de C
	int row = by * TILE_WIDTH + ty;
	int col = bx * TILE_WIDTH + tx;

	int suma = 0;//para llevar la suma de las multiplicaciones

	int n = 0, m = 0;
	while(m < gx && n < gy){
		/* De A queremos sacar las columnas, por eso:
		* col = ( ( m * TILE_WIDTH ) + tx )
		* col = ( ( bx * TILE_WIDTH ) + tx )
		* Hacemos la comparación entre ambas.
		* Vemos que m se mueve entre los bloques en el eje x (las columnas)
		*/
		if(( ( m * TILE_WIDTH ) + tx ) < colA && row < filA) //Si no se pasa
			A_s[ty][tx] = A[ (row * colA) + ( ( m * TILE_WIDTH ) + tx )];//(Row*colA + k), donde k-> 0..filB (filB = colA)
		else A_s[ty][tx] = 0;

		/* De B queremos sacar las filas, por eso:
		* row = ( ( m * TILE_WIDTH ) + tx )
		* row = ( ( by * TILE_WIDTH ) + tx )
		* Hacemos la comparación entre ambas.
		* Vemos que n se mueve entre los bloques en el eje y (las filas)
		*/
		if(( n * TILE_WIDTH + ty) < filB && col < colB)
			B_s[ty][tx] = B[( ( n * TILE_WIDTH + ty) * colB ) + col ];//(k*colB)+Col, donde k-> 0..filB
		else B_s[ty][tx] = 0;

		m++; n++;

		__syncthreads();//espera a todos los hilos

		for (int k=0; k < TILE_WIDTH ; ++k) {
			suma += A_s[ty][k] * B_s[k][tx];
		}
		__syncthreads();
	}
	if(row < filA && col < colB)
		C[ (row * colB) + col] = suma; //C[filA][colB]
}

__host__ 
void multiplicaMatrices(int* X,int filX,int colX,int* Y,int filY,int colY,int* Z){
	for(int i=0;i<filX;i++){
		for(int j=0;j<colY;j++){
			int suma=0;
			for(int k=0;k<filY;k++){
				suma=suma+X[(i*colX)+k]*Y[(k*colY)+j];

			}
			Z[(i*colY)+j]=suma;
		}
	}
}

__host__ 
void imprime(int* A,int filas, int columnas){//imprime como si fuera una matriz
	for(int i = 0; i < filas; i++){
		for(int j = 0; j < columnas; j++){
			cout<<A[(i*columnas)+j]<<" ";
	}
        cout<<endl;
    }
}

__host__ 
void inicializa(int *A,int filas, int columnas){//inicializa arreglos
	for(int i=0;i<filas*columnas;i++){
		A[i]=1;
	}
}

__host__ 
bool compara(int *A, int *B, int filas, int columnas){
	for(int i = 0; i < filas; i++){
		for(int j = 0; j < columnas; j++){
			if(A[i*columnas+j] != B[i*columnas+j]) return false;
		}
	}
	return true;
}

int main(void){

	clock_t startCPU,endCPU,startGPU,endGPU;
	cudaError_t error = cudaSuccess;
	int *A,*B,*C; //A[filA][colA],B[filB][colB],C[filA][colB]
	int *d_A,*d_B,*d_C,*h_C;
	//int filA=2048,colA=2048,filB=2048,colB=2048;
	int filA=1024,colA=1024,filB=1024,colB=1024;
	//-------------------------------CPU--------------------------------------------------------------------
	A=(int*)malloc(filA*colA*sizeof(int));
	B=(int*)malloc(filB*colB*sizeof(int));
	C=(int*)malloc(filA*colB*sizeof(int));

	inicializa(A,filA,colA);
	inicializa(B,filB,colB);

	if(colA==filB){//para que sean multiplicables
		startCPU = clock();
		multiplicaMatrices(A,filA,colA,B,filB,colB,C);
		endCPU = clock();
		//imprime(C,filA,colB);
	}else{
		cout<<"Error, no se pueden multiplicar"<<endl;
		return 0;
	}

	double time_CPU=((double)(endCPU-startCPU))/CLOCKS_PER_SEC;
	cout<<"El tiempo transcurrido en la CPU fue: "<<time_CPU<<endl;
	//-------------------------------GPU--------------------------------------------------------------------
	h_C=(int*)malloc(filA*colB*sizeof(int));

	startGPU = clock();

	error=cudaMalloc((void**)&d_A,filA*colA*sizeof(int));
        if(error != cudaSuccess){
            cout<<"Error reservando memoria para d_A"<<endl;
            //return -1;
        }

	cudaMalloc((void**)&d_B,filB*colB*sizeof(int));
        if(error != cudaSuccess){
            cout<<"Error reservando memoria para d_B"<<endl;
            //return -1;
        }

	cudaMalloc((void**)&d_C,filA*colB*sizeof(int));
        if(error != cudaSuccess){
            cout<<"Error reservando memoria para d_C"<<endl;
            //return -1;
        }

	cudaMemcpy(d_A,A,filA*colA*sizeof(int),cudaMemcpyHostToDevice);//destino d_A y origen A
	cudaMemcpy(d_B,B,filB*colB*sizeof(int),cudaMemcpyHostToDevice);

	//Depende directamente de la dimensión de las matrices
	dim3 dimblock(32,32,1);
	//dim3 dimGrid(32,32,1);
	dim3 dimGrid(ceil((double)(colB/32)),ceil((double)(filA/32)),1);

	MultiplicaMatricesCU<<<dimGrid,dimblock>>>(d_A,filA,colA,d_B,filB,colB,d_C);

	cudaDeviceSynchronize();

	cudaMemcpy(h_C,d_C,filA*colB*sizeof(int),cudaMemcpyDeviceToHost);

	endGPU = clock();
	/*
	COMENTARIO: IMPRESIONES DE PRUEBA
	cout << "MATRIZ A" << endl;
	imprime(A, filA,colA);
	cout << endl << "MATRIZ B" << endl;
	imprime(B, filB,colB);
	cout << endl << "MATRIZ RESULTADO" << endl;
	imprime(h_C, filA,colB);
	*/
	double time_GPU=((double)(endGPU-startGPU))/CLOCKS_PER_SEC;
	cout<<"El tiempo transcurrido en la GPU fue: "<<time_GPU<<endl;
	//-----------------------------------------------------------------------------------
	cout<<"El tiempo de aceleramiento fue: "<<time_CPU/time_GPU<<endl;

	if(compara(h_C, C, filA, colB)) cout << "Buen cálculo" << endl;
	else cout << "Mal cálculo" << endl;

	free(A);free(B);free(C);free(h_C);
	cudaFree(d_A);
	cudaFree(d_B);
	cudaFree(d_C);
	return 0;
}

	.file	"tmpxft_0023304f_00000000-6_matrizSh.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3642:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3642:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4297:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4297:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z18multiplicaMatricesPiiiS_iiS_
	.type	_Z18multiplicaMatricesPiiiS_iiS_, @function
_Z18multiplicaMatricesPiiiS_iiS_:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%r9d, %rax
	movl	%esi, %r10d
	movl	%edx, %r11d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	salq	$2, %rax
	xorl	%esi, %esi
	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	%rcx, %rbx
	xorl	%ecx, %ecx
	movq	%rax, -16(%rsp)
	movl	%r8d, -4(%rsp)
	xorl	%r8d, %r8d
.L4:
	cmpl	%r10d, %r8d
	jge	.L3
	movq	56(%rsp), %rdx
	movslq	%esi, %rax
	leaq	(%rdx,%rax,4), %r15
	movslq	%ecx, %rax
	leaq	(%rdi,%rax,4), %r14
	xorl	%eax, %eax
.L9:
	cmpl	%eax, %r9d
	jle	.L6
	leaq	(%rbx,%rax,4), %r12
	xorl	%edx, %edx
	xorl	%ebp, %ebp
.L7:
	cmpl	%edx, -4(%rsp)
	jle	.L12
	movl	(%r14,%rdx,4), %r13d
	imull	(%r12), %r13d
	incq	%rdx
	addl	%r13d, %ebp
	movq	-16(%rsp), %r13
	addq	%r13, %r12
	jmp	.L7
.L12:
	movl	%ebp, (%r15,%rax,4)
	incq	%rax
	jmp	.L9
.L6:
	incl	%r8d
	addl	%r9d, %esi
	addl	%r11d, %ecx
	jmp	.L4
.L3:
	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
.LFE3635:
	.size	_Z18multiplicaMatricesPiiiS_iiS_, .-_Z18multiplicaMatricesPiiiS_iiS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_Z7imprimePiii
	.type	_Z7imprimePiii, @function
_Z7imprimePiii:
.LFB3636:
	.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
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L14:
	cmpl	%r14d, %r13d
	jge	.L13
	movslq	%r12d, %rax
	xorl	%r15d, %r15d
	leaq	0(%rbp,%rax,4), %rcx
.L17:
	cmpl	%r15d, %ebx
	jle	.L19
	movl	(%rcx,%r15,4), %esi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%rcx, 8(%rsp)
	incq	%r15
	call	_ZNSolsEi@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	8(%rsp), %rcx
	jmp	.L17
.L19:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	incl	%r13d
	addl	%ebx, %r12d
	call	_ZNSolsEPFRSoS_E.isra.0
	jmp	.L14
.L13:
	addq	$24, %rsp
	.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
	ret
	.cfi_endproc
.LFE3636:
	.size	_Z7imprimePiii, .-_Z7imprimePiii
	.globl	_Z10inicializaPiii
	.type	_Z10inicializaPiii, @function
_Z10inicializaPiii:
.LFB3637:
	.cfi_startproc
	endbr64
	imull	%edx, %esi
	xorl	%eax, %eax
.L21:
	cmpl	%eax, %esi
	jle	.L23
	movl	$1, (%rdi,%rax,4)
	incq	%rax
	jmp	.L21
.L23:
	ret
	.cfi_endproc
.LFE3637:
	.size	_Z10inicializaPiii, .-_Z10inicializaPiii
	.globl	_Z7comparaPiS_ii
	.type	_Z7comparaPiS_ii, @function
_Z7comparaPiS_ii:
.LFB3638:
	.cfi_startproc
	endbr64
	movq	%rdi, %r10
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.L25:
	cmpl	%edx, %r9d
	jge	.L30
	movslq	%r8d, %rax
	xorl	%edi, %edi
	salq	$2, %rax
.L28:
	cmpl	%ecx, %edi
	jge	.L31
	movl	(%r10,%rax), %r11d
	addq	$4, %rax
	cmpl	-4(%rsi,%rax), %r11d
	jne	.L29
	incl	%edi
	jmp	.L28
.L31:
	incl	%r9d
	addl	%ecx, %r8d
	jmp	.L25
.L29:
	xorl	%eax, %eax
	ret
.L30:
	movb	$1, %al
	ret
	.cfi_endproc
.LFE3638:
	.size	_Z7comparaPiS_ii, .-_Z7comparaPiS_ii
	.globl	_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_
	.type	_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_, @function
_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_:
.LFB3664:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	192(%rsp), %rax
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movl	%esi, 36(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 32(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 24(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movl	%r9d, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z20MultiplicaMatricesCUPiiiS_iiS_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L32:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3664:
	.size	_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_, .-_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_
	.globl	_Z20MultiplicaMatricesCUPiiiS_iiS_
	.type	_Z20MultiplicaMatricesCUPiiiS_iiS_, @function
_Z20MultiplicaMatricesCUPiiiS_iiS_:
.LFB3665:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_
	.cfi_endproc
.LFE3665:
	.size	_Z20MultiplicaMatricesCUPiiiS_iiS_, .-_Z20MultiplicaMatricesCUPiiiS_iiS_
	.section	.rodata.str1.1
.LC2:
	.string	"El tiempo transcurrido en la CPU fue: "
.LC3:
	.string	"Error reservando memoria para d_A"
.LC4:
	.string	"Error reservando memoria para d_B"
.LC5:
	.string	"Error reservando memoria para d_C"
.LC6:
	.string	"El tiempo transcurrido en la GPU fue: "
.LC7:
	.string	"El tiempo de aceleramiento fue: "
.LC8:
	.string	"Buen c\303\241lculo"
.LC9:
	.string	"Mal c\303\241lculo"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3639:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$4194304, %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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$4194304, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$4194304, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$1024, %edx
	movl	$1024, %esi
	movq	%r12, %rdi
	movq	%rax, %r13
	call	_Z10inicializaPiii
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	_Z10inicializaPiii
	call	clock@PLT
	movq	%rbp, %rcx
	movl	$1024, %edx
	movq	%r12, %rdi
	pushq	%rsi
	.cfi_def_cfa_offset 168
	movl	$1024, %r9d
	movl	$1024, %r8d
	movq	%rax, %rbx
	pushq	%r13
	.cfi_def_cfa_offset 176
	movl	$1024, %esi
	call	_Z18multiplicaMatricesPiiiS_iiS_
	call	clock@PLT
	leaq	.LC2(%rip), %rsi
	subq	%rbx, %rax
	leaq	_ZSt4cout(%rip), %rbx
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC1(%rip), %xmm0
	movsd	%xmm0, 32(%rsp)
	popq	%rdi
	.cfi_def_cfa_offset 168
	movq	%rbx, %rdi
	popq	%r8
	.cfi_def_cfa_offset 160
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$4194304, %edi
	call	malloc@PLT
	movq	%rax, 8(%rsp)
	call	clock@PLT
	leaq	40(%rsp), %rdi
	movl	$4194304, %esi
	movq	%rax, %r15
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L38
	leaq	.LC3(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L38:
	leaq	48(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	testl	%r14d, %r14d
	je	.L39
	leaq	.LC4(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L39:
	leaq	56(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	testl	%r14d, %r14d
	je	.L40
	leaq	.LC5(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L40:
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$4194304, %edx
	movq	%r12, %rsi
	call	cudaMemcpy@PLT
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$137438953504, %rdi
	movl	$1, %esi
	movq	%rdi, %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	pushq	%rax
	.cfi_def_cfa_offset 168
	movl	$1024, %edx
	movl	$1024, %esi
	movl	$1024, %r9d
	pushq	64(%rsp)
	.cfi_def_cfa_offset 176
	movq	64(%rsp), %rcx
	movl	$1024, %r8d
	movq	56(%rsp), %rdi
	call	_Z48__device_stub__Z20MultiplicaMatricesCUPiiiS_iiS_PiiiS_iiS_
	popq	%rdx
	.cfi_def_cfa_offset 168
	popq	%rcx
	.cfi_def_cfa_offset 160
.L41:
	call	cudaDeviceSynchronize@PLT
	movq	56(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	call	clock@PLT
	leaq	.LC6(%rip), %rsi
	movq	%rbx, %rdi
	subq	%r15, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC1(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC7(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	divsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	movq	%r13, %rsi
	movl	$1024, %ecx
	movl	$1024, %edx
	call	_Z7comparaPiS_ii
	leaq	.LC8(%rip), %rsi
	testb	%al, %al
	jne	.L55
	leaq	.LC9(%rip), %rsi
.L55:
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	addq	$104, %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
.LFE3639:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z20MultiplicaMatricesCUPiiiS_iiS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3667:
	.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	.LC10(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z20MultiplicaMatricesCUPiiiS_iiS_(%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
.LFE3667:
	.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
.LC1:
	.long	0
	.long	1093567616
	.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<stdio.h>
#include<malloc.h>
#include<hip/hip_runtime.h>
using namespace std;

#define TILE_WIDTH 32

__global__ 
void MultiplicaMatricesCU(int* A,int filA,int colA,int* B,int filB,int colB,int* C){//filC=filA,colC=colB

	//Tamaño total de los elementos con que vamos a trabajar
	__shared__ float A_s[TILE_WIDTH][TILE_WIDTH];
	__shared__ float B_s[TILE_WIDTH][TILE_WIDTH];

	//Para saber en qué bloque y qué hilo estamos
	int bx = blockIdx.x;
	int by = blockIdx.y;
	int tx = threadIdx.x;
	int ty = threadIdx.y;
	int gx = gridDim.x;
	int gy = gridDim.y;

	//Para el resultado de C
	int row = by * TILE_WIDTH + ty;
	int col = bx * TILE_WIDTH + tx;

	int suma = 0;//para llevar la suma de las multiplicaciones

	int n = 0, m = 0;
	while(m < gx && n < gy){
		/* De A queremos sacar las columnas, por eso:
		* col = ( ( m * TILE_WIDTH ) + tx )
		* col = ( ( bx * TILE_WIDTH ) + tx )
		* Hacemos la comparación entre ambas.
		* Vemos que m se mueve entre los bloques en el eje x (las columnas)
		*/
		if(( ( m * TILE_WIDTH ) + tx ) < colA && row < filA) //Si no se pasa
			A_s[ty][tx] = A[ (row * colA) + ( ( m * TILE_WIDTH ) + tx )];//(Row*colA + k), donde k-> 0..filB (filB = colA)
		else A_s[ty][tx] = 0;

		/* De B queremos sacar las filas, por eso:
		* row = ( ( m * TILE_WIDTH ) + tx )
		* row = ( ( by * TILE_WIDTH ) + tx )
		* Hacemos la comparación entre ambas.
		* Vemos que n se mueve entre los bloques en el eje y (las filas)
		*/
		if(( n * TILE_WIDTH + ty) < filB && col < colB)
			B_s[ty][tx] = B[( ( n * TILE_WIDTH + ty) * colB ) + col ];//(k*colB)+Col, donde k-> 0..filB
		else B_s[ty][tx] = 0;

		m++; n++;

		__syncthreads();//espera a todos los hilos

		for (int k=0; k < TILE_WIDTH ; ++k) {
			suma += A_s[ty][k] * B_s[k][tx];
		}
		__syncthreads();
	}
	if(row < filA && col < colB)
		C[ (row * colB) + col] = suma; //C[filA][colB]
}

__host__ 
void multiplicaMatrices(int* X,int filX,int colX,int* Y,int filY,int colY,int* Z){
	for(int i=0;i<filX;i++){
		for(int j=0;j<colY;j++){
			int suma=0;
			for(int k=0;k<filY;k++){
				suma=suma+X[(i*colX)+k]*Y[(k*colY)+j];

			}
			Z[(i*colY)+j]=suma;
		}
	}
}

__host__ 
void imprime(int* A,int filas, int columnas){//imprime como si fuera una matriz
	for(int i = 0; i < filas; i++){
		for(int j = 0; j < columnas; j++){
			cout<<A[(i*columnas)+j]<<" ";
	}
        cout<<endl;
    }
}

__host__ 
void inicializa(int *A,int filas, int columnas){//inicializa arreglos
	for(int i=0;i<filas*columnas;i++){
		A[i]=1;
	}
}

__host__ 
bool compara(int *A, int *B, int filas, int columnas){
	for(int i = 0; i < filas; i++){
		for(int j = 0; j < columnas; j++){
			if(A[i*columnas+j] != B[i*columnas+j]) return false;
		}
	}
	return true;
}

int main(void){

	clock_t startCPU,endCPU,startGPU,endGPU;
	hipError_t error = hipSuccess;
	int *A,*B,*C; //A[filA][colA],B[filB][colB],C[filA][colB]
	int *d_A,*d_B,*d_C,*h_C;
	//int filA=2048,colA=2048,filB=2048,colB=2048;
	int filA=1024,colA=1024,filB=1024,colB=1024;
	//-------------------------------CPU--------------------------------------------------------------------
	A=(int*)malloc(filA*colA*sizeof(int));
	B=(int*)malloc(filB*colB*sizeof(int));
	C=(int*)malloc(filA*colB*sizeof(int));

	inicializa(A,filA,colA);
	inicializa(B,filB,colB);

	if(colA==filB){//para que sean multiplicables
		startCPU = clock();
		multiplicaMatrices(A,filA,colA,B,filB,colB,C);
		endCPU = clock();
		//imprime(C,filA,colB);
	}else{
		cout<<"Error, no se pueden multiplicar"<<endl;
		return 0;
	}

	double time_CPU=((double)(endCPU-startCPU))/CLOCKS_PER_SEC;
	cout<<"El tiempo transcurrido en la CPU fue: "<<time_CPU<<endl;
	//-------------------------------GPU--------------------------------------------------------------------
	h_C=(int*)malloc(filA*colB*sizeof(int));

	startGPU = clock();

	error=hipMalloc((void**)&d_A,filA*colA*sizeof(int));
        if(error != hipSuccess){
            cout<<"Error reservando memoria para d_A"<<endl;
            //return -1;
        }

	hipMalloc((void**)&d_B,filB*colB*sizeof(int));
        if(error != hipSuccess){
            cout<<"Error reservando memoria para d_B"<<endl;
            //return -1;
        }

	hipMalloc((void**)&d_C,filA*colB*sizeof(int));
        if(error != hipSuccess){
            cout<<"Error reservando memoria para d_C"<<endl;
            //return -1;
        }

	hipMemcpy(d_A,A,filA*colA*sizeof(int),hipMemcpyHostToDevice);//destino d_A y origen A
	hipMemcpy(d_B,B,filB*colB*sizeof(int),hipMemcpyHostToDevice);

	//Depende directamente de la dimensión de las matrices
	dim3 dimblock(32,32,1);
	//dim3 dimGrid(32,32,1);
	dim3 dimGrid(ceil((double)(colB/32)),ceil((double)(filA/32)),1);

	MultiplicaMatricesCU<<<dimGrid,dimblock>>>(d_A,filA,colA,d_B,filB,colB,d_C);

	hipDeviceSynchronize();

	hipMemcpy(h_C,d_C,filA*colB*sizeof(int),hipMemcpyDeviceToHost);

	endGPU = clock();
	/*
	COMENTARIO: IMPRESIONES DE PRUEBA
	cout << "MATRIZ A" << endl;
	imprime(A, filA,colA);
	cout << endl << "MATRIZ B" << endl;
	imprime(B, filB,colB);
	cout << endl << "MATRIZ RESULTADO" << endl;
	imprime(h_C, filA,colB);
	*/
	double time_GPU=((double)(endGPU-startGPU))/CLOCKS_PER_SEC;
	cout<<"El tiempo transcurrido en la GPU fue: "<<time_GPU<<endl;
	//-----------------------------------------------------------------------------------
	cout<<"El tiempo de aceleramiento fue: "<<time_CPU/time_GPU<<endl;

	if(compara(h_C, C, filA, colB)) cout << "Buen cálculo" << endl;
	else cout << "Mal cálculo" << endl;

	free(A);free(B);free(C);free(h_C);
	hipFree(d_A);
	hipFree(d_B);
	hipFree(d_C);
	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_ # -- Begin function _Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_
	.type	_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_,@function
_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_: # @_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.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	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z20MultiplicaMatricesCUPiiiS_iiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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	_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_, .Lfunc_end0-_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z18multiplicaMatricesPiiiS_iiS_ # -- Begin function _Z18multiplicaMatricesPiiiS_iiS_
	.type	_Z18multiplicaMatricesPiiiS_iiS_,@function
_Z18multiplicaMatricesPiiiS_iiS_:       # @_Z18multiplicaMatricesPiiiS_iiS_
	.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
	movl	%r9d, -20(%rsp)                 # 4-byte Spill
	movq	%rcx, -8(%rsp)                  # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB1_7
# %bb.1:                                # %.preheader26.lr.ph
	movslq	-20(%rsp), %rax                 # 4-byte Folded Reload
	movslq	%edx, %rdx
	movl	%esi, %r9d
	movl	%eax, %r11d
	movl	%r8d, %ebx
	shlq	$2, %rdx
	movq	%rax, -16(%rsp)                 # 8-byte Spill
	leaq	(,%rax,4), %r14
	xorl	%r15d, %r15d
.LBB1_2:                                # %.preheader26
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
                                        #       Child Loop BB1_9 Depth 3
	cmpl	$0, -20(%rsp)                   # 4-byte Folded Reload
	jle	.LBB1_6
# %bb.3:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	movq	%r15, %rax
	imulq	-16(%rsp), %rax                 # 8-byte Folded Reload
	movq	56(%rsp), %rcx
	leaq	(%rcx,%rax,4), %r12
	movq	-8(%rsp), %rcx                  # 8-byte Reload
	xorl	%ebp, %ebp
.LBB1_4:                                # %.preheader
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_9 Depth 3
	testl	%r8d, %r8d
	jle	.LBB1_5
# %bb.8:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_4 Depth=2
	xorl	%r10d, %r10d
	movq	%rcx, %r13
	xorl	%eax, %eax
.LBB1_9:                                # %.lr.ph
                                        #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%r13), %esi
	imull	(%rdi,%r10,4), %esi
	addl	%esi, %eax
	incq	%r10
	addq	%r14, %r13
	cmpq	%r10, %rbx
	jne	.LBB1_9
	jmp	.LBB1_10
.LBB1_5:                                #   in Loop: Header=BB1_4 Depth=2
	xorl	%eax, %eax
.LBB1_10:                               # %._crit_edge
                                        #   in Loop: Header=BB1_4 Depth=2
	movl	%eax, (%r12,%rbp,4)
	incq	%rbp
	addq	$4, %rcx
	cmpq	%r11, %rbp
	jne	.LBB1_4
.LBB1_6:                                # %._crit_edge30
                                        #   in Loop: Header=BB1_2 Depth=1
	incq	%r15
	addq	%rdx, %rdi
	cmpq	%r9, %r15
	jne	.LBB1_2
.LBB1_7:                                # %._crit_edge32
	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	_Z18multiplicaMatricesPiiiS_iiS_, .Lfunc_end1-_Z18multiplicaMatricesPiiiS_iiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z7imprimePiii                  # -- Begin function _Z7imprimePiii
	.type	_Z7imprimePiii,@function
_Z7imprimePiii:                         # @_Z7imprimePiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB2_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%edx, %ebx
	movl	%esi, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%edx, %r12d
	xorl	%r13d, %r13d
	xorl	%ebp, %ebp
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
	testl	%ebx, %ebx
	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), %r14
	xorl	%r15d, %r15d
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r14,%r15,4), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%r15
	cmpq	%r15, %r12
	jne	.LBB2_4
.LBB2_5:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%rbp
	addl	%ebx, %r13d
	cmpq	16(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB2_2
.LBB2_6:                                # %._crit_edge13
	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_end2:
	.size	_Z7imprimePiii, .Lfunc_end2-_Z7imprimePiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10inicializaPiii              # -- Begin function _Z10inicializaPiii
	.type	_Z10inicializaPiii,@function
_Z10inicializaPiii:                     # @_Z10inicializaPiii
	.cfi_startproc
# %bb.0:
	imull	%edx, %esi
	testl	%esi, %esi
	jle	.LBB3_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	xorl	%ecx, %ecx
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$1, (%rdi,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z10inicializaPiii, .Lfunc_end3-_Z10inicializaPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z7comparaPiS_ii                # -- Begin function _Z7comparaPiS_ii
	.type	_Z7comparaPiS_ii,@function
_Z7comparaPiS_ii:                       # @_Z7comparaPiS_ii
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB4_1
# %bb.3:                                # %.preheader.lr.ph
	pushq	%rbp
	.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 %rbp, -16
	movl	%edx, %edx
	movl	%ecx, %r8d
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
	xorl	%eax, %eax
.LBB4_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_7 Depth 2
	testl	%ecx, %ecx
	jle	.LBB4_8
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB4_4 Depth=1
	movl	%r9d, %ebx
	leaq	(%rsi,%rbx,4), %r11
	leaq	(%rdi,%rbx,4), %rbx
	xorl	%r14d, %r14d
.LBB4_7:                                #   Parent Loop BB4_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rbx,%r14,4), %ebp
	cmpl	(%r11,%r14,4), %ebp
	jne	.LBB4_9
# %bb.6:                                #   in Loop: Header=BB4_7 Depth=2
	incq	%r14
	cmpq	%r14, %r8
	jne	.LBB4_7
.LBB4_8:                                # %._crit_edge
                                        #   in Loop: Header=BB4_4 Depth=1
	incq	%r10
	cmpq	%rdx, %r10
	setae	%al
	addl	%ecx, %r9d
	cmpq	%rdx, %r10
	jne	.LBB4_4
.LBB4_9:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %rbp
	jmp	.LBB4_2
.LBB4_1:
	movb	$1, %al
.LBB4_2:                                # %.thread
	andb	$1, %al
                                        # kill: def $al killed $al killed $rax
	retq
.Lfunc_end4:
	.size	_Z7comparaPiS_ii, .Lfunc_end4-_Z7comparaPiS_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI5_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.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	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %rbx
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r14
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r15
	xorl	%eax, %eax
.LBB5_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movl	$1, (%rbx,%rax,4)
	incq	%rax
	cmpq	$1048576, %rax                  # imm = 0x100000
	jne	.LBB5_1
# %bb.2:                                # %.lr.ph.i72.preheader
	xorl	%eax, %eax
.LBB5_3:                                # %.lr.ph.i72
                                        # =>This Inner Loop Header: Depth=1
	movl	$1, (%r14,%rax,4)
	incq	%rax
	cmpq	$1048576, %rax                  # imm = 0x100000
	jne	.LBB5_3
# %bb.4:                                # %_Z10inicializaPiii.exit76
	xorl	%r13d, %r13d
	callq	clock
	movq	%rax, %r12
	movq	%rbx, %rax
.LBB5_5:                                # %.preheader26.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_6 Depth 2
                                        #       Child Loop BB5_7 Depth 3
	movq	%r13, %rcx
	shlq	$12, %rcx
	addq	%r15, %rcx
	movq	%r14, %rdx
	xorl	%esi, %esi
.LBB5_6:                                # %.preheader.i
                                        #   Parent Loop BB5_5 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB5_7 Depth 3
	xorl	%edi, %edi
	movq	%rdx, %r8
	xorl	%r9d, %r9d
.LBB5_7:                                # %.lr.ph.i77
                                        #   Parent Loop BB5_5 Depth=1
                                        #     Parent Loop BB5_6 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%r8), %r10d
	imull	(%rax,%rdi,4), %r10d
	addl	%r10d, %r9d
	incq	%rdi
	addq	$4096, %r8                      # imm = 0x1000
	cmpq	$1024, %rdi                     # imm = 0x400
	jne	.LBB5_7
# %bb.8:                                # %._crit_edge.i
                                        #   in Loop: Header=BB5_6 Depth=2
	movl	%r9d, (%rcx,%rsi,4)
	incq	%rsi
	addq	$4, %rdx
	cmpq	$1024, %rsi                     # imm = 0x400
	jne	.LBB5_6
# %bb.9:                                # %._crit_edge30.i
                                        #   in Loop: Header=BB5_5 Depth=1
	incq	%r13
	addq	$4096, %rax                     # imm = 0x1000
	cmpq	$1024, %r13                     # imm = 0x400
	jne	.LBB5_5
# %bb.10:                               # %_Z18multiplicaMatricesPiiiS_iiS_.exit
	callq	clock
	subq	%r12, %rax
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI5_0(%rip), %xmm0
	movsd	%xmm0, 48(%rsp)                 # 8-byte Spill
	movl	$_ZSt4cout, %ebp
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$38, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	48(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, %r12
	callq	clock
	movq	%rax, %r13
	leaq	32(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB5_11
# %bb.12:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$33, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	leaq	24(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$33, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	leaq	16(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$33, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	jmp	.LBB5_13
.LBB5_11:                               # %.thread
	leaq	24(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
.LBB5_13:
	movq	32(%rsp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$137438953504, %rdi             # imm = 0x2000000020
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_15
# %bb.14:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rcx
	movq	16(%rsp), %rax
	movq	%rax, (%rsp)
	movl	$1024, %esi                     # imm = 0x400
	movl	$1024, %edx                     # imm = 0x400
	movl	$1024, %r8d                     # imm = 0x400
	movl	$1024, %r9d                     # imm = 0x400
	callq	_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_
.LBB5_15:
	callq	hipDeviceSynchronize
	movq	16(%rsp), %rsi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	callq	clock
	subq	%r13, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI5_0(%rip), %xmm0
	movsd	%xmm0, 40(%rsp)                 # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$38, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	40(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	48(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	40(%rsp), %xmm0                 # 8-byte Folded Reload
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	movl	$1024, %ecx                     # imm = 0x400
	xorl	%esi, %esi
	xorl	%edx, %edx
.LBB5_16:                               # %.preheader.i81
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_18 Depth 2
	movl	%eax, %edi
	shrl	$10, %edi
	shlq	$12, %rdi
	leaq	(%r15,%rdi), %r8
	addq	%r12, %rdi
	xorl	%r9d, %r9d
.LBB5_18:                               #   Parent Loop BB5_16 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rdi,%r9,4), %r10d
	cmpl	(%r8,%r9,4), %r10d
	jne	.LBB5_20
# %bb.17:                               #   in Loop: Header=BB5_18 Depth=2
	incq	%r9
	cmpq	$1024, %r9                      # imm = 0x400
	jne	.LBB5_18
# %bb.19:                               # %._crit_edge.i86
                                        #   in Loop: Header=BB5_16 Depth=1
	cmpq	$1023, %rsi                     # imm = 0x3FF
	leaq	1(%rsi), %rdi
	setae	%dl
	addq	%rcx, %rax
	movq	%rdi, %rsi
	cmpq	%rcx, %rdi
	jne	.LBB5_16
.LBB5_20:                               # %_Z7comparaPiS_ii.exit
	movl	$_ZSt4cout, %edi
	testb	$1, %dl
	je	.LBB5_22
# %bb.21:
	movl	$.L.str.8, %esi
	movl	$13, %edx
	jmp	.LBB5_23
.LBB5_22:
	movl	$.L.str.9, %esi
	movl	$12, %edx
.LBB5_23:
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$56, %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	main, .Lfunc_end5-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.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	$_Z20MultiplicaMatricesCUPiiiS_iiS_, %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	_Z20MultiplicaMatricesCUPiiiS_iiS_,@object # @_Z20MultiplicaMatricesCUPiiiS_iiS_
	.section	.rodata,"a",@progbits
	.globl	_Z20MultiplicaMatricesCUPiiiS_iiS_
	.p2align	3, 0x0
_Z20MultiplicaMatricesCUPiiiS_iiS_:
	.quad	_Z35__device_stub__MultiplicaMatricesCUPiiiS_iiS_
	.size	_Z20MultiplicaMatricesCUPiiiS_iiS_, 8

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"El tiempo transcurrido en la CPU fue: "
	.size	.L.str.2, 39

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Error reservando memoria para d_A"
	.size	.L.str.3, 34

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Error reservando memoria para d_B"
	.size	.L.str.4, 34

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Error reservando memoria para d_C"
	.size	.L.str.5, 34

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"El tiempo transcurrido en la GPU fue: "
	.size	.L.str.6, 39

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"El tiempo de aceleramiento fue: "
	.size	.L.str.7, 33

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Buen c\303\241lculo"
	.size	.L.str.8, 14

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Mal c\303\241lculo"
	.size	.L.str.9, 13

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z20MultiplicaMatricesCUPiiiS_iiS_"
	.size	.L__unnamed_1, 35

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z20MultiplicaMatricesCUPiiiS_iiS_ ; -- Begin function _Z20MultiplicaMatricesCUPiiiS_iiS_
	.globl	_Z20MultiplicaMatricesCUPiiiS_iiS_
	.p2align	8
	.type	_Z20MultiplicaMatricesCUPiiiS_iiS_,@function
_Z20MultiplicaMatricesCUPiiiS_iiS_:     ; @_Z20MultiplicaMatricesCUPiiiS_iiS_
; %bb.0:
	s_clause 0x2
	s_load_b64 s[2:3], s[0:1], 0x28
	s_load_b64 s[6:7], s[0:1], 0x8
	s_load_b64 s[4:5], s[0:1], 0x18
	v_bfe_u32 v3, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_lshl_add_u32 v1, s15, 5, v3
	v_lshl_add_u32 v0, s14, 5, v4
	s_waitcnt lgkmcnt(0)
	s_min_i32 s12, s2, s3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s6, v1
	v_cmp_gt_i32_e64 s2, s5, v0
	s_cmp_lt_i32 s12, 1
	s_cbranch_scc1 .LBB0_9
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b64 s[8:9], s[0:1], 0x0
	s_load_b64 s[10:11], s[0:1], 0x10
	v_lshlrev_b32_e32 v2, 2, v4
	v_lshlrev_b32_e32 v5, 7, v3
	v_mul_lo_u32 v7, v1, s7
	s_mov_b32 s13, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_or_b32_e32 v6, 0x1000, v2
	v_add_nc_u32_e32 v8, v5, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v9, v6, v5
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	s_lshl_b32 s14, s13, 5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mov_b32 v10, 0 :: v_dual_add_nc_u32 v11, s14, v4
	v_cmp_gt_i32_e64 s3, s7, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s3, s3, vcc_lo
	s_and_saveexec_b32 s15, s3
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	v_add_nc_u32_e32 v10, v11, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v11, 31, v10
	v_lshlrev_b64 v[10:11], 2, v[10:11]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s3, s8, v10
	v_add_co_ci_u32_e64 v11, s3, s9, v11, s3
	global_load_b32 v10, v[10:11], off
	s_waitcnt vmcnt(0)
	v_cvt_f32_i32_e32 v10, v10
.LBB0_4:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s15
	v_dual_mov_b32 v12, 0 :: v_dual_add_nc_u32 v11, s14, v3
	ds_store_b32 v8, v10
	v_cmp_gt_i32_e64 s3, s4, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s3, s3, s2
	s_and_saveexec_b32 s14, s3
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	v_mad_u64_u32 v[12:13], null, v11, s5, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v13, 31, v12
	v_lshlrev_b64 v[10:11], 2, v[12:13]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v10, s3, s10, v10
	v_add_co_ci_u32_e64 v11, s3, s11, v11, s3
	global_load_b32 v10, v[10:11], off
	s_waitcnt vmcnt(0)
	v_cvt_f32_i32_e32 v12, v10
.LBB0_6:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s14
	v_mov_b32_e32 v10, v6
	s_mov_b32 s3, 0
	ds_store_b32 v9, v12
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_7:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v11, s3, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_cvt_f32_i32_e32 v2, v2
	s_add_i32 s3, s3, 4
	ds_load_b32 v12, v10
	ds_load_b32 v11, v11
	v_add_nc_u32_e32 v10, 0x80, v10
	s_cmpk_eq_i32 s3, 0x80
	s_waitcnt lgkmcnt(0)
	v_fmac_f32_e32 v2, v11, v12
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f32_e32 v2, v2
	s_cbranch_scc0 .LBB0_7
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s13, s13, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s13, s12
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_2
.LBB0_9:                                ; %._crit_edge
	v_cmp_gt_i32_e32 vcc_lo, s6, v1
	v_cmp_gt_i32_e64 s2, s5, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_11
; %bb.10:
	s_load_b64 s[0:1], s[0:1], 0x20
	v_mad_u64_u32 v[3:4], null, v1, s5, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB0_11:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20MultiplicaMatricesCUPiiiS_iiS_
		.amdhsa_group_segment_fixed_size 8192
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 14
		.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	_Z20MultiplicaMatricesCUPiiiS_iiS_, .Lfunc_end0-_Z20MultiplicaMatricesCUPiiiS_iiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 604
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8192 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 8192
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20MultiplicaMatricesCUPiiiS_iiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z20MultiplicaMatricesCUPiiiS_iiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
