//
//  main.cpp
//  matrix-test
//
//  Created by Nikita Makarov on 22/03/16.
//  Copyright © 2016 Nikita Makarov. All rights reserved.
//

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iomanip>

using namespace std;

const double eps = 10e-7;

void print_matrix(double **M, long n, long m)
{
    cout.setf(ios::scientific);
    cout.precision(10);
    for (long i = 0; i < n; i++) {
        cout << M[i][0];
        for (long j = 1; j < m; j++) {
            cout << " " << M[i][j];
        }
        cout << endl;
    }
}

void swap_rows(long *prm, long i, long j)
{
    long temp = prm[i];
    prm[i] = prm[j];
    prm[j] = temp;
}

bool zero_column(double **A, long *prm, long n, long i, long j)
{
    for ( ; i < n; i++) {
        if (fabs(A[prm[i]][j]) > eps) {
            return false;
        }
    }
    return true;
}

void solve_equation(double **A, double **X, double **B, long n, long m, long k)
{
    long *prm = (long *)malloc(n * sizeof(long));
    for (long i = 0; i < n; i++) {
        prm[i] = i;
    }

    long *x_index = (long *)malloc(n * sizeof(long));
    for (long i = 0; i < n; i++) {
        x_index[i] = i;
    }

    long row = 0;
    long col = 0;

    for ( ; row < n && col < m; row++, col++) {

        long max_value_row = row;
        for (long i = row + 1; i < n; i++) {
            if (fabs(A[prm[i]][col]) > fabs(A[prm[max_value_row]][col])) {
                max_value_row = i;
            }
        }

        swap_rows(prm, row, max_value_row);

        if (fabs(A[prm[row]][col]) > eps) {

            x_index[row] = col;

            for (long i = row + 1; i < n; i++) {

                double factor = -A[prm[i]][col] / A[prm[row]][col];
                for (long j = col; j < m; j++) {
                    A[prm[i]][j] += A[prm[row]][j] * factor;
                }
                for (long j = 0; j < k; j++) {
                    B[prm[i]][j] += B[prm[row]][j] * factor;
                }
            }
        } else {
            row--;
        }

    }

    if (row == n || col == m) { // ??
        row--;
    }

    for (long t = 0; t < k; t++) {
        for (long i = row; i >= 0; i--) {
            long index = x_index[i];
            double sum = 0.0;
            for (long j = index + 1; j < m; j++) {
                sum += A[prm[i]][j] * X[j][t];
            }
            if (fabs(A[prm[i]][index]) > eps) {
                X[index][t] = (B[prm[i]][t] - sum) / A[prm[i]][index];
            } else {
                X[index][t] = 0.0;
            }
        }
    }
}

int main()
{
    long n, m, k;
    cin >> n >> m >> k;

    double **A = (double **)malloc(n * sizeof(double *));
    for (long i = 0; i < n; i++) {
        A[i] = (double *)malloc(m * sizeof(double));
    }

    for (long i = 0; i < n; i++) {
        for (long j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }

    double **B = (double **)malloc(n * sizeof(double *));
    for (long i = 0; i < n; i++) {
        B[i] = (double *)malloc(k * sizeof(double));
    }

    for (long i = 0; i < n; i++) {
        for (long j = 0; j < k; j++) {
            cin >> B[i][j];
        }
    }

    double **X = (double **)malloc(m * sizeof(double *));
    for (long i = 0; i < m; i++) {
        X[i] = (double *)malloc(k * sizeof(double));
    }

    for (long i = 0; i < m; i++) {
        for (long j = 0; j < k; j++) {
            X[i][j] = 0.0;
        }
    }

    solve_equation(A, X, B, n, m, k);
    print_matrix(X, m, k);

    return 0;
}

	.file	"tmpxft_00396d71_00000000-6_test_cpu.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4012:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4012:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_Z12print_matrixPPdll
	.type	_Z12print_matrixPPdll, @function
_Z12print_matrixPPdll:
.LFB4005:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 64
	orl	$256, 32+_ZSt4cout(%rip)
	movq	$10, 16+_ZSt4cout(%rip)
.L3:
	cmpq	%r13, %rbx
	jge	.L9
	movq	0(%rbp,%rbx,8), %rax
	leaq	_ZSt4cout(%rip), %rdi
	movl	$1, %r12d
	leaq	.LC0(%rip), %r15
	movsd	(%rax), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
.L4:
	cmpq	%r14, %r12
	jge	.L10
	movq	%r15, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	0(%rbp,%rbx,8), %rax
	movsd	(%rax,%r12,8), %xmm0
	incq	%r12
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	jmp	.L4
.L10:
	leaq	_ZSt4cout(%rip), %rdi
	incq	%rbx
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L3
.L9:
	popq	%rax
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4005:
	.size	_Z12print_matrixPPdll, .-_Z12print_matrixPPdll
	.globl	_Z9swap_rowsPlll
	.type	_Z9swap_rowsPlll, @function
_Z9swap_rowsPlll:
.LFB4006:
	.cfi_startproc
	endbr64
	movq	%rdx, %rax
	leaq	(%rdi,%rsi,8), %rdx
	leaq	(%rdi,%rax,8), %rax
	movq	(%rdx), %rcx
	movq	(%rax), %rsi
	movq	%rsi, (%rdx)
	movq	%rcx, (%rax)
	ret
	.cfi_endproc
.LFE4006:
	.size	_Z9swap_rowsPlll, .-_Z9swap_rowsPlll
	.globl	_Z11zero_columnPPdPllll
	.type	_Z11zero_columnPPdPllll, @function
_Z11zero_columnPPdPllll:
.LFB4007:
	.cfi_startproc
	endbr64
	movq	.LC1(%rip), %xmm1
	movsd	.LC2(%rip), %xmm2
	movq	%rdi, %rax
	salq	$3, %r8
.L13:
	cmpq	%rdx, %rcx
	jge	.L17
	movq	(%rsi,%rcx,8), %rdi
	movq	(%rax,%rdi,8), %rdi
	movsd	(%rdi,%r8), %xmm0
	andps	%xmm1, %xmm0
	comisd	%xmm2, %xmm0
	ja	.L16
	incq	%rcx
	jmp	.L13
.L17:
	movb	$1, %al
	ret
.L16:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE4007:
	.size	_Z11zero_columnPPdPllll, .-_Z11zero_columnPPdPllll
	.globl	_Z14solve_equationPPdS0_S0_lll
	.type	_Z14solve_equationPPdS0_S0_lll, @function
_Z14solve_equationPPdS0_S0_lll:
.LFB4008:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r8, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	leaq	0(,%rcx,8), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rcx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rdi, (%rsp)
	movq	%r9, 8(%rsp)
	call	malloc@PLT
	movq	(%rsp), %rdi
	movq	%rax, %rbx
	xorl	%eax, %eax
.L19:
	cmpq	%rbp, %rax
	jge	.L63
	movq	%rax, (%rbx,%rax,8)
	incq	%rax
	jmp	.L19
.L63:
	call	malloc@PLT
	movq	%rax, %r10
	xorl	%eax, %eax
.L21:
	cmpq	%rbp, %rax
	jge	.L64
	movq	%rax, (%r10,%rax,8)
	incq	%rax
	jmp	.L21
.L64:
	movq	.LC1(%rip), %xmm1
	movsd	.LC2(%rip), %xmm3
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	movq	.LC4(%rip), %xmm4
.L23:
	cmpq	%rbp, %r9
	jge	.L50
	cmpq	%r13, %r8
	jge	.L50
	leaq	1(%r9), %r11
	leaq	0(,%r8,8), %rcx
	movq	%r9, %rdx
	movq	%r11, %rax
.L24:
	cmpq	%rbp, %rax
	jge	.L65
	movq	(%rbx,%rax,8), %rsi
	movq	(%r12,%rsi,8), %rsi
	movsd	(%rsi,%rcx), %xmm2
	movq	(%rbx,%rdx,8), %rsi
	movq	(%r12,%rsi,8), %rsi
	andps	%xmm1, %xmm2
	movsd	(%rsi,%rcx), %xmm0
	andps	%xmm1, %xmm0
	ucomisd	%xmm0, %xmm2
	cmova	%rax, %rdx
	incq	%rax
	jmp	.L24
.L65:
	movq	%r9, %rsi
	movq	%rbx, %rdi
	movq	%rcx, 24(%rsp)
	call	_Z9swap_rowsPlll
	movq	(%rbx,%r9,8), %rax
	leaq	0(,%rax,8), %rcx
	movq	(%r12,%rax,8), %rax
	movq	%rcx, 16(%rsp)
	movq	24(%rsp), %rcx
	movq	%rax, (%rsp)
	leaq	(%rax,%rcx), %rdx
	movsd	(%rdx), %xmm0
	andps	%xmm1, %xmm0
	comisd	%xmm3, %xmm0
	jbe	.L60
	movq	%r8, (%r10,%r9,8)
.L29:
	cmpq	%rbp, %r11
	jge	.L34
	movq	(%rbx,%r11,8), %rax
	leaq	0(,%rax,8), %rsi
	movq	%rsi, 24(%rsp)
	movq	(%r12,%rax,8), %rsi
	movq	%r8, %rax
	movsd	(%rsi,%rcx), %xmm0
	xorps	%xmm4, %xmm0
	divsd	(%rdx), %xmm0
.L30:
	movq	(%rsp), %rdi
	movsd	(%rdi,%rax,8), %xmm2
	mulsd	%xmm0, %xmm2
	addsd	(%rsi,%rax,8), %xmm2
	movsd	%xmm2, (%rsi,%rax,8)
	incq	%rax
	cmpq	%rax, %r13
	jg	.L30
	xorl	%eax, %eax
.L31:
	movq	8(%rsp), %rdi
	cmpq	%rdi, %rax
	jge	.L66
	movq	24(%rsp), %rdi
	movq	(%r15,%rdi), %rsi
	movq	16(%rsp), %rdi
	movq	(%r15,%rdi), %rdi
	leaq	(%rsi,%rax,8), %rsi
	movsd	(%rdi,%rax,8), %xmm2
	incq	%rax
	mulsd	%xmm0, %xmm2
	addsd	(%rsi), %xmm2
	movsd	%xmm2, (%rsi)
	jmp	.L31
.L66:
	incq	%r11
	jmp	.L29
.L60:
	decq	%r9
.L34:
	incq	%r9
	incq	%r8
	jmp	.L23
.L50:
	cmpq	%rbp, %r9
	je	.L51
	cmpq	%r13, %r8
	jne	.L37
.L51:
	decq	%r9
.L37:
	movq	.LC1(%rip), %xmm3
	movsd	.LC2(%rip), %xmm4
	xorl	%ecx, %ecx
.L39:
	movq	8(%rsp), %rax
	cmpq	%rax, %rcx
	jge	.L18
	leaq	0(,%rcx,8), %rsi
	movq	%r9, %rax
.L46:
	testq	%rax, %rax
	js	.L67
	movq	(%rbx,%rax,8), %r8
	movq	(%r10,%rax,8), %rdi
	xorps	%xmm1, %xmm1
	movq	(%r12,%r8,8), %r11
	leaq	1(%rdi), %rdx
.L40:
	cmpq	%r13, %rdx
	jge	.L68
	movq	(%r14,%rdx,8), %rbp
	movsd	(%r11,%rdx,8), %xmm0
	incq	%rdx
	mulsd	0(%rbp,%rsi), %xmm0
	addsd	%xmm0, %xmm1
	jmp	.L40
.L68:
	movsd	(%r11,%rdi,8), %xmm2
	movq	(%r14,%rdi,8), %rdx
	movaps	%xmm2, %xmm0
	addq	%rsi, %rdx
	andps	%xmm3, %xmm0
	comisd	%xmm4, %xmm0
	jbe	.L61
	movq	(%r15,%r8,8), %rdi
	movsd	(%rdi,%rsi), %xmm0
	subsd	%xmm1, %xmm0
	divsd	%xmm2, %xmm0
	jmp	.L42
.L61:
	xorps	%xmm0, %xmm0
.L42:
	movsd	%xmm0, (%rdx)
	decq	%rax
	jmp	.L46
.L67:
	incq	%rcx
	jmp	.L39
.L18:
	addq	$40, %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
.LFE4008:
	.size	_Z14solve_equationPPdS0_S0_lll, .-_Z14solve_equationPPdS0_S0_lll
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB4009:
	.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
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	_ZSt3cin(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	_ZNSi10_M_extractIlEERSiRT_@PLT
	leaq	24(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIlEERSiRT_@PLT
	leaq	32(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSi10_M_extractIlEERSiRT_@PLT
	movq	16(%rsp), %rbp
	leaq	0(,%rbp,8), %rdi
	call	malloc@PLT
	movq	%rax, %r13
.L70:
	cmpq	%rbx, %rbp
	jle	.L90
	movq	24(%rsp), %rax
	leaq	0(,%rax,8), %rdi
	call	malloc@PLT
	movq	%rax, 0(%r13,%rbx,8)
	incq	%rbx
	jmp	.L70
.L90:
	xorl	%ebx, %ebx
.L72:
	movq	16(%rsp), %rbp
	cmpq	%rbx, %rbp
	jle	.L91
	xorl	%ebp, %ebp
.L74:
	cmpq	%rbp, 24(%rsp)
	jle	.L92
	movq	0(%r13,%rbx,8), %rax
	movq	%r12, %rdi
	leaq	(%rax,%rbp,8), %rsi
	incq	%rbp
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	jmp	.L74
.L92:
	incq	%rbx
	jmp	.L72
.L91:
	leaq	0(,%rbp,8), %rdi
	xorl	%ebx, %ebx
	call	malloc@PLT
	movq	%rax, %r14
.L75:
	movq	32(%rsp), %rdi
	cmpq	%rbx, %rbp
	jle	.L93
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, (%r14,%rbx,8)
	incq	%rbx
	jmp	.L75
.L93:
	xorl	%ebx, %ebx
.L77:
	movq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	cmpq	%rbx, %rax
	jle	.L94
	xorl	%ebp, %ebp
.L79:
	cmpq	%rbp, 32(%rsp)
	jle	.L95
	movq	(%r14,%rbx,8), %rax
	movq	%r12, %rdi
	leaq	(%rax,%rbp,8), %rsi
	incq	%rbp
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	jmp	.L79
.L95:
	incq	%rbx
	jmp	.L77
.L94:
	movq	24(%rsp), %r12
	xorl	%r15d, %r15d
	leaq	0(,%r12,8), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
.L80:
	movq	32(%rsp), %rbp
	cmpq	%r15, %r12
	jle	.L96
	leaq	0(,%rbp,8), %rdi
	call	malloc@PLT
	movq	%rax, (%rbx,%r15,8)
	incq	%r15
	jmp	.L80
.L96:
	xorl	%eax, %eax
.L82:
	cmpq	%rax, %r12
	jle	.L97
	xorl	%edx, %edx
.L84:
	cmpq	%rbp, %rdx
	jge	.L98
	movq	(%rbx,%rax,8), %rcx
	movq	$0x000000000, (%rcx,%rdx,8)
	incq	%rdx
	jmp	.L84
.L98:
	incq	%rax
	jmp	.L82
.L97:
	movq	8(%rsp), %rcx
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	movq	%rbp, %r9
	movq	%r12, %r8
	call	_Z14solve_equationPPdS0_S0_lll
	movq	%rbp, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	_Z12print_matrixPPdll
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L85
	call	__stack_chk_fail@PLT
.L85:
	addq	$56, %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
.LFE4009:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4035:
	.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
.LFE4035:
	.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.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	-1598689907
	.long	1051772663
	.section	.rodata.cst16
	.align 16
.LC4:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.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:

//
//  main.cpp
//  matrix-test
//
//  Created by Nikita Makarov on 22/03/16.
//  Copyright © 2016 Nikita Makarov. All rights reserved.
//


#include <hip/hip_runtime.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iomanip>

using namespace std;

const double eps = 10e-7;

void print_matrix(double **M, long n, long m)
{
    cout.setf(ios::scientific);
    cout.precision(10);
    for (long i = 0; i < n; i++) {
        cout << M[i][0];
        for (long j = 1; j < m; j++) {
            cout << " " << M[i][j];
        }
        cout << endl;
    }
}

void swap_rows(long *prm, long i, long j)
{
    long temp = prm[i];
    prm[i] = prm[j];
    prm[j] = temp;
}

bool zero_column(double **A, long *prm, long n, long i, long j)
{
    for ( ; i < n; i++) {
        if (fabs(A[prm[i]][j]) > eps) {
            return false;
        }
    }
    return true;
}

void solve_equation(double **A, double **X, double **B, long n, long m, long k)
{
    long *prm = (long *)malloc(n * sizeof(long));
    for (long i = 0; i < n; i++) {
        prm[i] = i;
    }

    long *x_index = (long *)malloc(n * sizeof(long));
    for (long i = 0; i < n; i++) {
        x_index[i] = i;
    }

    long row = 0;
    long col = 0;

    for ( ; row < n && col < m; row++, col++) {

        long max_value_row = row;
        for (long i = row + 1; i < n; i++) {
            if (fabs(A[prm[i]][col]) > fabs(A[prm[max_value_row]][col])) {
                max_value_row = i;
            }
        }

        swap_rows(prm, row, max_value_row);

        if (fabs(A[prm[row]][col]) > eps) {

            x_index[row] = col;

            for (long i = row + 1; i < n; i++) {

                double factor = -A[prm[i]][col] / A[prm[row]][col];
                for (long j = col; j < m; j++) {
                    A[prm[i]][j] += A[prm[row]][j] * factor;
                }
                for (long j = 0; j < k; j++) {
                    B[prm[i]][j] += B[prm[row]][j] * factor;
                }
            }
        } else {
            row--;
        }

    }

    if (row == n || col == m) { // ??
        row--;
    }

    for (long t = 0; t < k; t++) {
        for (long i = row; i >= 0; i--) {
            long index = x_index[i];
            double sum = 0.0;
            for (long j = index + 1; j < m; j++) {
                sum += A[prm[i]][j] * X[j][t];
            }
            if (fabs(A[prm[i]][index]) > eps) {
                X[index][t] = (B[prm[i]][t] - sum) / A[prm[i]][index];
            } else {
                X[index][t] = 0.0;
            }
        }
    }
}

int main()
{
    long n, m, k;
    cin >> n >> m >> k;

    double **A = (double **)malloc(n * sizeof(double *));
    for (long i = 0; i < n; i++) {
        A[i] = (double *)malloc(m * sizeof(double));
    }

    for (long i = 0; i < n; i++) {
        for (long j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }

    double **B = (double **)malloc(n * sizeof(double *));
    for (long i = 0; i < n; i++) {
        B[i] = (double *)malloc(k * sizeof(double));
    }

    for (long i = 0; i < n; i++) {
        for (long j = 0; j < k; j++) {
            cin >> B[i][j];
        }
    }

    double **X = (double **)malloc(m * sizeof(double *));
    for (long i = 0; i < m; i++) {
        X[i] = (double *)malloc(k * sizeof(double));
    }

    for (long i = 0; i < m; i++) {
        for (long j = 0; j < k; j++) {
            X[i][j] = 0.0;
        }
    }

    solve_equation(A, X, B, n, m, k);
    print_matrix(X, m, k);

    return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z12print_matrixPPdll           # -- Begin function _Z12print_matrixPPdll
	.type	_Z12print_matrixPPdll,@function
_Z12print_matrixPPdll:                  # @_Z12print_matrixPPdll
	.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
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rcx
	orl	$256, _ZSt4cout+24(%rcx)        # imm = 0x100
	movq	-24(%rax), %rax
	movq	$10, _ZSt4cout+8(%rax)
	testq	%rsi, %rsi
	jle	.LBB0_6
# %bb.1:                                # %.lr.ph14
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	xorl	%r12d, %r12d
	movl	$_ZSt4cout, %r13d
.LBB0_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	movq	(%r15,%r12,8), %rax
	movsd	(%rax), %xmm0                   # xmm0 = mem[0],zero
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	cmpq	$2, %rbx
	jl	.LBB0_5
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	$1, %ebp
.LBB0_4:                                # %.lr.ph
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r15,%r12,8), %rax
	movsd	(%rax,%rbp,8), %xmm0            # xmm0 = mem[0],zero
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	incq	%rbp
	cmpq	%rbp, %rbx
	jne	.LBB0_4
.LBB0_5:                                # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%r12
	cmpq	%r14, %r12
	jne	.LBB0_2
.LBB0_6:                                # %._crit_edge15
	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_end0:
	.size	_Z12print_matrixPPdll, .Lfunc_end0-_Z12print_matrixPPdll
	.cfi_endproc
                                        # -- End function
	.globl	_Z9swap_rowsPlll                # -- Begin function _Z9swap_rowsPlll
	.type	_Z9swap_rowsPlll,@function
_Z9swap_rowsPlll:                       # @_Z9swap_rowsPlll
	.cfi_startproc
# %bb.0:
	movq	(%rdi,%rsi,8), %rax
	movq	(%rdi,%rdx,8), %rcx
	movq	%rcx, (%rdi,%rsi,8)
	movq	%rax, (%rdi,%rdx,8)
	retq
.Lfunc_end1:
	.size	_Z9swap_rowsPlll, .Lfunc_end1-_Z9swap_rowsPlll
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z11zero_columnPPdPllll
.LCPI2_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI2_1:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	_Z11zero_columnPPdPllll
	.type	_Z11zero_columnPPdPllll,@function
_Z11zero_columnPPdPllll:                # @_Z11zero_columnPPdPllll
	.cfi_startproc
# %bb.0:
	movb	$1, %al
	cmpq	%rdx, %rcx
	jge	.LBB2_7
# %bb.1:                                # %.lr.ph.preheader
	movq	(%rsi,%rcx,8), %rax
	movq	(%rdi,%rax,8), %rax
	movsd	(%rax,%r8,8), %xmm0             # xmm0 = mem[0],zero
	andpd	.LCPI2_0(%rip), %xmm0
	ucomisd	.LCPI2_1(%rip), %xmm0
	jbe	.LBB2_3
# %bb.2:
	xorl	%eax, %eax
.LBB2_7:                                # %._crit_edge
                                        # kill: def $al killed $al killed $eax
	retq
.LBB2_3:                                # %.lr.ph12.preheader
	incq	%rcx
	movapd	.LCPI2_0(%rip), %xmm0           # xmm0 = [NaN,NaN]
	movsd	.LCPI2_1(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB2_4:                                # %.lr.ph12
                                        # =>This Inner Loop Header: Depth=1
	movq	%rcx, %rax
	cmpq	%rcx, %rdx
	je	.LBB2_6
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB2_4 Depth=1
	movq	(%rsi,%rax,8), %rcx
	movq	(%rdi,%rcx,8), %rcx
	movsd	(%rcx,%r8,8), %xmm2             # xmm2 = mem[0],zero
	andpd	%xmm0, %xmm2
	leaq	1(%rax), %rcx
	ucomisd	%xmm1, %xmm2
	jbe	.LBB2_4
.LBB2_6:                                # %._crit_edge.loopexit
	cmpq	%rdx, %rax
	setge	%al
                                        # kill: def $al killed $al killed $eax
	retq
.Lfunc_end2:
	.size	_Z11zero_columnPPdPllll, .Lfunc_end2-_Z11zero_columnPPdPllll
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z14solve_equationPPdS0_S0_lll
.LCPI3_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
.LCPI3_2:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_1:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	_Z14solve_equationPPdS0_S0_lll
	.type	_Z14solve_equationPPdS0_S0_lll,@function
_Z14solve_equationPPdS0_S0_lll:         # @_Z14solve_equationPPdS0_S0_lll
	.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	%r9, %rbx
	movq	%r8, %r14
	movq	%rcx, %r15
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r13
	leaq	(,%rcx,8), %rdi
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	callq	malloc
	movq	%rax, %rbp
	testq	%r15, %r15
	jle	.LBB3_37
# %bb.1:                                # %.lr.ph.preheader
	movq	8(%rsp), %rdi                   # 8-byte Reload
	xorl	%eax, %eax
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rax, (%rbp,%rax,8)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB3_2
# %bb.3:                                # %._crit_edge
	callq	malloc
	testq	%r15, %r15
	jle	.LBB3_4
# %bb.20:                               # %.lr.ph145.preheader
	xorl	%ecx, %ecx
.LBB3_21:                               # %.lr.ph145
                                        # =>This Inner Loop Header: Depth=1
	movq	%rcx, (%rax,%rcx,8)
	incq	%rcx
	cmpq	%rcx, %r15
	jne	.LBB3_21
# %bb.5:                                # %.preheader141
	xorl	%ecx, %ecx
	testq	%r15, %r15
	jle	.LBB3_6
# %bb.12:                               # %.preheader141
	testq	%r14, %r14
	jle	.LBB3_6
# %bb.13:                               # %.lr.ph163
	xorl	%edx, %edx
	movapd	.LCPI3_0(%rip), %xmm0           # xmm0 = [NaN,NaN]
	movapd	.LCPI3_0(%rip), %xmm1           # xmm1 = [NaN,NaN]
	movsd	.LCPI3_1(%rip), %xmm2           # xmm2 = mem[0],zero
	movapd	.LCPI3_2(%rip), %xmm3           # xmm3 = [-0.0E+0,-0.0E+0]
	xorl	%ecx, %ecx
.LBB3_14:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_22 Depth 2
                                        #     Child Loop BB3_26 Depth 2
                                        #       Child Loop BB3_27 Depth 3
                                        #       Child Loop BB3_30 Depth 3
	leaq	1(%rcx), %rsi
	movq	%rcx, %rdi
	movq	%rsi, %r8
	cmpq	%r15, %rsi
	jge	.LBB3_15
.LBB3_22:                               # %.lr.ph149
                                        #   Parent Loop BB3_14 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%rbp,%r8,8), %r9
	movq	(%r13,%r9,8), %r9
	movsd	(%r9,%rdx,8), %xmm4             # xmm4 = mem[0],zero
	andpd	%xmm0, %xmm4
	movq	(%rbp,%rdi,8), %r9
	movq	(%r13,%r9,8), %r9
	movsd	(%r9,%rdx,8), %xmm5             # xmm5 = mem[0],zero
	andpd	%xmm0, %xmm5
	ucomisd	%xmm5, %xmm4
	movq	%r8, %r9
	ja	.LBB3_24
# %bb.23:                               # %.lr.ph149
                                        #   in Loop: Header=BB3_22 Depth=2
	movq	%rdi, %r9
.LBB3_24:                               # %.lr.ph149
                                        #   in Loop: Header=BB3_22 Depth=2
	incq	%r8
	movq	%r9, %rdi
	cmpq	%r8, %r15
	jne	.LBB3_22
.LBB3_15:                               # %._crit_edge150
                                        #   in Loop: Header=BB3_14 Depth=1
	movq	(%rbp,%rcx,8), %r8
	movq	(%rbp,%rdi,8), %r9
	movq	%r9, (%rbp,%rcx,8)
	movq	%r8, (%rbp,%rdi,8)
	movq	(%rbp,%rcx,8), %rdi
	movq	(%r13,%rdi,8), %r8
	movsd	(%r8,%rdx,8), %xmm4             # xmm4 = mem[0],zero
	andpd	%xmm1, %xmm4
	ucomisd	%xmm2, %xmm4
	jbe	.LBB3_18
# %bb.16:                               #   in Loop: Header=BB3_14 Depth=1
	movq	%rdx, (%rax,%rcx,8)
	cmpq	%r15, %rsi
	jge	.LBB3_17
# %bb.25:                               # %.lr.ph159
                                        #   in Loop: Header=BB3_14 Depth=1
	movq	%rsi, %rcx
.LBB3_26:                               # %.lr.ph153.preheader
                                        #   Parent Loop BB3_14 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_27 Depth 3
                                        #       Child Loop BB3_30 Depth 3
	movq	(%rbp,%rcx,8), %r9
	movq	(%r13,%r9,8), %r10
	movsd	(%r10,%rdx,8), %xmm4            # xmm4 = mem[0],zero
	xorpd	%xmm3, %xmm4
	divsd	(%r8,%rdx,8), %xmm4
	movq	%rdx, %r11
.LBB3_27:                               # %.lr.ph153
                                        #   Parent Loop BB3_14 Depth=1
                                        #     Parent Loop BB3_26 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%r8,%r11,8), %xmm5             # xmm5 = mem[0],zero
	mulsd	%xmm4, %xmm5
	addsd	(%r10,%r11,8), %xmm5
	movsd	%xmm5, (%r10,%r11,8)
	incq	%r11
	cmpq	%r14, %r11
	jl	.LBB3_27
# %bb.28:                               # %.preheader140
                                        #   in Loop: Header=BB3_26 Depth=2
	testq	%rbx, %rbx
	jle	.LBB3_31
# %bb.29:                               # %.lr.ph155
                                        #   in Loop: Header=BB3_26 Depth=2
	movq	16(%rsp), %r11                  # 8-byte Reload
	movq	(%r11,%rdi,8), %r10
	movq	(%r11,%r9,8), %r9
	xorl	%r11d, %r11d
.LBB3_30:                               #   Parent Loop BB3_14 Depth=1
                                        #     Parent Loop BB3_26 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%r10,%r11,8), %xmm5            # xmm5 = mem[0],zero
	mulsd	%xmm4, %xmm5
	addsd	(%r9,%r11,8), %xmm5
	movsd	%xmm5, (%r9,%r11,8)
	incq	%r11
	cmpq	%r11, %rbx
	jne	.LBB3_30
.LBB3_31:                               # %._crit_edge156
                                        #   in Loop: Header=BB3_26 Depth=2
	incq	%rcx
	cmpq	%r15, %rcx
	jne	.LBB3_26
.LBB3_17:                               #   in Loop: Header=BB3_14 Depth=1
	movq	%rsi, %rcx
.LBB3_18:                               # %.loopexit
                                        #   in Loop: Header=BB3_14 Depth=1
	incq	%rdx
	cmpq	%r15, %rcx
	jge	.LBB3_7
# %bb.19:                               # %.loopexit
                                        #   in Loop: Header=BB3_14 Depth=1
	cmpq	%r14, %rdx
	jl	.LBB3_14
	jmp	.LBB3_7
.LBB3_37:                               # %._crit_edge.thread
	movq	8(%rsp), %rdi                   # 8-byte Reload
	callq	malloc
.LBB3_4:
	xorl	%ecx, %ecx
.LBB3_6:
	xorl	%edx, %edx
.LBB3_7:                                # %._crit_edge164
	cmpq	%r15, %rcx
	sete	%sil
	cmpq	%r14, %rdx
	sete	%dl
	testq	%rbx, %rbx
	movq	16(%rsp), %r15                  # 8-byte Reload
	jle	.LBB3_11
# %bb.8:                                # %.preheader.lr.ph
	orb	%dl, %sil
	movzbl	%sil, %edx
	subq	%rdx, %rcx
	xorl	%edx, %edx
	movapd	.LCPI3_0(%rip), %xmm0           # xmm0 = [NaN,NaN]
	movsd	.LCPI3_1(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB3_9:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_32 Depth 2
                                        #       Child Loop BB3_36 Depth 3
	movq	%rcx, %rsi
	testq	%rcx, %rcx
	js	.LBB3_10
.LBB3_32:                               # %.lr.ph175
                                        #   Parent Loop BB3_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_36 Depth 3
	movq	(%rax,%rsi,8), %rdi
	leaq	1(%rdi), %r9
	movq	(%rbp,%rsi,8), %r8
	movq	(%r13,%r8,8), %r10
	xorpd	%xmm2, %xmm2
	xorpd	%xmm3, %xmm3
	cmpq	%r14, %r9
	jge	.LBB3_33
.LBB3_36:                               # %.lr.ph171
                                        #   Parent Loop BB3_9 Depth=1
                                        #     Parent Loop BB3_32 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%r10,%r9,8), %xmm4             # xmm4 = mem[0],zero
	movq	(%r12,%r9,8), %r11
	mulsd	(%r11,%rdx,8), %xmm4
	addsd	%xmm4, %xmm3
	incq	%r9
	cmpq	%r9, %r14
	jne	.LBB3_36
.LBB3_33:                               # %._crit_edge172
                                        #   in Loop: Header=BB3_32 Depth=2
	movsd	(%r10,%rdi,8), %xmm4            # xmm4 = mem[0],zero
	movapd	%xmm4, %xmm5
	andpd	%xmm0, %xmm5
	ucomisd	%xmm1, %xmm5
	jbe	.LBB3_35
# %bb.34:                               #   in Loop: Header=BB3_32 Depth=2
	movq	(%r15,%r8,8), %r8
	movsd	(%r8,%rdx,8), %xmm2             # xmm2 = mem[0],zero
	subsd	%xmm3, %xmm2
	divsd	%xmm4, %xmm2
.LBB3_35:                               #   in Loop: Header=BB3_32 Depth=2
	movq	(%r12,%rdi,8), %rdi
	movsd	%xmm2, (%rdi,%rdx,8)
	leaq	-1(%rsi), %rdi
	testq	%rsi, %rsi
	movq	%rdi, %rsi
	jg	.LBB3_32
.LBB3_10:                               # %._crit_edge176
                                        #   in Loop: Header=BB3_9 Depth=1
	incq	%rdx
	cmpq	%rbx, %rdx
	jne	.LBB3_9
.LBB3_11:                               # %._crit_edge178
	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_end3:
	.size	_Z14solve_equationPPdS0_S0_lll, .Lfunc_end3-_Z14solve_equationPPdS0_S0_lll
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function 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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	24(%rsp), %rbx
	movl	$_ZSt3cin, %edi
	movq	%rbx, %rsi
	callq	_ZNSi10_M_extractIlEERSiRT_
	movq	%rsp, %rsi
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIlEERSiRT_
	leaq	8(%rsp), %rsi
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIlEERSiRT_
	movq	(%rbx), %r14
	leaq	(,%r14,8), %r15
	movq	%r15, %rdi
	callq	malloc
	testq	%r14, %r14
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	jle	.LBB4_20
# %bb.1:                                # %.lr.ph
	movq	%rax, %r13
	movq	(%rsp), %r12
	shlq	$3, %r12
	xorl	%ebx, %ebx
.LBB4_2:                                # =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, (%r13,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB4_2
# %bb.3:                                # %.preheader51
	testq	%r14, %r14
	jle	.LBB4_20
# %bb.4:                                # %.preheader50.preheader
	movq	(%rsp), %rax
	xorl	%r15d, %r15d
.LBB4_5:                                # %.preheader50
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_7 Depth 2
	testq	%rax, %rax
	jle	.LBB4_9
# %bb.6:                                # %.lr.ph55
                                        #   in Loop: Header=BB4_5 Depth=1
	movq	(%r13,%r15,8), %r14
	xorl	%ebx, %ebx
.LBB4_7:                                #   Parent Loop BB4_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$_ZSt3cin, %edi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	incq	%rbx
	movq	(%rsp), %rax
	addq	$8, %r14
	cmpq	%rax, %rbx
	jl	.LBB4_7
# %bb.8:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB4_5 Depth=1
	movq	24(%rsp), %r14
.LBB4_9:                                # %._crit_edge
                                        #   in Loop: Header=BB4_5 Depth=1
	incq	%r15
	cmpq	%r14, %r15
	jl	.LBB4_5
# %bb.10:                               # %._crit_edge57
	leaq	(,%r14,8), %rdi
	callq	malloc
	movq	8(%rsp), %r12
	testq	%r14, %r14
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	jle	.LBB4_21
# %bb.11:                               # %.lr.ph60
	movq	%rax, %rbp
	leaq	(,%r12,8), %r15
	xorl	%ebx, %ebx
.LBB4_12:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, (%rbp,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB4_12
# %bb.13:                               # %.preheader49
	testq	%r14, %r14
	jle	.LBB4_21
# %bb.14:                               # %.preheader48.preheader
	xorl	%r15d, %r15d
.LBB4_15:                               # %.preheader48
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_17 Depth 2
	testq	%r12, %r12
	jle	.LBB4_19
# %bb.16:                               # %.lr.ph62
                                        #   in Loop: Header=BB4_15 Depth=1
	movq	(%rbp,%r15,8), %r14
	xorl	%ebx, %ebx
.LBB4_17:                               #   Parent Loop BB4_15 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$_ZSt3cin, %edi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
	incq	%rbx
	movq	8(%rsp), %r12
	addq	$8, %r14
	cmpq	%r12, %rbx
	jl	.LBB4_17
# %bb.18:                               # %._crit_edge63.loopexit
                                        #   in Loop: Header=BB4_15 Depth=1
	movq	24(%rsp), %r14
.LBB4_19:                               # %._crit_edge63
                                        #   in Loop: Header=BB4_15 Depth=1
	incq	%r15
	cmpq	%r14, %r15
	jl	.LBB4_15
	jmp	.LBB4_21
.LBB4_20:                               # %._crit_edge57.thread
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	8(%rsp), %r12
.LBB4_21:                               # %._crit_edge65
	movq	(%rsp), %rbp
	leaq	(,%rbp,8), %rdi
	callq	malloc
	movq	%rax, %r13
	testq	%rbp, %rbp
	jle	.LBB4_29
# %bb.22:                               # %.lr.ph69
	leaq	(,%r12,8), %r15
	xorl	%ebx, %ebx
.LBB4_23:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, (%r13,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %rbp
	jne	.LBB4_23
# %bb.24:                               # %.preheader47
	testq	%rbp, %rbp
	jle	.LBB4_29
# %bb.25:                               # %.preheader.lr.ph
	xorl	%ebx, %ebx
.LBB4_26:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	testq	%r12, %r12
	jle	.LBB4_28
# %bb.27:                               # %.lr.ph71
                                        #   in Loop: Header=BB4_26 Depth=1
	movq	(%r13,%rbx,8), %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	memset@PLT
.LBB4_28:                               # %._crit_edge72
                                        #   in Loop: Header=BB4_26 Depth=1
	incq	%rbx
	cmpq	%rbx, %rbp
	jne	.LBB4_26
.LBB4_29:                               # %._crit_edge74
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r13, %rsi
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movq	%r14, %rcx
	movq	%rbp, %r8
	movq	%r12, %r9
	callq	_Z14solve_equationPPdS0_S0_lll
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%r13, %rdi
	callq	_Z12print_matrixPPdll
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	" "
	.size	.L.str, 2

	.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 _ZSt4cout
	.addrsig_sym _ZSt3cin
	.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
