#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 */
double CDFNormal(double);
double exp(double);
double fabs(double);
double log(double);
double sqrt(int);
double logCDFNormal(double x) {
  double lnF, z = fabs(x), C, low = -10, high = 5;
  if (x >= low && x <= high)
    return log(CDFNormal(x));
  if (x > high && x < -low)
    lnF = log(CDFNormal(-z));
  else {
    C = 1 - 1 / (z * z) + 3 / (z * z * z * z) - 15 / (z * z * z * z * z * z) +
        105 / (z * z * z * z * z * z * z * z);
    lnF = -z * z / 2 - log(sqrt(2 * 3.1415926535897932384626433832795) * z) +
          log(C);
  }
  if (x > 0) {
    z = exp(lnF);
    lnF = -z * (1 + z / 2 + z * z / 3 + z * z * z / 4 + z * z * z * z / 5);
  }
  return (lnF);
}


x86 assembly (clang, -O0):
<logCDFNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xee7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jb     11b9 <logCDFNormal+0x79>
movsd  -0x10(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11b9 <logCDFNormal+0x79>
movsd  -0x10(%rbp),%xmm0
call   1060 <CDFNormal@plt>
call   1040 <log@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1411 <logCDFNormal+0x2d1>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1224 <logCDFNormal+0xe4>
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1224 <logCDFNormal+0xe4>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1060 <CDFNormal@plt>
call   1040 <log@plt>
movsd  %xmm0,-0x18(%rbp)
jmp    1347 <logCDFNormal+0x207>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xdfa(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xdee(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xdc6(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xd90(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xd50(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xd12(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
mulsd  -0x20(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1407 <logCDFNormal+0x2c7>
movsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xc7f(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xc93(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xc75(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xc66(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xc0a(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logCDFNormal>:
sub    $0x48,%rsp
movapd %xmm0,%xmm1
ucomisd 0xef0(%rip),%xmm0
jb     1172 <logCDFNormal+0x32>
movsd  0xeee(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1172 <logCDFNormal+0x32>
movapd %xmm1,%xmm0
call   1060 <CDFNormal@plt>
add    $0x48,%rsp
jmp    1040 <log@plt>
movapd 0xe86(%rip),%xmm0
andpd  %xmm1,%xmm0
ucomisd 0xec2(%rip),%xmm1
movapd %xmm1,0x30(%rsp)
jbe    11b3 <logCDFNormal+0x73>
movsd  0xeba(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    11b3 <logCDFNormal+0x73>
xorpd  0xe8c(%rip),%xmm0
call   1060 <CDFNormal@plt>
call   1040 <log@plt>
jmp    1277 <logCDFNormal+0x137>
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm3,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
unpcklpd %xmm1,%xmm3
movapd %xmm0,%xmm4
movapd 0xe39(%rip),%xmm2
divpd  %xmm3,%xmm2
movsd  0xe75(%rip),%xmm0
subsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm4,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm4,%xmm0
movapd %xmm4,0x10(%rsp)
unpcklpd %xmm0,%xmm1
movapd 0xe0b(%rip),%xmm0
divpd  %xmm1,%xmm0
subsd  %xmm0,%xmm2
unpckhpd %xmm0,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
mulsd  0xe25(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
mulsd  0x10(%rsp),%xmm0
call   1040 <log@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <log@plt>
addsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
movapd 0x30(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jbe    12e8 <logCDFNormal+0x1a8>
call   1030 <exp@plt>
movapd 0xd9c(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0xdc8(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xdac(%rip),%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
divsd  0xdac(%rip),%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm4,%xmm0
mulsd  0xda4(%rip),%xmm4
addsd  %xmm3,%xmm4
divsd  0xd68(%rip),%xmm0
addsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @logCDFNormal(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
%9 = load double, double* %3
%10 = call double @llvm.fabs.f64(double %9)
store double %10, double* %5
store double -1.000000e+01, double* %7
store double 5.000000e+00, double* %8
%11 = load double, double* %3
%12 = load double, double* %7
%13 = fcmp oge double %11, %12
br i1 %13, label %14, label %22
14: ; preds = %1
%15 = load double, double* %3
%16 = load double, double* %8
%17 = fcmp ole double %15, %16
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load double, double* %3
%20 = call double @CDFNormal(double %19)
%21 = call double @log(double %20)
store double %21, double* %2
br label %129
22: ; preds = %14, %1
%23 = load double, double* %3
%24 = load double, double* %8
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load double, double* %3
%28 = load double, double* %7
%29 = fneg double %28
%30 = fcmp olt double %27, %29
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load double, double* %5
%33 = fneg double %32
%34 = call double @CDFNormal(double %33)
%35 = call double @log(double %34)
store double %35, double* %4
br label %94
36: ; preds = %26, %22
%37 = load double, double* %5
%38 = load double, double* %5
%39 = fmul double %37, %38
%40 = fdiv double 1.000000e+00, %39
%41 = fsub double 1.000000e+00, %40
%42 = load double, double* %5
%43 = load double, double* %5
%44 = fmul double %42, %43
%45 = load double, double* %5
%46 = fmul double %44, %45
%47 = load double, double* %5
%48 = fmul double %46, %47
%49 = fdiv double 3.000000e+00, %48
%50 = fadd double %41, %49
%51 = load double, double* %5
%52 = load double, double* %5
%53 = fmul double %51, %52
%54 = load double, double* %5
%55 = fmul double %53, %54
%56 = load double, double* %5
%57 = fmul double %55, %56
%58 = load double, double* %5
%59 = fmul double %57, %58
%60 = load double, double* %5
%61 = fmul double %59, %60
%62 = fdiv double 1.500000e+01, %61
%63 = fsub double %50, %62
%64 = load double, double* %5
%65 = load double, double* %5
%66 = fmul double %64, %65
%67 = load double, double* %5
%68 = fmul double %66, %67
%69 = load double, double* %5
%70 = fmul double %68, %69
%71 = load double, double* %5
%72 = fmul double %70, %71
%73 = load double, double* %5
%74 = fmul double %72, %73
%75 = load double, double* %5
%76 = fmul double %74, %75
%77 = load double, double* %5
%78 = fmul double %76, %77
%79 = fdiv double 1.050000e+02, %78
%80 = fadd double %63, %79
store double %80, double* %6
%81 = load double, double* %5
%82 = fneg double %81
%83 = load double, double* %5
%84 = fmul double %82, %83
%85 = fdiv double %84, 2.000000e+00
%86 = call double @sqrt(i32 6)
%87 = load double, double* %5
%88 = fmul double %86, %87
%89 = call double @log(double %88)
%90 = fsub double %85, %89
%91 = load double, double* %6
%92 = call double @log(double %91)
%93 = fadd double %90, %92
store double %93, double* %4
br label %94
94: ; preds = %36, %31
%95 = load double, double* %3
%96 = fcmp ogt double %95, 0.000000e+00
br i1 %96, label %97, label %127
97: ; preds = %94
%98 = load double, double* %4
%99 = call double @exp(double %98)
store double %99, double* %5
%100 = load double, double* %5
%101 = fneg double %100
%102 = load double, double* %5
%103 = fdiv double %102, 2.000000e+00
%104 = fadd double 1.000000e+00, %103
%105 = load double, double* %5
%106 = load double, double* %5
%107 = fmul double %105, %106
%108 = fdiv double %107, 3.000000e+00
%109 = fadd double %104, %108
%110 = load double, double* %5
%111 = load double, double* %5
%112 = fmul double %110, %111
%113 = load double, double* %5
%114 = fmul double %112, %113
%115 = fdiv double %114, 4.000000e+00
%116 = fadd double %109, %115
%117 = load double, double* %5
%118 = load double, double* %5
%119 = fmul double %117, %118
%120 = load double, double* %5
%121 = fmul double %119, %120
%122 = load double, double* %5
%123 = fmul double %121, %122
%124 = fdiv double %123, 5.000000e+00
%125 = fadd double %116, %124
%126 = fmul double %101, %125
store double %126, double* %4
br label %127
127: ; preds = %97, %94
%128 = load double, double* %4
store double %128, double* %2
br label %129
129: ; preds = %127, %18
%130 = load double, double* %2
ret double %130
}

LLVM IR (-O2):
define double @logCDFNormal(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp ult double %0, -1.000000e+01
%4 = fcmp ugt double %0, 5.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call double @CDFNormal(double %0)
%8 = tail call double @log(double %7)
br label %66
9: ; preds = %1
%10 = fcmp ogt double %0, 5.000000e+00
%11 = fcmp olt double %0, 1.000000e+01
%12 = and i1 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = fneg double %2
%15 = tail call double @CDFNormal(double %14)
%16 = tail call double @log(double %15)
br label %48
17: ; preds = %9
%18 = fmul double %0, %0
%19 = fmul double %18, %2
%20 = fmul double %2, %19
%21 = insertelement <2 x double> poison, double %18, i64 0
%22 = insertelement <2 x double> %21, double %20, i64 1
%23 = fdiv <2 x double> <double 1.000000e+00, double 3.000000e+00>, %22
%24 = extractelement <2 x double> %23, i64 0
%25 = fsub double 1.000000e+00, %24
%26 = extractelement <2 x double> %23, i64 1
%27 = fadd double %25, %26
%28 = fmul double %2, %20
%29 = fmul double %2, %28
%30 = fmul double %2, %29
%31 = fmul double %2, %30
%32 = insertelement <2 x double> poison, double %29, i64 0
%33 = insertelement <2 x double> %32, double %31, i64 1
%34 = fdiv <2 x double> <double 1.500000e+01, double 1.050000e+02>, %33
%35 = extractelement <2 x double> %34, i64 0
%36 = fsub double %27, %35
%37 = extractelement <2 x double> %34, i64 1
%38 = fadd double %36, %37
%39 = fneg double %2
%40 = fmul double %2, %39
%41 = fmul double %40, 5.000000e-01
%42 = tail call double @sqrt(i32 6)
%43 = fmul double %2, %42
%44 = tail call double @log(double %43)
%45 = fsub double %41, %44
%46 = tail call double @log(double %38)
%47 = fadd double %45, %46
br label %48
48: ; preds = %17, %13
%49 = phi double [ %16, %13 ], [ %47, %17 ]
%50 = fcmp ogt double %0, 0.000000e+00
br i1 %50, label %51, label %66
51: ; preds = %48
%52 = tail call double @exp(double %49)
%53 = fneg double %52
%54 = fmul double %52, 5.000000e-01
%55 = fadd double %54, 1.000000e+00
%56 = fmul double %52, %52
%57 = fdiv double %56, 3.000000e+00
%58 = fadd double %55, %57
%59 = fmul double %52, %56
%60 = fmul double %59, 2.500000e-01
%61 = fadd double %58, %60
%62 = fmul double %52, %59
%63 = fdiv double %62, 5.000000e+00
%64 = fadd double %61, %63
%65 = fmul double %64, %53
br label %66
66: ; preds = %48, %51, %6
%67 = phi double [ %8, %6 ], [ %65, %51 ], [ %49, %48 ]
ret double %67
}