int main() {
  float x0, x1, x2, error;
  int i = 0;
  printf("Input Two Approximations: ");
  scanf("%f %f", &x0, &x1);
  printf("Ite\tX0\t\tX1\t\tf(X0)\t\tf(X1)\t\tError\n");
  do {
    x2 = ((x0 * (pow(x1, 3) - 18)) - ((x1) * (pow(x0, 3) - 18))) /
         (((pow(x1, 3) - 18) - (pow(x0, 3) - 18)));
    printf("%2d\t%4.6f\t%4.6f\t%4.6f\t%4.6f\t%4.6f\n", i++, x0, x1,
           (pow(x0, 3) - 18), (pow(x1, 3) - 18), error);
    error = fabs((x2) - (x1));
    x0 = x1;
    x1 = x2;
  } while (error > 0.00005);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe81(%rip),%xmm1
call   1050 <pow@plt>
movsd  0xe6c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4c(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
movsd  0xe25(%rip),%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf0(%rip),%xmm1
call   1050 <pow@plt>
movsd  0xddb(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc9(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  0xda7(%rip),%xmm3
subsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd61(%rip),%xmm1
call   1050 <pow@plt>
movsd  0xd4c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd3a(%rip),%xmm1
call   1050 <pow@plt>
mov    -0x34(%rbp),%esi
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x20(%rbp),%xmm0
movsd  0xd10(%rip),%xmm4
subsd  %xmm4,%xmm3
movss  -0x14(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xd56(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movaps 0xcd0(%rip),%xmm1
pand   %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcbe(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1178 <main+0x48>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xee1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm2
lea    0xec2(%rip),%r14
nop
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  0xe57(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe4f(%rip),%xmm0
addsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe15(%rip),%xmm1
call   1060 <pow@plt>
addsd  0xe10(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde0(%rip),%xmm1
call   1060 <pow@plt>
addsd  0xddb(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdbb(%rip),%xmm1
call   1060 <pow@plt>
addsd  0xdb6(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
lea    0x1(%rbx),%ebp
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xd65(%rip),%xmm1
call   1060 <pow@plt>
addsd  0xd60(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd40(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm3
addsd  0xd38(%rip),%xmm3
movaps 0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm4
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x28(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    $0x5,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm2
movss  0x8(%rsp),%xmm0
movaps %xmm2,%xmm1
subss  %xmm0,%xmm1
andps  0xd0f(%rip),%xmm1
movss  %xmm0,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
movaps %xmm1,0x30(%rsp)
cvtss2sd %xmm1,%xmm1
ucomisd 0xce2(%rip),%xmm1
mov    %ebp,%ebx
ja     1190 <main+0x50>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Input Two Approximations: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [33 x i8] c"Ite\09X0\09\09X1\09\09f(X0)\09\09f(X1)\09\09Error\0A\00"
@.str.3 = [35 x i8] c"%2d\09%4.6f\09%4.6f\09%4.6f\09%4.6f\09%4.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %62, %0
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = call double @pow(double %14, double 3.000000e+00)
%16 = fsub double %15, 1.800000e+01
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = call double @pow(double %20, double 3.000000e+00)
%22 = fsub double %21, 1.800000e+01
%23 = fmul double %18, %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %12, double %16, double %24)
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = call double @pow(double %27, double 3.000000e+00)
%29 = fsub double %28, 1.800000e+01
%30 = load float, float* %2
%31 = fpext float %30 to double
%32 = call double @pow(double %31, double 3.000000e+00)
%33 = fsub double %32, 1.800000e+01
%34 = fsub double %29, %33
%35 = fdiv double %25, %34
%36 = fptrunc double %35 to float
store float %36, float* %4
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = load float, float* %2
%44 = fpext float %43 to double
%45 = call double @pow(double %44, double 3.000000e+00)
%46 = fsub double %45, 1.800000e+01
%47 = load float, float* %3
%48 = fpext float %47 to double
%49 = call double @pow(double %48, double 3.000000e+00)
%50 = fsub double %49, 1.800000e+01
%51 = load float, float* %5
%52 = fpext float %51 to double
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %37, double %40, double %42, double %46, double %50, double %52)
%54 = load float, float* %4
%55 = load float, float* %3
%56 = fsub float %54, %55
%57 = fpext float %56 to double
%58 = call double @llvm.fabs.f64(double %57)
%59 = fptrunc double %58 to float
store float %59, float* %5
%60 = load float, float* %3
store float %60, float* %2
%61 = load float, float* %4
store float %61, float* %3
br label %62
62: ; preds = %10
%63 = load float, float* %5
%64 = fpext float %63 to double
%65 = fcmp ogt double %64, 5.000000e-05
br i1 %65, label %10, label %66
66: ; preds = %62
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Input Two Approximations: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.3 = [35 x i8] c"%2d\09%4.6f\09%4.6f\09%4.6f\09%4.6f\09%4.6f\0A\00"
@str = [32 x i8] c"Ite\09X0\09\09X1\09\09f(X0)\09\09f(X1)\09\09Error\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%8 = load float, float* %1
%9 = load float, float* %2
br label %10
10: ; preds = %10, %0
%11 = phi float [ %9, %0 ], [ %38, %10 ]
%12 = phi float [ %8, %0 ], [ %52, %10 ]
%13 = phi float [ undef, %0 ], [ %54, %10 ]
%14 = phi i32 [ 0, %0 ], [ %39, %10 ]
%15 = fpext float %12 to double
%16 = fpext float %11 to double
%17 = call double @pow(double %16, double 3.000000e+00)
%18 = fadd double %17, -1.800000e+01
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = call double @pow(double %22, double 3.000000e+00)
%24 = fadd double %23, -1.800000e+01
%25 = fneg double %24
%26 = fmul double %20, %25
%27 = call double @llvm.fmuladd.f64(double %15, double %18, double %26)
%28 = load float, float* %2
%29 = fpext float %28 to double
%30 = call double @pow(double %29, double 3.000000e+00)
%31 = fadd double %30, -1.800000e+01
%32 = load float, float* %1
%33 = fpext float %32 to double
%34 = call double @pow(double %33, double 3.000000e+00)
%35 = fadd double %34, -1.800000e+01
%36 = fsub double %31, %35
%37 = fdiv double %27, %36
%38 = fptrunc double %37 to float
%39 = add nuw nsw i32 %14, 1
%40 = load float, float* %1
%41 = fpext float %40 to double
%42 = load float, float* %2
%43 = fpext float %42 to double
%44 = call double @pow(double %41, double 3.000000e+00)
%45 = fadd double %44, -1.800000e+01
%46 = load float, float* %2
%47 = fpext float %46 to double
%48 = call double @pow(double %47, double 3.000000e+00)
%49 = fadd double %48, -1.800000e+01
%50 = fpext float %13 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %14, double %41, double %43, double %45, double %49, double %50)
%52 = load float, float* %2
%53 = fsub float %38, %52
%54 = call float @llvm.fabs.f32(float %53)
store float %52, float* %1
store float %38, float* %2
%55 = fpext float %54 to double
%56 = fcmp ogt double %55, 5.000000e-05
br i1 %56, label %10, label %57
57: ; preds = %10
ret i32 0
}