#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*/ cdflib_beta_inc(double const *, double const *,
                                   double const *, double const *, double *,
                                   double *, int *);
void cdflib_cumbet(const double *x, const double *y, const double *a,
                   const double *b, double *cum, double *ccum) {
  int ierr;
  if (*x <= 0.0) {
    *cum = 0.0;
    *ccum = 1.0;
  } else if (*y <= 0.0) {
    *cum = 1.0;
    *ccum = 0.0;
  } else {
    cdflib_beta_inc(a, b, x, y, cum, ccum, &ierr);
  }
  return;
}


x86 assembly (clang, -O0):
<cdflib_cumbet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jb     1161 <cdflib_cumbet+0x51>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    11bc <cdflib_cumbet+0xac>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jb     1192 <cdflib_cumbet+0x82>
mov    -0x28(%rbp),%rax
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11b7 <cdflib_cumbet+0xa7>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    -0x34(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <cdflib_beta_inc@plt>
jmp    11bc <cdflib_cumbet+0xac>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_cumbet>:
sub    $0x18,%rsp
xorpd  %xmm0,%xmm0
ucomisd (%rdi),%xmm0
jae    1149 <cdflib_cumbet+0x39>
mov    %rsi,%r10
ucomisd (%rsi),%xmm0
jae    1162 <cdflib_cumbet+0x52>
mov    %rdi,%rax
lea    0x14(%rsp),%rsi
mov    %rsi,(%rsp)
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %rax,%rdx
mov    %r10,%rcx
call   1030 <cdflib_beta_inc@plt>
add    $0x18,%rsp
ret
movq   $0x0,(%r8)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r9)
add    $0x18,%rsp
ret
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r8)
movq   $0x0,(%r9)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @cdflib_cumbet(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%14 = load double*, double** %7
%15 = load double, double* %14
%16 = fcmp ole double %15, 0.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %6
%18 = load double*, double** %11
store double 0.000000e+00, double* %18
%19 = load double*, double** %12
store double 1.000000e+00, double* %19
br label %36
20: ; preds = %6
%21 = load double*, double** %8
%22 = load double, double* %21
%23 = fcmp ole double %22, 0.000000e+00
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load double*, double** %11
store double 1.000000e+00, double* %25
%26 = load double*, double** %12
store double 0.000000e+00, double* %26
br label %35
27: ; preds = %20
%28 = load double*, double** %9
%29 = load double*, double** %10
%30 = load double*, double** %7
%31 = load double*, double** %8
%32 = load double*, double** %11
%33 = load double*, double** %12
%34 = call i32 @cdflib_beta_inc(double* %28, double* %29, double* %30, double* %31, double* %32, double* %33, i32* %13)
br label %35
35: ; preds = %27, %24
br label %36
36: ; preds = %35, %17
ret void
}

LLVM IR (-O2):
define void @cdflib_cumbet(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = load double, double* %0
%10 = fcmp ugt double %9, 0.000000e+00
br i1 %10, label %12, label %11
11: ; preds = %6
store double 0.000000e+00, double* %4
store double 1.000000e+00, double* %5
br label %18
12: ; preds = %6
%13 = load double, double* %1
%14 = fcmp ugt double %13, 0.000000e+00
br i1 %14, label %16, label %15
15: ; preds = %12
store double 1.000000e+00, double* %4
store double 0.000000e+00, double* %5
br label %18
16: ; preds = %12
%17 = call i32 @cdflib_beta_inc(double* %2, double* %3, double* %0, double* %1, double* %4, double* %5, i32* %7)
br label %18
18: ; preds = %15, %16, %11
ret void
}