#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 */
double beta(double, double);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
double pow(int, double);
int /*<<< orphan*/ stderr;
double dbetaidx(double a, double b, double x) {
  if (x <= 0.0 || x >= 1.0) {
    fprintf(stderr, "dbetaidx argument out of range\n");
    exit(-1);
  }
  return pow(x, a - 1.) * pow(1. - x, b - 1.) / beta(a, b);
}


x86 assembly (clang, -O0):
<dbetaidx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    117c <dbetaidx+0x3c>
movsd  -0x18(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     119b <dbetaidx+0x5b>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
cvttsd2si -0x18(%rbp),%edi
movsd  -0x8(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe3d(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  -0x10(%rbp),%xmm0
movsd  0xe27(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <beta@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbetaidx>:
sub    $0x28,%rsp
movsd  %xmm1,0x10(%rsp)
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jae    11e2 <dbetaidx+0xa2>
ucomisd 0xe9c(%rip),%xmm2
jae    11e2 <dbetaidx+0xa2>
cvttsd2si %xmm2,%edi
movapd %xmm1,%xmm0
addsd  0xe92(%rip),%xmm0
movsd  %xmm1,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1050 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe6b(%rip),%xmm0
subsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe61(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
call   1050 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <beta@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe1e(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"dbetaidx argument out of range\0A\00"
define double @dbetaidx(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fcmp ole double %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load double, double* %6
%11 = fcmp oge double %10, 1.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9, %3
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %9
%17 = load double, double* %6
%18 = fptosi double %17 to i32
%19 = load double, double* %4
%20 = fsub double %19, 1.000000e+00
%21 = call double @pow(i32 %18, double %20)
%22 = load double, double* %6
%23 = fsub double 1.000000e+00, %22
%24 = fptosi double %23 to i32
%25 = load double, double* %5
%26 = fsub double %25, 1.000000e+00
%27 = call double @pow(i32 %24, double %26)
%28 = fmul double %21, %27
%29 = load double, double* %4
%30 = load double, double* %5
%31 = call double @beta(double %29, double %30)
%32 = fdiv double %28, %31
ret double %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"dbetaidx argument out of range\0A\00"
define double @dbetaidx(double %0, double %1, double %2) {
%4 = fcmp ole double %2, 0.000000e+00
%5 = fcmp oge double %2, 1.000000e+00
%6 = or i1 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %3
%12 = fptosi double %2 to i32
%13 = fadd double %0, -1.000000e+00
%14 = tail call double @pow(i32 %12, double %13)
%15 = fsub double 1.000000e+00, %2
%16 = fptosi double %15 to i32
%17 = fadd double %1, -1.000000e+00
%18 = tail call double @pow(i32 %16, double %17)
%19 = fmul double %14, %18
%20 = tail call double @beta(double %0, double %1)
%21 = fdiv double %19, %20
ret double %21
}