double solve_nr(f, f1, c, x0, tol, err) double (*f)(), (*f1)(), c, x0, tol;
int *err;
{
  double y;
  do {
    y = f(x0) - c;
    x0 -= y / f1(x0);
  } while (fabs(y) > tol);
  return (x0);
}


x86 assembly (clang, -O0):
<solve_nr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    -0x8(%rbp),%rcx
movsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rcx
movsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
call   *%rcx
movsd  -0x40(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movaps 0xe8c(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x28(%rbp),%xmm0
ja     1123 <solve_nr+0x23>
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_nr>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
nopl   0x0(%rax)
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
mov    $0x1,%al
call   *%rbx
subsd  0x10(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   *%r14
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm1
andpd  0xe8f(%rip),%xmm2
ucomisd 0x18(%rsp),%xmm2
ja     1120 <solve_nr+0x20>
movaps %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @solve_nr(double (...)* %0, double (...)* %1, double %2, double %3, double %4, i32* %5) {
%7 = alloca double (...)*
%8 = alloca double (...)*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32*
%13 = alloca double
store double (...)* %0, double (...)** %7
store double (...)* %1, double (...)** %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32* %5, i32** %12
br label %14
14: ; preds = %29, %6
%15 = load double (...)*, double (...)** %7
%16 = load double, double* %10
%17 = bitcast double (...)* %15 to double (double, ...)*
%18 = call double (double, ...) %17(double %16)
%19 = load double, double* %9
%20 = fsub double %18, %19
store double %20, double* %13
%21 = load double, double* %13
%22 = load double (...)*, double (...)** %8
%23 = load double, double* %10
%24 = bitcast double (...)* %22 to double (double, ...)*
%25 = call double (double, ...) %24(double %23)
%26 = fdiv double %21, %25
%27 = load double, double* %10
%28 = fsub double %27, %26
store double %28, double* %10
br label %29
29: ; preds = %14
%30 = load double, double* %13
%31 = call double @llvm.fabs.f64(double %30)
%32 = load double, double* %11
%33 = fcmp ogt double %31, %32
br i1 %33, label %14, label %34
34: ; preds = %29
%35 = load double, double* %10
ret double %35
}

LLVM IR (-O2):
define double @solve_nr(double (...)* nocapture %0, double (...)* nocapture %1, double %2, double %3, double %4, i32* nocapture readnone %5) {
%7 = bitcast double (...)* %0 to double (double, ...)*
%8 = bitcast double (...)* %1 to double (double, ...)*
br label %9
9: ; preds = %9, %6
%10 = phi double [ %3, %6 ], [ %15, %9 ]
%11 = tail call double (double, ...) %7(double %10)
%12 = fsub double %11, %2
%13 = tail call double (double, ...) %8(double %10)
%14 = fdiv double %12, %13
%15 = fsub double %10, %14
%16 = tail call double @llvm.fabs.f64(double %12)
%17 = fcmp ogt double %16, %4
br i1 %17, label %9, label %18
18: ; preds = %9
ret double %15
}