#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int INT_MAX;
int RAND_MAX;
int /*<<< orphan*/ printf(char *, int);
int random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  printf("%d\n", RAND_MAX);
  printf("%d\n", INT_MAX);
  time_t time1;
  time(&time1);
  srandom(time1);
  for (int i = 0; i < 2; i++) {
    printf("%ld\n", random());
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
mov    -0x14(%rbp),%edi
call   1030 <srandom@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    11c5 <main+0x85>
mov    $0x0,%al
call   1060 <random@plt>
mov    %eax,%esi
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <main+0x58>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
lea    0xeab(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
call   1050 <time@plt>
mov    0xc(%rsp),%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1060 <random@plt>
lea    0xe75(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@RAND_MAX = global i32 0
@INT_MAX = global i32 0
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = load i32, i32* @RAND_MAX
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @INT_MAX
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast i32* %3 to i8*
%9 = call i32 @time(i32* %3)
%10 = load i32, i32* %3
%11 = call i32 @srandom(i32 %10)
%12 = call i32 (...) @random()
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 (...) @random()
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}