#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*/ create_ll();
int /*<<< orphan*/ delete_beg();
int /*<<< orphan*/ delete_end();
int /*<<< orphan*/ display();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ insert_beg();
int /*<<< orphan*/ insert_end();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int operation;
  while (1) {
    printf("Enter the operation to perform:\n");
    printf("\"1\" for creation.\n\"2\" for insertion at the beginning.\n\"3\" "
           "for insertion at the end.\n\"4\" for deletion at the "
           "beginning.\n\"5\" for deletion at the end.\n\"6\" to "
           "display\n\"7\" to exit.\nOperation: ");
    scanf("%d", &operation);
    switch (operation) {
    case 1:
      create_ll();
      break;
    case 2:
      insert_beg();
      break;
    case 3:
      insert_end();
      break;
    case 4:
      delete_beg();
      break;
    case 5:
      delete_end();
      break;
    case 6:
      display();
      break;
    case 7:
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe7d(%rip),%rdi
call   1060 <printf@plt>
lea    0xe92(%rip),%rdi
call   1060 <printf@plt>
lea    0xf42(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     1238 <main+0xa8>
mov    -0x10(%rbp),%rax
lea    0xe20(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <create_ll@plt>
jmp    1238 <main+0xa8>
mov    $0x0,%al
call   1030 <insert_beg@plt>
jmp    1238 <main+0xa8>
mov    $0x0,%al
call   1040 <insert_end@plt>
jmp    1238 <main+0xa8>
mov    $0x0,%al
call   1080 <delete_beg@plt>
jmp    1238 <main+0xa8>
mov    $0x0,%al
call   1070 <delete_end@plt>
jmp    1238 <main+0xa8>
mov    $0x0,%al
call   1050 <display@plt>
jmp    1238 <main+0xa8>
xor    %edi,%edi
call   10b0 <exit@plt>
jmp    1198 <main+0x8>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xf27(%rip),%r14
lea    0xe61(%rip),%r15
lea    0xf16(%rip),%r12
lea    0xc(%rsp),%r13
lea    0xe32(%rip),%rbx
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1060 <display@plt>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     11e0 <main+0x40>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <create_ll@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1030 <insert_beg@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1050 <insert_end@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1090 <delete_beg@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1080 <delete_end@plt>
jmp    11e0 <main+0x40>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Enter the operation to perform:\0A\00"
@.str.1 = [188 x i8] c"\221\22 for creation.\0A\222\22 for insertion at the beginning.\0A\223\22 for insertion at the end.\0A\224\22 for deletion at the beginning.\0A\225\22 for deletion at the end.\0A\226\22 to display\0A\227\22 to exit.\0AOperation: \00"
@.str.2 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %0, %21
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, 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 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
]
7: ; preds = %2
%8 = call i32 (...) @create_ll()
br label %21
9: ; preds = %2
%10 = call i32 (...) @insert_beg()
br label %21
11: ; preds = %2
%12 = call i32 (...) @insert_end()
br label %21
13: ; preds = %2
%14 = call i32 (...) @delete_beg()
br label %21
15: ; preds = %2
%16 = call i32 (...) @delete_end()
br label %21
17: ; preds = %2
%18 = call i32 (...) @display()
br label %21
19: ; preds = %2
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2, %17, %15, %13, %11, %9, %7
br label %2
}

LLVM IR (-O2):
@.str.1 = [188 x i8] c"\221\22 for creation.\0A\222\22 for insertion at the beginning.\0A\223\22 for insertion at the end.\0A\224\22 for deletion at the beginning.\0A\225\22 for deletion at the end.\0A\226\22 to display\0A\227\22 to exit.\0AOperation: \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [32 x i8] c"Enter the operation to perform:\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %8, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([188 x i8], [188 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %8 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 6, label %19
i32 7, label %21
]
8: ; preds = %3, %19, %17, %15, %13, %11, %9
br label %3
9: ; preds = %3
%10 = call i32 (...) @create_ll()
br label %8
11: ; preds = %3
%12 = call i32 (...) @insert_beg()
br label %8
13: ; preds = %3
%14 = call i32 (...) @insert_end()
br label %8
15: ; preds = %3
%16 = call i32 (...) @delete_beg()
br label %8
17: ; preds = %3
%18 = call i32 (...) @delete_end()
br label %8
19: ; preds = %3
%20 = call i32 (...) @display()
br label %8
21: ; preds = %3
%22 = call i32 @exit(i32 0)
unreachable
}