#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 sqrt(double);
double findroot_Ridder(double x1, double x2, double xacc,
                       double (*func)(double)) {
  int j;
  double ans, fhi, flo, fm, fnew, s, xhi, xlo, xm, xnew;
  flo = func(x1);
  fhi = func(x2);
  if (flo == 0.0)
    return x1;
  if (fhi == 0.0)
    return x2;
  ans = 0.5 * (x1 + x2);
  if ((flo > 0.0 && fhi < 0.0) || (flo < 0.0 && fhi > 0.0)) {
    xlo = x1;
    xhi = x2;
    for (j = 1; j <= 60; j++) {
      xm = 0.5 * (xlo + xhi);
      fm = func(xm);
      s = sqrt(fm * fm - flo * fhi);
      if (s == 0.0)
        return ans;
      xnew = xm + (xm - xlo) * ((flo >= fhi ? 1.0 : -1.0) * fm / s);
      if (fabs(xnew - ans) <= xacc)
        break;
      ans = xnew;
      fnew = func(ans);
      if (((fnew) >= 0.0 ? fabs(fm) : -fabs(fm)) != fm) {
        xlo = xm;
        flo = fm;
        xhi = ans;
        fhi = fnew;
      } else if (((fnew) >= 0.0 ? fabs(flo) : -fabs(flo)) != flo) {
        xhi = ans;
        fhi = fnew;
      } else if (((fnew) >= 0.0 ? fabs(fhi) : -fabs(fhi)) != fhi) {
        xlo = ans;
        flo = fnew;
      } else
        return ans;
      if (fabs(xhi - xlo) <= xacc)
        return ans;
    }
    return ans;
  }
  return -1.e20;
}


x86 assembly (clang, -O0):
<findroot_Ridder>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1175 <findroot_Ridder+0x65>
jp     1175 <findroot_Ridder+0x65>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    119c <findroot_Ridder+0x8c>
jp     119c <findroot_Ridder+0x8c>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe52(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d7 <findroot_Ridder+0xc7>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
ja     11f7 <findroot_Ridder+0xe7>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1583 <findroot_Ridder+0x473>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1583 <findroot_Ridder+0x473>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x3c,-0x2c(%rbp)
jg     1574 <findroot_Ridder+0x464>
movsd  -0x70(%rbp),%xmm1
addsd  -0x68(%rbp),%xmm1
movsd  0xdd2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x78(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12ab <findroot_Ridder+0x19b>
jp     12ab <findroot_Ridder+0x19b>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
movsd  -0x78(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm2
movsd  0xd44(%rip),%xmm5
movsd  0xd44(%rip),%xmm4
cmplesd %xmm3,%xmm2
movaps %xmm2,%xmm3
andpd  %xmm5,%xmm3
andnpd %xmm4,%xmm2
orpd   %xmm3,%xmm2
mulsd  -0x50(%rbp),%xmm2
divsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
movaps 0xd10(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1328 <findroot_Ridder+0x218>
jmp    1574 <findroot_Ridder+0x464>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x38(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1371 <findroot_Ridder+0x261>
movsd  -0x50(%rbp),%xmm0
movaps 0xcc0(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    13a0 <findroot_Ridder+0x290>
movsd  -0x50(%rbp),%xmm0
movaps 0xca3(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
ucomisd -0x50(%rbp),%xmm0
jne    13be <findroot_Ridder+0x2ae>
jp     13be <findroot_Ridder+0x2ae>
jmp    13eb <findroot_Ridder+0x2db>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    152e <findroot_Ridder+0x41e>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     141a <findroot_Ridder+0x30a>
movsd  -0x48(%rbp),%xmm0
movaps 0xc17(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1449 <findroot_Ridder+0x339>
movsd  -0x48(%rbp),%xmm0
movaps 0xbfa(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
ucomisd -0x48(%rbp),%xmm0
jne    1467 <findroot_Ridder+0x357>
jp     1467 <findroot_Ridder+0x357>
jmp    1480 <findroot_Ridder+0x370>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1529 <findroot_Ridder+0x419>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     14af <findroot_Ridder+0x39f>
movsd  -0x40(%rbp),%xmm0
movaps 0xb82(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    14de <findroot_Ridder+0x3ce>
movsd  -0x40(%rbp),%xmm0
movaps 0xb65(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
ucomisd -0x40(%rbp),%xmm0
jne    14fc <findroot_Ridder+0x3ec>
jp     14fc <findroot_Ridder+0x3ec>
jmp    1515 <findroot_Ridder+0x405>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1524 <findroot_Ridder+0x414>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
jmp    1529 <findroot_Ridder+0x419>
jmp    152e <findroot_Ridder+0x41e>
movsd  -0x68(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
movaps 0xae1(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1561 <findroot_Ridder+0x451>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
jmp    1566 <findroot_Ridder+0x456>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1212 <findroot_Ridder+0x102>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1590 <findroot_Ridder+0x480>
movsd  0xa7d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findroot_Ridder>:
push   %rbp
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
call   *%rdi
movaps %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
call   *%rbx
movapd 0x30(%rsp),%xmm4
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jne    1158 <findroot_Ridder+0x48>
jp     1158 <findroot_Ridder+0x48>
movsd  0x8(%rsp),%xmm7
jmp    1170 <findroot_Ridder+0x60>
movsd  0x8(%rsp),%xmm5
movsd  0x20(%rsp),%xmm2
ucomisd %xmm0,%xmm3
jne    117b <findroot_Ridder+0x6b>
jp     117b <findroot_Ridder+0x6b>
movapd %xmm2,%xmm7
movapd %xmm7,%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jbe    118b <findroot_Ridder+0x7b>
ucomisd %xmm3,%xmm0
ja     11a3 <findroot_Ridder+0x93>
ucomisd %xmm4,%xmm0
movsd  0xe71(%rip),%xmm7
jbe    1170 <findroot_Ridder+0x60>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    1170 <findroot_Ridder+0x60>
movapd %xmm5,%xmm7
addsd  %xmm2,%xmm7
mulsd  0xe4d(%rip),%xmm7
mov    $0x3b,%ebp
nopl   0x0(%rax,%rax,1)
movsd  %xmm7,0x10(%rsp)
movapd %xmm4,0x30(%rsp)
movapd %xmm3,0x50(%rsp)
movsd  %xmm2,0x20(%rsp)
movapd %xmm2,%xmm0
movsd  %xmm5,0x8(%rsp)
addsd  %xmm5,%xmm0
mulsd  0xe12(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
call   *%rbx
movapd 0x30(%rsp),%xmm9
movapd 0x50(%rsp),%xmm6
movapd %xmm0,%xmm4
movapd %xmm6,%xmm1
mulsd  %xmm9,%xmm1
mulsd  %xmm0,%xmm0
subsd  %xmm1,%xmm0
ucomisd 0xdf0(%rip),%xmm0
movapd %xmm4,0x60(%rsp)
jb     1230 <findroot_Ridder+0x120>
sqrtsd %xmm0,%xmm0
jmp    1248 <findroot_Ridder+0x138>
xchg   %ax,%ax
call   1030 <sqrt@plt>
movapd 0x60(%rsp),%xmm4
movapd 0x30(%rsp),%xmm9
movapd 0x50(%rsp),%xmm6
movsd  0x8(%rsp),%xmm2
movapd 0xdd9(%rip),%xmm8
movsd  0x10(%rsp),%xmm7
ucomisd 0xdab(%rip),%xmm0
jne    126d <findroot_Ridder+0x15d>
jnp    1170 <findroot_Ridder+0x60>
movsd  0x28(%rsp),%xmm5
movapd %xmm5,%xmm1
subsd  %xmm2,%xmm1
movapd %xmm4,%xmm2
xorpd  0xd99(%rip),%xmm2
cmplesd %xmm9,%xmm6
movapd %xmm6,%xmm3
andpd  %xmm4,%xmm3
andnpd %xmm2,%xmm6
orpd   %xmm3,%xmm6
divsd  %xmm0,%xmm6
mulsd  %xmm1,%xmm6
addsd  %xmm5,%xmm6
movapd %xmm6,%xmm0
subsd  %xmm7,%xmm0
andpd  %xmm8,%xmm0
movsd  0x48(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    1170 <findroot_Ridder+0x60>
movapd %xmm6,0x10(%rsp)
movapd %xmm6,%xmm0
call   *%rbx
movapd 0x60(%rsp),%xmm3
movapd 0xd50(%rip),%xmm6
ucomisd 0xd28(%rip),%xmm0
movapd %xmm3,%xmm1
andpd  %xmm6,%xmm1
jae    1330 <findroot_Ridder+0x220>
movapd 0xd26(%rip),%xmm2
xorpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm3
movapd 0x30(%rsp),%xmm4
jne    133e <findroot_Ridder+0x22e>
jp     133e <findroot_Ridder+0x22e>
movapd %xmm4,%xmm1
orpd   %xmm2,%xmm1
ucomisd %xmm1,%xmm4
jne    1368 <findroot_Ridder+0x258>
jp     1368 <findroot_Ridder+0x258>
movapd 0x50(%rsp),%xmm3
movapd %xmm3,%xmm1
orpd   %xmm2,%xmm1
jmp    138c <findroot_Ridder+0x27c>
nopl   0x0(%rax)
ucomisd %xmm3,%xmm1
movapd 0x30(%rsp),%xmm4
jne    133e <findroot_Ridder+0x22e>
jnp    1358 <findroot_Ridder+0x248>
movapd %xmm3,%xmm4
movapd %xmm0,%xmm3
movapd 0x10(%rsp),%xmm7
movapd %xmm7,%xmm2
movsd  0x28(%rsp),%xmm5
jmp    13b0 <findroot_Ridder+0x2a0>
movapd %xmm4,%xmm1
andpd  %xmm6,%xmm1
ucomisd %xmm4,%xmm1
jne    1368 <findroot_Ridder+0x258>
jnp    137e <findroot_Ridder+0x26e>
movapd %xmm0,%xmm3
movapd 0x10(%rsp),%xmm7
movapd %xmm7,%xmm2
movsd  0x8(%rsp),%xmm5
jmp    13b0 <findroot_Ridder+0x2a0>
movapd 0x50(%rsp),%xmm3
movapd %xmm3,%xmm1
andpd  %xmm6,%xmm1
movapd 0x10(%rsp),%xmm7
ucomisd %xmm3,%xmm1
movapd %xmm0,%xmm4
movapd %xmm7,%xmm5
movsd  0x20(%rsp),%xmm2
jne    13b0 <findroot_Ridder+0x2a0>
jnp    1170 <findroot_Ridder+0x60>
nopl   0x0(%rax)
movapd %xmm2,%xmm0
subsd  %xmm5,%xmm0
andpd  %xmm6,%xmm0
sub    $0x1,%ebp
setb   %al
movsd  0x48(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    1170 <findroot_Ridder+0x60>
test   %al,%al
je     11c0 <findroot_Ridder+0xb0>
jmp    1170 <findroot_Ridder+0x60>

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

LLVM IR (-O2):
define double @findroot_Ridder(double %0, double %1, double %2, double (double)* nocapture %3) {
%5 = tail call double %3(double %0)
%6 = tail call double %3(double %1)
%7 = fcmp oeq double %5, 0.000000e+00
br i1 %7, label %81, label %8
8: ; preds = %4
%9 = fcmp oeq double %6, 0.000000e+00
br i1 %9, label %81, label %10
10: ; preds = %8
%11 = fadd double %0, %1
%12 = fmul double %11, 5.000000e-01
%13 = fcmp ogt double %5, 0.000000e+00
%14 = fcmp olt double %6, 0.000000e+00
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = fcmp olt double %5, 0.000000e+00
%18 = fcmp ogt double %6, 0.000000e+00
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %81
20: ; preds = %16, %10
br label %21
21: ; preds = %20, %70
%22 = phi i32 [ %78, %70 ], [ 1, %20 ]
%23 = phi double [ %74, %70 ], [ %0, %20 ]
%24 = phi double [ %73, %70 ], [ %1, %20 ]
%25 = phi double [ %42, %70 ], [ %12, %20 ]
%26 = phi double [ %72, %70 ], [ %6, %20 ]
%27 = phi double [ %71, %70 ], [ %5, %20 ]
%28 = fadd double %24, %23
%29 = fmul double %28, 5.000000e-01
%30 = tail call double %3(double %29)
%31 = fneg double %27
%32 = fmul double %26, %31
%33 = tail call double @llvm.fmuladd.f64(double %30, double %30, double %32)
%34 = tail call double @sqrt(double %33)
%35 = fcmp oeq double %34, 0.000000e+00
br i1 %35, label %81, label %36
36: ; preds = %21
%37 = fsub double %29, %23
%38 = fcmp oge double %27, %26
%39 = fneg double %30
%40 = select i1 %38, double %30, double %39
%41 = fdiv double %40, %34
%42 = tail call double @llvm.fmuladd.f64(double %37, double %41, double %29)
%43 = fsub double %42, %25
%44 = tail call double @llvm.fabs.f64(double %43)
%45 = fcmp ugt double %44, %2
br i1 %45, label %46, label %81
46: ; preds = %36
%47 = tail call double %3(double %42)
%48 = fcmp ult double %47, 0.000000e+00
%49 = tail call double @llvm.fabs.f64(double %30)
br i1 %48, label %52, label %50
50: ; preds = %46
%51 = fcmp une double %49, %30
br i1 %51, label %70, label %55
52: ; preds = %46
%53 = fneg double %49
%54 = fcmp une double %30, %53
br i1 %54, label %70, label %58
55: ; preds = %50
%56 = tail call double @llvm.fabs.f64(double %27)
%57 = fcmp une double %56, %27
br i1 %57, label %70, label %62
58: ; preds = %52
%59 = tail call double @llvm.fabs.f64(double %27)
%60 = fneg double %59
%61 = fcmp une double %27, %60
br i1 %61, label %70, label %64
62: ; preds = %55
%63 = tail call double @llvm.fabs.f64(double %26)
br label %67
64: ; preds = %58
%65 = tail call double @llvm.fabs.f64(double %26)
%66 = fneg double %65
br label %67
67: ; preds = %64, %62
%68 = phi double [ %63, %62 ], [ %66, %64 ]
%69 = fcmp une double %68, %26
br i1 %69, label %70, label %81
70: ; preds = %58, %52, %67, %55, %50
%71 = phi double [ %30, %50 ], [ %27, %55 ], [ %47, %67 ], [ %30, %52 ], [ %27, %58 ]
%72 = phi double [ %47, %50 ], [ %47, %55 ], [ %26, %67 ], [ %47, %52 ], [ %47, %58 ]
%73 = phi double [ %42, %50 ], [ %42, %55 ], [ %24, %67 ], [ %42, %52 ], [ %42, %58 ]
%74 = phi double [ %29, %50 ], [ %23, %55 ], [ %42, %67 ], [ %29, %52 ], [ %23, %58 ]
%75 = fsub double %73, %74
%76 = tail call double @llvm.fabs.f64(double %75)
%77 = fcmp ole double %76, %2
%78 = add nuw nsw i32 %22, 1
%79 = icmp eq i32 %78, 61
%80 = select i1 %77, i1 true, i1 %79
br i1 %80, label %81, label %21
81: ; preds = %36, %70, %67, %21, %16, %8, %4
%82 = phi double [ %0, %4 ], [ %1, %8 ], [ -1.000000e+20, %16 ], [ %25, %36 ], [ %42, %70 ], [ %42, %67 ], [ %25, %21 ]
ret double %82
}