double brent(ax, bx, fbx, cx, f, tol, xmin)
double ax, bx, fbx, cx, tol, *xmin;
double (*f)();
{
  int iter;
  double a, b, d, etemp, fu, fv, fw, fx, p, q, r, tol1, tol2, u, v, w, x, xm;
  double e = 0.0;
  a = ((ax < cx) ? ax : cx);
  b = ((ax > cx) ? ax : cx);
  x = w = v = bx;
  fw = fv = fx = fbx;
  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.38196601125 * (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.38196601125 * (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;
      }
    }
  }
  printf("Too many iterations in BRENT()\n");
  *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)
movsd  %xmm3,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    116d <brent+0x5d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
jmp    117a <brent+0x6a>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11a9 <brent+0x99>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    11b6 <brent+0xa6>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  %xmm0,-0x78(%rbp)
movsd  %xmm0,-0x80(%rbp)
movl   $0x1,-0x44(%rbp)
cmpl   $0x64,-0x44(%rbp)
jg     1940 <brent+0x830>
movsd  -0x50(%rbp),%xmm1
addsd  -0x58(%rbp),%xmm1
movsd  0xdfe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x38(%rbp),%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
movaps 0xdf6(%rip),%xmm2
pand   %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdc6(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,-0xa8(%rbp)
ff
movsd  0xdaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
subsd  -0xd8(%rbp),%xmm1
ff
movaps 0xdaf(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x58(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  0xd61(%rip),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     12d3 <brent+0x1c3>
movsd  -0xd0(%rbp),%xmm0
ff
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    196b <brent+0x85b>
movsd  -0xe0(%rbp),%xmm0
ff
movaps 0xd4e(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jbe    161e <brent+0x50e>
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0xc8(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
subsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
subsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
subsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0xd0(%rbp),%xmm1
ff
subsd  -0xc8(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
subsd  -0xa0(%rbp),%xmm1
ff
movsd  0xc53(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13fd <brent+0x2ed>
movsd  -0x90(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movaps 0xc24(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movaps 0xbef(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xbcb(%rip),%xmm1
mulsd  -0x98(%rbp),%xmm1
ff
mulsd  -0x68(%rbp),%xmm1
movaps 0xbcf(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jae    14c5 <brent+0x3b5>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm2
subsd  -0xd0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    14c5 <brent+0x3b5>
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x58(%rbp),%xmm2
subsd  -0xd0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     1530 <brent+0x420>
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd -0xd8(%rbp),%xmm0
ff
jb     14f5 <brent+0x3e5>
movsd  -0x50(%rbp),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf8(%rbp)
ff
jmp    150a <brent+0x3fa>
movsd  -0x58(%rbp),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xf8(%rbp),%xmm1
ff
movsd  %xmm1,-0xe0(%rbp)
ff
movsd  0xafe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1619 <brent+0x509>
movsd  -0x90(%rbp),%xmm0
ff
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0xd0(%rbp),%xmm0
ff
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm1
ff
subsd  -0x50(%rbp),%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
ja     1598 <brent+0x488>
movsd  -0x58(%rbp),%xmm1
subsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1614 <brent+0x504>
movsd  -0xd8(%rbp),%xmm0
ff
subsd  -0xd0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15d5 <brent+0x4c5>
movsd  -0xa8(%rbp),%xmm0
ff
movaps 0xa6c(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
jmp    1607 <brent+0x4f7>
movsd  -0xa8(%rbp),%xmm0
ff
movaps 0xa4c(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
jmp    1619 <brent+0x509>
jmp    1684 <brent+0x574>
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd -0xd8(%rbp),%xmm0
ff
jb     164e <brent+0x53e>
movsd  -0x50(%rbp),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x108(%rbp)
ff
jmp    1663 <brent+0x553>
movsd  -0x58(%rbp),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x108(%rbp),%xmm1
ff
movsd  %xmm1,-0xe0(%rbp)
ff
movsd  0x9a5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movaps 0x9a0(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jb     16bc <brent+0x5ac>
movsd  -0xd0(%rbp),%xmm0
ff
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
jmp    174c <brent+0x63c>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    16fe <brent+0x5ee>
movsd  -0xa8(%rbp),%xmm0
ff
movaps 0x943(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
jmp    1730 <brent+0x620>
movsd  -0xa8(%rbp),%xmm0
ff
movaps 0x923(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  -0x120(%rbp),%xmm1
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x110(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x30(%rbp),%rcx
movsd  -0xb8(%rbp),%xmm0
ff
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jb     1816 <brent+0x706>
movsd  -0xb8(%rbp),%xmm0
ff
ucomisd -0xd0(%rbp),%xmm0
ff
jb     17b0 <brent+0x6a0>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
jmp    17bd <brent+0x6ad>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    192d <brent+0x81d>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1842 <brent+0x732>
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
jmp    184f <brent+0x73f>
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    187f <brent+0x76f>
movsd  -0xc8(%rbp),%xmm0
ff
ucomisd -0xd0(%rbp),%xmm0
ff
jne    18b8 <brent+0x7a8>
jp     18b8 <brent+0x7a8>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1928 <brent+0x818>
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    1909 <brent+0x7f9>
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd -0xd0(%rbp),%xmm0
ff
jne    18ed <brent+0x7dd>
jp     18ed <brent+0x7dd>
jmp    1909 <brent+0x7f9>
movsd  -0xc0(%rbp),%xmm0
ff
ucomisd -0xc8(%rbp),%xmm0
ff
jne    1923 <brent+0x813>
jp     1923 <brent+0x813>
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1928 <brent+0x818>
jmp    192d <brent+0x81d>
jmp    1932 <brent+0x822>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11fe <brent+0xee>
lea    0x6f9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0xd0(%rbp),%xmm0
ff
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
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    $0x98,%rsp
mov    %rsi,%r14
movsd  %xmm4,0x40(%rsp)
mov    %rdi,%r15
movapd %xmm2,%xmm9
movapd %xmm0,%xmm11
movapd %xmm0,%xmm6
minsd  %xmm3,%xmm6
maxsd  %xmm3,%xmm11
mov    $0x64,%ebp
movapd 0xee2(%rip),%xmm13
xorpd  %xmm12,%xmm12
movapd %xmm1,%xmm14
movapd %xmm1,%xmm10
movapd %xmm2,%xmm15
jmp    11cd <brent+0xbd>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm4,%xmm11
cmpnlesd %xmm5,%xmm11
movapd %xmm11,%xmm2
andpd  %xmm4,%xmm2
andnpd 0x70(%rsp),%xmm11
orpd   %xmm2,%xmm11
movsd  0x10(%rsp),%xmm2
movapd %xmm9,%xmm15
movapd %xmm0,%xmm9
movsd  0x18(%rsp),%xmm10
movapd %xmm4,%xmm14
movapd %xmm5,%xmm1
movapd 0xe77(%rip),%xmm13
movapd 0x60(%rsp),%xmm12
movapd %xmm3,%xmm6
add    $0xffffffff,%ebp
je     157c <brent+0x46c>
movsd  %xmm2,0x8(%rsp)
movapd 0x80(%rsp),%xmm8
movapd %xmm11,%xmm7
addsd  %xmm6,%xmm7
mulsd  0xe12(%rip),%xmm7
movapd %xmm1,%xmm3
movapd 0xe36(%rip),%xmm2
andpd  %xmm2,%xmm3
mulsd  0x40(%rsp),%xmm3
addsd  0xdfc(%rip),%xmm3
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm1,%xmm4
subsd  %xmm7,%xmm4
andpd  %xmm2,%xmm4
movapd %xmm11,%xmm5
subsd  %xmm6,%xmm5
mulsd  0xddf(%rip),%xmm5
addsd  %xmm0,%xmm5
ucomisd %xmm4,%xmm5
jae    15a0 <brent+0x490>
movapd %xmm12,%xmm4
andpd  %xmm13,%xmm4
ucomisd %xmm3,%xmm4
movsd  %xmm10,0x48(%rsp)
movapd %xmm6,0x30(%rsp)
movsd  %xmm15,0x10(%rsp)
jbe    13a0 <brent+0x290>
movapd %xmm1,%xmm4
subsd  %xmm14,%xmm4
movapd %xmm9,%xmm2
subsd  0x8(%rsp),%xmm2
mulsd  %xmm4,%xmm2
movapd %xmm1,%xmm5
subsd  %xmm10,%xmm5
movapd %xmm9,%xmm6
subsd  %xmm15,%xmm6
mulsd  %xmm5,%xmm6
mulsd  %xmm2,%xmm4
mulsd  %xmm6,%xmm5
subsd  %xmm4,%xmm5
subsd  %xmm2,%xmm6
addsd  %xmm6,%xmm6
movapd %xmm6,%xmm10
movapd 0xd78(%rip),%xmm15
andpd  %xmm15,%xmm10
movapd %xmm5,%xmm2
andpd  %xmm15,%xmm2
movapd %xmm10,%xmm4
mulsd  0xd2d(%rip),%xmm4
mulsd  %xmm4,%xmm12
andpd  %xmm15,%xmm12
movapd 0x30(%rsp),%xmm15
ucomisd %xmm12,%xmm2
jae    13c0 <brent+0x2b0>
movapd %xmm5,%xmm4
xorpd  0xd45(%rip),%xmm4
xorpd  %xmm12,%xmm12
cmpltsd %xmm6,%xmm12
andpd  %xmm12,%xmm4
andnpd %xmm5,%xmm12
orpd   %xmm4,%xmm12
movapd %xmm15,%xmm4
subsd  %xmm1,%xmm4
mulsd  %xmm10,%xmm4
ucomisd %xmm12,%xmm4
jae    13c0 <brent+0x2b0>
movapd %xmm11,%xmm4
subsd  %xmm1,%xmm4
mulsd  %xmm10,%xmm4
ucomisd %xmm4,%xmm12
jae    13c0 <brent+0x2b0>
divsd  %xmm10,%xmm12
movapd %xmm1,%xmm4
addsd  %xmm12,%xmm4
movapd %xmm4,%xmm2
subsd  %xmm15,%xmm2
ucomisd %xmm2,%xmm0
ja     136f <brent+0x25f>
movapd %xmm11,%xmm2
subsd  %xmm4,%xmm2
ucomisd %xmm2,%xmm0
jbe    138b <brent+0x27b>
subsd  %xmm1,%xmm7
ucomisd 0xca5(%rip),%xmm7
movapd %xmm3,%xmm12
andpd  %xmm13,%xmm12
jbe    1569 <brent+0x459>
movapd %xmm8,%xmm7
jmp    13e9 <brent+0x2d9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpnlesd %xmm1,%xmm7
movapd %xmm7,%xmm2
andpd  %xmm11,%xmm2
andnpd %xmm6,%xmm7
jmp    13d3 <brent+0x2c3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpnlesd %xmm1,%xmm7
movapd %xmm7,%xmm2
andpd  %xmm11,%xmm2
andnpd %xmm15,%xmm7
orpd   %xmm2,%xmm7
subsd  %xmm1,%xmm7
movapd %xmm7,%xmm12
mulsd  0xc2f(%rip),%xmm12
movsd  %xmm14,0x18(%rsp)
movsd  %xmm9,(%rsp)
movapd %xmm12,%xmm2
andpd  %xmm13,%xmm2
ucomisd %xmm3,%xmm2
movapd %xmm12,%xmm0
jae    1427 <brent+0x317>
ucomisd 0xc0c(%rip),%xmm12
andpd  %xmm13,%xmm3
movapd %xmm3,%xmm0
ja     1427 <brent+0x317>
xorpd  0xc19(%rip),%xmm0
movapd %xmm12,0x80(%rsp)
movapd %xmm7,0x60(%rsp)
movapd %xmm11,0x70(%rsp)
addsd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
mov    $0x1,%al
movapd %xmm1,0x20(%rsp)
call   *%r15
movsd  (%rsp),%xmm9
ucomisd %xmm0,%xmm9
jae    1520 <brent+0x410>
movapd 0x50(%rsp),%xmm5
movapd 0x20(%rsp),%xmm1
ucomisd %xmm5,%xmm1
movapd %xmm5,%xmm3
movsd  0x48(%rsp),%xmm4
ja     1486 <brent+0x376>
movapd 0x30(%rsp),%xmm3
movapd %xmm5,%xmm2
cmpltsd %xmm1,%xmm2
movapd 0x70(%rsp),%xmm11
andpd  %xmm2,%xmm11
andnpd %xmm5,%xmm2
orpd   %xmm2,%xmm11
movsd  0x10(%rsp),%xmm15
ucomisd %xmm0,%xmm15
movapd 0xb77(%rip),%xmm13
movsd  0x18(%rsp),%xmm14
movapd 0x60(%rsp),%xmm12
jae    1550 <brent+0x440>
ucomisd %xmm1,%xmm14
jne    14d6 <brent+0x3c6>
jnp    1550 <brent+0x440>
movsd  0x8(%rsp),%xmm2
ucomisd %xmm0,%xmm2
setae  %al
ucomisd %xmm1,%xmm4
setnp  %cl
sete   %dl
and    %cl,%dl
ucomisd %xmm14,%xmm4
setnp  %cl
sete   %bl
and    %cl,%bl
or     %dl,%bl
or     %al,%bl
jne    150a <brent+0x3fa>
movapd %xmm2,%xmm0
movapd %xmm4,%xmm5
movapd %xmm0,%xmm2
movapd %xmm5,%xmm10
jmp    11c0 <brent+0xb0>
nopl   0x0(%rax,%rax,1)
movapd 0x50(%rsp),%xmm5
movapd 0x20(%rsp),%xmm4
ucomisd %xmm4,%xmm5
movapd 0x30(%rsp),%xmm3
jb     1170 <brent+0x60>
movapd %xmm4,%xmm3
jmp    1170 <brent+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
movapd %xmm15,%xmm2
movapd %xmm0,%xmm15
movapd %xmm14,%xmm10
movapd %xmm5,%xmm14
jmp    11c0 <brent+0xb0>
xorpd  0xace(%rip),%xmm12
movapd %xmm8,%xmm7
jmp    13e9 <brent+0x2d9>
lea    0xacd(%rip),%rdi
movsd  %xmm9,(%rsp)
movapd %xmm1,0x20(%rsp)
call   1030 <puts@plt>
movapd 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm9
movsd  %xmm1,(%r14)
movapd %xmm9,%xmm0
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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