#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*/ cdflib_dinvnr(double *, double *);
double cdflib_eval_pol(double const *, int const *, double *);
double fabs(int /*<<< orphan*/);
double cdflib_dt1(double *p, double *q, double *df) {
  static const double coef[4][5] = {
      {1.0e0, 1.0e0, 0.0e0, 0.0e0, 0.0e0},
      {3.0e0, 16.0e0, 5.0e0, 0.0e0, 0.0e0},
      {-15.0e0, 17.0e0, 19.0e0, 3.0e0, 0.0e0},
      {-945.0e0, -1920.0e0, 1482.0e0, 776.0e0, 79.0e0}};
  static const double denom[4] = {4.0e0, 96.0e0, 384.0e0, 92160.0e0};
  static const int ideg[4] = {2, 3, 4, 5};
  double dt1, denpow, sum, term, x, xp, xx;
  int i;
  x = fabs(cdflib_dinvnr(p, q));
  xx = x * x;
  sum = x;
  denpow = 1.0e0;
  for (i = 0; i < 4; i++) {
    term = cdflib_eval_pol(&coef[i][0], &ideg[i], &xx) * x;
    denpow *= *df;
    sum += (term / (denpow * denom[i]));
  }
  if (!(*p >= 0.5e0)) {
    goto S20;
  }
  xp = sum;
  goto S30;
S20:
  xp = -sum;
S30:
  dt1 = xp;
  return dt1;
}


x86 assembly (clang, -O0):
<cdflib_dt1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <cdflib_dinvnr@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    1213 <cdflib_dt1+0xe3>
movslq -0x54(%rbp),%rax
lea    0xe71(%rip),%rdi
imul   $0x28,%rax,%rax
add    %rax,%rdi
movslq -0x54(%rbp),%rax
lea    0xf1f(%rip),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x50(%rbp),%rdx
call   1050 <cdflib_eval_pol@plt>
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movslq -0x54(%rbp),%rcx
lea    0xebe(%rip),%rax
mulsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    118a <cdflib_dt1+0x5a>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xde5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    1232 <cdflib_dt1+0x102>
jmp    1241 <cdflib_dt1+0x111>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1262 <cdflib_dt1+0x132>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_dt1>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
call   1030 <cdflib_dinvnr@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movapd %xmm0,(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
lea    0xedb(%rip),%rdi
lea    0xf74(%rip),%rsi
lea    0x38(%rsp),%r15
mov    %r15,%rdx
call   1050 <cdflib_eval_pol@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
movapd %xmm0,0x40(%rsp)
lea    0xed8(%rip),%rdi
lea    0xf4d(%rip),%rsi
mov    %r15,%rdx
call   1050 <cdflib_eval_pol@plt>
movapd (%rsp),%xmm3
movapd %xmm3,%xmm2
unpcklpd %xmm3,%xmm2
movapd %xmm2,0x50(%rsp)
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
movsd  (%rbx),%xmm0
movapd 0x40(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
unpcklpd %xmm0,%xmm2
mulpd  0xe20(%rip),%xmm2
divpd  %xmm2,%xmm1
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
lea    0xe8f(%rip),%rdi
lea    0xee0(%rip),%rsi
mov    %r15,%rdx
call   1050 <cdflib_eval_pol@plt>
movapd %xmm0,(%rsp)
movapd 0x20(%rsp),%xmm0
mulsd  (%rbx),%xmm0
movapd %xmm0,0x20(%rsp)
lea    0xe8c(%rip),%rdi
lea    0xeb9(%rip),%rsi
mov    %r15,%rdx
call   1050 <cdflib_eval_pol@plt>
movapd (%rsp),%xmm3
unpcklpd %xmm0,%xmm3
mulpd  0x50(%rsp),%xmm3
movsd  (%rbx),%xmm0
movapd 0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm0
unpcklpd %xmm0,%xmm1
mulpd  0xdac(%rip),%xmm1
divpd  %xmm1,%xmm3
movapd 0x10(%rsp),%xmm0
addsd  %xmm3,%xmm0
unpckhpd %xmm3,%xmm3
addsd  %xmm0,%xmm3
movapd 0xd9e(%rip),%xmm1
movsd  0xda6(%rip),%xmm0
cmpnlesd (%r14),%xmm0
xorpd  %xmm3,%xmm1
movapd %xmm0,%xmm2
andnpd %xmm3,%xmm2
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@cdflib_dt1.coef = internal constant [4 x [5 x double]] [[5 x double] [double 1.000000e+00, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double 3.000000e+00, double 1.600000e+01, double 5.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double -1.500000e+01, double 1.700000e+01, double 1.900000e+01, double 3.000000e+00, double 0.000000e+00], [5 x double] [double -9.450000e+02, double -1.920000e+03, double 1.482000e+03, double 7.760000e+02, double 7.900000e+01]]
@cdflib_dt1.denom = internal constant [4 x double] [double 4.000000e+00, double 9.600000e+01, double 3.840000e+02, double 9.216000e+04]
@cdflib_dt1.ideg = internal constant [4 x i32] [i32 2, i32 3, i32 4, i32 5]
define double @cdflib_dt1(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%15 = load double*, double** %4
%16 = load double*, double** %5
%17 = call i32 @cdflib_dinvnr(double* %15, double* %16)
%18 = call double @fabs(i32 %17)
store double %18, double* %11
%19 = load double, double* %11
%20 = load double, double* %11
%21 = fmul double %19, %20
store double %21, double* %13
%22 = load double, double* %11
store double %22, double* %9
store double 1.000000e+00, double* %8
store i32 0, i32* %14
br label %23
23: ; preds = %51, %3
%24 = load i32, i32* %14
%25 = icmp slt i32 %24, 4
br i1 %25, label %26, label %54
26: ; preds = %23
%27 = load i32, i32* %14
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x [5 x double]], [4 x [5 x double]]* @cdflib_dt1.coef, i64 0, i64 %28
%30 = getelementptr inbounds [5 x double], [5 x double]* %29, i64 0, i64 0
%31 = load i32, i32* %14
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i32], [4 x i32]* @cdflib_dt1.ideg, i64 0, i64 %32
%34 = call double @cdflib_eval_pol(double* %30, i32* %33, double* %13)
%35 = load double, double* %11
%36 = fmul double %34, %35
store double %36, double* %10
%37 = load double*, double** %6
%38 = load double, double* %37
%39 = load double, double* %8
%40 = fmul double %39, %38
store double %40, double* %8
%41 = load double, double* %10
%42 = load double, double* %8
%43 = load i32, i32* %14
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x double], [4 x double]* @cdflib_dt1.denom, i64 0, i64 %44
%46 = load double, double* %45
%47 = fmul double %42, %46
%48 = fdiv double %41, %47
%49 = load double, double* %9
%50 = fadd double %49, %48
store double %50, double* %9
br label %51
51: ; preds = %26
%52 = load i32, i32* %14
%53 = add nsw i32 %52, 1
store i32 %53, i32* %14
br label %23
54: ; preds = %23
%55 = load double*, double** %4
%56 = load double, double* %55
%57 = fcmp oge double %56, 5.000000e-01
br i1 %57, label %59, label %58
58: ; preds = %54
br label %61
59: ; preds = %54
%60 = load double, double* %9
store double %60, double* %12
br label %64
61: ; preds = %58
%62 = load double, double* %9
%63 = fneg double %62
store double %63, double* %12
br label %64
64: ; preds = %61, %59
%65 = load double, double* %12
store double %65, double* %7
%66 = load double, double* %7
ret double %66
}

LLVM IR (-O2):
@cdflib_dt1.coef = internal constant [4 x [5 x double]] [[5 x double] [double 1.000000e+00, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double 3.000000e+00, double 1.600000e+01, double 5.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double -1.500000e+01, double 1.700000e+01, double 1.900000e+01, double 3.000000e+00, double 0.000000e+00], [5 x double] [double -9.450000e+02, double -1.920000e+03, double 1.482000e+03, double 7.760000e+02, double 7.900000e+01]]
@cdflib_dt1.ideg = internal constant [4 x i32] [i32 2, i32 3, i32 4, i32 5]
define double @cdflib_dt1(double* %0, double* %1, double* nocapture %2) {
%4 = alloca double
%5 = bitcast double* %4 to i8*
%6 = tail call i32 @cdflib_dinvnr(double* %0, double* %1)
%7 = tail call double @fabs(i32 %6)
%8 = fmul double %7, %7
store double %8, double* %4
%9 = call double @cdflib_eval_pol(double* getelementptr inbounds ([4 x [5 x double]], [4 x [5 x double]]* @cdflib_dt1.coef, i64 0, i64 0, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @cdflib_dt1.ideg, i64 0, i64 0), double* %4)
%10 = load double, double* %2
%11 = call double @cdflib_eval_pol(double* getelementptr inbounds ([4 x [5 x double]], [4 x [5 x double]]* @cdflib_dt1.coef, i64 0, i64 1, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @cdflib_dt1.ideg, i64 0, i64 1), double* %4)
%12 = insertelement <2 x double> poison, double %7, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %9, i64 0
%15 = insertelement <2 x double> %14, double %11, i64 1
%16 = fmul <2 x double> %13, %15
%17 = load double, double* %2
%18 = fmul double %10, %17
%19 = insertelement <2 x double> poison, double %10, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = fmul <2 x double> %20, <double 4.000000e+00, double 9.600000e+01>
%22 = fdiv <2 x double> %16, %21
%23 = extractelement <2 x double> %22, i64 0
%24 = fadd double %7, %23
%25 = extractelement <2 x double> %22, i64 1
%26 = fadd double %24, %25
%27 = call double @cdflib_eval_pol(double* getelementptr inbounds ([4 x [5 x double]], [4 x [5 x double]]* @cdflib_dt1.coef, i64 0, i64 2, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @cdflib_dt1.ideg, i64 0, i64 2), double* %4)
%28 = load double, double* %2
%29 = fmul double %18, %28
%30 = call double @cdflib_eval_pol(double* getelementptr inbounds ([4 x [5 x double]], [4 x [5 x double]]* @cdflib_dt1.coef, i64 0, i64 3, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @cdflib_dt1.ideg, i64 0, i64 3), double* %4)
%31 = insertelement <2 x double> poison, double %27, i64 0
%32 = insertelement <2 x double> %31, double %30, i64 1
%33 = fmul <2 x double> %13, %32
%34 = load double, double* %2
%35 = fmul double %29, %34
%36 = insertelement <2 x double> poison, double %29, i64 0
%37 = insertelement <2 x double> %36, double %35, i64 1
%38 = fmul <2 x double> %37, <double 3.840000e+02, double 9.216000e+04>
%39 = fdiv <2 x double> %33, %38
%40 = extractelement <2 x double> %39, i64 0
%41 = fadd double %26, %40
%42 = extractelement <2 x double> %39, i64 1
%43 = fadd double %41, %42
%44 = load double, double* %0
%45 = fcmp ult double %44, 5.000000e-01
%46 = fneg double %43
%47 = select i1 %45, double %46, double %43
ret double %47
}