#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() {
  int x, vet[8], num, achei = 0;
  for (int x = 0; x < 8; x++) {
    printf("\n[%d] Digite um numero: ", x);
    scanf("%d", &vet[x]);
  }
  printf("\n\n");
  printf("Digite um valor a ser pesquisado: ");
  scanf("%d", &num);
  for (int x = 0; x < 8; x++) {
    if (vet[x] == num) {
      printf("\n O numero %d esta na posicao %d: ", num, x);
      achei = 1;
    }
  }
  if (achei != 1)
    printf("\n Este numero nao existe");
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    1181 <main+0x61>
mov    -0x3c(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeab(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    113d <main+0x1d>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x40(%rbp)
cmpl   $0x8,-0x40(%rbp)
jge    11fd <main+0xdd>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jne    11ea <main+0xca>
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x38(%rbp)
jmp    11ef <main+0xcf>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11b4 <main+0x94>
cmpl   $0x1,-0x38(%rbp)
je     1215 <main+0xf5>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xec1(%rip),%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xe4f(%rip),%rdi
call   1030 <puts@plt>
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%esi
cmp    %esi,%eax
je     12b2 <main+0x182>
cmp    %esi,0x14(%rsp)
je     12d3 <main+0x1a3>
cmp    %esi,0x18(%rsp)
je     12f9 <main+0x1c9>
cmp    %esi,0x1c(%rsp)
je     131f <main+0x1ef>
cmp    %esi,0x20(%rsp)
je     1345 <main+0x215>
cmp    %esi,0x24(%rsp)
je     136b <main+0x23b>
cmp    %esi,0x28(%rsp)
je     1391 <main+0x261>
cmp    %esi,0x2c(%rsp)
jne    13b7 <main+0x287>
lea    0xd9e(%rip),%rdi
mov    $0x7,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13c9 <main+0x299>
lea    0xd86(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    $0x1,%ebp
cmp    %esi,0x14(%rsp)
jne    125e <main+0x12e>
lea    0xd65(%rip),%rdi
mov    $0x1,%ebp
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
cmp    %esi,0x18(%rsp)
jne    1268 <main+0x138>
lea    0xd3f(%rip),%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,0x1c(%rsp)
jne    1272 <main+0x142>
lea    0xd19(%rip),%rdi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,0x20(%rsp)
jne    127c <main+0x14c>
lea    0xcf3(%rip),%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,0x24(%rsp)
jne    1286 <main+0x156>
lea    0xccd(%rip),%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,0x28(%rsp)
jne    1290 <main+0x160>
lea    0xca7(%rip),%rdi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,0x2c(%rsp)
je     129a <main+0x16a>
test   %ebp,%ebp
jne    13c9 <main+0x299>
lea    0xca0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"\0A[%d] Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [35 x i8] c"Digite um valor a ser pesquisado: \00"
@.str.4 = [35 x i8] c"\0A O numero %d esta na posicao %d: \00"
@.str.5 = [25 x i8] c"\0A Este numero nao existe\00"
@str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca i32
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 0)
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 2)
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 3)
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 4)
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 5)
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 6)
%24 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 7)
%27 = getelementptr inbounds [8 x i32], [8 x i32]* %1, 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%32 = load i32, i32* %6
%33 = load i32, i32* %2
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %0
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %32, i32 0)
%37 = load i32, i32* %2
br label %38
38: ; preds = %0, %35
%39 = phi i32 [ %37, %35 ], [ %33, %0 ]
%40 = phi i32 [ 1, %35 ], [ 0, %0 ]
%41 = load i32, i32* %9
%42 = icmp eq i32 %41, %39
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %39, i32 1)
%45 = load i32, i32* %2
br label %46
46: ; preds = %43, %38
%47 = phi i32 [ %45, %43 ], [ %39, %38 ]
%48 = phi i32 [ 1, %43 ], [ %40, %38 ]
%49 = load i32, i32* %12
%50 = icmp eq i32 %49, %47
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 2)
%53 = load i32, i32* %2
br label %54
54: ; preds = %51, %46
%55 = phi i32 [ %53, %51 ], [ %47, %46 ]
%56 = phi i32 [ 1, %51 ], [ %48, %46 ]
%57 = load i32, i32* %15
%58 = icmp eq i32 %57, %55
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %55, i32 3)
%61 = load i32, i32* %2
br label %62
62: ; preds = %59, %54
%63 = phi i32 [ %61, %59 ], [ %55, %54 ]
%64 = phi i32 [ 1, %59 ], [ %56, %54 ]
%65 = load i32, i32* %18
%66 = icmp eq i32 %65, %63
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 4)
%69 = load i32, i32* %2
br label %70
70: ; preds = %67, %62
%71 = phi i32 [ %69, %67 ], [ %63, %62 ]
%72 = phi i32 [ 1, %67 ], [ %64, %62 ]
%73 = load i32, i32* %21
%74 = icmp eq i32 %73, %71
br i1 %74, label %75, label %78
75: ; preds = %70
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %71, i32 5)
%77 = load i32, i32* %2
br label %78
78: ; preds = %75, %70
%79 = phi i32 [ %77, %75 ], [ %71, %70 ]
%80 = phi i32 [ 1, %75 ], [ %72, %70 ]
%81 = load i32, i32* %24
%82 = icmp eq i32 %81, %79
br i1 %82, label %83, label %86
83: ; preds = %78
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %79, i32 6)
%85 = load i32, i32* %2
br label %86
86: ; preds = %83, %78
%87 = phi i32 [ %85, %83 ], [ %79, %78 ]
%88 = phi i32 [ 1, %83 ], [ %80, %78 ]
%89 = load i32, i32* %27
%90 = icmp eq i32 %89, %87
br i1 %90, label %91, label %93
91: ; preds = %86
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %87, i32 7)
br label %97
93: ; preds = %86
%94 = icmp eq i32 %88, 1
br i1 %94, label %97, label %95
95: ; preds = %93
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %97
97: ; preds = %91, %95, %93
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}