#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*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int *getRandom() {
  static int r[10];
  int i;
  srand((unsigned)time(NULL));
  for (i = 0; i < 10; ++i) {
    r[i] = rand();
    printf("%d\n", r[i]);
  }
  return r;
}


x86 assembly (clang, -O0):
<getRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11a8 <getRandom+0x68>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,%edx
movslq -0x4(%rbp),%rcx
lea    0x2ed3(%rip),%rax
mov    %edx,(%rax,%rcx,4)
movslq -0x4(%rbp),%rcx
lea    0x2ec5(%rip),%rax
mov    (%rax,%rcx,4),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <getRandom+0x1f>
lea    0x2ea1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandom>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2ef1(%rip)
lea    0x2eea(%rip),%r14
lea    0xe93(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2ed0(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2ebd(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2eaa(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e97(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e84(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e71(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e5e(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e4b(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e38(%rip)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@getRandom.r = internal global [10 x i32] zeroinitializer
@.str = [4 x i8] c"%d\0A\00"
define i32* @getRandom() {
%1 = alloca i32
%2 = call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = call i32 @srand(i32 %3)
store i32 0, i32* %1
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = call i32 (...) @rand()
%10 = load i32, i32* %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 %11
store i32 %9, i32* %12
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %8
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %5
21: ; preds = %5
ret i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 0)
}

LLVM IR (-O2):
@getRandom.r = internal global [10 x i32] zeroinitializer
@.str = [4 x i8] c"%d\0A\00"
define i32* @getRandom() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (...) @rand()
store i32 %4, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @rand()
store i32 %6, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @rand()
store i32 %8, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 2)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @rand()
store i32 %10, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @rand()
store i32 %12, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 4)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @rand()
store i32 %14, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 5)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32 (...) @rand()
store i32 %16, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 6)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = tail call i32 (...) @rand()
store i32 %18, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 7)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = tail call i32 (...) @rand()
store i32 %20, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 8)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = tail call i32 (...) @rand()
store i32 %22, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 9)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32* getelementptr inbounds ([10 x i32], [10 x i32]* @getRandom.r, i64 0, i64 0)
}