#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 RicercaBinaria(int *, int, int, int *);
int RicercaVettoreNonOrdinato(int *, int, int, int *);
int RicercaVettoreOrdinato(int *, int, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int c, lista[10] = {1, 3, 5, 6, 7, 8, 10, 13, 14, 15}, count = 0;
  c = RicercaVettoreNonOrdinato(lista, 10, 13, &count);
  printf("%d, %d", c, count);
  count = 0;
  c = RicercaVettoreOrdinato(lista, 10, 13, &count);
  printf("\n%d, %d", c, count);
  count = 0;
  c = RicercaBinaria(lista, 10, 13, &count);
  printf("\n%d, %d", c, count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
lea    -0x34(%rbp),%rcx
call   1060 <RicercaVettoreNonOrdinato@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x34(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
lea    -0x34(%rbp),%rcx
call   1040 <RicercaVettoreOrdinato@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x34(%rbp),%edx
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
lea    -0x34(%rbp),%rcx
call   1070 <RicercaBinaria@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x34(%rbp),%edx
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    0xed0(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r14
mov    %r15,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1050 <RicercaVettoreNonOrdinato@plt>
mov    0xc(%rsp),%edx
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    %r15,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1040 <RicercaVettoreOrdinato@plt>
mov    0xc(%rsp),%edx
lea    0xe5a(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    %r15,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1060 <RicercaBinaria@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.lista = [10 x i32] [i32 1, i32 3, i32 5, i32 6, i32 7, i32 8, i32 10, i32 13, i32 14, i32 15]
@.str = [7 x i8] c"%d, %d\00"
@.str.1 = [8 x i8] c"\0A%d, %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @RicercaVettoreNonOrdinato(i32* %5, i32 10, i32 13, i32* %3)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
store i32 0, i32* %3
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = call i32 @RicercaVettoreOrdinato(i32* %10, i32 10, i32 13, i32* %3)
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
store i32 0, i32* %3
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%16 = call i32 @RicercaBinaria(i32* %15, i32 10, i32 13, i32* %3)
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = load i32, i32* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.lista = [10 x i32] [i32 1, i32 3, i32 5, i32 6, i32 7, i32 8, i32 10, i32 13, i32 14, i32 15]
@.str = [7 x i8] c"%d, %d\00"
@.str.1 = [8 x i8] c"\0A%d, %d\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*
store i32 0, i32* %2
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @RicercaVettoreNonOrdinato(i32* %5, i32 10, i32 13, i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
store i32 0, i32* %2
%9 = call i32 @RicercaVettoreOrdinato(i32* %5, i32 10, i32 13, i32* %2)
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
store i32 0, i32* %2
%12 = call i32 @RicercaBinaria(i32* %5, i32 10, i32 13, i32* %2)
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
ret i32 0
}