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


x86 assembly (clang, -O0):
<chis_cdfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117b <chis_cdfc+0x6b>
mov    -0x18(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
lea    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   1030 <cumchi@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <chis_cdfc+0x1f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chis_cdfc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
test   %edi,%edi
jle    1168 <chis_cdfc+0x58>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
shl    $0x3,%rbp
xor    %r15d,%r15d
mov    %rsp,%r12
lea    0x10(%rsp),%r13
nop
lea    (%rbx,%r15,1),%rdi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1030 <cumchi@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14,%r15,1)
add    $0x8,%r15
cmp    %r15,%rbp
jne    1140 <chis_cdfc+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @chis_cdfc(i32 %0, double %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
store i32 0, i32* %9
br label %12
12: ; preds = %27, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load double*, double** %7
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = call i32 @cumchi(double* %20, double* %6, double* %10, double* %11)
%22 = load double, double* %10
%23 = load double*, double** %8
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
br label %27
27: ; preds = %16
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %9
br label %12
30: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @chis_cdfc(i32 %0, double %1, double* %2, double* nocapture writeonly %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %1, double* %5
%8 = bitcast double* %6 to i8*
%9 = bitcast double* %7 to i8*
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %21
11: ; preds = %4
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %19, %13 ]
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = call i32 @cumchi(double* %15, double* %5, double* %6, double* %7)
%17 = load double, double* %6
%18 = getelementptr inbounds double, double* %3, i64 %14
store double %17, double* %18
%19 = add nuw nsw i64 %14, 1
%20 = icmp eq i64 %19, %12
br i1 %20, label %21, label %13
21: ; preds = %13, %4
ret void
}