#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 **dmatrix(int, int, int, int);
int /*<<< orphan*/ gaussj(double **, int, double **, int);
void main_all_you_really_need() {
  int i, j;
  double **a = dmatrix(1, 5, 1, 5);
  double **b = dmatrix(1, 5, 1, 1);
  for (i = 1; i <= 5; i++)
    for (j = 1; j <= 5; j++)
      a[i][j] = 1.0 / (i + j);
  for (i = 1; i <= 5; i++)
    b[i][1] = 1;
  gaussj(a, 5, b, 1);
}


x86 assembly (clang, -O0):
<main_all_you_really_need>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x1,%edx
mov    $0x5,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <dmatrix@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%ecx
mov    $0x5,%esi
mov    %ecx,%edi
mov    %ecx,%edx
call   1040 <dmatrix@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jg     11c4 <main_all_you_really_need+0xa4>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     11b1 <main_all_you_really_need+0x91>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe76(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main_all_you_really_need+0x4e>
jmp    11b6 <main_all_you_really_need+0x96>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <main_all_you_really_need+0x3d>
movl   $0x1,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jg     11fc <main_all_you_really_need+0xdc>
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xe17(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <main_all_you_really_need+0xab>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x5,%esi
mov    $0x1,%ecx
call   1030 <gaussj@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_all_you_really_need>:
push   %rbx
mov    $0x1,%edi
mov    $0x5,%esi
mov    $0x1,%edx
mov    $0x5,%ecx
call   1040 <dmatrix@plt>
mov    %rax,%rbx
mov    $0x1,%edi
mov    $0x5,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1040 <dmatrix@plt>
mov    0x8(%rbx),%rcx
movaps 0xe9f(%rip),%xmm0
movups %xmm0,0x8(%rcx)
movaps 0xea4(%rip),%xmm0
movups %xmm0,0x18(%rcx)
movabs $0x3fc5555555555555,%rdx
55 c5 3f
mov    %rdx,0x28(%rcx)
mov    0x10(%rbx),%rcx
movaps 0xe97(%rip),%xmm1
movups %xmm1,0x8(%rcx)
movaps 0xe9c(%rip),%xmm1
movups %xmm1,0x18(%rcx)
movabs $0x3fc2492492492492,%rdx
49 c2 3f
mov    %rdx,0x28(%rcx)
mov    0x18(%rbx),%rcx
movups %xmm0,0x8(%rcx)
movaps 0xe8b(%rip),%xmm0
movups %xmm0,0x18(%rcx)
movabs $0x3fc0000000000000,%rdx
mov    %rdx,0x28(%rcx)
mov    0x20(%rbx),%rcx
movups %xmm1,0x8(%rcx)
movaps 0xe7a(%rip),%xmm1
movups %xmm1,0x18(%rcx)
movabs $0x3fbc71c71c71c71c,%rdx
71 bc 3f
mov    %rdx,0x28(%rcx)
mov    0x28(%rbx),%rcx
movups %xmm0,0x8(%rcx)
movaps 0xe69(%rip),%xmm0
movups %xmm0,0x18(%rcx)
movabs $0x3fb999999999999a,%rdx
99 b9 3f
mov    %rdx,0x28(%rcx)
mov    0x8(%rax),%rcx
movabs $0x3ff0000000000000,%rdx
mov    %rdx,0x8(%rcx)
mov    0x10(%rax),%rcx
mov    %rdx,0x8(%rcx)
mov    0x18(%rax),%rcx
mov    %rdx,0x8(%rcx)
mov    0x20(%rax),%rcx
mov    %rdx,0x8(%rcx)
mov    0x28(%rax),%rcx
mov    %rdx,0x8(%rcx)
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %rax,%rdx
mov    $0x1,%ecx
pop    %rbx
jmp    1030 <gaussj@plt>

LLVM IR (-O0):
define void @main_all_you_really_need() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double**
%4 = alloca double**
%5 = call double** @dmatrix(i32 1, i32 5, i32 1, i32 5)
store double** %5, double*** %3
%6 = call double** @dmatrix(i32 1, i32 5, i32 1, i32 1)
store double** %6, double*** %4
store i32 1, i32* %1
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, 5
br i1 %9, label %10, label %35
10: ; preds = %7
store i32 1, i32* %2
br label %11
11: ; preds = %28, %10
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 5
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = add nsw i32 %15, %16
%18 = sitofp i32 %17 to double
%19 = fdiv double 1.000000e+00, %18
%20 = load double**, double*** %3
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double*, double** %20, i64 %22
%24 = load double*, double** %23
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %19, double* %27
br label %28
28: ; preds = %14
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %11
31: ; preds = %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %7
35: ; preds = %7
store i32 1, i32* %1
br label %36
36: ; preds = %46, %35
%37 = load i32, i32* %1
%38 = icmp sle i32 %37, 5
br i1 %38, label %39, label %49
39: ; preds = %36
%40 = load double**, double*** %4
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double*, double** %40, i64 %42
%44 = load double*, double** %43
%45 = getelementptr inbounds double, double* %44, i64 1
store double 1.000000e+00, double* %45
br label %46
46: ; preds = %39
%47 = load i32, i32* %1
%48 = add nsw i32 %47, 1
store i32 %48, i32* %1
br label %36
49: ; preds = %36
%50 = load double**, double*** %3
%51 = load double**, double*** %4
%52 = call i32 @gaussj(double** %50, i32 5, double** %51, i32 1)
ret void
}

LLVM IR (-O2):
define void @main_all_you_really_need() {
%1 = tail call double** @dmatrix(i32 1, i32 5, i32 1, i32 5)
%2 = tail call double** @dmatrix(i32 1, i32 5, i32 1, i32 1)
%3 = getelementptr inbounds double*, double** %1, i64 1
%4 = load double*, double** %3
%5 = getelementptr inbounds double, double* %4, i64 1
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 5.000000e-01, double 0x3FD5555555555555>, <2 x double>* %6
%7 = getelementptr inbounds double, double* %4, i64 3
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 2.500000e-01, double 2.000000e-01>, <2 x double>* %8
%9 = getelementptr inbounds double, double* %4, i64 5
store double 0x3FC5555555555555, double* %9
%10 = getelementptr inbounds double*, double** %1, i64 2
%11 = load double*, double** %10
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 0x3FD5555555555555, double 2.500000e-01>, <2 x double>* %13
%14 = getelementptr inbounds double, double* %11, i64 3
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> <double 2.000000e-01, double 0x3FC5555555555555>, <2 x double>* %15
%16 = getelementptr inbounds double, double* %11, i64 5
store double 0x3FC2492492492492, double* %16
%17 = getelementptr inbounds double*, double** %1, i64 3
%18 = load double*, double** %17
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = bitcast double* %19 to <2 x double>*
store <2 x double> <double 2.500000e-01, double 2.000000e-01>, <2 x double>* %20
%21 = getelementptr inbounds double, double* %18, i64 3
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> <double 0x3FC5555555555555, double 0x3FC2492492492492>, <2 x double>* %22
%23 = getelementptr inbounds double, double* %18, i64 5
store double 1.250000e-01, double* %23
%24 = getelementptr inbounds double*, double** %1, i64 4
%25 = load double*, double** %24
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> <double 2.000000e-01, double 0x3FC5555555555555>, <2 x double>* %27
%28 = getelementptr inbounds double, double* %25, i64 3
%29 = bitcast double* %28 to <2 x double>*
store <2 x double> <double 0x3FC2492492492492, double 1.250000e-01>, <2 x double>* %29
%30 = getelementptr inbounds double, double* %25, i64 5
store double 0x3FBC71C71C71C71C, double* %30
%31 = getelementptr inbounds double*, double** %1, i64 5
%32 = load double*, double** %31
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> <double 0x3FC5555555555555, double 0x3FC2492492492492>, <2 x double>* %34
%35 = getelementptr inbounds double, double* %32, i64 3
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> <double 1.250000e-01, double 0x3FBC71C71C71C71C>, <2 x double>* %36
%37 = getelementptr inbounds double, double* %32, i64 5
store double 1.000000e-01, double* %37
%38 = getelementptr inbounds double*, double** %2, i64 1
%39 = load double*, double** %38
%40 = getelementptr inbounds double, double* %39, i64 1
store double 1.000000e+00, double* %40
%41 = getelementptr inbounds double*, double** %2, i64 2
%42 = load double*, double** %41
%43 = getelementptr inbounds double, double* %42, i64 1
store double 1.000000e+00, double* %43
%44 = getelementptr inbounds double*, double** %2, i64 3
%45 = load double*, double** %44
%46 = getelementptr inbounds double, double* %45, i64 1
store double 1.000000e+00, double* %46
%47 = getelementptr inbounds double*, double** %2, i64 4
%48 = load double*, double** %47
%49 = getelementptr inbounds double, double* %48, i64 1
store double 1.000000e+00, double* %49
%50 = getelementptr inbounds double*, double** %2, i64 5
%51 = load double*, double** %50
%52 = getelementptr inbounds double, double* %51, i64 1
store double 1.000000e+00, double* %52
%53 = tail call i32 @gaussj(double** %1, i32 5, double** %2, i32 1)
ret void
}