#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
double incomplete_beta(double, double, double, char const *);
int /*<<< orphan*/ stderr;
double student_t(double n, double x, const char *prompt) {
  if (n <= 0) {
    fprintf(stderr,
            "%s: IMPLEMENTATION ERROR! (Invalid argument in function "
            "\"student_t\")\n",
            prompt);
    exit(4);
  }
  if (x > 0)
    return 1 - 0.5 * incomplete_beta(n / 2, 0.5, n / (n + x * x), prompt);
  else if (x < 0)
    return 0.5 * incomplete_beta(n / 2, 0.5, n / (n + x * x), prompt);
  else
    return 0.5;
}


x86 assembly (clang, -O0):
<student_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1177 <student_t+0x47>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x4,%edi
call   1050 <exit@plt>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ed <student_t+0xbd>
movsd  -0x10(%rbp),%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm4
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm1,%xmm2
mov    -0x20(%rbp),%rdi
movsd  0xe3a(%rip),%xmm1
call   1040 <incomplete_beta@plt>
movsd  0xe3d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe39(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1263 <student_t+0x133>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1256 <student_t+0x126>
movsd  -0x10(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm4
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm1,%xmm2
mov    -0x20(%rbp),%rdi
movsd  0xdc8(%rip),%xmm1
call   1040 <incomplete_beta@plt>
movaps %xmm0,%xmm1
movsd  0xdb8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1263 <student_t+0x133>
movsd  0xda2(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<student_t>:
push   %rax
mov    %rdi,%rdx
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jae    11cc <student_t+0x9c>
ucomisd %xmm0,%xmm1
jbe    1186 <student_t+0x56>
movsd  0xeac(%rip),%xmm3
movapd %xmm2,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm3,%xmm1
mov    %rdx,%rdi
call   1040 <incomplete_beta@plt>
mulsd  0xe8c(%rip),%xmm0
addsd  0xe8c(%rip),%xmm0
pop    %rax
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11c2 <student_t+0x92>
movsd  0xe68(%rip),%xmm3
movapd %xmm2,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm3,%xmm1
mov    %rdx,%rdi
call   1040 <incomplete_beta@plt>
mulsd  0xe40(%rip),%xmm0
pop    %rax
ret
movsd  0xe36(%rip),%xmm0
pop    %rax
ret
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x4,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [70 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22student_t\22)\0A\00"
define double @student_t(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i8*
store double %0, double* %5
store double %1, double* %6
store i8* %2, i8** %7
%8 = load double, double* %5
%9 = fcmp ole double %8, 0.000000e+00
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %7
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 4)
unreachable
15: ; preds = %3
%16 = load double, double* %6
%17 = fcmp ogt double %16, 0.000000e+00
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load double, double* %5
%20 = fdiv double %19, 2.000000e+00
%21 = load double, double* %5
%22 = load double, double* %5
%23 = load double, double* %6
%24 = load double, double* %6
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double %22)
%26 = fdiv double %21, %25
%27 = load i8*, i8** %7
%28 = call double @incomplete_beta(double %20, double 5.000000e-01, double %26, i8* %27)
%29 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %28, double 1.000000e+00)
store double %29, double* %4
br label %46
30: ; preds = %15
%31 = load double, double* %6
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %45
33: ; preds = %30
%34 = load double, double* %5
%35 = fdiv double %34, 2.000000e+00
%36 = load double, double* %5
%37 = load double, double* %5
%38 = load double, double* %6
%39 = load double, double* %6
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double %37)
%41 = fdiv double %36, %40
%42 = load i8*, i8** %7
%43 = call double @incomplete_beta(double %35, double 5.000000e-01, double %41, i8* %42)
%44 = fmul double 5.000000e-01, %43
store double %44, double* %4
br label %46
45: ; preds = %30
store double 5.000000e-01, double* %4
br label %46
46: ; preds = %45, %33, %18
%47 = load double, double* %4
ret double %47
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [70 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22student_t\22)\0A\00"
define double @student_t(double %0, double %1, i8* %2) {
%4 = fcmp ugt double %0, 0.000000e+00
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = tail call i32 @exit(i32 4)
unreachable
9: ; preds = %3
%10 = fcmp ogt double %1, 0.000000e+00
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = fmul double %0, 5.000000e-01
%13 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %0)
%14 = fdiv double %0, %13
%15 = tail call double @incomplete_beta(double %12, double 5.000000e-01, double %14, i8* %2)
%16 = tail call double @llvm.fmuladd.f64(double %15, double -5.000000e-01, double 1.000000e+00)
br label %25
17: ; preds = %9
%18 = fcmp olt double %1, 0.000000e+00
br i1 %18, label %19, label %25
19: ; preds = %17
%20 = fmul double %0, 5.000000e-01
%21 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %0)
%22 = fdiv double %0, %21
%23 = tail call double @incomplete_beta(double %20, double 5.000000e-01, double %22, i8* %2)
%24 = fmul double %23, 5.000000e-01
br label %25
25: ; preds = %17, %19, %11
%26 = phi double [ %16, %11 ], [ %24, %19 ], [ 5.000000e-01, %17 ]
ret double %26
}