#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 stub2(float);
float stub3(float);
float rtflsp(float (*func)(float), float x1, float x2, float xacc) {
  void nrerror(char error_text[]);
  int j;
  float fl, fh, xl, xh, swap, dx, del, f, rtf;
  fl = (*func)(x1);
  fh = (*func)(x2);
  if (fl * fh > 0.0)
    nrerror("Root must be bracketed in rtflsp");
  if (fl < 0.0) {
    xl = x1;
    xh = x2;
  } else {
    xl = x2;
    xh = x1;
    swap = fl;
    fl = fh;
    fh = swap;
  }
  dx = xh - xl;
  for (j = 1; j <= 30; j++) {
    rtf = xl + dx * fl / (fl - fh);
    f = (*func)(rtf);
    if (f < 0.0) {
      del = xl - rtf;
      xl = rtf;
      fl = f;
    } else {
      del = xh - rtf;
      xh = rtf;
      fh = f;
    }
    dx = xh - xl;
    if (fabs(del) < xacc || f == 0.0)
      return rtf;
  }
  nrerror("Maximum number of iterations exceeded in rtflsp");
  return 0.0;
}


x86 assembly (clang, -O0):
<rtflsp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x14(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x18(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1182 <rtflsp+0x62>
lea    0xe83(%rip),%rdi
call   1030 <nrerror@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11b1 <rtflsp+0x91>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    11e3 <rtflsp+0xc3>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x1e,-0x20(%rbp)
jg     1302 <rtflsp+0x1e2>
movss  -0x2c(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
mulss  -0x24(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
subss  -0x28(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x44(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1277 <rtflsp+0x157>
movss  -0x2c(%rbp),%xmm0
subss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    129a <rtflsp+0x17a>
movss  -0x30(%rbp),%xmm0
subss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x3c(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     12e0 <rtflsp+0x1c0>
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12ef <rtflsp+0x1cf>
jp     12ef <rtflsp+0x1cf>
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1316 <rtflsp+0x1f6>
jmp    12f4 <rtflsp+0x1d4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f9 <rtflsp+0xd9>
lea    0xd18(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtflsp>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
mov    %rdi,%rbx
movaps %xmm0,0x30(%rsp)
call   *%rdi
movaps %xmm0,0x20(%rsp)
movss  0x10(%rsp),%xmm0
call   *%rbx
movaps 0x20(%rsp),%xmm4
movaps %xmm0,%xmm2
mulss  %xmm4,%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm0
jbe    116b <rtflsp+0x5b>
lea    0xebc(%rip),%rdi
movaps %xmm2,0x40(%rsp)
call   1030 <nrerror@plt>
xorps  %xmm3,%xmm3
movaps 0x20(%rsp),%xmm4
movaps 0x40(%rsp),%xmm2
ucomiss %xmm4,%xmm3
movaps %xmm4,%xmm1
cmpltss %xmm3,%xmm1
movaps %xmm1,%xmm0
andps  %xmm2,%xmm0
andnps %xmm4,%xmm1
orps   %xmm0,%xmm1
movaps %xmm1,0x50(%rsp)
ja     1196 <rtflsp+0x86>
movss  0x10(%rsp),%xmm3
movaps 0x30(%rsp),%xmm1
jmp    11a4 <rtflsp+0x94>
movaps 0x30(%rsp),%xmm3
movss  0x10(%rsp),%xmm1
movaps %xmm4,%xmm2
movaps %xmm1,%xmm5
subss  %xmm3,%xmm5
mov    $0x1e,%ebp
jmp    11f2 <rtflsp+0xe2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movaps %xmm0,%xmm2
cmpltss %xmm5,%xmm2
andps  %xmm2,%xmm4
movaps %xmm2,%xmm3
andnps %xmm6,%xmm3
orps   %xmm4,%xmm3
movaps %xmm1,%xmm5
subss  %xmm3,%xmm5
movaps %xmm2,%xmm4
andps  %xmm0,%xmm4
andnps 0x40(%rsp),%xmm2
orps   %xmm4,%xmm2
add    $0xffffffff,%ebp
je     1282 <rtflsp+0x172>
movaps %xmm3,0x20(%rsp)
movaps %xmm1,0x30(%rsp)
mulss  %xmm2,%xmm5
movaps %xmm2,0x40(%rsp)
movaps %xmm2,%xmm0
subss  0x50(%rsp),%xmm0
divss  %xmm0,%xmm5
addss  %xmm3,%xmm5
movaps %xmm5,0x10(%rsp)
movaps %xmm5,%xmm0
call   *%rbx
xorps  %xmm5,%xmm5
ucomiss %xmm0,%xmm5
ja     1240 <rtflsp+0x130>
movaps 0x10(%rsp),%xmm4
movaps %xmm4,%xmm1
movaps 0x30(%rsp),%xmm3
movaps 0x20(%rsp),%xmm6
jmp    1252 <rtflsp+0x142>
nopl   0x0(%rax)
movaps 0x30(%rsp),%xmm1
movaps 0x20(%rsp),%xmm6
movaps %xmm6,%xmm3
movaps 0x10(%rsp),%xmm4
subss  %xmm4,%xmm3
andps  0xda3(%rip),%xmm3
movss  0xc(%rsp),%xmm2
ucomiss %xmm3,%xmm2
ja     1291 <rtflsp+0x181>
ucomiss %xmm5,%xmm0
jne    126f <rtflsp+0x15f>
jnp    1291 <rtflsp+0x181>
ucomiss %xmm0,%xmm5
ja     11c0 <rtflsp+0xb0>
movaps %xmm0,0x50(%rsp)
jmp    11c0 <rtflsp+0xb0>
lea    0xda8(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm4,%xmm4
movaps %xmm4,%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"Root must be bracketed in rtflsp\00"
@.str.1 = [48 x i8] c"Maximum number of iterations exceeded in rtflsp\00"
define float @rtflsp(float (float)* nocapture %0, float %1, float %2, float %3) {
%5 = tail call float %0(float %1)
%6 = tail call float %0(float %2)
%7 = fmul float %5, %6
%8 = fcmp ogt float %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %4
tail call void @nrerror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %9, %4
%11 = fcmp olt float %5, 0.000000e+00
%12 = select i1 %11, float %6, float %5
%13 = select i1 %11, float %1, float %2
%14 = select i1 %11, float %2, float %1
%15 = select i1 %11, float %5, float %6
%16 = fsub float %14, %13
br label %17
17: ; preds = %10, %38
%18 = phi i32 [ 1, %10 ], [ %42, %38 ]
%19 = phi float [ %16, %10 ], [ %39, %38 ]
%20 = phi float [ %15, %10 ], [ %40, %38 ]
%21 = phi float [ %14, %10 ], [ %31, %38 ]
%22 = phi float [ %13, %10 ], [ %30, %38 ]
%23 = phi float [ %12, %10 ], [ %41, %38 ]
%24 = fmul float %20, %19
%25 = fsub float %20, %23
%26 = fdiv float %24, %25
%27 = fadd float %22, %26
%28 = tail call float %0(float %27)
%29 = fcmp olt float %28, 0.000000e+00
%30 = select i1 %29, float %27, float %22
%31 = select i1 %29, float %21, float %27
%32 = select i1 %29, float %22, float %21
%33 = fsub float %32, %27
%34 = tail call float @llvm.fabs.f32(float %33)
%35 = fcmp olt float %34, %3
%36 = fcmp oeq float %28, 0.000000e+00
%37 = select i1 %35, i1 true, i1 %36
br i1 %37, label %45, label %38
38: ; preds = %17
%39 = fsub float %31, %30
%40 = select i1 %29, float %28, float %20
%41 = select i1 %29, float %23, float %28
%42 = add nuw nsw i32 %18, 1
%43 = icmp eq i32 %42, 31
br i1 %43, label %44, label %17
44: ; preds = %38
tail call void @nrerror(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %45
45: ; preds = %17, %44
%46 = phi float [ 0.000000e+00, %44 ], [ %27, %17 ]
ret float %46
}