#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 exp(double);
double fabs(double);
double sqrt(double);
double normalCdf(double x) {
  static double a1 = 0.254829592;
  static double a2 = -0.284496736;
  static double a3 = 1.421413741;
  static double a4 = -1.453152027;
  static double a5 = 1.061405429;
  static double p = 0.3275911;
  short int sign = x >= 0;
  x = fabs(x) / sqrt(2.0);
  double t = 1.0 / (1.0 + p * x);
  double y =
      1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-x * x);
  return 0.5 * (1.0 + sign * y);
}


x86 assembly (clang, -O0):
<normalCdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %ax,-0xa(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xecf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeae(%rip),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0x2ed8(%rip),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe77(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe6b(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x2ea2(%rip),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0x2e8d(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0x2e70(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0x2e53(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0x2e36(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdab(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movswl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd89(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd75(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalCdf>:
sub    $0x38,%rsp
movapd %xmm0,0x20(%rsp)
movapd 0xede(%rip),%xmm1
andpd  %xmm0,%xmm1
divsd  0xef2(%rip),%xmm1
movsd  0xef2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeee(%rip),%xmm2
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,0x10(%rsp)
movsd  0xee0(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xedc(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xed8(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xed4(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xed0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0xe7a(%rip),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0xe71(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
cmplesd 0x20(%rsp),%xmm0
andpd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xe7a(%rip),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
@normalCdf.a1 = internal global double 0x3FD04F20C6EC5A7E
@normalCdf.a2 = internal global double 0xBFD23531CC3C1469
@normalCdf.a3 = internal global double 0x3FF6BE1C55BAE157
@normalCdf.a4 = internal global double 0xBFF7401C57014C39
@normalCdf.a5 = internal global double 0x3FF0FB844255A12D
@normalCdf.p = internal global double 0x3FD4F740A93D7B8C
define double @normalCdf(double %0) {
%2 = alloca double
%3 = alloca i16
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = fcmp oge double %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = trunc i32 %8 to i16
store i16 %9, i16* %3
%10 = load double, double* %2
%11 = call double @llvm.fabs.f64(double %10)
%12 = call double @sqrt(double 2.000000e+00)
%13 = fdiv double %11, %12
store double %13, double* %2
%14 = load double, double* @normalCdf.p
%15 = load double, double* %2
%16 = call double @llvm.fmuladd.f64(double %14, double %15, double 1.000000e+00)
%17 = fdiv double 1.000000e+00, %16
store double %17, double* %4
%18 = load double, double* @normalCdf.a5
%19 = load double, double* %4
%20 = load double, double* @normalCdf.a4
%21 = call double @llvm.fmuladd.f64(double %18, double %19, double %20)
%22 = load double, double* %4
%23 = load double, double* @normalCdf.a3
%24 = call double @llvm.fmuladd.f64(double %21, double %22, double %23)
%25 = load double, double* %4
%26 = load double, double* @normalCdf.a2
%27 = call double @llvm.fmuladd.f64(double %24, double %25, double %26)
%28 = load double, double* %4
%29 = load double, double* @normalCdf.a1
%30 = call double @llvm.fmuladd.f64(double %27, double %28, double %29)
%31 = load double, double* %4
%32 = fmul double %30, %31
%33 = load double, double* %2
%34 = fneg double %33
%35 = load double, double* %2
%36 = fmul double %34, %35
%37 = call double @exp(double %36)
%38 = fneg double %32
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double 1.000000e+00)
store double %39, double* %5
%40 = load i16, i16* %3
%41 = sext i16 %40 to i32
%42 = sitofp i32 %41 to double
%43 = load double, double* %5
%44 = call double @llvm.fmuladd.f64(double %42, double %43, double 1.000000e+00)
%45 = fmul double 5.000000e-01, %44
ret double %45
}

LLVM IR (-O2):
define double @normalCdf(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = fdiv double %3, 0x3FF6A09E667F3BCD
%5 = tail call double @llvm.fmuladd.f64(double %4, double 0x3FD4F740A93D7B8C, double 1.000000e+00)
%6 = fdiv double 1.000000e+00, %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FF0FB844255A12D, double 0xBFF7401C57014C39)
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double 0x3FF6BE1C55BAE157)
%9 = tail call double @llvm.fmuladd.f64(double %8, double %6, double 0xBFD23531CC3C1469)
%10 = tail call double @llvm.fmuladd.f64(double %9, double %6, double 0x3FD04F20C6EC5A7E)
%11 = fneg double %4
%12 = fmul double %4, %11
%13 = tail call double @exp(double %12)
%14 = fneg double %10
%15 = fmul double %6, %14
%16 = tail call double @llvm.fmuladd.f64(double %15, double %13, double 1.000000e+00)
%17 = uitofp i1 %2 to double
%18 = tail call double @llvm.fmuladd.f64(double %17, double %16, double 1.000000e+00)
%19 = fmul double %18, 5.000000e-01
ret double %19
}