#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);
  for (x; x < 10; x++) {
    if (local == v[x]) {
      printf("O número foi encontrado na posição [%d]\n ", x);
      i++;
    }
  }
  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)
jge    1221 <main+0xd1>
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)
jmp    120d <main+0xbd>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11c1 <main+0x71>
cmpl   $0x0,-0x1a8(%rbp)
jne    123c <main+0xec>
lea    0xe32(%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     11e9 <main+0xa9>
cmp    $0x14,%eax
je     1207 <main+0xc7>
cmp    $0x1e,%eax
je     122a <main+0xea>
cmp    $0x28,%eax
je     124d <main+0x10d>
cmp    $0x32,%eax
je     1270 <main+0x130>
cmp    $0x3c,%eax
je     1293 <main+0x153>
cmp    $0x46,%eax
je     12b6 <main+0x176>
cmp    $0x50,%eax
je     12d9 <main+0x199>
cmp    $0x5a,%eax
je     12fc <main+0x1bc>
cmp    $0x64,%eax
jne    131f <main+0x1df>
lea    0xe62(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1331 <main+0x1f1>
lea    0xe4a(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x14,%eax
jne    1189 <main+0x49>
lea    0xe2c(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x1e,%eax
jne    1192 <main+0x52>
lea    0xe09(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x28,%eax
jne    119b <main+0x5b>
lea    0xde6(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x32,%eax
jne    11a4 <main+0x64>
lea    0xdc3(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x3c,%eax
jne    11ad <main+0x6d>
lea    0xda0(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x46,%eax
jne    11b6 <main+0x76>
lea    0xd7d(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x50,%eax
jne    11bf <main+0x7f>
lea    0xd5a(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x5a,%eax
jne    11c8 <main+0x88>
lea    0xd37(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    $0x64,%eax
je     11d1 <main+0x91>
test   %ebx,%ebx
jne    1331 <main+0x1f1>
lea    0xd3d(%rip),%rdi
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)
%11 = load i32, i32* %4
br label %12
12: ; preds = %28, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %16, %20
br i1 %21, label %22, label %27
22: ; preds = %15
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %27
27: ; preds = %22, %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %12
31: ; preds = %12
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = call i32 (...) @getch()
%38 = load i32, i32* %1
ret i32 %38
}

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 = %0, %9
%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 %82
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)
br label %86
82: ; preds = %76
%83 = icmp eq i32 %78, 0
br i1 %83, label %84, label %86
84: ; preds = %82
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %86
86: ; preds = %80, %84, %82
%87 = call i32 (...) @getch()
ret i32 0
}