#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 verifica(int *);
main() {
  int vetor[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
  int resultado = verifica(vetor);
  switch (resultado) {
  case 0:
    printf("\nNao achou :(");
    break;
  case 1:
    printf("\nAchou! :)");
    break;
  default:
    printf("\nErro");
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeea(%rip),%rax
mov    %rax,-0x10(%rbp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,-0x20(%rbp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <verifica@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
test   %eax,%eax
je     1180 <main+0x60>
jmp    116f <main+0x4f>
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
je     1191 <main+0x71>
jmp    11a2 <main+0x82>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <main+0x8e>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <main+0x8e>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <verifica@plt>
cmp    $0x1,%eax
lea    0xedd(%rip),%rcx
lea    0xee1(%rip),%rdx
cmove  %rcx,%rdx
test   %eax,%eax
lea    0xebb(%rip),%rdi
cmovne %rdx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.vetor = [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str = [14 x i8] c"\0ANao achou :(\00"
@.str.1 = [11 x i8] c"\0AAchou! :)\00"
@.str.2 = [6 x i8] c"\0AErro\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @verifica(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
switch i32 %7, label %12 [
i32 0, label %8
i32 1, label %10
]
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %14
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@__const.main.vetor = [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str = [14 x i8] c"\0ANao achou :(\00"
@.str.1 = [11 x i8] c"\0AAchou! :)\00"
@.str.2 = [6 x i8] c"\0AErro\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @verifica(i32* %3)
%5 = icmp eq i32 %4, 1
%6 = select i1 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%7 = icmp eq i32 %4, 0
%8 = select i1 %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %6
%9 = call i32 @printf(i8* dereferenceable(1) %8)
ret i32 0
}