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


x86 assembly (clang, -O0):
<beta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     116e <beta+0x2e>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1184 <beta+0x44>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <gamma_log@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <gamma_log@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1030 <gamma_log@plt>
mov    -0x20(%rbp),%rdi
sub    %rax,%rdi
call   1050 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
ja     1195 <beta+0x55>
ucomisd %xmm1,%xmm2
ja     1195 <beta+0x55>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <gamma_log@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1030 <gamma_log@plt>
add    %rax,%rbx
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <gamma_log@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <exp@plt>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c" The Two Inputs should be nonnegative and real\00"
define double @beta(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 i64 @gamma_log(double %15)
%17 = load double, double* %4
%18 = call i64 @gamma_log(double %17)
%19 = add nsw i64 %16, %18
%20 = load double, double* %3
%21 = load double, double* %4
%22 = fadd double %20, %21
%23 = call i64 @gamma_log(double %22)
%24 = sub nsw i64 %19, %23
%25 = call double @exp(i64 %24)
store double %25, double* %5
%26 = load double, double* %5
ret double %26
}

LLVM IR (-O2):
@.str = [47 x i8] c" The Two Inputs should be nonnegative and real\00"
define double @beta(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 i64 @gamma_log(double %0)
%11 = tail call i64 @gamma_log(double %1)
%12 = add nsw i64 %11, %10
%13 = fadd double %0, %1
%14 = tail call i64 @gamma_log(double %13)
%15 = sub i64 %12, %14
%16 = tail call double @exp(i64 %15)
ret double %16
}