#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*/ del_beg();
int /*<<< orphan*/ del_end();
int /*<<< orphan*/ display();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ ins_beg();
int /*<<< orphan*/ ins_end();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  int choice;
  do {
    printf("1)Insert at begining\n2)Insert at end\n4)Delete at "
           "beginging\n5)Delete at end\n7)Display\n8)Exit\n");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      ins_beg();
      break;
    case 2:
      ins_end();
      break;
      break;
    case 4:
      del_beg();
      break;
    case 5:
      del_end();
      break;
    case 7:
      display();
      break;
    case 8:
      exit(0);
    }
  } while (choice != 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1060 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     1217 <main+0x97>
mov    -0x18(%rbp),%rax
lea    0xe35(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <ins_beg@plt>
jmp    1217 <main+0x97>
mov    $0x0,%al
call   1030 <ins_end@plt>
jmp    1217 <main+0x97>
mov    $0x0,%al
call   10a0 <del_beg@plt>
jmp    1217 <main+0x97>
mov    $0x0,%al
call   1070 <del_end@plt>
jmp    1217 <main+0x97>
mov    $0x0,%al
call   1040 <display@plt>
jmp    1217 <main+0x97>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    121c <main+0x9c>
cmpl   $0x8,-0xc(%rbp)
jne    118f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe94(%rip),%r14
lea    0xe8a(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe5e(%rip),%rbx
jmp    11b9 <main+0x39>
xor    %eax,%eax
call   1060 <ins_beg@plt>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
cmp    $0x8,%eax
je     1205 <main+0x85>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
ja     11b4 <main+0x34>
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1040 <ins_end@plt>
jmp    11b0 <main+0x30>
xor    %eax,%eax
call   10a0 <del_beg@plt>
jmp    11b0 <main+0x30>
xor    %eax,%eax
call   1070 <del_end@plt>
jmp    11b0 <main+0x30>
xor    %eax,%eax
call   1050 <display@plt>
jmp    11b0 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [93 x i8] c"1)Insert at begining\0A2)Insert at end\0A4)Delete at beginging\0A5)Delete at end\0A7)Display\0A8)Exit\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %21, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 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), i32* %3)
%7 = load i32, i32* %3
switch i32 %7, label %20 [
i32 1, label %8
i32 2, label %10
i32 4, label %12
i32 5, label %14
i32 7, label %16
i32 8, label %18
]
8: ; preds = %4
%9 = call i32 (...) @ins_beg()
br label %20
10: ; preds = %4
%11 = call i32 (...) @ins_end()
br label %20
12: ; preds = %4
%13 = call i32 (...) @del_beg()
br label %20
14: ; preds = %4
%15 = call i32 (...) @del_end()
br label %20
16: ; preds = %4
%17 = call i32 (...) @display()
br label %20
18: ; preds = %4
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %4, %16, %14, %12, %10, %8
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 8
br i1 %23, label %4, label %24
24: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [92 x i8] c"1)Insert at begining\0A2)Insert at end\0A4)Delete at beginging\0A5)Delete at end\0A7)Display\0A8)Exit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %21, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %21 [
i32 1, label %7
i32 2, label %9
i32 4, label %11
i32 5, label %13
i32 7, label %15
i32 8, label %17
]
7: ; preds = %3
%8 = call i32 (...) @ins_beg()
br label %19
9: ; preds = %3
%10 = call i32 (...) @ins_end()
br label %19
11: ; preds = %3
%12 = call i32 (...) @del_beg()
br label %19
13: ; preds = %3
%14 = call i32 (...) @del_end()
br label %19
15: ; preds = %3
%16 = call i32 (...) @display()
br label %19
17: ; preds = %3
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %15, %13, %11, %9, %7
%20 = load i32, i32* %1
br label %21
21: ; preds = %19, %3
%22 = phi i32 [ %20, %19 ], [ %6, %3 ]
%23 = icmp eq i32 %22, 8
br i1 %23, label %24, label %3
24: ; preds = %21
ret i32 0
}