#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int x, max, min;
  printf("Digite um número inteiro positivo: ");
  scanf("%d", &x);
  max = min = x;
  while (x != -1) {
    printf("Digite um número inteiro positivo: ");
    scanf("%d", &x);
    if (x > max)
      max = x;
    else if (x < min) {
      if (x != -1)
        min = x;
    }
  }
  printf("\nO maior valor digitado foi %d e o menor valor foi %d.\n\n", max,
         min);
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     11d0 <main+0xa0>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a5 <main+0x75>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11cb <main+0x9b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c6 <main+0x96>
cmpl   $0xffffffff,-0x8(%rbp)
je     11c1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11c6 <main+0x96>
jmp    11cb <main+0x9b>
jmp    1166 <main+0x36>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe76(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0xffffffff,%ebx
je     11b5 <main+0x85>
lea    0xe95(%rip),%r14
lea    0xeb3(%rip),%r15
lea    0xc(%rsp),%r12
mov    %ebx,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
mov    %ebx,%ecx
cmovne %eax,%ecx
cmp    %ebx,%eax
cmovge %ebx,%ecx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmovle %ecx,%ebx
cmp    $0xffffffff,%eax
jne    1180 <main+0x50>
jmp    11bf <main+0x8f>
mov    $0xffffffff,%ebp
mov    $0xffffffff,%ebx
lea    0xe62(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Digite um n\C3\BAmero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"\0AO maior valor digitado foi %d e o menor valor foi %d.\0A\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
store i32 %7, i32* %4
store i32 %7, i32* %3
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i32, i32* %2
store i32 %18, i32* %3
br label %30
19: ; preds = %11
%20 = load i32, i32* %2
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load i32, i32* %2
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* %2
store i32 %27, i32* %4
br label %28
28: ; preds = %26, %23
br label %29
29: ; preds = %28, %19
br label %30
30: ; preds = %29, %17
br label %8
31: ; preds = %8
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %33)
%35 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Digite um n\C3\BAmero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"\0AO maior valor digitado foi %d e o menor valor foi %d.\0A\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %21, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %19, %7 ], [ %5, %0 ]
%9 = phi i32 [ %18, %7 ], [ %5, %0 ]
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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* %1)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, %9
%14 = icmp slt i32 %12, %8
%15 = icmp ne i32 %12, -1
%16 = and i1 %14, %15
%17 = select i1 %16, i32 %12, i32 %8
%18 = select i1 %13, i32 %12, i32 %9
%19 = select i1 %13, i32 %8, i32 %17
%20 = icmp eq i32 %12, -1
br i1 %20, label %21, label %7
21: ; preds = %7, %0
%22 = phi i32 [ -1, %0 ], [ %18, %7 ]
%23 = phi i32 [ -1, %0 ], [ %19, %7 ]
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23)
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}