#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*/ display();
int /*<<< orphan*/ enqueue(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int ch, x;
  while (ch != 3) {
    printf("\n**MENU**\n");
    printf("Enter the choice \n1.Enqueue \n2.Dequeue \n3.Exit\n");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      printf("Enter the value\n");
      scanf("%d", &x);
      enqueue(x);
      display();
      break;
    case 2:
      dequeue();
      display();
      break;
    case 3:
      exit(0);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1226 <main+0xc6>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11d7 <main+0x77>
jmp    11b5 <main+0x55>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1207 <main+0xa7>
jmp    11c6 <main+0x66>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     121a <main+0xba>
jmp    1221 <main+0xc1>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
lea    0xe51(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1080 <enqueue@plt>
mov    $0x0,%al
call   1030 <display@plt>
jmp    1221 <main+0xc1>
mov    $0x0,%al
call   1050 <dequeue@plt>
mov    $0x0,%al
call   1030 <display@plt>
jmp    1221 <main+0xc1>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    116f <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    0xe91(%rip),%r14
lea    0xe94(%rip),%r15
lea    0xe80(%rip),%rbx
mov    %rsp,%r12
lea    0xeb2(%rip),%r13
lea    0x4(%rsp),%rbp
jmp    11cb <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1080 <enqueue@plt>
xor    %eax,%eax
call   1040 <display@plt>
mov    (%rsp),%eax
cmp    $0x3,%eax
je     1209 <main+0xa9>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%eax
cmp    $0x1,%eax
je     11a0 <main+0x40>
cmp    $0x2,%eax
je     1200 <main+0xa0>
cmp    $0x3,%eax
jne    11c6 <main+0x66>
jmp    121a <main+0xba>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <dequeue@plt>
jmp    11bc <main+0x5c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\0A**MENU**\0A\00"
@.str.1 = [48 x i8] c"Enter the choice \0A1.Enqueue \0A2.Dequeue \0A3.Exit\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"Enter the value\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 3
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %23 [
i32 1, label %12
i32 2, label %18
i32 3, label %21
]
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = call i32 @enqueue(i32 %15)
%17 = call i32 (...) @display()
br label %23
18: ; preds = %7
%19 = call i32 (...) @dequeue()
%20 = call i32 (...) @display()
br label %23
21: ; preds = %7
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %7, %18, %12
br label %4
24: ; preds = %4
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@str = [10 x i8] c"\0A**MENU**\00"
@str.4 = [47 x i8] c"Enter the choice \0A1.Enqueue \0A2.Dequeue \0A3.Exit\00"
@str.5 = [16 x i8] c"Enter the value\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %0, %22
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %22 [
i32 1, label %10
i32 2, label %15
i32 3, label %17
]
10: ; preds = %5
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = call i32 @enqueue(i32 %13)
br label %19
15: ; preds = %5
%16 = call i32 (...) @dequeue()
br label %19
17: ; preds = %5
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %10, %15
%20 = call i32 (...) @display()
%21 = load i32, i32* %1
br label %22
22: ; preds = %19, %5
%23 = phi i32 [ %21, %19 ], [ %9, %5 ]
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %5
25: ; preds = %22
ret i32 0
}