#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*/ dequeue_front();
int /*<<< orphan*/ dequeue_rear();
int /*<<< orphan*/ display();
int /*<<< orphan*/ enqueue_front(int);
int /*<<< orphan*/ enqueue_rear(int);
int /*<<< orphan*/ initialize();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int choice, item;
  char ans;
  initialize();
  do {
    puts("1. Insertion At Rear \n2. Insertion At Front \n3. Deletion At Front "
         "\n4: Deletion At Rear \n5. Display");
    scanf(" %d%*c", &choice);
    switch (choice) {
    case 1:
      puts("Item?");
      scanf(" %d%*c", &item);
      enqueue_rear(item);
      break;
    case 2:
      puts("Item?");
      scanf(" %d%*c", &item);
      enqueue_front(item);
      break;
    case 3:
      dequeue_front();
      break;
    case 4:
      dequeue_rear();
      break;
    case 5:
      display();
      break;
    }
    puts("Continue?");
    scanf(" %c%*c", &ans);
  } while (ans == 'Y' || ans == 'y');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <initialize@plt>
lea    0xe77(%rip),%rdi
call   1050 <puts@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1252 <main+0xd2>
mov    -0x18(%rbp),%rax
lea    0xe2c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe9a(%rip),%rdi
call   1050 <puts@plt>
lea    0xe87(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1030 <enqueue_rear@plt>
jmp    1252 <main+0xd2>
lea    0xe6f(%rip),%rdi
call   1050 <puts@plt>
lea    0xe5c(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
call   10a0 <enqueue_front@plt>
jmp    1252 <main+0xd2>
mov    $0x0,%al
call   1040 <dequeue_front@plt>
jmp    1252 <main+0xd2>
mov    $0x0,%al
call   1080 <dequeue_rear@plt>
jmp    1252 <main+0xd2>
mov    $0x0,%al
call   1060 <display@plt>
lea    0xe2b(%rip),%rdi
call   1050 <puts@plt>
lea    0xe29(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
movsbl -0xd(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x19(%rbp)
je     128f <main+0x10f>
movsbl -0xd(%rbp),%eax
cmp    $0x79,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1196 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1070 <initialize@plt>
lea    0xedb(%rip),%rbx
lea    0x14(%rsp),%r15
lea    0xedc(%rip),%r12
lea    0xedf(%rip),%r13
lea    0xf(%rsp),%rbp
lea    0xe45(%rip),%r14
jmp    11f4 <main+0x74>
xor    %eax,%eax
call   1060 <display@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
jne    1289 <main+0x109>
lea    0xe19(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11d0 <main+0x50>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
lea    0xe55(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x10(%rsp),%edi
call   1030 <enqueue_rear@plt>
jmp    11d0 <main+0x50>
lea    0xe2f(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x10(%rsp),%edi
call   10a0 <enqueue_front@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1040 <dequeue_front@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1080 <dequeue_rear@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [99 x i8] c"1. Insertion At Rear \0A2. Insertion At Front \0A3. Deletion At Front \0A4: Deletion At Rear \0A5. Display\00"
@.str.1 = [7 x i8] c" %d%*c\00"
@.str.2 = [6 x i8] c"Item?\00"
@.str.3 = [10 x i8] c"Continue?\00"
@.str.4 = [7 x i8] c" %c%*c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (...) @initialize()
br label %6
6: ; preds = %37, %0
%7 = call i32 @puts(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %26 [
i32 1, label %10
i32 2, label %15
i32 3, label %20
i32 4, label %22
i32 5, label %24
]
10: ; preds = %6
%11 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = call i32 @enqueue_rear(i32 %13)
br label %26
15: ; preds = %6
%16 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = call i32 @enqueue_front(i32 %18)
br label %26
20: ; preds = %6
%21 = call i32 (...) @dequeue_front()
br label %26
22: ; preds = %6
%23 = call i32 (...) @dequeue_rear()
br label %26
24: ; preds = %6
%25 = call i32 (...) @display()
br label %26
26: ; preds = %6, %24, %22, %20, %15, %10
%27 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %29
29: ; preds = %26
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 89
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load i8, i8* %4
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 121
br label %37
37: ; preds = %33, %29
%38 = phi i1 [ true, %29 ], [ %36, %33 ]
br i1 %38, label %6, label %39
39: ; preds = %37
ret i32 0
}

LLVM IR (-O2):
@.str = [99 x i8] c"1. Insertion At Rear \0A2. Insertion At Front \0A3. Deletion At Front \0A4: Deletion At Rear \0A5. Display\00"
@.str.1 = [7 x i8] c" %d%*c\00"
@.str.2 = [6 x i8] c"Item?\00"
@.str.3 = [10 x i8] c"Continue?\00"
@.str.4 = [7 x i8] c" %c%*c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 (...) @initialize()
br label %7
7: ; preds = %27, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %27 [
i32 1, label %11
i32 2, label %16
i32 3, label %21
i32 4, label %23
i32 5, label %25
]
11: ; preds = %7
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = call i32 @enqueue_rear(i32 %14)
br label %27
16: ; preds = %7
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = call i32 @enqueue_front(i32 %19)
br label %27
21: ; preds = %7
%22 = call i32 (...) @dequeue_front()
br label %27
23: ; preds = %7
%24 = call i32 (...) @dequeue_rear()
br label %27
25: ; preds = %7
%26 = call i32 (...) @display()
br label %27
27: ; preds = %7, %25, %23, %21, %16, %11
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%30 = load i8, i8* %3
%31 = and i8 %30, -33
%32 = icmp eq i8 %31, 89
br i1 %32, label %7, label %33
33: ; preds = %27
ret i32 0
}