#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 *, int *);
int main() {
  int n1, n2, n3, M, m;
  printf("Me diga tres numeros e eu digo o menor e maior\n");
  scanf("%d"
        "%d"
        "%d",
        &n1, &n2, &n3);
  if (n1 > n2) {
    M = n1;
    m = n2;
  } else {
    M = n2;
    m = n1;
  }
  if (n3 > M) {
    M = n3;
  }
  if (n3 < m) {
    m = n3;
  }
  printf("O maior numero e o %d e o menor e o %d", M, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1172 <main+0x52>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1190 <main+0x70>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a2 <main+0x82>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%eax
cmp    %eax,%edx
mov    %eax,%esi
cmovg  %edx,%esi
cmovg  %eax,%edx
mov    0xc(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %edx,%eax
cmovl  %eax,%edx
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Me diga tres numeros e eu digo o menor e maior\0A\00"
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [39 x i8] c"O maior numero e o %d e o menor e o %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
store i32 %13, i32* %5
%14 = load i32, i32* %3
store i32 %14, i32* %6
br label %18
15: ; preds = %0
%16 = load i32, i32* %3
store i32 %16, i32* %5
%17 = load i32, i32* %2
store i32 %17, i32* %6
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %4
store i32 %23, i32* %5
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* %4
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* %4
store i32 %29, i32* %6
br label %30
30: ; preds = %28, %24
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [39 x i8] c"O maior numero e o %d e o menor e o %d\00"
@str = [47 x i8] c"Me diga tres numeros e eu digo o menor e maior\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i32 %9, i32 %10
%13 = select i1 %11, i32 %10, i32 %9
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, %12
%16 = select i1 %15, i32 %14, i32 %12
%17 = icmp slt i32 %14, %13
%18 = select i1 %17, i32 %14, i32 %13
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %18)
ret i32 0
}