double Izero(double x) {
  const double IzeroEPSILON = 1E-41;
  double sum, u, halfx, temp;
  int n;
  sum = u = n = 1;
  halfx = x / 2.0;
  do {
    temp = halfx / (double)n;
    n += 1;
    temp *= temp;
    u *= temp;
    sum += u;
  } while (u >= IzeroEPSILON * sum);
  return (sum);
}


x86 assembly (clang, -O0):
<Izero>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x34(%rbp)
movsd  0xee3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jae    114d <Izero+0x4d>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Izero>:
mulsd  0xef8(%rip),%xmm0
mov    $0x1,%eax
movsd  0xef3(%rip),%xmm2
movsd  0xef3(%rip),%xmm3
movapd %xmm2,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
movapd %xmm0,%xmm5
divsd  %xmm4,%xmm5
add    $0x1,%eax
mulsd  %xmm5,%xmm5
mulsd  %xmm5,%xmm2
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm3,%xmm4
ucomisd %xmm4,%xmm2
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
%8 = alloca i32
store double %0, double* %2
store double 1.000000e-41, double* %3
store i32 1, i32* %8
store double 1.000000e+00, double* %5
store double 1.000000e+00, double* %4
%9 = load double, double* %2
%10 = fdiv double %9, 2.000000e+00
store double %10, double* %6
br label %11
11: ; preds = %27, %1
%12 = load double, double* %6
%13 = load i32, i32* %8
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
store double %15, double* %7
%16 = load i32, i32* %8
%17 = add nsw i32 %16, 1
store i32 %17, i32* %8
%18 = load double, double* %7
%19 = load double, double* %7
%20 = fmul double %19, %18
store double %20, double* %7
%21 = load double, double* %7
%22 = load double, double* %5
%23 = fmul double %22, %21
store double %23, double* %5
%24 = load double, double* %5
%25 = load double, double* %4
%26 = fadd double %25, %24
store double %26, double* %4
br label %27
27: ; preds = %11
%28 = load double, double* %5
%29 = load double, double* %4
%30 = fmul double 1.000000e-41, %29
%31 = fcmp oge double %28, %30
br i1 %31, label %11, label %32
32: ; preds = %27
%33 = load double, double* %4
ret double %33
}

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 ], [ %11, %3 ]
%5 = phi double [ 1.000000e+00, %1 ], [ %12, %3 ]
%6 = phi i32 [ 1, %1 ], [ %9, %3 ]
%7 = sitofp i32 %6 to double
%8 = fdiv double %2, %7
%9 = add nuw nsw i32 %6, 1
%10 = fmul double %8, %8
%11 = fmul double %4, %10
%12 = fadd double %5, %11
%13 = fmul double %12, 1.000000e-41
%14 = fcmp ult double %11, %13
br i1 %14, label %15, label %3
15: ; preds = %3
ret double %12
}