#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 *);
main() {
  int num1, num2, num3, maior;
  printf("NUM1: ");
  scanf("%i", &num1);
  printf("NUM2: ");
  scanf("%i", &num2);
  printf("NUM3: ");
  scanf("%i", &num3);
  if (num1 > num2 && num1 > num3)
    maior = num1;
  else if (num2 > num1 && num2 > num3)
    maior = num2;
  else
    maior = num3;
  printf("Maior: %i", maior);
}


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    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11da <main+0xba>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11cf <main+0xaf>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11cf <main+0xaf>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11da <main+0xba>
mov    -0x14(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
mov    %ecx,%edx
cmovg  %eax,%edx
mov    0xc(%rsp),%edi
cmp    %edi,%eax
cmovle %ecx,%edx
cmp    %ecx,%edi
mov    %edx,%esi
cmovg  %edi,%esi
cmp    %eax,%edi
cmovle %edx,%esi
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"NUM1: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [7 x i8] c"NUM2: \00"
@.str.3 = [7 x i8] c"NUM3: \00"
@.str.4 = [10 x i8] c"Maior: %i\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 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* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 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* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 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* %4)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %0
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32, i32* %2
store i32 %20, i32* %5
br label %34
21: ; preds = %15, %0
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %3
store i32 %30, i32* %5
br label %33
31: ; preds = %25, %21
%32 = load i32, i32* %4
store i32 %32, i32* %5
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %19
%35 = load i32, i32* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [7 x i8] c"NUM1: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [7 x i8] c"NUM2: \00"
@.str.3 = [7 x i8] c"NUM3: \00"
@.str.4 = [10 x i8] c"Maior: %i\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 %13, %14
%16 = load i32, i32* %3
%17 = icmp sgt i32 %13, %16
%18 = select i1 %15, i1 %17, i1 false
%19 = icmp sgt i32 %14, %13
%20 = icmp sgt i32 %14, %16
%21 = select i1 %19, i1 %20, i1 false
%22 = select i1 %21, i32 %14, i32 %16
%23 = select i1 %18, i32 %13, i32 %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %23)
ret i32 0
}