#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ log(int);
double sqrt(int /*<<< orphan*/);
double QuantileNormal(double prob) {
  double a0 = -.322232431088, a1 = -1, a2 = -.342242088547,
         a3 = -.0204231210245;
  double a4 = -.453642210148e-4, b0 = .0993484626060, b1 = .588581570495;
  double b2 = .531103462366, b3 = .103537752850, b4 = .0038560700634;
  double y, z = 0, p = prob, p1;
  p1 = (p < 0.5 ? p : 1 - p);
  if (p1 < 1e-20)
    return (-9999);
  y = sqrt(log(1 / (p1 * p1)));
  z = y + ((((y * a4 + a3) * y + a2) * y + a1) * y + a0) /
              ((((y * b4 + b3) * y + b2) * y + b1) * y + b0);
  return (p < 0.5 ? -z : z);
}


x86 assembly (clang, -O0):
<QuantileNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xf18(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xf03(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeee(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe70(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe5b(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe34(%rip),%xmm0
ucomisd -0x78(%rbp),%xmm0
jbe    11e9 <QuantileNormal+0xc9>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    11fe <QuantileNormal+0xde>
movsd  0xe67(%rip),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  0xe4d(%rip),%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1230 <QuantileNormal+0x110>
movsd  0xe42(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135d <QuantileNormal+0x23d>
movsd  -0x80(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
movsd  0xe16(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm4
movsd  -0x58(%rbp),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movsd  -0x68(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movsd  -0x68(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movsd  -0x68(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xcf1(%rip),%xmm0
ucomisd -0x78(%rbp),%xmm0
jbe    1343 <QuantileNormal+0x223>
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1350 <QuantileNormal+0x230>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuantileNormal>:
sub    $0x18,%rsp
movsd  0xed4(%rip),%xmm1
movapd %xmm1,%xmm3
subsd  %xmm0,%xmm3
movapd %xmm0,%xmm4
cmpltsd 0xec7(%rip),%xmm4
andpd  %xmm4,%xmm0
movapd %xmm4,%xmm2
andnpd %xmm3,%xmm2
orpd   %xmm0,%xmm2
movsd  0xebf(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    116c <QuantileNormal+0x4c>
movsd  0xea9(%rip),%xmm0
add    $0x18,%rsp
ret
mulsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
movapd %xmm4,(%rsp)
call   1030 <log@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
movapd %xmm0,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd 0xe83(%rip),%xmm0
mulpd  %xmm2,%xmm0
addpd  0xe87(%rip),%xmm0
mulpd  %xmm2,%xmm0
addpd  0xe8b(%rip),%xmm0
mulpd  %xmm2,%xmm0
addpd  0xe8f(%rip),%xmm0
mulpd  %xmm2,%xmm0
addpd  0xe93(%rip),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movapd (%rsp),%xmm2
movapd %xmm2,%xmm1
andnpd %xmm0,%xmm1
xorpd  0xe7e(%rip),%xmm0
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @QuantileNormal(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %3
store double 0xBFD49F74C64EF237, double* %4
store double -1.000000e+00, double* %5
store double 0xBFD5E74B5C67F146, double* %6
store double 0xBF94E9CC7387A830, double* %7
store double 0xBF07C8AEC3ED1A62, double* %8
store double 0x3FB96EE69DCCF754, double* %9
store double 0x3FE2D5A90489BD2F, double* %10
store double 0x3FE0FECCB034F054, double* %11
store double 0x3FBA81733E645F68, double* %12
store double 0x3F6F96C3DA074588, double* %13
store double 0.000000e+00, double* %15
%18 = load double, double* %3
store double %18, double* %16
%19 = load double, double* %16
%20 = fcmp olt double %19, 5.000000e-01
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = load double, double* %16
br label %26
23: ; preds = %1
%24 = load double, double* %16
%25 = fsub double 1.000000e+00, %24
br label %26
26: ; preds = %23, %21
%27 = phi double [ %22, %21 ], [ %25, %23 ]
store double %27, double* %17
%28 = load double, double* %17
%29 = fcmp olt double %28, 0x3BC79CA10C924223
br i1 %29, label %30, label %31
30: ; preds = %26
store double -9.999000e+03, double* %2
br label %77
31: ; preds = %26
%32 = load double, double* %17
%33 = load double, double* %17
%34 = fmul double %32, %33
%35 = fdiv double 1.000000e+00, %34
%36 = fptosi double %35 to i32
%37 = call i32 @log(i32 %36)
%38 = call double @sqrt(i32 %37)
store double %38, double* %14
%39 = load double, double* %14
%40 = load double, double* %14
%41 = load double, double* %8
%42 = load double, double* %7
%43 = call double @llvm.fmuladd.f64(double %40, double %41, double %42)
%44 = load double, double* %14
%45 = load double, double* %6
%46 = call double @llvm.fmuladd.f64(double %43, double %44, double %45)
%47 = load double, double* %14
%48 = load double, double* %5
%49 = call double @llvm.fmuladd.f64(double %46, double %47, double %48)
%50 = load double, double* %14
%51 = load double, double* %4
%52 = call double @llvm.fmuladd.f64(double %49, double %50, double %51)
%53 = load double, double* %14
%54 = load double, double* %13
%55 = load double, double* %12
%56 = call double @llvm.fmuladd.f64(double %53, double %54, double %55)
%57 = load double, double* %14
%58 = load double, double* %11
%59 = call double @llvm.fmuladd.f64(double %56, double %57, double %58)
%60 = load double, double* %14
%61 = load double, double* %10
%62 = call double @llvm.fmuladd.f64(double %59, double %60, double %61)
%63 = load double, double* %14
%64 = load double, double* %9
%65 = call double @llvm.fmuladd.f64(double %62, double %63, double %64)
%66 = fdiv double %52, %65
%67 = fadd double %39, %66
store double %67, double* %15
%68 = load double, double* %16
%69 = fcmp olt double %68, 5.000000e-01
br i1 %69, label %70, label %73
70: ; preds = %31
%71 = load double, double* %15
%72 = fneg double %71
br label %75
73: ; preds = %31
%74 = load double, double* %15
br label %75
75: ; preds = %73, %70
%76 = phi double [ %72, %70 ], [ %74, %73 ]
store double %76, double* %2
br label %77
77: ; preds = %75, %30
%78 = load double, double* %2
ret double %78
}

LLVM IR (-O2):
define double @QuantileNormal(double %0) {
%2 = fcmp olt double %0, 5.000000e-01
%3 = fsub double 1.000000e+00, %0
%4 = select i1 %2, double %0, double %3
%5 = fcmp olt double %4, 0x3BC79CA10C924223
br i1 %5, label %24, label %6
6: ; preds = %1
%7 = fmul double %4, %4
%8 = fdiv double 1.000000e+00, %7
%9 = fptosi double %8 to i32
%10 = tail call i32 @log(i32 %9)
%11 = tail call double @sqrt(i32 %10)
%12 = insertelement <2 x double> poison, double %11, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> <double 0xBF07C8AEC3ED1A62, double 0x3F6F96C3DA074588>, <2 x double> <double 0xBF94E9CC7387A830, double 0x3FBA81733E645F68>)
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %13, <2 x double> <double 0xBFD5E74B5C67F146, double 0x3FE0FECCB034F054>)
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %13, <2 x double> <double -1.000000e+00, double 0x3FE2D5A90489BD2F>)
%17 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %13, <2 x double> <double 0xBFD49F74C64EF237, double 0x3FB96EE69DCCF754>)
%18 = extractelement <2 x double> %17, i64 0
%19 = extractelement <2 x double> %17, i64 1
%20 = fdiv double %18, %19
%21 = fadd double %11, %20
%22 = fneg double %21
%23 = select i1 %2, double %22, double %21
br label %24
24: ; preds = %1, %6
%25 = phi double [ %23, %6 ], [ -9.999000e+03, %1 ]
ret double %25
}