#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 log(double);
double sqrt(double);
double probability_re_norm(double p) {
  if (p == 0.5)
    return 0.0;
  if (p > 0.9999997)
    return 5.0;
  if (p < 0.0000003)
    return -5.0;
  if (p < 0.5)
    return -probability_re_norm(1.0 - p);
  double y = -log(4.0 * p * (1.0 - p));
  y = y *
      (1.570796288 +
       y * (0.3706987906e-1 +
            y * (-0.8364353589e-3 +
                 y * (-0.2250947176e-3 +
                      y * (0.6841218299e-5 +
                           y * (0.5824238515e-5 +
                                y * (-0.1045274970e-5 +
                                     y * (0.8360937017e-7 +
                                          y * (-0.3231081277e-8 +
                                               y * (0.3657763036e-10 +
                                                    y * 0.6936233982e-12))))))))));
  return sqrt(y);
}


x86 assembly (clang, -O0):
<probability_re_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1167 <probability_re_norm+0x37>
jp     1167 <probability_re_norm+0x37>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1341 <probability_re_norm+0x211>
movsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1190 <probability_re_norm+0x60>
movsd  0xf02(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1341 <probability_re_norm+0x211>
movsd  0xe78(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b5 <probability_re_norm+0x85>
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1341 <probability_re_norm+0x211>
movsd  0xe43(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11fb <probability_re_norm+0xcb>
movsd  0xea0(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <probability_re_norm@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1341 <probability_re_norm+0x211>
movsd  0xe75(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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  -0x18(%rbp),%xmm6
movsd  -0x18(%rbp),%xmm7
movsd  -0x18(%rbp),%xmm8
movsd  -0x18(%rbp),%xmm9
movsd  -0x18(%rbp),%xmm10
movsd  0xde3(%rip),%xmm11
mulsd  %xmm11,%xmm10
movsd  0xddd(%rip),%xmm11
addsd  %xmm11,%xmm10
mulsd  %xmm10,%xmm9
movsd  0xdba(%rip),%xmm10
addsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm8
movsd  0xd9f(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xd84(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd6b(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd53(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd3b(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd23(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd0b(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xcf3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probability_re_norm>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd 0xec3(%rip),%xmm0
jne    1145 <probability_re_norm+0x15>
jnp    1295 <probability_re_norm+0x165>
ucomisd 0xec3(%rip),%xmm0
jbe    115c <probability_re_norm+0x2c>
movsd  0xeb1(%rip),%xmm1
jmp    1295 <probability_re_norm+0x165>
movsd  0xebc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1177 <probability_re_norm+0x47>
movsd  0xea6(%rip),%xmm1
jmp    1295 <probability_re_norm+0x165>
movsd  0xe81(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11ab <probability_re_norm+0x7b>
movsd  0xea3(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <probability_re_norm@plt>
movapd %xmm0,%xmm1
xorpd  0xeea(%rip),%xmm1
jmp    1295 <probability_re_norm+0x165>
movsd  0xe75(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe71(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1040 <log@plt>
movapd 0xeb8(%rip),%xmm1
movsd  0xe58(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xe54(%rip),%xmm2
xorpd  %xmm0,%xmm1
mulsd  %xmm0,%xmm2
movsd  0xe4c(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xe44(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe3c(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xe34(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe2c(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xe24(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe1c(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xe14(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe0c(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     129b <probability_re_norm+0x16b>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret
pop    %rax
jmp    1050 <sqrt@plt>

LLVM IR (-O0):
define double @probability_re_norm(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp oeq double %5, 5.000000e-01
br i1 %6, label %7, label %8
7: ; preds = %1
store double 0.000000e+00, double* %2
br label %56
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp ogt double %9, 0x3FEFFFFF5EF05060
br i1 %10, label %11, label %12
11: ; preds = %8
store double 5.000000e+00, double* %2
br label %56
12: ; preds = %8
%13 = load double, double* %3
%14 = fcmp olt double %13, 3.000000e-07
br i1 %14, label %15, label %16
15: ; preds = %12
store double -5.000000e+00, double* %2
br label %56
16: ; preds = %12
%17 = load double, double* %3
%18 = fcmp olt double %17, 5.000000e-01
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load double, double* %3
%21 = fsub double 1.000000e+00, %20
%22 = call double @probability_re_norm(double %21)
%23 = fneg double %22
store double %23, double* %2
br label %56
24: ; preds = %16
%25 = load double, double* %3
%26 = fmul double 4.000000e+00, %25
%27 = load double, double* %3
%28 = fsub double 1.000000e+00, %27
%29 = fmul double %26, %28
%30 = call double @log(double %29)
%31 = fneg double %30
store double %31, double* %4
%32 = load double, double* %4
%33 = load double, double* %4
%34 = load double, double* %4
%35 = load double, double* %4
%36 = load double, double* %4
%37 = load double, double* %4
%38 = load double, double* %4
%39 = load double, double* %4
%40 = load double, double* %4
%41 = load double, double* %4
%42 = load double, double* %4
%43 = call double @llvm.fmuladd.f64(double %42, double 0x3D68679AA9EC9A38, double 0x3DC41BD805096DF9)
%44 = call double @llvm.fmuladd.f64(double %41, double %43, double 0xBE2BC1390DEC58E7)
%45 = call double @llvm.fmuladd.f64(double %40, double %44, double 0x3E7671979857A092)
%46 = call double @llvm.fmuladd.f64(double %39, double %45, double 0xBEB1896BFBD6446E)
%47 = call double @llvm.fmuladd.f64(double %38, double %46, double 0x3ED86DBA7E177BCB)
%48 = call double @llvm.fmuladd.f64(double %37, double %47, double 0x3EDCB1B3C4588BE6)
%49 = call double @llvm.fmuladd.f64(double %36, double %48, double 0xBF2D80ECE6B44DAA)
%50 = call double @llvm.fmuladd.f64(double %35, double %49, double 0xBF4B6887417F2C60)
%51 = call double @llvm.fmuladd.f64(double %34, double %50, double 0x3FA2FAD2BC7570AB)
%52 = call double @llvm.fmuladd.f64(double %33, double %51, double 0x3FF921FB49DA360E)
%53 = fmul double %32, %52
store double %53, double* %4
%54 = load double, double* %4
%55 = call double @sqrt(double %54)
store double %55, double* %2
br label %56
56: ; preds = %24, %19, %15, %11, %7
%57 = load double, double* %2
ret double %57
}

LLVM IR (-O2):
define double @probability_re_norm(double %0) {
%2 = fcmp oeq double %0, 5.000000e-01
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = fcmp ogt double %0, 0x3FEFFFFF5EF05060
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = fcmp olt double %0, 3.000000e-07
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = fcmp olt double %0, 5.000000e-01
br i1 %8, label %11, label %15
9: ; preds = %15, %1, %3, %5, %11
%10 = phi double [ %14, %11 ], [ %32, %15 ], [ 0.000000e+00, %1 ], [ 5.000000e+00, %3 ], [ -5.000000e+00, %5 ]
ret double %10
11: ; preds = %7
%12 = fsub double 1.000000e+00, %0
%13 = tail call double @probability_re_norm(double %12)
%14 = fneg double %13
br label %9
15: ; preds = %7
%16 = fmul double %0, 4.000000e+00
%17 = fsub double 1.000000e+00, %0
%18 = fmul double %16, %17
%19 = tail call double @log(double %18)
%20 = fneg double %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double 0x3D68679AA9EC9A38, double 0x3DC41BD805096DF9)
%22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double 0xBE2BC1390DEC58E7)
%23 = tail call double @llvm.fmuladd.f64(double %20, double %22, double 0x3E7671979857A092)
%24 = tail call double @llvm.fmuladd.f64(double %20, double %23, double 0xBEB1896BFBD6446E)
%25 = tail call double @llvm.fmuladd.f64(double %20, double %24, double 0x3ED86DBA7E177BCB)
%26 = tail call double @llvm.fmuladd.f64(double %20, double %25, double 0x3EDCB1B3C4588BE6)
%27 = tail call double @llvm.fmuladd.f64(double %20, double %26, double 0xBF2D80ECE6B44DAA)
%28 = tail call double @llvm.fmuladd.f64(double %20, double %27, double 0xBF4B6887417F2C60)
%29 = tail call double @llvm.fmuladd.f64(double %20, double %28, double 0x3FA2FAD2BC7570AB)
%30 = tail call double @llvm.fmuladd.f64(double %20, double %29, double 0x3FF921FB49DA360E)
%31 = fmul double %30, %20
%32 = tail call double @sqrt(double %31)
br label %9
}