#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*/ LC_ALL;
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
main() {
  setlocale(LC_ALL, "Portuguese");
  int local;
  int v[100] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
  int x = 0;
  int i = 0;
  printf("digite um número para encontrar no vetor: ");
  scanf("%d", &local);
  while (x <= 10) {
    if (local == v[x]) {
      printf("O número foi encontrado na posição [%d]\n ", x);
      i++;
    }
    x++;
  }
  if (i == 0) {
    printf("Número não encontrado");
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
call   1050 <setlocale@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xefb(%rip),%rsi
mov    $0x190,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x1a4(%rbp)
movl   $0x0,-0x1a8(%rbp)
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0xa,-0x1a4(%rbp)
jg     121c <main+0xcc>
mov    -0x8(%rbp),%eax
movslq -0x1a4(%rbp),%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jne    1208 <main+0xb8>
mov    -0x1a4(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11c1 <main+0x71>
cmpl   $0x0,-0x1a8(%rbp)
jne    1237 <main+0xe7>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xeaa(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
je     11f8 <main+0xb8>
cmp    $0x14,%eax
je     121a <main+0xda>
cmp    $0x1e,%eax
je     123d <main+0xfd>
cmp    $0x28,%eax
je     1260 <main+0x120>
cmp    $0x32,%eax
je     1283 <main+0x143>
cmp    $0x3c,%eax
je     12a6 <main+0x166>
cmp    $0x46,%eax
je     12c9 <main+0x189>
cmp    $0x50,%eax
je     12ec <main+0x1ac>
cmp    $0x5a,%eax
je     130f <main+0x1cf>
cmp    $0x64,%eax
je     1332 <main+0x1f2>
test   %eax,%eax
je     1354 <main+0x214>
test   %ebx,%ebx
jne    1367 <main+0x227>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1367 <main+0x227>
lea    0xe3b(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x14,%eax
jne    118d <main+0x4d>
lea    0xe19(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x1e,%eax
jne    1196 <main+0x56>
lea    0xdf6(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x28,%eax
jne    119f <main+0x5f>
lea    0xdd3(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x32,%eax
jne    11a8 <main+0x68>
lea    0xdb0(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x3c,%eax
jne    11b1 <main+0x71>
lea    0xd8d(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x46,%eax
jne    11ba <main+0x7a>
lea    0xd6a(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x50,%eax
jne    11c3 <main+0x83>
lea    0xd47(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x5a,%eax
jne    11cc <main+0x8c>
lea    0xd24(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x64,%eax
jne    11d5 <main+0x95>
lea    0xd01(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    11dd <main+0x9d>
lea    0xcdf(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@__const.main.v = <{ [10 x i32], [90 x i32] }> <{ [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100], [90 x i32] zeroinitializer }>
@.str.1 = [44 x i8] c"digite um n\C3\BAmero para encontrar no vetor: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [45 x i8] c"O n\C3\BAmero foi encontrado na posi\C3\A7\C3\A3o [%d]\0A \00"
@.str.4 = [24 x i8] c"N\C3\BAmero n\C3\A3o encontrado\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @LC_ALL
%7 = call i32 @setlocale(i32 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [100 x i32]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %26, %0
%12 = load i32, i32* %4
%13 = icmp sle i32 %12, 10
br i1 %13, label %14, label %29
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %15, %19
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %26
26: ; preds = %21, %14
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %11
29: ; preds = %11
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = call i32 (...) @getch()
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@.str.1 = [44 x i8] c"digite um n\C3\BAmero para encontrar no vetor: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [45 x i8] c"O n\C3\BAmero foi encontrado na posi\C3\A7\C3\A3o [%d]\0A \00"
@.str.4 = [24 x i8] c"N\C3\BAmero n\C3\A3o encontrado\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 0)
%11 = load i32, i32* %1
br label %12
12: ; preds = %9, %0
%13 = phi i32 [ %11, %9 ], [ %7, %0 ]
%14 = phi i32 [ 1, %9 ], [ 0, %0 ]
%15 = icmp eq i32 %13, 20
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 1)
%18 = add nuw nsw i32 %14, 1
%19 = load i32, i32* %1
br label %20
20: ; preds = %16, %12
%21 = phi i32 [ %19, %16 ], [ %13, %12 ]
%22 = phi i32 [ %18, %16 ], [ %14, %12 ]
%23 = icmp eq i32 %21, 30
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 2)
%26 = add nuw nsw i32 %22, 1
%27 = load i32, i32* %1
br label %28
28: ; preds = %24, %20
%29 = phi i32 [ %27, %24 ], [ %21, %20 ]
%30 = phi i32 [ %26, %24 ], [ %22, %20 ]
%31 = icmp eq i32 %29, 40
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 3)
%34 = add nuw nsw i32 %30, 1
%35 = load i32, i32* %1
br label %36
36: ; preds = %32, %28
%37 = phi i32 [ %35, %32 ], [ %29, %28 ]
%38 = phi i32 [ %34, %32 ], [ %30, %28 ]
%39 = icmp eq i32 %37, 50
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 4)
%42 = add nuw nsw i32 %38, 1
%43 = load i32, i32* %1
br label %44
44: ; preds = %40, %36
%45 = phi i32 [ %43, %40 ], [ %37, %36 ]
%46 = phi i32 [ %42, %40 ], [ %38, %36 ]
%47 = icmp eq i32 %45, 60
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 5)
%50 = add nuw nsw i32 %46, 1
%51 = load i32, i32* %1
br label %52
52: ; preds = %48, %44
%53 = phi i32 [ %51, %48 ], [ %45, %44 ]
%54 = phi i32 [ %50, %48 ], [ %46, %44 ]
%55 = icmp eq i32 %53, 70
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 6)
%58 = add nuw nsw i32 %54, 1
%59 = load i32, i32* %1
br label %60
60: ; preds = %56, %52
%61 = phi i32 [ %59, %56 ], [ %53, %52 ]
%62 = phi i32 [ %58, %56 ], [ %54, %52 ]
%63 = icmp eq i32 %61, 80
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 7)
%66 = add nuw nsw i32 %62, 1
%67 = load i32, i32* %1
br label %68
68: ; preds = %64, %60
%69 = phi i32 [ %67, %64 ], [ %61, %60 ]
%70 = phi i32 [ %66, %64 ], [ %62, %60 ]
%71 = icmp eq i32 %69, 90
br i1 %71, label %72, label %76
72: ; preds = %68
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 8)
%74 = add nuw nsw i32 %70, 1
%75 = load i32, i32* %1
br label %76
76: ; preds = %72, %68
%77 = phi i32 [ %75, %72 ], [ %69, %68 ]
%78 = phi i32 [ %74, %72 ], [ %70, %68 ]
%79 = icmp eq i32 %77, 100
br i1 %79, label %80, label %84
80: ; preds = %76
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 9)
%82 = add nuw nsw i32 %78, 1
%83 = load i32, i32* %1
br label %84
84: ; preds = %80, %76
%85 = phi i32 [ %83, %80 ], [ %77, %76 ]
%86 = phi i32 [ %82, %80 ], [ %78, %76 ]
%87 = icmp eq i32 %85, 0
br i1 %87, label %88, label %90
88: ; preds = %84
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 10)
br label %94
90: ; preds = %84
%91 = icmp eq i32 %86, 0
br i1 %91, label %92, label %94
92: ; preds = %90
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %94
94: ; preds = %88, %92, %90
%95 = call i32 (...) @getch()
ret i32 0
}