#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*/ assert(int);
long double lgamma(long double);
long double log(int);
long double lbetadist(long double x, long double alpha, long double beta) {
  assert(x > 0);
  assert(x < 1);
  assert(alpha > 0);
  assert(beta > 0);
  return (alpha - 1) * log(x) + (beta - 1) * log(1 - x) + lgamma(alpha + beta) -
         lgamma(alpha) - lgamma(beta);
}


x86 assembly (clang, -O0):
<lbetadist>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
fldt   0x30(%rbp)
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x10(%rbp)
fldz
fld    %st(0)
fstpt  -0xa0(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0x10(%rbp)
fld1
fld    %st(0)
fstpt  -0x94(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0xa0(%rbp)
fldt   -0x20(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0xa0(%rbp)
fldt   -0x30(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0x94(%rbp)
fldt   -0x20(%rbp)
fsubp  %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x10(%rbp)
fnstcw -0x3a(%rbp)
movzwl -0x3a(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x3c(%rbp)
fldcw  -0x3c(%rbp)
fistpl -0x38(%rbp)
fldcw  -0x3a(%rbp)
mov    -0x38(%rbp),%edi
call   1050 <log@plt>
fldt   -0x94(%rbp)
fxch   %st(1)
fstpt  -0x7c(%rbp)
fldt   -0x30(%rbp)
fsub   %st(1),%st
fstpt  -0x88(%rbp)
fldt   -0x10(%rbp)
fsubrp %st,%st(1)
fnstcw -0x3e(%rbp)
movzwl -0x3e(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x40(%rbp)
fldcw  -0x40(%rbp)
fistpl -0x34(%rbp)
fldcw  -0x3e(%rbp)
mov    -0x34(%rbp),%edi
call   1050 <log@plt>
fldt   -0x88(%rbp)
fldt   -0x7c(%rbp)
fldt   -0x70(%rbp)
fxch   %st(2)
fmulp  %st,%st(3)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x64(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
faddp  %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgamma@plt>
fldt   -0x64(%rbp)
faddp  %st,%st(1)
fstpt  -0x58(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgamma@plt>
fldt   -0x58(%rbp)
fsubp  %st,%st(1)
fstpt  -0x4c(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgamma@plt>
fldt   -0x4c(%rbp)
fsubp  %st,%st(1)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lbetadist>:
sub    $0x68,%rsp
fldt   0x90(%rsp)
fstpt  0x3c(%rsp)
fldt   0x80(%rsp)
fstpt  0x24(%rsp)
fldt   0x70(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fldz
fld    %st(0)
fstpt  0x30(%rsp)
xor    %edi,%edi
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
fld1
fld    %st(0)
fstpt  0x5c(%rsp)
xor    %edi,%edi
fldt   0x14(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
fldt   0x24(%rsp)
fldt   0x30(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
fldt   0x3c(%rsp)
fldt   0x30(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
fldt   0x5c(%rsp)
fchs
fld    %st(0)
fstpt  0x50(%rsp)
fldt   0x24(%rsp)
faddp  %st,%st(1)
fstpt  0x30(%rsp)
fnstcw 0x12(%rsp)
movzwl 0x12(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x22(%rsp)
fldcw  0x22(%rsp)
fldt   0x14(%rsp)
fistpl 0x48(%rsp)
fldcw  0x12(%rsp)
mov    0x48(%rsp),%edi
call   1050 <log@plt>
fldt   0x3c(%rsp)
fldt   0x50(%rsp)
faddp  %st,%st(1)
fstpt  0x50(%rsp)
fldt   0x14(%rsp)
fldt   0x5c(%rsp)
fsubp  %st,%st(1)
fnstcw 0x10(%rsp)
movzwl 0x10(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x20(%rsp)
fldcw  0x20(%rsp)
fistpl 0x4c(%rsp)
fldcw  0x10(%rsp)
fstpt  0x14(%rsp)
mov    0x4c(%rsp),%edi
call   1050 <log@plt>
fldt   0x50(%rsp)
fmulp  %st,%st(1)
fldt   0x30(%rsp)
fldt   0x14(%rsp)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  0x14(%rsp)
fldt   0x3c(%rsp)
fldt   0x24(%rsp)
faddp  %st,%st(1)
fstpt  (%rsp)
call   1040 <lgamma@plt>
fldt   0x14(%rsp)
faddp  %st,%st(1)
fstpt  0x14(%rsp)
fldt   0x24(%rsp)
fstpt  (%rsp)
call   1040 <lgamma@plt>
fldt   0x14(%rsp)
fsubp  %st,%st(1)
fstpt  0x24(%rsp)
fldt   0x3c(%rsp)
fstpt  (%rsp)
call   1040 <lgamma@plt>
fldt   0x24(%rsp)
fsubp  %st,%st(1)
add    $0x68,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @lbetadist(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
store x86_fp80 %2, x86_fp80* %6
%7 = load x86_fp80, x86_fp80* %4
%8 = fcmp ogt x86_fp80 %7, 0xK00000000000000000000
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load x86_fp80, x86_fp80* %4
%12 = fcmp olt x86_fp80 %11, 0xK3FFF8000000000000000
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load x86_fp80, x86_fp80* %5
%16 = fcmp ogt x86_fp80 %15, 0xK00000000000000000000
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load x86_fp80, x86_fp80* %6
%20 = fcmp ogt x86_fp80 %19, 0xK00000000000000000000
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load x86_fp80, x86_fp80* %5
%24 = fsub x86_fp80 %23, 0xK3FFF8000000000000000
%25 = load x86_fp80, x86_fp80* %4
%26 = fptosi x86_fp80 %25 to i32
%27 = call x86_fp80 @log(i32 %26)
%28 = load x86_fp80, x86_fp80* %6
%29 = fsub x86_fp80 %28, 0xK3FFF8000000000000000
%30 = load x86_fp80, x86_fp80* %4
%31 = fsub x86_fp80 0xK3FFF8000000000000000, %30
%32 = fptosi x86_fp80 %31 to i32
%33 = call x86_fp80 @log(i32 %32)
%34 = fmul x86_fp80 %29, %33
%35 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %24, x86_fp80 %27, x86_fp80 %34)
%36 = load x86_fp80, x86_fp80* %5
%37 = load x86_fp80, x86_fp80* %6
%38 = fadd x86_fp80 %36, %37
%39 = call x86_fp80 @lgamma(x86_fp80 %38)
%40 = fadd x86_fp80 %35, %39
%41 = load x86_fp80, x86_fp80* %5
%42 = call x86_fp80 @lgamma(x86_fp80 %41)
%43 = fsub x86_fp80 %40, %42
%44 = load x86_fp80, x86_fp80* %6
%45 = call x86_fp80 @lgamma(x86_fp80 %44)
%46 = fsub x86_fp80 %43, %45
ret x86_fp80 %46
}

LLVM IR (-O2):
define x86_fp80 @lbetadist(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = fcmp ogt x86_fp80 %0, 0xK00000000000000000000
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = fcmp olt x86_fp80 %0, 0xK3FFF8000000000000000
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = fcmp ogt x86_fp80 %1, 0xK00000000000000000000
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = fcmp ogt x86_fp80 %2, 0xK00000000000000000000
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = fadd x86_fp80 %1, 0xKBFFF8000000000000000
%17 = fptosi x86_fp80 %0 to i32
%18 = tail call x86_fp80 @log(i32 %17)
%19 = fadd x86_fp80 %2, 0xKBFFF8000000000000000
%20 = fsub x86_fp80 0xK3FFF8000000000000000, %0
%21 = fptosi x86_fp80 %20 to i32
%22 = tail call x86_fp80 @log(i32 %21)
%23 = fmul x86_fp80 %19, %22
%24 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %16, x86_fp80 %18, x86_fp80 %23)
%25 = fadd x86_fp80 %1, %2
%26 = tail call x86_fp80 @lgamma(x86_fp80 %25)
%27 = fadd x86_fp80 %26, %24
%28 = tail call x86_fp80 @lgamma(x86_fp80 %1)
%29 = fsub x86_fp80 %27, %28
%30 = tail call x86_fp80 @lgamma(x86_fp80 %2)
%31 = fsub x86_fp80 %29, %30
ret x86_fp80 %31
}