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


x86 assembly (clang, -O0):
<randomNumbers>:
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    11af <randomNumbers+0x6f>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
movslq -0x4(%rbp),%rcx
lea    0x2ecf(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%esi
movslq -0x4(%rbp),%rcx
lea    0x2ebe(%rip),%rax
mov    (%rax,%rcx,4),%edx
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <randomNumbers+0x1f>
lea    0x2e9a(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomNumbers>:
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
xor    %esi,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2ece(%rip)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2eb6(%rip)
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e9e(%rip)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e86(%rip)
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e6e(%rip)
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e56(%rip)
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e3e(%rip)
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e26(%rip)
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,0x2e0e(%rip)
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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