/* 
By : Johan S. Suarez L. or @jadry92 in twitter
This kernel make inverse of the matrix A in the matrix B 


*/

// Macro for mastrix index
#define Ind(a,i,j) (a)[(j)+(i)*N]

#include <stdio.h>              //manipulacion de ficheros, lectura-escritura ficheros, scandf-printf
#include <stdlib.h>             //Conversion de tipos de datos, memoria dinamica, abs
#include <string.h>             //Uso de memcpy principalmente
#include <math.h>				//funciones matemáticas
#include <time.h>	

/* Funtion check malloc of variables */
void checkMalloc(void * var,const char *name){
	if( var == NULL){
      	printf("It's not possible to allocate  %s. \n",name);}
    else {
     	printf(" Memory has already been allocated %s.\n",name);}
}


int main(int argc, char **argv){
	/* Initiation of variables*/
	int i,j; // i == rows and j == colms
	int N =3;
	float* A;
    float* B;



    /* Reservation of memory */

    A = (float*)malloc(N*sizeof(float));
    	checkMalloc(A,"A");
	B = (float*)malloc(N*sizeof(float));
		checkMalloc(B,"B");

	/* Initialitation Matix A*/

    /* Initialitation Matix A*/

    printf("A =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            Ind(A,i,j) = rand()/(RAND_MAX/10.0);
            printf(" %f ",Ind(A,i,j));
        }
    printf("\n");   
    }

    /* Gaussian Elimination*/
    // The B has to be identity matrix
    memset(B,0.0,N*sizeof(float));
    for(i = 0; i < N; i++){
        Ind(B,i,i) = 1.0;   
    }
    printf("B =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(B,i,j));
        }
    printf("\n");   
    }

    int y;
    float key;
    for(i = 0; i < N; i++){ // for to rows
        for(j = 0; j <N  ; j++){
            y=0;
            if(i==j){

            }else{
            while(y<N){
                if(i+1<N ){
                    Ind(A,i,j+y) = Ind(A,i,j+y) - Ind(A,i+1,j+y)*(Ind(A,i,j)/Ind(A,i+1,j));
                    Ind(B,i,j+y) = Ind(B,i,j+y) - Ind(B,i+1,j+y)*(Ind(A,i,j)/Ind(A,i+1,j));
                }else{
                    Ind(A,i,j+y) = Ind(A,i,j+y) - Ind(A,i-N-1+y,j+y)*(Ind(A,i,j)/Ind(A,i-N-1,j));
                    Ind(B,i,j+y) = Ind(B,i,j+y) - Ind(B,i-N-1+y,j+y)*(Ind(A,i,j)/Ind(A,i-N-1,j));
                }   
                y++;
            }
            }   
                //Ind(A,i,j) = 1;
                //Ind(B,i,j) = Ind(B,i,j)/Ind(A,i,j);
            //}
        }
    }               

    printf("A =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(A,i,j));
        }
    printf("\n");   
    }

    printf("B =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(B,i,j));
        }
    printf("\n");   
    }
    /* Descompotition LU*/


    return 0;
}


	.file	"tmpxft_00225c3c_00000000-6_matrix_inverse.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"It's not possible to allocate  %s. \n"
.LC1:
	.string	" Memory has already been allocated %s.\n"
	.text
	.globl	_Z11checkMallocPvPKc
	.type	_Z11checkMallocPvPKc, @function
_Z11checkMallocPvPKc:
.LFB2027:
	.cfi_startproc
	endbr64
	movq	%rsi, %rdx
	leaq	.LC0(%rip), %rsi
	testq	%rdi, %rdi
	je	.L4
	leaq	.LC1(%rip), %rsi
.L4:
	movl	$2, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z11checkMallocPvPKc, .-_Z11checkMallocPvPKc
	.section	.rodata.str1.1
.LC2:
	.string	"A"
.LC3:
	.string	"B"
.LC4:
	.string	"A =\n"
.LC6:
	.string	" %f "
.LC7:
	.string	"\n"
.LC9:
	.string	"B =\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$12, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	pushq	%rsi
	.cfi_def_cfa_offset 64
	call	malloc@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	_Z11checkMallocPvPKc
	movl	$12, %edi
	call	malloc@PLT
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, %rbp
	call	_Z11checkMallocPvPKc
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L7:
	imulq	$12, %r13, %r14
	xorl	%r12d, %r12d
	addq	%rbx, %r14
.L8:
	call	rand@PLT
	leaq	.LC6(%rip), %r15
	movl	$2, %edi
	cvtsi2sdl	%eax, %xmm0
	movq	%r15, %rsi
	movb	$1, %al
	divsd	.LC5(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r14,%r12,4)
	incq	%r12
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	cmpq	$3, %r12
	jne	.L8
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r13
	call	__printf_chk@PLT
	cmpq	$3, %r13
	jne	.L7
	xorl	%ecx, %ecx
	movss	.LC8(%rip), %xmm0
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%rcx, 4(%rbp)
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	movss	%xmm0, 0(%rbp)
	movss	%xmm0, 16(%rbp)
	movss	%xmm0, 32(%rbp)
	call	__printf_chk@PLT
.L10:
	imulq	$12, %r12, %r13
	xorl	%r14d, %r14d
	addq	%rbp, %r13
.L11:
	cvtss2sd	0(%r13,%r14,4), %xmm0
	movq	%r15, %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	incq	%r14
	cmpq	$3, %r14
	jne	.L11
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r12
	call	__printf_chk@PLT
	cmpq	$3, %r12
	jne	.L10
	xorl	%r9d, %r9d
	xorl	%esi, %esi
.L12:
	movl	%r9d, %ecx
	xorl	%eax, %eax
	addl	$3, %r9d
.L14:
	cmpl	%eax, %esi
	jne	.L13
.L19:
	incq	%rax
	incl	%ecx
	cmpq	$3, %rax
	jne	.L14
	jmp	.L37
.L13:
	movslq	%ecx, %rdx
	leal	6(%rax), %r11d
	leal	-6(%rax), %edi
	movl	%ecx, %r8d
	leaq	(%rbx,%rdx,4), %r12
	leal	3(%rcx), %edx
	movl	%r11d, %r10d
	movslq	%edx, %rdx
	leaq	(%rbx,%rdx,4), %r13
.L18:
	cmpl	$2, %esi
	je	.L16
	leal	3(%r8), %r14d
	movss	(%r12), %xmm0
	movslq	%r8d, %rdx
	divss	0(%r13), %xmm0
	movslq	%r14d, %r14
	salq	$2, %rdx
	mulss	(%rbx,%r14,4), %xmm0
	leaq	(%rbx,%rdx), %r15
	addq	%rbp, %rdx
	movss	(%r15), %xmm1
	subss	%xmm0, %xmm1
	movss	%xmm1, (%r15)
	movss	(%r12), %xmm0
	divss	0(%r13), %xmm0
	jmp	.L36
.L16:
	movslq	%edi, %r14
	movss	24(%rbx,%rax,4), %xmm0
	movslq	%r10d, %rdx
	divss	-24(%rbx,%rax,4), %xmm0
	mulss	(%rbx,%r14,4), %xmm0
	salq	$2, %rdx
	leaq	(%rbx,%rdx), %r15
	addq	%rbp, %rdx
	movss	(%r15), %xmm1
	subss	%xmm0, %xmm1
	movss	%xmm1, (%r15)
	movss	24(%rbx,%rax,4), %xmm0
	divss	-24(%rbx,%rax,4), %xmm0
.L36:
	mulss	0(%rbp,%r14,4), %xmm0
	addl	$4, %edi
	incl	%r8d
	incl	%r10d
	movss	(%rdx), %xmm1
	subss	%xmm0, %xmm1
	movss	%xmm1, (%rdx)
	cmpl	%edi, %r11d
	jne	.L18
	jmp	.L19
.L37:
	incl	%esi
	cmpl	$3, %esi
	jne	.L12
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
	leaq	.LC6(%rip), %r13
.L21:
	imulq	$12, %r15, %r14
	xorl	%r12d, %r12d
	addq	%rbx, %r14
.L22:
	cvtss2sd	(%r14,%r12,4), %xmm0
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	incq	%r12
	cmpq	$3, %r12
	jne	.L22
	leaq	.LC7(%rip), %r14
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r15
	movq	%r14, %rsi
	call	__printf_chk@PLT
	cmpq	$3, %r15
	jne	.L21
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__printf_chk@PLT
.L24:
	imulq	$12, %r12, %r15
	xorl	%ebx, %ebx
	addq	%rbp, %r15
.L25:
	cvtss2sd	(%r15,%rbx,4), %xmm0
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	incq	%rbx
	cmpq	$3, %rbx
	jne	.L25
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r12
	call	__printf_chk@PLT
	cmpq	$3, %r12
	jne	.L24
	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
.LFE2028:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
	.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
.LFE2054:
	.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
.LC5:
	.long	-1721342362
	.long	1101633945
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC8:
	.long	1065353216
	.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:

/* 
By : Johan S. Suarez L. or @jadry92 in twitter
This kernel make inverse of the matrix A in the matrix B 


*/

// Macro for mastrix index
#define Ind(a,i,j) (a)[(j)+(i)*N]


#include <hip/hip_runtime.h>
#include <stdio.h>              //manipulacion de ficheros, lectura-escritura ficheros, scandf-printf
#include <stdlib.h>             //Conversion de tipos de datos, memoria dinamica, abs
#include <string.h>             //Uso de memcpy principalmente
#include <math.h>				//funciones matemáticas
#include <time.h>	

/* Funtion check malloc of variables */
void checkMalloc(void * var,const char *name){
	if( var == NULL){
      	printf("It's not possible to allocate  %s. \n",name);}
    else {
     	printf(" Memory has already been allocated %s.\n",name);}
}


int main(int argc, char **argv){
	/* Initiation of variables*/
	int i,j; // i == rows and j == colms
	int N =3;
	float* A;
    float* B;



    /* Reservation of memory */

    A = (float*)malloc(N*sizeof(float));
    	checkMalloc(A,"A");
	B = (float*)malloc(N*sizeof(float));
		checkMalloc(B,"B");

	/* Initialitation Matix A*/

    /* Initialitation Matix A*/

    printf("A =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            Ind(A,i,j) = rand()/(RAND_MAX/10.0);
            printf(" %f ",Ind(A,i,j));
        }
    printf("\n");   
    }

    /* Gaussian Elimination*/
    // The B has to be identity matrix
    memset(B,0.0,N*sizeof(float));
    for(i = 0; i < N; i++){
        Ind(B,i,i) = 1.0;   
    }
    printf("B =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(B,i,j));
        }
    printf("\n");   
    }

    int y;
    float key;
    for(i = 0; i < N; i++){ // for to rows
        for(j = 0; j <N  ; j++){
            y=0;
            if(i==j){

            }else{
            while(y<N){
                if(i+1<N ){
                    Ind(A,i,j+y) = Ind(A,i,j+y) - Ind(A,i+1,j+y)*(Ind(A,i,j)/Ind(A,i+1,j));
                    Ind(B,i,j+y) = Ind(B,i,j+y) - Ind(B,i+1,j+y)*(Ind(A,i,j)/Ind(A,i+1,j));
                }else{
                    Ind(A,i,j+y) = Ind(A,i,j+y) - Ind(A,i-N-1+y,j+y)*(Ind(A,i,j)/Ind(A,i-N-1,j));
                    Ind(B,i,j+y) = Ind(B,i,j+y) - Ind(B,i-N-1+y,j+y)*(Ind(A,i,j)/Ind(A,i-N-1,j));
                }   
                y++;
            }
            }   
                //Ind(A,i,j) = 1;
                //Ind(B,i,j) = Ind(B,i,j)/Ind(A,i,j);
            //}
        }
    }               

    printf("A =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(A,i,j));
        }
    printf("\n");   
    }

    printf("B =\n");
    for(i = 0; i < N; i++){
        for(j = 0; j < N ; j++){
            printf(" %f ",Ind(B,i,j));
        }
    printf("\n");   
    }
    /* Descompotition LU*/


    return 0;
}


	.text
	.file	"matrix_inverse.hip"
	.globl	_Z11checkMallocPvPKc            # -- Begin function _Z11checkMallocPvPKc
	.type	_Z11checkMallocPvPKc,@function
_Z11checkMallocPvPKc:                   # @_Z11checkMallocPvPKc
	.cfi_startproc
# %bb.0:
	testq	%rdi, %rdi
	movl	$.L.str, %eax
	movl	$.L.str.1, %edi
	cmoveq	%rax, %rdi
	xorl	%eax, %eax
	jmp	printf                          # TAILCALL
.Lfunc_end0:
	.size	_Z11checkMallocPvPKc, .Lfunc_end0-_Z11checkMallocPvPKc
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI1_0:
	.quad	0x41a9999999666666              # double 214748364.69999999
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$12, %edi
	callq	malloc
	movq	%rax, %r14
	testq	%rax, %rax
	movl	$.L.str, %r13d
	movl	$.L.str.1, %r15d
	movl	$.L.str.1, %edi
	cmoveq	%r13, %rdi
	xorl	%r12d, %r12d
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$12, %edi
	callq	malloc
	movq	%rax, %rbx
	testq	%rax, %rax
	cmoveq	%r13, %r15
	movl	$.L.str.3, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	%r14, %r15
.LBB1_1:                                # %.preheader186
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
	xorl	%r13d, %r13d
.LBB1_2:                                #   Parent Loop BB1_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI1_0(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r15,%r13,4)
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$3, %r13
	jne	.LBB1_2
# %bb.3:                                #   in Loop: Header=BB1_1 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r12
	addq	$12, %r15
	cmpq	$3, %r12
	jne	.LBB1_1
# %bb.4:
	movq	$0, 4(%rbx)
	movl	$1065353216, %eax               # imm = 0x3F800000
	movl	%eax, (%rbx)
	movl	%eax, 16(%rbx)
	movl	%eax, 32(%rbx)
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	xorl	%r15d, %r15d
	movq	%rbx, %r12
.LBB1_5:                                # %.preheader185
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_6 Depth 2
	xorl	%r13d, %r13d
.LBB1_6:                                #   Parent Loop BB1_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12,%r13,4), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$3, %r13
	jne	.LBB1_6
# %bb.7:                                #   in Loop: Header=BB1_5 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r15
	addq	$12, %r12
	cmpq	$3, %r15
	jne	.LBB1_5
# %bb.8:                                # %.preheader183.preheader
	movl	$3, %eax
	xorl	%ecx, %ecx
.LBB1_9:                                # %.preheader183
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_10 Depth 2
                                        #       Child Loop BB1_12 Depth 3
	leaq	(%rcx,%rcx,2), %rsi
	leaq	(%rcx,%rcx,2), %rdx
	addq	$3, %rdx
	leaq	(%r14,%rsi,4), %rsi
	movq	%rax, %rdi
	xorl	%r8d, %r8d
.LBB1_10:                               #   Parent Loop BB1_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_12 Depth 3
	cmpq	%r8, %rcx
	je	.LBB1_15
# %bb.11:                               # %.preheader182
                                        #   in Loop: Header=BB1_10 Depth=2
	leaq	(%r14,%r8,4), %r9
	movq	$-9, %r10
	movq	%rdi, %r11
	xorl	%r15d, %r15d
.LBB1_12:                               #   Parent Loop BB1_9 Depth=1
                                        #     Parent Loop BB1_10 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r11, %r12
	movq	%rdx, %r13
	cmpq	$2, %rcx
	jne	.LBB1_14
# %bb.13:                               #   in Loop: Header=BB1_12 Depth=3
	leaq	(%r15,%r8), %r12
	addq	%r10, %r12
	addq	$3, %r12
	movq	$-6, %r13
.LBB1_14:                               #   in Loop: Header=BB1_12 Depth=3
	movss	(%rsi,%r8,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	divss	(%r9,%r13,4), %xmm0
	movss	-12(%r14,%r11,4), %xmm1         # xmm1 = mem[0],zero,zero,zero
	mulss	(%r14,%r12,4), %xmm0
	subss	%xmm0, %xmm1
	movss	%xmm1, -12(%r14,%r11,4)
	movss	(%rsi,%r8,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	divss	(%r9,%r13,4), %xmm0
	movss	-12(%rbx,%r11,4), %xmm1         # xmm1 = mem[0],zero,zero,zero
	mulss	(%rbx,%r12,4), %xmm0
	subss	%xmm0, %xmm1
	movss	%xmm1, -12(%rbx,%r11,4)
	incq	%r15
	incq	%r11
	addq	$3, %r10
	jne	.LBB1_12
.LBB1_15:                               # %.loopexit
                                        #   in Loop: Header=BB1_10 Depth=2
	incq	%r8
	incq	%rdi
	cmpq	$3, %r8
	jne	.LBB1_10
# %bb.16:                               #   in Loop: Header=BB1_9 Depth=1
	incq	%rcx
	addq	$3, %rax
	cmpq	$3, %rcx
	jne	.LBB1_9
# %bb.17:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	xorl	%r15d, %r15d
.LBB1_18:                               # %.preheader181
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_19 Depth 2
	xorl	%r12d, %r12d
.LBB1_19:                               #   Parent Loop BB1_18 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r12,4), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r12
	cmpq	$3, %r12
	jne	.LBB1_19
# %bb.20:                               #   in Loop: Header=BB1_18 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r15
	addq	$12, %r14
	cmpq	$3, %r15
	jne	.LBB1_18
# %bb.21:
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	xorl	%r14d, %r14d
.LBB1_22:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_23 Depth 2
	xorl	%r15d, %r15d
.LBB1_23:                               #   Parent Loop BB1_22 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	$3, %r15
	jne	.LBB1_23
# %bb.24:                               #   in Loop: Header=BB1_22 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r14
	addq	$12, %rbx
	cmpq	$3, %r14
	jne	.LBB1_22
# %bb.25:
	xorl	%eax, %eax
	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_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"It's not possible to allocate  %s. \n"
	.size	.L.str, 37

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" Memory has already been allocated %s.\n"
	.size	.L.str.1, 40

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	" %f "
	.size	.L.str.5, 5

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

	.type	.Lstr.2,@object                 # @str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.2:
	.asciz	"A ="
	.size	.Lstr.2, 4

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"B ="
	.size	.Lstr.3, 4

	.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
