double qnorm(double u) {
  static double a[9] = {1.24818987e-4,   -1.075204047e-3, 5.198775019e-3,
                        -0.019198292004, 0.059054035642,  -0.151968751364,
                        0.319152932694,  -0.5319230073,   0.797884560593};
  static double b[15] = {-4.5255659e-5,   1.5252929e-4,    -1.9538132e-5,
                         -6.76904986e-4,  1.390604284e-3,  -7.9462082e-4,
                         -2.034254874e-3, 6.549791214e-3,  -0.010557625006,
                         0.011630447319,  -9.279453341e-3, 5.353579108e-3,
                         -2.141268741e-3, 5.35310549e-4,   0.999936657524};
  double w, y, z;
  int i;
  if (u == 0.)
    return 0.5;
  y = u / 2.;
  if (y < -6.)
    return 0.;
  if (y > 6.)
    return 1.;
  if (y < 0.)
    y = -y;
  if (y < 1.) {
    w = y * y;
    z = a[0];
    for (i = 1; i < 9; i++)
      z = z * w + a[i];
    z *= (y * 2.);
  } else {
    y -= 2.;
    z = b[0];
    for (i = 1; i < 15; i++)
      z = z * y + b[i];
  }
  if (u < 0.)
    return (1. - z) / 2.;
  return (1. + z) / 2.;
}


x86 assembly (clang, -O0):
<qnorm>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1133 <qnorm+0x33>
jp     1133 <qnorm+0x33>
movsd  0xef7(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130f <qnorm+0x20f>
movsd  -0x10(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeaf(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1169 <qnorm+0x69>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130f <qnorm+0x20f>
movsd  -0x20(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1192 <qnorm+0x92>
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130f <qnorm+0x20f>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11c1 <qnorm+0xc1>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe4f(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1252 <qnorm+0x152>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x2e45(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x9,-0x2c(%rbp)
jge    1236 <qnorm+0x136>
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movslq -0x2c(%rbp),%rcx
lea    0x2e1a(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f7 <qnorm+0xf7>
movsd  0xdca(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12c0 <qnorm+0x1c0>
movsd  -0x20(%rbp),%xmm0
movsd  0xda9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0x2e10(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0xf,-0x2c(%rbp)
jge    12bb <qnorm+0x1bb>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movslq -0x2c(%rbp),%rcx
lea    0x2de5(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    127c <qnorm+0x17c>
jmp    12c0 <qnorm+0x1c0>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12f1 <qnorm+0x1f1>
movsd  0xd42(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xd25(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130f <qnorm+0x20f>
movsd  0xd1f(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xd02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<qnorm>:
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1119 <qnorm+0x19>
jp     1119 <qnorm+0x19>
movsd  0xee8(%rip),%xmm0
ret
movsd  0xedf(%rip),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xedb(%rip),%xmm2
ucomisd %xmm3,%xmm2
ja     12e1 <qnorm+0x1e1>
ucomisd 0xed9(%rip),%xmm3
jbe    114a <qnorm+0x4a>
movsd  0xec7(%rip),%xmm0
ret
movapd 0xf9e(%rip),%xmm0
xorpd  %xmm3,%xmm0
xorpd  %xmm4,%xmm4
movapd %xmm3,%xmm2
cmpltsd %xmm4,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm3,%xmm2
orpd   %xmm0,%xmm2
movsd  0xe99(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11fa <qnorm+0xfa>
movapd %xmm2,%xmm4
mulsd  %xmm2,%xmm4
movsd  0xf13(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xf0f(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xf0b(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xf07(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xf03(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xeff(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xefb(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xef7(%rip),%xmm3
mulsd  %xmm4,%xmm3
addsd  0xef3(%rip),%xmm3
addsd  %xmm2,%xmm2
mulsd  %xmm3,%xmm2
jmp    12b6 <qnorm+0x1b6>
movsd  0xe1e(%rip),%xmm3
addsd  %xmm2,%xmm3
movsd  0xe1a(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe16(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe12(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe0e(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe0a(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe06(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe02(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdfe(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdfa(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdf6(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdf2(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdee(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdea(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xde6(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xde2(%rip),%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm1,%xmm3
jbe    12cd <qnorm+0x1cd>
subsd  %xmm2,%xmm0
mulsd  0xd34(%rip),%xmm0
ret
addsd  0xd3b(%rip),%xmm2
mulsd  0xd23(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
@qnorm.a = internal global [9 x double] [double 0x3F205C3AEF25BECF, double 0xBF519DBB8DFA21CC, double 0x3F754B4F8AF94F71, double 0xBF93A8B7912F5918, double 0x3FAE3C549F8EF466, double 0xBFC373B6488FA8B0, double 0x3FD46D006C15F74E, double 0xBFE10583660AFDB3, double 0x3FE9884533B75E55]
@qnorm.b = internal global [15 x double] [double 0xBF07BA1C9A586733, double 0x3F23FE089FDCE2C3, double 0xBEF47CBA351AB72F, double 0xBF462E4A6380D6A6, double 0x3F56C89DFAF928DD, double 0xBF4A09C337A1A6B4, double 0xBF60AA2444FA5608, double 0x3F7AD3F430F4C4F3, double 0xBF859F3C70FE5D84, double 0x3F87D1B436FBD04B, double 0xBF83011B24FEACC1, double 0x3F75EDA272F76F46, double 0xBF618A90E6DD8762, double 0x3F418A82A68C5F2A, double 0x3FEFFF7B29446363]
define double @qnorm(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %3
%8 = load double, double* %3
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double 5.000000e-01, double* %2
br label %84
11: ; preds = %1
%12 = load double, double* %3
%13 = fdiv double %12, 2.000000e+00
store double %13, double* %5
%14 = load double, double* %5
%15 = fcmp olt double %14, -6.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %11
store double 0.000000e+00, double* %2
br label %84
17: ; preds = %11
%18 = load double, double* %5
%19 = fcmp ogt double %18, 6.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %17
store double 1.000000e+00, double* %2
br label %84
21: ; preds = %17
%22 = load double, double* %5
%23 = fcmp olt double %22, 0.000000e+00
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load double, double* %5
%26 = fneg double %25
store double %26, double* %5
br label %27
27: ; preds = %24, %21
%28 = load double, double* %5
%29 = fcmp olt double %28, 1.000000e+00
br i1 %29, label %30, label %54
30: ; preds = %27
%31 = load double, double* %5
%32 = load double, double* %5
%33 = fmul double %31, %32
store double %33, double* %4
%34 = load double, double* getelementptr inbounds ([9 x double], [9 x double]* @qnorm.a, i64 0, i64 0)
store double %34, double* %6
store i32 1, i32* %7
br label %35
35: ; preds = %46, %30
%36 = load i32, i32* %7
%37 = icmp slt i32 %36, 9
br i1 %37, label %38, label %49
38: ; preds = %35
%39 = load double, double* %6
%40 = load double, double* %4
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [9 x double], [9 x double]* @qnorm.a, i64 0, i64 %42
%44 = load double, double* %43
%45 = call double @llvm.fmuladd.f64(double %39, double %40, double %44)
store double %45, double* %6
br label %46
46: ; preds = %38
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %35
49: ; preds = %35
%50 = load double, double* %5
%51 = fmul double %50, 2.000000e+00
%52 = load double, double* %6
%53 = fmul double %52, %51
store double %53, double* %6
br label %73
54: ; preds = %27
%55 = load double, double* %5
%56 = fsub double %55, 2.000000e+00
store double %56, double* %5
%57 = load double, double* getelementptr inbounds ([15 x double], [15 x double]* @qnorm.b, i64 0, i64 0)
store double %57, double* %6
store i32 1, i32* %7
br label %58
58: ; preds = %69, %54
%59 = load i32, i32* %7
%60 = icmp slt i32 %59, 15
br i1 %60, label %61, label %72
61: ; preds = %58
%62 = load double, double* %6
%63 = load double, double* %5
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [15 x double], [15 x double]* @qnorm.b, i64 0, i64 %65
%67 = load double, double* %66
%68 = call double @llvm.fmuladd.f64(double %62, double %63, double %67)
store double %68, double* %6
br label %69
69: ; preds = %61
%70 = load i32, i32* %7
%71 = add nsw i32 %70, 1
store i32 %71, i32* %7
br label %58
72: ; preds = %58
br label %73
73: ; preds = %72, %49
%74 = load double, double* %3
%75 = fcmp olt double %74, 0.000000e+00
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load double, double* %6
%78 = fsub double 1.000000e+00, %77
%79 = fdiv double %78, 2.000000e+00
store double %79, double* %2
br label %84
80: ; preds = %73
%81 = load double, double* %6
%82 = fadd double 1.000000e+00, %81
%83 = fdiv double %82, 2.000000e+00
store double %83, double* %2
br label %84
84: ; preds = %80, %76, %20, %16, %10
%85 = load double, double* %2
ret double %85
}

LLVM IR (-O2):
define double @qnorm(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
br i1 %2, label %50, label %3
3: ; preds = %1
%4 = fmul double %0, 5.000000e-01
%5 = fcmp olt double %4, -6.000000e+00
br i1 %5, label %50, label %6
6: ; preds = %3
%7 = fcmp ogt double %4, 6.000000e+00
br i1 %7, label %50, label %8
8: ; preds = %6
%9 = fcmp olt double %4, 0.000000e+00
%10 = fneg double %4
%11 = select i1 %9, double %10, double %4
%12 = fcmp olt double %11, 1.000000e+00
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = fmul double %11, %11
%15 = tail call double @llvm.fmuladd.f64(double %14, double 0x3F205C3AEF25BECF, double 0xBF519DBB8DFA21CC)
%16 = tail call double @llvm.fmuladd.f64(double %15, double %14, double 0x3F754B4F8AF94F71)
%17 = tail call double @llvm.fmuladd.f64(double %16, double %14, double 0xBF93A8B7912F5918)
%18 = tail call double @llvm.fmuladd.f64(double %17, double %14, double 0x3FAE3C549F8EF466)
%19 = tail call double @llvm.fmuladd.f64(double %18, double %14, double 0xBFC373B6488FA8B0)
%20 = tail call double @llvm.fmuladd.f64(double %19, double %14, double 0x3FD46D006C15F74E)
%21 = tail call double @llvm.fmuladd.f64(double %20, double %14, double 0xBFE10583660AFDB3)
%22 = tail call double @llvm.fmuladd.f64(double %21, double %14, double 0x3FE9884533B75E55)
%23 = fmul double %11, 2.000000e+00
%24 = fmul double %23, %22
br label %41
25: ; preds = %8
%26 = fadd double %11, -2.000000e+00
%27 = tail call double @llvm.fmuladd.f64(double %26, double 0xBF07BA1C9A586733, double 0x3F23FE089FDCE2C3)
%28 = tail call double @llvm.fmuladd.f64(double %27, double %26, double 0xBEF47CBA351AB72F)
%29 = tail call double @llvm.fmuladd.f64(double %28, double %26, double 0xBF462E4A6380D6A6)
%30 = tail call double @llvm.fmuladd.f64(double %29, double %26, double 0x3F56C89DFAF928DD)
%31 = tail call double @llvm.fmuladd.f64(double %30, double %26, double 0xBF4A09C337A1A6B4)
%32 = tail call double @llvm.fmuladd.f64(double %31, double %26, double 0xBF60AA2444FA5608)
%33 = tail call double @llvm.fmuladd.f64(double %32, double %26, double 0x3F7AD3F430F4C4F3)
%34 = tail call double @llvm.fmuladd.f64(double %33, double %26, double 0xBF859F3C70FE5D84)
%35 = tail call double @llvm.fmuladd.f64(double %34, double %26, double 0x3F87D1B436FBD04B)
%36 = tail call double @llvm.fmuladd.f64(double %35, double %26, double 0xBF83011B24FEACC1)
%37 = tail call double @llvm.fmuladd.f64(double %36, double %26, double 0x3F75EDA272F76F46)
%38 = tail call double @llvm.fmuladd.f64(double %37, double %26, double 0xBF618A90E6DD8762)
%39 = tail call double @llvm.fmuladd.f64(double %38, double %26, double 0x3F418A82A68C5F2A)
%40 = tail call double @llvm.fmuladd.f64(double %39, double %26, double 0x3FEFFF7B29446363)
br label %41
41: ; preds = %25, %13
%42 = phi double [ %24, %13 ], [ %40, %25 ]
%43 = fcmp olt double %0, 0.000000e+00
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = fsub double 1.000000e+00, %42
%46 = fmul double %45, 5.000000e-01
br label %50
47: ; preds = %41
%48 = fadd double %42, 1.000000e+00
%49 = fmul double %48, 5.000000e-01
br label %50
50: ; preds = %6, %3, %1, %47, %44
%51 = phi double [ %46, %44 ], [ %49, %47 ], [ 5.000000e-01, %1 ], [ 0.000000e+00, %3 ], [ 1.000000e+00, %6 ]
ret double %51
}