#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*/ deletef();
int /*<<< orphan*/ deletep();
int /*<<< orphan*/ deleter();
int /*<<< orphan*/ display();
int /*<<< orphan*/ insfrt();
int /*<<< orphan*/ inspos();
int /*<<< orphan*/ insrear();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ search();
int /*<<< orphan*/ sort();
main() {
  int ch, flag = 0;
  while (flag == 0) {
    printf(
        "\n**MENU**\n1-Insert  @front\t2-Insert @rear\t3-Insert @position\n");
    printf("4-Delete @front  \t5-Delete @rear\t6-Delete @position");
    printf("\n7-Search data     \t8.SORT        \t9-Display all\n10-Exit\n");
    printf("Enter Choice\t: ");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      insfrt();
      break;
    case 2:
      insrear();
      break;
    case 3:
      inspos();
      break;
    case 4:
      deletef();
      break;
    case 5:
      deleter();
      break;
    case 6:
      deletep();
      break;
    case 7:
      search();
      break;
    case 8:
      sort();
      break;
    case 9:
      display();
      break;
    case 10:
      flag = 1;
      break;
    default:
      printf("Invalid choice\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    12c2 <main+0x112>
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
lea    0xeab(%rip),%rdi
call   1050 <printf@plt>
lea    0xed9(%rip),%rdi
call   1050 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x9,%eax
ja     12b1 <main+0x101>
mov    -0x18(%rbp),%rax
lea    0xdd0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <insfrt@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1080 <insrear@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1090 <inspos@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1030 <deletef@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   10c0 <deleter@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   10d0 <deletep@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1070 <search@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1060 <sort@plt>
jmp    12bd <main+0x10d>
mov    $0x0,%al
call   1040 <display@plt>
jmp    12bd <main+0x10d>
movl   $0x1,-0xc(%rbp)
jmp    12bd <main+0x10d>
lea    0xe2f(%rip),%rdi
call   1050 <printf@plt>
jmp    11c6 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe56(%rip),%r15
lea    0xed3(%rip),%r12
lea    0xe7c(%rip),%r13
lea    0xe85(%rip),%rbx
lea    0x4(%rsp),%rbp
lea    0xe0d(%rip),%r14
jmp    1200 <main+0x40>
xor    %eax,%eax
call   1050 <display@plt>
nopl   0x0(%rax)
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1060 <printf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10c0 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     124d <main+0x8d>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <insfrt@plt>
jmp    1200 <main+0x40>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   1090 <insrear@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   10a0 <inspos@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   1030 <deletef@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   10d0 <deleter@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   10e0 <deletep@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   1080 <search@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
call   1070 <sort@plt>
jmp    1200 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [62 x i8] c"\0A**MENU**\0A1-Insert @front\092-Insert @rear\093-Insert @position\0A\00"
@.str.1 = [52 x i8] c"4-Delete @front \095-Delete @rear\096-Delete @position\00"
@.str.2 = [58 x i8] c"\0A7-Search data \098.SORT \099-Display all\0A10-Exit\0A\00"
@.str.3 = [16 x i8] c"Enter Choice\09: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [16 x i8] c"Invalid choice\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %35, %0
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %36
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
switch i32 %13, label %33 [
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
i32 5, label %22
i32 6, label %24
i32 7, label %26
i32 8, label %28
i32 9, label %30
i32 10, label %32
]
14: ; preds = %7
%15 = call i32 (...) @insfrt()
br label %35
16: ; preds = %7
%17 = call i32 (...) @insrear()
br label %35
18: ; preds = %7
%19 = call i32 (...) @inspos()
br label %35
20: ; preds = %7
%21 = call i32 (...) @deletef()
br label %35
22: ; preds = %7
%23 = call i32 (...) @deleter()
br label %35
24: ; preds = %7
%25 = call i32 (...) @deletep()
br label %35
26: ; preds = %7
%27 = call i32 (...) @search()
br label %35
28: ; preds = %7
%29 = call i32 (...) @sort()
br label %35
30: ; preds = %7
%31 = call i32 (...) @display()
br label %35
32: ; preds = %7
store i32 1, i32* %3
br label %35
33: ; preds = %7
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %33, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14
br label %4
36: ; preds = %4
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str.1 = [52 x i8] c"4-Delete @front \095-Delete @rear\096-Delete @position\00"
@.str.3 = [16 x i8] c"Enter Choice\09: \00"
@.str.4 = [3 x i8] c"%d\00"
@str = [61 x i8] c"\0A**MENU**\0A1-Insert @front\092-Insert @rear\093-Insert @position\00"
@str.6 = [57 x i8] c"\0A7-Search data \098.SORT \099-Display all\0A10-Exit\00"
@str.7 = [15 x i8] c"Invalid choice\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %30, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.6, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %28 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
i32 5, label %18
i32 6, label %20
i32 7, label %22
i32 8, label %24
i32 9, label %26
i32 10, label %31
]
10: ; preds = %3
%11 = call i32 (...) @insfrt()
br label %30
12: ; preds = %3
%13 = call i32 (...) @insrear()
br label %30
14: ; preds = %3
%15 = call i32 (...) @inspos()
br label %30
16: ; preds = %3
%17 = call i32 (...) @deletef()
br label %30
18: ; preds = %3
%19 = call i32 (...) @deleter()
br label %30
20: ; preds = %3
%21 = call i32 (...) @deletep()
br label %30
22: ; preds = %3
%23 = call i32 (...) @search()
br label %30
24: ; preds = %3
%25 = call i32 (...) @sort()
br label %30
26: ; preds = %3
%27 = call i32 (...) @display()
br label %30
28: ; preds = %3
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
br label %30
30: ; preds = %28, %26, %24, %22, %20, %18, %16, %14, %12, %10
br label %3
31: ; preds = %3
ret i32 0
}