double f14_maxcorr(double **P, int Ng) {
  int i, j, k;
  double *px, *py, **Q;
  double *x, *iy, tmp;
  double f;
  px = allocate_vector(0, Ng);
  py = allocate_vector(0, Ng);
  Q = allocate_matrix(1, Ng + 1, 1, Ng + 1);
  x = allocate_vector(1, Ng);
  iy = allocate_vector(1, Ng);
  for (i = 0; i < Ng; ++i) {
    for (j = 0; j < Ng; ++j) {
      px[i] += P[i][j];
      py[j] += P[i][j];
    }
  }
  for (i = 0; i < Ng; ++i) {
    for (j = 0; j < Ng; ++j) {
      Q[i + 1][j + 1] = 0;
      for (k = 0; k < Ng; ++k)
        Q[i + 1][j + 1] += P[i][k] * P[j][k] / px[i] / py[k];
    }
  }
  mkbalanced(Q, Ng);
  reduction(Q, Ng);
  if (!hessenberg(Q, Ng, x, iy)) {
    for (i = 1; i <= Ng + 1; i++)
      free(Q[i] + 1);
    free(Q + 1);
    free((char *)px);
    free((char *)py);
    free((x + 1));
    free((iy + 1));
    return 0.0;
  }
  for (i = 2, tmp = x[1]; i <= Ng; ++i)
    tmp = (tmp > x[i]) ? tmp : x[i];
  f = sqrt(x[Ng - 1]);
  for (i = 1; i <= Ng + 1; i++)
    free(Q[i] + 1);
  free(Q + 1);
  free((char *)px);
  free((char *)py);
  free((x + 1));
  free((iy + 1));
  return f;
}


x86 assembly (clang, -O0):
<f14_maxcorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1080 <allocate_vector@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1080 <allocate_vector@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
mov    %edx,%edi
mov    $0x0,%al
call   1060 <allocate_matrix@plt>
cltq
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
mov    $0x0,%al
call   1080 <allocate_vector@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
mov    $0x0,%al
call   1080 <allocate_vector@plt>
cltq
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1282 <f14_maxcorr+0x112>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126f <f14_maxcorr+0xff>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1207 <f14_maxcorr+0x97>
jmp    1274 <f14_maxcorr+0x104>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11f4 <f14_maxcorr+0x84>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1379 <f14_maxcorr+0x209>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1366 <f14_maxcorr+0x1f6>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1353 <f14_maxcorr+0x1e3>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12d1 <f14_maxcorr+0x161>
jmp    1358 <f14_maxcorr+0x1e8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    129c <f14_maxcorr+0x12c>
jmp    136b <f14_maxcorr+0x1fb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1289 <f14_maxcorr+0x119>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1070 <mkbalanced@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1040 <reduction@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    $0x0,%al
call   1050 <hessenberg@plt>
cmp    $0x0,%eax
jne    1435 <f14_maxcorr+0x2c5>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     13ef <f14_maxcorr+0x27f>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13bb <f14_maxcorr+0x24b>
mov    -0x38(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1541 <f14_maxcorr+0x3d1>
movl   $0x2,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     14a7 <f14_maxcorr+0x337>
movsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    147d <f14_maxcorr+0x30d>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    148f <f14_maxcorr+0x31f>
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144a <f14_maxcorr+0x2da>
mov    -0x40(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     14fe <f14_maxcorr+0x38e>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14ca <f14_maxcorr+0x35a>
mov    -0x38(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f14_maxcorr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r15d
mov    %rdi,%r13
xor    %edi,%edi
xor    %eax,%eax
call   1080 <allocate_vector@plt>
movslq %eax,%r14
xor    %edi,%edi
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <allocate_vector@plt>
movslq %eax,%r12
lea    0x1(%r15),%ecx
mov    $0x1,%edi
mov    %ecx,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1060 <allocate_matrix@plt>
movslq %eax,%rbx
mov    $0x1,%edi
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <allocate_vector@plt>
cltq
mov    %rax,0x10(%rsp)
mov    $0x1,%edi
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <allocate_vector@plt>
mov    %rbx,%rdi
cltq
mov    %rax,0x8(%rsp)
test   %r15d,%r15d
jle    1315 <f14_maxcorr+0x1a5>
mov    %r15d,%r9d
mov    %r9d,%ecx
and    $0xfffffffe,%ecx
xor    %edx,%edx
jmp    120d <f14_maxcorr+0x9d>
xchg   %ax,%ax
add    $0x1,%rdx
cmp    %r9,%rdx
je     129e <f14_maxcorr+0x12e>
mov    0x0(%r13,%rdx,8),%rsi
xor    %ebp,%ebp
cmp    $0x1,%r15d
je     1271 <f14_maxcorr+0x101>
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rbp,8),%xmm0
addsd  (%r14,%rdx,8),%xmm0
movsd  %xmm0,(%r14,%rdx,8)
movsd  (%rsi,%rbp,8),%xmm0
addsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%r12,%rbp,8)
movsd  0x8(%rsi,%rbp,8),%xmm0
addsd  (%r14,%rdx,8),%xmm0
movsd  %xmm0,(%r14,%rdx,8)
movsd  0x8(%rsi,%rbp,8),%xmm0
addsd  0x8(%r12,%rbp,8),%xmm0
movsd  %xmm0,0x8(%r12,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%rcx
jne    1220 <f14_maxcorr+0xb0>
test   $0x1,%r9b
je     1200 <f14_maxcorr+0x90>
movsd  (%rsi,%rbp,8),%xmm0
addsd  (%r14,%rdx,8),%xmm0
movsd  %xmm0,(%r14,%rdx,8)
movsd  (%rsi,%rbp,8),%xmm0
addsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%r12,%rbp,8)
jmp    1200 <f14_maxcorr+0x90>
test   %r15d,%r15d
jle    1315 <f14_maxcorr+0x1a5>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rcx),%r8
mov    0x8(%rdi,%rcx,8),%rsi
mov    0x0(%r13,%rcx,8),%rax
xor    %ebp,%ebp
movq   $0x0,0x8(%rsi,%rbp,8)
mov    0x0(%r13,%rbp,8),%rdx
add    $0x1,%rbp
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rbx,8),%xmm1
mulsd  (%rdx,%rbx,8),%xmm1
divsd  (%r14,%rcx,8),%xmm1
divsd  (%r12,%rbx,8),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsi,%rbp,8)
add    $0x1,%rbx
cmp    %rbx,%r9
jne    12e0 <f14_maxcorr+0x170>
cmp    %r9,%rbp
jne    12c0 <f14_maxcorr+0x150>
mov    %r8,%rcx
cmp    %r9,%r8
jne    12b0 <f14_maxcorr+0x140>
mov    %r15d,%esi
xor    %eax,%eax
mov    %rdi,%rbx
call   1070 <mkbalanced@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <reduction@plt>
mov    %rbx,%r13
mov    %rbx,%rdi
mov    %r15d,%esi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdx
mov    0x8(%rsp),%rbx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <hessenberg@plt>
test   %eax,%eax
je     136c <f14_maxcorr+0x1fc>
movslq %r15d,%rax
movsd  -0x8(%rbp,%rax,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     13ab <f14_maxcorr+0x23b>
sqrtsd %xmm0,%xmm0
jmp    13b0 <f14_maxcorr+0x240>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
test   %r15d,%r15d
js     1433 <f14_maxcorr+0x2c3>
add    $0x2,%r15d
mov    $0x1,%ebx
mov    %r13,%rdi
nopw   0x0(%rax,%rax,1)
mov    (%rdi,%rbx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1390 <f14_maxcorr+0x220>
jmp    13e9 <f14_maxcorr+0x279>
call   1090 <sqrt@plt>
movsd  %xmm0,(%rsp)
mov    %r13,%rdi
test   %r15d,%r15d
js     13ee <f14_maxcorr+0x27e>
add    $0x2,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%rdi,%rbx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
add    $0x1,%rbx
cmp    %rbx,%r15
jne    13d0 <f14_maxcorr+0x260>
mov    0x8(%rsp),%rbx
add    $0x8,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
add    $0x8,%rbp
mov    %rbp,%rdi
call   1030 <free@plt>
add    $0x8,%rbx
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13,%rdi
jmp    13ee <f14_maxcorr+0x27e>

LLVM IR (-O0):
define double @f14_maxcorr(double** %0, i32 %1) {
%3 = alloca double
%4 = alloca double**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double**
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca double
store double** %0, double*** %4
store i32 %1, i32* %5
%16 = load i32, i32* %5
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @allocate_vector to i32 (i32, i32, ...)*)(i32 0, i32 %16)
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to double*
store double* %19, double** %9
%20 = load i32, i32* %5
%21 = call i32 (i32, i32, ...) bitcast (i32 (...)* @allocate_vector to i32 (i32, i32, ...)*)(i32 0, i32 %20)
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to double*
store double* %23, double** %10
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
%28 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @allocate_matrix to i32 (i32, i32, i32, i32, ...)*)(i32 1, i32 %25, i32 1, i32 %27)
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to double**
store double** %30, double*** %11
%31 = load i32, i32* %5
%32 = call i32 (i32, i32, ...) bitcast (i32 (...)* @allocate_vector to i32 (i32, i32, ...)*)(i32 1, i32 %31)
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to double*
store double* %34, double** %12
%35 = load i32, i32* %5
%36 = call i32 (i32, i32, ...) bitcast (i32 (...)* @allocate_vector to i32 (i32, i32, ...)*)(i32 1, i32 %35)
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to double*
store double* %38, double** %13
store i32 0, i32* %6
br label %39
39: ; preds = %83, %2
%40 = load i32, i32* %6
%41 = load i32, i32* %5
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %86
43: ; preds = %39
store i32 0, i32* %7
br label %44
44: ; preds = %79, %43
%45 = load i32, i32* %7
%46 = load i32, i32* %5
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %82
48: ; preds = %44
%49 = load double**, double*** %4
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double*, double** %49, i64 %51
%53 = load double*, double** %52
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %9
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = fadd double %62, %57
store double %63, double* %61
%64 = load double**, double*** %4
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double*, double** %64, i64 %66
%68 = load double*, double** %67
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
%72 = load double, double* %71
%73 = load double*, double** %10
%74 = load i32, i32* %7
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = fadd double %77, %72
store double %78, double* %76
br label %79
79: ; preds = %48
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
store i32 %81, i32* %7
br label %44
82: ; preds = %44
br label %83
83: ; preds = %82
%84 = load i32, i32* %6
%85 = add nsw i32 %84, 1
store i32 %85, i32* %6
br label %39
86: ; preds = %39
store i32 0, i32* %6
br label %87
87: ; preds = %163, %86
%88 = load i32, i32* %6
%89 = load i32, i32* %5
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %166
91: ; preds = %87
store i32 0, i32* %7
br label %92
92: ; preds = %159, %91
%93 = load i32, i32* %7
%94 = load i32, i32* %5
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %162
96: ; preds = %92
%97 = load double**, double*** %11
%98 = load i32, i32* %6
%99 = add nsw i32 %98, 1
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double*, double** %97, i64 %100
%102 = load double*, double** %101
%103 = load i32, i32* %7
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %102, i64 %105
store double 0.000000e+00, double* %106
store i32 0, i32* %8
br label %107
107: ; preds = %155, %96
%108 = load i32, i32* %8
%109 = load i32, i32* %5
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %158
111: ; preds = %107
%112 = load double**, double*** %4
%113 = load i32, i32* %6
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double*, double** %112, i64 %114
%116 = load double*, double** %115
%117 = load i32, i32* %8
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = load double**, double*** %4
%122 = load i32, i32* %7
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double*, double** %121, i64 %123
%125 = load double*, double** %124
%126 = load i32, i32* %8
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %125, i64 %127
%129 = load double, double* %128
%130 = fmul double %120, %129
%131 = load double*, double** %9
%132 = load i32, i32* %6
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %131, i64 %133
%135 = load double, double* %134
%136 = fdiv double %130, %135
%137 = load double*, double** %10
%138 = load i32, i32* %8
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %137, i64 %139
%141 = load double, double* %140
%142 = fdiv double %136, %141
%143 = load double**, double*** %11
%144 = load i32, i32* %6
%145 = add nsw i32 %144, 1
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double*, double** %143, i64 %146
%148 = load double*, double** %147
%149 = load i32, i32* %7
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %148, i64 %151
%153 = load double, double* %152
%154 = fadd double %153, %142
store double %154, double* %152
br label %155
155: ; preds = %111
%156 = load i32, i32* %8
%157 = add nsw i32 %156, 1
store i32 %157, i32* %8
br label %107
158: ; preds = %107
br label %159
159: ; preds = %158
%160 = load i32, i32* %7
%161 = add nsw i32 %160, 1
store i32 %161, i32* %7
br label %92
162: ; preds = %92
br label %163
163: ; preds = %162
%164 = load i32, i32* %6
%165 = add nsw i32 %164, 1
store i32 %165, i32* %6
br label %87
166: ; preds = %87
%167 = load double**, double*** %11
%168 = load i32, i32* %5
%169 = call i32 (double**, i32, ...) bitcast (i32 (...)* @mkbalanced to i32 (double**, i32, ...)*)(double** %167, i32 %168)
%170 = load double**, double*** %11
%171 = load i32, i32* %5
%172 = call i32 (double**, i32, ...) bitcast (i32 (...)* @reduction to i32 (double**, i32, ...)*)(double** %170, i32 %171)
%173 = load double**, double*** %11
%174 = load i32, i32* %5
%175 = load double*, double** %12
%176 = load double*, double** %13
%177 = call i32 (double**, i32, double*, double*, ...) bitcast (i32 (...)* @hessenberg to i32 (double**, i32, double*, double*, ...)*)(double** %173, i32 %174, double* %175, double* %176)
%178 = icmp ne i32 %177, 0
br i1 %178, label %210, label %179
179: ; preds = %166
store i32 1, i32* %6
br label %180
180: ; preds = %193, %179
%181 = load i32, i32* %6
%182 = load i32, i32* %5
%183 = add nsw i32 %182, 1
%184 = icmp sle i32 %181, %183
br i1 %184, label %185, label %196
185: ; preds = %180
%186 = load double**, double*** %11
%187 = load i32, i32* %6
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double*, double** %186, i64 %188
%190 = load double*, double** %189
%191 = getelementptr inbounds double, double* %190, i64 1
%192 = bitcast double* %191 to i8*
br label %193
193: ; preds = %185
%194 = load i32, i32* %6
%195 = add nsw i32 %194, 1
store i32 %195, i32* %6
br label %180
196: ; preds = %180
%197 = load double**, double*** %11
%198 = getelementptr inbounds double*, double** %197, i64 1
%199 = bitcast double** %198 to i8*
%200 = load double*, double** %9
%201 = bitcast double* %200 to i8*
%202 = load double*, double** %10
%203 = bitcast double* %202 to i8*
%204 = load double*, double** %12
%205 = getelementptr inbounds double, double* %204, i64 1
%206 = bitcast double* %205 to i8*
%207 = load double*, double** %13
%208 = getelementptr inbounds double, double* %207, i64 1
%209 = bitcast double* %208 to i8*
store double 0.000000e+00, double* %3
br label %278
210: ; preds = %166
store i32 2, i32* %6
%211 = load double*, double** %12
%212 = getelementptr inbounds double, double* %211, i64 1
%213 = load double, double* %212
store double %213, double* %14
br label %214
214: ; preds = %236, %210
%215 = load i32, i32* %6
%216 = load i32, i32* %5
%217 = icmp sle i32 %215, %216
br i1 %217, label %218, label %239
218: ; preds = %214
%219 = load double, double* %14
%220 = load double*, double** %12
%221 = load i32, i32* %6
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %220, i64 %222
%224 = load double, double* %223
%225 = fcmp ogt double %219, %224
br i1 %225, label %226, label %228
226: ; preds = %218
%227 = load double, double* %14
br label %234
228: ; preds = %218
%229 = load double*, double** %12
%230 = load i32, i32* %6
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds double, double* %229, i64 %231
%233 = load double, double* %232
br label %234
234: ; preds = %228, %226
%235 = phi double [ %227, %226 ], [ %233, %228 ]
store double %235, double* %14
br label %236
236: ; preds = %234
%237 = load i32, i32* %6
%238 = add nsw i32 %237, 1
store i32 %238, i32* %6
br label %214
239: ; preds = %214
%240 = load double*, double** %12
%241 = load i32, i32* %5
%242 = sub nsw i32 %241, 1
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %240, i64 %243
%245 = load double, double* %244
%246 = call double @sqrt(double %245)
store double %246, double* %15
store i32 1, i32* %6
br label %247
247: ; preds = %260, %239
%248 = load i32, i32* %6
%249 = load i32, i32* %5
%250 = add nsw i32 %249, 1
%251 = icmp sle i32 %248, %250
br i1 %251, label %252, label %263
252: ; preds = %247
%253 = load double**, double*** %11
%254 = load i32, i32* %6
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds double*, double** %253, i64 %255
%257 = load double*, double** %256
%258 = getelementptr inbounds double, double* %257, i64 1
%259 = bitcast double* %258 to i8*
br label %260
260: ; preds = %252
%261 = load i32, i32* %6
%262 = add nsw i32 %261, 1
store i32 %262, i32* %6
br label %247
263: ; preds = %247
%264 = load double**, double*** %11
%265 = getelementptr inbounds double*, double** %264, i64 1
%266 = bitcast double** %265 to i8*
%267 = load double*, double** %9
%268 = bitcast double* %267 to i8*
%269 = load double*, double** %10
%270 = bitcast double* %269 to i8*
%271 = load double*, double** %12
%272 = getelementptr inbounds double, double* %271, i64 1
%273 = bitcast double* %272 to i8*
%274 = load double*, double** %13
%275 = getelementptr inbounds double, double* %274, i64 1
%276 = bitcast double* %275 to i8*
%277 = load double, double* %15
store double %277, double* %3
br label %278
278: ; preds = %263, %196
%279 = load double, double* %3
ret double %279
}

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