#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);
  if (x == -1) {
    printf("\nFim de programa!\n\n");
    system("pause");
    return (0);
  }
  max = min = x;
  do {
    printf("Digite outro número inteiro positivo: ");
    scanf("%d", &x);
    if (x > max)
      max = x;
    else if ((x < min) && (x != -1))
      min = x;
  } while (x != -1);
  printf("\nO maior número digitado foi %d, e o menor %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>
cmpl   $0xffffffff,-0x8(%rbp)
jne    118d <main+0x5d>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    1222 <main+0xf2>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11cb <main+0x9b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11ec <main+0xbc>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e7 <main+0xb7>
cmpl   $0xffffffff,-0x8(%rbp)
je     11e7 <main+0xb7>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11ec <main+0xbc>
jmp    11f1 <main+0xc1>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1196 <main+0x66>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe26(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%ebx
cmp    $0xffffffff,%ebx
je     11db <main+0x9b>
lea    0xeb4(%rip),%r14
lea    0xea4(%rip),%r15
lea    0x4(%rsp),%r12
mov    %ebx,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%r13d
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xffffffff,%eax
cmovne %eax,%ebp
cmp    %r13d,%eax
cmovge %r13d,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r13d,%ebp
cmp    $0xffffffff,%eax
jne    1190 <main+0x50>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e7 <main+0xa7>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3a(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 = [20 x i8] c"\0AFim de programa!\0A\0A\00"
@.str.3 = [6 x i8] c"pause\00"
@.str.4 = [40 x i8] c"Digite outro n\C3\BAmero inteiro positivo: \00"
@.str.5 = [50 x i8] c"\0AO maior n\C3\BAmero digitado foi %d, e o menor %d.\0A\0A\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
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %41
12: ; preds = %0
%13 = load i32, i32* %2
store i32 %13, i32* %4
store i32 %13, i32* %3
br label %14
14: ; preds = %33, %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = load i32, i32* %2
store i32 %21, i32* %3
br label %32
22: ; preds = %14
%23 = load i32, i32* %2
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* %2
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load i32, i32* %2
store i32 %30, i32* %4
br label %31
31: ; preds = %29, %26, %22
br label %32
32: ; preds = %31, %20
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = icmp ne i32 %34, -1
br i1 %35, label %14, label %36
36: ; preds = %33
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %37, i32 %38)
%40 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %41
41: ; preds = %36, %9
%42 = load i32, i32* %1
ret i32 %42
}

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.3 = [6 x i8] c"pause\00"
@.str.4 = [40 x i8] c"Digite outro n\C3\BAmero inteiro positivo: \00"
@.str.5 = [50 x i8] c"\0AO maior n\C3\BAmero digitado foi %d, e o menor %d.\0A\0A\00"
@str = [19 x i8] c"\0AFim de programa!\0A\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 %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %25
9: ; preds = %0, %9
%10 = phi i32 [ %20, %9 ], [ %5, %0 ]
%11 = phi i32 [ %21, %9 ], [ %5, %0 ]
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, %10
%16 = icmp slt i32 %14, %11
%17 = icmp ne i32 %14, -1
%18 = and i1 %16, %17
%19 = select i1 %18, i32 %14, i32 %11
%20 = select i1 %15, i32 %14, i32 %10
%21 = select i1 %15, i32 %11, i32 %19
%22 = icmp eq i32 %14, -1
br i1 %22, label %23, label %9
23: ; preds = %9
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %20, i32 %21)
br label %25
25: ; preds = %23, %7
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}