#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 */
double frand(unsigned int *, double, double);
void frandvec(unsigned *seed, int n, double *p, double a, double b) {
  int i;
  for (i = 0; i < n; i++) {
    p[i] = frand(seed, a, b);
  }
}


x86 assembly (clang, -O0):
<frandvec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116e <frandvec+0x5e>
mov    -0x8(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <frand@plt>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1134 <frandvec+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frandvec>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    1163 <frandvec+0x53>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <frand@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <frandvec+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @frandvec(i32* %0, i32 %1, double* %2, double %3, double %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store double* %2, double** %8
store double %3, double* %9
store double %4, double* %10
store i32 0, i32* %11
br label %12
12: ; preds = %25, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32*, i32** %6
%18 = load double, double* %9
%19 = load double, double* %10
%20 = call double @frand(i32* %17, double %18, double %19)
%21 = load double*, double** %8
%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 @frandvec(i32* %0, i32 %1, double* nocapture writeonly %2, double %3, double %4) {
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %15
7: ; preds = %5
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %13, %9 ]
%11 = tail call double @frand(i32* %0, double %3, double %4)
%12 = getelementptr inbounds double, double* %2, 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
}