#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 cum_normal(double sample, double mean, double stddev) {
  double a, b, c, d, e, f, g, h, temp;
  a = 0.319381530;
  b = -0.356563782;
  c = 1.781477937;
  d = -1.821255978;
  e = 1.330274429;
  f = .2316419;
  if (stddev <= 0.0)
    return -1.0;
  sample = (sample - mean) / stddev;
  if (sample < 0.0)
    temp = -sample;
  else
    temp = sample;
  g = 1.0 / (1.0 + f * temp);
  h = 1.0 - (0.39894228040143 * exp(-0.5 * temp * temp)) *
                (a * g + b * g * g + c * g * g * g + d * g * g * g * g +
                 e * g * g * g * g * g);
  if (sample < 0.0)
    h = 1.0 - h;
  return h;
}


x86 assembly (clang, -O0):
<cum_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xef9(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeba(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1195 <cum_normal+0x85>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1312 <cum_normal+0x202>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11dd <cum_normal+0xcd>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    11e7 <cum_normal+0xd7>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe33(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe27(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe26(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe04(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x40(%rbp),%xmm2
mulsd  -0x58(%rbp),%xmm2
mulsd  -0x58(%rbp),%xmm2
mulsd  -0x58(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd51(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1308 <cum_normal+0x1f8>
movsd  0xd32(%rip),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cum_normal>:
sub    $0x28,%rsp
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
jae    1231 <cum_normal+0x121>
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
movapd %xmm0,%xmm2
movapd %xmm0,0x10(%rsp)
movapd 0xf24(%rip),%xmm0
xorpd  %xmm2,%xmm0
movapd %xmm2,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0xea6(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
xorpd  %xmm1,%xmm1
ucomisd 0x10(%rsp),%xmm1
movapd (%rsp),%xmm2
mulsd  0xe8a(%rip),%xmm2
movsd  0xe8a(%rip),%xmm1
addsd  %xmm1,%xmm2
movapd %xmm2,%xmm3
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
movsd  0xe7a(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
movsd  0xe72(%rip),%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm3,%xmm4
movsd  0xe6a(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
movsd  0xe5a(%rip),%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm3,%xmm4
movsd  0xe46(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
mulsd  0xe2e(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
jbe    122c <cum_normal+0x11c>
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret
movsd  0xdc7(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @cum_normal(double %0, double %1, double %2) {
%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
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double 0x3FD470BF3A92F8EC, double* %8
store double 0xBFD6D1F0E5A8325B, double* %9
store double 0x3FFC80EF025F5E68, double* %10
store double 0xBFFD23DD4EF278D0, double* %11
store double 0x3FF548CDD6F42943, double* %12
store double 0x3FCDA6711871100E, double* %13
%17 = load double, double* %7
%18 = fcmp ole double %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %3
store double -1.000000e+00, double* %4
br label %88
20: ; preds = %3
%21 = load double, double* %5
%22 = load double, double* %6
%23 = fsub double %21, %22
%24 = load double, double* %7
%25 = fdiv double %23, %24
store double %25, double* %5
%26 = load double, double* %5
%27 = fcmp olt double %26, 0.000000e+00
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load double, double* %5
%30 = fneg double %29
store double %30, double* %16
br label %33
31: ; preds = %20
%32 = load double, double* %5
store double %32, double* %16
br label %33
33: ; preds = %31, %28
%34 = load double, double* %13
%35 = load double, double* %16
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double 1.000000e+00)
%37 = fdiv double 1.000000e+00, %36
store double %37, double* %14
%38 = load double, double* %16
%39 = fmul double -5.000000e-01, %38
%40 = load double, double* %16
%41 = fmul double %39, %40
%42 = call double @exp(double %41)
%43 = fmul double 0x3FD9884533D43620, %42
%44 = load double, double* %8
%45 = load double, double* %14
%46 = load double, double* %9
%47 = load double, double* %14
%48 = fmul double %46, %47
%49 = load double, double* %14
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %44, double %45, double %50)
%52 = load double, double* %10
%53 = load double, double* %14
%54 = fmul double %52, %53
%55 = load double, double* %14
%56 = fmul double %54, %55
%57 = load double, double* %14
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double %51)
%59 = load double, double* %11
%60 = load double, double* %14
%61 = fmul double %59, %60
%62 = load double, double* %14
%63 = fmul double %61, %62
%64 = load double, double* %14
%65 = fmul double %63, %64
%66 = load double, double* %14
%67 = call double @llvm.fmuladd.f64(double %65, double %66, double %58)
%68 = load double, double* %12
%69 = load double, double* %14
%70 = fmul double %68, %69
%71 = load double, double* %14
%72 = fmul double %70, %71
%73 = load double, double* %14
%74 = fmul double %72, %73
%75 = load double, double* %14
%76 = fmul double %74, %75
%77 = load double, double* %14
%78 = call double @llvm.fmuladd.f64(double %76, double %77, double %67)
%79 = fneg double %43
%80 = call double @llvm.fmuladd.f64(double %79, double %78, double 1.000000e+00)
store double %80, double* %15
%81 = load double, double* %5
%82 = fcmp olt double %81, 0.000000e+00
br i1 %82, label %83, label %86
83: ; preds = %33
%84 = load double, double* %15
%85 = fsub double 1.000000e+00, %84
store double %85, double* %15
br label %86
86: ; preds = %83, %33
%87 = load double, double* %15
store double %87, double* %4
br label %88
88: ; preds = %86, %19
%89 = load double, double* %4
ret double %89
}

LLVM IR (-O2):
define double @cum_normal(double %0, double %1, double %2) {
%4 = fcmp ugt double %2, 0.000000e+00
br i1 %4, label %5, label %35
5: ; preds = %3
%6 = fsub double %0, %1
%7 = fdiv double %6, %2
%8 = fcmp olt double %7, 0.000000e+00
%9 = fneg double %7
%10 = select i1 %8, double %9, double %7
%11 = tail call double @llvm.fmuladd.f64(double %10, double 0x3FCDA6711871100E, double 1.000000e+00)
%12 = fdiv double 1.000000e+00, %11
%13 = fmul double %10, -5.000000e-01
%14 = fmul double %10, %13
%15 = tail call double @exp(double %14)
%16 = fmul double %12, 0xBFD6D1F0E5A8325B
%17 = fmul double %12, %16
%18 = tail call double @llvm.fmuladd.f64(double %12, double 0x3FD470BF3A92F8EC, double %17)
%19 = fmul double %12, 0x3FFC80EF025F5E68
%20 = fmul double %12, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %12, double %18)
%22 = fmul double %12, 0xBFFD23DD4EF278D0
%23 = fmul double %12, %22
%24 = fmul double %12, %23
%25 = tail call double @llvm.fmuladd.f64(double %24, double %12, double %21)
%26 = fmul double %12, 0x3FF548CDD6F42943
%27 = fmul double %12, %26
%28 = fmul double %12, %27
%29 = fmul double %12, %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double %12, double %25)
%31 = fmul double %15, 0xBFD9884533D43620
%32 = tail call double @llvm.fmuladd.f64(double %31, double %30, double 1.000000e+00)
%33 = fsub double 1.000000e+00, %32
%34 = select i1 %8, double %33, double %32
br label %35
35: ; preds = %3, %5
%36 = phi double [ %34, %5 ], [ -1.000000e+00, %3 ]
ret double %36
}