#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*/ fatalx(char *, double, double);
double rangam(double);
double ranbeta(double a, double b) {
  double xa, xb;
  if ((a <= 0.0) || (b <= 0.0))
    fatalx("(ranbeta) bad parameters: %9.3f %9.3f\n", a, b);
  xa = rangam(a);
  xb = rangam(b);
  return xa / (xa + xb);
}


x86 assembly (clang, -O0):
<ranbeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jae    114e <ranbeta+0x2e>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1164 <ranbeta+0x44>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xea1(%rip),%rdi
call   1030 <fatalx@plt>
movsd  -0x8(%rbp),%xmm0
call   1040 <rangam@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <rangam@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ranbeta>:
sub    $0x18,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x10(%rsp)
jae    113a <ranbeta+0x1a>
ucomisd %xmm1,%xmm2
jb     1158 <ranbeta+0x38>
lea    0xebf(%rip),%rdi
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
call   1030 <fatalx@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <rangam@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <rangam@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"(ranbeta) bad parameters: %9.3f %9.3f\0A\00"
define double @ranbeta(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = fcmp ole double %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load double, double* %4
%11 = fcmp ole double %10, 0.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9, %2
%13 = load double, double* %3
%14 = load double, double* %4
%15 = call i32 @fatalx(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %13, double %14)
br label %16
16: ; preds = %12, %9
%17 = load double, double* %3
%18 = call double @rangam(double %17)
store double %18, double* %5
%19 = load double, double* %4
%20 = call double @rangam(double %19)
store double %20, double* %6
%21 = load double, double* %5
%22 = load double, double* %5
%23 = load double, double* %6
%24 = fadd double %22, %23
%25 = fdiv double %21, %24
ret double %25
}

LLVM IR (-O2):
@.str = [39 x i8] c"(ranbeta) bad parameters: %9.3f %9.3f\0A\00"
define double @ranbeta(double %0, double %1) {
%3 = fcmp ole double %0, 0.000000e+00
%4 = fcmp ole double %1, 0.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @fatalx(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %0, double %1)
br label %8
8: ; preds = %2, %6
%9 = tail call double @rangam(double %0)
%10 = tail call double @rangam(double %1)
%11 = fadd double %9, %10
%12 = fdiv double %9, %11
ret double %12
}