#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int total1 = 0;
  int total2 = 1001;
  srand(time(NULL));
  for (int i = 1; i < 1001; i++) {
    int num = rand() % 1000;
    printf("Numero %d: %d \n ", i, num);
    if (num > total1)
      total1 = num;
    if (num < total2)
      total2 = num;
  }
  printf("\n");
  printf("\nO maior numero e: %d\nO menor numero e: %d", total1, total2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3e9,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x3e9,-0x10(%rbp)
jge    11de <main+0x9e>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11b9 <main+0x79>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cb <main+0x8b>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d0 <main+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1174 <main+0x34>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x3e9,%ebx
mov    $0x1,%ebp
lea    0xe89(%rip),%r15
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    %ebx,%r12d
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rbx
imul   $0x10624dd3,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
sub    %eax,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r14d,%ebx
cmovg  %ebx,%r14d
cmp    %r12d,%ebx
cmovge %r12d,%ebx
add    $0x1,%ebp
cmp    $0x3e9,%ebp
jne    1180 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe30(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Numero %d: %d \0A \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [43 x i8] c"\0AO maior numero e: %d\0AO menor numero e: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1001, i32* %3
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 1, i32* %4
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 1001
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 1000
store i32 %13, i32* %5
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = load i32, i32* %5
store i32 %21, i32* %2
br label %22
22: ; preds = %20, %11
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %5
store i32 %27, i32* %3
br label %28
28: ; preds = %26, %22
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %8
32: ; preds = %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [17 x i8] c"Numero %d: %d \0A \00"
@.str.2 = [43 x i8] c"\0AO maior numero e: %d\0AO menor numero e: %d\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %6
3: ; preds = %6
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %16)
ret i32 0
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %14, %6 ]
%8 = phi i32 [ 1, %0 ], [ %17, %6 ]
%9 = phi i32 [ 1001, %0 ], [ %16, %6 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 1000
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11)
%13 = icmp sgt i32 %11, %7
%14 = select i1 %13, i32 %11, i32 %7
%15 = icmp slt i32 %11, %9
%16 = select i1 %15, i32 %11, i32 %9
%17 = add nuw nsw i32 %8, 1
%18 = icmp eq i32 %17, 1001
br i1 %18, label %3, label %6
}