#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 DBL_EPSILON;
double DBL_MAX;
double DBL_MIN;
double exp(double);
double fabs(double);
scalar_t__ lgamma(double);
double log(int);
double ibeta(double x, double a, double b) {
  int flipped = 0, i, k, count;
  double I, temp, pn[6], ak, bk, next, prev, factor, val;
  if (x <= 0)
    return (0);
  if (x >= 1)
    return (1);
  if ((a + b + 1) * x > (a + 1)) {
    flipped = 1;
    temp = a;
    a = b;
    b = temp;
    x = 1 - x;
  }
  pn[0] = 0.0;
  pn[2] = pn[3] = pn[1] = 1.0;
  count = 1;
  val = x / (1.0 - x);
  bk = 1.0;
  next = 1.0;
  do {
    count++;
    k = count / 2;
    prev = next;
    if (count % 2 == 0)
      ak = -((a + k - 1.0) * (b - k) * val) /
           ((a + 2.0 * k - 2.0) * (a + 2.0 * k - 1.0));
    else
      ak =
          ((a + b + k - 1.0) * k * val) / ((a + 2.0 * k) * (a + 2.0 * k - 1.0));
    pn[4] = bk * pn[2] + ak * pn[0];
    pn[5] = bk * pn[3] + ak * pn[1];
    next = pn[4] / pn[5];
    for (i = 0; i <= 3; i++)
      pn[i] = pn[i + 2];
    if (fabs(pn[4]) >= DBL_MAX)
      for (i = 0; i <= 3; i++)
        pn[i] /= DBL_MAX;
    if (fabs(pn[4]) <= DBL_MIN)
      for (i = 0; i <= 3; i++)
        pn[i] /= DBL_MIN;
  } while (fabs(next - prev) > DBL_EPSILON * prev);
  factor = a * log(x) + (b - 1) * log(1 - x);
  factor -= lgamma(a + 1) + lgamma(b) - lgamma(a + b);
  I = exp(factor) * next;
  return (flipped ? 1 - I : I);
}


x86 assembly (clang, -O0):
<ibeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     116c <ibeta+0x3c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1685 <ibeta+0x555>
movsd  -0x10(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1195 <ibeta+0x65>
movsd  0xe75(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1685 <ibeta+0x555>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11fe <ibeta+0xce>
movl   $0x1,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe0c(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdf2(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xde5(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xdd8(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x1,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdbf(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xda6(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd99(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1343 <ibeta+0x213>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd40(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x18(%rbp),%xmm2
cvtsi2sdl -0x2c(%rbp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  0xcf9(%rip),%xmm2
subsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm3
cvtsi2sdl -0x2c(%rbp),%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
movsd  0xcd3(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    13b0 <ibeta+0x280>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xca2(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm2
cvtsi2sdl -0x2c(%rbp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm3
cvtsi2sdl -0x2c(%rbp),%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
movsd  0xc61(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jg     143b <ibeta+0x30b>
mov    -0x28(%rbp),%eax
add    $0x2,%eax
cltq
movsd  -0x70(%rbp,%rax,8),%xmm0
movslq -0x28(%rbp),%rax
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    140b <ibeta+0x2db>
movsd  -0x50(%rbp),%xmm0
movaps 0xbc9(%rip),%xmm1
pand   %xmm1,%xmm0
mov    0x2b86(%rip),%rax
ucomisd (%rax),%xmm0
jb     149f <ibeta+0x36f>
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jg     149a <ibeta+0x36a>
mov    0x2b64(%rip),%rax
movsd  (%rax),%xmm1
movslq -0x28(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1463 <ibeta+0x333>
jmp    149f <ibeta+0x36f>
movsd  -0x50(%rbp),%xmm1
movaps 0xb65(%rip),%xmm0
pand   %xmm0,%xmm1
mov    0x2b1a(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1507 <ibeta+0x3d7>
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jg     1502 <ibeta+0x3d2>
mov    0x2af4(%rip),%rax
movsd  (%rax),%xmm1
movslq -0x28(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    14cb <ibeta+0x39b>
jmp    1507 <ibeta+0x3d7>
jmp    150c <ibeta+0x3dc>
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x90(%rbp),%xmm0
ff
movaps 0xaed(%rip),%xmm1
pand   %xmm1,%xmm0
mov    0x2aba(%rip),%rax
movsd  (%rax),%xmm1
mulsd  -0x90(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
ja     126f <ibeta+0x13f>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
cvttsd2si -0x10(%rbp),%edi
call   1050 <log@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xa90(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xa7c(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xa37(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1040 <lgamma@plt>
mov    %rax,-0xb0(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <lgamma@plt>
mov    %rax,%rcx
mov    -0xb0(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
call   1040 <lgamma@plt>
mov    %rax,%rcx
mov    -0xa8(%rbp),%rax
sub    %rcx,%rax
cvtsi2sd %rax,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
call   1030 <exp@plt>
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     166b <ibeta+0x53b>
movsd  0x9a7(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    1678 <ibeta+0x548>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibeta>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm3
jae    147d <ibeta+0x34d>
movsd  0xeb0(%rip),%xmm3
ucomisd %xmm3,%xmm0
jae    147d <ibeta+0x34d>
movapd %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0xe96(%rip),%xmm6
addsd  %xmm6,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm1,%xmm4
addsd  %xmm6,%xmm4
ucomisd %xmm4,%xmm3
cmpltsd %xmm3,%xmm4
movapd %xmm4,%xmm3
andpd  %xmm1,%xmm3
movapd %xmm4,0x90(%rsp)
andnpd %xmm2,%xmm4
orpd   %xmm3,%xmm4
movapd %xmm4,0x30(%rsp)
ja     11aa <ibeta+0x7a>
movapd %xmm1,%xmm2
jmp    11b6 <ibeta+0x86>
movapd %xmm6,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
xorpd  %xmm1,%xmm1
unpcklpd %xmm6,%xmm1
movapd %xmm1,(%rsp)
lea    0x10(%rsp),%rax
movaps 0xe51(%rip),%xmm1
movaps %xmm1,0x10(%rsp)
movapd %xmm6,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm0,%xmm12
movapd %xmm1,0x40(%rsp)
divsd  %xmm1,%xmm12
mov    0x2de5(%rip),%rcx
movsd  (%rcx),%xmm11
mov    0x2dd1(%rip),%rcx
movsd  (%rcx),%xmm13
mov    0x2ddd(%rip),%rcx
movsd  (%rcx),%xmm8
movapd 0x30(%rsp),%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,0x60(%rsp)
movapd %xmm13,%xmm3
unpcklpd %xmm13,%xmm3
movapd %xmm11,%xmm7
unpcklpd %xmm11,%xmm7
mov    $0x2,%ecx
movsd  0xdc6(%rip),%xmm14
movsd  0xdc5(%rip),%xmm10
movapd 0xdec(%rip),%xmm15
jmp    1294 <ibeta+0x164>
cs nopw 0x0(%rax,%rax,1)
movapd %xmm9,%xmm1
unpckhpd %xmm9,%xmm1
divsd  %xmm1,%xmm9
movapd %xmm9,%xmm1
subsd  %xmm6,%xmm1
andpd  %xmm15,%xmm1
mulsd  %xmm8,%xmm6
add    $0x1,%ecx
ucomisd %xmm6,%xmm1
movapd %xmm9,%xmm6
jbe    139d <ibeta+0x26d>
mov    %ecx,%edx
shr    %edx
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
test   $0x1,%cl
jne    12e0 <ibeta+0x1b0>
movapd %xmm2,%xmm4
addsd  %xmm1,%xmm4
addsd  %xmm14,%xmm4
xorpd  0xd77(%rip),%xmm4
movapd 0x30(%rsp),%xmm9
subsd  %xmm1,%xmm9
mulsd  %xmm4,%xmm9
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm4
addsd  %xmm10,%xmm4
jmp    1302 <ibeta+0x1d2>
nopl   (%rax)
movapd 0x60(%rsp),%xmm9
addsd  %xmm1,%xmm9
addsd  %xmm14,%xmm9
mulsd  %xmm1,%xmm9
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm12,%xmm9
addsd  %xmm14,%xmm1
mulsd  %xmm4,%xmm1
divsd  %xmm1,%xmm9
unpcklpd %xmm9,%xmm9
mulpd  (%rsp),%xmm9
addpd  0x10(%rsp),%xmm9
movapd %xmm9,0x20(%rsp)
movaps (%rax),%xmm1
movapd 0x10(%rax),%xmm4
movapd %xmm4,0x10(%rsp)
movaps %xmm1,(%rsp)
movapd %xmm9,%xmm1
andpd  %xmm15,%xmm1
ucomisd %xmm11,%xmm1
jb     136f <ibeta+0x23f>
movapd (%rsp),%xmm4
movapd 0x10(%rsp),%xmm5
divpd  %xmm7,%xmm4
movapd %xmm4,(%rsp)
divpd  %xmm7,%xmm5
movapd %xmm5,0x10(%rsp)
ucomisd %xmm1,%xmm13
jb     1260 <ibeta+0x130>
movapd (%rsp),%xmm1
movapd 0x10(%rsp),%xmm4
divpd  %xmm3,%xmm1
movapd %xmm1,(%rsp)
divpd  %xmm3,%xmm4
movapd %xmm4,0x10(%rsp)
jmp    1260 <ibeta+0x130>
cvttsd2si %xmm0,%edi
movapd %xmm2,0x70(%rsp)
movapd %xmm9,0x80(%rsp)
call   1050 <log@plt>
movsd  %xmm0,0x58(%rsp)
movsd  0xc44(%rip),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
cvttsd2si 0x40(%rsp),%edi
call   1050 <log@plt>
mulsd  0x50(%rsp),%xmm0
movapd 0x70(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0xbfd(%rip),%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <lgamma@plt>
mov    %rax,%r14
movaps 0x30(%rsp),%xmm0
call   1040 <lgamma@plt>
mov    %rax,%rbx
add    %r14,%rbx
movaps 0x60(%rsp),%xmm0
call   1040 <lgamma@plt>
sub    %rax,%rbx
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
movsd  0x40(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0xbb1(%rip),%xmm3
movapd 0x80(%rsp),%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm3
movapd %xmm1,%xmm2
movapd 0x90(%rsp),%xmm1
movapd %xmm1,%xmm0
andnpd %xmm2,%xmm0
andpd  %xmm1,%xmm3
orpd   %xmm0,%xmm3
movapd %xmm3,%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@DBL_MAX = global double 0.000000e+00
@DBL_MIN = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define double @ibeta(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca [6 x double]
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32 0, i32* %8
%21 = load double, double* %5
%22 = fcmp ole double %21, 0.000000e+00
br i1 %22, label %23, label %24
23: ; preds = %3
store double 0.000000e+00, double* %4
br label %243
24: ; preds = %3
%25 = load double, double* %5
%26 = fcmp oge double %25, 1.000000e+00
br i1 %26, label %27, label %28
27: ; preds = %24
store double 1.000000e+00, double* %4
br label %243
28: ; preds = %24
%29 = load double, double* %6
%30 = load double, double* %7
%31 = fadd double %29, %30
%32 = fadd double %31, 1.000000e+00
%33 = load double, double* %5
%34 = fmul double %32, %33
%35 = load double, double* %6
%36 = fadd double %35, 1.000000e+00
%37 = fcmp ogt double %34, %36
br i1 %37, label %38, label %44
38: ; preds = %28
store i32 1, i32* %8
%39 = load double, double* %6
store double %39, double* %13
%40 = load double, double* %7
store double %40, double* %6
%41 = load double, double* %13
store double %41, double* %7
%42 = load double, double* %5
%43 = fsub double 1.000000e+00, %42
store double %43, double* %5
br label %44
44: ; preds = %38, %28
%45 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 0
store double 0.000000e+00, double* %45
%46 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 1
store double 1.000000e+00, double* %46
%47 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 3
store double 1.000000e+00, double* %47
%48 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 2
store double 1.000000e+00, double* %48
store i32 1, i32* %11
%49 = load double, double* %5
%50 = load double, double* %5
%51 = fsub double 1.000000e+00, %50
%52 = fdiv double %49, %51
store double %52, double* %20
store double 1.000000e+00, double* %16
store double 1.000000e+00, double* %17
br label %53
53: ; preds = %194, %44
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
store i32 %55, i32* %11
%56 = load i32, i32* %11
%57 = sdiv i32 %56, 2
store i32 %57, i32* %10
%58 = load double, double* %17
store double %58, double* %18
%59 = load i32, i32* %11
%60 = srem i32 %59, 2
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %88
62: ; preds = %53
%63 = load double, double* %6
%64 = load i32, i32* %10
%65 = sitofp i32 %64 to double
%66 = fadd double %63, %65
%67 = fsub double %66, 1.000000e+00
%68 = load double, double* %7
%69 = load i32, i32* %10
%70 = sitofp i32 %69 to double
%71 = fsub double %68, %70
%72 = fmul double %67, %71
%73 = load double, double* %20
%74 = fmul double %72, %73
%75 = fneg double %74
%76 = load double, double* %6
%77 = load i32, i32* %10
%78 = sitofp i32 %77 to double
%79 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %78, double %76)
%80 = fsub double %79, 2.000000e+00
%81 = load double, double* %6
%82 = load i32, i32* %10
%83 = sitofp i32 %82 to double
%84 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %83, double %81)
%85 = fsub double %84, 1.000000e+00
%86 = fmul double %80, %85
%87 = fdiv double %75, %86
store double %87, double* %15
br label %112
88: ; preds = %53
%89 = load double, double* %6
%90 = load double, double* %7
%91 = fadd double %89, %90
%92 = load i32, i32* %10
%93 = sitofp i32 %92 to double
%94 = fadd double %91, %93
%95 = fsub double %94, 1.000000e+00
%96 = load i32, i32* %10
%97 = sitofp i32 %96 to double
%98 = fmul double %95, %97
%99 = load double, double* %20
%100 = fmul double %98, %99
%101 = load double, double* %6
%102 = load i32, i32* %10
%103 = sitofp i32 %102 to double
%104 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %103, double %101)
%105 = load double, double* %6
%106 = load i32, i32* %10
%107 = sitofp i32 %106 to double
%108 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %107, double %105)
%109 = fsub double %108, 1.000000e+00
%110 = fmul double %104, %109
%111 = fdiv double %100, %110
store double %111, double* %15
br label %112
112: ; preds = %88, %62
%113 = load double, double* %16
%114 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 2
%115 = load double, double* %114
%116 = load double, double* %15
%117 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 0
%118 = load double, double* %117
%119 = fmul double %116, %118
%120 = call double @llvm.fmuladd.f64(double %113, double %115, double %119)
%121 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 4
store double %120, double* %121
%122 = load double, double* %16
%123 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 3
%124 = load double, double* %123
%125 = load double, double* %15
%126 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 1
%127 = load double, double* %126
%128 = fmul double %125, %127
%129 = call double @llvm.fmuladd.f64(double %122, double %124, double %128)
%130 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 5
store double %129, double* %130
%131 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 4
%132 = load double, double* %131
%133 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 5
%134 = load double, double* %133
%135 = fdiv double %132, %134
store double %135, double* %17
store i32 0, i32* %9
br label %136
136: ; preds = %148, %112
%137 = load i32, i32* %9
%138 = icmp sle i32 %137, 3
br i1 %138, label %139, label %151
139: ; preds = %136
%140 = load i32, i32* %9
%141 = add nsw i32 %140, 2
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 %142
%144 = load double, double* %143
%145 = load i32, i32* %9
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 %146
store double %144, double* %147
br label %148
148: ; preds = %139
%149 = load i32, i32* %9
%150 = add nsw i32 %149, 1
store i32 %150, i32* %9
br label %136
151: ; preds = %136
%152 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 4
%153 = load double, double* %152
%154 = call double @llvm.fabs.f64(double %153)
%155 = load double, double* @DBL_MAX
%156 = fcmp oge double %154, %155
br i1 %156, label %157, label %172
157: ; preds = %151
store i32 0, i32* %9
br label %158
158: ; preds = %168, %157
%159 = load i32, i32* %9
%160 = icmp sle i32 %159, 3
br i1 %160, label %161, label %171
161: ; preds = %158
%162 = load double, double* @DBL_MAX
%163 = load i32, i32* %9
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 %164
%166 = load double, double* %165
%167 = fdiv double %166, %162
store double %167, double* %165
br label %168
168: ; preds = %161
%169 = load i32, i32* %9
%170 = add nsw i32 %169, 1
store i32 %170, i32* %9
br label %158
171: ; preds = %158
br label %172
172: ; preds = %171, %151
%173 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 4
%174 = load double, double* %173
%175 = call double @llvm.fabs.f64(double %174)
%176 = load double, double* @DBL_MIN
%177 = fcmp ole double %175, %176
br i1 %177, label %178, label %193
178: ; preds = %172
store i32 0, i32* %9
br label %179
179: ; preds = %189, %178
%180 = load i32, i32* %9
%181 = icmp sle i32 %180, 3
br i1 %181, label %182, label %192
182: ; preds = %179
%183 = load double, double* @DBL_MIN
%184 = load i32, i32* %9
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [6 x double], [6 x double]* %14, i64 0, i64 %185
%187 = load double, double* %186
%188 = fdiv double %187, %183
store double %188, double* %186
br label %189
189: ; preds = %182
%190 = load i32, i32* %9
%191 = add nsw i32 %190, 1
store i32 %191, i32* %9
br label %179
192: ; preds = %179
br label %193
193: ; preds = %192, %172
br label %194
194: ; preds = %193
%195 = load double, double* %17
%196 = load double, double* %18
%197 = fsub double %195, %196
%198 = call double @llvm.fabs.f64(double %197)
%199 = load double, double* @DBL_EPSILON
%200 = load double, double* %18
%201 = fmul double %199, %200
%202 = fcmp ogt double %198, %201
br i1 %202, label %53, label %203
203: ; preds = %194
%204 = load double, double* %6
%205 = load double, double* %5
%206 = fptosi double %205 to i32
%207 = call double @log(i32 %206)
%208 = load double, double* %7
%209 = fsub double %208, 1.000000e+00
%210 = load double, double* %5
%211 = fsub double 1.000000e+00, %210
%212 = fptosi double %211 to i32
%213 = call double @log(i32 %212)
%214 = fmul double %209, %213
%215 = call double @llvm.fmuladd.f64(double %204, double %207, double %214)
store double %215, double* %19
%216 = load double, double* %6
%217 = fadd double %216, 1.000000e+00
%218 = call i64 @lgamma(double %217)
%219 = load double, double* %7
%220 = call i64 @lgamma(double %219)
%221 = add nsw i64 %218, %220
%222 = load double, double* %6
%223 = load double, double* %7
%224 = fadd double %222, %223
%225 = call i64 @lgamma(double %224)
%226 = sub nsw i64 %221, %225
%227 = sitofp i64 %226 to double
%228 = load double, double* %19
%229 = fsub double %228, %227
store double %229, double* %19
%230 = load double, double* %19
%231 = call double @exp(double %230)
%232 = load double, double* %17
%233 = fmul double %231, %232
store double %233, double* %12
%234 = load i32, i32* %8
%235 = icmp ne i32 %234, 0
br i1 %235, label %236, label %239
236: ; preds = %203
%237 = load double, double* %12
%238 = fsub double 1.000000e+00, %237
br label %241
239: ; preds = %203
%240 = load double, double* %12
br label %241
241: ; preds = %239, %236
%242 = phi double [ %238, %236 ], [ %240, %239 ]
store double %242, double* %4
br label %243
243: ; preds = %241, %27, %23
%244 = load double, double* %4
ret double %244
}

LLVM IR (-O2):
@DBL_MAX = global double 0.000000e+00
@DBL_MIN = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define double @ibeta(double %0, double %1, double %2) {
%4 = alloca [6 x double]
%5 = bitcast [6 x double]* %4 to i8*
%6 = fcmp ugt double %0, 0.000000e+00
br i1 %6, label %7, label %126
7: ; preds = %3
%8 = fcmp ult double %0, 1.000000e+00
br i1 %8, label %9, label %126
9: ; preds = %7
%10 = fadd double %1, %2
%11 = fadd double %10, 1.000000e+00
%12 = fmul double %11, %0
%13 = fadd double %1, 1.000000e+00
%14 = fcmp ogt double %12, %13
%15 = fsub double 1.000000e+00, %0
%16 = select i1 %14, double %1, double %2
%17 = select i1 %14, double %2, double %1
%18 = select i1 %14, double %15, double %0
%19 = bitcast [6 x double]* %4 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %19
%20 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 2
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %21
%22 = fsub double 1.000000e+00, %18
%23 = fdiv double %18, %22
%24 = load double, double* @DBL_MAX
%25 = load double, double* @DBL_MIN
%26 = load double, double* @DBL_EPSILON
%27 = fadd double %17, %16
%28 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 4
%29 = bitcast double* %20 to i8*
%30 = insertelement <2 x double> poison, double %25, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = insertelement <2 x double> poison, double %25, i64 0
%33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
%34 = insertelement <2 x double> poison, double %24, i64 0
%35 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%36 = insertelement <2 x double> poison, double %24, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = bitcast double* %20 to <2 x double>*
%39 = bitcast [6 x double]* %4 to <2 x double>*
%40 = bitcast double* %28 to <2 x double>*
%41 = bitcast [6 x double]* %4 to <2 x double>*
%42 = bitcast [6 x double]* %4 to <2 x double>*
%43 = bitcast double* %20 to <2 x double>*
%44 = bitcast double* %20 to <2 x double>*
%45 = bitcast [6 x double]* %4 to <2 x double>*
%46 = bitcast [6 x double]* %4 to <2 x double>*
%47 = bitcast double* %20 to <2 x double>*
%48 = bitcast double* %20 to <2 x double>*
br label %49
49: ; preds = %101, %9
%50 = phi i32 [ 1, %9 ], [ %52, %101 ]
%51 = phi double [ 1.000000e+00, %9 ], [ %86, %101 ]
%52 = add nuw nsw i32 %50, 1
%53 = lshr i32 %52, 1
%54 = and i32 %52, 1
%55 = icmp eq i32 %54, 0
%56 = sitofp i32 %53 to double
br i1 %55, label %57, label %65
57: ; preds = %49
%58 = fadd double %17, %56
%59 = fadd double %58, -1.000000e+00
%60 = fsub double %16, %56
%61 = fneg double %59
%62 = fmul double %60, %61
%63 = tail call double @llvm.fmuladd.f64(double %56, double 2.000000e+00, double %17)
%64 = fadd double %63, -2.000000e+00
br label %70
65: ; preds = %49
%66 = fadd double %27, %56
%67 = fadd double %66, -1.000000e+00
%68 = fmul double %67, %56
%69 = tail call double @llvm.fmuladd.f64(double %56, double 2.000000e+00, double %17)
br label %70
70: ; preds = %65, %57
%71 = phi double [ %69, %65 ], [ %63, %57 ]
%72 = phi double [ %69, %65 ], [ %64, %57 ]
%73 = phi double [ %68, %65 ], [ %62, %57 ]
%74 = fmul double %23, %73
%75 = fadd double %71, -1.000000e+00
%76 = fmul double %72, %75
%77 = fdiv double %74, %76
%78 = load <2 x double>, <2 x double>* %38
%79 = load <2 x double>, <2 x double>* %39
%80 = insertelement <2 x double> poison, double %77, i64 0
%81 = shufflevector <2 x double> %80, <2 x double> poison, <2 x i32> zeroinitializer
%82 = fmul <2 x double> %81, %79
%83 = fadd <2 x double> %78, %82
store <2 x double> %83, <2 x double>* %40
%84 = extractelement <2 x double> %83, i64 0
%85 = extractelement <2 x double> %83, i64 1
%86 = fdiv double %84, %85
%87 = tail call double @llvm.fabs.f64(double %84)
%88 = fcmp ult double %87, %24
br i1 %88, label %94, label %89
89: ; preds = %70
%90 = load <2 x double>, <2 x double>* %41
%91 = fdiv <2 x double> %90, %35
store <2 x double> %91, <2 x double>* %42
%92 = load <2 x double>, <2 x double>* %43
%93 = fdiv <2 x double> %92, %37
store <2 x double> %93, <2 x double>* %44
br label %94
94: ; preds = %89, %70
%95 = fcmp ugt double %87, %25
br i1 %95, label %101, label %96
96: ; preds = %94
%97 = load <2 x double>, <2 x double>* %45
%98 = fdiv <2 x double> %97, %31
store <2 x double> %98, <2 x double>* %46
%99 = load <2 x double>, <2 x double>* %47
%100 = fdiv <2 x double> %99, %33
store <2 x double> %100, <2 x double>* %48
br label %101
101: ; preds = %96, %94
%102 = fsub double %86, %51
%103 = tail call double @llvm.fabs.f64(double %102)
%104 = fmul double %51, %26
%105 = fcmp ogt double %103, %104
br i1 %105, label %49, label %106
106: ; preds = %101
%107 = fptosi double %18 to i32
%108 = tail call double @log(i32 %107)
%109 = fadd double %16, -1.000000e+00
%110 = fptosi double %22 to i32
%111 = tail call double @log(i32 %110)
%112 = fmul double %109, %111
%113 = tail call double @llvm.fmuladd.f64(double %17, double %108, double %112)
%114 = fadd double %17, 1.000000e+00
%115 = tail call i64 @lgamma(double %114)
%116 = tail call i64 @lgamma(double %16)
%117 = add nsw i64 %116, %115
%118 = tail call i64 @lgamma(double %27)
%119 = sub i64 %117, %118
%120 = sitofp i64 %119 to double
%121 = fsub double %113, %120
%122 = tail call double @exp(double %121)
%123 = fmul double %86, %122
%124 = fsub double 1.000000e+00, %123
%125 = select i1 %14, double %124, double %123
br label %126
126: ; preds = %7, %3, %106
%127 = phi double [ %125, %106 ], [ 0.000000e+00, %3 ], [ 1.000000e+00, %7 ]
ret double %127
}