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


x86 assembly (clang, -O0):
<rtsec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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
call   1040 <fabs@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x28(%rbp),%xmm0
call   1040 <fabs@plt>
movss  -0x3c(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11b9 <rtsec+0x99>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    11cd <rtsec+0xad>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x1e,-0x20(%rbp)
jg     128c <rtsec+0x16c>
movss  -0x34(%rbp),%xmm0
subss  -0x38(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
subss  -0x24(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x2c(%rbp),%xmm0
addss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x38(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x28(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     126a <rtsec+0x14a>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1279 <rtsec+0x159>
jp     1279 <rtsec+0x159>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12a0 <rtsec+0x180>
jmp    127e <rtsec+0x15e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d4 <rtsec+0xb4>
lea    0xd6d(%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):
<rtsec>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
movss  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
mov    %rdi,%rbx
movss  %xmm0,0x10(%rsp)
call   *%rdi
movaps %xmm0,0x20(%rsp)
movss  0x4(%rsp),%xmm0
call   *%rbx
movaps 0xebf(%rip),%xmm2
movaps 0x20(%rsp),%xmm4
movaps %xmm4,%xmm3
andps  %xmm2,%xmm3
movaps %xmm0,%xmm1
andps  %xmm2,%xmm1
ucomiss %xmm3,%xmm1
cmpltss %xmm1,%xmm3
movaps %xmm3,%xmm1
andps  %xmm0,%xmm1
andnps %xmm4,%xmm3
orps   %xmm1,%xmm3
ja     117b <rtsec+0x6b>
movss  0x10(%rsp),%xmm4
movss  0x4(%rsp),%xmm2
mov    $0x1e,%ebp
jmp    11a0 <rtsec+0x90>
movaps %xmm4,%xmm2
movaps %xmm4,%xmm0
movss  0x4(%rsp),%xmm4
movss  0x10(%rsp),%xmm2
mov    $0x1e,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  %xmm2,0xc(%rsp)
subss  %xmm2,%xmm4
mulss  %xmm0,%xmm4
movaps %xmm0,0x10(%rsp)
subss  %xmm3,%xmm0
divss  %xmm0,%xmm4
movaps %xmm4,0x20(%rsp)
addss  %xmm4,%xmm2
movss  %xmm2,0x4(%rsp)
movaps %xmm2,%xmm0
call   *%rbx
movaps 0x20(%rsp),%xmm2
andps  0xe25(%rip),%xmm2
movss  0x8(%rsp),%xmm1
ucomiss %xmm2,%xmm1
ja     1218 <rtsec+0x108>
ucomiss 0xe23(%rip),%xmm0
jne    11f1 <rtsec+0xe1>
jnp    1218 <rtsec+0x108>
add    $0xffffffff,%ebp
movss  0x4(%rsp),%xmm2
movaps 0x10(%rsp),%xmm3
movss  0xc(%rsp),%xmm4
jne    11a0 <rtsec+0x90>
lea    0xe06(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm0,%xmm0
jmp    121e <rtsec+0x10e>
movss  0x4(%rsp),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Maximum number of iterations exceeded in rtsec\00"
define float @rtsec(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
store float (float)* %0, float (float)** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%17 = load float (float)*, float (float)** %6
%18 = load float, float* %7
%19 = call float %17(float %18)
store float %19, float* %11
%20 = load float (float)*, float (float)** %6
%21 = load float, float* %8
%22 = call float %20(float %21)
store float %22, float* %12
%23 = load float, float* %11
%24 = call float @fabs(float %23)
%25 = load float, float* %12
%26 = call float @fabs(float %25)
%27 = fcmp olt float %24, %26
br i1 %27, label %28, label %34
28: ; preds = %4
%29 = load float, float* %7
store float %29, float* %16
%30 = load float, float* %8
store float %30, float* %15
%31 = load float, float* %11
store float %31, float* %14
%32 = load float, float* %12
store float %32, float* %11
%33 = load float, float* %14
store float %33, float* %12
br label %37
34: ; preds = %4
%35 = load float, float* %7
store float %35, float* %15
%36 = load float, float* %8
store float %36, float* %16
br label %37
37: ; preds = %34, %28
store i32 1, i32* %10
br label %38
38: ; preds = %70, %37
%39 = load i32, i32* %10
%40 = icmp sle i32 %39, 30
br i1 %40, label %41, label %73
41: ; preds = %38
%42 = load float, float* %15
%43 = load float, float* %16
%44 = fsub float %42, %43
%45 = load float, float* %12
%46 = fmul float %44, %45
%47 = load float, float* %12
%48 = load float, float* %11
%49 = fsub float %47, %48
%50 = fdiv float %46, %49
store float %50, float* %13
%51 = load float, float* %16
store float %51, float* %15
%52 = load float, float* %12
store float %52, float* %11
%53 = load float, float* %13
%54 = load float, float* %16
%55 = fadd float %54, %53
store float %55, float* %16
%56 = load float (float)*, float (float)** %6
%57 = load float, float* %16
%58 = call float %56(float %57)
store float %58, float* %12
%59 = load float, float* %13
%60 = call float @fabs(float %59)
%61 = load float, float* %9
%62 = fcmp olt float %60, %61
br i1 %62, label %67, label %63
63: ; preds = %41
%64 = load float, float* %12
%65 = fpext float %64 to double
%66 = fcmp oeq double %65, 0.000000e+00
br i1 %66, label %67, label %69
67: ; preds = %63, %41
%68 = load float, float* %16
store float %68, float* %5
br label %74
69: ; preds = %63
br label %70
70: ; preds = %69
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %38
73: ; preds = %38
store float 0.000000e+00, float* %5
br label %74
74: ; preds = %73, %67
%75 = load float, float* %5
ret float %75
}

LLVM IR (-O2):
@.str = [47 x i8] c"Maximum number of iterations exceeded in rtsec\00"
define float @rtsec(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 = tail call float @llvm.fabs.f32(float %5)
%8 = tail call float @llvm.fabs.f32(float %6)
%9 = fcmp olt float %7, %8
%10 = select i1 %9, float %6, float %5
%11 = select i1 %9, float %5, float %6
%12 = select i1 %9, float %2, float %1
%13 = select i1 %9, float %1, float %2
br label %17
14: ; preds = %17
%15 = add nuw nsw i32 %20, 1
%16 = icmp eq i32 %15, 31
br i1 %16, label %33, label %17
17: ; preds = %4, %14
%18 = phi float [ %13, %4 ], [ %27, %14 ]
%19 = phi float [ %12, %4 ], [ %18, %14 ]
%20 = phi i32 [ 1, %4 ], [ %15, %14 ]
%21 = phi float [ %11, %4 ], [ %28, %14 ]
%22 = phi float [ %10, %4 ], [ %21, %14 ]
%23 = fsub float %19, %18
%24 = fmul float %21, %23
%25 = fsub float %21, %22
%26 = fdiv float %24, %25
%27 = fadd float %18, %26
%28 = tail call float %0(float %27)
%29 = tail call float @llvm.fabs.f32(float %26)
%30 = fcmp olt float %29, %3
%31 = fcmp oeq float %28, 0.000000e+00
%32 = select i1 %30, i1 true, i1 %31
br i1 %32, label %34, label %14
33: ; preds = %14
tail call void @nrerror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %17, %33
%35 = phi float [ 0.000000e+00, %33 ], [ %27, %17 ]
ret float %35
}