#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_function(double const, double const);
double pow(double const, double const);
double dstrb_beta_pdf(const double a, const double b, const double x) {
  assert(a > 0);
  assert(b > 0);
  assert(x >= 0.0 && x <= 1.0);
  const double a1 = a - 1.0;
  const double b1 = b - 1.0;
  const double x1 = 1.0 - x;
  const double y1 = pow(x, a1) * pow(x1, b1);
  const double y0 = dstrb_beta_function(a, b);
  return y1 / y0;
}


x86 assembly (clang, -O0):
<dstrb_beta_pdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
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
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jb     11a3 <dstrb_beta_pdf+0x73>
movsd  0xe68(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe1c(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <dstrb_beta_function@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrb_beta_pdf>:
sub    $0x28,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
movsd  0x10(%rsp),%xmm0
ucomisd 0xea7(%rip),%xmm0
seta   %dil
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe90(%rip),%xmm0
setae  %al
movsd  0xe75(%rip),%xmm1
movsd  %xmm1,(%rsp)
ucomisd %xmm0,%xmm1
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movsd  0xe5f(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm2,%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <dstrb_beta_function@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @dstrb_beta_pdf(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%12 = load double, double* %4
%13 = fcmp ogt double %12, 0.000000e+00
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load double, double* %5
%17 = fcmp ogt double %16, 0.000000e+00
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load double, double* %6
%21 = fcmp oge double %20, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %3
%23 = load double, double* %6
%24 = fcmp ole double %23, 1.000000e+00
br label %25
25: ; preds = %22, %3
%26 = phi i1 [ false, %3 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load double, double* %4
%30 = fsub double %29, 1.000000e+00
store double %30, double* %7
%31 = load double, double* %5
%32 = fsub double %31, 1.000000e+00
store double %32, double* %8
%33 = load double, double* %6
%34 = fsub double 1.000000e+00, %33
store double %34, double* %9
%35 = load double, double* %6
%36 = load double, double* %7
%37 = call double @pow(double %35, double %36)
%38 = load double, double* %9
%39 = load double, double* %8
%40 = call double @pow(double %38, double %39)
%41 = fmul double %37, %40
store double %41, double* %10
%42 = load double, double* %4
%43 = load double, double* %5
%44 = call double @dstrb_beta_function(double %42, double %43)
store double %44, double* %11
%45 = load double, double* %10
%46 = load double, double* %11
%47 = fdiv double %45, %46
ret double %47
}

LLVM IR (-O2):
define double @dstrb_beta_pdf(double %0, double %1, double %2) {
%4 = fcmp ogt double %0, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = fcmp ogt double %1, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = fcmp oge double %2, 0.000000e+00
%11 = fcmp ole double %2, 1.000000e+00
%12 = and i1 %10, %11
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = fadd double %0, -1.000000e+00
%16 = fadd double %1, -1.000000e+00
%17 = fsub double 1.000000e+00, %2
%18 = tail call double @pow(double %2, double %15)
%19 = tail call double @pow(double %17, double %16)
%20 = fmul double %18, %19
%21 = tail call double @dstrb_beta_function(double %0, double %1)
%22 = fdiv double %20, %21
ret double %22
}