#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*/ free(double *);
double ighmm_determinant(double *, int);
double *malloc(int);
double pow(double, int);
int ighmm_inverse(double *cov, int n, double det, double *inv) {
  int i, j, ic, jc, actrow, actcol;
  double *m;
  if (n == 1) {
    inv[0] = 1 / cov[0];
    return 0;
  }
  if (n == 2) {
    inv[0] = cov[3] / (cov[0] * cov[3] - cov[1] * cov[2]);
    inv[1] = -cov[1] / (cov[0] * cov[3] - cov[1] * cov[2]);
    inv[2] = -cov[2] / (cov[0] * cov[3] - cov[1] * cov[2]);
    inv[3] = cov[0] / (cov[0] * cov[3] - cov[1] * cov[2]);
    return 0;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      m = malloc((n - 1) * (n - 1) * sizeof(double));
      actrow = 0;
      for (ic = 0; ic < n; ic++) {
        if (ic == i)
          continue;
        actcol = 0;
        for (jc = 0; jc < n; jc++) {
          if (jc == j)
            continue;
          m[actrow * (n - 1) + actcol] = cov[ic * n + jc];
          actcol++;
        }
        actrow++;
      }
      inv[j * n + i] =
          pow(-1.0, i + j + 2.0) * ighmm_determinant(m, n - 1) / det;
      free(m);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<ighmm_inverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1186 <ighmm_inverse+0x46>
mov    -0x10(%rbp),%rax
movsd  0xea2(%rip),%xmm0
divsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    14b6 <ighmm_inverse+0x376>
cmpl   $0x2,-0x14(%rbp)
jne    1328 <ighmm_inverse+0x1e8>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movl   $0x0,-0x4(%rbp)
jmp    14b6 <ighmm_inverse+0x376>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14af <ighmm_inverse+0x36f>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    149c <ighmm_inverse+0x35c>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1423 <ighmm_inverse+0x2e3>
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1399 <ighmm_inverse+0x259>
jmp    1415 <ighmm_inverse+0x2d5>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    140c <ighmm_inverse+0x2cc>
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
jne    13c4 <ighmm_inverse+0x284>
jmp    13fe <ighmm_inverse+0x2be>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13a7 <ighmm_inverse+0x267>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    137c <ighmm_inverse+0x23c>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xbd3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xbbb(%rip),%xmm0
call   1060 <pow@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
call   1050 <ighmm_determinant@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1342 <ighmm_inverse+0x202>
jmp    14a1 <ighmm_inverse+0x361>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    132f <ighmm_inverse+0x1ef>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_inverse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x8(%rsp)
movsd  %xmm0,0x38(%rsp)
cmp    $0x1,%esi
je     1210 <ighmm_inverse+0xd0>
cmp    $0x2,%esi
jne    122a <ighmm_inverse+0xea>
movsd  0x10(%rdi),%xmm0
mulsd  0x8(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
movsd  (%rdi),%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
mov    0x8(%rsp),%rax
movsd  %xmm1,(%rax)
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movapd 0xe5c(%rip),%xmm2
movapd %xmm1,%xmm3
xorpd  %xmm2,%xmm3
mulsd  0x10(%rdi),%xmm1
mulsd  0x18(%rdi),%xmm0
subsd  %xmm1,%xmm0
divsd  %xmm0,%xmm3
movsd  %xmm3,0x8(%rax)
movsd  (%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
xorpd  %xmm1,%xmm2
mulsd  0x8(%rdi),%xmm1
mulsd  0x18(%rdi),%xmm0
subsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rax)
movsd  (%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
mulsd  0x8(%rdi),%xmm1
movsd  0x18(%rdi),%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rax)
jmp    13fc <ighmm_inverse+0x2bc>
movsd  0xdf8(%rip),%xmm0
divsd  (%rdi),%xmm0
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
jmp    13fc <ighmm_inverse+0x2bc>
mov    %rdi,0x20(%rsp)
mov    %rsi,0x18(%rsp)
test   %esi,%esi
jle    13fc <ighmm_inverse+0x2bc>
mov    0x18(%rsp),%rax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
imul   %ecx,%ecx
shl    $0x3,%ecx
mov    %ecx,0x14(%rsp)
mov    %eax,%r12d
mov    %r12d,%r14d
and    $0xfffffffe,%r14d
mov    0x20(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x30(%rsp)
lea    0x0(,%r12,8),%rax
mov    %rax,0x28(%rsp)
xor    %r13d,%r13d
jmp    128d <ighmm_inverse+0x14d>
nopl   0x0(%rax)
add    $0x1,%r13
cmp    %r12,%r13
je     13fc <ighmm_inverse+0x2bc>
xor    %ebp,%ebp
jmp    12f5 <ighmm_inverse+0x1b5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x2(%rbp,%r13,1),%edi
movsd  0xd6b(%rip),%xmm0
call   1060 <pow@plt>
movsd  %xmm0,0x40(%rsp)
mov    %r15,%rdi
mov    0x4(%rsp),%esi
call   1050 <ighmm_determinant@plt>
mulsd  0x40(%rsp),%xmm0
divsd  0x38(%rsp),%xmm0
mov    %rbp,%rax
imul   %r12,%rax
add    %r13,%rax
mov    0x8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %r12,%rbp
je     1280 <ighmm_inverse+0x140>
mov    0x14(%rsp),%edi
call   1040 <malloc@plt>
mov    %rax,%r15
xor    %r9d,%r9d
mov    0x30(%rsp),%rcx
xor    %r8d,%r8d
mov    0x20(%rsp),%r10
mov    0x18(%rsp),%r11
mov    0x28(%rsp),%rdx
jmp    1334 <ighmm_inverse+0x1f4>
nopl   (%rax)
add    $0x1,%r8d
add    $0x1,%r9
add    %rdx,%rcx
cmp    %r12,%r9
je     12a0 <ighmm_inverse+0x160>
cmp    %r13,%r9
je     1324 <ighmm_inverse+0x1e4>
mov    %r8d,%esi
imul   0x4(%rsp),%esi
cmp    $0x1,%r11d
jne    1360 <ighmm_inverse+0x220>
xor    %ebx,%ebx
xor    %edi,%edi
test   $0x1,%r12b
jne    13d3 <ighmm_inverse+0x293>
jmp    1320 <ighmm_inverse+0x1e0>
nopw   0x0(%rax,%rax,1)
xor    %edx,%edx
xor    %edi,%edi
jmp    1379 <ighmm_inverse+0x239>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdx
cmp    %r14,%rdx
je     13c0 <ighmm_inverse+0x280>
mov    %rdx,%rbx
cmp    %rdx,%rbp
je     1396 <ighmm_inverse+0x256>
movsd  -0x8(%rcx,%rbx,8),%xmm0
lea    (%rdi,%rsi,1),%edx
movslq %edx,%rdx
movsd  %xmm0,(%r15,%rdx,8)
add    $0x1,%edi
lea    0x1(%rbx),%rdx
cmp    %rbp,%rdx
je     1370 <ighmm_inverse+0x230>
movsd  (%rcx,%rbx,8),%xmm0
lea    (%rdi,%rsi,1),%eax
cltq
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%edi
jmp    1370 <ighmm_inverse+0x230>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%rbx
mov    0x28(%rsp),%rdx
test   $0x1,%r12b
je     1320 <ighmm_inverse+0x1e0>
cmp    %rbp,%rbx
je     1320 <ighmm_inverse+0x1e0>
mov    %r9,%rax
imul   %r12,%rax
add    %rax,%rbx
movsd  (%r10,%rbx,8),%xmm0
add    %esi,%edi
movslq %edi,%rax
movsd  %xmm0,(%r15,%rax,8)
jmp    1320 <ighmm_inverse+0x1e0>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ighmm_inverse(double* %0, i32 %1, double %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
store double* %0, double** %6
store i32 %1, i32* %7
store double %2, double* %8
store double* %3, double** %9
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %26
19: ; preds = %4
%20 = load double*, double** %6
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fdiv double 1.000000e+00, %22
%24 = load double*, double** %9
%25 = getelementptr inbounds double, double* %24, i64 0
store double %23, double* %25
store i32 0, i32* %5
br label %218
26: ; preds = %4
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %116
29: ; preds = %26
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = load double, double* %31
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 3
%38 = load double, double* %37
%39 = load double*, double** %6
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 2
%44 = load double, double* %43
%45 = fmul double %41, %44
%46 = fneg double %45
%47 = call double @llvm.fmuladd.f64(double %35, double %38, double %46)
%48 = fdiv double %32, %47
%49 = load double*, double** %9
%50 = getelementptr inbounds double, double* %49, i64 0
store double %48, double* %50
%51 = load double*, double** %6
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
%54 = fneg double %53
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 0
%57 = load double, double* %56
%58 = load double*, double** %6
%59 = getelementptr inbounds double, double* %58, i64 3
%60 = load double, double* %59
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 1
%63 = load double, double* %62
%64 = load double*, double** %6
%65 = getelementptr inbounds double, double* %64, i64 2
%66 = load double, double* %65
%67 = fmul double %63, %66
%68 = fneg double %67
%69 = call double @llvm.fmuladd.f64(double %57, double %60, double %68)
%70 = fdiv double %54, %69
%71 = load double*, double** %9
%72 = getelementptr inbounds double, double* %71, i64 1
store double %70, double* %72
%73 = load double*, double** %6
%74 = getelementptr inbounds double, double* %73, i64 2
%75 = load double, double* %74
%76 = fneg double %75
%77 = load double*, double** %6
%78 = getelementptr inbounds double, double* %77, i64 0
%79 = load double, double* %78
%80 = load double*, double** %6
%81 = getelementptr inbounds double, double* %80, i64 3
%82 = load double, double* %81
%83 = load double*, double** %6
%84 = getelementptr inbounds double, double* %83, i64 1
%85 = load double, double* %84
%86 = load double*, double** %6
%87 = getelementptr inbounds double, double* %86, i64 2
%88 = load double, double* %87
%89 = fmul double %85, %88
%90 = fneg double %89
%91 = call double @llvm.fmuladd.f64(double %79, double %82, double %90)
%92 = fdiv double %76, %91
%93 = load double*, double** %9
%94 = getelementptr inbounds double, double* %93, i64 2
store double %92, double* %94
%95 = load double*, double** %6
%96 = getelementptr inbounds double, double* %95, i64 0
%97 = load double, double* %96
%98 = load double*, double** %6
%99 = getelementptr inbounds double, double* %98, i64 0
%100 = load double, double* %99
%101 = load double*, double** %6
%102 = getelementptr inbounds double, double* %101, i64 3
%103 = load double, double* %102
%104 = load double*, double** %6
%105 = getelementptr inbounds double, double* %104, i64 1
%106 = load double, double* %105
%107 = load double*, double** %6
%108 = getelementptr inbounds double, double* %107, i64 2
%109 = load double, double* %108
%110 = fmul double %106, %109
%111 = fneg double %110
%112 = call double @llvm.fmuladd.f64(double %100, double %103, double %111)
%113 = fdiv double %97, %112
%114 = load double*, double** %9
%115 = getelementptr inbounds double, double* %114, i64 3
store double %113, double* %115
store i32 0, i32* %5
br label %218
116: ; preds = %26
store i32 0, i32* %10
br label %117
117: ; preds = %214, %116
%118 = load i32, i32* %10
%119 = load i32, i32* %7
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %217
121: ; preds = %117
store i32 0, i32* %11
br label %122
122: ; preds = %210, %121
%123 = load i32, i32* %11
%124 = load i32, i32* %7
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %213
126: ; preds = %122
%127 = load i32, i32* %7
%128 = sub nsw i32 %127, 1
%129 = load i32, i32* %7
%130 = sub nsw i32 %129, 1
%131 = mul nsw i32 %128, %130
%132 = sext i32 %131 to i64
%133 = mul i64 %132, 8
%134 = trunc i64 %133 to i32
%135 = call double* @malloc(i32 %134)
store double* %135, double** %16
store i32 0, i32* %14
store i32 0, i32* %12
br label %136
136: ; preds = %182, %126
%137 = load i32, i32* %12
%138 = load i32, i32* %7
%139 = icmp slt i32 %137, %138
br i1 %139, label %140, label %185
140: ; preds = %136
%141 = load i32, i32* %12
%142 = load i32, i32* %10
%143 = icmp eq i32 %141, %142
br i1 %143, label %144, label %145
144: ; preds = %140
br label %182
145: ; preds = %140
store i32 0, i32* %15
store i32 0, i32* %13
br label %146
146: ; preds = %176, %145
%147 = load i32, i32* %13
%148 = load i32, i32* %7
%149 = icmp slt i32 %147, %148
br i1 %149, label %150, label %179
150: ; preds = %146
%151 = load i32, i32* %13
%152 = load i32, i32* %11
%153 = icmp eq i32 %151, %152
br i1 %153, label %154, label %155
154: ; preds = %150
br label %176
155: ; preds = %150
%156 = load double*, double** %6
%157 = load i32, i32* %12
%158 = load i32, i32* %7
%159 = mul nsw i32 %157, %158
%160 = load i32, i32* %13
%161 = add nsw i32 %159, %160
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %156, i64 %162
%164 = load double, double* %163
%165 = load double*, double** %16
%166 = load i32, i32* %14
%167 = load i32, i32* %7
%168 = sub nsw i32 %167, 1
%169 = mul nsw i32 %166, %168
%170 = load i32, i32* %15
%171 = add nsw i32 %169, %170
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %165, i64 %172
store double %164, double* %173
%174 = load i32, i32* %15
%175 = add nsw i32 %174, 1
store i32 %175, i32* %15
br label %176
176: ; preds = %155, %154
%177 = load i32, i32* %13
%178 = add nsw i32 %177, 1
store i32 %178, i32* %13
br label %146
179: ; preds = %146
%180 = load i32, i32* %14
%181 = add nsw i32 %180, 1
store i32 %181, i32* %14
br label %182
182: ; preds = %179, %144
%183 = load i32, i32* %12
%184 = add nsw i32 %183, 1
store i32 %184, i32* %12
br label %136
185: ; preds = %136
%186 = load i32, i32* %10
%187 = load i32, i32* %11
%188 = add nsw i32 %186, %187
%189 = sitofp i32 %188 to double
%190 = fadd double %189, 2.000000e+00
%191 = fptosi double %190 to i32
%192 = call double @pow(double -1.000000e+00, i32 %191)
%193 = load double*, double** %16
%194 = load i32, i32* %7
%195 = sub nsw i32 %194, 1
%196 = call double @ighmm_determinant(double* %193, i32 %195)
%197 = fmul double %192, %196
%198 = load double, double* %8
%199 = fdiv double %197, %198
%200 = load double*, double** %9
%201 = load i32, i32* %11
%202 = load i32, i32* %7
%203 = mul nsw i32 %201, %202
%204 = load i32, i32* %10
%205 = add nsw i32 %203, %204
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %200, i64 %206
store double %199, double* %207
%208 = load double*, double** %16
%209 = call i32 @free(double* %208)
br label %210
210: ; preds = %185
%211 = load i32, i32* %11
%212 = add nsw i32 %211, 1
store i32 %212, i32* %11
br label %122
213: ; preds = %122
br label %214
214: ; preds = %213
%215 = load i32, i32* %10
%216 = add nsw i32 %215, 1
store i32 %216, i32* %10
br label %117
217: ; preds = %117
store i32 0, i32* %5
br label %218
218: ; preds = %217, %29, %19
%219 = load i32, i32* %5
ret i32 %219
}

LLVM IR (-O2):
define i32 @ighmm_inverse(double* nocapture %0, i32 %1, double %2, double* nocapture writeonly %3) {
switch i32 %1, label %5 [
i32 1, label %17
i32 2, label %20
]
5: ; preds = %4
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %137
7: ; preds = %5
%8 = add nsw i32 %1, -1
%9 = shl i32 %8, 3
%10 = mul i32 %9, %8
%11 = zext i32 %1 to i64
%12 = zext i32 %1 to i64
%13 = and i64 %12, 1
%14 = icmp eq i32 %1, 1
%15 = and i64 %12, 4294967294
%16 = icmp eq i64 %13, 0
br label %60
17: ; preds = %4
%18 = load double, double* %0
%19 = fdiv double 1.000000e+00, %18
store double %19, double* %3
br label %137
20: ; preds = %4
%21 = getelementptr inbounds double, double* %0, i64 3
%22 = load double, double* %21
%23 = load double, double* %0
%24 = getelementptr inbounds double, double* %0, i64 1
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %0, i64 2
%27 = load double, double* %26
%28 = fneg double %25
%29 = fmul double %27, %28
%30 = tail call double @llvm.fmuladd.f64(double %23, double %22, double %29)
%31 = fdiv double %22, %30
store double %31, double* %3
%32 = load double, double* %24
%33 = fneg double %32
%34 = load double, double* %0
%35 = load double, double* %21
%36 = load double, double* %26
%37 = fmul double %36, %33
%38 = tail call double @llvm.fmuladd.f64(double %34, double %35, double %37)
%39 = fdiv double %33, %38
%40 = getelementptr inbounds double, double* %3, i64 1
store double %39, double* %40
%41 = load double, double* %26
%42 = fneg double %41
%43 = load double, double* %0
%44 = load double, double* %21
%45 = load double, double* %24
%46 = fneg double %45
%47 = fmul double %41, %46
%48 = tail call double @llvm.fmuladd.f64(double %43, double %44, double %47)
%49 = fdiv double %42, %48
%50 = getelementptr inbounds double, double* %3, i64 2
store double %49, double* %50
%51 = load double, double* %0
%52 = load double, double* %21
%53 = load double, double* %24
%54 = load double, double* %26
%55 = fneg double %53
%56 = fmul double %54, %55
%57 = tail call double @llvm.fmuladd.f64(double %51, double %52, double %56)
%58 = fdiv double %51, %57
%59 = getelementptr inbounds double, double* %3, i64 3
store double %58, double* %59
br label %137
60: ; preds = %134, %7
%61 = phi i64 [ 0, %7 ], [ %135, %134 ]
br label %62
62: ; preds = %120, %60
%63 = phi i64 [ 0, %60 ], [ %132, %120 ]
%64 = tail call double* @malloc(i32 %10)
br label %65
65: ; preds = %62, %116
%66 = phi i64 [ 0, %62 ], [ %118, %116 ]
%67 = phi i32 [ 0, %62 ], [ %117, %116 ]
%68 = icmp eq i64 %66, %61
br i1 %68, label %116, label %69
69: ; preds = %65
%70 = mul nsw i64 %66, %11
%71 = mul nsw i32 %67, %8
br i1 %14, label %102, label %72
72: ; preds = %69, %97
%73 = phi i64 [ %99, %97 ], [ 0, %69 ]
%74 = phi i32 [ %98, %97 ], [ 0, %69 ]
%75 = phi i64 [ %100, %97 ], [ 0, %69 ]
%76 = icmp eq i64 %73, %63
br i1 %76, label %85, label %77
77: ; preds = %72
%78 = add nuw nsw i64 %73, %70
%79 = getelementptr inbounds double, double* %0, i64 %78
%80 = load double, double* %79
%81 = add nsw i32 %74, %71
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %64, i64 %82
store double %80, double* %83
%84 = add nsw i32 %74, 1
br label %85
85: ; preds = %72, %77
%86 = phi i32 [ %74, %72 ], [ %84, %77 ]
%87 = or i64 %73, 1
%88 = icmp eq i64 %87, %63
br i1 %88, label %97, label %89
89: ; preds = %85
%90 = add nuw nsw i64 %87, %70
%91 = getelementptr inbounds double, double* %0, i64 %90
%92 = load double, double* %91
%93 = add nsw i32 %86, %71
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %64, i64 %94
store double %92, double* %95
%96 = add nsw i32 %86, 1
br label %97
97: ; preds = %89, %85
%98 = phi i32 [ %86, %85 ], [ %96, %89 ]
%99 = add nuw nsw i64 %73, 2
%100 = add i64 %75, 2
%101 = icmp eq i64 %100, %15
br i1 %101, label %102, label %72
102: ; preds = %97, %69
%103 = phi i64 [ 0, %69 ], [ %99, %97 ]
%104 = phi i32 [ 0, %69 ], [ %98, %97 ]
%105 = icmp eq i64 %103, %63
%106 = select i1 %16, i1 true, i1 %105
br i1 %106, label %114, label %107
107: ; preds = %102
%108 = add nuw nsw i64 %103, %70
%109 = getelementptr inbounds double, double* %0, i64 %108
%110 = load double, double* %109
%111 = add nsw i32 %104, %71
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %64, i64 %112
store double %110, double* %113
br label %114
114: ; preds = %107, %102
%115 = add nsw i32 %67, 1
br label %116
116: ; preds = %65, %114
%117 = phi i32 [ %67, %65 ], [ %115, %114 ]
%118 = add nuw nsw i64 %66, 1
%119 = icmp eq i64 %118, %12
br i1 %119, label %120, label %65
120: ; preds = %116
%121 = add nuw nsw i64 %63, %61
%122 = trunc i64 %121 to i32
%123 = add i32 %122, 2
%124 = tail call double @pow(double -1.000000e+00, i32 %123)
%125 = tail call double @ighmm_determinant(double* %64, i32 %8)
%126 = fmul double %124, %125
%127 = fdiv double %126, %2
%128 = mul nsw i64 %63, %11
%129 = add nuw nsw i64 %128, %61
%130 = getelementptr inbounds double, double* %3, i64 %129
store double %127, double* %130
%131 = tail call i32 @free(double* %64)
%132 = add nuw nsw i64 %63, 1
%133 = icmp eq i64 %132, %12
br i1 %133, label %134, label %62
134: ; preds = %120
%135 = add nuw nsw i64 %61, 1
%136 = icmp eq i64 %135, %12
br i1 %136, label %137, label %60
137: ; preds = %134, %5, %20, %17
ret i32 0
}