#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*/ delete_first();
int /*<<< orphan*/ delete_last();
int /*<<< orphan*/ display();
int /*<<< orphan*/ insert_first();
int /*<<< orphan*/ insert_info();
int /*<<< orphan*/ insert_last();
int /*<<< orphan*/ insert_node();
int /*<<< orphan*/ insert_pos();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sort();
int main() {
  char ch;
  int choice;
  printf("MAIN MENU \n");
  printf("1.INSERT AT BEGINING \n");
  printf("2.INSERT AT LAST \n");
  printf("3.DELETE AT BEGINING \n");
  printf("4.DELETE AT LAST \n");
  printf("5.SEARCH INFO\n");
  printf("6.SEARCH POSITION \n");
  printf("7.DISPLAY \n");
  printf("8.SORT \n");
  printf("ENTER YOUR CHOICE \n");
  scanf("%d", &choice);
  while (choice < 10) {
    switch (choice) {
    case 1:
      insert_first();
      break;
    case 2:
      insert_last();
      break;
    case 3:
      delete_first();
      break;
    case 4:
      delete_last();
      break;
    case 5:
      insert_info();
      break;
    case 6:
      insert_pos();
      break;
    case 7:
      display();
      break;
    case 8:
      sort();
      break;
    case 9:
      insert_node();
      break;
    }
    printf("\n ENTER YOUR CHOICE \n");
    scanf("%d", &choice);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
lea    0xe85(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0xa,-0xc(%rbp)
jge    1302 <main+0x152>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x8,%eax
ja     12e1 <main+0x131>
mov    -0x18(%rbp),%rax
lea    0xd8f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <insert_first@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   1040 <insert_last@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   1080 <delete_first@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   10d0 <delete_last@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   10c0 <insert_info@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   10b0 <insert_pos@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   1030 <display@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   1060 <sort@plt>
jmp    12e1 <main+0x131>
mov    $0x0,%al
call   1070 <insert_node@plt>
lea    0xdd7(%rip),%rdi
call   1050 <printf@plt>
lea    0xdc8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1090 <scanf@plt>
jmp    1247 <main+0x97>
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    0xe68(%rip),%rdi
call   1030 <puts@plt>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
lea    0xded(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x9,%eax
jg     12f5 <main+0x145>
lea    0xe61(%rip),%r14
lea    0xdc8(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xd98(%rip),%rbx
jmp    129c <main+0xec>
xor    %eax,%eax
call   1070 <insert_node@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xa,%eax
jge    12f5 <main+0x145>
add    $0xffffffff,%eax
cmp    $0x8,%eax
ja     1280 <main+0xd0>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <insert_first@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   1050 <insert_last@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   1080 <delete_first@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   10d0 <delete_last@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   10c0 <insert_info@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   10b0 <insert_pos@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   1040 <display@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   1060 <sort@plt>
jmp    1280 <main+0xd0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"MAIN MENU \0A\00"
@.str.1 = [23 x i8] c"1.INSERT AT BEGINING \0A\00"
@.str.2 = [19 x i8] c"2.INSERT AT LAST \0A\00"
@.str.3 = [23 x i8] c"3.DELETE AT BEGINING \0A\00"
@.str.4 = [19 x i8] c"4.DELETE AT LAST \0A\00"
@.str.5 = [15 x i8] c"5.SEARCH INFO\0A\00"
@.str.6 = [20 x i8] c"6.SEARCH POSITION \0A\00"
@.str.7 = [12 x i8] c"7.DISPLAY \0A\00"
@.str.8 = [9 x i8] c"8.SORT \0A\00"
@.str.9 = [20 x i8] c"ENTER YOUR CHOICE \0A\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [22 x i8] c"\0A ENTER YOUR CHOICE \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %3)
br label %15
15: ; preds = %38, %0
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %41
18: ; preds = %15
%19 = load i32, i32* %3
switch i32 %19, label %38 [
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
i32 5, label %28
i32 6, label %30
i32 7, label %32
i32 8, label %34
i32 9, label %36
]
20: ; preds = %18
%21 = call i32 (...) @insert_first()
br label %38
22: ; preds = %18
%23 = call i32 (...) @insert_last()
br label %38
24: ; preds = %18
%25 = call i32 (...) @delete_first()
br label %38
26: ; preds = %18
%27 = call i32 (...) @delete_last()
br label %38
28: ; preds = %18
%29 = call i32 (...) @insert_info()
br label %38
30: ; preds = %18
%31 = call i32 (...) @insert_pos()
br label %38
32: ; preds = %18
%33 = call i32 (...) @display()
br label %38
34: ; preds = %18
%35 = call i32 (...) @sort()
br label %38
36: ; preds = %18
%37 = call i32 (...) @insert_node()
br label %38
38: ; preds = %18, %36, %34, %32, %30, %28, %26, %24, %22, %20
%39 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %3)
br label %15
41: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str.10 = [3 x i8] c"%d\00"
@str = [11 x i8] c"MAIN MENU \00"
@str.12 = [22 x i8] c"1.INSERT AT BEGINING \00"
@str.13 = [18 x i8] c"2.INSERT AT LAST \00"
@str.14 = [22 x i8] c"3.DELETE AT BEGINING \00"
@str.15 = [18 x i8] c"4.DELETE AT LAST \00"
@str.16 = [14 x i8] c"5.SEARCH INFO\00"
@str.17 = [19 x i8] c"6.SEARCH POSITION \00"
@str.18 = [11 x i8] c"7.DISPLAY \00"
@str.19 = [8 x i8] c"8.SORT \00"
@str.20 = [19 x i8] c"ENTER YOUR CHOICE \00"
@str.21 = [21 x i8] c"\0A ENTER YOUR CHOICE \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.12, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.13, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %41
16: ; preds = %0, %36
%17 = phi i32 [ %39, %36 ], [ %14, %0 ]
switch i32 %17, label %36 [
i32 1, label %18
i32 2, label %20
i32 3, label %22
i32 4, label %24
i32 5, label %26
i32 6, label %28
i32 7, label %30
i32 8, label %32
i32 9, label %34
]
18: ; preds = %16
%19 = call i32 (...) @insert_first()
br label %36
20: ; preds = %16
%21 = call i32 (...) @insert_last()
br label %36
22: ; preds = %16
%23 = call i32 (...) @delete_first()
br label %36
24: ; preds = %16
%25 = call i32 (...) @delete_last()
br label %36
26: ; preds = %16
%27 = call i32 (...) @insert_info()
br label %36
28: ; preds = %16
%29 = call i32 (...) @insert_pos()
br label %36
30: ; preds = %16
%31 = call i32 (...) @display()
br label %36
32: ; preds = %16
%33 = call i32 (...) @sort()
br label %36
34: ; preds = %16
%35 = call i32 (...) @insert_node()
br label %36
36: ; preds = %16, %34, %32, %30, %28, %26, %24, %22, %20, %18
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%39 = load i32, i32* %1
%40 = icmp slt i32 %39, 10
br i1 %40, label %16, label %41
41: ; preds = %36, %0
ret i32 0
}