double regulafalsi(double initiala, double initialb, double accuracy,
                   double (*f)(double)) {
  int i = 1;
  double a = initiala, b = initialb, c = (a + b) / 2, cminus1, fa = f(a),
         fb = f(b), fc, ei = exp(1);
  printf("REGULA FALSI "
         "METHOD:\n\ni\ta\t\tb\t\tc\t\tf(c)\t\t|f(c)|\t\t|ei|\t\t|log(ei)/"
         "log(e(i-1))|\n");
  do {
    cminus1 = c;
    if (fa == fb)
      c = (a + b) / 2;
    else
      c = (a * fb - b * fa) / (fb - fa);
    if (!(fc = f(c)))
      break;
    printf("%02d\t%+09g\t%+09g\t%+09g\t%+09g\t%+09g\t%+09g\t%+09g\n", i++, a, b,
           c, fc, abslt(fc), b - a, abslt(log(abslt(b - a)) / ei));
    ei = (b - a);
    if (fa * fc > 0)
      fa = fc, a = c;
    else
      fb = fc, b = c;
  } while (abslt(c - cminus1) > accuracy);
  return c;
}


x86 assembly (clang, -O0):
<regulafalsi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  -0x30(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rax
movsd  -0x38(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x58(%rbp)
movsd  0xe44(%rip),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x68(%rbp)
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jne    1214 <regulafalsi+0xd4>
jp     1214 <regulafalsi+0xd4>
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xe02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    125a <regulafalsi+0x11a>
movsd  -0x30(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  -0x40(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1282 <regulafalsi+0x142>
jp     1282 <regulafalsi+0x142>
jmp    13b9 <regulafalsi+0x279>
mov    -0x24(%rbp),%eax
mov    %eax,-0x9c(%rbp)
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
mov    %eax,-0x74(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
cvtsi2sd %eax,%xmm0
call   1060 <log@plt>
divsd  -0x68(%rbp),%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
mov    -0x9c(%rbp),%esi
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x80(%rbp),%xmm3
mov    -0x74(%rbp),%edx
movsd  -0x70(%rbp),%xmm4
mov    %eax,%ecx
lea    0xd22(%rip),%rdi
mov    $0x5,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1380 <regulafalsi+0x240>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1394 <regulafalsi+0x254>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1399 <regulafalsi+0x259>
movsd  -0x40(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
cvtsi2sd %eax,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     11d4 <regulafalsi+0x94>
movsd  -0x40(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regulafalsi>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%r15
movsd  %xmm2,0x58(%rsp)
movapd %xmm1,0x10(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xe97(%rip),%xmm2
movsd  %xmm2,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
call   *%rdi
movsd  %xmm0,0x28(%rsp)
movaps 0x10(%rsp),%xmm0
call   *%r15
movsd  %xmm0,0x40(%rsp)
lea    0xeb6(%rip),%rdi
call   1040 <puts@plt>
movsd  0xe69(%rip),%xmm0
movsd  %xmm0,0x48(%rsp)
mov    $0x1,%ebp
lea    0xe67(%rip),%r14
jmp    122e <regulafalsi+0xee>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm1,0x40(%rsp)
movsd  0x20(%rsp),%xmm2
movapd 0x30(%rsp),%xmm3
add    $0x1,%ebp
xorpd  %xmm1,%xmm1
cmpltsd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm3,%xmm1
orpd   %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
movapd %xmm3,%xmm0
subsd  %xmm2,%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd 0x58(%rsp),%xmm0
movaps 0x30(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movaps 0x60(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
jbe    1340 <regulafalsi+0x200>
movsd  0x28(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
ucomisd %xmm2,%xmm1
jne    1260 <regulafalsi+0x120>
jp     1260 <regulafalsi+0x120>
movapd 0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xdaa(%rip),%xmm0
jmp    1280 <regulafalsi+0x140>
nopl   0x0(%rax,%rax,1)
movapd %xmm1,%xmm3
mulsd  0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
subsd  %xmm3,%xmm0
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
movapd %xmm0,0x30(%rsp)
call   *%r15
ucomisd 0xd7f(%rip),%xmm0
jne    1299 <regulafalsi+0x159>
jnp    1340 <regulafalsi+0x200>
mov    $0x1,%al
movsd  %xmm0,0x50(%rsp)
call   1030 <abslt@plt>
mov    %eax,%ebx
movapd 0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movapd %xmm0,0x60(%rsp)
mov    $0x1,%al
call   1030 <abslt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
call   1060 <log@plt>
divsd  0x48(%rsp),%xmm0
mov    $0x1,%al
call   1030 <abslt@plt>
mov    %r14,%rdi
mov    %ebp,%esi
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
movsd  0x50(%rsp),%xmm3
mov    %ebx,%edx
movaps 0x60(%rsp),%xmm4
mov    %eax,%ecx
mov    $0x5,%al
call   1050 <printf@plt>
movsd  0x50(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0x28(%rsp),%xmm0
ucomisd 0xcf3(%rip),%xmm0
jbe    11c0 <regulafalsi+0x80>
movapd 0x30(%rsp),%xmm3
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  0x20(%rsp),%xmm2
jmp    11d2 <regulafalsi+0x92>
movaps 0x30(%rsp),%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [76 x i8] c"REGULA FALSI METHOD:\0A\0Ai\09a\09\09b\09\09c\09\09f(c)\09\09|f(c)|\09\09|ei|\09\09|log(ei)/log(e(i-1))|\0A\00"
@.str.1 = [48 x i8] c"%02d\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\0A\00"
define double @regulafalsi(double %0, double %1, double %2, double (double)* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double (double)*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double (double)* %3, double (double)** %8
store i32 1, i32* %9
%18 = load double, double* %5
store double %18, double* %10
%19 = load double, double* %6
store double %19, double* %11
%20 = load double, double* %10
%21 = load double, double* %11
%22 = fadd double %20, %21
%23 = fdiv double %22, 2.000000e+00
store double %23, double* %12
%24 = load double (double)*, double (double)** %8
%25 = load double, double* %10
%26 = call double %24(double %25)
store double %26, double* %14
%27 = load double (double)*, double (double)** %8
%28 = load double, double* %11
%29 = call double %27(double %28)
store double %29, double* %15
%30 = call double @exp(double 1.000000e+00)
store double %30, double* %17
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %96, %4
%33 = load double, double* %12
store double %33, double* %13
%34 = load double, double* %14
%35 = load double, double* %15
%36 = fcmp oeq double %34, %35
br i1 %36, label %37, label %42
37: ; preds = %32
%38 = load double, double* %10
%39 = load double, double* %11
%40 = fadd double %38, %39
%41 = fdiv double %40, 2.000000e+00
store double %41, double* %12
br label %54
42: ; preds = %32
%43 = load double, double* %10
%44 = load double, double* %15
%45 = load double, double* %11
%46 = load double, double* %14
%47 = fmul double %45, %46
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %43, double %44, double %48)
%50 = load double, double* %15
%51 = load double, double* %14
%52 = fsub double %50, %51
%53 = fdiv double %49, %52
store double %53, double* %12
br label %54
54: ; preds = %42, %37
%55 = load double (double)*, double (double)** %8
%56 = load double, double* %12
%57 = call double %55(double %56)
store double %57, double* %16
%58 = fcmp une double %57, 0.000000e+00
br i1 %58, label %60, label %59
59: ; preds = %54
br label %104
60: ; preds = %54
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
%63 = load double, double* %10
%64 = load double, double* %11
%65 = load double, double* %12
%66 = load double, double* %16
%67 = load double, double* %16
%68 = call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %67)
%69 = load double, double* %11
%70 = load double, double* %10
%71 = fsub double %69, %70
%72 = load double, double* %11
%73 = load double, double* %10
%74 = fsub double %72, %73
%75 = call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %74)
%76 = sitofp i32 %75 to double
%77 = call double @log(double %76)
%78 = load double, double* %17
%79 = fdiv double %77, %78
%80 = call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %61, double %63, double %64, double %65, double %66, i32 %68, double %71, i32 %80)
%82 = load double, double* %11
%83 = load double, double* %10
%84 = fsub double %82, %83
store double %84, double* %17
%85 = load double, double* %14
%86 = load double, double* %16
%87 = fmul double %85, %86
%88 = fcmp ogt double %87, 0.000000e+00
br i1 %88, label %89, label %92
89: ; preds = %60
%90 = load double, double* %16
store double %90, double* %14
%91 = load double, double* %12
store double %91, double* %10
br label %95
92: ; preds = %60
%93 = load double, double* %16
store double %93, double* %15
%94 = load double, double* %12
store double %94, double* %11
br label %95
95: ; preds = %92, %89
br label %96
96: ; preds = %95
%97 = load double, double* %12
%98 = load double, double* %13
%99 = fsub double %97, %98
%100 = call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %99)
%101 = sitofp i32 %100 to double
%102 = load double, double* %7
%103 = fcmp ogt double %101, %102
br i1 %103, label %32, label %104
104: ; preds = %96, %59
%105 = load double, double* %12
ret double %105
}

LLVM IR (-O2):
@.str.1 = [48 x i8] c"%02d\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\09%+09g\0A\00"
@str = [75 x i8] c"REGULA FALSI METHOD:\0A\0Ai\09a\09\09b\09\09c\09\09f(c)\09\09|f(c)|\09\09|ei|\09\09|log(ei)/log(e(i-1))|\00"
define double @regulafalsi(double %0, double %1, double %2, double (double)* nocapture %3) {
%5 = fadd double %0, %1
%6 = fmul double %5, 5.000000e-01
%7 = tail call double %3(double %0)
%8 = tail call double %3(double %1)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %32, %4
%11 = phi double [ %1, %4 ], [ %44, %32 ]
%12 = phi double [ %6, %4 ], [ %29, %32 ]
%13 = phi double [ %0, %4 ], [ %45, %32 ]
%14 = phi double [ %7, %4 ], [ %46, %32 ]
%15 = phi double [ %8, %4 ], [ %47, %32 ]
%16 = phi i32 [ 1, %4 ], [ %33, %32 ]
%17 = phi double [ 0x4005BF0A8B145769, %4 ], [ %35, %32 ]
%18 = fcmp oeq double %14, %15
br i1 %18, label %19, label %22
19: ; preds = %10
%20 = fadd double %11, %13
%21 = fmul double %20, 5.000000e-01
br label %28
22: ; preds = %10
%23 = fneg double %11
%24 = fmul double %14, %23
%25 = tail call double @llvm.fmuladd.f64(double %13, double %15, double %24)
%26 = fsub double %15, %14
%27 = fdiv double %25, %26
br label %28
28: ; preds = %22, %19
%29 = phi double [ %21, %19 ], [ %27, %22 ]
%30 = tail call double %3(double %29)
%31 = fcmp une double %30, 0.000000e+00
br i1 %31, label %32, label %52
32: ; preds = %28
%33 = add nuw nsw i32 %16, 1
%34 = tail call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %30)
%35 = fsub double %11, %13
%36 = tail call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %35)
%37 = sitofp i32 %36 to double
%38 = tail call double @log(double %37)
%39 = fdiv double %38, %17
%40 = tail call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %39)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %16, double %13, double %11, double %29, double %30, i32 %34, double %35, i32 %40)
%42 = fmul double %14, %30
%43 = fcmp ogt double %42, 0.000000e+00
%44 = select i1 %43, double %11, double %29
%45 = select i1 %43, double %29, double %13
%46 = select i1 %43, double %30, double %14
%47 = select i1 %43, double %15, double %30
%48 = fsub double %29, %12
%49 = tail call i32 (double, ...) bitcast (i32 (...)* @abslt to i32 (double, ...)*)(double %48)
%50 = sitofp i32 %49 to double
%51 = fcmp ogt double %50, %2
br i1 %51, label %10, label %52
52: ; preds = %28, %32
ret double %29
}