#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 /*<<< orphan*/ system(char *);
int main() {
  int v[10];
  int cont;
  int pos;
  int trovato;
  int n;
  cont = 0;
  while (cont <= 9) {
    printf("\nInserisci numero:");
    scanf("%d", &v[cont]);
    cont++;
  }
  cont = 0;
  trovato = 0;
  printf("\nInserisci numero da trovare:");
  scanf("%d", &n);
  while ((cont < 10) && (trovato == 0)) {
    if (v[cont] == n) {
      trovato = 1;
      pos = cont;
    }
    cont++;
  }
  if (trovato == 0) {
    printf("\nIl numero non e' stato trovato\n\n");
  } else {
    printf("\nIl numero e' stato trovato alla posizione:%d\n\n", pos + 1);
  }
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jg     1187 <main+0x57>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9f(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1146 <main+0x16>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
cmpl   $0xa,-0x34(%rbp)
mov    %al,-0x41(%rbp)
jge    11cc <main+0x9c>
cmpl   $0x0,-0x3c(%rbp)
sete   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11dc <main+0xac>
jmp    1208 <main+0xd8>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x40(%rbp),%eax
jne    11fa <main+0xca>
movl   $0x1,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b3 <main+0x83>
cmpl   $0x0,-0x3c(%rbp)
jne    1225 <main+0xf5>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1239 <main+0x109>
mov    -0x38(%rbp),%esi
add    $0x1,%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe46(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xeb0(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb0(%rip),%r15
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x34(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
lea    0xdd0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
xchg   %ax,%ax
mov    %esi,%edx
mov    0x10(%rsp,%rbx,4),%ecx
mov    %ebx,%esi
cmp    %eax,%ecx
cmovne %edx,%esi
je     127c <main+0x13c>
lea    0x1(%rbx),%rdx
cmp    $0x9,%rbx
mov    %rdx,%rbx
jb     1260 <main+0x120>
cmp    %eax,%ecx
jne    1293 <main+0x153>
add    $0x1,%esi
lea    0xdaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    129f <main+0x15f>
lea    0xdd0(%rip),%rdi
call   1030 <puts@plt>
lea    0xdbe(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0AInserisci numero:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\0AInserisci numero da trovare:\00"
@.str.3 = [34 x i8] c"\0AIl numero non e' stato trovato\0A\0A\00"
@.str.4 = [48 x i8] c"\0AIl numero e' stato trovato alla posizione:%d\0A\0A\00"
@.str.5 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %7
7: ; preds = %10, %0
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 9
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
store i32 0, i32* %3
store i32 0, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %21
21: ; preds = %38, %18
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 0
br label %27
27: ; preds = %24, %21
%28 = phi i1 [ false, %21 ], [ %26, %24 ]
br i1 %28, label %29, label %41
29: ; preds = %27
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %29
store i32 1, i32* %5
%37 = load i32, i32* %3
store i32 %37, i32* %4
br label %38
38: ; preds = %36, %29
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %21
41: ; preds = %27
%42 = load i32, i32* %5
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %50
46: ; preds = %41
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %46, %44
%51 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0AInserisci numero:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\0AInserisci numero da trovare:\00"
@.str.4 = [48 x i8] c"\0AIl numero e' stato trovato alla posizione:%d\0A\0A\00"
@.str.5 = [6 x i8] c"PAUSE\00"
@str = [33 x i8] c"\0AIl numero non e' stato trovato\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%21 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%24 = getelementptr inbounds [10 x i32], [10 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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%27 = getelementptr inbounds [10 x i32], [10 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 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* %2)
%37 = load i32, i32* %2
br label %38
38: ; preds = %0, %38
%39 = phi i64 [ 0, %0 ], [ %46, %38 ]
%40 = phi i32 [ undef, %0 ], [ %45, %38 ]
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %39
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, %37
%44 = trunc i64 %39 to i32
%45 = select i1 %43, i32 %44, i32 %40
%46 = add nuw nsw i64 %39, 1
%47 = icmp ugt i64 %39, 8
%48 = or i1 %43, %47
br i1 %48, label %49, label %38
49: ; preds = %38
br i1 %43, label %52, label %50
50: ; preds = %49
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %55
52: ; preds = %49
%53 = add nsw i32 %45, 1
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %52, %50
%56 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}