#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 */
int /*<<< orphan*/ LUFactotisation(int, double **, double **, double **);
double **allocateDoubleMatrix(int, int);
double *backSubstitution(int, double **, double *);
double *forwardSubstitution(int, double **, double *);
double *LUSolver(double **A, double *b, int n) {
  double **L, **U, *c, *x;
  L = allocateDoubleMatrix(n, n);
  U = allocateDoubleMatrix(n, n);
  LUFactotisation(n, A, U, L);
  c = forwardSubstitution(n, L, b);
  x = backSubstitution(n, U, c);
  return x;
}


x86 assembly (clang, -O0):
<LUSolver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <LUFactotisation@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1060 <forwardSubstitution@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1040 <backSubstitution@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LUSolver>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%edi
mov    %edx,%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,%r12
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,%r13
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rax,%rdx
mov    %r12,%rcx
call   1050 <LUFactotisation@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1060 <forwardSubstitution@plt>
mov    %ebx,%edi
mov    %r13,%rsi
mov    %rax,%rdx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <backSubstitution@plt>

LLVM IR (-O0):
define double* @LUSolver(double** %0, double* %1, i32 %2) {
%4 = alloca double**
%5 = alloca double*
%6 = alloca i32
%7 = alloca double**
%8 = alloca double**
%9 = alloca double*
%10 = alloca double*
store double** %0, double*** %4
store double* %1, double** %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = call double** @allocateDoubleMatrix(i32 %11, i32 %12)
store double** %13, double*** %7
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = call double** @allocateDoubleMatrix(i32 %14, i32 %15)
store double** %16, double*** %8
%17 = load i32, i32* %6
%18 = load double**, double*** %4
%19 = load double**, double*** %8
%20 = load double**, double*** %7
%21 = call i32 @LUFactotisation(i32 %17, double** %18, double** %19, double** %20)
%22 = load i32, i32* %6
%23 = load double**, double*** %7
%24 = load double*, double** %5
%25 = call double* @forwardSubstitution(i32 %22, double** %23, double* %24)
store double* %25, double** %9
%26 = load i32, i32* %6
%27 = load double**, double*** %8
%28 = load double*, double** %9
%29 = call double* @backSubstitution(i32 %26, double** %27, double* %28)
store double* %29, double** %10
%30 = load double*, double** %10
ret double* %30
}

LLVM IR (-O2):
define double* @LUSolver(double** %0, double* %1, i32 %2) {
%4 = tail call double** @allocateDoubleMatrix(i32 %2, i32 %2)
%5 = tail call double** @allocateDoubleMatrix(i32 %2, i32 %2)
%6 = tail call i32 @LUFactotisation(i32 %2, double** %0, double** %5, double** %4)
%7 = tail call double* @forwardSubstitution(i32 %2, double** %4, double* %1)
%8 = tail call double* @backSubstitution(i32 %2, double** %5, double* %7)
ret double* %8
}