double kolmogi(p)
double p;
{
  double y, t, dpdy;
  if (p <= 0.0 || p > 1.0) {
    mtherr("kolmogi", 1);
    return 0.0;
  }
  y = sqrt(-0.5 * log(0.5 * p));
  do {
    t = -2.0 * y;
    dpdy = 4.0 * t * exp(t * y);
    if (fabs(dpdy) > 0.0)
      t = (p - kolmogorov(y)) / dpdy;
    else {
      mtherr("kolmogi", 4);
      return 0.0;
    }
    y = y + t;
  } while (fabs(t / y) > 1e-10);
  return (y);
}


x86 assembly (clang, -O0):
<kolmogi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1182 <kolmogi+0x32>
movsd  -0x10(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a2 <kolmogi+0x52>
lea    0xeb7(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1070 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <kolmogi+0x170>
movsd  0xe66(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe49(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe4b(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe31(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xe13(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1260 <kolmogi+0x110>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1030 <kolmogorov@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1280 <kolmogi+0x130>
lea    0xdd9(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1070 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c0 <kolmogi+0x170>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movaps 0xd90(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11cd <kolmogi+0x7d>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kolmogi>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
mov    $0x1,%esi
jae    1239 <kolmogi+0xe9>
ucomisd 0xe8d(%rip),%xmm1
ja     1239 <kolmogi+0xe9>
movsd  0xe87(%rip),%xmm0
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm1,%xmm0
call   1050 <log@plt>
mulsd  0xe78(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a8 <kolmogi+0x58>
sqrtsd %xmm0,%xmm0
jmp    11b0 <kolmogi+0x60>
call   1060 <sqrt@plt>
nopl   (%rax)
movapd %xmm0,%xmm1
mulsd  0xe5c(%rip),%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm1,%xmm0
mulsd  0xe52(%rip),%xmm1
movsd  %xmm1,(%rsp)
call   1040 <exp@plt>
mulsd  (%rsp),%xmm0
ucomisd 0xe4b(%rip),%xmm0
je     1234 <kolmogi+0xe4>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <kolmogorov@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
andpd  0xe1b(%rip),%xmm1
ucomisd 0xdfb(%rip),%xmm1
ja     11b0 <kolmogi+0x60>
add    $0x18,%rsp
ret
mov    $0x4,%esi
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1070 <mtherr@plt>
xorpd  %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"kolmogi\00"
define double @kolmogi(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
%8 = fcmp ole double %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load double, double* %3
%11 = fcmp ogt double %10, 1.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9, %1
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %2
br label %55
14: ; preds = %9
%15 = load double, double* %3
%16 = fmul double 5.000000e-01, %15
%17 = call double @log(double %16)
%18 = fmul double -5.000000e-01, %17
%19 = call double @sqrt(double %18)
store double %19, double* %4
br label %20
20: ; preds = %47, %14
%21 = load double, double* %4
%22 = fmul double -2.000000e+00, %21
store double %22, double* %5
%23 = load double, double* %5
%24 = fmul double 4.000000e+00, %23
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fmul double %25, %26
%28 = call double @exp(double %27)
%29 = fmul double %24, %28
store double %29, double* %6
%30 = load double, double* %6
%31 = call double @llvm.fabs.f64(double %30)
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %41
33: ; preds = %20
%34 = load double, double* %3
%35 = load double, double* %4
%36 = call i32 (double, ...) bitcast (i32 (...)* @kolmogorov to i32 (double, ...)*)(double %35)
%37 = sitofp i32 %36 to double
%38 = fsub double %34, %37
%39 = load double, double* %6
%40 = fdiv double %38, %39
store double %40, double* %5
br label %43
41: ; preds = %20
%42 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
store double 0.000000e+00, double* %2
br label %55
43: ; preds = %33
%44 = load double, double* %4
%45 = load double, double* %5
%46 = fadd double %44, %45
store double %46, double* %4
br label %47
47: ; preds = %43
%48 = load double, double* %5
%49 = load double, double* %4
%50 = fdiv double %48, %49
%51 = call double @llvm.fabs.f64(double %50)
%52 = fcmp ogt double %51, 1.000000e-10
br i1 %52, label %20, label %53
53: ; preds = %47
%54 = load double, double* %4
store double %54, double* %2
br label %55
55: ; preds = %53, %41, %12
%56 = load double, double* %2
ret double %56
}

LLVM IR (-O2):
@.str = [8 x i8] c"kolmogi\00"
define double @kolmogi(double %0) {
%2 = fcmp ole double %0, 0.000000e+00
%3 = fcmp ogt double %0, 1.000000e+00
%4 = or i1 %2, %3
br i1 %4, label %27, label %5
5: ; preds = %1
%6 = fmul double %0, 5.000000e-01
%7 = tail call double @log(double %6)
%8 = fmul double %7, -5.000000e-01
%9 = tail call double @sqrt(double %8)
br label %10
10: ; preds = %18, %5
%11 = phi double [ %9, %5 ], [ %23, %18 ]
%12 = fmul double %11, -2.000000e+00
%13 = fmul double %12, 4.000000e+00
%14 = fmul double %11, %12
%15 = tail call double @exp(double %14)
%16 = fmul double %15, %13
%17 = fcmp ueq double %16, 0.000000e+00
br i1 %17, label %27, label %18
18: ; preds = %10
%19 = tail call i32 (double, ...) bitcast (i32 (...)* @kolmogorov to i32 (double, ...)*)(double %11)
%20 = sitofp i32 %19 to double
%21 = fsub double %0, %20
%22 = fdiv double %21, %16
%23 = fadd double %11, %22
%24 = fdiv double %22, %23
%25 = tail call double @llvm.fabs.f64(double %24)
%26 = fcmp ogt double %25, 1.000000e-10
br i1 %26, label %10, label %30
27: ; preds = %10, %1
%28 = phi i32 [ 1, %1 ], [ 4, %10 ]
%29 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %18, %27
%31 = phi double [ 0.000000e+00, %27 ], [ %23, %18 ]
ret double %31
}