#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 LogBeta(double, long);
double exp(double);
double log(double);
double sqrt(double);
double pdfStudent(long n, double x) {
  double s, t;
  s = -0.5 * (n + 1) * log(1.0 + ((x * x) / (double)n));
  t = -LogBeta(0.5, n / 2.0);
  return (exp(s + t) / sqrt((double)n));
}


x86 assembly (clang, -O0):
<pdfStudent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
cvtsi2sd %rax,%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
cvtsi2sdq -0x8(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe85(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xe55(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
movsd  0xe3c(%rip),%xmm0
call   1040 <LogBeta@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdfStudent>:
sub    $0x18,%rsp
lea    0x1(%rdi),%rax
cvtsi2sd %rax,%xmm1
mulsd  0xeab(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %rdi,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
addsd  0xe8f(%rip),%xmm0
call   1050 <log@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe7e(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1040 <LogBeta@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     11d7 <pdfStudent+0x97>
sqrtsd %xmm0,%xmm0
jmp    11e8 <pdfStudent+0xa8>
movsd  %xmm2,0x8(%rsp)
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @pdfStudent(i64 %0, double %1) {
%3 = alloca i64
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i64 %0, i64* %3
store double %1, double* %4
%7 = load i64, i64* %3
%8 = add nsw i64 %7, 1
%9 = sitofp i64 %8 to double
%10 = fmul double -5.000000e-01, %9
%11 = load double, double* %4
%12 = load double, double* %4
%13 = fmul double %11, %12
%14 = load i64, i64* %3
%15 = sitofp i64 %14 to double
%16 = fdiv double %13, %15
%17 = fadd double 1.000000e+00, %16
%18 = call double @log(double %17)
%19 = fmul double %10, %18
store double %19, double* %5
%20 = load i64, i64* %3
%21 = sitofp i64 %20 to double
%22 = fdiv double %21, 2.000000e+00
%23 = fptosi double %22 to i64
%24 = call double @LogBeta(double 5.000000e-01, i64 %23)
%25 = fneg double %24
store double %25, double* %6
%26 = load double, double* %5
%27 = load double, double* %6
%28 = fadd double %26, %27
%29 = call double @exp(double %28)
%30 = load i64, i64* %3
%31 = sitofp i64 %30 to double
%32 = call double @sqrt(double %31)
%33 = fdiv double %29, %32
ret double %33
}

LLVM IR (-O2):
define double @pdfStudent(i64 %0, double %1) {
%3 = add nsw i64 %0, 1
%4 = sitofp i64 %3 to double
%5 = fmul double %4, -5.000000e-01
%6 = fmul double %1, %1
%7 = sitofp i64 %0 to double
%8 = fdiv double %6, %7
%9 = fadd double %8, 1.000000e+00
%10 = tail call double @log(double %9)
%11 = fmul double %5, %10
%12 = fmul double %7, 5.000000e-01
%13 = fptosi double %12 to i64
%14 = tail call double @LogBeta(double 5.000000e-01, i64 %13)
%15 = fsub double %11, %14
%16 = tail call double @exp(double %15)
%17 = tail call double @sqrt(double %7)
%18 = fdiv double %16, %17
ret double %18
}