#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 */
unsigned long long rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void create_rand_array(unsigned long long *arr, int size) {
  unsigned long i;
  unsigned long long product;
  unsigned long long tmp;
  srand((unsigned)time(NULL));
  for (i = 0; i < size; i++) {
    do {
      product = rand();
      tmp = rand() + (product * 1000000000);
    } while (tmp < 4294967296);
    *(arr + i) = tmp;
  }
  return;
}


x86 assembly (clang, -O0):
<create_rand_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jae    11c3 <create_rand_array+0x93>
jmp    116d <create_rand_array+0x3d>
mov    $0x0,%al
call   1050 <rand@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
imul   $0x3b9aca00,-0x20(%rbp),%rcx
3b
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
movabs $0x100000000,%rax
cmp    %rax,-0x28(%rbp)
jb     116d <create_rand_array+0x3d>
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <create_rand_array+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_rand_array>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
je     1191 <create_rand_array+0x61>
movslq %ebp,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1050 <rand@plt>
imul   $0x3b9aca00,%rbp,%rcx
add    %rax,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
je     1160 <create_rand_array+0x30>
mov    %rcx,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %r15,%rbx
jne    1160 <create_rand_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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