#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 rand();
int /*<<< orphan*/ srand(int);
scalar_t__ time(int /*<<< orphan*/ *);
void initArr(int *arr, int lowV, int upV, int len) {
  srand((int)time(NULL));
  int i = 0;
  int size = upV - lowV;
  for (; i < len; i++) {
    arr[i] = rand() % size + lowV;
  }
}


x86 assembly (clang, -O0):
<initArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1198 <initArr+0x68>
mov    $0x0,%al
call   1050 <rand@plt>
cltd
idivl  -0x1c(%rbp)
add    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1165 <initArr+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initArr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r13d
mov    %esi,%r12d
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %r15d,%r15d
jle    118b <initArr+0x5b>
sub    %r12d,%r13d
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltd
idiv   %r13d
add    %r12d,%edx
mov    %edx,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <initArr+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @initArr(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = tail call i32 @srand(i32 %6)
%8 = sub nsw i32 %2, %1
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %20
10: ; preds = %4
%11 = zext i32 %3 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %18, %12 ]
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, %8
%16 = add nsw i32 %15, %1
%17 = getelementptr inbounds i32, i32* %0, i64 %13
store i32 %16, i32* %17
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %12
20: ; preds = %12, %4
ret void
}