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


x86 assembly (clang, -O0):
<lgammadist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
fldt   0x30(%rbp)
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldz
fld    %st(0)
fstpt  -0x6c(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0x6c(%rbp)
fldt   -0x30(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
movzbl %al,%edi
call   1030 <assert@plt>
fldt   -0x20(%rbp)
fld1
fchs
faddp  %st,%st(1)
fstpt  -0x48(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <log@plt>
fstpt  -0x54(%rbp)
fldt   -0x20(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <log@plt>
fldt   -0x60(%rbp)
fldt   -0x54(%rbp)
fldt   -0x48(%rbp)
fxch   %st(2)
fmulp  %st,%st(3)
fmulp  %st,%st(1)
fsubp  %st,%st(1)
fldt   -0x10(%rbp)
fldt   -0x30(%rbp)
fdivrp %st,%st(1)
fsubrp %st,%st(1)
fstpt  -0x3c(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgamma@plt>
fldt   -0x3c(%rbp)
fsubp  %st,%st(1)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lgammadist>:
sub    $0x58,%rsp
fldt   0x60(%rsp)
fstpt  0x40(%rsp)
fldt   0x80(%rsp)
fstpt  0x1c(%rsp)
fldt   0x70(%rsp)
fld    %st(0)
fstpt  0x34(%rsp)
fldz
fld    %st(0)
fstpt  0x28(%rsp)
xor    %edi,%edi
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
fldt   0x1c(%rsp)
fldt   0x28(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %dil
call   1030 <assert@plt>
fld1
fchs
fldt   0x34(%rsp)
faddp  %st,%st(1)
fstpt  0x28(%rsp)
fldt   0x40(%rsp)
fstpt  (%rsp)
call   1050 <log@plt>
fstpt  0x4c(%rsp)
fldt   0x1c(%rsp)
fstpt  (%rsp)
call   1050 <log@plt>
fldt   0x34(%rsp)
fmul   %st,%st(1)
fldt   0x28(%rsp)
fldt   0x4c(%rsp)
fmulp  %st,%st(1)
fsubp  %st,%st(2)
fldt   0x40(%rsp)
fldt   0x1c(%rsp)
fdivrp %st,%st(1)
fsubrp %st,%st(2)
fxch   %st(1)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1040 <lgamma@plt>
fldt   0x1c(%rsp)
fsubp  %st,%st(1)
add    $0x58,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @lgammadist(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* %5
%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* %6
%12 = fcmp ogt x86_fp80 %11, 0xK00000000000000000000
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load x86_fp80, x86_fp80* %5
%16 = fsub x86_fp80 %15, 0xK3FFF8000000000000000
%17 = load x86_fp80, x86_fp80* %4
%18 = call x86_fp80 @log(x86_fp80 %17)
%19 = load x86_fp80, x86_fp80* %5
%20 = load x86_fp80, x86_fp80* %6
%21 = call x86_fp80 @log(x86_fp80 %20)
%22 = fmul x86_fp80 %19, %21
%23 = fneg x86_fp80 %22
%24 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %16, x86_fp80 %18, x86_fp80 %23)
%25 = load x86_fp80, x86_fp80* %4
%26 = load x86_fp80, x86_fp80* %6
%27 = fdiv x86_fp80 %25, %26
%28 = fsub x86_fp80 %24, %27
%29 = load x86_fp80, x86_fp80* %5
%30 = call x86_fp80 @lgamma(x86_fp80 %29)
%31 = fsub x86_fp80 %28, %30
ret x86_fp80 %31
}

LLVM IR (-O2):
define x86_fp80 @lgammadist(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = fcmp ogt x86_fp80 %1, 0xK00000000000000000000
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = fcmp ogt x86_fp80 %2, 0xK00000000000000000000
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = fadd x86_fp80 %1, 0xKBFFF8000000000000000
%11 = tail call x86_fp80 @log(x86_fp80 %0)
%12 = tail call x86_fp80 @log(x86_fp80 %2)
%13 = fneg x86_fp80 %12
%14 = fmul x86_fp80 %13, %1
%15 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %10, x86_fp80 %11, x86_fp80 %14)
%16 = fdiv x86_fp80 %0, %2
%17 = fsub x86_fp80 %15, %16
%18 = tail call x86_fp80 @lgamma(x86_fp80 %1)
%19 = fsub x86_fp80 %17, %18
ret x86_fp80 %19
}