#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 *);
void ex4() {
  int a, b, c;
  printf("Informe a: ");
  scanf("%d", &a);
  printf("Informe b: ");
  scanf("%d", &b);
  printf("Informe c: ");
  scanf("%d", &c);
  int maior = a, menor = a;
  if (b > maior)
    maior = b;
  if (c > maior)
    maior = c;
  if (menor > b)
    menor = b;
  if (menor > c)
    menor = c;
  printf("Maior: %d\nMenor: %d\n", maior, menor);
}


x86 assembly (clang, -O0):
<ex4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11a0 <ex4+0x80>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11b2 <ex4+0x92>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11c4 <ex4+0xa4>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11d6 <ex4+0xb6>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex4>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
cmp    %edx,%eax
mov    %edx,%esi
cmovg  %eax,%esi
mov    0x4(%rsp),%ecx
cmp    %esi,%ecx
cmovg  %ecx,%esi
cmp    %eax,%edx
cmovg  %eax,%edx
cmp    %ecx,%edx
cmovg  %ecx,%edx
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Informe a: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Informe b: \00"
@.str.3 = [12 x i8] c"Informe c: \00"
@.str.4 = [21 x i8] c"Maior: %d\0AMenor: %d\0A\00"
define void @ex4() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %1
store i32 %12, i32* %4
%13 = load i32, i32* %1
store i32 %13, i32* %5
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = load i32, i32* %2
store i32 %18, i32* %4
br label %19
19: ; preds = %17, %0
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %3
store i32 %24, i32* %4
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* %5
%27 = load i32, i32* %2
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %2
store i32 %30, i32* %5
br label %31
31: ; preds = %29, %25
%32 = load i32, i32* %5
%33 = load i32, i32* %3
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i32, i32* %3
store i32 %36, i32* %5
br label %37
37: ; preds = %35, %31
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %39)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Informe a: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Informe b: \00"
@.str.3 = [12 x i8] c"Informe c: \00"
@.str.4 = [21 x i8] c"Maior: %d\0AMenor: %d\0A\00"
define void @ex4() {
%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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, %13
%16 = select i1 %15, i32 %14, i32 %13
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, %16
%19 = select i1 %18, i32 %17, i32 %16
%20 = icmp sgt i32 %13, %14
%21 = select i1 %20, i32 %14, i32 %13
%22 = icmp sgt i32 %21, %17
%23 = select i1 %22, i32 %17, i32 %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %19, i32 %23)
ret void
}