#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, void *p), void *p) {
  int j;
  double ans, fhi, flo, fm, fnew, s, xhi, xlo, xm, xnew;
  flo = func(x1, p);
  fhi = func(x2, p);
  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, p);
      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, p);
      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    %rsi,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1181 <findroot_Ridder+0x71>
jp     1181 <findroot_Ridder+0x71>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a8 <findroot_Ridder+0x98>
jp     11a8 <findroot_Ridder+0x98>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe46(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11e3 <findroot_Ridder+0xd3>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
ja     1203 <findroot_Ridder+0xf3>
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    15a0 <findroot_Ridder+0x490>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15a0 <findroot_Ridder+0x490>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0x3c,-0x34(%rbp)
jg     1591 <findroot_Ridder+0x481>
movsd  -0x78(%rbp),%xmm1
addsd  -0x70(%rbp),%xmm1
movsd  0xdc6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x80(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x48(%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,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12bb <findroot_Ridder+0x1ab>
jp     12bb <findroot_Ridder+0x1ab>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
movsd  -0x80(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm2
movsd  0xd34(%rip),%xmm5
movsd  0xd34(%rip),%xmm4
cmplesd %xmm3,%xmm2
movaps %xmm2,%xmm3
andpd  %xmm5,%xmm3
andnpd %xmm4,%xmm2
orpd   %xmm3,%xmm2
mulsd  -0x58(%rbp),%xmm2
divsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm1
ff
subsd  -0x40(%rbp),%xmm1
movaps 0xcfa(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     133e <findroot_Ridder+0x22e>
jmp    1591 <findroot_Ridder+0x481>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     138e <findroot_Ridder+0x27e>
movsd  -0x58(%rbp),%xmm0
movaps 0xca3(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    13bd <findroot_Ridder+0x2ad>
movsd  -0x58(%rbp),%xmm0
movaps 0xc86(%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 -0x58(%rbp),%xmm0
jne    13db <findroot_Ridder+0x2cb>
jp     13db <findroot_Ridder+0x2cb>
jmp    1408 <findroot_Ridder+0x2f8>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    154b <findroot_Ridder+0x43b>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1437 <findroot_Ridder+0x327>
movsd  -0x50(%rbp),%xmm0
movaps 0xbfa(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1466 <findroot_Ridder+0x356>
movsd  -0x50(%rbp),%xmm0
movaps 0xbdd(%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 -0x50(%rbp),%xmm0
jne    1484 <findroot_Ridder+0x374>
jp     1484 <findroot_Ridder+0x374>
jmp    149d <findroot_Ridder+0x38d>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1546 <findroot_Ridder+0x436>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     14cc <findroot_Ridder+0x3bc>
movsd  -0x48(%rbp),%xmm0
movaps 0xb65(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    14fb <findroot_Ridder+0x3eb>
movsd  -0x48(%rbp),%xmm0
movaps 0xb48(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
ucomisd -0x48(%rbp),%xmm0
jne    1519 <findroot_Ridder+0x409>
jp     1519 <findroot_Ridder+0x409>
jmp    1532 <findroot_Ridder+0x422>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1541 <findroot_Ridder+0x431>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
jmp    1546 <findroot_Ridder+0x436>
jmp    154b <findroot_Ridder+0x43b>
movsd  -0x70(%rbp),%xmm1
subsd  -0x78(%rbp),%xmm1
movaps 0xac4(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     157e <findroot_Ridder+0x46e>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
jmp    1583 <findroot_Ridder+0x473>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    121e <findroot_Ridder+0x10e>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15ad <findroot_Ridder+0x49d>
movsd  0xa60(%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   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%rdi
call   *%rbx
movaps %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
mov    %r14,%rdi
call   *%rbx
movapd 0x30(%rsp),%xmm4
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jne    1163 <findroot_Ridder+0x53>
jp     1163 <findroot_Ridder+0x53>
movsd  0x8(%rsp),%xmm7
jmp    117b <findroot_Ridder+0x6b>
movsd  0x8(%rsp),%xmm5
movsd  0x20(%rsp),%xmm2
ucomisd %xmm0,%xmm3
jne    1188 <findroot_Ridder+0x78>
jp     1188 <findroot_Ridder+0x78>
movapd %xmm2,%xmm7
movapd %xmm7,%xmm0
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jbe    1198 <findroot_Ridder+0x88>
ucomisd %xmm3,%xmm0
ja     11b0 <findroot_Ridder+0xa0>
ucomisd %xmm4,%xmm0
movsd  0xe64(%rip),%xmm7
jbe    117b <findroot_Ridder+0x6b>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    117b <findroot_Ridder+0x6b>
movapd %xmm5,%xmm7
addsd  %xmm2,%xmm7
mulsd  0xe40(%rip),%xmm7
mov    $0x3b,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
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  0xe02(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
mov    %r14,%rdi
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 0xddd(%rip),%xmm0
movapd %xmm4,0x60(%rsp)
jb     1250 <findroot_Ridder+0x140>
sqrtsd %xmm0,%xmm0
jmp    1268 <findroot_Ridder+0x158>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <sqrt@plt>
movapd 0x60(%rsp),%xmm4
movapd 0x30(%rsp),%xmm9
movapd 0x50(%rsp),%xmm6
movsd  0x8(%rsp),%xmm2
movapd 0xdb9(%rip),%xmm8
movsd  0x10(%rsp),%xmm7
ucomisd 0xd8b(%rip),%xmm0
jne    128d <findroot_Ridder+0x17d>
jnp    117b <findroot_Ridder+0x6b>
movsd  0x28(%rsp),%xmm5
movapd %xmm5,%xmm1
subsd  %xmm2,%xmm1
movapd %xmm4,%xmm2
xorpd  0xd79(%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    117b <findroot_Ridder+0x6b>
movapd %xmm6,0x10(%rsp)
movapd %xmm6,%xmm0
mov    %r14,%rdi
call   *%rbx
movapd 0x60(%rsp),%xmm3
movapd 0xd2d(%rip),%xmm6
ucomisd 0xd05(%rip),%xmm0
movapd %xmm3,%xmm1
andpd  %xmm6,%xmm1
jae    1350 <findroot_Ridder+0x240>
movapd 0xd03(%rip),%xmm2
xorpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm3
movapd 0x30(%rsp),%xmm4
jne    135e <findroot_Ridder+0x24e>
jp     135e <findroot_Ridder+0x24e>
movapd %xmm4,%xmm1
orpd   %xmm2,%xmm1
ucomisd %xmm1,%xmm4
jne    1388 <findroot_Ridder+0x278>
jp     1388 <findroot_Ridder+0x278>
movapd 0x50(%rsp),%xmm3
movapd %xmm3,%xmm1
orpd   %xmm2,%xmm1
jmp    13ac <findroot_Ridder+0x29c>
nop
ucomisd %xmm3,%xmm1
movapd 0x30(%rsp),%xmm4
jne    135e <findroot_Ridder+0x24e>
jnp    1378 <findroot_Ridder+0x268>
movapd %xmm3,%xmm4
movapd %xmm0,%xmm3
movapd 0x10(%rsp),%xmm7
movapd %xmm7,%xmm2
movsd  0x28(%rsp),%xmm5
jmp    13d0 <findroot_Ridder+0x2c0>
movapd %xmm4,%xmm1
andpd  %xmm6,%xmm1
ucomisd %xmm4,%xmm1
jne    1388 <findroot_Ridder+0x278>
jnp    139e <findroot_Ridder+0x28e>
movapd %xmm0,%xmm3
movapd 0x10(%rsp),%xmm7
movapd %xmm7,%xmm2
movsd  0x8(%rsp),%xmm5
jmp    13d0 <findroot_Ridder+0x2c0>
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    13d0 <findroot_Ridder+0x2c0>
jnp    117b <findroot_Ridder+0x6b>
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    117b <findroot_Ridder+0x6b>
test   %al,%al
je     11d0 <findroot_Ridder+0xc0>
jmp    117b <findroot_Ridder+0x6b>

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

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