#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 Dequeue();
int /*<<< orphan*/ Display();
int /*<<< orphan*/ Enqueue(int);
int Front();
int /*<<< orphan*/ is_empty();
int /*<<< orphan*/ is_full();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int choice, element, flag = 1, temp;
  while (flag) {
    printf("\n\nQueue Operations");
    printf("\n----------------");
    printf("\n1. Enqueue");
    printf("\n2. Dequeue");
    printf("\n3. Front");
    printf("\n4. Display");
    printf("\n5. Exit");
    printf("\n----------------");
    printf("\nEnter your choice: ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      if (!is_full()) {
        printf("\nEnter the element to be enqueued: ");
        scanf("%d", &element);
        Enqueue(element);
        printf("\nEnqueued element: %d", element);
      } else {
        printf("\nError: Queue is full");
      }
      break;
    case 2:
      if (!is_empty()) {
        temp = Dequeue();
        printf("\nDequeued element: %d", temp);
      } else {
        printf("\nError: Queue is empty");
      }
      break;
    case 3:
      if (!is_empty()) {
        temp = Front();
        printf("\nFront element: %d", temp);
      }
      break;
    case 4:
      Display();
      break;
    case 5:
      flag = 0;
      break;
    default:
      printf("\nInvalid Choice");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1359 <main+0x1d9>
lea    0xe74(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe73(%rip),%rdi
mov    %rdi,-0x28(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x19(%rbp),%al
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1346 <main+0x1c6>
mov    -0x18(%rbp),%rax
lea    0xdad(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <is_full@plt>
cmp    $0x0,%eax
jne    12a8 <main+0x128>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe67(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <Enqueue@plt>
mov    -0x8(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12b6 <main+0x136>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1354 <main+0x1d4>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%eax
jne    12eb <main+0x16b>
mov    $0x0,%al
call   10a0 <Dequeue@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f9 <main+0x179>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1354 <main+0x1d4>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%eax
jne    1329 <main+0x1a9>
mov    $0x0,%al
call   1060 <Front@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1354 <main+0x1d4>
mov    $0x0,%al
call   1070 <Display@plt>
jmp    1354 <main+0x1d4>
movl   $0x0,-0xc(%rbp)
jmp    1354 <main+0x1d4>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118f <main+0xf>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe95(%rip),%rbx
lea    0xece(%rip),%r14
lea    0xed0(%rip),%r15
lea    0xf41(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xe4d(%rip),%rbp
jmp    11c3 <main+0x43>
lea    0xf59(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11b5 <main+0x35>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <is_full@plt>
test   %eax,%eax
je     12af <main+0x12f>
lea    0xe57(%rip),%rdi
jmp    11bc <main+0x3c>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %eax,%eax
je     12dc <main+0x15c>
lea    0xe6c(%rip),%rdi
jmp    11bc <main+0x3c>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %eax,%eax
jne    11c3 <main+0x43>
xor    %eax,%eax
call   1060 <Front@plt>
lea    0xe61(%rip),%rdi
jmp    12ea <main+0x16a>
xor    %eax,%eax
call   1070 <Display@plt>
jmp    11c3 <main+0x43>
lea    0xdcf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rsp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1030 <Enqueue@plt>
mov    (%rsp),%esi
lea    0xdcf(%rip),%rdi
jmp    12ec <main+0x16c>
xor    %eax,%eax
call   10a0 <Dequeue@plt>
lea    0xdeb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c3 <main+0x43>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0A\0AQueue Operations\00"
@.str.1 = [18 x i8] c"\0A----------------\00"
@.str.2 = [12 x i8] c"\0A1. Enqueue\00"
@.str.3 = [12 x i8] c"\0A2. Dequeue\00"
@.str.4 = [10 x i8] c"\0A3. Front\00"
@.str.5 = [12 x i8] c"\0A4. Display\00"
@.str.6 = [9 x i8] c"\0A5. Exit\00"
@.str.7 = [21 x i8] c"\0AEnter your choice: \00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [36 x i8] c"\0AEnter the element to be enqueued: \00"
@.str.10 = [22 x i8] c"\0AEnqueued element: %d\00"
@.str.11 = [22 x i8] c"\0AError: Queue is full\00"
@.str.12 = [22 x i8] c"\0ADequeued element: %d\00"
@.str.13 = [23 x i8] c"\0AError: Queue is empty\00"
@.str.14 = [19 x i8] c"\0AFront element: %d\00"
@.str.15 = [16 x i8] c"\0AInvalid Choice\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %3
br label %5
5: ; preds = %56, %0
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %57
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
switch i32 %19, label %54 [
i32 1, label %20
i32 2, label %33
i32 3, label %43
i32 4, label %51
i32 5, label %53
]
20: ; preds = %8
%21 = call i32 (...) @is_full()
%22 = icmp ne i32 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%26 = load i32, i32* %2
%27 = call i32 @Enqueue(i32 %26)
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %28)
br label %32
30: ; preds = %20
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %32
32: ; preds = %30, %23
br label %56
33: ; preds = %8
%34 = call i32 (...) @is_empty()
%35 = icmp ne i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = call i32 (...) @Dequeue()
store i32 %37, i32* %4
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %38)
br label %42
40: ; preds = %33
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
br label %56
43: ; preds = %8
%44 = call i32 (...) @is_empty()
%45 = icmp ne i32 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %43
%47 = call i32 (...) @Front()
store i32 %47, i32* %4
%48 = load i32, i32* %4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %46, %43
br label %56
51: ; preds = %8
%52 = call i32 (...) @Display()
br label %56
53: ; preds = %8
store i32 0, i32* %3
br label %56
54: ; preds = %8
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
br label %56
56: ; preds = %54, %53, %51, %50, %42, %32
br label %5
57: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0A\0AQueue Operations\00"
@.str.1 = [18 x i8] c"\0A----------------\00"
@.str.2 = [12 x i8] c"\0A1. Enqueue\00"
@.str.3 = [12 x i8] c"\0A2. Dequeue\00"
@.str.4 = [10 x i8] c"\0A3. Front\00"
@.str.5 = [12 x i8] c"\0A4. Display\00"
@.str.6 = [9 x i8] c"\0A5. Exit\00"
@.str.7 = [21 x i8] c"\0AEnter your choice: \00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [36 x i8] c"\0AEnter the element to be enqueued: \00"
@.str.10 = [22 x i8] c"\0AEnqueued element: %d\00"
@.str.11 = [22 x i8] c"\0AError: Queue is full\00"
@.str.12 = [22 x i8] c"\0ADequeued element: %d\00"
@.str.13 = [23 x i8] c"\0AError: Queue is empty\00"
@.str.14 = [19 x i8] c"\0AFront element: %d\00"
@.str.15 = [16 x i8] c"\0AInvalid Choice\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %40, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
switch i32 %16, label %46 [
i32 1, label %17
i32 2, label %29
i32 3, label %37
i32 4, label %44
i32 5, label %48
]
17: ; preds = %5
%18 = call i32 (...) @is_full()
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
%24 = call i32 @Enqueue(i32 %23)
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %25)
br label %40
27: ; preds = %17
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %40
29: ; preds = %5
%30 = call i32 (...) @is_empty()
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = call i32 (...) @Dequeue()
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %33)
br label %40
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %40
37: ; preds = %5
%38 = call i32 (...) @is_empty()
%39 = icmp eq i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %37, %41, %32, %35, %20, %27, %46, %44
br label %5
41: ; preds = %37
%42 = call i32 (...) @Front()
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 %42)
br label %40
44: ; preds = %5
%45 = call i32 (...) @Display()
br label %40
46: ; preds = %5
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
br label %40
48: ; preds = %5
ret void
}