#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 gamma_log(double);
int /*<<< orphan*/ printf(char *);
double beta_log(double a, double b) {
  double oup;
  if (a < 0. || b < 0.) {
    printf(" The Two Inputs should be nonnegative and real");
    exit(1);
  }
  oup = gamma_log(a) + gamma_log(b) - gamma_log(a + b);
  return oup;
}


x86 assembly (clang, -O0):
<beta_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     115e <beta_log+0x2e>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1174 <beta_log+0x44>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <gamma_log@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <gamma_log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1030 <gamma_log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta_log>:
sub    $0x18,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
ja     1192 <beta_log+0x62>
ucomisd %xmm1,%xmm2
ja     1192 <beta_log+0x62>
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1030 <gamma_log@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <gamma_log@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <gamma_log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c" The Two Inputs should be nonnegative and real\00"
define double @beta_log(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load double, double* %4
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %8, %2
%12 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %8
%15 = load double, double* %3
%16 = call double @gamma_log(double %15)
%17 = load double, double* %4
%18 = call double @gamma_log(double %17)
%19 = fadd double %16, %18
%20 = load double, double* %3
%21 = load double, double* %4
%22 = fadd double %20, %21
%23 = call double @gamma_log(double %22)
%24 = fsub double %19, %23
store double %24, double* %5
%25 = load double, double* %5
ret double %25
}

LLVM IR (-O2):
@.str = [47 x i8] c" The Two Inputs should be nonnegative and real\00"
define double @beta_log(double %0, double %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fcmp olt double %1, 0.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = tail call double @gamma_log(double %0)
%11 = tail call double @gamma_log(double %1)
%12 = fadd double %10, %11
%13 = fadd double %0, %1
%14 = tail call double @gamma_log(double %13)
%15 = fsub double %12, %14
ret double %15
}