#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 random(int, int);
unsigned long time(int /*<<< orphan*/ *);
int main() {
  unsigned long t = time(NULL);
  int x = t % 1000;
  int range = 100;
  for (int i = 0; i < 100; i++) {
    x = random(range, x);
    printf("%d ", x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x64,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    11a2 <main+0x72>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <random@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116d <main+0x3d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%rbx
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
shr    $0x4,%rdx
imul   $0x3e8,%edx,%eax
sub    %eax,%ebx
mov    $0x64,%ebp
lea    0xe99(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    $0x64,%edi
mov    %ebx,%esi
call   1050 <random@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = urem i64 %1, 1000
%3 = trunc i64 %2 to i32
br label %5
4: ; preds = %5
ret i32 0
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %10, %5 ]
%7 = phi i32 [ %3, %0 ], [ %8, %5 ]
%8 = tail call i32 @random(i32 100, i32 %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i32 %6, 1
%11 = icmp eq i32 %10, 100
br i1 %11, label %4, label %5
}