double cephes_kolmogorov(y)
double y;
{
  double p, t, r, sign, x;
  x = -2.0 * y * y;
  sign = 1.0;
  p = 0.0;
  r = 1.0;
  do {
    t = cephes_exp(x * r * r);
    p += sign * t;
    if (t == 0.0)
      break;
    r += 1.0;
    sign = -sign;
  } while ((t / p) > 1.1e-16);
  return (p + p);
}


x86 assembly (clang, -O0):
<cephes_kolmogorov>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
call   1030 <cephes_exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ae <cephes_kolmogorov+0x9e>
jp     11ae <cephes_kolmogorov+0x9e>
jmp    11fd <cephes_kolmogorov+0xed>
movsd  0xe4a(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1156 <cephes_kolmogorov+0x46>
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cephes_kolmogorov>:
sub    $0x38,%rsp
movsd  0xee4(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
movapd %xmm1,%xmm2
movapd %xmm1,%xmm3
xchg   %ax,%ax
movapd %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mov    $0x1,%al
call   1030 <cephes_exp@plt>
movapd 0x20(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
test   %eax,%eax
je     11aa <cephes_kolmogorov+0x9a>
addsd  0xe74(%rip),%xmm2
xorpd  0xe84(%rip),%xmm3
divsd  %xmm0,%xmm1
ucomisd 0xe68(%rip),%xmm1
ja     1140 <cephes_kolmogorov+0x30>
addsd  %xmm0,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @cephes_kolmogorov(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 -2.000000e+00, %8
%10 = load double, double* %2
%11 = fmul double %9, %10
store double %11, double* %7
store double 1.000000e+00, double* %6
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %5
br label %12
12: ; preds = %32, %1
%13 = load double, double* %7
%14 = load double, double* %5
%15 = fmul double %13, %14
%16 = load double, double* %5
%17 = fmul double %15, %16
%18 = call i32 (double, ...) bitcast (i32 (...)* @cephes_exp to i32 (double, ...)*)(double %17)
%19 = sitofp i32 %18 to double
store double %19, double* %4
%20 = load double, double* %6
%21 = load double, double* %4
%22 = load double, double* %3
%23 = call double @llvm.fmuladd.f64(double %20, double %21, double %22)
store double %23, double* %3
%24 = load double, double* %4
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %26, label %27
26: ; preds = %12
br label %37
27: ; preds = %12
%28 = load double, double* %5
%29 = fadd double %28, 1.000000e+00
store double %29, double* %5
%30 = load double, double* %6
%31 = fneg double %30
store double %31, double* %6
br label %32
32: ; preds = %27
%33 = load double, double* %4
%34 = load double, double* %3
%35 = fdiv double %33, %34
%36 = fcmp ogt double %35, 1.100000e-16
br i1 %36, label %12, label %37
37: ; preds = %32, %26
%38 = load double, double* %3
%39 = load double, double* %3
%40 = fadd double %38, %39
ret double %40
}

LLVM IR (-O2):
define double @cephes_kolmogorov(double %0) {
%2 = fmul double %0, -2.000000e+00
%3 = fmul double %2, %0
br label %4
4: ; preds = %14, %1
%5 = phi double [ 1.000000e+00, %1 ], [ %15, %14 ]
%6 = phi double [ 1.000000e+00, %1 ], [ %16, %14 ]
%7 = phi double [ 0.000000e+00, %1 ], [ %12, %14 ]
%8 = fmul double %3, %5
%9 = fmul double %5, %8
%10 = tail call i32 (double, ...) bitcast (i32 (...)* @cephes_exp to i32 (double, ...)*)(double %9)
%11 = sitofp i32 %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %6, double %11, double %7)
%13 = icmp eq i32 %10, 0
br i1 %13, label %19, label %14
14: ; preds = %4
%15 = fadd double %5, 1.000000e+00
%16 = fneg double %6
%17 = fdiv double %11, %12
%18 = fcmp ogt double %17, 1.100000e-16
br i1 %18, label %4, label %19
19: ; preds = %4, %14
%20 = fadd double %12, %12
ret double %20
}