int interroot(x0, ab, f, eps, max)
double *x0, ab, (*f)(), eps;
int max;
{
  double x, dis;
  double y0, yd, yab = f(ab);
  int num = 0;
  do {
    y0 = f(*x0);
    yd = (*x0 - ab) / (y0 - yab);
    x = *x0 - yd * y0;
    num++;
    dis = fabs(x - *x0);
    if (dis < fabs(y0))
      dis = fabs(y0);
    printf("%1.7f    %1.7f    %1.7f\n", *x0, x, dis);
    *x0 = x;
  } while (dis > eps && num < max);
  if (num == max)
    return (0);
  else
    return (1);
}


x86 assembly (clang, -O0):
<interroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %edx,-0x2c(%rbp)
mov    -0x20(%rbp),%rcx
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movaps 0xe32(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movaps 0xe18(%rip),%xmm2
pand   %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    120b <interroot+0xfb>
movsd  -0x48(%rbp),%xmm0
movaps 0xdfe(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
lea    0xdec(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x5d(%rbp)
jbe    1259 <interroot+0x149>
mov    -0x5c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
setl   %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
test   $0x1,%al
jne    1146 <interroot+0x36>
mov    -0x5c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    127c <interroot+0x16c>
movl   $0x0,-0x4(%rbp)
jmp    1283 <interroot+0x173>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interroot>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %edx,%r14d
movsd  %xmm1,0x10(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbp
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%al
call   *%rsi
movsd  %xmm0,(%rsp)
movsd  0x0(%rbp),%xmm0
mov    $0x1,%ebx
lea    0xec5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    $0x1,%al
call   *%r12
movapd %xmm0,%xmm3
movsd  0x0(%rbp),%xmm0
movapd %xmm0,%xmm1
subsd  0x8(%rsp),%xmm1
movapd %xmm3,%xmm2
subsd  (%rsp),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm4
movapd %xmm2,%xmm1
movsd  %xmm2,0x18(%rsp)
subsd  %xmm0,%xmm4
movapd 0xe65(%rip),%xmm2
andpd  %xmm2,%xmm4
andpd  %xmm2,%xmm3
maxsd  %xmm4,%xmm3
movapd %xmm3,0x20(%rsp)
mov    %r15,%rdi
movapd %xmm3,%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp)
lea    0x1(%rbx),%ecx
movapd 0x20(%rsp),%xmm1
ucomisd 0x10(%rsp),%xmm1
jbe    11e2 <interroot+0xd2>
cmp    %r14d,%ebx
mov    %ecx,%ebx
jl     1150 <interroot+0x40>
sub    %r14d,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
setne  %al
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%1.7f %1.7f %1.7f\0A\00"
define i32 @interroot(double* %0, double %1, double (...)* %2, double %3, i32 %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca double
%9 = alloca double (...)*
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
store double* %0, double** %7
store double %1, double* %8
store double (...)* %2, double (...)** %9
store double %3, double* %10
store i32 %4, i32* %11
%18 = load double (...)*, double (...)** %9
%19 = load double, double* %8
%20 = bitcast double (...)* %18 to double (double, ...)*
%21 = call double (double, ...) %20(double %19)
store double %21, double* %16
store i32 0, i32* %17
br label %22
22: ; preds = %72, %5
%23 = load double (...)*, double (...)** %9
%24 = load double*, double** %7
%25 = load double, double* %24
%26 = bitcast double (...)* %23 to double (double, ...)*
%27 = call double (double, ...) %26(double %25)
store double %27, double* %14
%28 = load double*, double** %7
%29 = load double, double* %28
%30 = load double, double* %8
%31 = fsub double %29, %30
%32 = load double, double* %14
%33 = load double, double* %16
%34 = fsub double %32, %33
%35 = fdiv double %31, %34
store double %35, double* %15
%36 = load double*, double** %7
%37 = load double, double* %36
%38 = load double, double* %15
%39 = load double, double* %14
%40 = fneg double %38
%41 = call double @llvm.fmuladd.f64(double %40, double %39, double %37)
store double %41, double* %12
%42 = load i32, i32* %17
%43 = add nsw i32 %42, 1
store i32 %43, i32* %17
%44 = load double, double* %12
%45 = load double*, double** %7
%46 = load double, double* %45
%47 = fsub double %44, %46
%48 = call double @llvm.fabs.f64(double %47)
store double %48, double* %13
%49 = load double, double* %13
%50 = load double, double* %14
%51 = call double @llvm.fabs.f64(double %50)
%52 = fcmp olt double %49, %51
br i1 %52, label %53, label %56
53: ; preds = %22
%54 = load double, double* %14
%55 = call double @llvm.fabs.f64(double %54)
store double %55, double* %13
br label %56
56: ; preds = %53, %22
%57 = load double*, double** %7
%58 = load double, double* %57
%59 = load double, double* %12
%60 = load double, double* %13
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %58, double %59, double %60)
%62 = load double, double* %12
%63 = load double*, double** %7
store double %62, double* %63
br label %64
64: ; preds = %56
%65 = load double, double* %13
%66 = load double, double* %10
%67 = fcmp ogt double %65, %66
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = load i32, i32* %17
%70 = load i32, i32* %11
%71 = icmp slt i32 %69, %70
br label %72
72: ; preds = %68, %64
%73 = phi i1 [ false, %64 ], [ %71, %68 ]
br i1 %73, label %22, label %74
74: ; preds = %72
%75 = load i32, i32* %17
%76 = load i32, i32* %11
%77 = icmp eq i32 %75, %76
br i1 %77, label %78, label %79
78: ; preds = %74
store i32 0, i32* %6
br label %80
79: ; preds = %74
store i32 1, i32* %6
br label %80
80: ; preds = %79, %78
%81 = load i32, i32* %6
ret i32 %81
}

LLVM IR (-O2):
@.str = [25 x i8] c"%1.7f %1.7f %1.7f\0A\00"
define i32 @interroot(double* nocapture %0, double %1, double (...)* nocapture %2, double %3, i32 %4) {
%6 = bitcast double (...)* %2 to double (double, ...)*
%7 = tail call double (double, ...) %6(double %1)
%8 = load double, double* %0
br label %9
9: ; preds = %9, %5
%10 = phi double [ %8, %5 ], [ %18, %9 ]
%11 = phi i32 [ 0, %5 ], [ %19, %9 ]
%12 = tail call double (double, ...) %6(double %10)
%13 = load double, double* %0
%14 = fsub double %13, %1
%15 = fsub double %12, %7
%16 = fneg double %14
%17 = fdiv double %16, %15
%18 = tail call double @llvm.fmuladd.f64(double %17, double %12, double %13)
%19 = add nuw nsw i32 %11, 1
%20 = fsub double %18, %13
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = tail call double @llvm.fabs.f64(double %12)
%23 = fcmp olt double %21, %22
%24 = select i1 %23, double %22, double %21
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %13, double %18, double %24)
store double %18, double* %0
%26 = fcmp ogt double %24, %3
%27 = icmp slt i32 %19, %4
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %9, label %29
29: ; preds = %9
%30 = icmp ne i32 %19, %4
%31 = zext i1 %30 to i32
ret i32 %31
}