#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 closest_centroid(double *, double *, int, int);
scalar_t__ distance_metric(double *, double *, int);
int /*<<< orphan*/ free(int *);
int log(int);
scalar_t__ malloc(int);
double nextafter(int /*<<< orphan*/, int);
double bayesian_information_criterion(double *data, double *centroids, int k,
                                      int N, int D) {
  int *centroid_count = (int *)malloc(k * sizeof(int));
  for (int c = 0; c < k; c++) {
    centroid_count[c] = 0;
  }
  double variance_distance = 0.0;
  for (int i = 0; i < N; i++) {
    int c = closest_centroid(data + i * D, centroids, k, D);
    centroid_count[c] += 1;
    variance_distance += distance_metric(data + i * D, centroids + c * D, D);
  }
  double variance = variance_distance / (double)(N - k);
  if (variance == 0) {
    variance = nextafter(0, 1);
  }
  double log_likelihood = 0.0;
  double t1, t2, t3, t4;
  double ccount;
  for (int c = 0; c < k; c++) {
    ccount = (double)centroid_count[c];
    if (ccount == 0) {
      ccount = nextafter(0, 1);
    }
    t1 = ccount * log(ccount);
    t2 = ccount * log(N);
    t3 = (ccount * D) / 2.0 + log(2.0 * (3.141592653589793)) * variance;
    t4 = (ccount - 1.0) / 2.0;
    log_likelihood += t1 - t2 - t3 - t4;
  }
  double bic = log_likelihood - k * (D + 1) * 2.0 * log(N);
  free(centroid_count);
  return bic;
}


x86 assembly (clang, -O0):
<bayesian_information_criterion>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c0 <bayesian_information_criterion+0x60>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1197 <bayesian_information_criterion+0x37>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    125f <bayesian_information_criterion+0xff>
mov    -0x8(%rbp),%rdi
mov    -0x3c(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1040 <closest_centroid@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0x3c(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x40(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1080 <distance_metric@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11cf <bayesian_information_criterion+0x6f>
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12a0 <bayesian_information_criterion+0x140>
jp     12a0 <bayesian_information_criterion+0x140>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <nextafter@plt>
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13e4 <bayesian_information_criterion+0x284>
mov    -0x28(%rbp),%rax
movslq -0x7c(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12f6 <bayesian_information_criterion+0x196>
jp     12f6 <bayesian_information_criterion+0x196>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <nextafter@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
cvttsd2si -0x78(%rbp),%edi
call   1070 <log@plt>
movsd  -0xa0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x18(%rbp),%edi
call   1070 <log@plt>
movsd  -0x98(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x78(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc9e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    $0x6,%edi
call   1070 <log@plt>
movsd  -0x90(%rbp),%xmm1
ff
cvtsi2sd %eax,%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  0xc65(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc51(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12af <bayesian_information_criterion+0x14f>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xbf7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x18(%rbp),%edi
call   1070 <log@plt>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
cvtsi2sd %eax,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x88(%rbp),%xmm0
ff
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bayesian_information_criterion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r8d,%r13d
mov    %ecx,%r12d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0x0(,%r15,4),%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %r15d,%r14d
mov    %r15,0x38(%rsp)
test   %r15d,%r15d
jle    11c0 <bayesian_information_criterion+0x50>
lea    0x0(,%r14,4),%rdx
mov    0x18(%rsp),%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,0x40(%rsp)
xorpd  %xmm0,%xmm0
mov    %r12d,0x14(%rsp)
test   %r12d,%r12d
mov    0x38(%rsp),%r12
jle    1242 <bayesian_information_criterion+0xd2>
movslq %r13d,%r14
mov    0x14(%rsp),%r15d
shl    $0x3,%r14
xorpd  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x28(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
mov    %r13d,%ecx
call   1040 <closest_centroid@plt>
cltq
mov    0x18(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
imul   %r13d,%eax
cltq
lea    (%rbx,%rax,8),%rsi
mov    %rbp,%rdi
mov    %r13d,%edx
call   1090 <distance_metric@plt>
movsd  0x28(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm0
add    %r14,%rbp
add    $0xffffffffffffffff,%r15
jne    11f0 <bayesian_information_criterion+0x80>
mov    0x18(%rsp),%r15
mov    0x14(%rsp),%r14d
mov    %r14d,%eax
sub    %r12d,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
ucomisd 0xdb3(%rip),%xmm0
jne    1275 <bayesian_information_criterion+0x105>
jp     1275 <bayesian_information_criterion+0x105>
xor    %edi,%edi
mov    $0x1,%esi
call   1070 <nextafter@plt>
test   %r12d,%r12d
mov    0x40(%rsp),%rbp
jle    1395 <bayesian_information_criterion+0x225>
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
movsd  %xmm1,0x48(%rsp)
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
movsd  %xmm0,0x28(%rsp)
jmp    1377 <bayesian_information_criterion+0x207>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
mov    $0x1,%esi
call   1070 <nextafter@plt>
movsd  %xmm0,0x30(%rsp)
cvttsd2si %xmm0,%edi
call   1080 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
call   1080 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  0x48(%rsp),%xmm1
movsd  0xceb(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x50(%rsp)
mov    $0x6,%edi
call   1080 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x28(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x30(%rsp),%xmm0
addsd  0xcb4(%rip),%xmm0
mulsd  0xca4(%rip),%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1399 <bayesian_information_criterion+0x229>
mov    (%r15,%rbx,4),%eax
test   %eax,%eax
movsd  %xmm1,0x20(%rsp)
je     12b0 <bayesian_information_criterion+0x140>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    12bc <bayesian_information_criterion+0x14c>
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
add    $0x1,%r13d
imul   %r12d,%r13d
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
call   1080 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xc3e(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %r15,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @bayesian_information_criterion(double* %0, double* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca i32
%24 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 4
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to i32*
store i32* %30, i32** %11
store i32 0, i32* %12
br label %31
31: ; preds = %40, %5
%32 = load i32, i32* %12
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %43
35: ; preds = %31
%36 = load i32*, i32** %11
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 0, i32* %39
br label %40
40: ; preds = %35
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %31
43: ; preds = %31
store double 0.000000e+00, double* %13
store i32 0, i32* %14
br label %44
44: ; preds = %82, %43
%45 = load i32, i32* %14
%46 = load i32, i32* %9
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %85
48: ; preds = %44
%49 = load double*, double** %6
%50 = load i32, i32* %14
%51 = load i32, i32* %10
%52 = mul nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %49, i64 %53
%55 = load double*, double** %7
%56 = load i32, i32* %8
%57 = load i32, i32* %10
%58 = call i32 @closest_centroid(double* %54, double* %55, i32 %56, i32 %57)
store i32 %58, i32* %15
%59 = load i32*, i32** %11
%60 = load i32, i32* %15
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
%63 = load i32, i32* %62
%64 = add nsw i32 %63, 1
store i32 %64, i32* %62
%65 = load double*, double** %6
%66 = load i32, i32* %14
%67 = load i32, i32* %10
%68 = mul nsw i32 %66, %67
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %65, i64 %69
%71 = load double*, double** %7
%72 = load i32, i32* %15
%73 = load i32, i32* %10
%74 = mul nsw i32 %72, %73
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %71, i64 %75
%77 = load i32, i32* %10
%78 = call i64 @distance_metric(double* %70, double* %76, i32 %77)
%79 = sitofp i64 %78 to double
%80 = load double, double* %13
%81 = fadd double %80, %79
store double %81, double* %13
br label %82
82: ; preds = %48
%83 = load i32, i32* %14
%84 = add nsw i32 %83, 1
store i32 %84, i32* %14
br label %44
85: ; preds = %44
%86 = load double, double* %13
%87 = load i32, i32* %9
%88 = load i32, i32* %8
%89 = sub nsw i32 %87, %88
%90 = sitofp i32 %89 to double
%91 = fdiv double %86, %90
store double %91, double* %16
%92 = load double, double* %16
%93 = fcmp oeq double %92, 0.000000e+00
br i1 %93, label %94, label %96
94: ; preds = %85
%95 = call double @nextafter(i32 0, i32 1)
store double %95, double* %16
br label %96
96: ; preds = %94, %85
store double 0.000000e+00, double* %17
store i32 0, i32* %23
br label %97
97: ; preds = %145, %96
%98 = load i32, i32* %23
%99 = load i32, i32* %8
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %148
101: ; preds = %97
%102 = load i32*, i32** %11
%103 = load i32, i32* %23
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i32, i32* %102, i64 %104
%106 = load i32, i32* %105
%107 = sitofp i32 %106 to double
store double %107, double* %22
%108 = load double, double* %22
%109 = fcmp oeq double %108, 0.000000e+00
br i1 %109, label %110, label %112
110: ; preds = %101
%111 = call double @nextafter(i32 0, i32 1)
store double %111, double* %22
br label %112
112: ; preds = %110, %101
%113 = load double, double* %22
%114 = load double, double* %22
%115 = fptosi double %114 to i32
%116 = call i32 @log(i32 %115)
%117 = sitofp i32 %116 to double
%118 = fmul double %113, %117
store double %118, double* %18
%119 = load double, double* %22
%120 = load i32, i32* %9
%121 = call i32 @log(i32 %120)
%122 = sitofp i32 %121 to double
%123 = fmul double %119, %122
store double %123, double* %19
%124 = load double, double* %22
%125 = load i32, i32* %10
%126 = sitofp i32 %125 to double
%127 = fmul double %124, %126
%128 = fdiv double %127, 2.000000e+00
%129 = call i32 @log(i32 6)
%130 = sitofp i32 %129 to double
%131 = load double, double* %16
%132 = call double @llvm.fmuladd.f64(double %130, double %131, double %128)
store double %132, double* %20
%133 = load double, double* %22
%134 = fsub double %133, 1.000000e+00
%135 = fdiv double %134, 2.000000e+00
store double %135, double* %21
%136 = load double, double* %18
%137 = load double, double* %19
%138 = fsub double %136, %137
%139 = load double, double* %20
%140 = fsub double %138, %139
%141 = load double, double* %21
%142 = fsub double %140, %141
%143 = load double, double* %17
%144 = fadd double %143, %142
store double %144, double* %17
br label %145
145: ; preds = %112
%146 = load i32, i32* %23
%147 = add nsw i32 %146, 1
store i32 %147, i32* %23
br label %97
148: ; preds = %97
%149 = load double, double* %17
%150 = load i32, i32* %8
%151 = load i32, i32* %10
%152 = add nsw i32 %151, 1
%153 = mul nsw i32 %150, %152
%154 = sitofp i32 %153 to double
%155 = fmul double %154, 2.000000e+00
%156 = load i32, i32* %9
%157 = call i32 @log(i32 %156)
%158 = sitofp i32 %157 to double
%159 = fneg double %155
%160 = call double @llvm.fmuladd.f64(double %159, double %158, double %149)
store double %160, double* %24
%161 = load i32*, i32** %11
%162 = call i32 @free(i32* %161)
%163 = load double, double* %24
ret double %163
}

LLVM IR (-O2):
define double @bayesian_information_criterion(double* %0, double* %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %2, 2
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i32*
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = inttoptr i64 %7 to i8*
%12 = zext i32 %2 to i64
%13 = shl nuw nsw i64 %12, 2
br label %14
14: ; preds = %10, %5
%15 = icmp sgt i32 %3, 0
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = sext i32 %4 to i64
%18 = zext i32 %3 to i64
br label %25
19: ; preds = %25, %14
%20 = phi double [ 0.000000e+00, %14 ], [ %40, %25 ]
%21 = sub nsw i32 %3, %2
%22 = sitofp i32 %21 to double
%23 = fdiv double %20, %22
%24 = fcmp oeq double %23, 0.000000e+00
br i1 %24, label %43, label %45
25: ; preds = %16, %25
%26 = phi i64 [ 0, %16 ], [ %41, %25 ]
%27 = phi double [ 0.000000e+00, %16 ], [ %40, %25 ]
%28 = mul nsw i64 %26, %17
%29 = getelementptr inbounds double, double* %0, i64 %28
%30 = tail call i32 @closest_centroid(double* %29, double* %1, i32 %2, i32 %4)
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %8, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %32
%35 = mul nsw i32 %30, %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %1, i64 %36
%38 = tail call i64 @distance_metric(double* %29, double* %37, i32 %4)
%39 = sitofp i64 %38 to double
%40 = fadd double %27, %39
%41 = add nuw nsw i64 %26, 1
%42 = icmp eq i64 %41, %18
br i1 %42, label %19, label %25
43: ; preds = %19
%44 = tail call double @nextafter(i32 0, i32 1)
br label %45
45: ; preds = %43, %19
%46 = phi double [ %44, %43 ], [ %23, %19 ]
br i1 %9, label %47, label %50
47: ; preds = %45
%48 = sitofp i32 %4 to double
%49 = zext i32 %2 to i64
br label %60
50: ; preds = %69, %45
%51 = phi double [ 0.000000e+00, %45 ], [ %88, %69 ]
%52 = add nsw i32 %4, 1
%53 = mul nsw i32 %52, %2
%54 = sitofp i32 %53 to double
%55 = tail call i32 @log(i32 %3)
%56 = sitofp i32 %55 to double
%57 = fmul double %54, -2.000000e+00
%58 = tail call double @llvm.fmuladd.f64(double %57, double %56, double %51)
%59 = tail call i32 @free(i32* %8)
ret double %58
60: ; preds = %47, %69
%61 = phi i64 [ 0, %47 ], [ %89, %69 ]
%62 = phi double [ 0.000000e+00, %47 ], [ %88, %69 ]
%63 = getelementptr inbounds i32, i32* %8, i64 %61
%64 = load i32, i32* %63
%65 = sitofp i32 %64 to double
%66 = icmp eq i32 %64, 0
br i1 %66, label %67, label %69
67: ; preds = %60
%68 = tail call double @nextafter(i32 0, i32 1)
br label %69
69: ; preds = %67, %60
%70 = phi double [ %68, %67 ], [ %65, %60 ]
%71 = fptosi double %70 to i32
%72 = tail call i32 @log(i32 %71)
%73 = sitofp i32 %72 to double
%74 = fmul double %70, %73
%75 = tail call i32 @log(i32 %3)
%76 = sitofp i32 %75 to double
%77 = fmul double %70, %76
%78 = fmul double %70, %48
%79 = fmul double %78, 5.000000e-01
%80 = tail call i32 @log(i32 6)
%81 = sitofp i32 %80 to double
%82 = tail call double @llvm.fmuladd.f64(double %81, double %46, double %79)
%83 = fadd double %70, -1.000000e+00
%84 = fmul double %83, 5.000000e-01
%85 = fsub double %74, %77
%86 = fsub double %85, %82
%87 = fsub double %86, %84
%88 = fadd double %62, %87
%89 = add nuw nsw i64 %61, 1
%90 = icmp eq i64 %89, %49
br i1 %90, label %50, label %60
}