#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 main() {
  int num1, maior = -999, menor = 1000, opcao;
  do {
    printf("Digite um número:\n");
    scanf("%d", &num1);
    if (num1 > maior)
      maior = num1;
    if (num1 < menor)
      menor = num1;
    printf("Deseja continuar? 1 SIM - 2 NAO.\n");
    scanf("%d", &opcao);
  } while (opcao == 1);
  printf("O maior número foi: %d\n", maior);
  printf("O menor número foi: %d\n", menor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffc19,-0xc(%rbp)
movl   $0x3e8,-0x10(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116d <main+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117f <main+0x5f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
je     113d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x3e8,%ebx
mov    $0xfffffc19,%ebp
lea    0xeb4(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xef0(%rip),%r13
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x1,(%rsp)
je     1160 <main+0x30>
lea    0xe5e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe67(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Digite um n\C3\BAmero:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Deseja continuar? 1 SIM - 2 NAO.\0A\00"
@.str.3 = [25 x i8] c"O maior n\C3\BAmero foi: %d\0A\00"
@.str.4 = [25 x i8] c"O menor n\C3\BAmero foi: %d\0A\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 -999, i32* %3
store i32 1000, i32* %4
br label %6
6: ; preds = %23, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = load i32, i32* %2
store i32 %13, i32* %3
br label %14
14: ; preds = %12, %6
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32, i32* %2
store i32 %19, i32* %4
br label %20
20: ; preds = %18, %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %23
23: ; preds = %20
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 1
br i1 %25, label %6, label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [25 x i8] c"O maior n\C3\BAmero foi: %d\0A\00"
@.str.4 = [25 x i8] c"O menor n\C3\BAmero foi: %d\0A\00"
@str = [19 x i8] c"Digite um n\C3\BAmero:\00"
@str.5 = [33 x i8] c"Deseja continuar? 1 SIM - 2 NAO.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ -999, %0 ], [ %12, %5 ]
%7 = phi i32 [ 1000, %0 ], [ %14, %5 ]
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, %6
%12 = select i1 %11, i32 %10, i32 %6
%13 = icmp slt i32 %10, %7
%14 = select i1 %13, i32 %10, i32 %7
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, 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 = icmp eq i32 %17, 1
br i1 %18, label %5, label %19
19: ; preds = %5
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %14)
ret i32 0
}