#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 */
struct pumas_physics {
  int dummy;
};

/* Variables and functions */
double const fabs(double);
double sqrt(double const);
double stub1(struct pumas_physics const *, double, void *);
double stub2(struct pumas_physics const *, double, void *);
double stub3(struct pumas_physics const *, double const, void *);
double stub4(struct pumas_physics const *, double, void *);
int math_find_root(double (*f)(const struct pumas_physics *physics, double x,
                               void *params),
                   const struct pumas_physics *physics, double xa, double xb,
                   const double *fa_p, const double *fb_p, double xtol,
                   double rtol, int max_iter, void *params, double *x0) {
  double fa, fb;
  if (fa_p == NULL)
    fa = (*f)(physics, xa, params);
  else
    fa = *fa_p;
  if (fb_p == NULL)
    fb = (*f)(physics, xb, params);
  else
    fb = *fb_p;
  if (fa * fb > 0) {
    *x0 = 0.;
    return -1;
  }
  if (fa == 0) {
    *x0 = xa;
    return 0;
  }
  if (fb == 0) {
    *x0 = xb;
    return 0;
  }
  const double tol =
      xtol + rtol * ((fabs(xa) < fabs(xb)) ? fabs(xa) : fabs(xb));
  double xn = 0.;
  int i = 0;
  for (i = 0; i < max_iter; i++) {
    double dm = 0.5 * (xb - xa);
    const double xm = xa + dm;
    const double fm = (*f)(physics, xm, params);
    double sgn = (fb > fa) ? 1. : -1.;
    double dn = sgn * dm * fm / sqrt(fm * fm - fa * fb);
    sgn = (dn > 0.) ? 1. : -1.;
    dn = fabs(dn);
    dm = fabs(dm) - 0.5 * tol;
    if (dn < dm)
      dm = dn;
    xn = xm - sgn * dm;
    const double fn = (*f)(physics, xn, params);
    if (fn * fm < 0.0) {
      xa = xn;
      fa = fn;
      xb = xm;
      fb = fm;
    } else if (fn * fa < 0.0) {
      xb = xn;
      fb = fn;
    } else {
      xa = xn;
      fa = fn;
    }
    if (fn == 0.0 || fabs(xb - xa) < tol) {
      *x0 = xn;
      return 0;
    }
  }
  *x0 = xn;
  return -2;
}


x86 assembly (clang, -O0):
<math_find_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
mov    %r8d,-0x4c(%rbp)
mov    %r9,-0x58(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1183 <math_find_root+0x63>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    -0x58(%rbp),%rsi
call   *%rax
movsd  %xmm0,-0x60(%rbp)
jmp    1190 <math_find_root+0x70>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11b8 <math_find_root+0x98>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
mov    -0x58(%rbp),%rsi
call   *%rax
movsd  %xmm0,-0x68(%rbp)
jmp    11c5 <math_find_root+0xa5>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11f3 <math_find_root+0xd3>
mov    0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <math_find_root+0x509>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1224 <math_find_root+0x104>
jp     1224 <math_find_root+0x104>
movsd  -0x20(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1629 <math_find_root+0x509>
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1255 <math_find_root+0x135>
jp     1255 <math_find_root+0x135>
movsd  -0x28(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1629 <math_find_root+0x509>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  -0xb8(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jbe    12b4 <math_find_root+0x194>
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    12c6 <math_find_root+0x1a6>
movsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xd0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1615 <math_find_root+0x4f5>
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xcf9(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rsi
call   *%rax
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  0xc98(%rip),%xmm3
movsd  0xc98(%rip),%xmm2
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0x60(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm1
ff
movsd  0xbef(%rip),%xmm3
movsd  0xbef(%rip),%xmm2
xorps  %xmm0,%xmm0
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
call   1030 <fabs@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
movsd  0xb8e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0xa8(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    14ac <math_find_root+0x38c>
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
movsd  -0x78(%rbp),%xmm0
mov    -0x58(%rbp),%rsi
call   *%rax
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  -0x98(%rbp),%xmm1
ff
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1556 <math_find_root+0x436>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x28(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
jmp    15a8 <math_find_root+0x488>
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  -0x60(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    158c <math_find_root+0x46c>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
jmp    15a3 <math_find_root+0x483>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
jmp    15a8 <math_find_root+0x488>
movsd  -0xb0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    15c8 <math_find_root+0x4a8>
jp     15c8 <math_find_root+0x4a8>
jmp    15e9 <math_find_root+0x4c9>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1602 <math_find_root+0x4e2>
movsd  -0x78(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1629 <math_find_root+0x509>
jmp    1607 <math_find_root+0x4e7>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1301 <math_find_root+0x1e1>
movsd  -0x78(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_find_root>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%r14
mov    %r8d,%ebp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x8(%rsp)
mov    %rcx,%rbx
movapd %xmm1,%xmm3
movapd %xmm0,%xmm4
mov    %rsi,%r15
mov    %rdi,%r12
test   %rdx,%rdx
je     1155 <math_find_root+0x45>
movsd  (%rdx),%xmm5
test   %rbx,%rbx
je     1183 <math_find_root+0x73>
movsd  (%rbx),%xmm2
jmp    11b8 <math_find_root+0xa8>
mov    %r15,%rdi
movapd %xmm4,%xmm0
mov    %r14,%rsi
movapd %xmm4,0x40(%rsp)
movapd %xmm3,0x20(%rsp)
call   *%r12
movapd 0x20(%rsp),%xmm3
movapd 0x40(%rsp),%xmm4
movapd %xmm0,%xmm5
test   %rbx,%rbx
jne    114f <math_find_root+0x3f>
mov    %r15,%rdi
movapd %xmm3,%xmm0
mov    %r14,%rsi
movapd %xmm4,0x40(%rsp)
movapd %xmm5,0x30(%rsp)
movapd %xmm3,0x20(%rsp)
call   *%r12
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm5
movapd 0x40(%rsp),%xmm4
movapd %xmm0,%xmm2
mov    0xb0(%rsp),%r13
movapd %xmm5,%xmm0
mulsd  %xmm2,%xmm0
mov    $0xffffffff,%ebx
xorpd  %xmm7,%xmm7
ucomisd %xmm7,%xmm0
ja     11f7 <math_find_root+0xe7>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm5
jne    11e9 <math_find_root+0xd9>
jp     11e9 <math_find_root+0xd9>
movapd %xmm4,%xmm7
jmp    11f5 <math_find_root+0xe5>
ucomisd %xmm0,%xmm2
jne    120e <math_find_root+0xfe>
jp     120e <math_find_root+0xfe>
movapd %xmm3,%xmm7
xor    %ebx,%ebx
movsd  %xmm7,0x0(%r13)
mov    %ebx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xfffffffe,%ebx
test   %ebp,%ebp
jle    1425 <math_find_root+0x315>
movapd 0xddd(%rip),%xmm6
movapd %xmm4,%xmm0
andpd  %xmm6,%xmm0
movapd %xmm3,%xmm1
andpd  %xmm6,%xmm1
minsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0xde9(%rip),%xmm0
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x70(%rsp)
nop
movsd  %xmm2,0x10(%rsp)
movapd %xmm5,0x30(%rsp)
movapd %xmm3,0x20(%rsp)
subsd  %xmm4,%xmm3
mulsd  0xdb2(%rip),%xmm3
movapd %xmm4,0x40(%rsp)
movapd %xmm3,0x60(%rsp)
addsd  %xmm3,%xmm4
mov    %r15,%rdi
movsd  %xmm4,0x58(%rsp)
movapd %xmm4,%xmm0
mov    %r14,%rsi
call   *%r12
xorpd  %xmm5,%xmm5
movsd  0x10(%rsp),%xmm3
movapd 0x30(%rsp),%xmm2
movapd %xmm3,%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm0,%xmm0
subsd  %xmm1,%xmm0
ucomisd %xmm5,%xmm0
jb     12e0 <math_find_root+0x1d0>
sqrtsd %xmm0,%xmm0
jmp    12f5 <math_find_root+0x1e5>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0x10(%rsp),%xmm3
movapd 0x30(%rsp),%xmm2
movapd 0x60(%rsp),%xmm6
movapd %xmm6,%xmm1
xorpd  0xd09(%rip),%xmm1
cmpltsd %xmm3,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm6,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
mulsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
xor    %eax,%eax
ucomisd %xmm5,%xmm2
seta   %al
movapd 0xcc9(%rip),%xmm0
andpd  %xmm0,%xmm2
andpd  %xmm0,%xmm6
addsd  0x70(%rsp),%xmm6
minsd  %xmm6,%xmm2
lea    0xcd0(%rip),%rcx
mulsd  (%rcx,%rax,8),%xmm2
movsd  0x58(%rsp),%xmm0
subsd  %xmm2,%xmm0
mov    %r15,%rdi
movsd  %xmm0,0x60(%rsp)
mov    %r14,%rsi
call   *%r12
movsd  0x8(%rsp),%xmm2
xorpd  %xmm6,%xmm6
movapd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm6
jbe    13a0 <math_find_root+0x290>
movapd %xmm0,%xmm5
movsd  0x58(%rsp),%xmm3
movsd  0x60(%rsp),%xmm7
movapd %xmm7,%xmm4
jmp    13eb <math_find_root+0x2db>
nopl   0x0(%rax)
movsd  0x60(%rsp),%xmm7
movapd 0x30(%rsp),%xmm5
movapd %xmm5,%xmm1
mulsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm6
movapd %xmm0,%xmm2
ja     13c4 <math_find_root+0x2b4>
movsd  0x10(%rsp),%xmm2
movapd %xmm7,%xmm3
movapd 0x40(%rsp),%xmm4
ja     13da <math_find_root+0x2ca>
movapd 0x20(%rsp),%xmm3
movapd %xmm7,%xmm4
cmpltsd %xmm6,%xmm1
andpd  %xmm1,%xmm5
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm5
ucomisd %xmm6,%xmm0
jne    13f7 <math_find_root+0x2e7>
jnp    11f5 <math_find_root+0xe5>
movapd %xmm3,%xmm0
subsd  %xmm4,%xmm0
andpd  0xbf9(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     11f5 <math_find_root+0xe5>
add    $0xffffffff,%ebp
jne    1260 <math_find_root+0x150>
jmp    11f7 <math_find_root+0xe7>
xorpd  %xmm7,%xmm7
jmp    11f7 <math_find_root+0xe7>

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

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