#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 */
float fabs(float);
float stub1(float, float);
float stub2(float, float);
float stub3(float, float);
float rootfind(float (*func)(float, float), float nu, float x1, float x2,
               float xacc) {
  void nrerror(char error_text[]);
  int j;
  float dx, f, fmid, xmid, rtb;
  f = (*func)(nu / 2., x1 / 2.) - 0.6827;
  fmid = (*func)(nu / 2., x2 / 2.) - 0.6827;
  if (f * fmid >= 0.0)
    nrerror("Root must be bracketed for bisection in rtbis");
  rtb = f < 0.0 ? (dx = x2 - x1, x1) : (dx = x1 - x2, x2);
  for (j = 1; j <= 40; j++) {
    fmid = (*func)(nu / 2., (xmid = rtb + (dx *= 0.5)) / 2.) - 0.6827;
    if (fmid <= 0.0)
      rtb = xmid;
    if (fabs(dx) < xacc || fmid == 0.0)
      return rtb;
  }
  nrerror("Too many bisections in rtbis");
  return 0.0;
}


x86 assembly (clang, -O0):
<rootfind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
movss  %xmm3,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe9a(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
call   *%rax
cvtss2sd %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe49(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
call   *%rax
cvtss2sd %xmm0,%xmm0
movsd  0xe2b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1209 <rootfind+0xe9>
lea    0xe14(%rip),%rdi
call   1030 <nrerror@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    123d <rootfind+0x11d>
movss  -0x1c(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    1256 <rootfind+0x136>
movss  -0x18(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x28,-0x24(%rbp)
jg     1362 <rootfind+0x242>
mov    -0x10(%rbp),%rax
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd82(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x38(%rbp),%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xd6c(%rip),%xmm3
mulsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,-0x28(%rbp)
addss  %xmm2,%xmm1
movss  %xmm1,-0x34(%rbp)
cvtss2sd %xmm1,%xmm1
movsd  0xd42(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
call   *%rax
cvtss2sd %xmm0,%xmm0
movsd  0xd24(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1309 <rootfind+0x1e9>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x28(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     1340 <rootfind+0x220>
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    134f <rootfind+0x22f>
jp     134f <rootfind+0x22f>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1376 <rootfind+0x256>
jmp    1354 <rootfind+0x234>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1267 <rootfind+0x147>
lea    0xcdd(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rootfind>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
movss  %xmm3,0xc(%rsp)
movaps %xmm2,0x10(%rsp)
mov    %rdi,%rbx
movss  0xed4(%rip),%xmm2
mulss  %xmm2,%xmm0
movss  %xmm0,0x8(%rsp)
movaps %xmm1,0x30(%rsp)
mulss  %xmm2,%xmm1
call   *%rdi
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm1
mulss  0xead(%rip),%xmm1
movss  0x8(%rsp),%xmm0
call   *%rbx
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
cvtps2pd %xmm1,%xmm0
addpd  0xea2(%rip),%xmm0
cvtpd2ps %xmm0,%xmm3
movapd %xmm3,%xmm0
shufps $0x55,%xmm3,%xmm0
mulss  %xmm3,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     119f <rootfind+0x8f>
lea    0xeab(%rip),%rdi
movaps %xmm3,0x20(%rsp)
call   1030 <nrerror@plt>
xorps  %xmm2,%xmm2
movaps 0x20(%rsp),%xmm3
ucomiss %xmm3,%xmm2
ja     11b7 <rootfind+0xa7>
movaps 0x30(%rsp),%xmm0
movaps %xmm0,%xmm4
movaps 0x10(%rsp),%xmm1
subss  %xmm1,%xmm4
jmp    11c8 <rootfind+0xb8>
movaps 0x10(%rsp),%xmm1
movaps %xmm1,%xmm4
movaps 0x30(%rsp),%xmm0
subss  %xmm0,%xmm4
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm0
andnps %xmm1,%xmm3
orps   %xmm0,%xmm3
mov    $0x28,%ebp
nopl   0x0(%rax,%rax,1)
movaps %xmm3,0x20(%rsp)
movss  0xe13(%rip),%xmm0
mulss  %xmm0,%xmm4
movaps %xmm4,0x10(%rsp)
movaps %xmm4,%xmm1
addss  %xmm3,%xmm1
movaps %xmm1,0x30(%rsp)
mulss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
call   *%rbx
xorps  %xmm5,%xmm5
movaps 0x10(%rsp),%xmm4
cvtss2sd %xmm0,%xmm0
addsd  0xe0e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,%xmm3
cmpnless %xmm5,%xmm3
movaps %xmm3,%xmm2
andnps 0x30(%rsp),%xmm2
andps  0x20(%rsp),%xmm3
orps   %xmm2,%xmm3
movaps %xmm4,%xmm1
andps  0xdd8(%rip),%xmm1
movss  0xc(%rsp),%xmm2
ucomiss %xmm1,%xmm2
ja     126e <rootfind+0x15e>
ucomiss %xmm5,%xmm0
jne    125a <rootfind+0x14a>
jnp    126e <rootfind+0x15e>
add    $0xffffffff,%ebp
jne    11e0 <rootfind+0xd0>
lea    0xe00(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Root must be bracketed for bisection in rtbis\00"
@.str.1 = [29 x i8] c"Too many bisections in rtbis\00"
define float @rootfind(float (float, float)* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float (float, float)*
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
store float (float, float)* %0, float (float, float)** %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
%18 = load float (float, float)*, float (float, float)** %7
%19 = load float, float* %8
%20 = fpext float %19 to double
%21 = fdiv double %20, 2.000000e+00
%22 = fptrunc double %21 to float
%23 = load float, float* %9
%24 = fpext float %23 to double
%25 = fdiv double %24, 2.000000e+00
%26 = fptrunc double %25 to float
%27 = call float %18(float %22, float %26)
%28 = fpext float %27 to double
%29 = fsub double %28, 6.827000e-01
%30 = fptrunc double %29 to float
store float %30, float* %14
%31 = load float (float, float)*, float (float, float)** %7
%32 = load float, float* %8
%33 = fpext float %32 to double
%34 = fdiv double %33, 2.000000e+00
%35 = fptrunc double %34 to float
%36 = load float, float* %10
%37 = fpext float %36 to double
%38 = fdiv double %37, 2.000000e+00
%39 = fptrunc double %38 to float
%40 = call float %31(float %35, float %39)
%41 = fpext float %40 to double
%42 = fsub double %41, 6.827000e-01
%43 = fptrunc double %42 to float
store float %43, float* %15
%44 = load float, float* %14
%45 = load float, float* %15
%46 = fmul float %44, %45
%47 = fpext float %46 to double
%48 = fcmp oge double %47, 0.000000e+00
br i1 %48, label %49, label %50
49: ; preds = %5
br label %50
50: ; preds = %49, %5
%51 = load float, float* %14
%52 = fpext float %51 to double
%53 = fcmp olt double %52, 0.000000e+00
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = load float, float* %10
%56 = load float, float* %9
%57 = fsub float %55, %56
store float %57, float* %13
%58 = load float, float* %9
br label %64
59: ; preds = %50
%60 = load float, float* %9
%61 = load float, float* %10
%62 = fsub float %60, %61
store float %62, float* %13
%63 = load float, float* %10
br label %64
64: ; preds = %59, %54
%65 = phi float [ %58, %54 ], [ %63, %59 ]
store float %65, float* %17
store i32 1, i32* %12
br label %66
66: ; preds = %105, %64
%67 = load i32, i32* %12
%68 = icmp sle i32 %67, 40
br i1 %68, label %69, label %108
69: ; preds = %66
%70 = load float (float, float)*, float (float, float)** %7
%71 = load float, float* %8
%72 = fpext float %71 to double
%73 = fdiv double %72, 2.000000e+00
%74 = fptrunc double %73 to float
%75 = load float, float* %17
%76 = load float, float* %13
%77 = fpext float %76 to double
%78 = fmul double %77, 5.000000e-01
%79 = fptrunc double %78 to float
store float %79, float* %13
%80 = fadd float %75, %79
store float %80, float* %16
%81 = fpext float %80 to double
%82 = fdiv double %81, 2.000000e+00
%83 = fptrunc double %82 to float
%84 = call float %70(float %74, float %83)
%85 = fpext float %84 to double
%86 = fsub double %85, 6.827000e-01
%87 = fptrunc double %86 to float
store float %87, float* %15
%88 = load float, float* %15
%89 = fpext float %88 to double
%90 = fcmp ole double %89, 0.000000e+00
br i1 %90, label %91, label %93
91: ; preds = %69
%92 = load float, float* %16
store float %92, float* %17
br label %93
93: ; preds = %91, %69
%94 = load float, float* %13
%95 = call float @fabs(float %94)
%96 = load float, float* %11
%97 = fcmp olt float %95, %96
br i1 %97, label %102, label %98
98: ; preds = %93
%99 = load float, float* %15
%100 = fpext float %99 to double
%101 = fcmp oeq double %100, 0.000000e+00
br i1 %101, label %102, label %104
102: ; preds = %98, %93
%103 = load float, float* %17
store float %103, float* %6
br label %109
104: ; preds = %98
br label %105
105: ; preds = %104
%106 = load i32, i32* %12
%107 = add nsw i32 %106, 1
store i32 %107, i32* %12
br label %66
108: ; preds = %66
store float 0.000000e+00, float* %6
br label %109
109: ; preds = %108, %102
%110 = load float, float* %6
ret float %110
}

LLVM IR (-O2):
@.str = [46 x i8] c"Root must be bracketed for bisection in rtbis\00"
@.str.1 = [29 x i8] c"Too many bisections in rtbis\00"
define float @rootfind(float (float, float)* nocapture %0, float %1, float %2, float %3, float %4) {
%6 = fmul float %1, 5.000000e-01
%7 = fmul float %2, 5.000000e-01
%8 = tail call float %0(float %6, float %7)
%9 = fmul float %3, 5.000000e-01
%10 = tail call float %0(float %6, float %9)
%11 = insertelement <2 x float> poison, float %8, i64 0
%12 = insertelement <2 x float> %11, float %10, i64 1
%13 = fpext <2 x float> %12 to <2 x double>
%14 = fadd <2 x double> %13, <double -6.827000e-01, double -6.827000e-01>
%15 = fptrunc <2 x double> %14 to <2 x float>
%16 = extractelement <2 x float> %15, i64 0
%17 = shufflevector <2 x float> %15, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%18 = fmul <2 x float> %17, %15
%19 = extractelement <2 x float> %18, i64 0
%20 = fcmp ult float %19, 0.000000e+00
br i1 %20, label %22, label %21
21: ; preds = %5
tail call void @nrerror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %21, %5
%23 = fcmp olt float %16, 0.000000e+00
%24 = fsub float %3, %2
%25 = fsub float %2, %3
%26 = select i1 %23, float %24, float %25
%27 = select i1 %23, float %2, float %3
br label %31
28: ; preds = %31
%29 = add nuw nsw i32 %33, 1
%30 = icmp eq i32 %29, 41
br i1 %30, label %48, label %31
31: ; preds = %22, %28
%32 = phi float [ %27, %22 ], [ %43, %28 ]
%33 = phi i32 [ 1, %22 ], [ %29, %28 ]
%34 = phi float [ %26, %22 ], [ %35, %28 ]
%35 = fmul float %34, 5.000000e-01
%36 = fadd float %35, %32
%37 = fmul float %36, 5.000000e-01
%38 = tail call float %0(float %6, float %37)
%39 = fpext float %38 to double
%40 = fadd double %39, -6.827000e-01
%41 = fptrunc double %40 to float
%42 = fcmp ugt float %41, 0.000000e+00
%43 = select i1 %42, float %32, float %36
%44 = tail call float @llvm.fabs.f32(float %35)
%45 = fcmp olt float %44, %4
%46 = fcmp oeq float %41, 0.000000e+00
%47 = select i1 %45, i1 true, i1 %46
br i1 %47, label %49, label %28
48: ; preds = %28
tail call void @nrerror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %49
49: ; preds = %31, %48
%50 = phi float [ 0.000000e+00, %48 ], [ %43, %31 ]
ret float %50
}