#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*/ DeleteEnd();
int /*<<< orphan*/ DeleteKth();
int /*<<< orphan*/ DeleteStart();
int /*<<< orphan*/ InsertEnd();
int /*<<< orphan*/ InsertKth();
int /*<<< orphan*/ InsertStart();
int /*<<< orphan*/ Print();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  do {
    printf("1. Print\n");
    printf("2. Insert at Start\n");
    printf("3. Insert at End\n");
    printf("4. Insert at Kth\n");
    printf("5. Delete at Start\n");
    printf("6. Delete at End\n");
    printf("7. Delete at Kth\n");
    printf("0. Exit\n");
    printf("Input: ");
    scanf("%d", &n);
    switch (n) {
    case 1:
      Print();
      break;
    case 2:
      InsertStart();
      break;
    case 3:
      InsertEnd();
      break;
    case 4:
      InsertKth();
      break;
    case 5:
      DeleteStart();
      break;
    case 6:
      DeleteEnd();
      break;
    case 7:
      DeleteKth();
      break;
    case 0:
      break;
    default:
      printf("Invalid Input. Try Again.\n");
    }
  } while (n != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     1299 <main+0x109>
mov    -0x10(%rbp),%rax
lea    0xdc9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10b0 <Print@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   1050 <InsertStart@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   1080 <InsertEnd@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   1070 <InsertKth@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   1030 <DeleteStart@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   1060 <DeleteEnd@plt>
jmp    12a5 <main+0x115>
mov    $0x0,%al
call   10a0 <DeleteKth@plt>
jmp    12a5 <main+0x115>
jmp    12a5 <main+0x115>
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
jmp    12aa <main+0x11a>
cmpl   $0x0,-0x8(%rbp)
jne    119f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xedb(%rip),%r14
lea    0xee5(%rip),%r15
lea    0xe60(%rip),%r12
lea    0xe61(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0xe2d(%rip),%rbp
jmp    11fb <main+0x5b>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x4(%rsp)
je     12d2 <main+0x132>
lea    0xe29(%rip),%rdi
call   1040 <puts@plt>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe32(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x7,%rax
ja     11d5 <main+0x35>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   10c0 <Print@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   1060 <InsertStart@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   1090 <InsertEnd@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   1080 <InsertKth@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   1030 <DeleteStart@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   1070 <DeleteEnd@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
call   10b0 <DeleteKth@plt>
jmp    11f0 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"1. Print\0A\00"
@.str.1 = [20 x i8] c"2. Insert at Start\0A\00"
@.str.2 = [18 x i8] c"3. Insert at End\0A\00"
@.str.3 = [18 x i8] c"4. Insert at Kth\0A\00"
@.str.4 = [20 x i8] c"5. Delete at Start\0A\00"
@.str.5 = [18 x i8] c"6. Delete at End\0A\00"
@.str.6 = [18 x i8] c"7. Delete at Kth\0A\00"
@.str.7 = [9 x i8] c"0. Exit\0A\00"
@.str.8 = [8 x i8] c"Input: \00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [27 x i8] c"Invalid Input. Try Again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %33, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %30 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
i32 5, label %23
i32 6, label %25
i32 7, label %27
i32 0, label %29
]
15: ; preds = %3
%16 = call i32 (...) @Print()
br label %32
17: ; preds = %3
%18 = call i32 (...) @InsertStart()
br label %32
19: ; preds = %3
%20 = call i32 (...) @InsertEnd()
br label %32
21: ; preds = %3
%22 = call i32 (...) @InsertKth()
br label %32
23: ; preds = %3
%24 = call i32 (...) @DeleteStart()
br label %32
25: ; preds = %3
%26 = call i32 (...) @DeleteEnd()
br label %32
27: ; preds = %3
%28 = call i32 (...) @DeleteKth()
br label %32
29: ; preds = %3
br label %32
30: ; preds = %3
%31 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %32
32: ; preds = %30, %29, %27, %25, %23, %21, %19, %17, %15
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = icmp ne i32 %34, 0
br i1 %35, label %3, label %36
36: ; preds = %33
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str.8 = [8 x i8] c"Input: \00"
@.str.9 = [3 x i8] c"%d\00"
@str = [9 x i8] c"1. Print\00"
@str.11 = [19 x i8] c"2. Insert at Start\00"
@str.12 = [17 x i8] c"3. Insert at End\00"
@str.13 = [17 x i8] c"4. Insert at Kth\00"
@str.14 = [19 x i8] c"5. Delete at Start\00"
@str.15 = [17 x i8] c"6. Delete at End\00"
@str.16 = [17 x i8] c"7. Delete at Kth\00"
@str.17 = [8 x i8] c"0. Exit\00"
@str.18 = [26 x i8] c"Invalid Input. Try Again.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %31, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.11, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.13, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.16, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %29 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
i32 5, label %23
i32 6, label %25
i32 7, label %27
i32 0, label %34
]
15: ; preds = %3
%16 = call i32 (...) @Print()
br label %31
17: ; preds = %3
%18 = call i32 (...) @InsertStart()
br label %31
19: ; preds = %3
%20 = call i32 (...) @InsertEnd()
br label %31
21: ; preds = %3
%22 = call i32 (...) @InsertKth()
br label %31
23: ; preds = %3
%24 = call i32 (...) @DeleteStart()
br label %31
25: ; preds = %3
%26 = call i32 (...) @DeleteEnd()
br label %31
27: ; preds = %3
%28 = call i32 (...) @DeleteKth()
br label %31
29: ; preds = %3
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.18, i64 0, i64 0))
br label %31
31: ; preds = %15, %17, %19, %21, %23, %25, %27, %29
%32 = load i32, i32* %1
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %3
34: ; preds = %3, %31
ret i32 0
}