#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_Q(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 = gauss_small(x);
    if (x < 0.0) {
      result = fabs(result) + 0.5;
    } else {
      result = 0.5 - result;
    }
    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 > -((-37.519))) {
    result = 0.0;
    return result;
  } else if (x < -((8.572))) {
    result = 1.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_Q>:
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_Q+0x51>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <gsl_cdf_ugaussian_Q+0x1d7>
movsd  0xe7f(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11f8 <gsl_cdf_ugaussian_Q+0xc8>
movsd  -0x10(%rbp),%xmm0
call   1050 <gauss_small@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11d7 <gsl_cdf_ugaussian_Q+0xa7>
movsd  -0x18(%rbp),%xmm0
movaps 0xe83(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe67(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e9 <gsl_cdf_ugaussian_Q+0xb9>
movsd  0xe51(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <gsl_cdf_ugaussian_Q+0x1d7>
movsd  -0x20(%rbp),%xmm1
movsd  0xe0b(%rip),%xmm0
mov    0x2dd4(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1258 <gsl_cdf_ugaussian_Q+0x128>
movsd  -0x10(%rbp),%xmm0
call   1040 <gauss_medium@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1249 <gsl_cdf_ugaussian_Q+0x119>
movsd  0xde9(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <gsl_cdf_ugaussian_Q+0x1d7>
movsd  -0x10(%rbp),%xmm0
movsd  0xdb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1286 <gsl_cdf_ugaussian_Q+0x156>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <gsl_cdf_ugaussian_Q+0x1d7>
movsd  0xd92(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12b5 <gsl_cdf_ugaussian_Q+0x185>
movsd  0xd87(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <gsl_cdf_ugaussian_Q+0x1d7>
movsd  -0x10(%rbp),%xmm0
call   1030 <gauss_large@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12e4 <gsl_cdf_ugaussian_Q+0x1b4>
movsd  0xd4e(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    12e9 <gsl_cdf_ugaussian_Q+0x1b9>
jmp    12ee <gsl_cdf_ugaussian_Q+0x1be>
jmp    12f3 <gsl_cdf_ugaussian_Q+0x1c3>
jmp    12f8 <gsl_cdf_ugaussian_Q+0x1c8>
jmp    12fd <gsl_cdf_ugaussian_Q+0x1cd>
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_Q>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
movapd 0xec0(%rip),%xmm0
andpd  %xmm2,%xmm0
movsd  0xedc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    115f <gsl_cdf_ugaussian_Q+0x2f>
movsd  0xec6(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xec9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11b6 <gsl_cdf_ugaussian_Q+0x86>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1050 <gauss_small@plt>
movapd 0xe7d(%rip),%xmm1
andpd  %xmm0,%xmm1
xorpd  0xe81(%rip),%xmm0
xorpd  %xmm2,%xmm2
movapd (%rsp),%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
addsd  0xe6f(%rip),%xmm3
jmp    123c <gsl_cdf_ugaussian_Q+0x10c>
mov    0x2e23(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xe6f(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11df <gsl_cdf_ugaussian_Q+0xaf>
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1040 <gauss_medium@plt>
jmp    1216 <gsl_cdf_ugaussian_Q+0xe6>
xorpd  %xmm0,%xmm0
ucomisd 0xe55(%rip),%xmm2
ja     1240 <gsl_cdf_ugaussian_Q+0x110>
movsd  0xe5b(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    1208 <gsl_cdf_ugaussian_Q+0xd8>
movsd  0xe45(%rip),%xmm0
add    $0x18,%rsp
ret
movapd %xmm2,%xmm0
movapd %xmm2,(%rsp)
call   1030 <gauss_large@plt>
movsd  0xe2a(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd (%rsp),%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

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

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