#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();
int /*<<< orphan*/ enqueue();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printQueue();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int choice = 0;
  while (1) {
    printf("1.Insert element to queue \n");
    printf("2.Delete element from queue \n");
    printf("3.Display all elements of queue \n");
    printf("4.Quit \n");
    printf("Please make a selection:");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      enqueue();
      break;
    case 2:
      dequeue();
      break;
    case 3:
      printQueue();
      break;
    case 4:
      exit(0);
    default:
      printf("Please enter a valid input\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1216 <main+0xb6>
mov    -0x10(%rbp),%rax
lea    0xe1e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <enqueue@plt>
jmp    1222 <main+0xc2>
mov    $0x0,%al
call   1040 <dequeue@plt>
jmp    1222 <main+0xc2>
mov    $0x0,%al
call   1080 <printQueue@plt>
jmp    1222 <main+0xc2>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    1176 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeda(%rip),%r12
lea    0xef4(%rip),%r13
lea    0xe78(%rip),%rbx
lea    0xe8a(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xe55(%rip),%r15
jmp    11b7 <main+0x47>
nopl   (%rax)
xor    %eax,%eax
call   1090 <printQueue@plt>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1210 <main+0xa0>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <enqueue@plt>
jmp    11b7 <main+0x47>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
jmp    11b7 <main+0x47>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <dequeue@plt>
jmp    11b7 <main+0x47>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"1.Insert element to queue \0A\00"
@.str.1 = [30 x i8] c"2.Delete element from queue \0A\00"
@.str.2 = [34 x i8] c"3.Display all elements of queue \0A\00"
@.str.3 = [9 x i8] c"4.Quit \0A\00"
@.str.4 = [25 x i8] c"Please make a selection:\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [28 x i8] c"Please enter a valid input\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %21
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
]
11: ; preds = %3
%12 = call i32 (...) @enqueue()
br label %21
13: ; preds = %3
%14 = call i32 (...) @dequeue()
br label %21
15: ; preds = %3
%16 = call i32 (...) @printQueue()
br label %21
17: ; preds = %3
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %3
%20 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11
br label %3
}

LLVM IR (-O2):
@.str.4 = [25 x i8] c"Please make a selection:\00"
@.str.5 = [3 x i8] c"%d\00"
@str = [27 x i8] c"1.Insert element to queue \00"
@str.7 = [29 x i8] c"2.Delete element from queue \00"
@str.8 = [33 x i8] c"3.Display all elements of queue \00"
@str.9 = [8 x i8] c"4.Quit \00"
@str.10 = [27 x i8] c"Please enter a valid input\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %21, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
]
11: ; preds = %3
%12 = call i32 (...) @enqueue()
br label %21
13: ; preds = %3
%14 = call i32 (...) @dequeue()
br label %21
15: ; preds = %3
%16 = call i32 (...) @printQueue()
br label %21
17: ; preds = %3
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %3
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11
br label %3
}