#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 random(int, int);
int /*<<< orphan*/ scanf(char *, int *);
unsigned long time(int /*<<< orphan*/ *);
void Task6() {
  unsigned long t = time(NULL);
  int x = t % 1000;
  int range = 100, n;
  printf("Enter the number of random numbers: ");
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    x = random(range, x);
    printf("%d ", x);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<Task6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x64,-0x10(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11cd <Task6+0x8d>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <random@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <Task6+0x54>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Task6>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11e3 <Task6+0x93>
mov    %rbx,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
shr    $0x4,%rdx
imul   $0x3e8,%edx,%eax
sub    %eax,%ebx
lea    0xe79(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
mov    %ebx,%esi
call   1060 <random@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11c0 <Task6+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [37 x i8] c"Enter the number of random numbers: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define void @Task6() {
%1 = alloca i32
%2 = tail call i64 @time(i32* null)
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = urem i64 %2, 1000
%10 = trunc i64 %9 to i32
br label %13
11: ; preds = %13, %0
%12 = call i32 @putchar(i32 10)
ret void
13: ; preds = %8, %13
%14 = phi i32 [ %18, %13 ], [ 0, %8 ]
%15 = phi i32 [ %16, %13 ], [ %10, %8 ]
%16 = call i32 @random(i32 100, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i32 %14, 1
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %13, label %11
}