int main(void) {
  double x_min = -10, x_max = 10, f1, f2, fc, x_center;
  int i = 0;
  printf("[No.]%15s%15s%15s%15s%15s%15s%15s\n", "x_min", "f(x_min)", "x_center",
         "f(x_center)", "x_max", "f(x_max)", "|x_max-x_min|");
  do {
    x_center = (x_max + x_min) / 2.0;
    fc = (2 * (x_center) * (x_center) * (x_center)-4 * (x_center) * (x_center) +
          3 * (x_center)-6);
    if (f1 * fc > 0) {
      x_min = x_center;
      f1 = fc;
    } else {
      x_max = x_center;
      f2 = fc;
    }
    printf("[%3d]%15.6f%15.6f%15.6f%15.6f%15.6f%15.6f%15g\n", ++i, x_min, f1,
           x_center, fc, x_max, f2, fabs(x_max - x_min));
  } while (fabs(x_max - x_min) > 1e-6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xf09(%rip),%rdi
lea    0xf25(%rip),%rsi
lea    0xf24(%rip),%rdx
lea    0xf26(%rip),%rcx
lea    0xf28(%rip),%r8
lea    0xf2d(%rip),%r9
lea    0xf2c(%rip),%r10
lea    0xf2e(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe7d(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  0xe5e(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xe20(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe08(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1241 <main+0x131>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1255 <main+0x145>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x3c(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x3c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x18(%rbp),%xmm6
subsd  -0x10(%rbp),%xmm6
movaps 0xdb3(%rip),%xmm7
pand   %xmm7,%xmm6
lea    0xe1c(%rip),%rdi
mov    $0x7,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xd90(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd74(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1188 <main+0x78>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xf88(%rip),%rbx
lea    0xf78(%rip),%r10
lea    0xf24(%rip),%rdi
lea    0xf40(%rip),%rsi
lea    0xf3f(%rip),%rdx
lea    0xf41(%rip),%rcx
lea    0xf43(%rip),%r8
lea    0xf48(%rip),%r9
xor    %eax,%eax
push   %rbx
push   %r10
call   1030 <printf@plt>
add    $0x10,%rsp
movsd  0xe9b(%rip),%xmm1
movsd  0xe9b(%rip),%xmm4
mov    $0x1,%ebx
lea    0xf3b(%rip),%r14
jmp    11ff <main+0xef>
xchg   %ax,%ax
movsd  %xmm0,0x10(%rsp)
movsd  %xmm4,0x18(%rsp)
xorpd  %xmm7,%xmm7
cmpltsd %xmm5,%xmm7
movapd %xmm7,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm6,%xmm7
orpd   %xmm1,%xmm7
movapd %xmm7,%xmm1
movapd %xmm7,0x30(%rsp)
movapd %xmm4,%xmm5
subsd  %xmm0,%xmm5
andpd  0xe81(%rip),%xmm5
movapd %xmm5,%xmm6
movapd %xmm5,0x20(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm5
mov    $0x7,%al
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm4
add    $0x1,%ebx
movapd 0x20(%rsp),%xmm0
ucomisd 0xe3e(%rip),%xmm0
movaps 0x30(%rsp),%xmm6
movsd  0x10(%rsp),%xmm1
jbe    1278 <main+0x168>
movapd %xmm4,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xe01(%rip),%xmm2
movapd %xmm2,%xmm5
addsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
movapd %xmm2,%xmm3
mulsd  0xdf1(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm5
addsd  %xmm3,%xmm5
movapd %xmm2,%xmm3
mulsd  0xde1(%rip),%xmm3
addsd  %xmm5,%xmm3
addsd  0xddd(%rip),%xmm3
movapd %xmm6,%xmm5
mulsd  %xmm3,%xmm5
ucomisd 0xddd(%rip),%xmm5
movapd %xmm2,%xmm0
ja     1180 <main+0x70>
movsd  %xmm3,0x8(%rsp)
movapd %xmm2,%xmm4
movapd %xmm1,%xmm0
jmp    1180 <main+0x70>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [35 x i8] c"[No.]%15s%15s%15s%15s%15s%15s%15s\0A\00"
@.str.1 = [6 x i8] c"x_min\00"
@.str.2 = [9 x i8] c"f(x_min)\00"
@.str.3 = [9 x i8] c"x_center\00"
@.str.4 = [12 x i8] c"f(x_center)\00"
@.str.5 = [6 x i8] c"x_max\00"
@.str.6 = [9 x i8] c"f(x_max)\00"
@.str.7 = [14 x i8] c"|x_max-x_min|\00"
@.str.8 = [47 x i8] c"[%3d]%15.6f%15.6f%15.6f%15.6f%15.6f%15.6f%15g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %1
store double -1.000000e+01, double* %2
store double 1.000000e+01, double* %3
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %10
10: ; preds = %53, %0
%11 = load double, double* %3
%12 = load double, double* %2
%13 = fadd double %11, %12
%14 = fdiv double %13, 2.000000e+00
store double %14, double* %7
%15 = load double, double* %7
%16 = fmul double 2.000000e+00, %15
%17 = load double, double* %7
%18 = fmul double %16, %17
%19 = load double, double* %7
%20 = load double, double* %7
%21 = fmul double 4.000000e+00, %20
%22 = load double, double* %7
%23 = fmul double %21, %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %18, double %19, double %24)
%26 = load double, double* %7
%27 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %26, double %25)
%28 = fsub double %27, 6.000000e+00
store double %28, double* %6
%29 = load double, double* %4
%30 = load double, double* %6
%31 = fmul double %29, %30
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %10
%34 = load double, double* %7
store double %34, double* %2
%35 = load double, double* %6
store double %35, double* %4
br label %39
36: ; preds = %10
%37 = load double, double* %7
store double %37, double* %3
%38 = load double, double* %6
store double %38, double* %5
br label %39
39: ; preds = %36, %33
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
%42 = load double, double* %2
%43 = load double, double* %4
%44 = load double, double* %7
%45 = load double, double* %6
%46 = load double, double* %3
%47 = load double, double* %5
%48 = load double, double* %3
%49 = load double, double* %2
%50 = fsub double %48, %49
%51 = call double @llvm.fabs.f64(double %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i32 %41, double %42, double %43, double %44, double %45, double %46, double %47, double %51)
br label %53
53: ; preds = %39
%54 = load double, double* %3
%55 = load double, double* %2
%56 = fsub double %54, %55
%57 = call double @llvm.fabs.f64(double %56)
%58 = fcmp ogt double %57, 0x3EB0C6F7A0B5ED8D
br i1 %58, label %10, label %59
59: ; preds = %53
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"[No.]%15s%15s%15s%15s%15s%15s%15s\0A\00"
@.str.1 = [6 x i8] c"x_min\00"
@.str.2 = [9 x i8] c"f(x_min)\00"
@.str.3 = [9 x i8] c"x_center\00"
@.str.4 = [12 x i8] c"f(x_center)\00"
@.str.5 = [6 x i8] c"x_max\00"
@.str.6 = [9 x i8] c"f(x_max)\00"
@.str.7 = [14 x i8] c"|x_max-x_min|\00"
@.str.8 = [47 x i8] c"[%3d]%15.6f%15.6f%15.6f%15.6f%15.6f%15.6f%15g\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = phi double [ undef, %0 ], [ %19, %2 ]
%4 = phi double [ undef, %0 ], [ %20, %2 ]
%5 = phi double [ 1.000000e+01, %0 ], [ %21, %2 ]
%6 = phi double [ -1.000000e+01, %0 ], [ %22, %2 ]
%7 = phi i32 [ 0, %0 ], [ %23, %2 ]
%8 = fadd double %5, %6
%9 = fmul double %8, 5.000000e-01
%10 = fmul double %9, 2.000000e+00
%11 = fmul double %9, %10
%12 = fmul double %9, -4.000000e+00
%13 = fmul double %9, %12
%14 = tail call double @llvm.fmuladd.f64(double %11, double %9, double %13)
%15 = tail call double @llvm.fmuladd.f64(double %9, double 3.000000e+00, double %14)
%16 = fadd double %15, -6.000000e+00
%17 = fmul double %3, %16
%18 = fcmp ogt double %17, 0.000000e+00
%19 = select i1 %18, double %16, double %3
%20 = select i1 %18, double %4, double %16
%21 = select i1 %18, double %5, double %9
%22 = select i1 %18, double %9, double %6
%23 = add nuw nsw i32 %7, 1
%24 = fsub double %21, %22
%25 = tail call double @llvm.fabs.f64(double %24)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i32 %23, double %22, double %19, double %9, double %16, double %21, double %20, double %25)
%27 = fcmp ogt double %25, 0x3EB0C6F7A0B5ED8D
br i1 %27, label %2, label %28
28: ; preds = %2
ret i32 0
}