#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 *allocate_vector(int /*<<< orphan*/, int);
int /*<<< orphan*/ free(double *);
double log10(double);
double f12_icorr(double **P, int Ng) {
  int i, j;
  double *px, *py;
  double hx = 0, hy = 0, hxy = 0, hxy1 = 0, hxy2 = 0;
  px = allocate_vector(0, Ng);
  py = allocate_vector(0, 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) {
      hxy1 -= P[i][j] * log10(px[i] * py[j] + 0.000000001) / log10(2.0);
      hxy2 -= px[i] * py[j] * log10(px[i] * py[j] + 0.000000001) / log10(2.0);
      hxy -= P[i][j] * log10(P[i][j] + 0.000000001) / log10(2.0);
    }
  for (i = 0; i < Ng; ++i) {
    hx -= px[i] * log10(px[i] + 0.000000001) / log10(2.0);
    hy -= py[i] * log10(py[i] + 0.000000001) / log10(2.0);
  }
  free(px);
  free(py);
  return ((hxy - hxy1) / (hx > hy ? hx : hy));
}


x86 assembly (clang, -O0):
<f12_icorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0xc(%rbp),%esi
xor    %edi,%edi
call   1040 <allocate_vector@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%esi
xor    %edi,%edi
call   1040 <allocate_vector@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <f12_icorr+0xeb>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1208 <f12_icorr+0xd8>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a0 <f12_icorr+0x70>
jmp    120d <f12_icorr+0xdd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118d <f12_icorr+0x5d>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13d4 <f12_icorr+0x2a4>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13c1 <f12_icorr+0x291>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd87(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xd5d(%rip),%xmm0
call   1050 <log10@plt>
movsd  -0x78(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd04(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xcda(%rip),%xmm0
call   1050 <log10@plt>
movsd  -0x68(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  0xc94(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xc69(%rip),%xmm0
call   1050 <log10@plt>
movsd  -0x58(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1235 <f12_icorr+0x105>
jmp    13c6 <f12_icorr+0x296>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1222 <f12_icorr+0xf2>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14cf <f12_icorr+0x39f>
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  0xbfc(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xbcb(%rip),%xmm0
call   1050 <log10@plt>
movsd  -0x98(%rbp),%xmm1
ff
divsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  0xb8f(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xb5e(%rip),%xmm0
call   1050 <log10@plt>
movsd  -0x88(%rbp),%xmm1
ff
divsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    13db <f12_icorr+0x2ab>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x40(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1515 <f12_icorr+0x3e5>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    1522 <f12_icorr+0x3f2>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f12_icorr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %esi,%ebp
mov    %rdi,%r13
xor    %edi,%edi
call   1040 <allocate_vector@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %ebp,%esi
call   1040 <allocate_vector@plt>
mov    %rax,%rbx
xorpd  %xmm1,%xmm1
test   %ebp,%ebp
jle    1398 <f12_icorr+0x268>
mov    %ebp,%r12d
mov    %r12d,%eax
and    $0xfffffffe,%eax
xor    %ecx,%ecx
jmp    118d <f12_icorr+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rcx
cmp    %r12,%rcx
je     1218 <f12_icorr+0xe8>
mov    0x0(%r13,%rcx,8),%rdx
xor    %esi,%esi
cmp    $0x1,%ebp
je     11ed <f12_icorr+0xbd>
nopl   0x0(%rax)
movsd  (%rdx,%rsi,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  (%rdx,%rsi,8),%xmm0
addsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rsi,8)
movsd  0x8(%rdx,%rsi,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  0x8(%rdx,%rsi,8),%xmm0
addsd  0x8(%rbx,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rsi,8)
add    $0x2,%rsi
cmp    %rsi,%rax
jne    11a0 <f12_icorr+0x70>
test   $0x1,%r12b
je     1180 <f12_icorr+0x50>
movsd  (%rdx,%rsi,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  (%rdx,%rsi,8),%xmm0
addsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rsi,8)
jmp    1180 <f12_icorr+0x50>
xorpd  %xmm0,%xmm0
test   %ebp,%ebp
jle    13a7 <f12_icorr+0x277>
mov    %ebp,0x20(%rsp)
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
movsd  0xdca(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm0,(%rsp)
mov    0x0(%r13,%rbp,8),%rax
movsd  (%r14,%rbp,8),%xmm0
mulsd  (%rbx,%r15,8),%xmm0
addsd  %xmm1,%xmm0
movsd  (%rax,%r15,8),%xmm1
movaps %xmm1,0x10(%rsp)
call   1050 <log10@plt>
movapd %xmm0,0x40(%rsp)
movsd  (%r14,%rbp,8),%xmm0
mulsd  (%rbx,%r15,8),%xmm0
addsd  0xd6c(%rip),%xmm0
call   1050 <log10@plt>
mov    0x0(%r13,%rbp,8),%rax
movsd  (%rax,%r15,8),%xmm0
movapd %xmm0,0x30(%rsp)
addsd  0xd4e(%rip),%xmm0
call   1050 <log10@plt>
movapd 0xd51(%rip),%xmm2
movsd  0xd39(%rip),%xmm1
movapd 0x10(%rsp),%xmm3
unpcklpd 0x30(%rsp),%xmm3
movapd 0x40(%rsp),%xmm4
unpcklpd %xmm0,%xmm4
movapd (%rsp),%xmm0
mulpd  %xmm3,%xmm4
divpd  %xmm2,%xmm4
addpd  %xmm4,%xmm0
add    $0x1,%r15
cmp    %r15,%r12
jne    1250 <f12_icorr+0x120>
add    $0x1,%rbp
cmp    %r12,%rbp
jne    1240 <f12_icorr+0x110>
movapd %xmm0,(%rsp)
cmpl   $0x0,0x20(%rsp)
jle    139e <f12_icorr+0x26e>
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
xchg   %ax,%ax
movapd %xmm1,0x10(%rsp)
movsd  (%r14,%rbp,8),%xmm0
movapd %xmm0,0x40(%rsp)
movsd  0xcc6(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log10@plt>
movapd %xmm0,0x30(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
movapd %xmm0,0x20(%rsp)
addsd  0xca4(%rip),%xmm0
call   1050 <log10@plt>
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm2
unpcklpd 0x20(%rsp),%xmm2
movapd 0x30(%rsp),%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm2,%xmm3
divpd  0xc87(%rip),%xmm3
addpd  %xmm3,%xmm1
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1320 <f12_icorr+0x1f0>
jmp    13a2 <f12_icorr+0x272>
xorpd  %xmm0,%xmm0
jmp    13a7 <f12_icorr+0x277>
xorpd  %xmm1,%xmm1
movapd (%rsp),%xmm0
movapd %xmm0,(%rsp)
movapd %xmm1,0x10(%rsp)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movapd (%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
subsd  %xmm1,%xmm0
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
maxsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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