#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 *, long);
int /*<<< orphan*/ ran_array(long *, int);
int /*<<< orphan*/ ran_start(long);
int main() {
  register int m;
  long a[2009];
  ran_start(310952L);
  for (m = 0; m <= 2009; m++)
    ran_array(a, 1009);
  printf("%ld\n", a[0]);
  ran_start(310952L);
  for (m = 0; m <= 1009; m++)
    ran_array(a, 2009);
  printf("%ld\n", a[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3ed0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4bea8,%edi
call   1030 <ran_start@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7d9,-0x8(%rbp)
jg     117f <main+0x4f>
lea    -0x3ed0(%rbp),%rdi
mov    $0x3f1,%esi
call   1050 <ran_array@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <main+0x23>
mov    -0x3ed0(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4bea8,%edi
call   1030 <ran_start@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3f1,-0x8(%rbp)
jg     11cf <main+0x9f>
lea    -0x3ed0(%rbp),%rdi
mov    $0x7d9,%esi
call   1050 <ran_array@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x73>
mov    -0x3ed0(%rbp),%rsi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3ed0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x3ec8,%rsp
mov    $0x4bea8,%edi
call   1030 <ran_start@plt>
mov    $0x7da,%ebp
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3f1,%esi
call   1050 <ran_array@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
mov    (%rsp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4bea8,%edi
call   1030 <ran_start@plt>
mov    $0x3f2,%ebp
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x7d9,%esi
call   1050 <ran_array@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x60>
mov    (%rsp),%rsi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3ec8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2009 x i64]
store i32 0, i32* %1
%4 = call i32 @ran_start(i64 310952)
store i32 0, i32* %2
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 2009
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = getelementptr inbounds [2009 x i64], [2009 x i64]* %3, i64 0, i64 0
%10 = call i32 @ran_array(i64* %9, i32 1009)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %5
14: ; preds = %5
%15 = getelementptr inbounds [2009 x i64], [2009 x i64]* %3, i64 0, i64 0
%16 = load i64, i64* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %16)
%18 = call i32 @ran_start(i64 310952)
store i32 0, i32* %2
br label %19
19: ; preds = %25, %14
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 1009
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = getelementptr inbounds [2009 x i64], [2009 x i64]* %3, i64 0, i64 0
%24 = call i32 @ran_array(i64* %23, i32 2009)
br label %25
25: ; preds = %22
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %19
28: ; preds = %19
%29 = getelementptr inbounds [2009 x i64], [2009 x i64]* %3, i64 0, i64 0
%30 = load i64, i64* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca [2009 x i64]
%2 = bitcast [2009 x i64]* %1 to i8*
%3 = tail call i32 @ran_start(i64 310952)
%4 = getelementptr inbounds [2009 x i64], [2009 x i64]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %8, %5 ]
%7 = call i32 @ran_array(i64* %4, i32 1009)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 2010
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = load i64, i64* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = call i32 @ran_start(i64 310952)
br label %14
14: ; preds = %10, %14
%15 = phi i32 [ 0, %10 ], [ %17, %14 ]
%16 = call i32 @ran_array(i64* %4, i32 2009)
%17 = add nuw nsw i32 %15, 1
%18 = icmp eq i32 %17, 1010
br i1 %18, label %19, label %14
19: ; preds = %14
%20 = load i64, i64* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %20)
ret i32 0
}