#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*/ Lawless416(double *, int *, int, double, double *, double *);
double exp(int);
double fabs(double);
int log(double);
int EVDMaxLikelyFit(double *x, int *c, int n, double *ret_mu,
                    double *ret_lambda) {
  double lambda, mu;
  double fx;
  double dfx;
  double esum;
  double mult;
  double total;
  double tol = 1e-5;
  int i;
  lambda = 0.2;
  for (i = 0; i < 100; i++) {
    Lawless416(x, c, n, lambda, &fx, &dfx);
    if (fabs(fx) < tol)
      break;
    lambda = lambda - fx / dfx;
    if (lambda <= 0.)
      lambda = 0.001;
  }
  if (i == 100) {
    double left, right, mid;
    lambda = right = left = 0.2;
    Lawless416(x, c, n, lambda, &fx, &dfx);
    if (fx < 0.) {
      do {
        left -= 0.1;
        if (left < 0.) {
          return 0;
        }
        Lawless416(x, c, n, left, &fx, &dfx);
      } while (fx < 0.);
    } else {
      do {
        right += 0.1;
        Lawless416(x, c, n, right, &fx, &dfx);
        if (right > 100.) {
          return 0;
        }
      } while (fx > 0.);
    }
    for (i = 0; i < 100; i++) {
      mid = (left + right) / 2.;
      Lawless416(x, c, n, mid, &fx, &dfx);
      if (fabs(fx) < tol)
        break;
      if (fx > 0.)
        left = mid;
      else
        right = mid;
    }
    if (i == 100) {
      return 0;
    }
    lambda = mid;
  }
  esum = 0.;
  total = 0.;
  for (i = 0; i < n; i++) {
    mult = (c == NULL) ? 1. : (double)c[i];
    esum += mult * exp(-1 * lambda * x[i]);
    total += mult;
  }
  mu = -1. * log(esum / total) / lambda;
  *ret_lambda = lambda;
  *ret_mu = mu;
  return 1;
}


x86 assembly (clang, -O0):
<EVDMaxLikelyFit>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe9d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    1200 <EVDMaxLikelyFit+0xd0>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x38(%rbp),%xmm0
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <Lawless416@plt>
movsd  -0x48(%rbp),%xmm1
movaps 0xe9e(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ba <EVDMaxLikelyFit+0x8a>
jmp    1200 <EVDMaxLikelyFit+0xd0>
movsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     11ed <EVDMaxLikelyFit+0xbd>
movsd  0xe28(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11f2 <EVDMaxLikelyFit+0xc2>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    116f <EVDMaxLikelyFit+0x3f>
cmpl   $0x64,-0x74(%rbp)
jne    1423 <EVDMaxLikelyFit+0x2f3>
movsd  0xdee(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xde1(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xdd1(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x38(%rbp),%xmm0
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <Lawless416@plt>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    12c4 <EVDMaxLikelyFit+0x194>
jmp    1264 <EVDMaxLikelyFit+0x134>
movsd  -0x80(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1294 <EVDMaxLikelyFit+0x164>
movl   $0x0,-0x4(%rbp)
jmp    153c <EVDMaxLikelyFit+0x40c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x80(%rbp),%xmm0
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <Lawless416@plt>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
ja     1264 <EVDMaxLikelyFit+0x134>
jmp    1343 <EVDMaxLikelyFit+0x213>
jmp    12c9 <EVDMaxLikelyFit+0x199>
movsd  0xd4f(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x88(%rbp),%xmm0
ff
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <Lawless416@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xd07(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1327 <EVDMaxLikelyFit+0x1f7>
movl   $0x0,-0x4(%rbp)
jmp    153c <EVDMaxLikelyFit+0x40c>
jmp    132c <EVDMaxLikelyFit+0x1fc>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     12c9 <EVDMaxLikelyFit+0x199>
jmp    1343 <EVDMaxLikelyFit+0x213>
movl   $0x0,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    1400 <EVDMaxLikelyFit+0x2d0>
movsd  -0x80(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  0xcbf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x90(%rbp),%xmm0
ff
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <Lawless416@plt>
movsd  -0x48(%rbp),%xmm1
movaps 0xc9f(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13b9 <EVDMaxLikelyFit+0x289>
jmp    1400 <EVDMaxLikelyFit+0x2d0>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13dd <EVDMaxLikelyFit+0x2ad>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
jmp    13ed <EVDMaxLikelyFit+0x2bd>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    13f2 <EVDMaxLikelyFit+0x2c2>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    134a <EVDMaxLikelyFit+0x21a>
cmpl   $0x64,-0x74(%rbp)
jne    1416 <EVDMaxLikelyFit+0x2e6>
movl   $0x0,-0x4(%rbp)
jmp    153c <EVDMaxLikelyFit+0x40c>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14f2 <EVDMaxLikelyFit+0x3c2>
cmpq   $0x0,-0x18(%rbp)
jne    1466 <EVDMaxLikelyFit+0x336>
movsd  0xbdf(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    147b <EVDMaxLikelyFit+0x34b>
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xb93(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    143a <EVDMaxLikelyFit+0x30a>
movsd  -0x58(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
call   1050 <log@plt>
cvtsi2sd %eax,%xmm1
movsd  0xb23(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EVDMaxLikelyFit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r8,0x48(%rsp)
mov    %rcx,0x50(%rsp)
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r12
movsd  0xea8(%rip),%xmm0
mov    $0x64,%ebp
lea    0x8(%rsp),%r14
lea    0x18(%rsp),%r13
nopw   0x0(%rax,%rax,1)
movapd %xmm0,0x20(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r14,%rcx
mov    %r13,%r8
call   1030 <Lawless416@plt>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
andpd  0xeb5(%rip),%xmm1
movsd  0xe65(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     13a0 <EVDMaxLikelyFit+0x270>
divsd  0x18(%rsp),%xmm0
movapd 0x20(%rsp),%xmm2
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
cmpnlesd 0xe76(%rip),%xmm0
andpd  %xmm0,%xmm2
movsd  0xe3a(%rip),%xmm1
andnpd %xmm1,%xmm0
orpd   %xmm0,%xmm2
add    $0xffffffff,%ebp
movapd %xmm2,%xmm0
jne    1170 <EVDMaxLikelyFit+0x40>
movsd  0xe11(%rip),%xmm0
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <Lawless416@plt>
xorpd  %xmm0,%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    1281 <EVDMaxLikelyFit+0x151>
movsd  0xdfe(%rip),%xmm0
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <Lawless416@plt>
movsd  0xdc7(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    12f5 <EVDMaxLikelyFit+0x1c5>
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
xorpd  %xmm0,%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <Lawless416@plt>
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd 0x8(%rsp),%xmm1
jbe    12fd <EVDMaxLikelyFit+0x1cd>
jmp    1481 <EVDMaxLikelyFit+0x351>
lea    0x8(%rsp),%r14
lea    0x18(%rsp),%rbp
movsd  0xd6d(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
addsd  0xd6a(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r14,%rcx
mov    %rbp,%r8
call   1030 <Lawless416@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xd4b(%rip),%xmm0
ja     1440 <EVDMaxLikelyFit+0x310>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     12a0 <EVDMaxLikelyFit+0x170>
movsd  0xd0d(%rip),%xmm1
jmp    12fd <EVDMaxLikelyFit+0x1cd>
movsd  0xd1b(%rip),%xmm1
mov    $0x64,%ebp
lea    0x8(%rsp),%r13
lea    0x18(%rsp),%r14
jmp    1330 <EVDMaxLikelyFit+0x200>
xchg   %ax,%ax
xorpd  %xmm1,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd 0x30(%rsp),%xmm1
orpd   %xmm2,%xmm1
add    $0xffffffff,%ebp
je     1440 <EVDMaxLikelyFit+0x310>
movapd %xmm1,0x30(%rsp)
movapd %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0xce0(%rip),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movapd %xmm0,0x20(%rsp)
mov    %r13,%rcx
mov    %r14,%r8
call   1030 <Lawless416@plt>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
andpd  0xcdd(%rip),%xmm1
movsd  0xc8d(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     13a0 <EVDMaxLikelyFit+0x270>
ucomisd 0xcb7(%rip),%xmm0
movapd 0x20(%rsp),%xmm2
ja     1310 <EVDMaxLikelyFit+0x1e0>
movsd  %xmm2,0x10(%rsp)
jmp    1310 <EVDMaxLikelyFit+0x1e0>
test   %ebx,%ebx
movapd 0x20(%rsp),%xmm0
jle    1444 <EVDMaxLikelyFit+0x314>
movapd 0xcaa(%rip),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x60(%rsp)
mov    %ebx,%ebp
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
jmp    1416 <EVDMaxLikelyFit+0x2e6>
xchg   %ax,%ax
movsd  %xmm0,0x58(%rsp)
movsd  (%r12,%rbx,8),%xmm0
mulsd  0x60(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <exp@plt>
movsd  0x58(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x30(%rsp),%xmm1
addsd  %xmm2,%xmm1
add    $0x1,%rbx
cmp    %rbx,%rbp
je     143a <EVDMaxLikelyFit+0x30a>
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0xc0e(%rip),%xmm0
test   %r15,%r15
je     13d0 <EVDMaxLikelyFit+0x2a0>
xorps  %xmm0,%xmm0
cvtsi2sdl (%r15,%rbx,4),%xmm0
jmp    13d0 <EVDMaxLikelyFit+0x2a0>
divsd  %xmm1,%xmm0
jmp    144c <EVDMaxLikelyFit+0x31c>
xor    %eax,%eax
jmp    1481 <EVDMaxLikelyFit+0x351>
movsd  0xbe4(%rip),%xmm0
call   1050 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  0xc00(%rip),%xmm0
movapd 0x20(%rsp),%xmm1
divsd  %xmm1,%xmm0
mov    0x48(%rsp),%rax
movsd  %xmm1,(%rax)
mov    0x50(%rsp),%rax
movsd  %xmm0,(%rax)
mov    $0x1,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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