#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*/ glbGetBGCenters(int, int, double *, double *);
double *glbGetBGFitRatePtr(int, int);
double *glbGetBinCentersListPtr(int);
int /*<<< orphan*/ glbGetEminEmax(int, double *, double *);
int /*<<< orphan*/ glbGetEnergyWindowBins(int, int, int *, int *);
int glbGetNumberOfBins(int);
double *glbGetRuleRatePtr(int, int);
double *glbGetSignalFitRatePtr(int, int);
double glb_likelihood(double, double);
scalar_t__ glb_prior(double, double, double);
double glbChiTotalRatesTilt(int exp, int rule, int n_params, double *x,
                            double *errors, void *user_data) {
  int n_bins = glbGetNumberOfBins(exp);
  double *true_rates = glbGetRuleRatePtr(exp, rule);
  double *signal_fit_rates = glbGetSignalFitRatePtr(exp, rule);
  double *bg_fit_rates = glbGetBGFitRatePtr(exp, rule);
  double *bin_centers = glbGetBinCentersListPtr(exp);
  double signal_norm, signal_tilt;
  double bg_norm_center, bg_tilt_center;
  double bg_norm, bg_tilt;
  int ew_low, ew_high;
  double emin, emax, ecenter;
  double fit_rate, true_rate;
  double total_fit_rate, total_true_rate;
  double chi2 = 0.0;
  int i;
  glbGetEminEmax(exp, &emin, &emax);
  ecenter = 0.5 * (emax + emin);
  glbGetEnergyWindowBins(exp, rule, &ew_low, &ew_high);
  glbGetBGCenters(exp, rule, &bg_norm_center, &bg_tilt_center);
  signal_norm = 1.0 + x[0];
  signal_tilt = x[1] / (emax - emin);
  bg_norm = bg_norm_center * (1.0 + x[2]);
  bg_tilt = x[3] / (emax - emin);
  total_fit_rate = 0.0;
  total_true_rate = 0.0;
  for (i = ew_low; i <= ew_high; i++) {
    fit_rate = signal_norm * signal_fit_rates[i] +
               signal_tilt * (bin_centers[i] - ecenter) * signal_fit_rates[i] +
               bg_norm * bg_fit_rates[i] +
               bg_tilt * (bin_centers[i] - ecenter) * bg_fit_rates[i];
    total_fit_rate += fit_rate;
    total_true_rate += true_rates[i];
  }
  chi2 = glb_likelihood(total_true_rate, total_fit_rate);
  chi2 += glb_prior(x[0], 0.0, errors[0]) + glb_prior(x[1], 0.0, errors[1]) +
          glb_prior(bg_norm, bg_norm_center, errors[2]) +
          glb_prior(bg_tilt, bg_tilt_center, errors[3]);
  return chi2;
}


x86 assembly (clang, -O0):
<glbChiTotalRatesTilt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <glbGetNumberOfBins@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <glbGetRuleRatePtr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <glbGetSignalFitRatePtr@plt>
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <glbGetBGFitRatePtr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <glbGetBinCentersListPtr@plt>
mov    %rax,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rsi
lea    -0x98(%rbp),%rdx
call   1080 <glbGetEminEmax@plt>
movsd  -0x98(%rbp),%xmm1
ff
addsd  -0x90(%rbp),%xmm1
ff
movsd  0xdcb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x84(%rbp),%rdx
lea    -0x88(%rbp),%rcx
call   1050 <glbGetEnergyWindowBins@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
call   10c0 <glbGetBGCenters@plt>
mov    -0x18(%rbp),%rax
movsd  0xd7f(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
subsd  -0x90(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0xd43(%rip),%xmm1
addsd  0x10(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
subsd  -0x90(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x84(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x88(%rbp),%eax
jg     1419 <glbChiTotalRatesTilt+0x279>
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x60(%rbp),%xmm1
mov    -0x50(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
subsd  -0xa0(%rbp),%xmm3
ff
mulsd  %xmm3,%xmm1
mov    -0x40(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm1
mov    -0x48(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
subsd  -0xa0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
mov    -0x48(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x38(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    130f <glbChiTotalRatesTilt+0x16f>
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xb8(%rbp),%xmm1
ff
call   1090 <glb_likelihood@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
xorps  %xmm1,%xmm1
call   10a0 <glb_prior@plt>
mov    %rax,-0xe8(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm2
xorps  %xmm1,%xmm1
call   10a0 <glb_prior@plt>
mov    %rax,%rcx
mov    -0xe8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xe0(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
call   10a0 <glb_prior@plt>
mov    %rax,%rcx
mov    -0xe0(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xd8(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm2
call   10a0 <glb_prior@plt>
mov    %rax,%rcx
mov    -0xd8(%rbp),%rax
add    %rcx,%rax
cvtsi2sd %rax,%xmm0
addsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glbChiTotalRatesTilt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %esi,%r15d
mov    %edi,%r12d
call   1040 <glbGetNumberOfBins@plt>
mov    %r12d,%edi
mov    %r15d,%esi
call   1060 <glbGetRuleRatePtr@plt>
mov    %rax,0x8(%rsp)
mov    %r12d,%edi
mov    %r15d,%esi
call   1070 <glbGetSignalFitRatePtr@plt>
mov    %rax,(%rsp)
mov    %r12d,%edi
mov    %r15d,%esi
call   10b0 <glbGetBGFitRatePtr@plt>
mov    %rax,0x38(%rsp)
mov    %r12d,%edi
call   1030 <glbGetBinCentersListPtr@plt>
mov    %rax,%r13
lea    0x28(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r12d,%edi
call   1080 <glbGetEminEmax@plt>
movsd  0x20(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
mov    %r12d,%edi
mov    %r15d,%esi
call   1050 <glbGetEnergyWindowBins@plt>
lea    0x30(%rsp),%rdx
lea    0x40(%rsp),%rcx
mov    %r12d,%edi
mov    %r15d,%esi
call   10c0 <glbGetBGCenters@plt>
movsd  0x10(%rsp),%xmm10
movsd  0x20(%rsp),%xmm4
subsd  0x28(%rsp),%xmm4
movsd  0xda5(%rip),%xmm8
movsd  0x18(%rbx),%xmm9
movsd  0x10(%rbx),%xmm2
addsd  %xmm8,%xmm2
mulsd  0x30(%rsp),%xmm2
divsd  %xmm4,%xmm9
movslq 0x1c(%rsp),%rbp
mov    0x18(%rsp),%eax
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
cmp    %eax,%ebp
jg     1333 <glbChiTotalRatesTilt+0x193>
mulsd  0xd60(%rip),%xmm10
addsd  (%rbx),%xmm8
movsd  0x8(%rbx),%xmm3
divsd  %xmm4,%xmm3
mov    (%rsp),%rcx
lea    (%rcx,%rbp,8),%rcx
lea    0x0(%r13,%rbp,8),%rdx
mov    0x38(%rsp),%rsi
lea    (%rsi,%rbp,8),%rsi
mov    0x8(%rsp),%rdi
lea    (%rdi,%rbp,8),%rdi
sub    %ebp,%eax
add    $0x1,%eax
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
xorpd  %xmm1,%xmm1
nopl   0x0(%rax)
movsd  (%rcx,%rbp,8),%xmm4
movsd  (%rdx,%rbp,8),%xmm5
subsd  %xmm10,%xmm5
movapd %xmm3,%xmm6
mulsd  %xmm5,%xmm6
mulsd  %xmm4,%xmm6
mulsd  %xmm8,%xmm4
addsd  %xmm6,%xmm4
movsd  (%rsi,%rbp,8),%xmm6
movapd %xmm2,%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm9,%xmm5
mulsd  %xmm6,%xmm5
addsd  %xmm7,%xmm5
addsd  %xmm5,%xmm1
addsd  (%rdi,%rbp,8),%xmm0
add    $0x1,%rbp
cmp    %ebp,%eax
jne    12e0 <glbChiTotalRatesTilt+0x140>
movsd  %xmm9,0x8(%rsp)
movsd  %xmm2,(%rsp)
call   1090 <glb_likelihood@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
movsd  (%r14),%xmm2
xorpd  %xmm1,%xmm1
call   10a0 <glb_prior@plt>
mov    %rax,%rbp
movsd  0x8(%rbx),%xmm0
movsd  0x8(%r14),%xmm2
xorpd  %xmm1,%xmm1
call   10a0 <glb_prior@plt>
mov    %rax,%rbx
add    %rbp,%rbx
movsd  0x30(%rsp),%xmm1
movsd  0x10(%r14),%xmm2
movsd  (%rsp),%xmm0
call   10a0 <glb_prior@plt>
mov    %rax,%rbp
add    %rbx,%rbp
movsd  0x40(%rsp),%xmm1
movsd  0x18(%r14),%xmm2
movsd  0x8(%rsp),%xmm0
call   10a0 <glb_prior@plt>
add    %rbp,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @glbChiTotalRatesTilt(i32 %0, i32 %1, i32 %2, double* nocapture %3, double* nocapture %4, i8* nocapture readnone %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = tail call i32 @glbGetNumberOfBins(i32 %0)
%14 = tail call double* @glbGetRuleRatePtr(i32 %0, i32 %1)
%15 = tail call double* @glbGetSignalFitRatePtr(i32 %0, i32 %1)
%16 = tail call double* @glbGetBGFitRatePtr(i32 %0, i32 %1)
%17 = tail call double* @glbGetBinCentersListPtr(i32 %0)
%18 = bitcast double* %7 to i8*
%19 = bitcast double* %8 to i8*
%20 = bitcast i32* %9 to i8*
%21 = bitcast i32* %10 to i8*
%22 = bitcast double* %11 to i8*
%23 = bitcast double* %12 to i8*
%24 = call i32 @glbGetEminEmax(i32 %0, double* %11, double* %12)
%25 = load double, double* %12
%26 = load double, double* %11
%27 = fadd double %25, %26
%28 = fmul double %27, 5.000000e-01
%29 = call i32 @glbGetEnergyWindowBins(i32 %0, i32 %1, i32* %9, i32* %10)
%30 = call i32 @glbGetBGCenters(i32 %0, i32 %1, double* %7, double* %8)
%31 = load double, double* %3
%32 = fadd double %31, 1.000000e+00
%33 = getelementptr inbounds double, double* %3, i64 1
%34 = load double, double* %33
%35 = load double, double* %12
%36 = load double, double* %11
%37 = fsub double %35, %36
%38 = fdiv double %34, %37
%39 = load double, double* %7
%40 = getelementptr inbounds double, double* %3, i64 2
%41 = load double, double* %40
%42 = fadd double %41, 1.000000e+00
%43 = fmul double %39, %42
%44 = getelementptr inbounds double, double* %3, i64 3
%45 = load double, double* %44
%46 = fdiv double %45, %37
%47 = load i32, i32* %9
%48 = load i32, i32* %10
%49 = icmp sgt i32 %47, %48
br i1 %49, label %77, label %50
50: ; preds = %6
%51 = sext i32 %47 to i64
%52 = add i32 %48, 1
br label %53
53: ; preds = %50, %53
%54 = phi i64 [ %51, %50 ], [ %74, %53 ]
%55 = phi double [ 0.000000e+00, %50 ], [ %73, %53 ]
%56 = phi double [ 0.000000e+00, %50 ], [ %70, %53 ]
%57 = getelementptr inbounds double, double* %15, i64 %54
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %17, i64 %54
%60 = load double, double* %59
%61 = fsub double %60, %28
%62 = fmul double %38, %61
%63 = fmul double %58, %62
%64 = call double @llvm.fmuladd.f64(double %32, double %58, double %63)
%65 = getelementptr inbounds double, double* %16, i64 %54
%66 = load double, double* %65
%67 = call double @llvm.fmuladd.f64(double %43, double %66, double %64)
%68 = fmul double %46, %61
%69 = call double @llvm.fmuladd.f64(double %68, double %66, double %67)
%70 = fadd double %56, %69
%71 = getelementptr inbounds double, double* %14, i64 %54
%72 = load double, double* %71
%73 = fadd double %55, %72
%74 = add nsw i64 %54, 1
%75 = trunc i64 %74 to i32
%76 = icmp eq i32 %52, %75
br i1 %76, label %77, label %53
77: ; preds = %53, %6
%78 = phi double [ 0.000000e+00, %6 ], [ %70, %53 ]
%79 = phi double [ 0.000000e+00, %6 ], [ %73, %53 ]
%80 = call double @glb_likelihood(double %79, double %78)
%81 = load double, double* %3
%82 = load double, double* %4
%83 = call i64 @glb_prior(double %81, double 0.000000e+00, double %82)
%84 = load double, double* %33
%85 = getelementptr inbounds double, double* %4, i64 1
%86 = load double, double* %85
%87 = call i64 @glb_prior(double %84, double 0.000000e+00, double %86)
%88 = add nsw i64 %87, %83
%89 = load double, double* %7
%90 = getelementptr inbounds double, double* %4, i64 2
%91 = load double, double* %90
%92 = call i64 @glb_prior(double %43, double %89, double %91)
%93 = add nsw i64 %88, %92
%94 = load double, double* %8
%95 = getelementptr inbounds double, double* %4, i64 3
%96 = load double, double* %95
%97 = call i64 @glb_prior(double %46, double %94, double %96)
%98 = add nsw i64 %93, %97
%99 = sitofp i64 %98 to double
%100 = fadd double %80, %99
ret double %100
}