#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() {
  const int tam = 10;
  int i, pos = 0, achou = 0, num, vet[tam];
  for (i = 0; i < tam; i++) {
    printf("Entre com um numero: ");
    scanf("%d", &vet[i]);
  }
  printf("Entre com um numero a ser pesquisado: ");
  scanf("%d", &num);
  do {
    if (vet[pos] == num)
      achou = 1;
    else
      pos++;
  } while ((!achou) && (pos < tam));
  if (achou)
    printf("Numero foi achado");
  else
    printf("Numero nao foi achado");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1191 <main+0x71>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe98(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x32>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0x10(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x18(%rbp),%eax
jne    11ca <main+0xaa>
movl   $0x1,-0x14(%rbp)
jmp    11d3 <main+0xb3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d8 <main+0xb8>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x51(%rbp)
jne    11f1 <main+0xd1>
cmpl   $0xa,-0x10(%rbp)
setl   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    11ad <main+0x8d>
cmpl   $0x0,-0x14(%rbp)
je     1217 <main+0xf7>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
jmp    1223 <main+0x103>
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%r15
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x34(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
xor    %ecx,%ecx
mov    0xc(%rsp),%eax
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
mov    0x10(%rsp,%rdx,4),%edx
xor    %esi,%esi
cmp    %eax,%edx
setne  %bl
je     1249 <main+0x129>
mov    %bl,%sil
add    %esi,%ecx
cmp    $0xa,%ecx
jb     1230 <main+0x110>
cmp    %eax,%edx
lea    0xdee(%rip),%rax
lea    0xdf9(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Entre com um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Entre com um numero a ser pesquisado: \00"
@.str.3 = [18 x i8] c"Numero foi achado\00"
@.str.4 = [22 x i8] c"Numero nao foi achado\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %1
store i32 10, i32* %2
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %7
%9 = alloca i32, i64 10
store i32 0, i32* %3
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %9, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %10
22: ; preds = %10
%23 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %25
25: ; preds = %43, %22
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %9, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %6
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %33
32: ; preds = %25
store i32 1, i32* %5
br label %36
33: ; preds = %25
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %36
36: ; preds = %33, %32
br label %37
37: ; preds = %36
%38 = load i32, i32* %5
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %4
%42 = icmp slt i32 %41, 10
br label %43
43: ; preds = %40, %37
%44 = phi i1 [ false, %37 ], [ %42, %40 ]
br i1 %44, label %25, label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %52
50: ; preds = %45
%51 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = load i8*, i8** %7
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [22 x i8] c"Entre com um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Entre com um numero a ser pesquisado: \00"
@.str.3 = [18 x i8] c"Numero foi achado\00"
@.str.4 = [22 x i8] c"Numero nao foi achado\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [10 x i32]
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 3
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 4
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 5
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 6
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 7
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 8
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %30)
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 9
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%37 = load i32, i32* %1
br label %38
38: ; preds = %38, %0
%39 = phi i32 [ 0, %0 ], [ %46, %38 ]
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, %37
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
%46 = add nuw nsw i32 %39, %45
%47 = icmp ult i32 %46, 10
%48 = select i1 %44, i1 %47, i1 false
br i1 %48, label %38, label %49
49: ; preds = %38
%50 = select i1 %43, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0)
%51 = call i32 @printf(i8* dereferenceable(1) %50)
ret i32 0
}