double disroot(a, b, f, eps)
double a, b, (*f)(), eps;
{
  double x, ym;
  double ya = (*f)(a);
  double yb = (*f)(b);
  while (b - a > eps) {
    x = (a + b) / 2;
    printf("%1.7f    %1.7f    %1.7f\n", a, x, b);
    ym = (*f)(x);
    if (ym == 0)
      return (x);
    if (ya * ym < 0.0) {
      b = x;
      yb = ym;
    } else {
      a = x;
      ya = ym;
    }
  }
  return ((a + b) / 2);
}


x86 assembly (clang, -O0):
<disroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rcx
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    121e <disroot+0x10e>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe73(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rcx
movsd  -0x30(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d5 <disroot+0xc5>
jp     11d5 <disroot+0xc5>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1239 <disroot+0x129>
movsd  -0x40(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1205 <disroot+0xf5>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1219 <disroot+0x109>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    114f <disroot+0x3f>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xdd0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disroot>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  %xmm2,0x18(%rsp)
mov    %rdi,%rbx
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%al
call   *%rdi
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   *%rbx
movsd  0x10(%rsp),%xmm3
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jbe    121c <disroot+0x10c>
lea    0xea1(%rip),%r14
jmp    11aa <disroot+0x9a>
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm5
movapd %xmm5,%xmm3
movsd  (%rsp),%xmm2
cmpltsd %xmm6,%xmm1
andpd  %xmm1,%xmm4
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm4
movapd %xmm4,0x20(%rsp)
movapd %xmm2,%xmm0
subsd  %xmm5,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1220 <disroot+0x110>
movapd %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  0xe46(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %r14,%rdi
movsd  %xmm3,0x10(%rsp)
movapd %xmm3,%xmm0
movsd  %xmm2,(%rsp)
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   *%rbx
xorpd  %xmm6,%xmm6
ucomisd %xmm6,%xmm0
jne    11ef <disroot+0xdf>
jnp    1232 <disroot+0x122>
movapd 0x20(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm6
jbe    1170 <disroot+0x60>
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movapd %xmm3,%xmm5
jmp    117f <disroot+0x6f>
movapd %xmm3,%xmm5
addsd  %xmm5,%xmm2
mulsd  0xdd4(%rip),%xmm2
movapd %xmm2,%xmm0
jmp    1238 <disroot+0x128>
movsd  0x8(%rsp),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%1.7f %1.7f %1.7f\0A\00"
define double @disroot(double %0, double %1, double (...)* %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double (...)*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %6
store double %1, double* %7
store double (...)* %2, double (...)** %8
store double %3, double* %9
%14 = load double (...)*, double (...)** %8
%15 = load double, double* %6
%16 = bitcast double (...)* %14 to double (double, ...)*
%17 = call double (double, ...) %16(double %15)
store double %17, double* %12
%18 = load double (...)*, double (...)** %8
%19 = load double, double* %7
%20 = bitcast double (...)* %18 to double (double, ...)*
%21 = call double (double, ...) %20(double %19)
store double %21, double* %13
br label %22
22: ; preds = %56, %4
%23 = load double, double* %7
%24 = load double, double* %6
%25 = fsub double %23, %24
%26 = load double, double* %9
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %57
28: ; preds = %22
%29 = load double, double* %6
%30 = load double, double* %7
%31 = fadd double %29, %30
%32 = fdiv double %31, 2.000000e+00
store double %32, double* %10
%33 = load double, double* %6
%34 = load double, double* %10
%35 = load double, double* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %33, double %34, double %35)
%37 = load double (...)*, double (...)** %8
%38 = load double, double* %10
%39 = bitcast double (...)* %37 to double (double, ...)*
%40 = call double (double, ...) %39(double %38)
store double %40, double* %11
%41 = load double, double* %11
%42 = fcmp oeq double %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %28
%44 = load double, double* %10
store double %44, double* %5
br label %62
45: ; preds = %28
%46 = load double, double* %12
%47 = load double, double* %11
%48 = fmul double %46, %47
%49 = fcmp olt double %48, 0.000000e+00
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load double, double* %10
store double %51, double* %7
%52 = load double, double* %11
store double %52, double* %13
br label %56
53: ; preds = %45
%54 = load double, double* %10
store double %54, double* %6
%55 = load double, double* %11
store double %55, double* %12
br label %56
56: ; preds = %53, %50
br label %22
57: ; preds = %22
%58 = load double, double* %6
%59 = load double, double* %7
%60 = fadd double %58, %59
%61 = fdiv double %60, 2.000000e+00
store double %61, double* %5
br label %62
62: ; preds = %57, %43
%63 = load double, double* %5
ret double %63
}

LLVM IR (-O2):
@.str = [25 x i8] c"%1.7f %1.7f %1.7f\0A\00"
define double @disroot(double %0, double %1, double (...)* nocapture %2, double %3) {
%5 = bitcast double (...)* %2 to double (double, ...)*
%6 = tail call double (double, ...) %5(double %0)
%7 = tail call double (double, ...) %5(double %1)
%8 = fsub double %1, %0
%9 = fcmp ogt double %8, %3
br i1 %9, label %10, label %27
10: ; preds = %4, %19
%11 = phi double [ %24, %19 ], [ %6, %4 ]
%12 = phi double [ %23, %19 ], [ %0, %4 ]
%13 = phi double [ %22, %19 ], [ %1, %4 ]
%14 = fadd double %13, %12
%15 = fmul double %14, 5.000000e-01
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %12, double %15, double %13)
%17 = tail call double (double, ...) %5(double %15)
%18 = fcmp oeq double %17, 0.000000e+00
br i1 %18, label %32, label %19
19: ; preds = %10
%20 = fmul double %11, %17
%21 = fcmp olt double %20, 0.000000e+00
%22 = select i1 %21, double %15, double %13
%23 = select i1 %21, double %12, double %15
%24 = select i1 %21, double %11, double %17
%25 = fsub double %22, %23
%26 = fcmp ogt double %25, %3
br i1 %26, label %10, label %27
27: ; preds = %19, %4
%28 = phi double [ %1, %4 ], [ %22, %19 ]
%29 = phi double [ %0, %4 ], [ %23, %19 ]
%30 = fadd double %28, %29
%31 = fmul double %30, 5.000000e-01
br label %32
32: ; preds = %10, %27
%33 = phi double [ %31, %27 ], [ %15, %10 ]
ret double %33
}