float compute_ideal_breadth(new_guess, length, goals, accuracy)
long int length, goals;
float new_guess, accuracy;
{
  float fgoals, guessed_branch;
  int count;
  if (goals != 0) {
    count = 0;
    fgoals = (float)goals;
    do {
      guessed_branch = new_guess;
      new_guess = guessed_branch - f(guessed_branch, length, fgoals) /
                                       fprime(guessed_branch, length, fgoals);
      count++;
    } while ((fabs(guessed_branch - new_guess) > accuracy) && (count < 300));
    if (count == 300)
      new_guess = -1.0;
  } else
    new_guess = 0.0;
  return (new_guess);
}


x86 assembly (clang, -O0):
<compute_ideal_breadth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1248 <compute_ideal_breadth+0x128>
movl   $0x0,-0x28(%rbp)
cvtsi2ssq -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rdi
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1030 <f@plt>
mov    %eax,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rdi
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1040 <fprime@plt>
movss  -0x38(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movaps 0xe0b(%rip),%xmm1
pand   %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x39(%rbp)
jbe    121e <compute_ideal_breadth+0xfe>
cmpl   $0x12c,-0x28(%rbp)
setl   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    116c <compute_ideal_breadth+0x4c>
cmpl   $0x12c,-0x28(%rbp)
jne    1243 <compute_ideal_breadth+0x123>
movss  0xdd2(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1250 <compute_ideal_breadth+0x130>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_ideal_breadth>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
test   %rsi,%rsi
je     11ea <compute_ideal_breadth+0xca>
mov    %rdi,%r14
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x8(%rsp)
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %rsi,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movss  %xmm0,0xc(%rsp)
movaps %xmm0,0x20(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1030 <f@plt>
mov    %eax,%ebp
movsd  0x18(%rsp),%xmm0
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1040 <fprime@plt>
movss  0xc(%rsp),%xmm0
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
lea    0x1(%rbx),%eax
movaps 0x20(%rsp),%xmm1
subss  %xmm0,%xmm1
andps  0xe38(%rip),%xmm1
ucomiss 0x8(%rsp),%xmm1
jbe    11d9 <compute_ideal_breadth+0xb9>
cmp    $0x12b,%ebx
mov    %eax,%ebx
jb     1160 <compute_ideal_breadth+0x40>
cmp    $0x12c,%eax
jne    11ed <compute_ideal_breadth+0xcd>
movss  0xe28(%rip),%xmm0
jmp    11ed <compute_ideal_breadth+0xcd>
xorps  %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define float @compute_ideal_breadth(double %0, i64 %1, i64 %2, double %3) {
%5 = alloca float
%6 = alloca i64
%7 = alloca i64
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = fptrunc double %0 to float
%13 = fptrunc double %3 to float
store float %12, float* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store float %13, float* %8
%14 = load i64, i64* %7
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %58
16: ; preds = %4
store i32 0, i32* %11
%17 = load i64, i64* %7
%18 = sitofp i64 %17 to float
store float %18, float* %9
br label %19
19: ; preds = %51, %16
%20 = load float, float* %5
store float %20, float* %10
%21 = load float, float* %10
%22 = load float, float* %10
%23 = fpext float %22 to double
%24 = load i64, i64* %6
%25 = load float, float* %9
%26 = fpext float %25 to double
%27 = call i32 (double, i64, double, ...) bitcast (i32 (...)* @f to i32 (double, i64, double, ...)*)(double %23, i64 %24, double %26)
%28 = load float, float* %10
%29 = fpext float %28 to double
%30 = load i64, i64* %6
%31 = load float, float* %9
%32 = fpext float %31 to double
%33 = call i32 (double, i64, double, ...) bitcast (i32 (...)* @fprime to i32 (double, i64, double, ...)*)(double %29, i64 %30, double %32)
%34 = sdiv i32 %27, %33
%35 = sitofp i32 %34 to float
%36 = fsub float %21, %35
store float %36, float* %5
%37 = load i32, i32* %11
%38 = add nsw i32 %37, 1
store i32 %38, i32* %11
br label %39
39: ; preds = %19
%40 = load float, float* %10
%41 = load float, float* %5
%42 = fsub float %40, %41
%43 = fpext float %42 to double
%44 = call double @llvm.fabs.f64(double %43)
%45 = load float, float* %8
%46 = fpext float %45 to double
%47 = fcmp ogt double %44, %46
br i1 %47, label %48, label %51
48: ; preds = %39
%49 = load i32, i32* %11
%50 = icmp slt i32 %49, 300
br label %51
51: ; preds = %48, %39
%52 = phi i1 [ false, %39 ], [ %50, %48 ]
br i1 %52, label %19, label %53
53: ; preds = %51
%54 = load i32, i32* %11
%55 = icmp eq i32 %54, 300
br i1 %55, label %56, label %57
56: ; preds = %53
store float -1.000000e+00, float* %5
br label %57
57: ; preds = %56, %53
br label %59
58: ; preds = %4
store float 0.000000e+00, float* %5
br label %59
59: ; preds = %58, %57
%60 = load float, float* %5
ret float %60
}

LLVM IR (-O2):
define float @compute_ideal_breadth(double %0, i64 %1, i64 %2, double %3) {
%5 = fptrunc double %3 to float
%6 = icmp eq i64 %2, 0
br i1 %6, label %29, label %7
7: ; preds = %4
%8 = fptrunc double %0 to float
%9 = sitofp i64 %2 to float
%10 = fpext float %9 to double
br label %11
11: ; preds = %11, %7
%12 = phi float [ %8, %7 ], [ %19, %11 ]
%13 = phi i32 [ 0, %7 ], [ %20, %11 ]
%14 = fpext float %12 to double
%15 = tail call i32 (double, i64, double, ...) bitcast (i32 (...)* @f to i32 (double, i64, double, ...)*)(double %14, i64 %1, double %10)
%16 = tail call i32 (double, i64, double, ...) bitcast (i32 (...)* @fprime to i32 (double, i64, double, ...)*)(double %14, i64 %1, double %10)
%17 = sdiv i32 %15, %16
%18 = sitofp i32 %17 to float
%19 = fsub float %12, %18
%20 = add nuw nsw i32 %13, 1
%21 = fsub float %12, %19
%22 = tail call float @llvm.fabs.f32(float %21)
%23 = fcmp ogt float %22, %5
%24 = icmp ult i32 %13, 299
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %11, label %26
26: ; preds = %11
%27 = icmp eq i32 %20, 300
%28 = select i1 %27, float -1.000000e+00, float %19
br label %29
29: ; preds = %26, %4
%30 = phi float [ %28, %26 ], [ 0.000000e+00, %4 ]
ret float %30
}