#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 CDFBeta(double, double, double, double);
double LnGamma(double);
double CDFt(double x, double loc, double scale, double df, double lnbeta) {
  double z = (x - loc) / scale, cdf;
  double lnghalf = 0.57236494292470008707;
  if (lnbeta == 0) {
    lnbeta = LnGamma(df / 2) + lnghalf - LnGamma((df + 1) / 2);
  }
  cdf = CDFBeta(df / (df + z * z), df / 2, 0.5, lnbeta);
  if (z >= 0)
    cdf = 1 - cdf / 2;
  else
    cdf /= 2;
  return (cdf);
}


x86 assembly (clang, -O0):
<CDFt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c9 <CDFt+0xa9>
jp     11c9 <CDFt+0xa9>
movsd  -0x20(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <LnGamma@plt>
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe6e(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <LnGamma@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe12(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm3
movsd  0xe11(%rip),%xmm2
call   1030 <CDFBeta@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     124a <CDFt+0x12a>
movsd  -0x38(%rbp),%xmm1
movsd  0xdd8(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdd4(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1260 <CDFt+0x140>
movsd  -0x38(%rbp),%xmm0
movsd  0xdb1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CDFt>:
sub    $0x28,%rsp
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
movsd  0xebe(%rip),%xmm1
movsd  %xmm3,0x8(%rsp)
mulsd  %xmm3,%xmm1
jne    1198 <CDFt+0x78>
jp     1198 <CDFt+0x78>
movapd %xmm1,%xmm0
movsd  %xmm1,0x20(%rsp)
call   1040 <LnGamma@plt>
addsd  0xea1(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe9b(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xe7d(%rip),%xmm0
call   1040 <LnGamma@plt>
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm4
subsd  %xmm0,%xmm4
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm2
divsd  %xmm2,%xmm0
movsd  0xe48(%rip),%xmm2
movapd %xmm4,%xmm3
call   1030 <CDFBeta@plt>
mulsd  0xe37(%rip),%xmm0
movsd  0xe3f(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpnlesd 0x10(%rsp),%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @CDFt(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fsub double %14, %15
%17 = load double, double* %8
%18 = fdiv double %16, %17
store double %18, double* %11
store double 0x3FE250D048E7A1BD, double* %13
%19 = load double, double* %10
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %32
21: ; preds = %5
%22 = load double, double* %9
%23 = fdiv double %22, 2.000000e+00
%24 = call double @LnGamma(double %23)
%25 = load double, double* %13
%26 = fadd double %24, %25
%27 = load double, double* %9
%28 = fadd double %27, 1.000000e+00
%29 = fdiv double %28, 2.000000e+00
%30 = call double @LnGamma(double %29)
%31 = fsub double %26, %30
store double %31, double* %10
br label %32
32: ; preds = %21, %5
%33 = load double, double* %9
%34 = load double, double* %9
%35 = load double, double* %11
%36 = load double, double* %11
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double %34)
%38 = fdiv double %33, %37
%39 = load double, double* %9
%40 = fdiv double %39, 2.000000e+00
%41 = load double, double* %10
%42 = call double @CDFBeta(double %38, double %40, double 5.000000e-01, double %41)
store double %42, double* %12
%43 = load double, double* %11
%44 = fcmp oge double %43, 0.000000e+00
br i1 %44, label %45, label %49
45: ; preds = %32
%46 = load double, double* %12
%47 = fdiv double %46, 2.000000e+00
%48 = fsub double 1.000000e+00, %47
store double %48, double* %12
br label %52
49: ; preds = %32
%50 = load double, double* %12
%51 = fdiv double %50, 2.000000e+00
store double %51, double* %12
br label %52
52: ; preds = %49, %45
%53 = load double, double* %12
ret double %53
}

LLVM IR (-O2):
define double @CDFt(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %0, %1
%7 = fdiv double %6, %2
%8 = fcmp oeq double %4, 0.000000e+00
%9 = fmul double %3, 5.000000e-01
br i1 %8, label %10, label %17
10: ; preds = %5
%11 = tail call double @LnGamma(double %9)
%12 = fadd double %11, 0x3FE250D048E7A1BD
%13 = fadd double %3, 1.000000e+00
%14 = fmul double %13, 5.000000e-01
%15 = tail call double @LnGamma(double %14)
%16 = fsub double %12, %15
br label %17
17: ; preds = %5, %10
%18 = phi double [ %16, %10 ], [ %4, %5 ]
%19 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %3)
%20 = fdiv double %3, %19
%21 = tail call double @CDFBeta(double %20, double %9, double 5.000000e-01, double %18)
%22 = fcmp ult double %7, 0.000000e+00
%23 = fmul double %21, 5.000000e-01
%24 = fsub double 1.000000e+00, %23
%25 = select i1 %22, double %23, double %24
ret double %25
}