#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*/ assert(int);
int /*<<< orphan*/ is_nan(double);
double quadfit1d_2(double, double, double, double, double, double, double,
                   double (*)(double, void const *), void const *);
double quadfit1d(double limit, double a, double b,
                 double (*unfitnessf)(double, const void *), const void *p) {
  double cente = (a + b) / 2;
  double delta_neg, delta_pos;
  double ei, ej, ek;
  double xi, xj, xk;
  double r1, r2;
  assert(!is_nan(limit));
  assert(!is_nan(a));
  assert(!is_nan(b));
  delta_pos = delta_neg = (b > a ? b - a : a - b) / 2;
  assert(!is_nan(cente));
  assert(!is_nan(delta_neg));
  assert(!is_nan(delta_pos));
  xi = cente - delta_neg;
  xj = cente;
  xk = cente + delta_neg;
  ei = unfitnessf(xi, p);
  ej = unfitnessf(xj, p);
  ek = unfitnessf(xk, p);
  if (!(ej > 0))
    return xj;
  r1 = (ei <= ej) ? ej / ei : ei / ej;
  r2 = (ej <= ek) ? ek / ej : ej / ek;
  if (r1 < 1.0000001 && r2 < 1.0000001) {
    return xj;
  }
  for (;;) {
    assert(!is_nan(ei));
    assert(!is_nan(ej));
    assert(!is_nan(ek));
    if (ei >= ej && ej <= ek) {
      double r;
      assert(!is_nan(xi));
      assert(!is_nan(xj));
      r = quadfit1d_2(limit, xi, xj, xk, ei, ej, ek, unfitnessf, p);
      assert(!is_nan(r));
      return r;
    } else if (ej >= ei && ei <= ek) {
      delta_neg *= 2;
      ek = ej;
      ej = ei;
      xk = xj;
      xj = xi;
      xi = cente - delta_neg;
      assert(!is_nan(xi));
      ei = unfitnessf(xi, p);
    } else if (ei >= ek && ek <= ej) {
      delta_pos *= 2;
      ei = ej;
      ej = ek;
      xi = xj;
      xj = xk;
      xk = cente + delta_pos;
      assert(!is_nan(xk));
      ek = unfitnessf(xk, p);
    } else {
      assert(0);
    }
  }
}


x86 assembly (clang, -O0):
<quadfit1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x18(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x20(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11e8 <quadfit1d+0xb8>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    11fa <quadfit1d+0xca>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  0xdf6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x40(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x48(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x70(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     12f1 <quadfit1d+0x1c1>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1638 <quadfit1d+0x508>
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     131c <quadfit1d+0x1ec>
movsd  -0x58(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    132e <quadfit1d+0x1fe>
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1366 <quadfit1d+0x236>
movsd  -0x60(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    1378 <quadfit1d+0x248>
movsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xc78(%rip),%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    13c0 <quadfit1d+0x290>
movsd  0xc65(%rip),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    13c0 <quadfit1d+0x290>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1638 <quadfit1d+0x508>
jmp    13c5 <quadfit1d+0x295>
movsd  -0x50(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x58(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x60(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jb     14de <quadfit1d+0x3ae>
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     14de <quadfit1d+0x3ae>
movsd  -0x68(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x70(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm4
movsd  -0x58(%rbp),%xmm5
movsd  -0x60(%rbp),%xmm6
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <quadfit1d_2@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    1638 <quadfit1d+0x508>
movsd  -0x58(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     1580 <quadfit1d+0x450>
movsd  -0x50(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1580 <quadfit1d+0x450>
movsd  0xaf6(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x28(%rbp),%rax
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x50(%rbp)
jmp    162e <quadfit1d+0x4fe>
movsd  -0x50(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jb     1622 <quadfit1d+0x4f2>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1622 <quadfit1d+0x4f2>
movsd  0xa54(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1050 <is_nan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x28(%rbp),%rax
movsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x60(%rbp)
jmp    1629 <quadfit1d+0x4f9>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    162e <quadfit1d+0x4fe>
jmp    1633 <quadfit1d+0x503>
jmp    13c5 <quadfit1d+0x295>
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadfit1d>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,0x30(%rsp)
movapd %xmm1,%xmm3
addsd  %xmm2,%xmm3
mulsd  0xea2(%rip),%xmm3
movsd  %xmm3,0x18(%rsp)
movsd  %xmm0,0x58(%rsp)
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movaps 0x30(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm0
movapd 0x30(%rsp),%xmm2
subsd  %xmm2,%xmm0
movapd %xmm2,%xmm1
subsd  %xmm3,%xmm1
cmpltsd %xmm3,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
mulsd  0xe20(%rip),%xmm2
movapd %xmm2,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movaps 0x30(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movaps 0x30(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm0
movapd 0x30(%rsp),%xmm2
subsd  %xmm2,%xmm0
movapd %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %r14,%rdi
call   *%r15
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
mov    %r14,%rdi
call   *%r15
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %r14,%rdi
call   *%r15
movsd  0x8(%rsp),%xmm5
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm5
jbe    152e <quadfit1d+0x3fe>
movsd  0x28(%rsp),%xmm4
ucomisd %xmm4,%xmm5
jae    12a8 <quadfit1d+0x178>
movapd %xmm4,%xmm1
divsd  %xmm5,%xmm1
jmp    12b0 <quadfit1d+0x180>
movapd %xmm5,%xmm1
divsd  %xmm4,%xmm1
movsd  0x10(%rsp),%xmm7
ucomisd %xmm5,%xmm0
jae    12c6 <quadfit1d+0x196>
movapd %xmm5,%xmm2
divsd  %xmm0,%xmm2
jmp    12ce <quadfit1d+0x19e>
movapd %xmm0,%xmm2
divsd  %xmm5,%xmm2
movsd  0xd32(%rip),%xmm3
ucomisd %xmm1,%xmm3
jbe    12e6 <quadfit1d+0x1b6>
ucomisd %xmm2,%xmm3
ja     152e <quadfit1d+0x3fe>
movsd  0x18(%rsp),%xmm6
movapd 0x30(%rsp),%xmm1
movsd  %xmm1,0x50(%rsp)
movsd  0x20(%rsp),%xmm2
movapd %xmm4,%xmm1
movapd %xmm0,%xmm3
movsd  %xmm7,0x40(%rsp)
movapd %xmm5,%xmm0
ucomisd %xmm5,%xmm1
movsd  %xmm6,0x20(%rsp)
movsd  %xmm2,0x48(%rsp)
setb   %al
ucomisd %xmm5,%xmm3
setb   %bpl
or     %al,%bpl
ucomisd %xmm1,%xmm5
setb   %al
ucomisd %xmm1,%xmm3
setb   %r12b
or     %al,%r12b
ucomisd %xmm3,%xmm1
setb   %al
movsd  %xmm5,0x28(%rsp)
movsd  %xmm3,0x8(%rsp)
ucomisd %xmm3,%xmm5
setb   %bl
or     %al,%bl
movsd  %xmm1,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm1,%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x28(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
test   %bpl,%bpl
je     14b1 <quadfit1d+0x381>
test   %r12b,%r12b
je     13e0 <quadfit1d+0x2b0>
test   %bl,%bl
je     1450 <quadfit1d+0x320>
xor    %edi,%edi
call   1040 <assert@plt>
movsd  0x10(%rsp),%xmm1
jmp    1370 <quadfit1d+0x240>
nopl   0x0(%rax,%rax,1)
movsd  0x50(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  0x18(%rsp),%xmm0
movsd  %xmm1,0x50(%rsp)
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   *%r15
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
jmp    130c <quadfit1d+0x1dc>
nopl   0x0(%rax,%rax,1)
movapd 0x30(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  0x18(%rsp),%xmm0
movapd %xmm1,0x30(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x10(%rsp),%xmm0
mov    %r14,%rdi
call   *%r15
movsd  0x10(%rsp),%xmm7
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
movsd  0x40(%rsp),%xmm6
jmp    12fe <quadfit1d+0x1ce>
movsd  0x48(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x20(%rsp),%xmm0
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x58(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movsd  0x28(%rsp),%xmm5
movsd  0x8(%rsp),%xmm6
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <quadfit1d_2@plt>
movsd  %xmm0,0x18(%rsp)
call   1050 <is_nan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
movsd  0x18(%rsp),%xmm0
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @quadfit1d(double %0, double %1, double %2, double (double, i8*)* %3, i8* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double (double, i8*)*
%11 = alloca i8*
%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 double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double (double, i8*)* %3, double (double, i8*)** %10
store i8* %4, i8** %11
%24 = load double, double* %8
%25 = load double, double* %9
%26 = fadd double %24, %25
%27 = fdiv double %26, 2.000000e+00
store double %27, double* %12
%28 = load double, double* %7
%29 = call i32 @is_nan(double %28)
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load double, double* %8
%35 = call i32 @is_nan(double %34)
%36 = icmp ne i32 %35, 0
%37 = xor i1 %36, true
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load double, double* %9
%41 = call i32 @is_nan(double %40)
%42 = icmp ne i32 %41, 0
%43 = xor i1 %42, true
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load double, double* %9
%47 = load double, double* %8
%48 = fcmp ogt double %46, %47
br i1 %48, label %49, label %53
49: ; preds = %5
%50 = load double, double* %9
%51 = load double, double* %8
%52 = fsub double %50, %51
br label %57
53: ; preds = %5
%54 = load double, double* %8
%55 = load double, double* %9
%56 = fsub double %54, %55
br label %57
57: ; preds = %53, %49
%58 = phi double [ %52, %49 ], [ %56, %53 ]
%59 = fdiv double %58, 2.000000e+00
store double %59, double* %13
store double %59, double* %14
%60 = load double, double* %12
%61 = call i32 @is_nan(double %60)
%62 = icmp ne i32 %61, 0
%63 = xor i1 %62, true
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = load double, double* %13
%67 = call i32 @is_nan(double %66)
%68 = icmp ne i32 %67, 0
%69 = xor i1 %68, true
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = load double, double* %14
%73 = call i32 @is_nan(double %72)
%74 = icmp ne i32 %73, 0
%75 = xor i1 %74, true
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = load double, double* %12
%79 = load double, double* %13
%80 = fsub double %78, %79
store double %80, double* %18
%81 = load double, double* %12
store double %81, double* %19
%82 = load double, double* %12
%83 = load double, double* %13
%84 = fadd double %82, %83
store double %84, double* %20
%85 = load double (double, i8*)*, double (double, i8*)** %10
%86 = load double, double* %18
%87 = load i8*, i8** %11
%88 = call double %85(double %86, i8* %87)
store double %88, double* %15
%89 = load double (double, i8*)*, double (double, i8*)** %10
%90 = load double, double* %19
%91 = load i8*, i8** %11
%92 = call double %89(double %90, i8* %91)
store double %92, double* %16
%93 = load double (double, i8*)*, double (double, i8*)** %10
%94 = load double, double* %20
%95 = load i8*, i8** %11
%96 = call double %93(double %94, i8* %95)
store double %96, double* %17
%97 = load double, double* %16
%98 = fcmp ogt double %97, 0.000000e+00
br i1 %98, label %101, label %99
99: ; preds = %57
%100 = load double, double* %19
store double %100, double* %6
br label %253
101: ; preds = %57
%102 = load double, double* %15
%103 = load double, double* %16
%104 = fcmp ole double %102, %103
br i1 %104, label %105, label %109
105: ; preds = %101
%106 = load double, double* %16
%107 = load double, double* %15
%108 = fdiv double %106, %107
br label %113
109: ; preds = %101
%110 = load double, double* %15
%111 = load double, double* %16
%112 = fdiv double %110, %111
br label %113
113: ; preds = %109, %105
%114 = phi double [ %108, %105 ], [ %112, %109 ]
store double %114, double* %21
%115 = load double, double* %16
%116 = load double, double* %17
%117 = fcmp ole double %115, %116
br i1 %117, label %118, label %122
118: ; preds = %113
%119 = load double, double* %17
%120 = load double, double* %16
%121 = fdiv double %119, %120
br label %126
122: ; preds = %113
%123 = load double, double* %16
%124 = load double, double* %17
%125 = fdiv double %123, %124
br label %126
126: ; preds = %122, %118
%127 = phi double [ %121, %118 ], [ %125, %122 ]
store double %127, double* %22
%128 = load double, double* %21
%129 = fcmp olt double %128, 0x3FF000001AD7F29B
br i1 %129, label %130, label %135
130: ; preds = %126
%131 = load double, double* %22
%132 = fcmp olt double %131, 0x3FF000001AD7F29B
br i1 %132, label %133, label %135
133: ; preds = %130
%134 = load double, double* %19
store double %134, double* %6
br label %253
135: ; preds = %130, %126
br label %136
136: ; preds = %252, %135
%137 = load double, double* %15
%138 = call i32 @is_nan(double %137)
%139 = icmp ne i32 %138, 0
%140 = xor i1 %139, true
%141 = zext i1 %140 to i32
%142 = call i32 @assert(i32 %141)
%143 = load double, double* %16
%144 = call i32 @is_nan(double %143)
%145 = icmp ne i32 %144, 0
%146 = xor i1 %145, true
%147 = zext i1 %146 to i32
%148 = call i32 @assert(i32 %147)
%149 = load double, double* %17
%150 = call i32 @is_nan(double %149)
%151 = icmp ne i32 %150, 0
%152 = xor i1 %151, true
%153 = zext i1 %152 to i32
%154 = call i32 @assert(i32 %153)
%155 = load double, double* %15
%156 = load double, double* %16
%157 = fcmp oge double %155, %156
br i1 %157, label %158, label %192
158: ; preds = %136
%159 = load double, double* %16
%160 = load double, double* %17
%161 = fcmp ole double %159, %160
br i1 %161, label %162, label %192
162: ; preds = %158
%163 = load double, double* %18
%164 = call i32 @is_nan(double %163)
%165 = icmp ne i32 %164, 0
%166 = xor i1 %165, true
%167 = zext i1 %166 to i32
%168 = call i32 @assert(i32 %167)
%169 = load double, double* %19
%170 = call i32 @is_nan(double %169)
%171 = icmp ne i32 %170, 0
%172 = xor i1 %171, true
%173 = zext i1 %172 to i32
%174 = call i32 @assert(i32 %173)
%175 = load double, double* %7
%176 = load double, double* %18
%177 = load double, double* %19
%178 = load double, double* %20
%179 = load double, double* %15
%180 = load double, double* %16
%181 = load double, double* %17
%182 = load double (double, i8*)*, double (double, i8*)** %10
%183 = load i8*, i8** %11
%184 = call double @quadfit1d_2(double %175, double %176, double %177, double %178, double %179, double %180, double %181, double (double, i8*)* %182, i8* %183)
store double %184, double* %23
%185 = load double, double* %23
%186 = call i32 @is_nan(double %185)
%187 = icmp ne i32 %186, 0
%188 = xor i1 %187, true
%189 = zext i1 %188 to i32
%190 = call i32 @assert(i32 %189)
%191 = load double, double* %23
store double %191, double* %6
br label %253
192: ; preds = %158, %136
%193 = load double, double* %16
%194 = load double, double* %15
%195 = fcmp oge double %193, %194
br i1 %195, label %196, label %220
196: ; preds = %192
%197 = load double, double* %15
%198 = load double, double* %17
%199 = fcmp ole double %197, %198
br i1 %199, label %200, label %220
200: ; preds = %196
%201 = load double, double* %13
%202 = fmul double %201, 2.000000e+00
store double %202, double* %13
%203 = load double, double* %16
store double %203, double* %17
%204 = load double, double* %15
store double %204, double* %16
%205 = load double, double* %19
store double %205, double* %20
%206 = load double, double* %18
store double %206, double* %19
%207 = load double, double* %12
%208 = load double, double* %13
%209 = fsub double %207, %208
store double %209, double* %18
%210 = load double, double* %18
%211 = call i32 @is_nan(double %210)
%212 = icmp ne i32 %211, 0
%213 = xor i1 %212, true
%214 = zext i1 %213 to i32
%215 = call i32 @assert(i32 %214)
%216 = load double (double, i8*)*, double (double, i8*)** %10
%217 = load double, double* %18
%218 = load i8*, i8** %11
%219 = call double %216(double %217, i8* %218)
store double %219, double* %15
br label %251
220: ; preds = %196, %192
%221 = load double, double* %15
%222 = load double, double* %17
%223 = fcmp oge double %221, %222
br i1 %223, label %224, label %248
224: ; preds = %220
%225 = load double, double* %17
%226 = load double, double* %16
%227 = fcmp ole double %225, %226
br i1 %227, label %228, label %248
228: ; preds = %224
%229 = load double, double* %14
%230 = fmul double %229, 2.000000e+00
store double %230, double* %14
%231 = load double, double* %16
store double %231, double* %15
%232 = load double, double* %17
store double %232, double* %16
%233 = load double, double* %19
store double %233, double* %18
%234 = load double, double* %20
store double %234, double* %19
%235 = load double, double* %12
%236 = load double, double* %14
%237 = fadd double %235, %236
store double %237, double* %20
%238 = load double, double* %20
%239 = call i32 @is_nan(double %238)
%240 = icmp ne i32 %239, 0
%241 = xor i1 %240, true
%242 = zext i1 %241 to i32
%243 = call i32 @assert(i32 %242)
%244 = load double (double, i8*)*, double (double, i8*)** %10
%245 = load double, double* %20
%246 = load i8*, i8** %11
%247 = call double %244(double %245, i8* %246)
store double %247, double* %17
br label %250
248: ; preds = %224, %220
%249 = call i32 @assert(i32 0)
br label %250
250: ; preds = %248, %228
br label %251
251: ; preds = %250, %200
br label %252
252: ; preds = %251
br label %136
253: ; preds = %162, %133, %99
%254 = load double, double* %6
ret double %254
}

LLVM IR (-O2):
define double @quadfit1d(double %0, double %1, double %2, double (double, i8*)* %3, i8* %4) {
%6 = fadd double %1, %2
%7 = fmul double %6, 5.000000e-01
%8 = tail call i32 @is_nan(double %0)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32 @is_nan(double %1)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @is_nan(double %2)
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = fcmp ogt double %2, %1
%21 = fsub double %2, %1
%22 = fsub double %1, %2
%23 = select i1 %20, double %21, double %22
%24 = fmul double %23, 5.000000e-01
%25 = tail call i32 @is_nan(double %7)
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i32 @is_nan(double %24)
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = tail call i32 @is_nan(double %24)
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = fsub double %7, %24
%38 = fadd double %7, %24
%39 = tail call double %3(double %37, i8* %4)
%40 = tail call double %3(double %7, i8* %4)
%41 = tail call double %3(double %38, i8* %4)
%42 = fcmp ogt double %40, 0.000000e+00
br i1 %42, label %43, label %134
43: ; preds = %5
%44 = fcmp ugt double %39, %40
br i1 %44, label %47, label %45
45: ; preds = %43
%46 = fdiv double %40, %39
br label %49
47: ; preds = %43
%48 = fdiv double %39, %40
br label %49
49: ; preds = %47, %45
%50 = phi double [ %46, %45 ], [ %48, %47 ]
%51 = fcmp ugt double %40, %41
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = fdiv double %41, %40
br label %56
54: ; preds = %49
%55 = fdiv double %40, %41
br label %56
56: ; preds = %54, %52
%57 = phi double [ %53, %52 ], [ %55, %54 ]
%58 = fcmp olt double %50, 0x3FF000001AD7F29B
%59 = fcmp olt double %57, 0x3FF000001AD7F29B
%60 = select i1 %58, i1 %59, i1 false
br i1 %60, label %134, label %61
61: ; preds = %56, %124
%62 = phi double [ %72, %124 ], [ %39, %56 ]
%63 = phi double [ %73, %124 ], [ %40, %56 ]
%64 = phi double [ %131, %124 ], [ %41, %56 ]
%65 = phi double [ %75, %124 ], [ %37, %56 ]
%66 = phi double [ %76, %124 ], [ %7, %56 ]
%67 = phi double [ %126, %124 ], [ %38, %56 ]
%68 = phi double [ %125, %124 ], [ %24, %56 ]
%69 = phi double [ %77, %124 ], [ %24, %56 ]
br label %70
70: ; preds = %61, %115
%71 = phi double [ %122, %115 ], [ %62, %61 ]
%72 = phi double [ %71, %115 ], [ %63, %61 ]
%73 = phi double [ %72, %115 ], [ %64, %61 ]
%74 = phi double [ %117, %115 ], [ %65, %61 ]
%75 = phi double [ %74, %115 ], [ %66, %61 ]
%76 = phi double [ %75, %115 ], [ %67, %61 ]
%77 = phi double [ %116, %115 ], [ %69, %61 ]
%78 = fcmp ult double %71, %72
%79 = fcmp ugt double %72, %73
%80 = select i1 %78, i1 true, i1 %79
%81 = fcmp ult double %72, %71
%82 = fcmp ugt double %71, %73
%83 = select i1 %81, i1 true, i1 %82
%84 = fcmp ult double %71, %73
%85 = fcmp ugt double %73, %72
%86 = select i1 %84, i1 true, i1 %85
br label %87
87: ; preds = %70, %132
%88 = tail call i32 @is_nan(double %71)
%89 = icmp eq i32 %88, 0
%90 = zext i1 %89 to i32
%91 = tail call i32 @assert(i32 %90)
%92 = tail call i32 @is_nan(double %72)
%93 = icmp eq i32 %92, 0
%94 = zext i1 %93 to i32
%95 = tail call i32 @assert(i32 %94)
%96 = tail call i32 @is_nan(double %73)
%97 = icmp eq i32 %96, 0
%98 = zext i1 %97 to i32
%99 = tail call i32 @assert(i32 %98)
br i1 %80, label %114, label %100
100: ; preds = %87
%101 = tail call i32 @is_nan(double %74)
%102 = icmp eq i32 %101, 0
%103 = zext i1 %102 to i32
%104 = tail call i32 @assert(i32 %103)
%105 = tail call i32 @is_nan(double %75)
%106 = icmp eq i32 %105, 0
%107 = zext i1 %106 to i32
%108 = tail call i32 @assert(i32 %107)
%109 = tail call double @quadfit1d_2(double %0, double %74, double %75, double %76, double %71, double %72, double %73, double (double, i8*)* %3, i8* %4)
%110 = tail call i32 @is_nan(double %109)
%111 = icmp eq i32 %110, 0
%112 = zext i1 %111 to i32
%113 = tail call i32 @assert(i32 %112)
br label %134
114: ; preds = %87
br i1 %83, label %123, label %115
115: ; preds = %114
%116 = fmul double %77, 2.000000e+00
%117 = fsub double %7, %116
%118 = tail call i32 @is_nan(double %117)
%119 = icmp eq i32 %118, 0
%120 = zext i1 %119 to i32
%121 = tail call i32 @assert(i32 %120)
%122 = tail call double %3(double %117, i8* %4)
br label %70
123: ; preds = %114
br i1 %86, label %132, label %124
124: ; preds = %123
%125 = fmul double %68, 2.000000e+00
%126 = fadd double %7, %125
%127 = tail call i32 @is_nan(double %126)
%128 = icmp eq i32 %127, 0
%129 = zext i1 %128 to i32
%130 = tail call i32 @assert(i32 %129)
%131 = tail call double %3(double %126, i8* %4)
br label %61
132: ; preds = %123
%133 = tail call i32 @assert(i32 0)
br label %87
134: ; preds = %56, %5, %100
%135 = phi double [ %109, %100 ], [ %7, %5 ], [ %7, %56 ]
ret double %135
}