#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(void) {
  int prod1, prod2, prod3;
  printf("Qual o valor do primeiro produto: \n");
  scanf("%i", &prod1);
  printf("Qual o valor do segundo produto: \n");
  scanf("%i", &prod2);
  printf("Qual o valor do terceiro produto: \n");
  scanf("%i", &prod3);
  if (prod1 < prod2 && prod1 < prod3) {
    printf("Compre o primeiro produto\n");
  } else if (prod2 < prod1 && prod2 < prod3) {
    printf("Compre o segundo produto\n");
  } else if (prod3 < prod1 && prod3 < prod2) {
    printf("Compre o terceiro produto\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ac <main+0x8c>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    1203 <main+0xe3>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d5 <main+0xb5>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d5 <main+0xb5>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f9 <main+0xd9>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f9 <main+0xd9>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
jmp    1203 <main+0xe3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %eax,%edx
jge    1194 <main+0x74>
cmp    %ecx,%edx
jge    1194 <main+0x74>
lea    0xf0c(%rip),%rdi
jmp    11b4 <main+0x94>
cmp    %edx,%eax
jge    11a5 <main+0x85>
cmp    %ecx,%eax
jge    11a5 <main+0x85>
lea    0xee2(%rip),%rdi
jmp    11b4 <main+0x94>
cmp    %edx,%ecx
jge    11b9 <main+0x99>
cmp    %eax,%ecx
jge    11b9 <main+0x99>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Qual o valor do primeiro produto: \0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Qual o valor do segundo produto: \0A\00"
@.str.3 = [36 x i8] c"Qual o valor do terceiro produto: \0A\00"
@.str.4 = [27 x i8] c"Compre o primeiro produto\0A\00"
@.str.5 = [26 x i8] c"Compre o segundo produto\0A\00"
@.str.6 = [27 x i8] c"Compre o terceiro produto\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %0
%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 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %42
20: ; preds = %14, %0
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %41
30: ; preds = %24, %20
%31 = load i32, i32* %4
%32 = load i32, i32* %2
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* %4
%36 = load i32, i32* %3
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %34, %30
br label %41
41: ; preds = %40, %28
br label %42
42: ; preds = %41, %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@str = [35 x i8] c"Qual o valor do primeiro produto: \00"
@str.7 = [34 x i8] c"Qual o valor do segundo produto: \00"
@str.8 = [35 x i8] c"Qual o valor do terceiro produto: \00"
@str.9 = [26 x i8] c"Compre o terceiro produto\00"
@str.10 = [25 x i8] c"Compre o segundo produto\00"
@str.11 = [26 x i8] c"Compre o primeiro produto\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 ([35 x i8], [35 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, 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 slt i32 %13, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %13, %16
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %27, label %19
19: ; preds = %0
%20 = icmp slt i32 %14, %13
%21 = icmp slt i32 %14, %16
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = icmp slt i32 %16, %13
%25 = icmp slt i32 %16, %14
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %27, label %30
27: ; preds = %23, %19, %0
%28 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0), %0 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0), %19 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %23 ]
%29 = call i32 @puts(i8* dereferenceable(1) %28)
br label %30
30: ; preds = %27, %23
ret i32 0
}