#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*/ Print();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  do {
    printf("1. Print Queue\n");
    printf("2. Enqueue\n");
    printf("3. Dequeue\n");
    printf("0. Exit\n");
    printf("Input: ");
    scanf("%d", &n);
    switch (n) {
    case 1:
      Print();
      break;
    case 2:
      Enqueue();
      break;
    case 3:
      Dequeue();
      break;
    case 0:
      break;
    default:
      printf("Invalid Input. Try Again.\n");
    }
  } while (n != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     11f9 <main+0xa9>
mov    -0x10(%rbp),%rax
lea    0xe39(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <Print@plt>
jmp    1205 <main+0xb5>
mov    $0x0,%al
call   1030 <Enqueue@plt>
jmp    1205 <main+0xb5>
mov    $0x0,%al
call   1060 <Dequeue@plt>
jmp    1205 <main+0xb5>
jmp    1205 <main+0xb5>
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
jmp    120a <main+0xba>
cmpl   $0x0,-0x8(%rbp)
jne    115f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xec3(%rip),%r12
lea    0xec7(%rip),%r13
lea    0xe90(%rip),%rbx
lea    0xe91(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xe6d(%rip),%r15
jmp    11b3 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
je     1229 <main+0xc9>
lea    0xe61(%rip),%rdi
call   1040 <puts@plt>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%rax
ja     11a0 <main+0x40>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <Print@plt>
jmp    11ac <main+0x4c>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <Enqueue@plt>
jmp    11ac <main+0x4c>
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <Dequeue@plt>
jmp    11ac <main+0x4c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"1. Print Queue\0A\00"
@.str.1 = [12 x i8] c"2. Enqueue\0A\00"
@.str.2 = [12 x i8] c"3. Dequeue\0A\00"
@.str.3 = [9 x i8] c"0. Exit\0A\00"
@.str.4 = [8 x i8] c"Input: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [27 x i8] c"Invalid Input. Try Again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %21, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 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 ([8 x i8], [8 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 %18 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 0, label %17
]
11: ; preds = %3
%12 = call i32 (...) @Print()
br label %20
13: ; preds = %3
%14 = call i32 (...) @Enqueue()
br label %20
15: ; preds = %3
%16 = call i32 (...) @Dequeue()
br label %20
17: ; preds = %3
br label %20
18: ; preds = %3
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %20
20: ; preds = %18, %17, %15, %13, %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %2
%23 = icmp ne i32 %22, 0
br i1 %23, label %3, label %24
24: ; preds = %21
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str.4 = [8 x i8] c"Input: \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [15 x i8] c"1. Print Queue\00"
@str.7 = [11 x i8] c"2. Enqueue\00"
@str.8 = [11 x i8] c"3. Dequeue\00"
@str.9 = [8 x i8] c"0. Exit\00"
@str.10 = [26 x i8] c"Invalid Input. Try Again.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %19, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 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 ([8 x i8], [8 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 %17 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 0, label %22
]
11: ; preds = %3
%12 = call i32 (...) @Print()
br label %19
13: ; preds = %3
%14 = call i32 (...) @Enqueue()
br label %19
15: ; preds = %3
%16 = call i32 (...) @Dequeue()
br label %19
17: ; preds = %3
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.10, i64 0, i64 0))
br label %19
19: ; preds = %11, %13, %15, %17
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %3
22: ; preds = %3, %19
ret i32 0
}