#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*/ elimina(char **, int *);
int /*<<< orphan*/ inserisci(char **, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ ricerca(char **, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  char *parola[100];
  int scelta;
  int n = 0;
  int esci = 0;
  printf("======== M E N U ========\n"
         "1 - Inserisci una stringa\n"
         "2 - Elimina una stringa\n"
         "3 - Cerca una stringa\n"
         "4 - Esci dal programma\n\n");
  while (!esci) {
    printf("> ");
    scanf("%d", &scelta);
    switch (scelta) {
    case 1:
      inserisci(parola, &n);
      break;
    case 2:
      elimina(parola, &n);
      break;
    case 3:
      ricerca(parola, n);
      break;
    case 4:
      esci = 1;
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x338(%rbp)
movl   $0x0,-0x33c(%rbp)
lea    0xe8c(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x33c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a2 <main+0x52>
jmp    1249 <main+0xf9>
lea    0xee2(%rip),%rdi
call   1050 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x334(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x334(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x348(%rbp)
sub    $0x3,%eax
ja     1244 <main+0xf4>
mov    -0x348(%rbp),%rax
lea    0xe16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x330(%rbp),%rdi
lea    -0x338(%rbp),%rsi
call   1040 <inserisci@plt>
jmp    1244 <main+0xf4>
lea    -0x330(%rbp),%rdi
lea    -0x338(%rbp),%rsi
call   1070 <elimina@plt>
jmp    1244 <main+0xf4>
lea    -0x330(%rbp),%rdi
mov    -0x338(%rbp),%esi
call   1030 <ricerca@plt>
jmp    1244 <main+0xf4>
movl   $0x1,-0x33c(%rbp)
jmp    1189 <main+0x39>
xor    %eax,%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
movl   $0x0,0x8(%rsp)
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%r14
lea    0xe80(%rip),%r15
lea    0xc(%rsp),%rbx
lea    0xe61(%rip),%rbp
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
jmp    11bc <main+0x5c>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%esi
mov    %r12,%rdi
call   1040 <ricerca@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11bc <main+0x5c>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <inserisci@plt>
jmp    11bc <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
call   1080 <elimina@plt>
jmp    11bc <main+0x5c>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [123 x i8] c"======== M E N U ========\0A1 - Inserisci una stringa\0A2 - Elimina una stringa\0A3 - Cerca una stringa\0A4 - Esci dal programma\0A\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8*]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([123 x i8], [123 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %9
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%18 = load i32, i32* %7
switch i32 %18, label %30 [
i32 1, label %19
i32 2, label %22
i32 3, label %25
i32 4, label %29
]
19: ; preds = %15
%20 = getelementptr inbounds [100 x i8*], [100 x i8*]* %6, i64 0, i64 0
%21 = call i32 @inserisci(i8** %20, i32* %8)
br label %30
22: ; preds = %15
%23 = getelementptr inbounds [100 x i8*], [100 x i8*]* %6, i64 0, i64 0
%24 = call i32 @elimina(i8** %23, i32* %8)
br label %30
25: ; preds = %15
%26 = getelementptr inbounds [100 x i8*], [100 x i8*]* %6, i64 0, i64 0
%27 = load i32, i32* %8
%28 = call i32 @ricerca(i8** %26, i32 %27)
br label %30
29: ; preds = %15
store i32 1, i32* %9
br label %30
30: ; preds = %15, %29, %25, %22, %19
br label %11
31: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [122 x i8] c"======== M E N U ========\0A1 - Inserisci una stringa\0A2 - Elimina una stringa\0A3 - Cerca una stringa\0A4 - Esci dal programma\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8*]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [100 x i8*]* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([122 x i8], [122 x i8]* @str, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8*], [100 x i8*]* %3, i64 0, i64 0
br label %11
11: ; preds = %15, %2
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
switch i32 %14, label %15 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %23
]
15: ; preds = %11, %20, %18, %16
br label %11
16: ; preds = %11
%17 = call i32 @inserisci(i8** %10, i32* %5)
br label %15
18: ; preds = %11
%19 = call i32 @elimina(i8** %10, i32* %5)
br label %15
20: ; preds = %11
%21 = load i32, i32* %5
%22 = call i32 @ricerca(i8** %10, i32 %21)
br label %15
23: ; preds = %11
ret i32 0
}