#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 */
double const DBL_EPSILON;
int /*<<< orphan*/ assert(int);
double const fabs(double);
scalar_t__ isnan(double);
double parabolic_interpolate(double, double, double, double, double, double);
double sign(double);
double brentmin(double lb, const double *flbp, double ub, const double *fubp,
                double x, double *fxp, double (*fun)(const double, void *),
                const double tol, void *info, int *neval) {
  assert(lb <= x && x <= ub);
  double flb = (NULL != flbp) ? *flbp : fun(lb, info);
  double fub = (NULL != fubp) ? *fubp : fun(ub, info);
  double fx = (NULL != fxp) ? *fxp : fun(x, info);
  if (NULL == flbp)
    (*neval)++;
  if (NULL == fubp)
    (*neval)++;
  if (NULL == fxp)
    (*neval)++;
  if (fx > flb || fx > fub) {
    if (flb > fub) {
      fx = fub;
      x = ub;
    } else {
      fx = flb;
      x = lb;
    }
  }
  assert(fx <= flb && fx <= fub);
  double diff_old2 = 0., diff_old = 0.;
  double fractol = tol * fabs(x) + 3e-8;
  while ((fabs(x - 0.5 * (ub + lb)) + 0.5 * (ub - lb)) > 2. * fractol) {
    double x_new = parabolic_interpolate(lb, x, ub, flb, fx, fub);
    double diff = fabs(x - x_new);
    if (isnan(x_new) || diff_old < fractol || diff <= 0.5 * diff_old2 ||
        x_new < lb || x_new > ub) {
      x_new = x + 0.38196601125010515179541316563436 *
                      ((2 * x > (lb + ub)) ? (lb - x) : (ub - x));
      diff = fabs(x_new - x);
    }
    x_new = (diff >= fractol) ? x_new : x + fractol * sign(x_new - x);
    double f_new = fun(x_new, info);
    (*neval)++;
    if (f_new < fx) {
      if (x_new >= x) {
        lb = x;
        flb = fx;
      } else {
        ub = x;
        fub = fx;
      }
      x = x_new;
      fx = f_new;
    } else {
      if (x_new >= x) {
        ub = x_new;
        fub = f_new;
      } else {
        lb = x_new;
        flb = f_new;
      }
    }
    diff_old2 = diff_old;
    diff_old = diff;
    fractol = tol * fabs(x) + DBL_EPSILON;
  }
  if (NULL != fxp) {
    *fxp = fx;
  }
  return x;
}


x86 assembly (clang, -O0):
<brentmin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
movsd  %xmm3,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x99(%rbp)
jb     11ba <brentmin+0x6a>
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x99(%rbp)
mov    -0x99(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11eb <brentmin+0x9b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    1202 <brentmin+0xb2>
mov    -0x38(%rbp),%rax
movsd  -0x8(%rbp),%xmm0
mov    -0x48(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
je     1230 <brentmin+0xe0>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    1247 <brentmin+0xf7>
mov    -0x38(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
mov    -0x48(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
je     1275 <brentmin+0x125>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    128c <brentmin+0x13c>
mov    -0x38(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
mov    -0x48(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    12b0 <brentmin+0x160>
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    12c7 <brentmin+0x177>
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
jne    12de <brentmin+0x18e>
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movsd  -0x68(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
ja     12fe <brentmin+0x1ae>
movsd  -0x68(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1340 <brentmin+0x1f0>
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1327 <brentmin+0x1d7>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    133b <brentmin+0x1eb>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1340 <brentmin+0x1f0>
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0xb9(%rbp)
jb     1373 <brentmin+0x223>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xc3f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xc37(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xc0d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xbf5(%rip),%xmm1
mulsd  -0x80(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    173d <brentmin+0x5ed>
movsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm4
movsd  -0x60(%rbp),%xmm5
call   1070 <parabolic_interpolate@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
call   1030 <fabs@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1060 <isnan@plt>
cmp    $0x0,%rax
jne    14db <brentmin+0x38b>
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     14db <brentmin+0x38b>
movsd  -0x90(%rbp),%xmm1
ff
movsd  0xb6e(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    14db <brentmin+0x38b>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     14db <brentmin+0x38b>
movsd  -0x88(%rbp),%xmm0
ff
ucomisd -0x18(%rbp),%xmm0
jbe    1574 <brentmin+0x424>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xb18(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1520 <brentmin+0x3d0>
movsd  -0x8(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
jmp    1532 <brentmin+0x3e2>
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  0xad6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     159c <brentmin+0x44c>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
jmp    15eb <brentmin+0x49b>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x28(%rbp),%xmm0
call   1050 <sign@plt>
movsd  -0xf0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%rax
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1696 <brentmin+0x546>
movsd  -0x88(%rbp),%xmm0
ff
ucomisd -0x28(%rbp),%xmm0
jb     1663 <brentmin+0x513>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1677 <brentmin+0x527>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x28(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
jmp    16e7 <brentmin+0x597>
movsd  -0x88(%rbp),%xmm0
ff
ucomisd -0x28(%rbp),%xmm0
jb     16c8 <brentmin+0x578>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x18(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
jmp    16e2 <brentmin+0x592>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
jmp    16e7 <brentmin+0x597>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm2
movsd  -0xf8(%rbp),%xmm0
ff
mov    0x28c1(%rip),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    13ca <brentmin+0x27a>
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
je     1756 <brentmin+0x606>
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brentmin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movapd %xmm0,0x50(%rsp)
ucomisd %xmm0,%xmm2
setae  %al
movapd %xmm2,0x30(%rsp)
movapd %xmm1,0x20(%rsp)
ucomisd %xmm2,%xmm1
mov    %r9,%r15
mov    %r8,%r12
movsd  %xmm3,0x10(%rsp)
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%rbp
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movapd 0x50(%rsp),%xmm0
test   %rbp,%rbp
je     11a5 <brentmin+0x65>
movsd  0x0(%rbp),%xmm4
jmp    11ae <brentmin+0x6e>
mov    %r12,%rdi
call   *%rbx
movapd %xmm0,%xmm4
test   %r13,%r13
movapd 0x30(%rsp),%xmm1
movapd 0x20(%rsp),%xmm3
movsd  %xmm4,0x8(%rsp)
je     11cd <brentmin+0x8d>
movsd  0x0(%r13),%xmm5
jmp    11ec <brentmin+0xac>
movapd %xmm3,%xmm0
mov    %r12,%rdi
call   *%rbx
movsd  0x8(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm1
movapd %xmm0,%xmm5
test   %r14,%r14
movapd 0x50(%rsp),%xmm2
movsd  %xmm5,0x18(%rsp)
je     1641 <brentmin+0x501>
movsd  (%r14),%xmm0
test   %rbp,%rbp
je     166b <brentmin+0x52b>
test   %r13,%r13
je     1678 <brentmin+0x538>
test   %r14,%r14
je     1685 <brentmin+0x545>
ucomisd %xmm4,%xmm0
seta   %al
ucomisd %xmm5,%xmm0
seta   %cl
or     %al,%cl
je     125a <brentmin+0x11a>
movapd %xmm5,%xmm1
cmpltsd %xmm4,%xmm1
movapd %xmm1,%xmm0
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movapd %xmm5,%xmm0
minsd  %xmm4,%xmm0
movsd  %xmm0,0x48(%rsp)
ucomisd %xmm0,%xmm4
setae  %al
ucomisd %xmm0,%xmm5
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movapd 0xd80(%rip),%xmm1
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm12
andpd  %xmm1,%xmm12
mulsd  0x10(%rsp),%xmm12
addsd  0xd70(%rip),%xmm12
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm10
movapd 0x50(%rsp),%xmm8
addsd  %xmm8,%xmm10
movsd  0xd59(%rip),%xmm0
mulsd  %xmm10,%xmm0
addsd  %xmm2,%xmm0
andpd  %xmm1,%xmm0
movapd %xmm3,%xmm1
subsd  %xmm8,%xmm1
mulsd  0xd43(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm12,%xmm0
addsd  %xmm12,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm2,%xmm1
jbe    161b <brentmin+0x4db>
movapd %xmm3,%xmm2
xorps  %xmm11,%xmm11
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x68(%rsp)
movsd  0x8(%rsp),%xmm3
movsd  0x18(%rsp),%xmm5
movsd  0x48(%rsp),%xmm4
jmp    13db <brentmin+0x29b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm0,%xmm5
movsd  0x10(%rsp),%xmm10
movapd 0x50(%rsp),%xmm8
movapd 0x20(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
movapd 0xcaa(%rip),%xmm7
movsd  0xcc1(%rip),%xmm9
movaps 0x70(%rsp),%xmm11
movapd %xmm1,%xmm0
cmpnlesd %xmm6,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm6,%xmm0
orpd   %xmm0,%xmm2
movapd %xmm4,%xmm0
movapd %xmm1,%xmm12
andpd  %xmm7,%xmm12
mulsd  %xmm10,%xmm12
addsd  0xc9a(%rip),%xmm12
movapd %xmm2,%xmm10
addsd  %xmm8,%xmm10
movapd %xmm10,%xmm6
mulsd  0xc6b(%rip),%xmm6
addsd  %xmm1,%xmm6
andpd  %xmm7,%xmm6
movapd %xmm2,%xmm7
subsd  %xmm8,%xmm7
mulsd  %xmm9,%xmm7
addsd  %xmm6,%xmm7
movapd %xmm12,%xmm6
addsd  %xmm12,%xmm6
ucomisd %xmm6,%xmm7
jbe    1621 <brentmin+0x4e1>
movapd %xmm12,0xa0(%rsp)
movapd %xmm10,0x80(%rsp)
movapd %xmm2,0x20(%rsp)
movapd %xmm8,0x50(%rsp)
movapd %xmm1,0x30(%rsp)
movsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
movsd  %xmm11,0x68(%rsp)
movapd %xmm8,%xmm0
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x48(%rsp)
movsd  %xmm5,0x18(%rsp)
call   1060 <parabolic_interpolate@plt>
movsd  %xmm0,0x98(%rsp)
call   1050 <isnan@plt>
movsd  0x98(%rsp),%xmm6
movsd  0x70(%rsp),%xmm0
movapd 0xa0(%rsp),%xmm5
movapd 0x20(%rsp),%xmm3
movapd 0x50(%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
mulsd  0xbaf(%rip),%xmm0
test   %rax,%rax
jne    14b0 <brentmin+0x370>
ucomisd 0x68(%rsp),%xmm5
ja     14b0 <brentmin+0x370>
movapd %xmm1,%xmm4
subsd  %xmm6,%xmm4
andpd  0xb72(%rip),%xmm4
ucomisd %xmm4,%xmm0
jae    14b0 <brentmin+0x370>
ucomisd %xmm6,%xmm2
ja     14b0 <brentmin+0x370>
ucomisd %xmm3,%xmm6
ja     14b0 <brentmin+0x370>
movapd %xmm6,%xmm0
jmp    14f6 <brentmin+0x3b6>
cs nopw 0x0(%rax,%rax,1)
movapd %xmm1,%xmm4
addsd  %xmm1,%xmm4
movapd 0x80(%rsp),%xmm0
cmpltsd %xmm4,%xmm0
movapd %xmm0,%xmm4
andpd  %xmm2,%xmm4
andnpd %xmm3,%xmm0
orpd   %xmm4,%xmm0
subsd  %xmm1,%xmm0
mulsd  0xb46(%rip),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,%xmm4
subsd  %xmm1,%xmm4
andpd  0xb0a(%rip),%xmm4
ucomisd %xmm5,%xmm4
movapd %xmm4,0x70(%rsp)
jae    1522 <brentmin+0x3e2>
subsd  %xmm1,%xmm0
call   1040 <sign@plt>
movapd 0xa0(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
movapd %xmm0,0x80(%rsp)
mov    %r12,%rdi
call   *%rbx
addl   $0x1,(%r15)
movsd  0x48(%rsp),%xmm4
ucomisd %xmm0,%xmm4
jbe    1580 <brentmin+0x440>
movapd 0x30(%rsp),%xmm2
movapd 0x80(%rsp),%xmm6
ucomisd %xmm2,%xmm6
jb     15c0 <brentmin+0x480>
movapd %xmm4,%xmm3
movapd %xmm2,%xmm8
movsd  0x10(%rsp),%xmm10
movapd 0x20(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
jmp    15de <brentmin+0x49e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd 0x30(%rsp),%xmm1
movapd 0x80(%rsp),%xmm6
ucomisd %xmm1,%xmm6
jae    1330 <brentmin+0x1f0>
movapd %xmm0,%xmm3
movapd %xmm6,%xmm8
movsd  0x10(%rsp),%xmm10
movapd 0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm5
jmp    134e <brentmin+0x20e>
nopw   0x0(%rax,%rax,1)
movapd %xmm4,%xmm5
movsd  0x10(%rsp),%xmm10
movapd 0x50(%rsp),%xmm8
movapd 0x20(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movapd 0xa1a(%rip),%xmm7
movsd  0xa31(%rip),%xmm9
movaps 0x70(%rsp),%xmm11
movapd %xmm2,%xmm1
cmpnlesd %xmm6,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm4,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm2
movapd %xmm0,%xmm4
movapd %xmm6,%xmm1
jmp    137e <brentmin+0x23e>
movsd  0x48(%rsp),%xmm0
test   %r14,%r14
je     162b <brentmin+0x4eb>
movsd  %xmm0,(%r14)
movapd %xmm1,%xmm0
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movapd %xmm1,%xmm0
mov    %r12,%rdi
call   *%rbx
movsd  0x18(%rsp),%xmm5
movsd  0x8(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
movapd 0x50(%rsp),%xmm2
test   %rbp,%rbp
jne    120f <brentmin+0xcf>
addl   $0x1,(%r15)
test   %r13,%r13
jne    1218 <brentmin+0xd8>
addl   $0x1,(%r15)
test   %r14,%r14
jne    1221 <brentmin+0xe1>
addl   $0x1,(%r15)
jmp    1221 <brentmin+0xe1>

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

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