#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 matrixDeterminant(double **, int);
int /*<<< orphan*/ stdout;
void testMatrixDeterminant() {
  int n;
  double **C;
  n = 3;
  C = allocateDoubleMatrix(3, 3);
  C[0][0] = 6.0;
  C[0][1] = 1.0;
  C[0][2] = 1.0;
  C[1][0] = 4.0;
  C[1][1] = -2.0;
  C[1][2] = 5.0;
  C[2][0] = 2.0;
  C[2][1] = 8.0;
  C[2][2] = 7.0;
  fprintf(stdout, "Matrix Determinant\n");
  fprintf(stdout, "%f \n", matrixDeterminant(C, n));
}


x86 assembly (clang, -O0):
<testMatrixDeterminant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe72(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0xe55(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xe38(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xe1c(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0xdff(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <matrixDeterminant@plt>
mov    -0x14(%rbp),%edi
lea    0xe15(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testMatrixDeterminant>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,%rbx
mov    (%rax),%rax
movaps 0xeb1(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x10(%rax)
mov    0x8(%rbx),%rax
movaps 0xea5(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x4014000000000000,%rcx
mov    %rcx,0x10(%rax)
mov    0x10(%rbx),%rax
movaps 0xe99(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x401c000000000000,%rcx
mov    %rcx,0x10(%rax)
mov    0x2e41(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%ebp
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <matrixDeterminant@plt>
lea    0xe7d(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [20 x i8] c"Matrix Determinant\0A\00"
@.str.1 = [5 x i8] c"%f \0A\00"
define void @testMatrixDeterminant() {
%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 6.000000e+00, double 1.000000e+00>, <2 x double>* %3
%4 = getelementptr inbounds double, double* %2, i64 2
store double 1.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 4.000000e+00, double -2.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 2.000000e+00, double 8.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds double, double* %10, i64 2
store double 7.000000e+00, double* %12
%13 = load i32, i32* @stdout
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stdout
%16 = tail call double @matrixDeterminant(double** %1, i32 3)
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %16)
ret void
}