#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 pow(int, double);
double normalcdf(double z) {
  double a1, a2, a3, a4, a5, p, t, y;
  int sign;
  a1 = 0.254829592;
  a2 = -0.284496736;
  a3 = 1.421413741;
  a4 = -1.453152027;
  a5 = 1.061405429;
  p = 0.3275911;
  sign = 1;
  if (z < 0)
    sign = -1;
  z = fabs(z) / pow(2, 0.5);
  t = 1 / (1 + p * z);
  y = 1 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-z * z);
  return 0.5 * (1 + sign * y);
}


x86 assembly (clang, -O0):
<normalcdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe9f(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x4c(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1197 <normalcdf+0x77>
movl   $0xffffffff,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xe9d(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    $0x2,%edi
movsd  0xe77(%rip),%xmm0
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe53(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe47(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%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  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0x4c(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd77(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd63(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalcdf>:
push   %rbx
sub    $0x20,%rsp
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
ucomisd %xmm0,%xmm1
seta   %bl
andpd  0xec6(%rip),%xmm0
movapd %xmm0,(%rsp)
movsd  0xee9(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movapd (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xed6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm2
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movsd  0xec5(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xec1(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xebd(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xeb9(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xeb5(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movapd 0xe4f(%rip),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0x18(%rsp),%xmm1
mulsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
movsd  0xe57(%rip),%xmm1
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
lea    0xe28(%rip),%rax
mulsd  (%rax,%rbx,8),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe27(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @normalcdf(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 i32
store double %0, double* %2
store double 0x3FD04F20C6EC5A7E, double* %3
store double 0xBFD23531CC3C1469, double* %4
store double 0x3FF6BE1C55BAE157, double* %5
store double 0xBFF7401C57014C39, double* %6
store double 0x3FF0FB844255A12D, double* %7
store double 0x3FD4F740A93D7B8C, double* %8
store i32 1, i32* %11
%12 = load double, double* %2
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 -1, i32* %11
br label %15
15: ; preds = %14, %1
%16 = load double, double* %2
%17 = call double @llvm.fabs.f64(double %16)
%18 = call double @pow(i32 2, double 5.000000e-01)
%19 = fdiv double %17, %18
store double %19, double* %2
%20 = load double, double* %8
%21 = load double, double* %2
%22 = call double @llvm.fmuladd.f64(double %20, double %21, double 1.000000e+00)
%23 = fdiv double 1.000000e+00, %22
store double %23, double* %9
%24 = load double, double* %7
%25 = load double, double* %9
%26 = load double, double* %6
%27 = call double @llvm.fmuladd.f64(double %24, double %25, double %26)
%28 = load double, double* %9
%29 = load double, double* %5
%30 = call double @llvm.fmuladd.f64(double %27, double %28, double %29)
%31 = load double, double* %9
%32 = load double, double* %4
%33 = call double @llvm.fmuladd.f64(double %30, double %31, double %32)
%34 = load double, double* %9
%35 = load double, double* %3
%36 = call double @llvm.fmuladd.f64(double %33, double %34, double %35)
%37 = load double, double* %9
%38 = fmul double %36, %37
%39 = load double, double* %2
%40 = fneg double %39
%41 = load double, double* %2
%42 = fmul double %40, %41
%43 = call double @exp(double %42)
%44 = fneg double %38
%45 = call double @llvm.fmuladd.f64(double %44, double %43, double 1.000000e+00)
store double %45, double* %10
%46 = load i32, i32* %11
%47 = sitofp i32 %46 to double
%48 = load double, double* %10
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double 1.000000e+00)
%50 = fmul double 5.000000e-01, %49
ret double %50
}

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