#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 cerca(char **, int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void ricerca(char **p, int n) {
  char inp[25 + 1];
  printf("Parola da ricercare: ");
  scanf("%s", inp);
  if (cerca(p, n, inp) == -1)
    printf("Parola non trovata\n\n");
  else
    printf("Parola trovata in poszione %d\n\n", cerca(p, n, inp));
}


x86 assembly (clang, -O0):
<ricerca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1040 <cerca@plt>
cmp    $0xffffffff,%eax
jne    1189 <ricerca+0x59>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <ricerca+0x79>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1040 <cerca@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ricerca>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1050 <cerca@plt>
cmp    $0xffffffff,%eax
je     119e <ricerca+0x5e>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <cerca@plt>
lea    0xe86(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <ricerca+0x6a>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Parola da ricercare: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [21 x i8] c"Parola non trovata\0A\0A\00"
@.str.3 = [32 x i8] c"Parola trovata in poszione %d\0A\0A\00"
define void @ricerca(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca [26 x i8]
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8**, i8*** %3
%10 = load i32, i32* %4
%11 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%12 = call i32 @cerca(i8** %9, i32 %10, i8* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %22
16: ; preds = %2
%17 = load i8**, i8*** %3
%18 = load i32, i32* %4
%19 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%20 = call i32 @cerca(i8** %17, i32 %18, i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %16, %14
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Parola da ricercare: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [32 x i8] c"Parola trovata in poszione %d\0A\0A\00"
@str = [20 x i8] c"Parola non trovata\0A\00"
define void @ricerca(i8** %0, i32 %1) {
%3 = alloca [26 x i8]
%4 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @cerca(i8** %0, i32 %1, i8* %4)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %14
11: ; preds = %2
%12 = call i32 @cerca(i8** %0, i32 %1, i8* %4)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %9
ret void
}