double Izero(double x) {
  double halfx, term, sum, r;
  double temp;
  halfx = 0.5 * x;
  term = sum = r = 1.0;
  do {
    temp = halfx / r;
    term *= temp * temp;
    sum += term;
    r += 1.0;
  } while (term >= (sum * (1E-21)));
  return sum;
}


x86 assembly (clang, -O0):
<Izero>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xedd(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe84(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jae    1142 <Izero+0x42>
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Izero>:
mulsd  0xef8(%rip),%xmm0
movsd  0xef8(%rip),%xmm2
movsd  0xef8(%rip),%xmm3
movapd %xmm2,%xmm1
movapd %xmm2,%xmm4
movapd %xmm2,%xmm5
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm0,%xmm6
divsd  %xmm4,%xmm6
mulsd  %xmm6,%xmm6
mulsd  %xmm6,%xmm5
addsd  %xmm5,%xmm1
addsd  %xmm2,%xmm4
movapd %xmm1,%xmm6
mulsd  %xmm3,%xmm6
ucomisd %xmm6,%xmm5
jae    1130 <Izero+0x30>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @Izero(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %2
%8 = load double, double* %2
%9 = fmul double 5.000000e-01, %8
store double %9, double* %3
store double 1.000000e+00, double* %6
store double 1.000000e+00, double* %5
store double 1.000000e+00, double* %4
br label %10
10: ; preds = %24, %1
%11 = load double, double* %3
%12 = load double, double* %6
%13 = fdiv double %11, %12
store double %13, double* %7
%14 = load double, double* %7
%15 = load double, double* %7
%16 = fmul double %14, %15
%17 = load double, double* %4
%18 = fmul double %17, %16
store double %18, double* %4
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fadd double %20, %19
store double %21, double* %5
%22 = load double, double* %6
%23 = fadd double %22, 1.000000e+00
store double %23, double* %6
br label %24
24: ; preds = %10
%25 = load double, double* %4
%26 = load double, double* %5
%27 = fmul double %26, 0x3B92E3B40A0E9B4F
%28 = fcmp oge double %25, %27
br i1 %28, label %10, label %29
29: ; preds = %24
%30 = load double, double* %5
ret double %30
}

LLVM IR (-O2):
define double @Izero(double %0) {
%2 = fmul double %0, 5.000000e-01
br label %3
3: ; preds = %3, %1
%4 = phi double [ 1.000000e+00, %1 ], [ %10, %3 ]
%5 = phi double [ 1.000000e+00, %1 ], [ %11, %3 ]
%6 = phi double [ 1.000000e+00, %1 ], [ %9, %3 ]
%7 = fdiv double %2, %5
%8 = fmul double %7, %7
%9 = fmul double %6, %8
%10 = fadd double %4, %9
%11 = fadd double %5, 1.000000e+00
%12 = fmul double %10, 0x3B92E3B40A0E9B4F
%13 = fcmp ult double %9, %12
br i1 %13, label %14, label %3
14: ; preds = %3
ret double %10
}