#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 xinormal(double pee) {
  double f0, pind, pw, px;
  static double p[5] = {-0.322232431088, -1., -0.342242088547, -0.0204231210245,
                        -4.53642210148e-5};
  static double q[5] = {0.099348462606, 0.588581570495, 0.531103462366,
                        0.10353775285, 0.0038560700634};
  pind = pee;
  if (pee < 1e-10)
    return (double)-10.0;
  else if (pee >= 1.0)
    return (double)10.0;
  else if (pee == 0.5)
    return (double)0.5;
  if (pee > .5)
    pee--;
  pw = sqrt(log(1 / (pee * pee)));
  f0 = (((pw * q[4] + q[3]) * pw + q[2]) * pw + q[1]) * pw + q[0];
  px = pw + ((((pw * p[4] + p[3]) * pw + p[2]) * pw + p[1]) * pw + p[0]) / f0;
  if (pind < .5)
    px = -px;
  return px;
}


x86 assembly (clang, -O0):
<xinormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    115c <xinormal+0x3c>
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1320 <xinormal+0x200>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1185 <xinormal+0x65>
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1320 <xinormal+0x200>
movsd  -0x10(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11b4 <xinormal+0x94>
jp     11b4 <xinormal+0x94>
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1320 <xinormal+0x200>
jmp    11b9 <xinormal+0x99>
jmp    11be <xinormal+0x9e>
movsd  -0x10(%rbp),%xmm0
movsd  0xe45(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e7 <xinormal+0xc7>
movsd  0xe3b(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe0f(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0x2e71(%rip),%xmm2
movsd  0x2e61(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0x2e44(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0x2e27(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0x2e0a(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0x2ddb(%rip),%xmm3
movsd  0x2dcb(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm3
movsd  0x2dae(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm3
movsd  0x2d91(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm3
movsd  0x2d74(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd26(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1316 <xinormal+0x1f6>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xinormal>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
movsd  0xed8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1143 <xinormal+0x23>
movsd  0xec2(%rip),%xmm0
add    $0x18,%rsp
ret
ucomisd 0xecd(%rip),%xmm1
jae    1162 <xinormal+0x42>
movsd  0xecb(%rip),%xmm0
ucomisd %xmm0,%xmm1
jne    116f <xinormal+0x4f>
jp     116f <xinormal+0x4f>
add    $0x18,%rsp
ret
movsd  0xea6(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xeb1(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe9d(%rip),%xmm2
movapd %xmm1,%xmm3
movapd %xmm1,(%rsp)
movapd %xmm2,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm3,%xmm1
orpd   %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movsd  0xe6b(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xe5f(%rip),%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe63(%rip),%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe67(%rip),%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe6b(%rip),%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe6f(%rip),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
divsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd 0xe67(%rip),%xmm0
xorpd  %xmm2,%xmm0
movapd (%rsp),%xmm3
cmpltsd 0xdf5(%rip),%xmm3
movapd %xmm3,%xmm1
andnpd %xmm2,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

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

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