#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*/ check();
int /*<<< orphan*/ delete ();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ first_element();
int /*<<< orphan*/ insert();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ queue_size();
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int choice, value;
  while (1) {
    printf("enter the choice \n");
    printf("1 : create an empty queue \n2 : Insert element\n");
    printf("3 : Dequeue an element \n4 : Check if empty\n");
    printf("5. Get the first element of the queue\n");
    printf("6. Get the number of entries in the queue\n");
    printf("7. Exit\n");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      printf("Empty queue is created with a capacity of %d\n", 10);
      break;
    case 2:
      insert();
      break;
    case 3:
      delete ();
      break;
    case 4:
      check();
      break;
    case 5:
      first_element();
      break;
    case 6:
      queue_size();
      break;
    case 7:
      exit(0);
    default:
      printf("wrong choice\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xefd(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     1278 <main+0xf8>
mov    -0x10(%rbp),%rax
lea    0xdec(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec4(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1286 <main+0x106>
mov    $0x0,%al
call   1070 <insert@plt>
jmp    1286 <main+0x106>
mov    $0x0,%al
call   1090 <delete@plt>
jmp    1286 <main+0x106>
mov    $0x0,%al
call   1080 <check@plt>
jmp    1286 <main+0x106>
mov    $0x0,%al
call   1040 <first_element@plt>
jmp    1286 <main+0x106>
mov    $0x0,%al
call   1060 <queue_size@plt>
jmp    1286 <main+0x106>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1188 <main+0x8>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf16(%rip),%r13
lea    0xf35(%rip),%rbx
lea    0xf58(%rip),%rbp
lea    0xe65(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe3d(%rip),%r12
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1070 <queue_size@plt>
nopl   0x0(%rax)
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     1241 <main+0xb1>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
lea    0xdec(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d0 <main+0x40>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1080 <insert@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   10a0 <delete@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1090 <check@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
call   1050 <first_element@plt>
jmp    11d0 <main+0x40>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"enter the choice \0A\00"
@.str.1 = [47 x i8] c"1 : create an empty queue \0A2 : Insert element\0A\00"
@.str.2 = [44 x i8] c"3 : Dequeue an element \0A4 : Check if empty\0A\00"
@.str.3 = [39 x i8] c"5. Get the first element of the queue\0A\00"
@.str.4 = [43 x i8] c"6. Get the number of entries in the queue\0A\00"
@.str.5 = [9 x i8] c"7. Exit\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [46 x i8] c"Empty queue is created with a capacity of %d\0A\00"
@.str.8 = [14 x i8] c"wrong choice\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %0, %28
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %26 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
i32 5, label %20
i32 6, label %22
i32 7, label %24
]
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i32 10)
br label %28
14: ; preds = %3
%15 = call i32 (...) @insert()
br label %28
16: ; preds = %3
%17 = call i32 (...) @delete()
br label %28
18: ; preds = %3
%19 = call i32 (...) @check()
br label %28
20: ; preds = %3
%21 = call i32 (...) @first_element()
br label %28
22: ; preds = %3
%23 = call i32 (...) @queue_size()
br label %28
24: ; preds = %3
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %28
28: ; preds = %26, %22, %20, %18, %16, %14, %12
br label %3
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [46 x i8] c"Empty queue is created with a capacity of %d\0A\00"
@str = [18 x i8] c"enter the choice \00"
@str.9 = [46 x i8] c"1 : create an empty queue \0A2 : Insert element\00"
@str.10 = [43 x i8] c"3 : Dequeue an element \0A4 : Check if empty\00"
@str.11 = [38 x i8] c"5. Get the first element of the queue\00"
@str.12 = [42 x i8] c"6. Get the number of entries in the queue\00"
@str.13 = [8 x i8] c"7. Exit\00"
@str.14 = [13 x i8] c"wrong choice\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %28, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.10, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.11, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.12, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %26 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
i32 5, label %20
i32 6, label %22
i32 7, label %24
]
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i32 10)
br label %28
14: ; preds = %3
%15 = call i32 (...) @insert()
br label %28
16: ; preds = %3
%17 = call i32 (...) @delete()
br label %28
18: ; preds = %3
%19 = call i32 (...) @check()
br label %28
20: ; preds = %3
%21 = call i32 (...) @first_element()
br label %28
22: ; preds = %3
%23 = call i32 (...) @queue_size()
br label %28
24: ; preds = %3
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %3
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
br label %28
28: ; preds = %26, %22, %20, %18, %16, %14, %12
br label %3
}