#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*/ display(int *, int *, int *, int *, int *);
int /*<<< orphan*/ frontdeq(int *, int *, int *, int *);
int /*<<< orphan*/ frontenq(int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reardeq(int *, int *, int *, int *);
int /*<<< orphan*/ rearenq(int *, int *, int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int a[10], i, j, n = 0, k;
  int ff = -1, rf = -1, fr = -1, rr = -1;
  while (1) {
    printf("___MENU___\n1.ENQUEUE\n2.DEQUEUE\n3.DISPLAY\n4.EXIT\n\n");
    printf("Option : ");
    scanf("%d", &i);
    if (i == 1) {
      printf("\nENQUEUE_MENU\n");
      printf("1.Insert at front\n2.Insert at back\n");
      printf("Option : ");
      scanf("%d", &k);
      if (k == 1)
        frontenq(a, &ff, &fr, &n);
      else if (k == 2)
        rearenq(a, &rf, &rr, &n);
      else
        printf("invalid Option...!\n");
    } else if (i == 2) {
      printf("\nDEQUEUE_MENU\n");
      printf("1.Delete at front\n2.Delete at back\n");
      printf("Option : ");
      scanf("%d", &k);
      if (k == 1)
        frontdeq(a, &ff, &fr, &n);
      else if (k == 2)
        reardeq(a, &rf, &rr, &n);
      else
        printf("invalid Option...!\n");
    } else if (i == 3) {
      display(a, &ff, &fr, &rf, &rr);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x3c(%rbp)
movl   $0xffffffff,-0x44(%rbp)
movl   $0xffffffff,-0x48(%rbp)
movl   $0xffffffff,-0x4c(%rbp)
movl   $0xffffffff,-0x50(%rbp)
lea    0xe5e(%rip),%rdi
call   1060 <printf@plt>
lea    0xe84(%rip),%rdi
call   1060 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x34(%rbp)
jne    125f <main+0xef>
lea    0xe6b(%rip),%rdi
call   1060 <printf@plt>
lea    0xe6e(%rip),%rdi
call   1060 <printf@plt>
lea    0xe46(%rip),%rdi
call   1060 <printf@plt>
lea    0xe44(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x40(%rbp)
jne    1225 <main+0xb5>
lea    -0x30(%rbp),%rdi
lea    -0x44(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1080 <frontenq@plt>
jmp    125a <main+0xea>
cmpl   $0x2,-0x40(%rbp)
jne    1249 <main+0xd9>
lea    -0x30(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1070 <rearenq@plt>
jmp    1255 <main+0xe5>
lea    0xe22(%rip),%rdi
call   1060 <printf@plt>
jmp    125a <main+0xea>
jmp    1328 <main+0x1b8>
cmpl   $0x2,-0x34(%rbp)
jne    12fb <main+0x18b>
lea    0xe16(%rip),%rdi
call   1060 <printf@plt>
lea    0xe19(%rip),%rdi
call   1060 <printf@plt>
lea    0xdaa(%rip),%rdi
call   1060 <printf@plt>
lea    0xda8(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x40(%rbp)
jne    12c1 <main+0x151>
lea    -0x30(%rbp),%rdi
lea    -0x44(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1030 <frontdeq@plt>
jmp    12f6 <main+0x186>
cmpl   $0x2,-0x40(%rbp)
jne    12e5 <main+0x175>
lea    -0x30(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1050 <reardeq@plt>
jmp    12f1 <main+0x181>
lea    0xd86(%rip),%rdi
call   1060 <printf@plt>
jmp    12f6 <main+0x186>
jmp    1323 <main+0x1b3>
cmpl   $0x3,-0x34(%rbp)
jne    131e <main+0x1ae>
lea    -0x30(%rbp),%rdi
lea    -0x44(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1040 <display@plt>
jmp    1323 <main+0x1b3>
jmp    1328 <main+0x1b8>
jmp    119b <main+0x2b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x0,0x4(%rsp)
movl   $0xffffffff,0x14(%rsp)
ff
movl   $0xffffffff,0x10(%rsp)
ff
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0xffffffff,0x8(%rsp)
ff
lea    0xe50(%rip),%r14
lea    0xe3c(%rip),%r15
lea    0xe3f(%rip),%rbx
lea    0x1c(%rsp),%r12
lea    0x20(%rsp),%r13
lea    0x18(%rsp),%rbp
jmp    11f0 <main+0x70>
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    $0x3,%eax
je     1280 <main+0x100>
cmp    $0x2,%eax
je     12b0 <main+0x130>
cmp    $0x1,%eax
jne    11f0 <main+0x70>
lea    0xe46(%rip),%rdi
call   1040 <puts@plt>
lea    0xe48(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    $0x2,%eax
je     1309 <main+0x189>
cmp    $0x1,%eax
jne    11dc <main+0x5c>
mov    %r13,%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1090 <frontenq@plt>
jmp    11f0 <main+0x70>
nop
mov    %r13,%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <display@plt>
jmp    11f0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd87(%rip),%rdi
call   1040 <puts@plt>
lea    0xd89(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    $0x2,%eax
je     1325 <main+0x1a5>
cmp    $0x1,%eax
jne    11dc <main+0x5c>
mov    %r13,%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1030 <frontdeq@plt>
jmp    11f0 <main+0x70>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1080 <rearenq@plt>
jmp    11f0 <main+0x70>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1060 <reardeq@plt>
jmp    11f0 <main+0x70>

LLVM IR (-O0):
@.str = [50 x i8] c"___MENU___\0A1.ENQUEUE\0A2.DEQUEUE\0A3.DISPLAY\0A4.EXIT\0A\0A\00"
@.str.1 = [10 x i8] c"Option : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"\0AENQUEUE_MENU\0A\00"
@.str.4 = [36 x i8] c"1.Insert at front\0A2.Insert at back\0A\00"
@.str.5 = [20 x i8] c"invalid Option...!\0A\00"
@.str.6 = [15 x i8] c"\0ADEQUEUE_MENU\0A\00"
@.str.7 = [36 x i8] c"1.Delete at front\0A2.Delete at back\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %4
store i32 -1, i32* %6
store i32 -1, i32* %7
store i32 -1, i32* %8
store i32 -1, i32* %9
br label %10
10: ; preds = %0, %67
%11 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %36
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%25 = call i32 @frontenq(i32* %24, i32* %6, i32* %8, i32* %4)
br label %35
26: ; preds = %16
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%31 = call i32 @rearenq(i32* %30, i32* %7, i32* %9, i32* %4)
br label %34
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34, %23
br label %67
36: ; preds = %10
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %59
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%44 = load i32, i32* %5
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%48 = call i32 @frontdeq(i32* %47, i32* %6, i32* %8, i32* %4)
br label %58
49: ; preds = %39
%50 = load i32, i32* %5
%51 = icmp eq i32 %50, 2
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%54 = call i32 @reardeq(i32* %53, i32* %7, i32* %9, i32* %4)
br label %57
55: ; preds = %49
%56 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %57
57: ; preds = %55, %52
br label %58
58: ; preds = %57, %46
br label %66
59: ; preds = %36
%60 = load i32, i32* %2
%61 = icmp eq i32 %60, 3
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%64 = call i32 @display(i32* %63, i32* %6, i32* %8, i32* %7, i32* %9)
br label %65
65: ; preds = %62, %59
br label %66
66: ; preds = %65, %58
br label %67
67: ; preds = %66, %35
br label %10
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"Option : \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [49 x i8] c"___MENU___\0A1.ENQUEUE\0A2.DEQUEUE\0A3.DISPLAY\0A4.EXIT\0A\00"
@str.8 = [14 x i8] c"\0ADEQUEUE_MENU\00"
@str.9 = [35 x i8] c"1.Delete at front\0A2.Delete at back\00"
@str.11 = [14 x i8] c"\0AENQUEUE_MENU\00"
@str.12 = [35 x i8] c"1.Insert at front\0A2.Insert at back\00"
@str.13 = [19 x i8] c"invalid Option...!\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast [10 x i32]* %1 to i8*
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
store i32 -1, i32* %5
%14 = bitcast i32* %6 to i8*
store i32 -1, i32* %6
%15 = bitcast i32* %7 to i8*
store i32 -1, i32* %7
%16 = bitcast i32* %8 to i8*
store i32 -1, i32* %8
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %18
18: ; preds = %23, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%22 = load i32, i32* %2
switch i32 %22, label %23 [
i32 1, label %24
i32 2, label %36
i32 3, label %48
]
23: ; preds = %18, %44, %46, %42, %48, %30, %34, %32
br label %18
24: ; preds = %18
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%29 = load i32, i32* %4
switch i32 %29, label %34 [
i32 1, label %30
i32 2, label %32
]
30: ; preds = %24
%31 = call i32 @frontenq(i32* %17, i32* %5, i32* %7, i32* %3)
br label %23
32: ; preds = %24
%33 = call i32 @rearenq(i32* %17, i32* %6, i32* %8, i32* %3)
br label %23
34: ; preds = %24
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %23
36: ; preds = %18
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.9, i64 0, i64 0))
%39 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%41 = load i32, i32* %4
switch i32 %41, label %46 [
i32 1, label %42
i32 2, label %44
]
42: ; preds = %36
%43 = call i32 @frontdeq(i32* %17, i32* %5, i32* %7, i32* %3)
br label %23
44: ; preds = %36
%45 = call i32 @reardeq(i32* %17, i32* %6, i32* %8, i32* %3)
br label %23
46: ; preds = %36
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %23
48: ; preds = %18
%49 = call i32 @display(i32* %17, i32* %5, i32* %7, i32* %6, i32* %8)
br label %23
}