#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*/ cofactor(double **, double **, int);
int determinantOfMatrix(double **, int);
int /*<<< orphan*/ transpose(double **, int);
void inverseOfMatrix(double arr[][20], double b[][20], int size) {
  int i = 0;
  int j = 0;
  cofactor(arr, b, size);
  transpose(b, size);
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++)
      b[i][j] = (1 / determinantOfMatrix(arr, size)) * b[i][j];
  }
}


x86 assembly (clang, -O0):
<inverseOfMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <cofactor@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <transpose@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1204 <inverseOfMatrix+0xd4>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f1 <inverseOfMatrix+0xc1>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <determinantOfMatrix@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0xa0,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0xa0,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <inverseOfMatrix+0x57>
jmp    11f6 <inverseOfMatrix+0xc6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1174 <inverseOfMatrix+0x44>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverseOfMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <cofactor@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <transpose@plt>
test   %r14d,%r14d
jle    11c5 <inverseOfMatrix+0x95>
mov    %r14d,%ebp
xor    %r12d,%r12d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,(%rsp)
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14d,%esi
call   1040 <determinantOfMatrix@plt>
lea    0x1(%rax),%ecx
cmp    $0x3,%ecx
cmovae %r12d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rbx,%r13,8),%xmm0
movsd  %xmm0,(%rbx,%r13,8)
add    $0x1,%r13
cmp    %r13,%rbp
jne    1180 <inverseOfMatrix+0x50>
mov    (%rsp),%rax
add    $0x1,%rax
add    $0xa0,%rbx
cmp    %rbp,%rax
jne    1170 <inverseOfMatrix+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @inverseOfMatrix([20 x double]* %0, [20 x double]* %1, i32 %2) {
%4 = bitcast [20 x double]* %0 to double**
%5 = bitcast [20 x double]* %1 to double**
%6 = tail call i32 @cofactor(double** %4, double** %5, i32 %2)
%7 = tail call i32 @transpose(double** %5, i32 %2)
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %28
9: ; preds = %3
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %25, %9
%12 = phi i64 [ 0, %9 ], [ %26, %25 ]
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %23, %13 ]
%15 = tail call i32 @determinantOfMatrix(double** %4, i32 %2)
%16 = add i32 %15, 1
%17 = icmp ult i32 %16, 3
%18 = select i1 %17, i32 %15, i32 0
%19 = sitofp i32 %18 to double
%20 = getelementptr inbounds [20 x double], [20 x double]* %1, i64 %12, i64 %14
%21 = load double, double* %20
%22 = fmul double %21, %19
store double %22, double* %20
%23 = add nuw nsw i64 %14, 1
%24 = icmp eq i64 %23, %10
br i1 %24, label %25, label %13
25: ; preds = %13
%26 = add nuw nsw i64 %12, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %11
28: ; preds = %25, %3
ret void
}