#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 M_SQRT2;
double fabs(double const);
double gauss_large(double const);
double gauss_medium(double const);
double gauss_small(double const);
double gsl_cdf_ugaussian_P(const double x) {
  double result;
  double absx = fabs(x);
  if (absx < (2.2204460492503131e-16 / 2)) {
    result = 0.5;
    return result;
  } else if (absx < 0.66291) {
    result = 0.5 + gauss_small(x);
    return result;
  } else if (absx < (4.0 * M_SQRT2)) {
    result = gauss_medium(x);
    if (x > 0.0) {
      result = 1.0 - result;
    }
    return result;
  } else if (x > (8.572)) {
    result = 1.0;
    return result;
  } else if (x < (-37.519)) {
    result = 0.0;
    return result;
  } else {
    result = gauss_large(x);
    if (x > 0.0) {
      result = 1.0 - result;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<gsl_cdf_ugaussian_P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xef7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea6(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1181 <gsl_cdf_ugaussian_P+0x51>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d8 <gsl_cdf_ugaussian_P+0x1a8>
movsd  0xe7f(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11c1 <gsl_cdf_ugaussian_P+0x91>
movsd  -0x10(%rbp),%xmm0
call   1050 <gauss_small@plt>
movaps %xmm0,%xmm1
movsd  0xe87(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d8 <gsl_cdf_ugaussian_P+0x1a8>
movsd  -0x20(%rbp),%xmm1
movsd  0xe42(%rip),%xmm0
mov    0x2e0b(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1225 <gsl_cdf_ugaussian_P+0xf5>
movsd  -0x10(%rbp),%xmm0
call   1040 <gauss_medium@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1216 <gsl_cdf_ugaussian_P+0xe6>
movsd  0xe1c(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d8 <gsl_cdf_ugaussian_P+0x1a8>
movsd  -0x10(%rbp),%xmm0
movsd  0xde6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1258 <gsl_cdf_ugaussian_P+0x128>
movsd  0xde4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d8 <gsl_cdf_ugaussian_P+0x1a8>
movsd  0xdc0(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1282 <gsl_cdf_ugaussian_P+0x152>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d8 <gsl_cdf_ugaussian_P+0x1a8>
movsd  -0x10(%rbp),%xmm0
call   1030 <gauss_large@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12b5 <gsl_cdf_ugaussian_P+0x185>
movsd  0xd7d(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    12ba <gsl_cdf_ugaussian_P+0x18a>
jmp    12bf <gsl_cdf_ugaussian_P+0x18f>
jmp    12c4 <gsl_cdf_ugaussian_P+0x194>
jmp    12c9 <gsl_cdf_ugaussian_P+0x199>
jmp    12ce <gsl_cdf_ugaussian_P+0x19e>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsl_cdf_ugaussian_P>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
movapd 0xec0(%rip),%xmm0
andpd  %xmm2,%xmm0
movsd  0xecc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    115f <gsl_cdf_ugaussian_P+0x2f>
movsd  0xeb6(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xeb9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1183 <gsl_cdf_ugaussian_P+0x53>
movapd %xmm2,%xmm0
call   1050 <gauss_small@plt>
addsd  0xe92(%rip),%xmm0
add    $0x18,%rsp
ret
mov    0x2e56(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xe92(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11ac <gsl_cdf_ugaussian_P+0x7c>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1040 <gauss_medium@plt>
jmp    11e3 <gsl_cdf_ugaussian_P+0xb3>
ucomisd 0xe84(%rip),%xmm2
jbe    11c3 <gsl_cdf_ugaussian_P+0x93>
movsd  0xe72(%rip),%xmm0
add    $0x18,%rsp
ret
xorpd  %xmm0,%xmm0
movsd  0xe71(%rip),%xmm1
ucomisd %xmm2,%xmm1
ja     1209 <gsl_cdf_ugaussian_P+0xd9>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1030 <gauss_large@plt>
movapd %xmm0,%xmm1
movsd  0xe41(%rip),%xmm2
subsd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
cmpltsd (%rsp),%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_SQRT2 = global double 0.000000e+00
define double @gsl_cdf_ugaussian_P(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = call double @llvm.fabs.f64(double %6)
store double %7, double* %5
%8 = load double, double* %5
%9 = fcmp olt double %8, 0x3CA0000000000000
br i1 %9, label %10, label %12
10: ; preds = %1
store double 5.000000e-01, double* %4
%11 = load double, double* %4
store double %11, double* %2
br label %60
12: ; preds = %1
%13 = load double, double* %5
%14 = fcmp olt double %13, 6.629100e-01
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load double, double* %3
%17 = call double @gauss_small(double %16)
%18 = fadd double 5.000000e-01, %17
store double %18, double* %4
%19 = load double, double* %4
store double %19, double* %2
br label %60
20: ; preds = %12
%21 = load double, double* %5
%22 = load double, double* @M_SQRT2
%23 = fmul double 4.000000e+00, %22
%24 = fcmp olt double %21, %23
br i1 %24, label %25, label %35
25: ; preds = %20
%26 = load double, double* %3
%27 = call double @gauss_medium(double %26)
store double %27, double* %4
%28 = load double, double* %3
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load double, double* %4
%32 = fsub double 1.000000e+00, %31
store double %32, double* %4
br label %33
33: ; preds = %30, %25
%34 = load double, double* %4
store double %34, double* %2
br label %60
35: ; preds = %20
%36 = load double, double* %3
%37 = fcmp ogt double %36, 0x402124DD2F1A9FBE
br i1 %37, label %38, label %40
38: ; preds = %35
store double 1.000000e+00, double* %4
%39 = load double, double* %4
store double %39, double* %2
br label %60
40: ; preds = %35
%41 = load double, double* %3
%42 = fcmp olt double %41, -3.751900e+01
br i1 %42, label %43, label %45
43: ; preds = %40
store double 0.000000e+00, double* %4
%44 = load double, double* %4
store double %44, double* %2
br label %60
45: ; preds = %40
%46 = load double, double* %3
%47 = call double @gauss_large(double %46)
store double %47, double* %4
%48 = load double, double* %3
%49 = fcmp ogt double %48, 0.000000e+00
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load double, double* %4
%52 = fsub double 1.000000e+00, %51
store double %52, double* %4
br label %53
53: ; preds = %50, %45
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
br label %58
58: ; preds = %57
%59 = load double, double* %4
store double %59, double* %2
br label %60
60: ; preds = %58, %43, %38, %33, %15, %10
%61 = load double, double* %2
ret double %61
}

LLVM IR (-O2):
@M_SQRT2 = global double 0.000000e+00
define double @gsl_cdf_ugaussian_P(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 0x3CA0000000000000
br i1 %3, label %27, label %4
4: ; preds = %1
%5 = fcmp olt double %2, 6.629100e-01
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = tail call double @gauss_small(double %0)
%8 = fadd double %7, 5.000000e-01
br label %27
9: ; preds = %4
%10 = load double, double* @M_SQRT2
%11 = fmul double %10, 4.000000e+00
%12 = fcmp olt double %2, %11
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = tail call double @gauss_medium(double %0)
%15 = fcmp ogt double %0, 0.000000e+00
%16 = fsub double 1.000000e+00, %14
%17 = select i1 %15, double %16, double %14
br label %27
18: ; preds = %9
%19 = fcmp ogt double %0, 0x402124DD2F1A9FBE
br i1 %19, label %27, label %20
20: ; preds = %18
%21 = fcmp olt double %0, -3.751900e+01
br i1 %21, label %27, label %22
22: ; preds = %20
%23 = tail call double @gauss_large(double %0)
%24 = fcmp ogt double %0, 0.000000e+00
%25 = fsub double 1.000000e+00, %23
%26 = select i1 %24, double %25, double %23
br label %27
27: ; preds = %20, %18, %1, %22, %13, %6
%28 = phi double [ %8, %6 ], [ %17, %13 ], [ %26, %22 ], [ 5.000000e-01, %1 ], [ 1.000000e+00, %18 ], [ 0.000000e+00, %20 ]
ret double %28
}