double ibeta(a, b, x)
double a, b, x;
{
  if (a <= 0.0 || b <= 0.0)
    return -1.0;
  if (x < 0.0 || x > 1.0)
    return -1.0;
  ;
  if (x == 0.0 || x == 1.0)
    return x;
  return a < x * (a + b) ? 1.0 - confrac(b, a, 1.0 - x) : confrac(a, b, x);
}


x86 assembly (clang, -O0):
<ibeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1143 <ibeta+0x33>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1155 <ibeta+0x45>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <ibeta+0x148>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
ja     117a <ibeta+0x6a>
movsd  -0x20(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118c <ibeta+0x7c>
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <ibeta+0x148>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a9 <ibeta+0x99>
jp     11a9 <ibeta+0x99>
jmp    11c6 <ibeta+0xb6>
movsd  -0x20(%rbp),%xmm0
movsd  0xe4a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11d5 <ibeta+0xc5>
jp     11d5 <ibeta+0xc5>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <ibeta+0x148>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
addsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    122f <ibeta+0x11f>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xdf7(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
mov    $0x3,%al
call   1030 <confrac@plt>
cvtsi2sd %eax,%xmm1
movsd  0xddf(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    124e <ibeta+0x13e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    $0x3,%al
call   1030 <confrac@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibeta>:
push   %rax
movapd %xmm0,%xmm3
xorpd  %xmm4,%xmm4
ucomisd %xmm0,%xmm4
movsd  0xedb(%rip),%xmm0
jae    11c3 <ibeta+0xb3>
ucomisd %xmm1,%xmm4
jae    11c3 <ibeta+0xb3>
xorpd  %xmm4,%xmm4
ucomisd %xmm2,%xmm4
ja     11c3 <ibeta+0xb3>
ucomisd 0xebd(%rip),%xmm2
ja     11c3 <ibeta+0xb3>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1159 <ibeta+0x49>
jnp    11ab <ibeta+0x9b>
ucomisd 0xea7(%rip),%xmm2
jne    1165 <ibeta+0x55>
jnp    11ab <ibeta+0x9b>
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm3,%xmm0
jbe    11b1 <ibeta+0xa1>
movsd  0xe89(%rip),%xmm4
subsd  %xmm2,%xmm4
movapd %xmm1,%xmm0
movapd %xmm3,%xmm1
movapd %xmm4,%xmm2
mov    $0x3,%al
call   1030 <confrac@plt>
movsd  0xe6a(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
pop    %rax
ret
movapd %xmm2,%xmm0
pop    %rax
ret
movapd %xmm3,%xmm0
mov    $0x3,%al
call   1030 <confrac@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ibeta(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = fcmp ole double %8, 0.000000e+00
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load double, double* %6
%12 = fcmp ole double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10, %3
store double -1.000000e+00, double* %4
br label %53
14: ; preds = %10
%15 = load double, double* %7
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load double, double* %7
%19 = fcmp ogt double %18, 1.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %17, %14
store double -1.000000e+00, double* %4
br label %53
21: ; preds = %17
%22 = load double, double* %7
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load double, double* %7
%26 = fcmp oeq double %25, 1.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %24, %21
%28 = load double, double* %7
store double %28, double* %4
br label %53
29: ; preds = %24
%30 = load double, double* %5
%31 = load double, double* %7
%32 = load double, double* %5
%33 = load double, double* %6
%34 = fadd double %32, %33
%35 = fmul double %31, %34
%36 = fcmp olt double %30, %35
br i1 %36, label %37, label %45
37: ; preds = %29
%38 = load double, double* %6
%39 = load double, double* %5
%40 = load double, double* %7
%41 = fsub double 1.000000e+00, %40
%42 = call i32 (double, double, double, ...) bitcast (i32 (...)* @confrac to i32 (double, double, double, ...)*)(double %38, double %39, double %41)
%43 = sitofp i32 %42 to double
%44 = fsub double 1.000000e+00, %43
br label %51
45: ; preds = %29
%46 = load double, double* %5
%47 = load double, double* %6
%48 = load double, double* %7
%49 = call i32 (double, double, double, ...) bitcast (i32 (...)* @confrac to i32 (double, double, double, ...)*)(double %46, double %47, double %48)
%50 = sitofp i32 %49 to double
br label %51
51: ; preds = %45, %37
%52 = phi double [ %44, %37 ], [ %50, %45 ]
store double %52, double* %4
br label %53
53: ; preds = %51, %27, %20, %13
%54 = load double, double* %4
ret double %54
}

LLVM IR (-O2):
define double @ibeta(double %0, double %1, double %2) {
%4 = fcmp ole double %0, 0.000000e+00
%5 = fcmp ole double %1, 0.000000e+00
%6 = or i1 %4, %5
br i1 %6, label %27, label %7
7: ; preds = %3
%8 = fcmp olt double %2, 0.000000e+00
%9 = fcmp ogt double %2, 1.000000e+00
%10 = or i1 %8, %9
br i1 %10, label %27, label %11
11: ; preds = %7
%12 = fcmp oeq double %2, 0.000000e+00
%13 = fcmp oeq double %2, 1.000000e+00
%14 = or i1 %12, %13
br i1 %14, label %27, label %15
15: ; preds = %11
%16 = fadd double %0, %1
%17 = fmul double %16, %2
%18 = fcmp ogt double %17, %0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = fsub double 1.000000e+00, %2
%21 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @confrac to i32 (double, double, double, ...)*)(double %1, double %0, double %20)
%22 = sitofp i32 %21 to double
%23 = fsub double 1.000000e+00, %22
br label %27
24: ; preds = %15
%25 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @confrac to i32 (double, double, double, ...)*)(double %0, double %1, double %2)
%26 = sitofp i32 %25 to double
br label %27
27: ; preds = %19, %24, %11, %7, %3
%28 = phi double [ -1.000000e+00, %3 ], [ -1.000000e+00, %7 ], [ %2, %11 ], [ %23, %19 ], [ %26, %24 ]
ret double %28
}