#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 CDFt(double, int /*<<< orphan*/, int, double, double);
double LnGamma(double);
int PDFt(double, int /*<<< orphan*/, int, double, double);
double log(double);
double sqrt(double);
double PDFSkewT(double x, double loc, double scale, double shape, double df) {
  double z = (x - loc) / scale, pdf;
  double lnghalf = 0.57236494292470008707;
  double lngv, lngv1, lnConst_pdft, lnbeta_cdft;
  lngv = LnGamma(df / 2);
  lngv1 = LnGamma((df + 1) / 2);
  lnConst_pdft =
      lngv1 - lngv - 0.5 * log(3.1415926535897932384626433832795 * df);
  lnbeta_cdft = lngv1 + lnghalf - lngv - log(df / 2);
  pdf = 2 / scale * PDFt(z, 0, 1, df, lnConst_pdft) *
        CDFt(shape * z * sqrt((df + 1) / (df + z * z)), 0, 1, df + 1,
             lnbeta_cdft);
  return pdf;
}


x86 assembly (clang, -O0):
<PDFSkewT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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  0xe90(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <LnGamma@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xe48(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <LnGamma@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe2b(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  0xe09(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdd3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdb1(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <PDFt@plt>
movsd  -0x78(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xd5b(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd22(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <CDFt@plt>
movsd  -0x68(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDFSkewT>:
sub    $0x48,%rsp
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x40(%rsp)
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movapd %xmm4,%xmm0
mulsd  0xe80(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
call   1070 <LnGamma@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe6f(%rip),%xmm1
addsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  0xe53(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1070 <LnGamma@plt>
movsd  %xmm0,0x8(%rsp)
movapd %xmm0,%xmm1
subsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xe3d(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1050 <log@plt>
mulsd  0xe32(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe1e(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x38(%rsp),%xmm0
call   1050 <log@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xdf7(%rip),%xmm0
divsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
xor    %edi,%edi
mov    $0x1,%esi
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm2
call   1040 <PDFt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mulsd  %xmm0,%xmm0
addsd  0x18(%rsp),%xmm0
movapd %xmm0,%xmm1
movsd  0x30(%rsp),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12aa <PDFSkewT+0x15a>
sqrtsd %xmm0,%xmm0
jmp    12af <PDFSkewT+0x15f>
call   1060 <sqrt@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
xor    %edi,%edi
mov    $0x1,%esi
movsd  0x30(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <CDFt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @PDFSkewT(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
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = 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
%18 = load double, double* %6
%19 = load double, double* %7
%20 = fsub double %18, %19
%21 = load double, double* %8
%22 = fdiv double %20, %21
store double %22, double* %11
store double 0x3FE250D048E7A1BD, double* %13
%23 = load double, double* %10
%24 = fdiv double %23, 2.000000e+00
%25 = call double @LnGamma(double %24)
store double %25, double* %14
%26 = load double, double* %10
%27 = fadd double %26, 1.000000e+00
%28 = fdiv double %27, 2.000000e+00
%29 = call double @LnGamma(double %28)
store double %29, double* %15
%30 = load double, double* %15
%31 = load double, double* %14
%32 = fsub double %30, %31
%33 = load double, double* %10
%34 = fmul double 0x400921FB54442D18, %33
%35 = call double @log(double %34)
%36 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %35, double %32)
store double %36, double* %16
%37 = load double, double* %15
%38 = load double, double* %13
%39 = fadd double %37, %38
%40 = load double, double* %14
%41 = fsub double %39, %40
%42 = load double, double* %10
%43 = fdiv double %42, 2.000000e+00
%44 = call double @log(double %43)
%45 = fsub double %41, %44
store double %45, double* %17
%46 = load double, double* %8
%47 = fdiv double 2.000000e+00, %46
%48 = load double, double* %11
%49 = load double, double* %10
%50 = load double, double* %16
%51 = call i32 @PDFt(double %48, i32 0, i32 1, double %49, double %50)
%52 = sitofp i32 %51 to double
%53 = fmul double %47, %52
%54 = load double, double* %9
%55 = load double, double* %11
%56 = fmul double %54, %55
%57 = load double, double* %10
%58 = fadd double %57, 1.000000e+00
%59 = load double, double* %10
%60 = load double, double* %11
%61 = load double, double* %11
%62 = call double @llvm.fmuladd.f64(double %60, double %61, double %59)
%63 = fdiv double %58, %62
%64 = call double @sqrt(double %63)
%65 = fmul double %56, %64
%66 = load double, double* %10
%67 = fadd double %66, 1.000000e+00
%68 = load double, double* %17
%69 = call i32 @CDFt(double %65, i32 0, i32 1, double %67, double %68)
%70 = sitofp i32 %69 to double
%71 = fmul double %53, %70
store double %71, double* %12
%72 = load double, double* %12
ret double %72
}

LLVM IR (-O2):
define double @PDFSkewT(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %0, %1
%7 = fdiv double %6, %2
%8 = fmul double %4, 5.000000e-01
%9 = tail call double @LnGamma(double %8)
%10 = fadd double %4, 1.000000e+00
%11 = fmul double %10, 5.000000e-01
%12 = tail call double @LnGamma(double %11)
%13 = fsub double %12, %9
%14 = fmul double %4, 0x400921FB54442D18
%15 = tail call double @log(double %14)
%16 = tail call double @llvm.fmuladd.f64(double %15, double -5.000000e-01, double %13)
%17 = fadd double %12, 0x3FE250D048E7A1BD
%18 = fsub double %17, %9
%19 = tail call double @log(double %8)
%20 = fsub double %18, %19
%21 = fdiv double 2.000000e+00, %2
%22 = tail call i32 @PDFt(double %7, i32 0, i32 1, double %4, double %16)
%23 = sitofp i32 %22 to double
%24 = fmul double %21, %23
%25 = fmul double %7, %3
%26 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %4)
%27 = fdiv double %10, %26
%28 = tail call double @sqrt(double %27)
%29 = fmul double %25, %28
%30 = tail call i32 @CDFt(double %29, i32 0, i32 1, double %10, double %20)
%31 = sitofp i32 %30 to double
%32 = fmul double %24, %31
ret double %32
}