#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 */
scalar_t__ BlastScoreChk(int, int);
double exp(double);
double pow(double, int);
double BlastKarlinLambdaBis(double *sfp, int min, int max) {
  double *sprob;
  double lambda, up, newval;
  int i, low, high;
  int j;
  double sum, x0, x1;
  low = min;
  high = max;
  if (BlastScoreChk(low, high) != 0)
    return -1.;
  sprob = sfp;
  up = 0.5;
  for (lambda = 0.;;) {
    up *= 2;
    x0 = exp((double)up);
    x1 = pow((double)x0, low - 1);
    if (x1 > 0.) {
      for (sum = 0., i = low; i <= high; ++i)
        sum += sprob[i] * (x1 *= x0);
    } else {
      for (sum = 0., i = low; i <= high; ++i)
        sum += sprob[i] * exp(up * i);
    }
    if (sum >= 1.0)
      break;
    lambda = up;
  }
  for (j = 0; j < 17; ++j) {
    newval = (lambda + up) / 2.;
    x0 = exp((double)newval);
    x1 = pow((double)x0, low - 1);
    if (x1 > 0.) {
      for (sum = 0., i = low; i <= high; ++i)
        sum += sprob[i] * (x1 *= x0);
    } else {
      for (sum = 0., i = low; i <= high; ++i)
        sum += sprob[i] * exp(newval * i);
    }
    if (sum > 1.0)
      up = newval;
    else
      lambda = newval;
  }
  return (lambda + up) / 2.;
}


x86 assembly (clang, -O0):
<BlastKarlinLambdaBis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1030 <BlastScoreChk@plt>
cmp    $0x0,%rax
je     1175 <BlastKarlinLambdaBis+0x45>
movsd  0xead(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1453 <BlastKarlinLambdaBis+0x323>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe6e(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%edi
sub    $0x1,%edi
call   1050 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1235 <BlastKarlinLambdaBis+0x105>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1230 <BlastKarlinLambdaBis+0x100>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  -0x60(%rbp),%xmm2
movsd  %xmm2,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e8 <BlastKarlinLambdaBis+0xb8>
jmp    12a1 <BlastKarlinLambdaBis+0x171>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     129c <BlastKarlinLambdaBis+0x16c>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x3c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1243 <BlastKarlinLambdaBis+0x113>
jmp    12a1 <BlastKarlinLambdaBis+0x171>
movsd  -0x50(%rbp),%xmm0
movsd  0xd62(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12bd <BlastKarlinLambdaBis+0x18d>
jmp    12cc <BlastKarlinLambdaBis+0x19c>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1192 <BlastKarlinLambdaBis+0x62>
movl   $0x0,-0x48(%rbp)
cmpl   $0x11,-0x48(%rbp)
jge    1438 <BlastKarlinLambdaBis+0x308>
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  0xd19(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%edi
sub    $0x1,%edi
call   1050 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1389 <BlastKarlinLambdaBis+0x259>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1384 <BlastKarlinLambdaBis+0x254>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  -0x60(%rbp),%xmm2
movsd  %xmm2,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    133c <BlastKarlinLambdaBis+0x20c>
jmp    13f5 <BlastKarlinLambdaBis+0x2c5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     13f0 <BlastKarlinLambdaBis+0x2c0>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x3c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1397 <BlastKarlinLambdaBis+0x267>
jmp    13f5 <BlastKarlinLambdaBis+0x2c5>
movsd  -0x50(%rbp),%xmm0
movsd  0xc0e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    141b <BlastKarlinLambdaBis+0x2eb>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1425 <BlastKarlinLambdaBis+0x2f5>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    142a <BlastKarlinLambdaBis+0x2fa>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12d3 <BlastKarlinLambdaBis+0x1a3>
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  0xbbe(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BlastKarlinLambdaBis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %edx,%r13d
mov    %esi,%r15d
mov    %rdi,%rbx
mov    %esi,%edi
mov    %edx,%esi
call   1030 <BlastScoreChk@plt>
test   %rax,%rax
je     1162 <BlastKarlinLambdaBis+0x32>
movsd  0xea3(%rip),%xmm0
jmp    1521 <BlastKarlinLambdaBis+0x3f1>
lea    -0x1(%r15),%eax
mov    %eax,0x24(%rsp)
movslq %r15d,%rax
lea    0x1(%r13),%r14d
mov    %r14d,%ecx
sub    %r15d,%ecx
mov    %r13d,%edx
sub    %r15d,%edx
mov    %edx,0x20(%rsp)
mov    %ecx,0x1c(%rsp)
and    $0x3,%ecx
mov    %ecx,0x40(%rsp)
mov    %rax,0x10(%rsp)
lea    (%rbx,%rax,8),%rax
mov    %rax,0x28(%rsp)
movsd  0xe66(%rip),%xmm3
xorpd  %xmm0,%xmm0
jmp    11c6 <BlastKarlinLambdaBis+0x96>
nopl   0x0(%rax,%rax,1)
movsd  0xe58(%rip),%xmm0
ucomisd %xmm0,%xmm4
movapd %xmm3,%xmm0
jae    1335 <BlastKarlinLambdaBis+0x205>
movsd  %xmm0,0x30(%rsp)
addsd  %xmm3,%xmm3
movapd %xmm3,0x50(%rsp)
movapd %xmm3,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x24(%rsp),%edi
call   1050 <pow@plt>
ucomisd 0xe22(%rip),%xmm0
jbe    1260 <BlastKarlinLambdaBis+0x130>
xorpd  %xmm4,%xmm4
cmp    %r15d,%r13d
movapd 0x50(%rsp),%xmm3
movsd  0x8(%rsp),%xmm5
jl     11b0 <BlastKarlinLambdaBis+0x80>
mov    0x40(%rsp),%ecx
xorpd  %xmm4,%xmm4
test   %ecx,%ecx
je     12c9 <BlastKarlinLambdaBis+0x199>
mov    0x10(%rsp),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulsd  %xmm5,%xmm0
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm4
add    $0x1,%rax
add    $0xffffffff,%ecx
jne    1230 <BlastKarlinLambdaBis+0x100>
cmpl   $0x3,0x20(%rsp)
jae    12e0 <BlastKarlinLambdaBis+0x1b0>
jmp    11b0 <BlastKarlinLambdaBis+0x80>
nopw   0x0(%rax,%rax,1)
xorpd  %xmm4,%xmm4
cmp    %r15d,%r13d
movapd 0x50(%rsp),%xmm3
jl     11b0 <BlastKarlinLambdaBis+0x80>
xorpd  %xmm4,%xmm4
mov    0x28(%rsp),%r12
mov    %r15d,%ebp
nop
movsd  %xmm4,0x8(%rsp)
movsd  (%r12),%xmm0
movsd  %xmm0,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  %xmm3,%xmm0
call   1040 <exp@plt>
movsd  0x8(%rsp),%xmm4
movapd 0x50(%rsp),%xmm3
mulsd  0x38(%rsp),%xmm0
addsd  %xmm0,%xmm4
add    $0x1,%ebp
add    $0x8,%r12
cmp    %ebp,%r14d
jne    1280 <BlastKarlinLambdaBis+0x150>
jmp    11b0 <BlastKarlinLambdaBis+0x80>
mov    0x10(%rsp),%rax
cmpl   $0x3,0x20(%rsp)
jb     11b0 <BlastKarlinLambdaBis+0x80>
nopl   0x0(%rax)
mulsd  %xmm5,%xmm0
movapd %xmm5,%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%rbx,%rax,8),%xmm0
addsd  %xmm4,%xmm0
movapd %xmm5,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x8(%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm5,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x10(%rbx,%rax,8),%xmm2
addsd  %xmm1,%xmm2
movsd  0x18(%rbx,%rax,8),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
add    $0x4,%rax
cmp    %eax,%r14d
jne    12e0 <BlastKarlinLambdaBis+0x1b0>
jmp    11b0 <BlastKarlinLambdaBis+0x80>
andl   $0x3,0x1c(%rsp)
mov    0x10(%rsp),%rax
lea    (%rbx,%rax,8),%rax
mov    %rax,0x60(%rsp)
xor    %r12d,%r12d
mov    %r13,0x28(%rsp)
jmp    1390 <BlastKarlinLambdaBis+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpltsd %xmm3,%xmm0
movapd 0x40(%rsp),%xmm1
andpd  %xmm0,%xmm1
andnpd 0x50(%rsp),%xmm0
orpd   %xmm1,%xmm0
add    $0x1,%r12d
movapd %xmm0,%xmm3
cmp    $0x11,%r12d
mov    0x28(%rsp),%r13
je     1513 <BlastKarlinLambdaBis+0x3e3>
movapd %xmm3,0x50(%rsp)
addsd  0x30(%rsp),%xmm3
mulsd  0xc64(%rip),%xmm3
movapd %xmm3,0x40(%rsp)
movapd %xmm3,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x24(%rsp),%edi
call   1050 <pow@plt>
ucomisd 0xc4e(%rip),%xmm0
jbe    1430 <BlastKarlinLambdaBis+0x300>
xorpd  %xmm3,%xmm3
cmp    %r15d,%r13d
movsd  0x8(%rsp),%xmm4
jl     14f0 <BlastKarlinLambdaBis+0x3c0>
mov    0x1c(%rsp),%ecx
xorpd  %xmm3,%xmm3
test   %ecx,%ecx
je     1492 <BlastKarlinLambdaBis+0x362>
mov    0x10(%rsp),%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mulsd  %xmm4,%xmm0
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm3
add    $0x1,%rax
add    $0xffffffff,%ecx
jne    1400 <BlastKarlinLambdaBis+0x2d0>
cmpl   $0x3,0x20(%rsp)
jae    14a0 <BlastKarlinLambdaBis+0x370>
jmp    14f0 <BlastKarlinLambdaBis+0x3c0>
cs nopw 0x0(%rax,%rax,1)
xorpd  %xmm3,%xmm3
cmp    %r15d,%r13d
jl     14f0 <BlastKarlinLambdaBis+0x3c0>
xorpd  %xmm3,%xmm3
mov    0x60(%rsp),%r13
mov    %r15d,%ebp
nopl   0x0(%rax)
movsd  %xmm3,0x8(%rsp)
movsd  0x0(%r13),%xmm0
movsd  %xmm0,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x40(%rsp),%xmm0
call   1040 <exp@plt>
movsd  0x8(%rsp),%xmm3
mulsd  0x38(%rsp),%xmm0
addsd  %xmm0,%xmm3
add    $0x1,%ebp
add    $0x8,%r13
cmp    %ebp,%r14d
jne    1450 <BlastKarlinLambdaBis+0x320>
jmp    14f0 <BlastKarlinLambdaBis+0x3c0>
mov    0x10(%rsp),%rax
cmpl   $0x3,0x20(%rsp)
jb     14f0 <BlastKarlinLambdaBis+0x3c0>
xchg   %ax,%ax
mulsd  %xmm4,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%rbx,%rax,8),%xmm0
addsd  %xmm3,%xmm0
movapd %xmm4,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x8(%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x10(%rbx,%rax,8),%xmm2
addsd  %xmm1,%xmm2
movsd  0x18(%rbx,%rax,8),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
add    $0x4,%rax
cmp    %eax,%r14d
jne    14a0 <BlastKarlinLambdaBis+0x370>
movsd  0xb18(%rip),%xmm0
ucomisd %xmm0,%xmm3
ja     1360 <BlastKarlinLambdaBis+0x230>
movapd 0x40(%rsp),%xmm1
movsd  %xmm1,0x30(%rsp)
jmp    1360 <BlastKarlinLambdaBis+0x230>
addsd  0x30(%rsp),%xmm0
mulsd  0xae7(%rip),%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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