#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*/ error2(int, char *);
int /*<<< orphan*/ exit(int);
double fabs(double);
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 <= 1000; 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 > 1000) {
    error2(93, "a or b too big, or MAXIT too small in betacf\n\n");
    exit(3);
  }
  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  0xeba(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe92(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
movsd  0xe76(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xe79(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe4d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ca <betacf+0xaa>
movsd  0xe3b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe36(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jg     1479 <betacf+0x359>
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  0xdaa(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xdad(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd81(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1296 <betacf+0x176>
movsd  0xd6f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xd60(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xd63(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd37(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e0 <betacf+0x1c0>
movsd  0xd25(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd20(%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  0xc87(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xc8a(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc5e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    13b9 <betacf+0x299>
movsd  0xc4c(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xc3d(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xc40(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc14(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1403 <betacf+0x2e3>
movsd  0xc02(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xbfd(%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  0xbc8(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xbd5(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xbb9(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1466 <betacf+0x346>
jmp    1479 <betacf+0x359>
jmp    146b <betacf+0x34b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ed <betacf+0xcd>
cmpl   $0x3e8,-0x1c(%rbp)
jle    14a1 <betacf+0x381>
mov    $0x5d,%edi
lea    0xb9e(%rip),%rsi
call   1030 <error2@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
movsd  -0x48(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<betacf>:
sub    $0x18,%rsp
movapd %xmm0,%xmm3
movsd  %xmm1,0x10(%rsp)
addsd  %xmm1,%xmm3
movsd  0xec5(%rip),%xmm10
movapd %xmm0,%xmm1
addsd  %xmm10,%xmm1
movsd  %xmm3,0x8(%rsp)
mulsd  %xmm2,%xmm3
movsd  %xmm1,(%rsp)
divsd  %xmm1,%xmm3
movapd %xmm10,%xmm1
subsd  %xmm3,%xmm1
movapd 0xec8(%rip),%xmm3
andpd  %xmm1,%xmm3
movsd  0xe9c(%rip),%xmm4
movsd  0xe9c(%rip),%xmm7
ucomisd %xmm3,%xmm7
movapd %xmm4,%xmm3
ja     118f <betacf+0x6f>
movapd %xmm10,%xmm3
divsd  %xmm1,%xmm3
movsd  0xe70(%rip),%xmm15
addsd  %xmm0,%xmm15
mov    $0x1,%eax
mov    $0x2,%ecx
movapd 0xe80(%rip),%xmm9
movapd %xmm10,%xmm5
movapd %xmm3,%xmm8
nopw   0x0(%rax,%rax,1)
xorps  %xmm12,%xmm12
cvtsi2sd %eax,%xmm12
movsd  0x10(%rsp),%xmm1
subsd  %xmm12,%xmm1
mulsd  %xmm12,%xmm1
mulsd  %xmm2,%xmm1
xorps  %xmm14,%xmm14
cvtsi2sd %ecx,%xmm14
movapd %xmm15,%xmm6
addsd  %xmm14,%xmm6
movapd %xmm14,%xmm13
addsd  %xmm0,%xmm13
mulsd  %xmm13,%xmm6
divsd  %xmm6,%xmm1
mulsd  %xmm1,%xmm8
addsd  %xmm10,%xmm8
movapd %xmm8,%xmm6
andpd  %xmm9,%xmm6
ucomisd %xmm6,%xmm7
movsd  0xdec(%rip),%xmm11
ja     1230 <betacf+0x110>
movapd %xmm10,%xmm11
divsd  %xmm8,%xmm11
movsd  0x8(%rsp),%xmm6
addsd  %xmm12,%xmm6
addsd  %xmm0,%xmm12
xorpd  0xdf7(%rip),%xmm12
mulsd  %xmm6,%xmm12
mulsd  %xmm2,%xmm12
addsd  (%rsp),%xmm14
mulsd  %xmm14,%xmm13
divsd  %xmm13,%xmm12
movapd %xmm12,%xmm4
mulsd  %xmm11,%xmm4
addsd  %xmm10,%xmm4
movapd %xmm4,%xmm6
andpd  %xmm9,%xmm6
ucomisd %xmm6,%xmm7
movsd  0xd88(%rip),%xmm8
ja     1294 <betacf+0x174>
movapd %xmm10,%xmm8
divsd  %xmm4,%xmm8
divsd  %xmm5,%xmm1
addsd  %xmm10,%xmm1
movapd %xmm1,%xmm4
andpd  %xmm9,%xmm4
cmpltsd %xmm7,%xmm4
movapd %xmm4,%xmm5
andnpd %xmm1,%xmm5
andpd  %xmm7,%xmm4
orpd   %xmm5,%xmm4
mulsd  %xmm4,%xmm11
mulsd  %xmm11,%xmm3
divsd  %xmm4,%xmm12
addsd  %xmm10,%xmm12
movapd %xmm12,%xmm5
andpd  %xmm9,%xmm5
cmpltsd %xmm7,%xmm5
movapd %xmm5,%xmm1
andnpd %xmm12,%xmm1
andpd  %xmm7,%xmm5
orpd   %xmm1,%xmm5
movapd %xmm8,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm1,%xmm3
addsd  0xd04(%rip),%xmm1
andpd  0xd24(%rip),%xmm1
movsd  0xd0c(%rip),%xmm4
ucomisd %xmm1,%xmm4
ja     1347 <betacf+0x227>
add    $0x1,%eax
add    $0x2,%ecx
cmp    $0x7d2,%ecx
jne    11c0 <betacf+0xa0>
lea    0xd1d(%rip),%rsi
mov    $0x5d,%edi
call   1030 <error2@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"a or b too big, or MAXIT too small in betacf\0A\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, 1000
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, 1000
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = call i32 @error2(i32 93, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%148 = call i32 @exit(i32 3)
unreachable
149: ; preds = %143
%150 = load double, double* %13
ret double %150
}

LLVM IR (-O2):
@.str = [47 x i8] c"a or b too big, or MAXIT too small in betacf\0A\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, 1001
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 %70, label %14
67: ; preds = %14
%68 = tail call i32 @error2(i32 93, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%69 = tail call i32 @exit(i32 3)
unreachable
70: ; preds = %17
ret double %63
}