#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 LnGamma(double);
double exp(double);
double log(int);
double PDFt(double x, double loc, double scale, double df, double lnConst) {
  double z = (x - loc) / scale, lnpdf = lnConst;
  if (lnpdf == 0) {
    lnpdf = LnGamma((df + 1) / 2) - LnGamma(df / 2) -
            0.5 * log(3.1415926535897932384626433832795 * df);
  }
  lnpdf -= (df + 1) / 2 * log(1 + z * z / df);
  return exp(lnpdf) / scale;
}


x86 assembly (clang, -O0):
<PDFt>:
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  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1201 <PDFt+0xd1>
jp     1201 <PDFt+0xd1>
movsd  0xe89(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe74(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <LnGamma@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <LnGamma@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe2f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  -0x40(%rbp),%xmm1
movsd  0xe0c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe0f(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xdfa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  0xde2(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <exp@plt>
divsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDFt>:
sub    $0x38,%rsp
movsd  %xmm2,0x20(%rsp)
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
movsd  0xeb2(%rip),%xmm0
movsd  %xmm3,0x10(%rsp)
addsd  %xmm3,%xmm0
movsd  %xmm0,0x18(%rsp)
jne    11df <PDFt+0xaf>
jp     11df <PDFt+0xaf>
movsd  0x18(%rsp),%xmm0
mulsd  0xe98(%rip),%xmm0
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
call   1050 <LnGamma@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe79(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1050 <LnGamma@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe5e(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movapd %xmm0,%xmm4
mulsd  0xe3f(%rip),%xmm4
addsd  0x8(%rsp),%xmm4
movsd  %xmm4,0x8(%rsp)
subsd  %xmm1,%xmm2
divsd  0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm2
divsd  0x10(%rsp),%xmm2
addsd  0xdff(%rip),%xmm2
cvttsd2si %xmm2,%edi
call   1040 <log@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0xe00(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
divsd  0x20(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @PDFt(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
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
%13 = load double, double* %6
%14 = load double, double* %7
%15 = fsub double %13, %14
%16 = load double, double* %8
%17 = fdiv double %15, %16
store double %17, double* %11
%18 = load double, double* %10
store double %18, double* %12
%19 = load double, double* %12
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %35
21: ; preds = %5
%22 = load double, double* %9
%23 = fadd double %22, 1.000000e+00
%24 = fdiv double %23, 2.000000e+00
%25 = call double @LnGamma(double %24)
%26 = load double, double* %9
%27 = fdiv double %26, 2.000000e+00
%28 = call double @LnGamma(double %27)
%29 = fsub double %25, %28
%30 = load double, double* %9
%31 = fmul double 0x400921FB54442D18, %30
%32 = fptosi double %31 to i32
%33 = call double @log(i32 %32)
%34 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %33, double %29)
store double %34, double* %12
br label %35
35: ; preds = %21, %5
%36 = load double, double* %9
%37 = fadd double %36, 1.000000e+00
%38 = fdiv double %37, 2.000000e+00
%39 = load double, double* %11
%40 = load double, double* %11
%41 = fmul double %39, %40
%42 = load double, double* %9
%43 = fdiv double %41, %42
%44 = fadd double 1.000000e+00, %43
%45 = fptosi double %44 to i32
%46 = call double @log(i32 %45)
%47 = load double, double* %12
%48 = fneg double %38
%49 = call double @llvm.fmuladd.f64(double %48, double %46, double %47)
store double %49, double* %12
%50 = load double, double* %12
%51 = call double @exp(double %50)
%52 = load double, double* %8
%53 = fdiv double %51, %52
ret double %53
}

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