#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*/ luDecomposition(double **, int, int *, double *);
int /*<<< orphan*/ lubksb(double **, int, int *, double *);
void inverseOfMatrix(double a[][100], double y[][100], int n) {
  double d, col[100];
  int i, j, indx[100];
  luDecomposition(a, n, indx, &d);
  for (j = 1; j <= n; j++) {
    for (i = 1; i <= n; i++)
      col[i] = 0.0;
    col[j] = 1.0;
    lubksb(a, n, indx, col);
    for (i = 1; i <= n; i++)
      y[i][j] = col[i];
  }
}


x86 assembly (clang, -O0):
<inverseOfMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x4e0(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <luDecomposition@plt>
movl   $0x1,-0x348(%rbp)
mov    -0x348(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     124f <inverseOfMatrix+0x12f>
movl   $0x1,-0x344(%rbp)
mov    -0x344(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a6 <inverseOfMatrix+0x86>
movslq -0x344(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x340(%rbp,%rax,8)
ff ff
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
jmp    1170 <inverseOfMatrix+0x50>
movslq -0x348(%rbp),%rax
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0x340(%rbp,%rax,8)
ff ff
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x4e0(%rbp),%rdx
lea    -0x340(%rbp),%rcx
call   1030 <lubksb@plt>
movl   $0x1,-0x344(%rbp)
mov    -0x344(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1236 <inverseOfMatrix+0x116>
movslq -0x344(%rbp),%rax
movsd  -0x340(%rbp,%rax,8),%xmm0
ff ff
mov    -0x10(%rbp),%rax
movslq -0x344(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x348(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
jmp    11e2 <inverseOfMatrix+0xc2>
jmp    123b <inverseOfMatrix+0x11b>
mov    -0x348(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x348(%rbp)
jmp    1157 <inverseOfMatrix+0x37>
add    $0x4e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverseOfMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e8,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
lea    0x350(%rsp),%rdx
lea    0x28(%rsp),%rcx
mov    %rdi,0x20(%rsp)
mov    %ebp,%esi
call   1050 <luDecomposition@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
jle    12ae <inverseOfMatrix+0x17e>
mov    0xc(%rsp),%r12d
lea    0x0(,%r12,8),%rax
mov    %rax,0x18(%rsp)
lea    0x1(%r12),%rax
mov    %rax,0x10(%rsp)
lea    -0x1(%r12),%r14
mov    %r12d,%r13d
and    $0x3,%r13d
and    $0xfffffffc,%r12d
lea    0xc88(%rbx),%r15
add    $0x8,%rbx
mov    $0x1,%ebp
jmp    11c7 <inverseOfMatrix+0x97>
nopl   0x0(%rax)
add    $0x1,%rbp
add    $0x8,%r15
add    $0x8,%rbx
cmp    0x10(%rsp),%rbp
je     12ae <inverseOfMatrix+0x17e>
lea    0x38(%rsp),%rdi
xor    %esi,%esi
mov    0x18(%rsp),%rdx
call   1030 <memset@plt>
movabs $0x3ff0000000000000,%rax
mov    %rax,0x30(%rsp,%rbp,8)
mov    0x20(%rsp),%rdi
mov    0xc(%rsp),%esi
lea    0x350(%rsp),%rdx
lea    0x30(%rsp),%rcx
call   1040 <lubksb@plt>
mov    $0x1,%eax
cmp    $0x3,%r14
jb     1268 <inverseOfMatrix+0x138>
mov    %r15,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x38(%rsp,%rax,8),%xmm0
movsd  %xmm0,-0x960(%rcx)
ff
movsd  0x40(%rsp,%rax,8),%xmm0
movsd  %xmm0,-0x640(%rcx)
ff
movsd  0x48(%rsp,%rax,8),%xmm0
movsd  %xmm0,-0x320(%rcx)
ff
movsd  0x50(%rsp,%rax,8),%xmm0
movsd  %xmm0,(%rcx)
add    $0x4,%rax
add    $0xc80,%rcx
cmp    %rax,%r12
jne    1220 <inverseOfMatrix+0xf0>
add    $0x1,%rax
test   %r13,%r13
je     11b0 <inverseOfMatrix+0x80>
imul   $0x320,%rax,%rcx
add    %rbx,%rcx
lea    (%rsp,%rax,8),%rax
add    $0x30,%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,(%rcx)
add    $0x1,%rdx
add    $0x320,%rcx
cmp    %rdx,%r13
jne    1290 <inverseOfMatrix+0x160>
jmp    11b0 <inverseOfMatrix+0x80>
add    $0x4e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @inverseOfMatrix([100 x double]* %0, [100 x double]* %1, i32 %2) {
%4 = alloca [100 x double]*
%5 = alloca [100 x double]*
%6 = alloca i32
%7 = alloca double
%8 = alloca [100 x double]
%9 = alloca i32
%10 = alloca i32
%11 = alloca [100 x i32]
store [100 x double]* %0, [100 x double]** %4
store [100 x double]* %1, [100 x double]** %5
store i32 %2, i32* %6
%12 = load [100 x double]*, [100 x double]** %4
%13 = bitcast [100 x double]* %12 to double**
%14 = load i32, i32* %6
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %11, i64 0, i64 0
%16 = call i32 @luDecomposition(double** %13, i32 %14, i32* %15, double* %7)
store i32 1, i32* %10
br label %17
17: ; preds = %63, %3
%18 = load i32, i32* %10
%19 = load i32, i32* %6
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %66
21: ; preds = %17
store i32 1, i32* %9
br label %22
22: ; preds = %30, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 %28
store double 0.000000e+00, double* %29
br label %30
30: ; preds = %26
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %22
33: ; preds = %22
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 %35
store double 1.000000e+00, double* %36
%37 = load [100 x double]*, [100 x double]** %4
%38 = bitcast [100 x double]* %37 to double**
%39 = load i32, i32* %6
%40 = getelementptr inbounds [100 x i32], [100 x i32]* %11, i64 0, i64 0
%41 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 0
%42 = call i32 @lubksb(double** %38, i32 %39, i32* %40, double* %41)
store i32 1, i32* %9
br label %43
43: ; preds = %59, %33
%44 = load i32, i32* %9
%45 = load i32, i32* %6
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %62
47: ; preds = %43
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 %49
%51 = load double, double* %50
%52 = load [100 x double]*, [100 x double]** %5
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x double], [100 x double]* %52, i64 %54
%56 = load i32, i32* %10
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x double], [100 x double]* %55, i64 0, i64 %57
store double %51, double* %58
br label %59
59: ; preds = %47
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %43
62: ; preds = %43
br label %63
63: ; preds = %62
%64 = load i32, i32* %10
%65 = add nsw i32 %64, 1
store i32 %65, i32* %10
br label %17
66: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @inverseOfMatrix([100 x double]* %0, [100 x double]* nocapture writeonly %1, i32 %2) {
%4 = alloca double
%5 = alloca [100 x double]
%6 = alloca [100 x i32]
%7 = bitcast double* %4 to i8*
%8 = bitcast [100 x double]* %5 to i8*
%9 = bitcast [100 x i32]* %6 to i8*
%10 = bitcast [100 x double]* %0 to double**
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%12 = call i32 @luDecomposition(double** %10, i32 %2, i32* %11, double* %4)
%13 = icmp slt i32 %2, 1
br i1 %13, label %67, label %14
14: ; preds = %3
%15 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 0
%16 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 1
%17 = bitcast double* %16 to i8*
%18 = zext i32 %2 to i64
%19 = shl nuw nsw i64 %18, 3
%20 = add nuw i32 %2, 1
%21 = zext i32 %20 to i64
%22 = add nsw i64 %21, -1
%23 = add nsw i64 %21, -2
%24 = and i64 %22, 3
%25 = icmp ult i64 %23, 3
%26 = and i64 %22, -4
%27 = icmp eq i64 %24, 0
br label %28
28: ; preds = %64, %14
%29 = phi i64 [ 1, %14 ], [ %65, %64 ]
%30 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %29
store double 1.000000e+00, double* %30
%31 = call i32 @lubksb(double** %10, i32 %2, i32* %11, double* %15)
br i1 %25, label %53, label %32
32: ; preds = %28, %32
%33 = phi i64 [ %50, %32 ], [ 1, %28 ]
%34 = phi i64 [ %51, %32 ], [ 0, %28 ]
%35 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %33
%36 = load double, double* %35
%37 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %33, i64 %29
store double %36, double* %37
%38 = add nuw nsw i64 %33, 1
%39 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %38
%40 = load double, double* %39
%41 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %38, i64 %29
store double %40, double* %41
%42 = add nuw nsw i64 %33, 2
%43 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %42, i64 %29
store double %44, double* %45
%46 = add nuw nsw i64 %33, 3
%47 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %46
%48 = load double, double* %47
%49 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %46, i64 %29
store double %48, double* %49
%50 = add nuw nsw i64 %33, 4
%51 = add i64 %34, 4
%52 = icmp eq i64 %51, %26
br i1 %52, label %53, label %32
53: ; preds = %32, %28
%54 = phi i64 [ 1, %28 ], [ %50, %32 ]
br i1 %27, label %64, label %55
55: ; preds = %53, %55
%56 = phi i64 [ %61, %55 ], [ %54, %53 ]
%57 = phi i64 [ %62, %55 ], [ 0, %53 ]
%58 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %56
%59 = load double, double* %58
%60 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %56, i64 %29
store double %59, double* %60
%61 = add nuw nsw i64 %56, 1
%62 = add i64 %57, 1
%63 = icmp eq i64 %62, %24
br i1 %63, label %64, label %55
64: ; preds = %55, %53
%65 = add nuw nsw i64 %29, 1
%66 = icmp eq i64 %65, %21
br i1 %66, label %67, label %28
67: ; preds = %64, %3
ret void
}