#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 */
int /*<<< orphan*/ Z(double);
double fabs(int /*<<< orphan*/);
double T(double p, double ndf) {
  int i;
  double z1, z2, h[4], x = 0.0;
  z1 = fabs(Z(p));
  z2 = z1 * z1;
  h[0] = 0.25 * z1 * (z2 + 1.0);
  h[1] = 0.010416667 * z1 * ((5.0 * z2 + 16.0) * z2 + 3.0);
  h[2] = 0.002604167 * z1 * (((3.0 * z2 + 19.0) * z2 + 17.0) * z2 - 15.0);
  h[3] = 0.000010851 * z1 *
         ((((79.0 * z2 + 776.0) * z2 + 1482.0) * z2 - 1920.0) * z2 - 945.0);
  for (i = 3; i >= 0; i--)
    x = (x + h[i]) / (double)ndf;
  z1 += x;
  if (p > 0.5)
    z1 = -z1;
  return (z1);
}


x86 assembly (clang, -O0):
<T>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <Z@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xf11(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xefc(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xede(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xebc(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xeb8(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe83(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe7e(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe5c(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe58(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe33(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe16(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdf9(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xdd7(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdd3(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdae(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd91(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd74(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     12d1 <T+0x1b1>
movsd  -0x58(%rbp),%xmm0
movslq -0x14(%rbp),%rax
addsd  -0x50(%rbp,%rax,8),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    12a0 <T+0x180>
movsd  -0x58(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd93(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1318 <T+0x1f8>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<T>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1030 <Z@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xeb4(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xeb0(%rip),%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xea8(%rip),%xmm5
mulsd  %xmm0,%xmm5
movsd  0xea4(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xea0(%rip),%xmm2
mulsd  %xmm3,%xmm2
movsd  0xe9c(%rip),%xmm4
addsd  %xmm4,%xmm2
mulsd  %xmm5,%xmm2
movsd  0xe94(%rip),%xmm5
mulsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm4
addsd  0xe8c(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xe88(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xe84(%rip),%xmm4
mulsd  %xmm5,%xmm4
movsd  0xe80(%rip),%xmm5
movsd  0xe80(%rip),%xmm6
mulsd  %xmm3,%xmm6
addsd  0xe7c(%rip),%xmm6
mulsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm6
addsd  0xe74(%rip),%xmm6
mulsd  %xmm3,%xmm6
addsd  0xe70(%rip),%xmm6
mulsd  %xmm3,%xmm6
addsd  0xe6c(%rip),%xmm6
mulsd  %xmm5,%xmm6
xorpd  %xmm3,%xmm3
addsd  %xmm6,%xmm3
movsd  0x8(%rsp),%xmm5
divsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
divsd  %xmm5,%xmm3
addsd  %xmm1,%xmm3
divsd  %xmm5,%xmm3
addsd  %xmm0,%xmm3
movapd 0xe4a(%rip),%xmm1
xorpd  %xmm3,%xmm1
movsd  0xe2e(%rip),%xmm0
cmpltsd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
andnpd %xmm3,%xmm2
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @T(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca [4 x double]
%9 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0.000000e+00, double* %9
%10 = load double, double* %3
%11 = call i32 @Z(double %10)
%12 = call double @fabs(i32 %11)
store double %12, double* %6
%13 = load double, double* %6
%14 = load double, double* %6
%15 = fmul double %13, %14
store double %15, double* %7
%16 = load double, double* %6
%17 = fmul double 2.500000e-01, %16
%18 = load double, double* %7
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %17, %19
%21 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
store double %20, double* %21
%22 = load double, double* %6
%23 = fmul double 0x3F85555560C95D45, %22
%24 = load double, double* %7
%25 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %24, double 1.600000e+01)
%26 = load double, double* %7
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double 3.000000e+00)
%28 = fmul double %23, %27
%29 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 1
store double %28, double* %29
%30 = load double, double* %6
%31 = fmul double 0x3F65555583257516, %30
%32 = load double, double* %7
%33 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %32, double 1.900000e+01)
%34 = load double, double* %7
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double 1.700000e+01)
%36 = load double, double* %7
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double -1.500000e+01)
%38 = fmul double %31, %37
%39 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 2
store double %38, double* %39
%40 = load double, double* %6
%41 = fmul double 1.085100e-05, %40
%42 = load double, double* %7
%43 = call double @llvm.fmuladd.f64(double 7.900000e+01, double %42, double 7.760000e+02)
%44 = load double, double* %7
%45 = call double @llvm.fmuladd.f64(double %43, double %44, double 1.482000e+03)
%46 = load double, double* %7
%47 = call double @llvm.fmuladd.f64(double %45, double %46, double -1.920000e+03)
%48 = load double, double* %7
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double -9.450000e+02)
%50 = fmul double %41, %49
%51 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 3
store double %50, double* %51
store i32 3, i32* %5
br label %52
52: ; preds = %64, %2
%53 = load i32, i32* %5
%54 = icmp sge i32 %53, 0
br i1 %54, label %55, label %67
55: ; preds = %52
%56 = load double, double* %9
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %58
%60 = load double, double* %59
%61 = fadd double %56, %60
%62 = load double, double* %4
%63 = fdiv double %61, %62
store double %63, double* %9
br label %64
64: ; preds = %55
%65 = load i32, i32* %5
%66 = add nsw i32 %65, -1
store i32 %66, i32* %5
br label %52
67: ; preds = %52
%68 = load double, double* %9
%69 = load double, double* %6
%70 = fadd double %69, %68
store double %70, double* %6
%71 = load double, double* %3
%72 = fcmp ogt double %71, 5.000000e-01
br i1 %72, label %73, label %76
73: ; preds = %67
%74 = load double, double* %6
%75 = fneg double %74
store double %75, double* %6
br label %76
76: ; preds = %73, %67
%77 = load double, double* %6
ret double %77
}

LLVM IR (-O2):
define double @T(double %0, double %1) {
%3 = tail call i32 @Z(double %0)
%4 = tail call double @fabs(i32 %3)
%5 = fmul double %4, %4
%6 = fmul double %4, 2.500000e-01
%7 = fadd double %5, 1.000000e+00
%8 = fmul double %6, %7
%9 = fmul double %4, 0x3F85555560C95D45
%10 = tail call double @llvm.fmuladd.f64(double %5, double 5.000000e+00, double 1.600000e+01)
%11 = tail call double @llvm.fmuladd.f64(double %10, double %5, double 3.000000e+00)
%12 = fmul double %9, %11
%13 = fmul double %4, 0x3F65555583257516
%14 = tail call double @llvm.fmuladd.f64(double %5, double 3.000000e+00, double 1.900000e+01)
%15 = tail call double @llvm.fmuladd.f64(double %14, double %5, double 1.700000e+01)
%16 = tail call double @llvm.fmuladd.f64(double %15, double %5, double -1.500000e+01)
%17 = fmul double %13, %16
%18 = fmul double %4, 1.085100e-05
%19 = tail call double @llvm.fmuladd.f64(double %5, double 7.900000e+01, double 7.760000e+02)
%20 = tail call double @llvm.fmuladd.f64(double %19, double %5, double 1.482000e+03)
%21 = tail call double @llvm.fmuladd.f64(double %20, double %5, double -1.920000e+03)
%22 = tail call double @llvm.fmuladd.f64(double %21, double %5, double -9.450000e+02)
%23 = fmul double %18, %22
%24 = fadd double %23, 0.000000e+00
%25 = fdiv double %24, %1
%26 = fadd double %25, %17
%27 = fdiv double %26, %1
%28 = fadd double %27, %12
%29 = fdiv double %28, %1
%30 = fadd double %29, %8
%31 = fdiv double %30, %1
%32 = fadd double %4, %31
%33 = fcmp ogt double %0, 5.000000e-01
%34 = fneg double %32
%35 = select i1 %33, double %34, double %32
ret double %35
}