#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*/ cumnbn(double *, double *, double *, double *, double *,
                          double *);
void nbino_cdfc(int n, double a, double prob, double *x, double *array) {
  int i;
  double p, q;
  double ompr;
  ompr = 1.0 - prob;
  for (i = 0; i < n; i++) {
    cumnbn(&x[i], &a, &prob, &ompr, &p, &q);
    *(array + i) = p;
  }
}


x86 assembly (clang, -O0):
<nbino_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)
movsd  0xecb(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119a <nbino_cdfc+0x8a>
mov    -0x20(%rbp),%rdi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x48(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x40(%rbp),%r9
call   1030 <cumnbn@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    1146 <nbino_cdfc+0x36>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbino_cdfc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  0xece(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
test   %edi,%edi
jle    1191 <nbino_cdfc+0x81>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r12d
shl    $0x3,%r12
xor    %r13d,%r13d
lea    0x8(%rsp),%rbp
lea    0x20(%rsp),%r15
nopl   0x0(%rax)
lea    (%rbx,%r13,1),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbp,%r8
mov    %r15,%r9
call   1030 <cumnbn@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%r13,1)
add    $0x8,%r13
cmp    %r13,%r12
jne    1160 <nbino_cdfc+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @nbino_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 double, double* %8
%16 = fsub double 1.000000e+00, %15
store double %16, double* %14
store i32 0, i32* %11
br label %17
17: ; preds = %32, %5
%18 = load i32, i32* %11
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %35
21: ; preds = %17
%22 = load double*, double** %9
%23 = load i32, i32* %11
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = call i32 @cumnbn(double* %25, double* %7, double* %8, double* %14, double* %12, double* %13)
%27 = load double, double* %12
%28 = load double*, double** %10
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
store double %27, double* %31
br label %32
32: ; preds = %21
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %17
35: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @nbino_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
%10 = alloca double
store double %1, double* %6
store double %2, double* %7
%11 = bitcast double* %8 to i8*
%12 = bitcast double* %9 to i8*
%13 = bitcast double* %10 to i8*
%14 = fsub double 1.000000e+00, %2
store double %14, double* %10
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %26
16: ; preds = %5
%17 = zext i32 %0 to i64
br label %18
18: ; preds = %16, %18
%19 = phi i64 [ 0, %16 ], [ %24, %18 ]
%20 = getelementptr inbounds double, double* %3, i64 %19
%21 = call i32 @cumnbn(double* %20, double* %6, double* %7, double* %10, double* %8, double* %9)
%22 = load double, double* %8
%23 = getelementptr inbounds double, double* %4, i64 %19
store double %22, double* %23
%24 = add nuw nsw i64 %19, 1
%25 = icmp eq i64 %24, %17
br i1 %25, label %26, label %18
26: ; preds = %18, %5
ret void
}