#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(float);
float stub1(float (*)(float), float, float, int);
float qromo(float (*func)(float), float a, float b,
            float (*choose)(float (*)(float), float, float, int)) {
  void polint(float xa[], float ya[], int n, float x, float *y, float *dy);
  void nrerror(char error_text[]);
  int j;
  float ss, dss, h[(14 + 1) + 1], s[(14 + 1) + 1];
  h[1] = 1.0;
  for (j = 1; j <= 14; j++) {
    s[j] = (*choose)(func, a, b, j);
    if (j >= 5) {
      polint(&h[j - 5], &s[j - 5], 5, 0.0, &ss, &dss);
      if (fabs(dss) < 1.0e-6 * fabs(ss))
        return ss;
    }
    s[j + 1] = s[j];
    h[j + 1] = h[j] / 9.0;
  }
  nrerror("Too many steps in routing qromo");
  return 0.0;
}


x86 assembly (clang, -O0):
<qromo>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  0xeab(%rip),%xmm0
movss  %xmm0,-0x6c(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0xe,-0x24(%rbp)
jg     1280 <qromo+0x150>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
mov    -0x24(%rbp),%esi
call   *%rax
movslq -0x24(%rbp),%rax
movss  %xmm0,-0xb0(%rbp,%rax,4)
ff ff
cmpl   $0x5,-0x24(%rbp)
jl     1228 <qromo+0xf8>
mov    -0x24(%rbp),%eax
sub    $0x5,%eax
cltq
lea    -0x70(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x24(%rbp),%eax
sub    $0x5,%eax
cltq
lea    -0xb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x5,%edx
xorps  %xmm0,%xmm0
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
call   1050 <polint@plt>
movss  -0x2c(%rbp),%xmm0
call   1040 <fabs@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movss  -0x28(%rbp),%xmm0
call   1040 <fabs@plt>
movsd  -0xb8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  0xe02(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1223 <qromo+0xf3>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1294 <qromo+0x164>
jmp    1228 <qromo+0xf8>
movslq -0x24(%rbp),%rax
movss  -0xb0(%rbp,%rax,4),%xmm0
ff ff
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
movss  %xmm0,-0xb0(%rbp,%rax,4)
ff ff
movslq -0x24(%rbp),%rax
movss  -0x70(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
movss  %xmm0,-0x70(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <qromo+0x31>
lea    0xd91(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qromo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rdi,%r13
movl   $0x3f800000,0x64(%rsp)
3f
mov    $0x1,%ebx
mov    $0xfffffffc,%ebp
mov    $0xe,%r15d
lea    0x14(%rsp),%r12
jmp    11a8 <qromo+0x78>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  %xmm0,0x24(%rsp,%rbx,4)
movss  0x60(%rsp,%rbx,4),%xmm0
divss  0xe74(%rip),%xmm0
movss  %xmm0,0x64(%rsp,%rbx,4)
add    $0x1,%rbx
add    $0x1,%rbp
add    $0xffffffffffffffff,%r15
je     1227 <qromo+0xf7>
mov    %r13,%rdi
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mov    %ebx,%esi
call   *%r14
movss  %xmm0,0x20(%rsp,%rbx,4)
cmp    $0x5,%rbx
jb     1180 <qromo+0x50>
mov    %ebp,%eax
shl    $0x2,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x60,%rdi
lea    0x20(%rsp,%rax,1),%rsi
xorps  %xmm0,%xmm0
mov    $0x5,%edx
lea    0x8(%rsp),%rcx
mov    %r12,%r8
call   1050 <polint@plt>
movss  0x14(%rsp),%xmm0
call   1040 <fabs@plt>
movsd  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
mulsd  0xdec(%rip),%xmm0
ucomisd 0x18(%rsp),%xmm0
ja     1238 <qromo+0x108>
movss  0x20(%rsp,%rbx,4),%xmm0
jmp    1180 <qromo+0x50>
lea    0xdde(%rip),%rdi
call   1030 <nrerror@plt>
xorps  %xmm0,%xmm0
jmp    123e <qromo+0x10e>
movss  0x8(%rsp),%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Too many steps in routing qromo\00"
define float @qromo(float (float)* %0, float %1, float %2, float (float (float)*, float, float, i32)* %3) {
%5 = alloca float
%6 = alloca float (float)*
%7 = alloca float
%8 = alloca float
%9 = alloca float (float (float)*, float, float, i32)*
%10 = alloca i32
%11 = alloca float
%12 = alloca float
%13 = alloca [16 x float]
%14 = alloca [16 x float]
store float (float)* %0, float (float)** %6
store float %1, float* %7
store float %2, float* %8
store float (float (float)*, float, float, i32)* %3, float (float (float)*, float, float, i32)** %9
%15 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 1
store float 1.000000e+00, float* %15
store i32 1, i32* %10
br label %16
16: ; preds = %69, %4
%17 = load i32, i32* %10
%18 = icmp sle i32 %17, 14
br i1 %18, label %19, label %72
19: ; preds = %16
%20 = load float (float (float)*, float, float, i32)*, float (float (float)*, float, float, i32)** %9
%21 = load float (float)*, float (float)** %6
%22 = load float, float* %7
%23 = load float, float* %8
%24 = load i32, i32* %10
%25 = call float %20(float (float)* %21, float %22, float %23, i32 %24)
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [16 x float], [16 x float]* %14, i64 0, i64 %27
store float %25, float* %28
%29 = load i32, i32* %10
%30 = icmp sge i32 %29, 5
br i1 %30, label %31, label %49
31: ; preds = %19
%32 = load i32, i32* %10
%33 = sub nsw i32 %32, 5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 %34
%36 = load i32, i32* %10
%37 = sub nsw i32 %36, 5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [16 x float], [16 x float]* %14, i64 0, i64 %38
%40 = load float, float* %12
%41 = call double @fabs(float %40)
%42 = load float, float* %11
%43 = call double @fabs(float %42)
%44 = fmul double 0x3EB0C6F7A0B5ED8D, %43
%45 = fcmp olt double %41, %44
br i1 %45, label %46, label %48
46: ; preds = %31
%47 = load float, float* %11
store float %47, float* %5
br label %73
48: ; preds = %31
br label %49
49: ; preds = %48, %19
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [16 x float], [16 x float]* %14, i64 0, i64 %51
%53 = load float, float* %52
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [16 x float], [16 x float]* %14, i64 0, i64 %56
store float %53, float* %57
%58 = load i32, i32* %10
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 %59
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = fdiv double %62, 9.000000e+00
%64 = fptrunc double %63 to float
%65 = load i32, i32* %10
%66 = add nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 %67
store float %64, float* %68
br label %69
69: ; preds = %49
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %16
72: ; preds = %16
store float 0.000000e+00, float* %5
br label %73
73: ; preds = %72, %46
%74 = load float, float* %5
ret float %74
}

LLVM IR (-O2):
@.str = [32 x i8] c"Too many steps in routing qromo\00"
define float @qromo(float (float)* %0, float %1, float %2, float (float (float)*, float, float, i32)* nocapture %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca [16 x float]
%8 = alloca [16 x float]
%9 = bitcast float* %5 to i8*
%10 = bitcast float* %6 to i8*
%11 = bitcast [16 x float]* %7 to i8*
%12 = bitcast [16 x float]* %8 to i8*
%13 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 1
store float 1.000000e+00, float* %13
br label %14
14: ; preds = %4, %35
%15 = phi i64 [ 1, %4 ], [ %37, %35 ]
%16 = trunc i64 %15 to i32
%17 = call float %3(float (float)* %0, float %1, float %2, i32 %16)
%18 = getelementptr inbounds [16 x float], [16 x float]* %8, i64 0, i64 %15
store float %17, float* %18
%19 = icmp ugt i64 %15, 4
br i1 %19, label %20, label %35
20: ; preds = %14
%21 = add nuw i64 %15, 4294967291
%22 = and i64 %21, 4294967295
%23 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 %22
%24 = getelementptr inbounds [16 x float], [16 x float]* %8, i64 0, i64 %22
%25 = load float, float* %6
%26 = call double @fabs(float %25)
%27 = load float, float* %5
%28 = call double @fabs(float %27)
%29 = fmul double %28, 0x3EB0C6F7A0B5ED8D
%30 = fcmp olt double %26, %29
br i1 %30, label %33, label %31
31: ; preds = %20
%32 = load float, float* %18
br label %35
33: ; preds = %20
%34 = load float, float* %5
br label %45
35: ; preds = %31, %14
%36 = phi float [ %32, %31 ], [ %17, %14 ]
%37 = add nuw nsw i64 %15, 1
%38 = getelementptr inbounds [16 x float], [16 x float]* %8, i64 0, i64 %37
store float %36, float* %38
%39 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 %15
%40 = load float, float* %39
%41 = fdiv float %40, 9.000000e+00
%42 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 %37
store float %41, float* %42
%43 = icmp eq i64 %37, 15
br i1 %43, label %44, label %14
44: ; preds = %35
br label %45
45: ; preds = %44, %33
%46 = phi float [ %34, %33 ], [ 0.000000e+00, %44 ]
ret float %46
}