#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*/ cumbet(double *, double *, double *, double *, double *,
                          double *);
double *dvector(int /*<<< orphan*/, int);
int /*<<< orphan*/ free_dvector(double *, int /*<<< orphan*/);
void beta_cdfc(int n, double a, double b, double *x, double *array) {
  int i;
  double p, q;
  double *y;
  y = dvector(0, n - 1);
  for (i = 0; i < n; i++) {
    y[i] = 1.0 - x[i];
    cumbet(&x[i], &y[i], &a, &b, &p, &q);
    *(array + i) = p;
  }
  free_dvector(y, 0);
}


x86 assembly (clang, -O0):
<beta_cdfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
xor    %edi,%edi
call   1030 <dvector@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e6 <beta_cdfc+0xb6>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xe7f(%rip),%xmm0
subsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rdi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x40(%rbp),%r9
call   1040 <cumbet@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1165 <beta_cdfc+0x35>
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
call   1050 <free_dvector@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta_cdfc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
lea    -0x1(%rbp),%esi
xor    %edi,%edi
call   1030 <dvector@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    11c7 <beta_cdfc+0x97>
mov    %ebp,%r13d
shl    $0x3,%r13
xor    %ebp,%ebp
lea    0x20(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbp,1),%rdi
movsd  0xe74(%rip),%xmm0
subsd  (%r15,%rbp,1),%xmm0
lea    (%rbx,%rbp,1),%rsi
movsd  %xmm0,(%rbx,%rbp,1)
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %r12,%r9
call   1040 <cumbet@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbp,1)
add    $0x8,%rbp
cmp    %rbp,%r13
jne    1180 <beta_cdfc+0x50>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <free_dvector@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @beta_cdfc(i32 %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double*
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store double* %4, double** %10
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = call double* @dvector(i32 0, i32 %16)
store double* %17, double** %14
store i32 0, i32* %11
br label %18
18: ; preds = %47, %5
%19 = load i32, i32* %11
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %50
22: ; preds = %18
%23 = load double*, double** %9
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = fsub double 1.000000e+00, %27
%29 = load double*, double** %14
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double %28, double* %32
%33 = load double*, double** %9
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double*, double** %14
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = call i32 @cumbet(double* %36, double* %40, double* %7, double* %8, double* %12, double* %13)
%42 = load double, double* %12
%43 = load double*, double** %10
%44 = load i32, i32* %11
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
br label %47
47: ; preds = %22
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %18
50: ; preds = %18
%51 = load double*, double** %14
%52 = call i32 @free_dvector(double* %51, i32 0)
ret void
}

LLVM IR (-O2):
define void @beta_cdfc(i32 %0, double %1, double %2, double* %3, double* nocapture writeonly %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %1, double* %6
store double %2, double* %7
%10 = bitcast double* %8 to i8*
%11 = bitcast double* %9 to i8*
%12 = add nsw i32 %0, -1
%13 = tail call double* @dvector(i32 0, i32 %12)
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %28
15: ; preds = %5
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %26, %17 ]
%19 = getelementptr inbounds double, double* %3, i64 %18
%20 = load double, double* %19
%21 = fsub double 1.000000e+00, %20
%22 = getelementptr inbounds double, double* %13, i64 %18
store double %21, double* %22
%23 = call i32 @cumbet(double* %19, double* %22, double* %6, double* %7, double* %8, double* %9)
%24 = load double, double* %8
%25 = getelementptr inbounds double, double* %4, i64 %18
store double %24, double* %25
%26 = add nuw nsw i64 %18, 1
%27 = icmp eq i64 %26, %16
br i1 %27, label %28, label %17
28: ; preds = %17, %5
%29 = call i32 @free_dvector(double* %13, i32 0)
ret void
}