#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*/ exit(int);
double exp(double);
double gamma_log(double);
double pow(double, int);
int /*<<< orphan*/ printf(char *);
double sqrt(double);
double tpdf(double t, int df) {
  double ft, f1, f2, f3;
  double pi = 3.1415926535897932384626434;
  if (df <= 0) {
    printf("Degree Of Freedom should be a positive real integer");
    exit(1);
  }
  f1 = gamma_log((double)(df + 1.0) / 2.0) - gamma_log((double)(df / 2.0));
  f2 = exp(f1);
  f3 = pow(1.0 + (t * t / (df * 1.0)), -(df + 1.0) / 2.0);
  ft = f2 * f3;
  ft = ft / sqrt((double)pi * df);
  return ft;
}


x86 assembly (clang, -O0):
<tpdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     119d <tpdf+0x3d>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <gamma_log@plt>
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe37(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <gamma_log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xdff(%rip),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xdef(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xdde(%rip),%xmm2
addsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdb3(%rip),%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1060 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tpdf>:
sub    $0x28,%rsp
movsd  %xmm0,0x20(%rsp)
test   %edi,%edi
jle    1245 <tpdf+0xe5>
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  0xe79(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  0xe73(%rip),%xmm0
call   1030 <gamma_log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe60(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <gamma_log@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm0
divsd  0x8(%rsp),%xmm0
addsd  0xe1c(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xe1e(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1060 <pow@plt>
movapd %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
mulsd  0xe0b(%rip),%xmm1
mulsd  0x10(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     1227 <tpdf+0xc7>
sqrtsd %xmm0,%xmm0
jmp    1238 <tpdf+0xd8>
movsd  %xmm2,0x8(%rsp)
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret
lea    0xdd4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Degree Of Freedom should be a positive real integer\00"
define double @tpdf(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
store double 0x400921FB54442D18, double* %9
%10 = load i32, i32* %4
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = fadd double %17, 1.000000e+00
%19 = fdiv double %18, 2.000000e+00
%20 = call double @gamma_log(double %19)
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 2.000000e+00
%24 = call double @gamma_log(double %23)
%25 = fsub double %20, %24
store double %25, double* %6
%26 = load double, double* %6
%27 = call double @exp(double %26)
store double %27, double* %7
%28 = load double, double* %3
%29 = load double, double* %3
%30 = fmul double %28, %29
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to double
%33 = fmul double %32, 1.000000e+00
%34 = fdiv double %30, %33
%35 = fadd double 1.000000e+00, %34
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to double
%38 = fadd double %37, 1.000000e+00
%39 = fneg double %38
%40 = fdiv double %39, 2.000000e+00
%41 = fptosi double %40 to i32
%42 = call double @pow(double %35, i32 %41)
store double %42, double* %8
%43 = load double, double* %7
%44 = load double, double* %8
%45 = fmul double %43, %44
store double %45, double* %5
%46 = load double, double* %5
%47 = load double, double* %9
%48 = load i32, i32* %4
%49 = sitofp i32 %48 to double
%50 = fmul double %47, %49
%51 = call double @sqrt(double %50)
%52 = fdiv double %46, %51
store double %52, double* %5
%53 = load double, double* %5
ret double %53
}

LLVM IR (-O2):
@.str = [52 x i8] c"Degree Of Freedom should be a positive real integer\00"
define double @tpdf(double %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = sitofp i32 %1 to double
%9 = fadd double %8, 1.000000e+00
%10 = fmul double %9, 5.000000e-01
%11 = tail call double @gamma_log(double %10)
%12 = fmul double %8, 5.000000e-01
%13 = tail call double @gamma_log(double %12)
%14 = fsub double %11, %13
%15 = tail call double @exp(double %14)
%16 = fmul double %0, %0
%17 = fdiv double %16, %8
%18 = fadd double %17, 1.000000e+00
%19 = fmul double %9, -5.000000e-01
%20 = fptosi double %19 to i32
%21 = tail call double @pow(double %18, i32 %20)
%22 = fmul double %15, %21
%23 = fmul double %8, 0x400921FB54442D18
%24 = tail call double @sqrt(double %23)
%25 = fdiv double %22, %24
ret double %25
}