#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);
double dstrb_beta_mode(const double a, const double b) {
  assert(a > 0.);
  assert(b > 0.);
  if (a == 1. && b == 1.)
    return 0.5;
  return (a - 1) / (a + b - 2);
}


x86 assembly (clang, -O0):
<dstrb_beta_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a0 <dstrb_beta_mode+0x90>
jp     11a0 <dstrb_beta_mode+0x90>
movsd  -0x18(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a0 <dstrb_beta_mode+0x90>
jp     11a0 <dstrb_beta_mode+0x90>
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d0 <dstrb_beta_mode+0xc0>
movsd  -0x10(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe45(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrb_beta_mode>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
ucomisd 0xedd(%rip),%xmm0
seta   %dil
call   1030 <assert@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd 0xea0(%rip),%xmm2
jne    117d <dstrb_beta_mode+0x6d>
jp     117d <dstrb_beta_mode+0x6d>
ucomisd 0xe94(%rip),%xmm1
jne    117d <dstrb_beta_mode+0x6d>
jp     117d <dstrb_beta_mode+0x6d>
movsd  0xe90(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xe8b(%rip),%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm2,%xmm1
addsd  0xe83(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @dstrb_beta_mode(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fcmp ogt double %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load double, double* %5
%11 = fcmp ogt double %10, 0.000000e+00
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load double, double* %4
%15 = fcmp oeq double %14, 1.000000e+00
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load double, double* %5
%18 = fcmp oeq double %17, 1.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %16
store double 5.000000e-01, double* %3
br label %28
20: ; preds = %16, %2
%21 = load double, double* %4
%22 = fsub double %21, 1.000000e+00
%23 = load double, double* %4
%24 = load double, double* %5
%25 = fadd double %23, %24
%26 = fsub double %25, 2.000000e+00
%27 = fdiv double %22, %26
store double %27, double* %3
br label %28
28: ; preds = %20, %19
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
define double @dstrb_beta_mode(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fcmp ogt double %1, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = fcmp oeq double %0, 1.000000e+00
%10 = fcmp oeq double %1, 1.000000e+00
%11 = and i1 %9, %10
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = fadd double %0, -1.000000e+00
%14 = fadd double %0, %1
%15 = fadd double %14, -2.000000e+00
%16 = fdiv double %13, %15
br label %17
17: ; preds = %2, %12
%18 = phi double [ %16, %12 ], [ 5.000000e-01, %2 ]
ret double %18
}