#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 */
struct node *clear(struct node *);
int /*<<< orphan*/ clear_screen(struct node *);
int /*<<< orphan*/ entering_menu(struct node **, struct node **);
struct node *insert_middle(struct node *, int, int);
int /*<<< orphan*/ print_colors(struct node *);
int /*<<< orphan*/ printf(char *);
struct node *removing_entries(struct node *);
int /*<<< orphan*/ scanf(char *, ...);
struct node *sort_menu(struct node *);
void the_menu(struct node *head, struct node *tail) {
  char choice[2];
  int place, number;
  do {
    printf("\nWould you like to... \nenter numbers, ");
    printf("sort, remove, print, delete list, ");
    printf("clear screen, insert pointer, or quit?");
    printf("\n(e/s/r/p/d/c/i/q) ");
    scanf("%s", choice);
    if (choice[0] == 'e') {
      entering_menu(&head, &tail);
    } else if (choice[0] == 's') {
      head = sort_menu(head);
    } else if (choice[0] == 'r') {
      head = removing_entries(head);
    } else if (choice[0] == 'p') {
      print_colors(head);
    } else if (choice[0] == 'c') {
      clear_screen(head);
    } else if (choice[0] == 'd') {
      head = clear(head);
    } else if (choice[0] == 'i') {
      printf("Enter your place: ");
      scanf("%d", &place);
      printf("Enter your number: ");
      scanf("%d", &number);
      head = insert_middle(head, place, number);
    }
  } while (choice[0] != 'q');
}


x86 assembly (clang, -O0):
<the_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8b(%rip),%rdi
call   1050 <printf@plt>
lea    0xea6(%rip),%rdi
call   1050 <printf@plt>
lea    -0x12(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
movsbl -0x12(%rbp),%eax
cmp    $0x65,%eax
jne    1201 <the_menu+0x71>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   10b0 <entering_menu@plt>
jmp    130e <the_menu+0x17e>
movsbl -0x12(%rbp),%eax
cmp    $0x73,%eax
jne    1220 <the_menu+0x90>
mov    -0x8(%rbp),%rdi
call   1040 <sort_menu@plt>
mov    %rax,-0x8(%rbp)
jmp    1309 <the_menu+0x179>
movsbl -0x12(%rbp),%eax
cmp    $0x72,%eax
jne    123f <the_menu+0xaf>
mov    -0x8(%rbp),%rdi
call   1030 <removing_entries@plt>
mov    %rax,-0x8(%rbp)
jmp    1304 <the_menu+0x174>
movsbl -0x12(%rbp),%eax
cmp    $0x70,%eax
jne    125a <the_menu+0xca>
mov    -0x8(%rbp),%rdi
call   1060 <print_colors@plt>
jmp    12ff <the_menu+0x16f>
movsbl -0x12(%rbp),%eax
cmp    $0x63,%eax
jne    1275 <the_menu+0xe5>
mov    -0x8(%rbp),%rdi
call   1080 <clear_screen@plt>
jmp    12fa <the_menu+0x16a>
movsbl -0x12(%rbp),%eax
cmp    $0x64,%eax
jne    1294 <the_menu+0x104>
mov    -0x8(%rbp),%rdi
call   10a0 <clear@plt>
mov    %rax,-0x8(%rbp)
jmp    12f5 <the_menu+0x165>
movsbl -0x12(%rbp),%eax
cmp    $0x69,%eax
jne    12f0 <the_menu+0x160>
lea    0xde0(%rip),%rdi
call   1050 <printf@plt>
lea    0xde7(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
lea    0xdc9(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1090 <insert_middle@plt>
mov    %rax,-0x8(%rbp)
jmp    12f5 <the_menu+0x165>
jmp    12fa <the_menu+0x16a>
jmp    12ff <the_menu+0x16f>
jmp    1304 <the_menu+0x174>
jmp    1309 <the_menu+0x179>
jmp    130e <the_menu+0x17e>
jmp    1313 <the_menu+0x183>
movsbl -0x12(%rbp),%eax
cmp    $0x71,%eax
jne    11a0 <the_menu+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<the_menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,0x8(%rsp)
mov    %rsi,0x20(%rsp)
lea    0xebc(%rip),%rbx
lea    0xed8(%rip),%rbp
lea    0xef8(%rip),%r15
lea    0xf05(%rip),%r12
lea    0x16(%rsp),%r13
lea    0xe30(%rip),%r14
jmp    11ee <the_menu+0x5e>
mov    0x8(%rsp),%rdi
call   10a0 <clear@plt>
mov    %rax,0x8(%rsp)
movzbl 0x16(%rsp),%eax
cmp    $0x71,%al
je     12ec <the_menu+0x15c>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movzbl 0x16(%rsp),%eax
lea    -0x63(%rax),%ecx
cmp    $0x10,%cl
ja     11e6 <the_menu+0x56>
movzbl %cl,%ecx
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
mov    0x8(%rsp),%rdi
call   1080 <clear_screen@plt>
jmp    11e1 <the_menu+0x51>
mov    0x8(%rsp),%rdi
call   1030 <removing_entries@plt>
jmp    11dc <the_menu+0x4c>
lea    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   10b0 <entering_menu@plt>
jmp    11e1 <the_menu+0x51>
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
mov    %r13,%r14
mov    %r12,%r13
mov    %r15,%r12
lea    0xe62(%rip),%r15
mov    %r15,%rdi
lea    0x1c(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%r15
mov    %r13,%r12
mov    %r14,%r13
lea    0xd55(%rip),%r14
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%rdi
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%edx
call   1090 <insert_middle@plt>
jmp    11dc <the_menu+0x4c>
mov    0x8(%rsp),%rdi
call   1060 <print_colors@plt>
jmp    11e1 <the_menu+0x51>
mov    0x8(%rsp),%rdi
call   1040 <sort_menu@plt>
jmp    11dc <the_menu+0x4c>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [39 x i8] c"\0AWould you like to... \0Aenter numbers, \00"
@.str.1 = [35 x i8] c"sort, remove, print, delete list, \00"
@.str.2 = [39 x i8] c"clear screen, insert pointer, or quit?\00"
@.str.3 = [20 x i8] c"\0A(e/s/r/p/d/c/i/q) \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [19 x i8] c"Enter your place: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [20 x i8] c"Enter your number: \00"
define void @the_menu(%struct.node* %0, %struct.node* %1) {
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca [2 x i8]
%6 = alloca i32
%7 = alloca i32
store %struct.node* %0, %struct.node** %3
store %struct.node* %1, %struct.node** %4
br label %8
8: ; preds = %82, %2
%9 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 101
br i1 %18, label %19, label %21
19: ; preds = %8
%20 = call i32 @entering_menu(%struct.node** %3, %struct.node** %4)
br label %81
21: ; preds = %8
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 115
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load %struct.node*, %struct.node** %3
%28 = call %struct.node* @sort_menu(%struct.node* %27)
store %struct.node* %28, %struct.node** %3
br label %80
29: ; preds = %21
%30 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 114
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load %struct.node*, %struct.node** %3
%36 = call %struct.node* @removing_entries(%struct.node* %35)
store %struct.node* %36, %struct.node** %3
br label %79
37: ; preds = %29
%38 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 112
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load %struct.node*, %struct.node** %3
%44 = call i32 @print_colors(%struct.node* %43)
br label %78
45: ; preds = %37
%46 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 99
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load %struct.node*, %struct.node** %3
%52 = call i32 @clear_screen(%struct.node* %51)
br label %77
53: ; preds = %45
%54 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 100
br i1 %57, label %58, label %61
58: ; preds = %53
%59 = load %struct.node*, %struct.node** %3
%60 = call %struct.node* @clear(%struct.node* %59)
store %struct.node* %60, %struct.node** %3
br label %76
61: ; preds = %53
%62 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 105
br i1 %65, label %66, label %75
66: ; preds = %61
%67 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%68 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%69 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%70 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%71 = load %struct.node*, %struct.node** %3
%72 = load i32, i32* %6
%73 = load i32, i32* %7
%74 = call %struct.node* @insert_middle(%struct.node* %71, i32 %72, i32 %73)
store %struct.node* %74, %struct.node** %3
br label %75
75: ; preds = %66, %61
br label %76
76: ; preds = %75, %58
br label %77
77: ; preds = %76, %50
br label %78
78: ; preds = %77, %42
br label %79
79: ; preds = %78, %34
br label %80
80: ; preds = %79, %26
br label %81
81: ; preds = %80, %19
br label %82
82: ; preds = %81
%83 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp ne i32 %85, 113
br i1 %86, label %8, label %87
87: ; preds = %82
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [39 x i8] c"\0AWould you like to... \0Aenter numbers, \00"
@.str.1 = [35 x i8] c"sort, remove, print, delete list, \00"
@.str.2 = [39 x i8] c"clear screen, insert pointer, or quit?\00"
@.str.3 = [20 x i8] c"\0A(e/s/r/p/d/c/i/q) \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [19 x i8] c"Enter your place: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [20 x i8] c"Enter your number: \00"
define void @the_menu(%struct.node* %0, %struct.node* %1) {
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca [2 x i8]
%6 = alloca i32
%7 = alloca i32
store %struct.node* %0, %struct.node** %3
store %struct.node* %1, %struct.node** %4
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%9 = bitcast i32* %6 to i8*
%10 = bitcast i32* %7 to i8*
br label %11
11: ; preds = %46, %2
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%17 = load i8, i8* %8
switch i8 %17, label %46 [
i8 101, label %18
i8 115, label %20
i8 114, label %23
i8 112, label %26
i8 99, label %29
i8 100, label %32
i8 105, label %35
]
18: ; preds = %11
%19 = call i32 @entering_menu(%struct.node** %3, %struct.node** %4)
br label %44
20: ; preds = %11
%21 = load %struct.node*, %struct.node** %3
%22 = call %struct.node* @sort_menu(%struct.node* %21)
store %struct.node* %22, %struct.node** %3
br label %44
23: ; preds = %11
%24 = load %struct.node*, %struct.node** %3
%25 = call %struct.node* @removing_entries(%struct.node* %24)
store %struct.node* %25, %struct.node** %3
br label %44
26: ; preds = %11
%27 = load %struct.node*, %struct.node** %3
%28 = call i32 @print_colors(%struct.node* %27)
br label %44
29: ; preds = %11
%30 = load %struct.node*, %struct.node** %3
%31 = call i32 @clear_screen(%struct.node* %30)
br label %44
32: ; preds = %11
%33 = load %struct.node*, %struct.node** %3
%34 = call %struct.node* @clear(%struct.node* %33)
store %struct.node* %34, %struct.node** %3
br label %44
35: ; preds = %11
%36 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%40 = load %struct.node*, %struct.node** %3
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = call %struct.node* @insert_middle(%struct.node* %40, i32 %41, i32 %42)
store %struct.node* %43, %struct.node** %3
br label %44
44: ; preds = %20, %26, %32, %35, %29, %23, %18
%45 = load i8, i8* %8
br label %46
46: ; preds = %44, %11
%47 = phi i8 [ %45, %44 ], [ %17, %11 ]
%48 = icmp eq i8 %47, 113
br i1 %48, label %49, label %11
49: ; preds = %46
ret void
}