#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 */
typedef int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
double rand_normal(int /*<<< orphan*/ *, int /*<<< orphan*/ *, double *);
void fill_vector_normal(int32_t *state, int8_t *empty, double *gset,
                        double *array, int num) {
  int i;
  for (i = 0; i < num; ++i) {
    array[i] = rand_normal(state, empty, gset);
  }
}


x86 assembly (clang, -O0):
<fill_vector_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    116b <fill_vector_normal+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <rand_normal@plt>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1133 <fill_vector_normal+0x23>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_vector_normal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %r8d,%r8d
jle    115d <fill_vector_normal+0x4d>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
mov    %r8d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <rand_normal@plt>
movsd  %xmm0,(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1140 <fill_vector_normal+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fill_vector_normal(i32* %0, i32* %1, double* %2, double* nocapture writeonly %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %15
7: ; preds = %5
%8 = zext i32 %4 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %13, %9 ]
%11 = tail call double @rand_normal(i32* %0, i32* %1, double* %2)
%12 = getelementptr inbounds double, double* %3, i64 %10
store double %11, double* %12
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, %8
br i1 %14, label %15, label %9
15: ; preds = %9, %5
ret void
}