#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*/ 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:
      printf("\nEnter the element to be enqueued: ");
      scanf("%d", &element);
      Enqueue(element);
      printf("\nEnqueued element: %d", element);
      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     1326 <main+0x1b6>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe83(%rip),%rdi
mov    %rdi,-0x28(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x19(%rbp),%al
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%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     1313 <main+0x1a3>
mov    -0x18(%rbp),%rax
lea    0xdbd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe71(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <Enqueue@plt>
mov    -0x8(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1321 <main+0x1b1>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%eax
jne    12b8 <main+0x148>
mov    $0x0,%al
call   1090 <Dequeue@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c6 <main+0x156>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1321 <main+0x1b1>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%eax
jne    12f6 <main+0x186>
mov    $0x0,%al
call   1060 <Front@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1321 <main+0x1b1>
mov    $0x0,%al
call   1070 <Display@plt>
jmp    1321 <main+0x1b1>
movl   $0x0,-0xc(%rbp)
jmp    1321 <main+0x1b1>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117f <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    0xea5(%rip),%rbx
lea    0xede(%rip),%r14
lea    0xee0(%rip),%r15
lea    0xf3b(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xe5d(%rip),%rbp
jmp    11b0 <main+0x40>
xor    %eax,%eax
call   1070 <Display@plt>
nopl   0x0(%rax)
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe62(%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     126c <main+0xfc>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0xe3f(%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    0xe3f(%rip),%rdi
jmp    12c2 <main+0x152>
lea    0xe8c(%rip),%rdi
jmp    1287 <main+0x117>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %eax,%eax
je     12b2 <main+0x142>
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b0 <main+0x40>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %eax,%eax
jne    11b0 <main+0x40>
xor    %eax,%eax
call   1060 <Front@plt>
lea    0xe3c(%rip),%rdi
jmp    12c0 <main+0x150>
xor    %eax,%eax
call   1090 <Dequeue@plt>
lea    0xdff(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b0 <main+0x40>
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"\0ADequeued element: %d\00"
@.str.12 = [23 x i8] c"\0AError: Queue is empty\00"
@.str.13 = [19 x i8] c"\0AFront element: %d\00"
@.str.14 = [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 = %50, %0
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %51
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 %48 [
i32 1, label %20
i32 2, label %27
i32 3, label %37
i32 4, label %45
i32 5, label %47
]
20: ; preds = %8
%21 = call i32 (i8*, ...) @printf(i8* 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* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %25)
br label %50
27: ; preds = %8
%28 = call i32 (...) @is_empty()
%29 = icmp ne i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = call i32 (...) @Dequeue()
store i32 %31, i32* %4
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i32 %32)
br label %36
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %36
36: ; preds = %34, %30
br label %50
37: ; preds = %8
%38 = call i32 (...) @is_empty()
%39 = icmp ne i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %37
%41 = call i32 (...) @Front()
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %40, %37
br label %50
45: ; preds = %8
%46 = call i32 (...) @Display()
br label %50
47: ; preds = %8
store i32 0, i32* %3
br label %50
48: ; preds = %8
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %50
50: ; preds = %48, %47, %45, %44, %36, %20
br label %5
51: ; 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"\0ADequeued element: %d\00"
@.str.12 = [23 x i8] c"\0AError: Queue is empty\00"
@.str.13 = [19 x i8] c"\0AFront element: %d\00"
@.str.14 = [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 = %35, %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 %41 [
i32 1, label %17
i32 2, label %24
i32 3, label %32
i32 4, label %39
i32 5, label %43
]
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%20 = load i32, i32* %2
%21 = call i32 @Enqueue(i32 %20)
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %22)
br label %35
24: ; preds = %5
%25 = call i32 (...) @is_empty()
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 (...) @Dequeue()
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i32 %28)
br label %35
30: ; preds = %24
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %35
32: ; preds = %5
%33 = call i32 (...) @is_empty()
%34 = icmp eq i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %32, %36, %27, %30, %41, %39, %17
br label %5
36: ; preds = %32
%37 = call i32 (...) @Front()
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %37)
br label %35
39: ; preds = %5
%40 = call i32 (...) @Display()
br label %35
41: ; preds = %5
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %35
43: ; preds = %5
ret void
}