#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 exp(double);
double fabs(double);
double cPhi(double x) {
  long double v[] = {
      1.25331413731550025,  .421369229288054473,  .236652382913560671,
      .162377660896867462,  .123131963257932296,  .0990285964717319214,
      .0827662865013691773, .0710695805388521071, .0622586659950261958};
  double h, a, b, z, t, s, pwr;
  int i, j;
  j = (fabs(x) + 1.) / 2.;
  a = v[j];
  z = 2 * j;
  h = fabs(x) - z;
  b = z * a - 1;
  pwr = 1;
  s = a + h * b;
  for (i = 2; i < 100; i += 2) {
    a = (a + z * b) / i;
    b = (b + z * a) / (i + 1);
    pwr = pwr * h * h;
    t = s;
    s = s + pwr * (a + h * b);
    if (s == t) {
      s *= exp(-.5 * x * x - .91893853320467274178);
      return (x > 0) ? s : 1 - s;
    }
  }
}


x86 assembly (clang, -O0):
<cPhi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x10(%rbp)
lea    0xf09(%rip),%rsi
lea    -0xa0(%rbp),%rdi
mov    $0x90,%edx
call   1030 <memcpy@plt>
movaps 0xee1(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
pand   %xmm1,%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xe0(%rbp)
movslq -0xe0(%rbp),%rax
shl    $0x4,%rax
fldt   -0xa0(%rbp,%rax,1)
fstpl  -0xe8(%rbp)
movsd  -0xe8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0xe0(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movaps 0xe6d(%rip),%xmm1
pand   %xmm1,%xmm0
subsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0xe15(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xdf9(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xb8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movl   $0x2,-0xdc(%rbp)
cmpl   $0x64,-0xdc(%rbp)
jge    13e8 <cPhi+0x2c8>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xb8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0xdc(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm4
ff
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd -0xc8(%rbp),%xmm0
ff
jne    13cf <cPhi+0x2af>
jp     13cf <cPhi+0x2af>
movsd  0xcd1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcb3(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13a5 <cPhi+0x285>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    13bd <cPhi+0x29d>
movsd  0xc53(%rip),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    13e8 <cPhi+0x2c8>
jmp    13d4 <cPhi+0x2b4>
mov    -0xdc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xdc(%rbp)
jmp    1241 <cPhi+0x121>
movsd  -0x8(%rbp),%xmm0
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cPhi>:
sub    $0x38,%rsp
movapd %xmm0,%xmm8
movapd 0xedf(%rip),%xmm7
andpd  %xmm0,%xmm7
movsd  0xee3(%rip),%xmm2
movapd %xmm7,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xedb(%rip),%xmm0
cvttsd2si %xmm0,%eax
cltq
mov    %rax,%rcx
shl    $0x4,%rcx
lea    0xeef(%rip),%rdx
fldt   (%rcx,%rdx,1)
fstpl  0x8(%rsp)
add    %eax,%eax
cvtsi2sd %eax,%xmm3
movsd  0x8(%rsp),%xmm4
movapd %xmm3,%xmm5
mulsd  %xmm4,%xmm5
addsd  0xeac(%rip),%xmm5
subsd  %xmm3,%xmm7
movapd %xmm7,%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm4,%xmm1
mov    $0x2,%eax
nopl   0x0(%rax)
movapd %xmm3,%xmm0
mulsd  %xmm5,%xmm0
xorps  %xmm6,%xmm6
cvtsi2sd %eax,%xmm6
addsd  %xmm0,%xmm4
movapd %xmm1,%xmm0
divsd  %xmm6,%xmm4
movapd %xmm3,%xmm6
mulsd  %xmm4,%xmm6
addsd  %xmm6,%xmm5
add    $0x1,%eax
xorps  %xmm6,%xmm6
cvtsi2sd %eax,%xmm6
divsd  %xmm6,%xmm5
mulsd  %xmm7,%xmm2
mulsd  %xmm7,%xmm2
movapd %xmm7,%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
ucomisd %xmm0,%xmm1
jne    11e9 <cPhi+0xd9>
jnp    11f9 <cPhi+0xe9>
lea    -0x1(%rax),%ecx
add    $0x1,%eax
cmp    $0x61,%ecx
jbe    1190 <cPhi+0x80>
add    $0x38,%rsp
ret
movsd  0xe27(%rip),%xmm0
mulsd  %xmm8,%xmm0
mulsd  %xmm8,%xmm0
addsd  0xe1d(%rip),%xmm0
movapd %xmm8,0x20(%rsp)
movapd %xmm1,0x10(%rsp)
call   1030 <exp@plt>
movapd 0x10(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xdd9(%rip),%xmm1
subsd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
cmpltsd 0x20(%rsp),%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.cPhi.v = [9 x x86_fp80] [x86_fp80 0xK3FFFA06C98FFB1383000, x86_fp80 0xK3FFDD7BDB526AA746800, x86_fp80 0xK3FFCF2550094896EF000, x86_fp80 0xK3FFCA646545C9CB24000, x86_fp80 0xK3FFBFC2C9C5A47DEC000, x86_fp80 0xK3FFBCACF8139B80D9000, x86_fp80 0xK3FFBA9815EEDE0C2F800, x86_fp80 0xK3FFB918CEDA13D0BE800, x86_fp80 0xK3FFAFF02F16575A82800]
define double @cPhi(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca [9 x x86_fp80]
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
store double %0, double* %3
%14 = bitcast [9 x x86_fp80]* %4 to i8*
%15 = load double, double* %3
%16 = call double @llvm.fabs.f64(double %15)
%17 = fadd double %16, 1.000000e+00
%18 = fdiv double %17, 2.000000e+00
%19 = fptosi double %18 to i32
store i32 %19, i32* %13
%20 = load i32, i32* %13
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x x86_fp80], [9 x x86_fp80]* %4, i64 0, i64 %21
%23 = load x86_fp80, x86_fp80* %22
%24 = fptrunc x86_fp80 %23 to double
store double %24, double* %6
%25 = load i32, i32* %13
%26 = mul nsw i32 2, %25
%27 = sitofp i32 %26 to double
store double %27, double* %8
%28 = load double, double* %3
%29 = call double @llvm.fabs.f64(double %28)
%30 = load double, double* %8
%31 = fsub double %29, %30
store double %31, double* %5
%32 = load double, double* %8
%33 = load double, double* %6
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double -1.000000e+00)
store double %34, double* %7
store double 1.000000e+00, double* %11
%35 = load double, double* %6
%36 = load double, double* %5
%37 = load double, double* %7
%38 = call double @llvm.fmuladd.f64(double %36, double %37, double %35)
store double %38, double* %10
store i32 2, i32* %12
br label %39
39: ; preds = %92, %1
%40 = load i32, i32* %12
%41 = icmp slt i32 %40, 100
br i1 %41, label %42, label %95
42: ; preds = %39
%43 = load double, double* %6
%44 = load double, double* %8
%45 = load double, double* %7
%46 = call double @llvm.fmuladd.f64(double %44, double %45, double %43)
%47 = load i32, i32* %12
%48 = sitofp i32 %47 to double
%49 = fdiv double %46, %48
store double %49, double* %6
%50 = load double, double* %7
%51 = load double, double* %8
%52 = load double, double* %6
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double %50)
%54 = load i32, i32* %12
%55 = add nsw i32 %54, 1
%56 = sitofp i32 %55 to double
%57 = fdiv double %53, %56
store double %57, double* %7
%58 = load double, double* %11
%59 = load double, double* %5
%60 = fmul double %58, %59
%61 = load double, double* %5
%62 = fmul double %60, %61
store double %62, double* %11
%63 = load double, double* %10
store double %63, double* %9
%64 = load double, double* %10
%65 = load double, double* %11
%66 = load double, double* %6
%67 = load double, double* %5
%68 = load double, double* %7
%69 = call double @llvm.fmuladd.f64(double %67, double %68, double %66)
%70 = call double @llvm.fmuladd.f64(double %65, double %69, double %64)
store double %70, double* %10
%71 = load double, double* %10
%72 = load double, double* %9
%73 = fcmp oeq double %71, %72
br i1 %73, label %74, label %91
74: ; preds = %42
%75 = load double, double* %3
%76 = fmul double -5.000000e-01, %75
%77 = load double, double* %3
%78 = call double @llvm.fmuladd.f64(double %76, double %77, double 0xBFED67F1C864BEB5)
%79 = call double @exp(double %78)
%80 = load double, double* %10
%81 = fmul double %80, %79
store double %81, double* %10
%82 = load double, double* %3
%83 = fcmp ogt double %82, 0.000000e+00
br i1 %83, label %84, label %86
84: ; preds = %74
%85 = load double, double* %10
br label %89
86: ; preds = %74
%87 = load double, double* %10
%88 = fsub double 1.000000e+00, %87
br label %89
89: ; preds = %86, %84
%90 = phi double [ %85, %84 ], [ %88, %86 ]
store double %90, double* %2
br label %95
91: ; preds = %42
br label %92
92: ; preds = %91
%93 = load i32, i32* %12
%94 = add nsw i32 %93, 2
store i32 %94, i32* %12
br label %39
95: ; preds = %89, %39
%96 = load double, double* %2
ret double %96
}

LLVM IR (-O2):
@__const.cPhi.v = [9 x x86_fp80] [x86_fp80 0xK3FFFA06C98FFB1383000, x86_fp80 0xK3FFDD7BDB526AA746800, x86_fp80 0xK3FFCF2550094896EF000, x86_fp80 0xK3FFCA646545C9CB24000, x86_fp80 0xK3FFBFC2C9C5A47DEC000, x86_fp80 0xK3FFBCACF8139B80D9000, x86_fp80 0xK3FFBA9815EEDE0C2F800, x86_fp80 0xK3FFB918CEDA13D0BE800, x86_fp80 0xK3FFAFF02F16575A82800]
define double @cPhi(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fadd double %2, 1.000000e+00
%4 = fmul double %3, 5.000000e-01
%5 = fptosi double %4 to i32
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [9 x x86_fp80], [9 x x86_fp80]* @__const.cPhi.v, i64 0, i64 %6
%8 = load x86_fp80, x86_fp80* %7
%9 = fptrunc x86_fp80 %8 to double
%10 = shl nsw i32 %5, 1
%11 = sitofp i32 %10 to double
%12 = fsub double %2, %11
%13 = tail call double @llvm.fmuladd.f64(double %11, double %9, double -1.000000e+00)
%14 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %9)
br label %18
15: ; preds = %18
%16 = add nuw nsw i32 %19, 2
%17 = icmp ult i32 %19, 98
br i1 %17, label %18, label %44
18: ; preds = %1, %15
%19 = phi i32 [ 2, %1 ], [ %16, %15 ]
%20 = phi double [ 1.000000e+00, %1 ], [ %32, %15 ]
%21 = phi double [ %14, %1 ], [ %34, %15 ]
%22 = phi double [ %9, %1 ], [ %26, %15 ]
%23 = phi double [ %13, %1 ], [ %30, %15 ]
%24 = tail call double @llvm.fmuladd.f64(double %11, double %23, double %22)
%25 = sitofp i32 %19 to double
%26 = fdiv double %24, %25
%27 = tail call double @llvm.fmuladd.f64(double %11, double %26, double %23)
%28 = or i32 %19, 1
%29 = sitofp i32 %28 to double
%30 = fdiv double %27, %29
%31 = fmul double %12, %20
%32 = fmul double %12, %31
%33 = tail call double @llvm.fmuladd.f64(double %12, double %30, double %26)
%34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %21)
%35 = fcmp oeq double %34, %21
br i1 %35, label %36, label %15
36: ; preds = %18
%37 = fmul double %0, -5.000000e-01
%38 = tail call double @llvm.fmuladd.f64(double %37, double %0, double 0xBFED67F1C864BEB5)
%39 = tail call double @exp(double %38)
%40 = fmul double %34, %39
%41 = fcmp ogt double %0, 0.000000e+00
%42 = fsub double 1.000000e+00, %40
%43 = select i1 %41, double %40, double %42
br label %44
44: ; preds = %15, %36
%45 = phi double [ %43, %36 ], [ undef, %15 ]
ret double %45
}