#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 fabs(double);
double stub1(double);
double stub2(double);
double brent(double ax, double bx, double cx, double (*f)(double), double tol,
             double *xmin) {
  int iter;
  double a, b, d, etemp, fu, fv, fw, fx, p, q, r, tol1, tol2, u, v, w, x, xm;
  double e;
  d = e = 0.0;
  a = (ax < cx) ? ax : cx;
  b = (ax > cx) ? ax : cx;
  x = w = v = bx;
  fw = fv = fx = (*f)(x);
  for (iter = 1; iter < 100; ++iter) {
    xm = 0.5 * (a + b);
    tol2 = 2.0 * (tol1 = tol * fabs(x) + 1.0e-10);
    if (fabs(x - xm) <= tol2 - 0.5 * (b - a)) {
      *xmin = x;
      return fx;
    }
    if (fabs(e) > tol1) {
      r = (x - w) * (fx - fv);
      q = (x - v) * (fx - fw);
      p = (x - v) * q - (x - w) * r;
      q = 2.0 * (q - r);
      if (q > 0.0)
        p = -p;
      q = fabs(q);
      etemp = e;
      e = d;
      if (fabs(p) >= fabs(0.5 * q * etemp) || p <= q * (a - x) ||
          p >= q * (b - x))
        d = 0.3819660 * (e = (x >= xm) ? a - x : b - x);
      else {
        d = p / q;
        u = x + d;
        if (u - a < tol2 || b - u < tol2)
          d = (((xm - x) >= 0.0) ? fabs(tol1) : -fabs(tol1));
      }
    } else
      d = 0.3819660 * (e = (x >= xm) ? a - x : b - x);
    u = (fabs(d) >= tol1) ? x + d
                          : x + (((d) >= 0.0) ? fabs(tol1) : -fabs(tol1));
    fu = (*f)(u);
    if (fu <= fx) {
      if (u >= x)
        a = x;
      else
        b = x;
      (v) = (w);
      (w) = (x);
      (x) = (u);
      ;
      (fv) = (fw);
      (fw) = (fx);
      (fx) = (fu);
      ;
    } else {
      if (u < x)
        a = u;
      else
        b = u;
      if (fu <= fw || w == x) {
        v = w;
        w = u;
        fv = fw;
        fw = fu;
      } else if (fu <= fv || v == x || v == w) {
        v = u;
        fv = fu;
      }
    }
  }
  *xmin = x;
  return fx;
}


x86 assembly (clang, -O0):
<brent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1160 <brent+0x60>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
jmp    116d <brent+0x6d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    119c <brent+0x9c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
jmp    11a9 <brent+0xa9>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  -0xc8(%rbp),%xmm0
ff
call   *%rax
movsd  %xmm0,-0x80(%rbp)
movsd  %xmm0,-0x70(%rbp)
movsd  %xmm0,-0x78(%rbp)
movl   $0x1,-0x3c(%rbp)
cmpl   $0x64,-0x3c(%rbp)
jge    1925 <brent+0x825>
movsd  -0x48(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  0xe05(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x30(%rbp),%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
movaps 0xdfd(%rip),%xmm2
pand   %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdcd(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,-0xa0(%rbp)
ff
movsd  0xdb1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm1
ff
subsd  -0xd0(%rbp),%xmm1
ff
movaps 0xdb6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  0xd68(%rip),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     12c9 <brent+0x1c9>
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    193f <brent+0x83f>
movsd  -0xd8(%rbp),%xmm0
ff
movaps 0xd58(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    160e <brent+0x50e>
movsd  -0xc8(%rbp),%xmm0
ff
subsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
subsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
subsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
subsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm1
ff
subsd  -0xc0(%rbp),%xmm1
ff
mulsd  -0x98(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm1
ff
subsd  -0x98(%rbp),%xmm1
ff
movsd  0xc63(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13ed <brent+0x2ed>
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movaps 0xc34(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movaps 0xbff(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xbdb(%rip),%xmm1
mulsd  -0x90(%rbp),%xmm1
ff
mulsd  -0x60(%rbp),%xmm1
movaps 0xbdf(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jae    14b5 <brent+0x3b5>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm2
subsd  -0xc8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    14b5 <brent+0x3b5>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm2
subsd  -0xc8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     1520 <brent+0x420>
movsd  -0xc8(%rbp),%xmm0
ff
ucomisd -0xd0(%rbp),%xmm0
ff
jb     14e5 <brent+0x3e5>
movsd  -0x48(%rbp),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    14fa <brent+0x3fa>
movsd  -0x50(%rbp),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xf0(%rbp),%xmm1
ff
movsd  %xmm1,-0xd8(%rbp)
ff
movsd  0xb0e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1609 <brent+0x509>
movsd  -0x88(%rbp),%xmm0
ff
divsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm1
ff
subsd  -0x48(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
ja     1588 <brent+0x488>
movsd  -0x50(%rbp),%xmm1
subsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1604 <brent+0x504>
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0xc8(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     15c5 <brent+0x4c5>
movsd  -0xa0(%rbp),%xmm0
ff
movaps 0xa7c(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
jmp    15f7 <brent+0x4f7>
movsd  -0xa0(%rbp),%xmm0
ff
movaps 0xa5c(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
jmp    1609 <brent+0x509>
jmp    1674 <brent+0x574>
movsd  -0xc8(%rbp),%xmm0
ff
ucomisd -0xd0(%rbp),%xmm0
ff
jb     163e <brent+0x53e>
movsd  -0x48(%rbp),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
jmp    1653 <brent+0x553>
movsd  -0x50(%rbp),%xmm0
subsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x100(%rbp),%xmm1
ff
movsd  %xmm1,-0xd8(%rbp)
ff
movsd  0x9b5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movaps 0x9b0(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jb     16ac <brent+0x5ac>
movsd  -0xc8(%rbp),%xmm0
ff
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
jmp    173c <brent+0x63c>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     16ee <brent+0x5ee>
movsd  -0xa0(%rbp),%xmm0
ff
movaps 0x953(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
jmp    1720 <brent+0x620>
movsd  -0xa0(%rbp),%xmm0
ff
movaps 0x933(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x110(%rbp),%xmm0
ff
movsd  -0x118(%rbp),%xmm1
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x108(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  -0xb0(%rbp),%xmm0
ff
call   *%rax
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     17fb <brent+0x6fb>
movsd  -0xb0(%rbp),%xmm0
ff
ucomisd -0xc8(%rbp),%xmm0
ff
jb     179b <brent+0x69b>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
jmp    17a8 <brent+0x6a8>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1912 <brent+0x812>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1827 <brent+0x727>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
jmp    1834 <brent+0x734>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    1864 <brent+0x764>
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd -0xc8(%rbp),%xmm0
ff
jne    189d <brent+0x79d>
jp     189d <brent+0x79d>
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    190d <brent+0x80d>
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    18ee <brent+0x7ee>
movsd  -0xb8(%rbp),%xmm0
ff
ucomisd -0xc8(%rbp),%xmm0
ff
jne    18d2 <brent+0x7d2>
jp     18d2 <brent+0x7d2>
jmp    18ee <brent+0x7ee>
movsd  -0xb8(%rbp),%xmm0
ff
ucomisd -0xc0(%rbp),%xmm0
ff
jne    1908 <brent+0x808>
jp     1908 <brent+0x808>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    190d <brent+0x80d>
jmp    1912 <brent+0x812>
jmp    1917 <brent+0x817>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11f7 <brent+0xf7>
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brent>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
movsd  %xmm3,0x58(%rsp)
mov    %rdi,%r15
movapd %xmm1,0x30(%rsp)
movapd %xmm0,%xmm3
minsd  %xmm2,%xmm3
movapd %xmm3,(%rsp)
maxsd  %xmm2,%xmm0
movapd %xmm0,0x40(%rsp)
movapd %xmm1,%xmm0
call   *%rdi
movapd (%rsp),%xmm7
movapd 0x30(%rsp),%xmm12
movapd 0x40(%rsp),%xmm9
movapd %xmm0,%xmm15
mov    $0x63,%ebp
movapd 0xece(%rip),%xmm11
xorpd  %xmm10,%xmm10
movapd %xmm12,%xmm13
movapd %xmm12,%xmm6
movapd %xmm0,%xmm14
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
movapd %xmm0,0x90(%rsp)
jmp    11f4 <brent+0xf4>
nopl   0x0(%rax)
movapd %xmm7,%xmm1
cmpnlesd %xmm3,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm7,%xmm2
andnpd 0x40(%rsp),%xmm1
orpd   %xmm2,%xmm1
movsd  0x20(%rsp),%xmm2
movapd %xmm4,%xmm14
movapd %xmm1,%xmm9
movapd %xmm5,%xmm1
movsd  0x28(%rsp),%xmm6
movapd %xmm7,%xmm13
movapd 0xe5d(%rip),%xmm11
movapd 0x80(%rsp),%xmm10
movapd %xmm3,%xmm12
movapd %xmm1,%xmm7
movapd %xmm0,%xmm15
add    $0xffffffff,%ebp
je     1597 <brent+0x497>
movsd  %xmm2,0x18(%rsp)
movapd 0x90(%rsp),%xmm8
movapd %xmm9,%xmm1
addsd  %xmm7,%xmm1
mulsd  0xdeb(%rip),%xmm1
movapd %xmm12,%xmm3
movapd 0xe0e(%rip),%xmm2
andpd  %xmm2,%xmm3
mulsd  0x58(%rsp),%xmm3
addsd  0xdd4(%rip),%xmm3
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm12,%xmm4
subsd  %xmm1,%xmm4
andpd  %xmm2,%xmm4
movapd %xmm9,%xmm5
subsd  %xmm7,%xmm5
mulsd  0xdb6(%rip),%xmm5
addsd  %xmm0,%xmm5
ucomisd %xmm4,%xmm5
jae    158d <brent+0x48d>
movapd %xmm10,%xmm4
andpd  %xmm11,%xmm4
ucomisd %xmm3,%xmm4
movsd  %xmm6,0x60(%rsp)
movapd %xmm7,(%rsp)
movsd  %xmm14,0x20(%rsp)
jbe    13b0 <brent+0x2b0>
movapd %xmm12,%xmm4
subsd  %xmm13,%xmm4
movapd %xmm15,%xmm7
subsd  0x18(%rsp),%xmm7
mulsd  %xmm4,%xmm7
movapd %xmm12,%xmm5
subsd  %xmm6,%xmm5
movapd %xmm15,%xmm6
subsd  %xmm14,%xmm6
mulsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm4
mulsd  %xmm6,%xmm5
subsd  %xmm4,%xmm5
subsd  %xmm7,%xmm6
addsd  %xmm6,%xmm6
movapd %xmm6,%xmm2
movapd 0xd51(%rip),%xmm14
andpd  %xmm14,%xmm2
movapd %xmm5,%xmm7
andpd  %xmm14,%xmm7
movapd %xmm2,%xmm4
mulsd  0xd07(%rip),%xmm4
mulsd  %xmm4,%xmm10
andpd  %xmm14,%xmm10
ucomisd %xmm10,%xmm7
movapd (%rsp),%xmm10
jae    13d0 <brent+0x2d0>
movapd %xmm5,%xmm4
xorpd  0xd20(%rip),%xmm4
xorpd  %xmm7,%xmm7
cmpltsd %xmm6,%xmm7
andpd  %xmm7,%xmm4
andnpd %xmm5,%xmm7
orpd   %xmm4,%xmm7
movapd %xmm10,%xmm4
subsd  %xmm12,%xmm4
mulsd  %xmm2,%xmm4
ucomisd %xmm7,%xmm4
jae    13d0 <brent+0x2d0>
movapd %xmm9,%xmm4
subsd  %xmm12,%xmm4
mulsd  %xmm2,%xmm4
ucomisd %xmm4,%xmm7
jae    13d0 <brent+0x2d0>
divsd  %xmm2,%xmm7
movapd %xmm12,%xmm4
addsd  %xmm7,%xmm4
movapd %xmm4,%xmm2
subsd  %xmm10,%xmm2
ucomisd %xmm2,%xmm0
ja     138c <brent+0x28c>
movapd %xmm9,%xmm2
subsd  %xmm4,%xmm2
ucomisd %xmm2,%xmm0
jbe    13fe <brent+0x2fe>
subsd  %xmm12,%xmm1
ucomisd 0xc87(%rip),%xmm1
movapd %xmm3,%xmm7
andpd  %xmm11,%xmm7
jae    13fe <brent+0x2fe>
xorpd  0xc94(%rip),%xmm7
jmp    13fe <brent+0x2fe>
xchg   %ax,%ax
cmpnlesd %xmm12,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm9,%xmm2
andnpd %xmm7,%xmm1
jmp    13e4 <brent+0x2e4>
cs nopw 0x0(%rax,%rax,1)
nop
cmpnlesd %xmm12,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm9,%xmm2
andnpd %xmm10,%xmm1
orpd   %xmm2,%xmm1
subsd  %xmm12,%xmm1
movapd %xmm1,%xmm7
mulsd  0xc1f(%rip),%xmm7
movapd %xmm1,%xmm8
movsd  %xmm15,0x68(%rsp)
movsd  %xmm13,0x28(%rsp)
movapd %xmm7,%xmm1
andpd  %xmm11,%xmm1
ucomisd %xmm3,%xmm1
movapd %xmm7,%xmm0
jae    143a <brent+0x33a>
ucomisd 0xbf9(%rip),%xmm7
andpd  %xmm11,%xmm3
movapd %xmm3,%xmm0
jae    143a <brent+0x33a>
xorpd  0xc06(%rip),%xmm0
movapd %xmm7,0x90(%rsp)
movapd %xmm8,0x80(%rsp)
movapd %xmm9,0x40(%rsp)
addsd  %xmm12,%xmm0
movapd %xmm0,0x70(%rsp)
movapd %xmm12,0x30(%rsp)
call   *%r15
movsd  0x68(%rsp),%xmm4
ucomisd %xmm0,%xmm4
jae    1540 <brent+0x440>
movapd 0x70(%rsp),%xmm7
movapd 0x30(%rsp),%xmm3
ucomisd %xmm7,%xmm3
movapd %xmm7,%xmm1
movsd  0x60(%rsp),%xmm5
ja     149a <brent+0x39a>
movapd (%rsp),%xmm1
movapd %xmm7,%xmm2
cmpltsd %xmm3,%xmm2
movapd 0x40(%rsp),%xmm9
andpd  %xmm2,%xmm9
andnpd %xmm7,%xmm2
orpd   %xmm2,%xmm9
movsd  0x20(%rsp),%xmm14
ucomisd %xmm0,%xmm14
movapd 0xb63(%rip),%xmm11
movsd  0x28(%rsp),%xmm13
movapd 0x80(%rsp),%xmm10
jae    1570 <brent+0x470>
ucomisd %xmm3,%xmm13
jne    14f1 <brent+0x3f1>
jnp    1570 <brent+0x470>
movsd  0x18(%rsp),%xmm2
ucomisd %xmm0,%xmm2
setae  %al
ucomisd %xmm3,%xmm5
setnp  %cl
sete   %dl
and    %cl,%dl
ucomisd %xmm13,%xmm5
setnp  %cl
sete   %bl
and    %cl,%bl
or     %dl,%bl
or     %al,%bl
jne    1525 <brent+0x425>
movapd %xmm2,%xmm0
movapd %xmm5,%xmm7
movapd %xmm0,%xmm2
movapd %xmm4,%xmm0
movapd %xmm7,%xmm6
jmp    11dd <brent+0xdd>
cs nopw 0x0(%rax,%rax,1)
movapd 0x70(%rsp),%xmm3
movapd 0x30(%rsp),%xmm7
ucomisd %xmm7,%xmm3
movapd (%rsp),%xmm5
jb     1190 <brent+0x90>
movapd %xmm7,%xmm5
jmp    1190 <brent+0x90>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm14,%xmm2
movapd %xmm0,%xmm14
movapd %xmm4,%xmm0
movapd %xmm13,%xmm6
movapd %xmm7,%xmm13
jmp    11dd <brent+0xdd>
movapd %xmm15,%xmm0
movapd %xmm12,%xmm3
movsd  %xmm3,(%r14)
add    $0xa8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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