#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
double betacf(double a, double b, double x) {
  double qap, qam, qab, em, tem, d;
  double bz, bm = 1.0, bp, bpp;
  double az = 1.0, am = 1.0, ap, app, aold;
  int m;
  qab = a + b;
  qap = a + 1.0;
  qam = a - 1.0;
  bz = 1.0 - qab * x / qap;
  for (m = 1; m <= 1000000; m++) {
    em = (double)m;
    tem = em + em;
    d = em * (b - em) * x / ((qam + tem) * (a + tem));
    ap = az + d * am;
    bp = bz + d * bm;
    d = -(a + em) * (qab + em) * x / ((qap + tem) * (a + tem));
    app = ap + d * az;
    bpp = bp + d * bz;
    aold = az;
    am = ap / bpp;
    bm = bp / bpp;
    az = app / bpp;
    bz = 1.0;
    if (fabs(az - aold) < (3.0e-7 * fabs(az)))
      return az;
  }
  fprintf(stderr, "WARNING: a or b too big, or ITMAX too small in BETACF\n");
}


x86 assembly (clang, -O0):
<betacf>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe98(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xe61(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x9c(%rbp)
cmpl   $0xf4240,-0x9c(%rbp)
jg     1398 <betacf+0x288>
cvtsi2sdl -0x9c(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
addsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
addsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xcd3(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x78(%rbp),%xmm1
subsd  -0x98(%rbp),%xmm1
ff
movaps 0xcca(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm2
movaps 0xcba(%rip),%xmm0
pand   %xmm0,%xmm2
movsd  0xca6(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    137f <betacf+0x26f>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13ad <betacf+0x29d>
jmp    1384 <betacf+0x274>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    11b2 <betacf+0xa2>
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
lea    0xc78(%rip),%rsi
call   1030 <fprintf@plt>
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<betacf>:
sub    $0x18,%rsp
movapd %xmm0,%xmm13
addsd  %xmm1,%xmm13
movsd  0xed9(%rip),%xmm10
movapd %xmm0,%xmm8
addsd  %xmm10,%xmm8
movsd  0xece(%rip),%xmm12
addsd  %xmm0,%xmm12
movapd %xmm13,%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm8,%xmm3
subsd  %xmm3,%xmm10
shufpd $0x2,0xec4(%rip),%xmm10
movapd 0xecb(%rip),%xmm15
mov    $0x1,%eax
movapd 0xedd(%rip),%xmm11
movsd  0xe94(%rip),%xmm9
nopl   0x0(%rax)
xorps  %xmm5,%xmm5
cvtsi2sd %eax,%xmm5
movapd %xmm5,%xmm4
addsd  %xmm5,%xmm4
movapd %xmm1,%xmm7
subsd  %xmm5,%xmm7
mulsd  %xmm5,%xmm7
mulsd  %xmm2,%xmm7
movapd %xmm12,%xmm3
addsd  %xmm4,%xmm3
movapd %xmm8,%xmm14
addsd  %xmm4,%xmm14
addsd  %xmm0,%xmm4
mulsd  %xmm4,%xmm3
divsd  %xmm3,%xmm7
unpcklpd %xmm7,%xmm7
mulpd  %xmm15,%xmm7
addpd  %xmm10,%xmm7
movapd %xmm13,%xmm3
addsd  %xmm5,%xmm3
addsd  %xmm0,%xmm5
xorpd  0xe5f(%rip),%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm14,%xmm4
divsd  %xmm4,%xmm5
unpcklpd %xmm5,%xmm5
mulpd  %xmm10,%xmm5
addpd  %xmm7,%xmm5
movapd %xmm5,%xmm3
unpckhpd %xmm5,%xmm3
divsd  %xmm5,%xmm3
unpckhpd %xmm10,%xmm10
movapd %xmm3,%xmm6
subsd  %xmm10,%xmm6
andpd  %xmm11,%xmm6
movapd %xmm3,%xmm4
andpd  %xmm11,%xmm4
mulsd  %xmm9,%xmm4
ucomisd %xmm6,%xmm4
ja     127a <betacf+0x16a>
unpcklpd %xmm5,%xmm5
divpd  %xmm5,%xmm7
add    $0x1,%eax
movapd 0xe1a(%rip),%xmm10
unpcklpd %xmm3,%xmm10
movapd %xmm7,%xmm15
cmp    $0xf4241,%eax
jne    1180 <betacf+0x70>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
movapd %xmm3,(%rsp)
call   1030 <fprintf@plt>
movapd (%rsp),%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [55 x i8] c"WARNING: a or b too big, or ITMAX 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 double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double 1.000000e+00, double* %15
store double 1.000000e+00, double* %18
store double 1.000000e+00, double* %19
%24 = load double, double* %5
%25 = load double, double* %6
%26 = fadd double %24, %25
store double %26, double* %10
%27 = load double, double* %5
%28 = fadd double %27, 1.000000e+00
store double %28, double* %8
%29 = load double, double* %5
%30 = fsub double %29, 1.000000e+00
store double %30, double* %9
%31 = load double, double* %10
%32 = load double, double* %7
%33 = fmul double %31, %32
%34 = load double, double* %8
%35 = fdiv double %33, %34
%36 = fsub double 1.000000e+00, %35
store double %36, double* %14
store i32 1, i32* %23
br label %37
37: ; preds = %116, %3
%38 = load i32, i32* %23
%39 = icmp sle i32 %38, 1000000
br i1 %39, label %40, label %119
40: ; preds = %37
%41 = load i32, i32* %23
%42 = sitofp i32 %41 to double
store double %42, double* %11
%43 = load double, double* %11
%44 = load double, double* %11
%45 = fadd double %43, %44
store double %45, double* %12
%46 = load double, double* %11
%47 = load double, double* %6
%48 = load double, double* %11
%49 = fsub double %47, %48
%50 = fmul double %46, %49
%51 = load double, double* %7
%52 = fmul double %50, %51
%53 = load double, double* %9
%54 = load double, double* %12
%55 = fadd double %53, %54
%56 = load double, double* %5
%57 = load double, double* %12
%58 = fadd double %56, %57
%59 = fmul double %55, %58
%60 = fdiv double %52, %59
store double %60, double* %13
%61 = load double, double* %18
%62 = load double, double* %13
%63 = load double, double* %19
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double %61)
store double %64, double* %20
%65 = load double, double* %14
%66 = load double, double* %13
%67 = load double, double* %15
%68 = call double @llvm.fmuladd.f64(double %66, double %67, double %65)
store double %68, double* %16
%69 = load double, double* %5
%70 = load double, double* %11
%71 = fadd double %69, %70
%72 = fneg double %71
%73 = load double, double* %10
%74 = load double, double* %11
%75 = fadd double %73, %74
%76 = fmul double %72, %75
%77 = load double, double* %7
%78 = fmul double %76, %77
%79 = load double, double* %8
%80 = load double, double* %12
%81 = fadd double %79, %80
%82 = load double, double* %5
%83 = load double, double* %12
%84 = fadd double %82, %83
%85 = fmul double %81, %84
%86 = fdiv double %78, %85
store double %86, double* %13
%87 = load double, double* %20
%88 = load double, double* %13
%89 = load double, double* %18
%90 = call double @llvm.fmuladd.f64(double %88, double %89, double %87)
store double %90, double* %21
%91 = load double, double* %16
%92 = load double, double* %13
%93 = load double, double* %14
%94 = call double @llvm.fmuladd.f64(double %92, double %93, double %91)
store double %94, double* %17
%95 = load double, double* %18
store double %95, double* %22
%96 = load double, double* %20
%97 = load double, double* %17
%98 = fdiv double %96, %97
store double %98, double* %19
%99 = load double, double* %16
%100 = load double, double* %17
%101 = fdiv double %99, %100
store double %101, double* %15
%102 = load double, double* %21
%103 = load double, double* %17
%104 = fdiv double %102, %103
store double %104, double* %18
store double 1.000000e+00, double* %14
%105 = load double, double* %18
%106 = load double, double* %22
%107 = fsub double %105, %106
%108 = call double @llvm.fabs.f64(double %107)
%109 = load double, double* %18
%110 = call double @llvm.fabs.f64(double %109)
%111 = fmul double 3.000000e-07, %110
%112 = fcmp olt double %108, %111
br i1 %112, label %113, label %115
113: ; preds = %40
%114 = load double, double* %18
store double %114, double* %4
br label %122
115: ; preds = %40
br label %116
116: ; preds = %115
%117 = load i32, i32* %23
%118 = add nsw i32 %117, 1
store i32 %118, i32* %23
br label %37
119: ; preds = %37
%120 = load i32, i32* @stderr
%121 = call i32 @fprintf(i32 %120, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %122
122: ; preds = %119, %113
%123 = load double, double* %4
ret double %123
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [55 x i8] c"WARNING: a or b too big, or ITMAX 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 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %9, i64 0
br label %11
11: ; preds = %3, %47
%12 = phi i32 [ 1, %3 ], [ %50, %47 ]
%13 = phi <2 x double> [ <double 1.000000e+00, double 1.000000e+00>, %3 ], [ %49, %47 ]
%14 = phi <2 x double> [ %10, %3 ], [ %52, %47 ]
%15 = sitofp i32 %12 to double
%16 = fadd double %15, %15
%17 = fsub double %1, %15
%18 = fmul double %17, %15
%19 = fmul double %18, %2
%20 = fadd double %6, %16
%21 = fadd double %16, %0
%22 = fmul double %20, %21
%23 = fdiv double %19, %22
%24 = insertelement <2 x double> poison, double %23, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %13, <2 x double> %14)
%27 = fadd double %15, %0
%28 = fneg double %27
%29 = fadd double %4, %15
%30 = fmul double %29, %28
%31 = fmul double %30, %2
%32 = fadd double %5, %16
%33 = fmul double %32, %21
%34 = fdiv double %31, %33
%35 = insertelement <2 x double> poison, double %34, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %14, <2 x double> %26)
%38 = extractelement <2 x double> %37, i64 0
%39 = extractelement <2 x double> %37, i64 1
%40 = fdiv double %39, %38
%41 = extractelement <2 x double> %14, i64 1
%42 = fsub double %40, %41
%43 = tail call double @llvm.fabs.f64(double %42)
%44 = tail call double @llvm.fabs.f64(double %40)
%45 = fmul double %44, 3.000000e-07
%46 = fcmp olt double %43, %45
br i1 %46, label %56, label %47
47: ; preds = %11
%48 = shufflevector <2 x double> %37, <2 x double> undef, <2 x i32> zeroinitializer
%49 = fdiv <2 x double> %26, %48
%50 = add nuw nsw i32 %12, 1
%51 = icmp eq i32 %50, 1000001
%52 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %40, i64 1
br i1 %51, label %53, label %11
53: ; preds = %47
%54 = load i32, i32* @stderr
%55 = tail call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %11, %53
ret double %40
}