#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 num;
  int resp;
  int maior = -999, menor = 1000;
  do {
    printf("\nEntre com um numero[1-100]:");
    scanf("%d", &num);
    if (num > maior)
      maior = num;
    if (num < menor)
      menor = num;
    printf("\nDeseja continuar(1-s/2-n)?");
    scanf("%d", &resp);
  } while (resp == 1);
  printf("\nMaior numero = %d\n", maior);
  printf("\nMenor numero = %d\n", menor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffc19,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    116d <main+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117f <main+0x5f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
je     113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe8e(%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    0xee1(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xed8(%rip),%r13
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,(%rsp)
je     1150 <main+0x30>
lea    0xea3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <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 = [29 x i8] c"\0AEntre com um numero[1-100]:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0ADeseja continuar(1-s/2-n)?\00"
@.str.3 = [20 x i8] c"\0AMaior numero = %d\0A\00"
@.str.4 = [20 x i8] c"\0AMenor numero = %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* %4
store i32 1000, i32* %5
br label %6
6: ; preds = %23, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 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* %4
%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* %4
br label %14
14: ; preds = %12, %6
%15 = load i32, i32* %2
%16 = load i32, i32* %5
%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* %5
br label %20
20: ; preds = %18, %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 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* %3)
br label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 1
br i1 %25, label %6, label %26
26: ; preds = %23
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0AEntre com um numero[1-100]:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0ADeseja continuar(1-s/2-n)?\00"
@.str.3 = [20 x i8] c"\0AMaior numero = %d\0A\00"
@.str.4 = [20 x i8] c"\0AMenor numero = %d\0A\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, 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 ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %14)
ret i32 0
}