#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 fabs(double);
int /*<<< orphan*/ fatalx(char *);
double betacf(double a, double b, double x) {
  int m, m2;
  double aa, c, d, del, h, qab, qam, qap;
  qab = a + b;
  qap = a + 1.0;
  qam = a - 1.0;
  c = 1.0;
  d = 1.0 - qab * x / qap;
  if (fabs(d) < 1.0e-30)
    d = 1.0e-30;
  d = 1.0 / d;
  h = d;
  for (m = 1; m <= 100; m++) {
    m2 = 2 * m;
    aa = m * (b - m) * x / ((qam + m2) * (a + m2));
    d = 1.0 + aa * d;
    if (fabs(d) < 1.0e-30)
      d = 1.0e-30;
    c = 1.0 + aa / c;
    if (fabs(c) < 1.0e-30)
      c = 1.0e-30;
    d = 1.0 / d;
    h *= d * c;
    aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2));
    d = 1.0 + aa * d;
    if (fabs(d) < 1.0e-30)
      d = 1.0e-30;
    c = 1.0 + aa / c;
    if (fabs(c) < 1.0e-30)
      c = 1.0e-30;
    d = 1.0 / d;
    del = d * c;
    h *= del;
    if (fabs(del - 1.0) < 3.0e-7)
      break;
  }
  if (m > 100)
    fatalx("a or b too big, or MAXIT too small in betacf\n");
  return h;
}


x86 assembly (clang, -O0):
<betacf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xeca(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
movsd  0xe86(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xe89(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ba <betacf+0xaa>
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe46(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jg     1466 <betacf+0x356>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
cvtsi2sdl -0x20(%rbp),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm2
cvtsi2sdl -0x20(%rbp),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdbd(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xdc0(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd94(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1283 <betacf+0x173>
movsd  0xd82(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xd73(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xd76(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd4a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12cd <betacf+0x1bd>
movsd  0xd38(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd33(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x50(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x20(%rbp),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x60(%rbp),%xmm2
cvtsi2sdl -0x20(%rbp),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc9a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xc9d(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc71(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    13a6 <betacf+0x296>
movsd  0xc5f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xc50(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xc53(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc27(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    13f0 <betacf+0x2e0>
movsd  0xc15(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xc10(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  0xbdb(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xbe8(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xbcc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1453 <betacf+0x343>
jmp    1466 <betacf+0x356>
jmp    1458 <betacf+0x348>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11dd <betacf+0xcd>
cmpl   $0x64,-0x1c(%rbp)
jle    147c <betacf+0x36c>
lea    0xbb9(%rip),%rdi
call   1030 <fatalx@plt>
movsd  -0x48(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<betacf>:
sub    $0x28,%rsp
movapd %xmm0,%xmm3
movsd  %xmm1,0x20(%rsp)
addsd  %xmm1,%xmm3
movsd  0xed5(%rip),%xmm9
movapd %xmm0,%xmm1
addsd  %xmm9,%xmm1
movsd  %xmm3,0x18(%rsp)
mulsd  %xmm2,%xmm3
movsd  %xmm1,0x10(%rsp)
divsd  %xmm1,%xmm3
movapd %xmm9,%xmm1
subsd  %xmm3,%xmm1
movapd 0xed7(%rip),%xmm3
andpd  %xmm1,%xmm3
movsd  0xeab(%rip),%xmm6
movsd  0xeaa(%rip),%xmm14
ucomisd %xmm3,%xmm14
movapd %xmm6,%xmm5
ja     1182 <betacf+0x72>
movapd %xmm9,%xmm5
divsd  %xmm1,%xmm5
movsd  0xe7d(%rip),%xmm15
addsd  %xmm0,%xmm15
mov    $0x1,%eax
mov    $0x2,%ecx
movapd 0xe8d(%rip),%xmm12
movapd %xmm9,%xmm4
movsd  %xmm5,0x8(%rsp)
xchg   %ax,%ax
xorps  %xmm10,%xmm10
cvtsi2sd %eax,%xmm10
movsd  0x20(%rsp),%xmm1
subsd  %xmm10,%xmm1
mulsd  %xmm10,%xmm1
mulsd  %xmm2,%xmm1
xorps  %xmm11,%xmm11
cvtsi2sd %ecx,%xmm11
movapd %xmm15,%xmm3
addsd  %xmm11,%xmm3
movapd %xmm11,%xmm13
addsd  %xmm0,%xmm13
mulsd  %xmm13,%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm5
addsd  %xmm9,%xmm5
movapd %xmm5,%xmm3
andpd  %xmm12,%xmm3
ucomisd %xmm3,%xmm14
movapd %xmm6,%xmm8
ja     121b <betacf+0x10b>
movapd %xmm9,%xmm8
divsd  %xmm5,%xmm8
movsd  0x18(%rsp),%xmm3
addsd  %xmm10,%xmm3
addsd  %xmm0,%xmm10
xorpd  0xe0c(%rip),%xmm10
mulsd  %xmm3,%xmm10
mulsd  %xmm2,%xmm10
addsd  0x10(%rsp),%xmm11
mulsd  %xmm11,%xmm13
divsd  %xmm13,%xmm10
movapd %xmm10,%xmm3
mulsd  %xmm8,%xmm3
addsd  %xmm9,%xmm3
movapd %xmm3,%xmm5
andpd  %xmm12,%xmm5
ucomisd %xmm5,%xmm14
movapd %xmm6,%xmm7
movapd %xmm6,%xmm5
ja     127f <betacf+0x16f>
movapd %xmm9,%xmm5
divsd  %xmm3,%xmm5
divsd  %xmm4,%xmm1
addsd  %xmm9,%xmm1
movapd %xmm1,%xmm3
andpd  %xmm12,%xmm3
cmpltsd %xmm14,%xmm3
movapd %xmm3,%xmm4
andnpd %xmm1,%xmm4
andpd  %xmm14,%xmm3
orpd   %xmm4,%xmm3
mulsd  %xmm3,%xmm8
movsd  0x8(%rsp),%xmm6
mulsd  %xmm8,%xmm6
divsd  %xmm3,%xmm10
addsd  %xmm9,%xmm10
movapd %xmm10,%xmm4
andpd  %xmm12,%xmm4
cmpltsd %xmm14,%xmm4
movapd %xmm4,%xmm1
andnpd %xmm10,%xmm1
andpd  %xmm14,%xmm4
orpd   %xmm1,%xmm4
movapd %xmm5,%xmm1
mulsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm6
addsd  0xd10(%rip),%xmm1
andpd  0xd30(%rip),%xmm1
movsd  0xd18(%rip),%xmm3
ucomisd %xmm1,%xmm3
ja     133c <betacf+0x22c>
movsd  %xmm6,0x8(%rsp)
add    $0x1,%eax
add    $0x2,%ecx
cmp    $0xca,%ecx
movapd %xmm7,%xmm6
jne    11b0 <betacf+0xa0>
lea    0xd1f(%rip),%rdi
call   1030 <fatalx@plt>
movsd  0x8(%rsp),%xmm6
movapd %xmm6,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"a or b too big, or MAXIT too small in betacf\0A\00"
define double @betacf(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%17 = load double, double* %4
%18 = load double, double* %5
%19 = fadd double %17, %18
store double %19, double* %14
%20 = load double, double* %4
%21 = fadd double %20, 1.000000e+00
store double %21, double* %16
%22 = load double, double* %4
%23 = fsub double %22, 1.000000e+00
store double %23, double* %15
store double 1.000000e+00, double* %10
%24 = load double, double* %14
%25 = load double, double* %6
%26 = fmul double %24, %25
%27 = load double, double* %16
%28 = fdiv double %26, %27
%29 = fsub double 1.000000e+00, %28
store double %29, double* %11
%30 = load double, double* %11
%31 = call double @llvm.fabs.f64(double %30)
%32 = fcmp olt double %31, 1.000000e-30
br i1 %32, label %33, label %34
33: ; preds = %3
store double 1.000000e-30, double* %11
br label %34
34: ; preds = %33, %3
%35 = load double, double* %11
%36 = fdiv double 1.000000e+00, %35
store double %36, double* %11
%37 = load double, double* %11
store double %37, double* %13
store i32 1, i32* %7
br label %38
38: ; preds = %140, %34
%39 = load i32, i32* %7
%40 = icmp sle i32 %39, 100
br i1 %40, label %41, label %143
41: ; preds = %38
%42 = load i32, i32* %7
%43 = mul nsw i32 2, %42
store i32 %43, i32* %8
%44 = load i32, i32* %7
%45 = sitofp i32 %44 to double
%46 = load double, double* %5
%47 = load i32, i32* %7
%48 = sitofp i32 %47 to double
%49 = fsub double %46, %48
%50 = fmul double %45, %49
%51 = load double, double* %6
%52 = fmul double %50, %51
%53 = load double, double* %15
%54 = load i32, i32* %8
%55 = sitofp i32 %54 to double
%56 = fadd double %53, %55
%57 = load double, double* %4
%58 = load i32, i32* %8
%59 = sitofp i32 %58 to double
%60 = fadd double %57, %59
%61 = fmul double %56, %60
%62 = fdiv double %52, %61
store double %62, double* %9
%63 = load double, double* %9
%64 = load double, double* %11
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double 1.000000e+00)
store double %65, double* %11
%66 = load double, double* %11
%67 = call double @llvm.fabs.f64(double %66)
%68 = fcmp olt double %67, 1.000000e-30
br i1 %68, label %69, label %70
69: ; preds = %41
store double 1.000000e-30, double* %11
br label %70
70: ; preds = %69, %41
%71 = load double, double* %9
%72 = load double, double* %10
%73 = fdiv double %71, %72
%74 = fadd double 1.000000e+00, %73
store double %74, double* %10
%75 = load double, double* %10
%76 = call double @llvm.fabs.f64(double %75)
%77 = fcmp olt double %76, 1.000000e-30
br i1 %77, label %78, label %79
78: ; preds = %70
store double 1.000000e-30, double* %10
br label %79
79: ; preds = %78, %70
%80 = load double, double* %11
%81 = fdiv double 1.000000e+00, %80
store double %81, double* %11
%82 = load double, double* %11
%83 = load double, double* %10
%84 = fmul double %82, %83
%85 = load double, double* %13
%86 = fmul double %85, %84
store double %86, double* %13
%87 = load double, double* %4
%88 = load i32, i32* %7
%89 = sitofp i32 %88 to double
%90 = fadd double %87, %89
%91 = fneg double %90
%92 = load double, double* %14
%93 = load i32, i32* %7
%94 = sitofp i32 %93 to double
%95 = fadd double %92, %94
%96 = fmul double %91, %95
%97 = load double, double* %6
%98 = fmul double %96, %97
%99 = load double, double* %4
%100 = load i32, i32* %8
%101 = sitofp i32 %100 to double
%102 = fadd double %99, %101
%103 = load double, double* %16
%104 = load i32, i32* %8
%105 = sitofp i32 %104 to double
%106 = fadd double %103, %105
%107 = fmul double %102, %106
%108 = fdiv double %98, %107
store double %108, double* %9
%109 = load double, double* %9
%110 = load double, double* %11
%111 = call double @llvm.fmuladd.f64(double %109, double %110, double 1.000000e+00)
store double %111, double* %11
%112 = load double, double* %11
%113 = call double @llvm.fabs.f64(double %112)
%114 = fcmp olt double %113, 1.000000e-30
br i1 %114, label %115, label %116
115: ; preds = %79
store double 1.000000e-30, double* %11
br label %116
116: ; preds = %115, %79
%117 = load double, double* %9
%118 = load double, double* %10
%119 = fdiv double %117, %118
%120 = fadd double 1.000000e+00, %119
store double %120, double* %10
%121 = load double, double* %10
%122 = call double @llvm.fabs.f64(double %121)
%123 = fcmp olt double %122, 1.000000e-30
br i1 %123, label %124, label %125
124: ; preds = %116
store double 1.000000e-30, double* %10
br label %125
125: ; preds = %124, %116
%126 = load double, double* %11
%127 = fdiv double 1.000000e+00, %126
store double %127, double* %11
%128 = load double, double* %11
%129 = load double, double* %10
%130 = fmul double %128, %129
store double %130, double* %12
%131 = load double, double* %12
%132 = load double, double* %13
%133 = fmul double %132, %131
store double %133, double* %13
%134 = load double, double* %12
%135 = fsub double %134, 1.000000e+00
%136 = call double @llvm.fabs.f64(double %135)
%137 = fcmp olt double %136, 3.000000e-07
br i1 %137, label %138, label %139
138: ; preds = %125
br label %143
139: ; preds = %125
br label %140
140: ; preds = %139
%141 = load i32, i32* %7
%142 = add nsw i32 %141, 1
store i32 %142, i32* %7
br label %38
143: ; preds = %138, %38
%144 = load i32, i32* %7
%145 = icmp sgt i32 %144, 100
br i1 %145, label %146, label %148
146: ; preds = %143
%147 = call i32 @fatalx(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %148
148: ; preds = %146, %143
%149 = load double, double* %13
ret double %149
}

LLVM IR (-O2):
@.str = [46 x i8] c"a or b too big, or MAXIT too small in betacf\0A\00"
define double @betacf(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fadd double %0, 1.000000e+00
%6 = fadd double %0, -1.000000e+00
%7 = fmul double %4, %2
%8 = fdiv double %7, %5
%9 = fsub double 1.000000e+00, %8
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fcmp olt double %10, 1.000000e-30
%12 = fdiv double 1.000000e+00, %9
%13 = select i1 %11, double 0x46293E5939A08CE9, double %12
br label %17
14: ; preds = %17
%15 = add nuw nsw i32 %18, 1
%16 = icmp eq i32 %15, 101
br i1 %16, label %67, label %17
17: ; preds = %3, %14
%18 = phi i32 [ 1, %3 ], [ %15, %14 ]
%19 = phi double [ 1.000000e+00, %3 ], [ %59, %14 ]
%20 = phi double [ %13, %3 ], [ %63, %14 ]
%21 = phi double [ %13, %3 ], [ %61, %14 ]
%22 = shl nuw nsw i32 %18, 1
%23 = sitofp i32 %18 to double
%24 = fsub double %1, %23
%25 = fmul double %24, %23
%26 = fmul double %25, %2
%27 = sitofp i32 %22 to double
%28 = fadd double %6, %27
%29 = fadd double %27, %0
%30 = fmul double %28, %29
%31 = fdiv double %26, %30
%32 = tail call double @llvm.fmuladd.f64(double %31, double %21, double 1.000000e+00)
%33 = tail call double @llvm.fabs.f64(double %32)
%34 = fcmp olt double %33, 1.000000e-30
%35 = fdiv double %31, %19
%36 = fadd double %35, 1.000000e+00
%37 = tail call double @llvm.fabs.f64(double %36)
%38 = fcmp olt double %37, 1.000000e-30
%39 = select i1 %38, double 1.000000e-30, double %36
%40 = fdiv double 1.000000e+00, %32
%41 = select i1 %34, double 0x46293E5939A08CE9, double %40
%42 = fmul double %41, %39
%43 = fmul double %20, %42
%44 = fadd double %23, %0
%45 = fneg double %44
%46 = fadd double %4, %23
%47 = fmul double %46, %45
%48 = fmul double %47, %2
%49 = fadd double %5, %27
%50 = fmul double %29, %49
%51 = fdiv double %48, %50
%52 = tail call double @llvm.fmuladd.f64(double %51, double %41, double 1.000000e+00)
%53 = tail call double @llvm.fabs.f64(double %52)
%54 = fcmp olt double %53, 1.000000e-30
%55 = fdiv double %51, %39
%56 = fadd double %55, 1.000000e+00
%57 = tail call double @llvm.fabs.f64(double %56)
%58 = fcmp olt double %57, 1.000000e-30
%59 = select i1 %58, double 1.000000e-30, double %56
%60 = fdiv double 1.000000e+00, %52
%61 = select i1 %54, double 0x46293E5939A08CE9, double %60
%62 = fmul double %61, %59
%63 = fmul double %43, %62
%64 = fadd double %62, -1.000000e+00
%65 = tail call double @llvm.fabs.f64(double %64)
%66 = fcmp olt double %65, 3.000000e-07
br i1 %66, label %69, label %14
67: ; preds = %14
%68 = tail call i32 @fatalx(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %69
69: ; preds = %17, %67
ret double %63
}