#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 */
struct NODE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_item(struct NODE *, int);
int /*<<< orphan*/ del_item(struct NODE *, int);
int find_item(struct NODE *, int);
int /*<<< orphan*/ free(struct NODE *);
struct NODE *init_items();
int /*<<< orphan*/ print_items(struct NODE *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int num = 0;
  int input = 1;
  int retval = 0;
  struct NODE *llist;
  llist = init_items();
  while (input != 0) {
    printf("\n-- Menu Selection --\n");
    printf("0) Quit\n");
    printf("1) Insert\n");
    printf("2) Delete\n");
    printf("3) Search\n");
    printf("4) Display\n");
    scanf("%d", &input);
    switch (input) {
    case 0:
    default:
      printf("Goodbye ...\n");
      input = 0;
      break;
    case 1:
      printf("Your choice: `Insertion'\n");
      printf("Enter the value which should be inserted: ");
      scanf("%d", &num);
      add_item(llist, num);
      break;
    case 2:
      printf("Your choice: `Deletion'\n");
      printf("Enter the value which should be deleted: ");
      scanf("%d", &num);
      del_item(llist, num);
      break;
    case 3:
      printf("Your choice: `Search'\n");
      printf("Enter the value you want to find: ");
      scanf("%d", &num);
      if ((retval = find_item(llist, num)) == -1)
        printf("Value `%d' not found\n", num);
      else
        printf("Value `%d' located at position `%d'\n", num, retval);
      break;
    case 4:
      printf("You choice: `Display'\n");
      print_items(llist);
      break;
    }
  }
  free(llist);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1090 <init_items@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1372 <main+0x1f2>
lea    0xe54(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1040 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xe4d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
lea    0xe45(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x4,%rax
ja     124f <main+0xcf>
mov    -0x20(%rbp),%rax
lea    0xdbf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    124f <main+0xcf>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    136d <main+0x1ed>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <add_item@plt>
jmp    136d <main+0x1ed>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd98(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <del_item@plt>
jmp    136d <main+0x1ed>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd5b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1070 <find_item@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    133d <main+0x1bd>
mov    -0x8(%rbp),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1351 <main+0x1d1>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    136d <main+0x1ed>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1080 <print_items@plt>
jmp    11af <main+0x2f>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,(%rsp)
movl   $0x1,0x4(%rsp)
xor    %eax,%eax
call   10a0 <init_items@plt>
mov    %rax,%rbx
lea    0xf3d(%rip),%rbp
lea    0xf40(%rip),%r14
lea    0xe47(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe2b(%rip),%r13
jmp    11ff <main+0x6f>
nopw   0x0(%rax,%rax,1)
lea    0xf6d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1090 <print_items@plt>
cmpl   $0x0,0x4(%rsp)
je     134c <main+0x1bc>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10b0 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1340 <main+0x1b0>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rsp,%rsi
call   10b0 <scanf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   1060 <add_item@plt>
jmp    11f4 <main+0x64>
nopl   0x0(%rax)
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rsp,%rsi
call   10b0 <scanf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   1070 <del_item@plt>
jmp    11f4 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
lea    0xd75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rsp,%rsi
call   10b0 <scanf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   1080 <find_item@plt>
mov    (%rsp),%esi
cmp    $0xffffffff,%eax
je     132d <main+0x19d>
lea    0xd82(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11f4 <main+0x64>
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11f4 <main+0x64>
lea    0xe23(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.NODE = type { i32 }
@.str = [23 x i8] c"\0A-- Menu Selection --\0A\00"
@.str.1 = [9 x i8] c"0) Quit\0A\00"
@.str.2 = [11 x i8] c"1) Insert\0A\00"
@.str.3 = [11 x i8] c"2) Delete\0A\00"
@.str.4 = [11 x i8] c"3) Search\0A\00"
@.str.5 = [12 x i8] c"4) Display\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [13 x i8] c"Goodbye ...\0A\00"
@.str.8 = [26 x i8] c"Your choice: `Insertion'\0A\00"
@.str.9 = [43 x i8] c"Enter the value which should be inserted: \00"
@.str.10 = [25 x i8] c"Your choice: `Deletion'\0A\00"
@.str.11 = [42 x i8] c"Enter the value which should be deleted: \00"
@.str.12 = [23 x i8] c"Your choice: `Search'\0A\00"
@.str.13 = [35 x i8] c"Enter the value you want to find: \00"
@.str.14 = [22 x i8] c"Value `%d' not found\0A\00"
@.str.15 = [37 x i8] c"Value `%d' located at position `%d'\0A\00"
@.str.16 = [23 x i8] c"You choice: `Display'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.NODE*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 0, i32* %4
%6 = call %struct.NODE* (...) @init_items()
store %struct.NODE* %6, %struct.NODE** %5
br label %7
7: ; preds = %56, %0
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %57
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
switch i32 %18, label %20 [
i32 0, label %19
i32 1, label %22
i32 2, label %29
i32 3, label %36
i32 4, label %52
]
19: ; preds = %10
br label %20
20: ; preds = %10, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %56
22: ; preds = %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%26 = load %struct.NODE*, %struct.NODE** %5
%27 = load i32, i32* %2
%28 = call i32 @add_item(%struct.NODE* %26, i32 %27)
br label %56
29: ; preds = %10
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%33 = load %struct.NODE*, %struct.NODE** %5
%34 = load i32, i32* %2
%35 = call i32 @del_item(%struct.NODE* %33, i32 %34)
br label %56
36: ; preds = %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%40 = load %struct.NODE*, %struct.NODE** %5
%41 = load i32, i32* %2
%42 = call i32 @find_item(%struct.NODE* %40, i32 %41)
store i32 %42, i32* %4
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %36
%45 = load i32, i32* %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i32 %45)
br label %51
47: ; preds = %36
%48 = load i32, i32* %2
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0), i32 %48, i32 %49)
br label %51
51: ; preds = %47, %44
br label %56
52: ; preds = %10
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
%54 = load %struct.NODE*, %struct.NODE** %5
%55 = call i32 @print_items(%struct.NODE* %54)
br label %56
56: ; preds = %52, %51, %29, %22, %20
br label %7
57: ; preds = %7
%58 = load %struct.NODE*, %struct.NODE** %5
%59 = call i32 @free(%struct.NODE* %58)
ret i32 0
}

LLVM IR (-O2):
%struct.NODE = type { i32 }
@.str.6 = [3 x i8] c"%d\00"
@.str.9 = [43 x i8] c"Enter the value which should be inserted: \00"
@.str.11 = [42 x i8] c"Enter the value which should be deleted: \00"
@.str.13 = [35 x i8] c"Enter the value you want to find: \00"
@.str.14 = [22 x i8] c"Value `%d' not found\0A\00"
@.str.15 = [37 x i8] c"Value `%d' located at position `%d'\0A\00"
@str = [22 x i8] c"\0A-- Menu Selection --\00"
@str.17 = [8 x i8] c"0) Quit\00"
@str.18 = [10 x i8] c"1) Insert\00"
@str.19 = [10 x i8] c"2) Delete\00"
@str.20 = [10 x i8] c"3) Search\00"
@str.21 = [11 x i8] c"4) Display\00"
@str.22 = [22 x i8] c"Your choice: `Search'\00"
@str.23 = [24 x i8] c"Your choice: `Deletion'\00"
@str.24 = [25 x i8] c"Your choice: `Insertion'\00"
@str.25 = [22 x i8] c"You choice: `Display'\00"
@str.26 = [12 x i8] c"Goodbye ...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = tail call %struct.NODE* (...) @init_items()
br label %6
6: ; preds = %0, %44
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.19, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.20, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.21, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %15 [
i32 4, label %41
i32 1, label %17
i32 2, label %23
i32 3, label %29
]
15: ; preds = %6
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.26, i64 0, i64 0))
br label %47
17: ; preds = %6
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.24, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = call i32 @add_item(%struct.NODE* %5, i32 %21)
br label %44
23: ; preds = %6
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.23, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%27 = load i32, i32* %1
%28 = call i32 @del_item(%struct.NODE* %5, i32 %27)
br label %44
29: ; preds = %6
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.22, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%33 = load i32, i32* %1
%34 = call i32 @find_item(%struct.NODE* %5, i32 %33)
%35 = icmp eq i32 %34, -1
%36 = load i32, i32* %1
br i1 %35, label %37, label %39
37: ; preds = %29
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i32 %36)
br label %44
39: ; preds = %29
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0), i32 %36, i32 %34)
br label %44
41: ; preds = %6
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.25, i64 0, i64 0))
%43 = call i32 @print_items(%struct.NODE* %5)
br label %44
44: ; preds = %37, %39, %41, %23, %17
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %6
47: ; preds = %44, %15
%48 = call i32 @free(%struct.NODE* %5)
ret i32 0
}