#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 fabs(double);
int pow(double, double);
double sqrt(double);
double probability_norm(double u) {
  if (u < -5.0)
    return 0.0;
  if (u > 5.0)
    return 1.0;
  double y = fabs(u) / sqrt(2.0);
  double p =
      1.0 + y * (0.0705230784 +
                 y * (0.0422820123 +
                      y * (0.0092705272 +
                           y * (0.0001520143 +
                                y * (0.0002765672 + y * 0.0000430638)))));
  double er = 1 - pow(p, -16.0);
  p = (u < 0.0) ? 0.5 - 0.5 * er : 0.5 + 0.5 * er;
  return p;
}


x86 assembly (clang, -O0):
<probability_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xecb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114d <probability_norm+0x2d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12bb <probability_norm+0x19b>
movsd  -0x10(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1176 <probability_norm+0x56>
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12bb <probability_norm+0x19b>
movsd  -0x10(%rbp),%xmm0
movaps 0xeee(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xebd(%rip),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
movsd  0xe71(%rip),%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe6d(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe4d(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe35(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe1d(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe05(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xded(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdcf(%rip),%xmm1
call   1030 <pow@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    128d <probability_norm+0x16d>
movsd  -0x28(%rbp),%xmm0
movsd  0xded(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    12a7 <probability_norm+0x187>
movsd  -0x28(%rbp),%xmm0
movsd  0xdbe(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probability_norm>:
push   %rbx
xorpd  %xmm1,%xmm1
movsd  0xee3(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     11de <probability_norm+0xce>
ucomisd 0xee1(%rip),%xmm0
jbe    113e <probability_norm+0x2e>
movsd  0xecf(%rip),%xmm1
jmp    11de <probability_norm+0xce>
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
ucomisd %xmm0,%xmm1
seta   %bl
andpd  0xf0d(%rip),%xmm0
divsd  0xebd(%rip),%xmm0
movsd  0xebd(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xeb9(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xeb5(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xeb1(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xead(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xea9(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xe5d(%rip),%xmm2
movsd  0xe9d(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <pow@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
lea    0xe9f(%rip),%rax
mulsd  (%rax,%rbx,8),%xmm1
addsd  0xe7a(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @probability_norm(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
%8 = fcmp olt double %7, -5.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %1
store double 0.000000e+00, double* %2
br label %46
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp ogt double %11, 5.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 1.000000e+00, double* %2
br label %46
14: ; preds = %10
%15 = load double, double* %3
%16 = call double @llvm.fabs.f64(double %15)
%17 = call double @sqrt(double 2.000000e+00)
%18 = fdiv double %16, %17
store double %18, double* %4
%19 = load double, double* %4
%20 = load double, double* %4
%21 = load double, double* %4
%22 = load double, double* %4
%23 = load double, double* %4
%24 = load double, double* %4
%25 = call double @llvm.fmuladd.f64(double %24, double 4.306380e-05, double 0x3F3220071442EE6C)
%26 = call double @llvm.fmuladd.f64(double %23, double %25, double 0x3F23ECC0E4E05F94)
%27 = call double @llvm.fmuladd.f64(double %22, double %26, double 0x3F82FC6D19201C06)
%28 = call double @llvm.fmuladd.f64(double %21, double %27, double 0x3FA5A5FCE8133C57)
%29 = call double @llvm.fmuladd.f64(double %20, double %28, double 0x3FB20DCCEB575BC4)
%30 = call double @llvm.fmuladd.f64(double %19, double %29, double 1.000000e+00)
store double %30, double* %5
%31 = load double, double* %5
%32 = call i32 @pow(double %31, double -1.600000e+01)
%33 = sub nsw i32 1, %32
%34 = sitofp i32 %33 to double
store double %34, double* %6
%35 = load double, double* %3
%36 = fcmp olt double %35, 0.000000e+00
br i1 %36, label %37, label %40
37: ; preds = %14
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %38, double 5.000000e-01)
br label %43
40: ; preds = %14
%41 = load double, double* %6
%42 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %41, double 5.000000e-01)
br label %43
43: ; preds = %40, %37
%44 = phi double [ %39, %37 ], [ %42, %40 ]
store double %44, double* %5
%45 = load double, double* %5
store double %45, double* %2
br label %46
46: ; preds = %43, %13, %9
%47 = load double, double* %2
ret double %47
}

LLVM IR (-O2):
define double @probability_norm(double %0) {
%2 = fcmp olt double %0, -5.000000e+00
br i1 %2, label %21, label %3
3: ; preds = %1
%4 = fcmp ogt double %0, 5.000000e+00
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = tail call double @llvm.fabs.f64(double %0)
%7 = fdiv double %6, 0x3FF6A09E667F3BCD
%8 = tail call double @llvm.fmuladd.f64(double %7, double 4.306380e-05, double 0x3F3220071442EE6C)
%9 = tail call double @llvm.fmuladd.f64(double %7, double %8, double 0x3F23ECC0E4E05F94)
%10 = tail call double @llvm.fmuladd.f64(double %7, double %9, double 0x3F82FC6D19201C06)
%11 = tail call double @llvm.fmuladd.f64(double %7, double %10, double 0x3FA5A5FCE8133C57)
%12 = tail call double @llvm.fmuladd.f64(double %7, double %11, double 0x3FB20DCCEB575BC4)
%13 = tail call double @llvm.fmuladd.f64(double %7, double %12, double 1.000000e+00)
%14 = tail call i32 @pow(double %13, double -1.600000e+01)
%15 = sub nsw i32 1, %14
%16 = sitofp i32 %15 to double
%17 = fcmp olt double %0, 0.000000e+00
%18 = tail call double @llvm.fmuladd.f64(double %16, double -5.000000e-01, double 5.000000e-01)
%19 = tail call double @llvm.fmuladd.f64(double %16, double 5.000000e-01, double 5.000000e-01)
%20 = select i1 %17, double %18, double %19
br label %21
21: ; preds = %3, %1, %5
%22 = phi double [ %20, %5 ], [ 0.000000e+00, %1 ], [ 1.000000e+00, %3 ]
ret double %22
}