#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double **allocateDoubleMatrix(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
double **matrixInverse(double **, int);
int /*<<< orphan*/ printMatrix(double **, int, int);
int /*<<< orphan*/ stdout;
void testMatrixInverse() {
  double **A, **B;
  int n;
  n = 3;
  A = allocateDoubleMatrix(3, 3);
  A[0][0] = 1.0;
  A[0][1] = 2.0;
  A[0][2] = 3.0;
  A[1][0] = 0.0;
  A[1][1] = 4.0;
  A[1][2] = 5.0;
  A[2][0] = 1.0;
  A[2][1] = 0.0;
  A[2][2] = 6.0;
  B = matrixInverse(A, n);
  fprintf(stdout, "Matrix Inversion\n");
  printMatrix(B, n, n);
}


x86 assembly (clang, -O0):
<testMatrixInverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x14(%rbp)
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  0xe8b(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe42(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xe25(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xdf9(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <matrixInverse@plt>
mov    %rax,-0x10(%rbp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <printMatrix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testMatrixInverse>:
push   %rbx
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <allocateDoubleMatrix@plt>
mov    (%rax),%rcx
movaps 0xea6(%rip),%xmm0
movups %xmm0,(%rcx)
movabs $0x4008000000000000,%rdx
mov    %rdx,0x10(%rcx)
mov    0x8(%rax),%rcx
xorps  %xmm0,%xmm0
movhps 0xe97(%rip),%xmm0
movups %xmm0,(%rcx)
movabs $0x4014000000000000,%rdx
mov    %rdx,0x10(%rcx)
mov    0x10(%rax),%rcx
movsd  0xe82(%rip),%xmm0
movups %xmm0,(%rcx)
movabs $0x4018000000000000,%rdx
mov    %rdx,0x10(%rcx)
mov    %rax,%rdi
mov    $0x3,%esi
call   1060 <matrixInverse@plt>
mov    %rax,%rbx
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
pop    %rbx
jmp    1050 <printMatrix@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"Matrix Inversion\0A\00"
define void @testMatrixInverse() {
%1 = alloca double**
%2 = alloca double**
%3 = alloca i32
store i32 3, i32* %3
%4 = call double** @allocateDoubleMatrix(i32 3, i32 3)
store double** %4, double*** %1
%5 = load double**, double*** %1
%6 = getelementptr inbounds double*, double** %5, i64 0
%7 = load double*, double** %6
%8 = getelementptr inbounds double, double* %7, i64 0
store double 1.000000e+00, double* %8
%9 = load double**, double*** %1
%10 = getelementptr inbounds double*, double** %9, i64 0
%11 = load double*, double** %10
%12 = getelementptr inbounds double, double* %11, i64 1
store double 2.000000e+00, double* %12
%13 = load double**, double*** %1
%14 = getelementptr inbounds double*, double** %13, i64 0
%15 = load double*, double** %14
%16 = getelementptr inbounds double, double* %15, i64 2
store double 3.000000e+00, double* %16
%17 = load double**, double*** %1
%18 = getelementptr inbounds double*, double** %17, i64 1
%19 = load double*, double** %18
%20 = getelementptr inbounds double, double* %19, i64 0
store double 0.000000e+00, double* %20
%21 = load double**, double*** %1
%22 = getelementptr inbounds double*, double** %21, i64 1
%23 = load double*, double** %22
%24 = getelementptr inbounds double, double* %23, i64 1
store double 4.000000e+00, double* %24
%25 = load double**, double*** %1
%26 = getelementptr inbounds double*, double** %25, i64 1
%27 = load double*, double** %26
%28 = getelementptr inbounds double, double* %27, i64 2
store double 5.000000e+00, double* %28
%29 = load double**, double*** %1
%30 = getelementptr inbounds double*, double** %29, i64 2
%31 = load double*, double** %30
%32 = getelementptr inbounds double, double* %31, i64 0
store double 1.000000e+00, double* %32
%33 = load double**, double*** %1
%34 = getelementptr inbounds double*, double** %33, i64 2
%35 = load double*, double** %34
%36 = getelementptr inbounds double, double* %35, i64 1
store double 0.000000e+00, double* %36
%37 = load double**, double*** %1
%38 = getelementptr inbounds double*, double** %37, i64 2
%39 = load double*, double** %38
%40 = getelementptr inbounds double, double* %39, i64 2
store double 6.000000e+00, double* %40
%41 = load double**, double*** %1
%42 = load i32, i32* %3
%43 = call double** @matrixInverse(double** %41, i32 %42)
store double** %43, double*** %2
%44 = load i32, i32* @stdout
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%46 = load double**, double*** %2
%47 = load i32, i32* %3
%48 = load i32, i32* %3
%49 = call i32 @printMatrix(double** %46, i32 %47, i32 %48)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"Matrix Inversion\0A\00"
define void @testMatrixInverse() {
%1 = tail call double** @allocateDoubleMatrix(i32 3, i32 3)
%2 = load double*, double** %1
%3 = bitcast double* %2 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %3
%4 = getelementptr inbounds double, double* %2, i64 2
store double 3.000000e+00, double* %4
%5 = getelementptr inbounds double*, double** %1, i64 1
%6 = load double*, double** %5
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 4.000000e+00>, <2 x double>* %7
%8 = getelementptr inbounds double, double* %6, i64 2
store double 5.000000e+00, double* %8
%9 = getelementptr inbounds double*, double** %1, i64 2
%10 = load double*, double** %9
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds double, double* %10, i64 2
store double 6.000000e+00, double* %12
%13 = tail call double** @matrixInverse(double** %1, i32 3)
%14 = load i32, i32* @stdout
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @printMatrix(double** %13, i32 3, i32 3)
ret void
}