#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] = {5, 9, 16, 10, 4, 3, 7, 11, 1, 0};
  int trovato;
  int n;
  int i;
  printf("Inserisci il numero da cercare:  ");
  scanf("%d", &n);
  i = 0;
  trovato = 0;
  while ((trovato == 0) && (i < 10)) {
    if (v[i] == n) {
      printf("La posizione e': %d ", i);
      trovato++;
    } else {
      i++;
    }
  }
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x34(%rbp)
mov    %al,-0x3d(%rbp)
jne    11a9 <main+0x69>
cmpl   $0xa,-0x3c(%rbp)
setl   %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    11b9 <main+0x79>
jmp    11f7 <main+0xb7>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jne    11e9 <main+0xa9>
mov    -0x3c(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f2 <main+0xb2>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1190 <main+0x50>
lea    0xe64(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeec(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xea3(%rip),%rax
mov    0xc(%rsp),%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rax),%edx
cmp    %ecx,%edx
je     1188 <main+0x58>
je     1198 <main+0x68>
lea    0x1(%rbx),%edx
add    $0x4,%rax
cmp    $0x9,%ebx
mov    %edx,%ebx
jb     1170 <main+0x40>
jmp    1198 <main+0x68>
lea    0xebe(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.v = [10 x i32] [i32 5, i32 9, i32 16, i32 10, i32 4, i32 3, i32 7, i32 11, i32 1, i32 0]
@.str = [34 x i8] c"Inserisci il numero da cercare: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"La posizione e': %d \00"
@.str.3 = [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
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
store i32 0, i32* %3
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 10
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ false, %9 ], [ %14, %12 ]
br i1 %16, label %17, label %33
17: ; preds = %15
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %32
29: ; preds = %17
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %32
32: ; preds = %29, %24
br label %9
33: ; preds = %15
%34 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@__const.main.v = [10 x i32] [i32 5, i32 9, i32 16, i32 10, i32 4, i32 3, i32 7, i32 11, i32 1, i32 0]
@.str = [34 x i8] c"Inserisci il numero da cercare: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"La posizione e': %d \00"
@.str.3 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
br label %6
6: ; preds = %0, %14
%7 = phi i32 [ 0, %0 ], [ %15, %14 ]
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.v, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %5
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %19
14: ; preds = %6
%15 = add nuw nsw i32 %7, 1
%16 = xor i1 %11, true
%17 = icmp ult i32 %7, 9
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %6, label %19
19: ; preds = %14, %12
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}