#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 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 < 1e-12) {
    result = 0.5;
    return result;
  } else if (absx < 0.66291) {
    result = 0.5 + gauss_small(x);
    return result;
  } else if (absx < (4.0 * 1.41421356237309504880)) {
    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)) {
    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    12c9 <gsl_cdf_ugaussian_P+0x199>
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    12c9 <gsl_cdf_ugaussian_P+0x199>
movsd  0xe47(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1216 <gsl_cdf_ugaussian_P+0xe6>
movsd  -0x10(%rbp),%xmm0
call   1040 <gauss_medium@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1207 <gsl_cdf_ugaussian_P+0xd7>
movsd  0xe2b(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c9 <gsl_cdf_ugaussian_P+0x199>
movsd  -0x10(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1249 <gsl_cdf_ugaussian_P+0x119>
movsd  0xdf3(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c9 <gsl_cdf_ugaussian_P+0x199>
movsd  0xdcf(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1273 <gsl_cdf_ugaussian_P+0x143>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c9 <gsl_cdf_ugaussian_P+0x199>
movsd  -0x10(%rbp),%xmm0
call   1030 <gauss_large@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12a6 <gsl_cdf_ugaussian_P+0x176>
movsd  0xd8c(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    12ab <gsl_cdf_ugaussian_P+0x17b>
jmp    12b0 <gsl_cdf_ugaussian_P+0x180>
jmp    12b5 <gsl_cdf_ugaussian_P+0x185>
jmp    12ba <gsl_cdf_ugaussian_P+0x18a>
jmp    12bf <gsl_cdf_ugaussian_P+0x18f>
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
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a1 <gsl_cdf_ugaussian_P+0x71>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1040 <gauss_medium@plt>
jmp    11d8 <gsl_cdf_ugaussian_P+0xa8>
ucomisd 0xe8f(%rip),%xmm2
jbe    11b8 <gsl_cdf_ugaussian_P+0x88>
movsd  0xe7d(%rip),%xmm0
add    $0x18,%rsp
ret
xorpd  %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm2,%xmm1
ja     11fe <gsl_cdf_ugaussian_P+0xce>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1030 <gauss_large@plt>
movapd %xmm0,%xmm1
movsd  0xe4c(%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):
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, 0x3D719799812DEA11
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 %58
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 %58
20: ; preds = %12
%21 = load double, double* %5
%22 = fcmp olt double %21, 0x4016A09E667F3BCD
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load double, double* %3
%25 = call double @gauss_medium(double %24)
store double %25, double* %4
%26 = load double, double* %3
%27 = fcmp ogt double %26, 0.000000e+00
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load double, double* %4
%30 = fsub double 1.000000e+00, %29
store double %30, double* %4
br label %31
31: ; preds = %28, %23
%32 = load double, double* %4
store double %32, double* %2
br label %58
33: ; preds = %20
%34 = load double, double* %3
%35 = fcmp ogt double %34, 0x402124DD2F1A9FBE
br i1 %35, label %36, label %38
36: ; preds = %33
store double 1.000000e+00, double* %4
%37 = load double, double* %4
store double %37, double* %2
br label %58
38: ; preds = %33
%39 = load double, double* %3
%40 = fcmp olt double %39, -3.700000e+01
br i1 %40, label %41, label %43
41: ; preds = %38
store double 0.000000e+00, double* %4
%42 = load double, double* %4
store double %42, double* %2
br label %58
43: ; preds = %38
%44 = load double, double* %3
%45 = call double @gauss_large(double %44)
store double %45, double* %4
%46 = load double, double* %3
%47 = fcmp ogt double %46, 0.000000e+00
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load double, double* %4
%50 = fsub double 1.000000e+00, %49
store double %50, double* %4
br label %51
51: ; preds = %48, %43
br label %52
52: ; preds = %51
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
%57 = load double, double* %4
store double %57, double* %2
br label %58
58: ; preds = %56, %41, %36, %31, %15, %10
%59 = load double, double* %2
ret double %59
}

LLVM IR (-O2):
define double @gsl_cdf_ugaussian_P(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 0x3D719799812DEA11
br i1 %3, label %25, 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 %25
9: ; preds = %4
%10 = fcmp olt double %2, 0x4016A09E667F3BCD
br i1 %10, label %11, label %16
11: ; preds = %9
%12 = tail call double @gauss_medium(double %0)
%13 = fcmp ogt double %0, 0.000000e+00
%14 = fsub double 1.000000e+00, %12
%15 = select i1 %13, double %14, double %12
br label %25
16: ; preds = %9
%17 = fcmp ogt double %0, 0x402124DD2F1A9FBE
br i1 %17, label %25, label %18
18: ; preds = %16
%19 = fcmp olt double %0, -3.700000e+01
br i1 %19, label %25, label %20
20: ; preds = %18
%21 = tail call double @gauss_large(double %0)
%22 = fcmp ogt double %0, 0.000000e+00
%23 = fsub double 1.000000e+00, %21
%24 = select i1 %22, double %23, double %21
br label %25
25: ; preds = %18, %16, %1, %20, %11, %6
%26 = phi double [ %8, %6 ], [ %15, %11 ], [ %24, %20 ], [ 5.000000e-01, %1 ], [ 1.000000e+00, %16 ], [ 0.000000e+00, %18 ]
ret double %26
}