#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 *);
main() {
  int n;
  int V[] = {4, 6, 15, 24, 35, 52, 64, 71, 85, 96};
  int I;
  int pos;
  printf("inserisci il numero da ricercare all'interno dell'array: ");
  scanf("%d", &n);
  I = 0;
  while (V[I] != n) {
    I++;
  }
  pos = I;
  if (pos < 10) {
    printf("Numero trovato");
  } else {
    printf("Numero non trovato");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x8(%rbp),%eax
je     1196 <main+0x66>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1177 <main+0x47>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11b7 <main+0x87>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <main+0x93>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xffffffff,%eax
lea    0xeb6(%rip),%rdx
mov    0x4(%rsp),%ecx
xchg   %ax,%ax
add    $0x1,%eax
lea    0x4(%rdx),%rsi
cmp    %ecx,(%rdx)
mov    %rsi,%rdx
jne    1150 <main+0x30>
cmp    $0xa,%eax
lea    0xefd(%rip),%rax
lea    0xf05(%rip),%rdi
cmovb  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.V = [10 x i32] [i32 4, i32 6, i32 15, i32 24, i32 35, i32 52, i32 64, i32 71, i32 85, i32 96]
@.str = [58 x i8] c"inserisci il numero da ricercare all'interno dell'array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Numero trovato\00"
@.str.3 = [19 x i8] c"Numero non trovato\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %3 to i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 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* %2)
store i32 0, i32* %4
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %2
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %9
19: ; preds = %9
%20 = load i32, i32* %4
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %27
25: ; preds = %19
%26 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@__const.main.V = [10 x i32] [i32 4, i32 6, i32 15, i32 24, i32 35, i32 52, i32 64, i32 71, i32 85, i32 96]
@.str = [58 x i8] c"inserisci il numero da ricercare all'interno dell'array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Numero trovato\00"
@.str.3 = [19 x i8] c"Numero non trovato\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 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 = %6, %0
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.V, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, %5
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = trunc i64 %7 to i32
%14 = icmp ult i32 %13, 10
%15 = select i1 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0)
%16 = call i32 @printf(i8* dereferenceable(1) %15)
ret i32 0
}