#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;
  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>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    119b <main+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x8c>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b7 <main+0x87>
cmpl   $0xffffffff,-0x8(%rbp)
je     11b7 <main+0x87>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11bc <main+0x8c>
jmp    11c1 <main+0x91>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1166 <main+0x36>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9c(%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   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%r14
lea    0x4(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0xebd(%rip),%r12
mov    %ebx,%ebp
nopl   (%rax)
mov    %ebp,%r13d
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <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    1170 <main+0x40>
lea    0xea2(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
call   1030 <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 = [40 x i8] c"Digite outro n\C3\BAmero inteiro positivo: \00"
@.str.3 = [50 x i8] c"\0AO maior n\C3\BAmero digitado foi %d, e o menor %d.\0A\0A\00"
@.str.4 = [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 = %27, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = load i32, i32* %2
store i32 %15, i32* %3
br label %26
16: ; preds = %8
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32, i32* %2
store i32 %24, i32* %4
br label %25
25: ; preds = %23, %20, %16
br label %26
26: ; preds = %25, %14
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = icmp ne i32 %28, -1
br i1 %29, label %8, label %30
30: ; preds = %27
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %31, i32 %32)
%34 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, 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 = [40 x i8] c"Digite outro n\C3\BAmero inteiro positivo: \00"
@.str.3 = [50 x i8] c"\0AO maior n\C3\BAmero digitado foi %d, e o menor %d.\0A\0A\00"
@.str.4 = [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
br label %6
6: ; preds = %6, %0
%7 = phi i32 [ %5, %0 ], [ %17, %6 ]
%8 = phi i32 [ %5, %0 ], [ %18, %6 ]
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, %7
%13 = icmp slt i32 %11, %8
%14 = icmp ne i32 %11, -1
%15 = and i1 %13, %14
%16 = select i1 %15, i32 %11, i32 %8
%17 = select i1 %12, i32 %11, i32 %7
%18 = select i1 %12, i32 %8, i32 %16
%19 = icmp eq i32 %11, -1
br i1 %19, label %20, label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %18)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}