#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*/ delete_element();
int /*<<< orphan*/ display_queue();
int /*<<< orphan*/ insert_element();
int /*<<< orphan*/ peek();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int option;
  printf(">>> c program to implement queue operations <<<");
  do {
    printf("\n\n 1.Insert an element");
    printf("\n 2.Delete an element");
    printf("\n 3.Display queue");
    printf("\n 4.Front ");
    printf("\n 5.Exit");
    printf("\n Enter your choice: ");
    scanf("%d", &option);
    switch (option) {
    case 1:
      insert_element();
      break;
    case 2:
      delete_element();
      break;
    case 3:
      display_queue();
      break;
    case 4:
      peek();
      break;
    case 5:
      return 0;
    }
  } while (option != 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     1238 <main+0xd8>
mov    -0x10(%rbp),%rax
lea    0xe0d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <insert_element@plt>
jmp    1238 <main+0xd8>
mov    $0x0,%al
call   1050 <delete_element@plt>
jmp    1238 <main+0xd8>
mov    $0x0,%al
call   1060 <display_queue@plt>
jmp    1238 <main+0xd8>
mov    $0x0,%al
call   1030 <peek@plt>
jmp    1238 <main+0xd8>
movl   $0x0,-0x4(%rbp)
jmp    1247 <main+0xe7>
jmp    123d <main+0xdd>
cmpl   $0x5,-0x8(%rbp)
jne    117b <main+0x1b>
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    0xea2(%rip),%rdi
call   1040 <printf@plt>
lea    0xf05(%rip),%r13
lea    0xf09(%rip),%rbx
lea    0xf0b(%rip),%rbp
lea    0xf1a(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe61(%rip),%r12
jmp    11c4 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <peek@plt>
mov    0x4(%rsp),%eax
cmp    $0x5,%eax
je     124c <main+0xec>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x4,%ecx
ja     11bb <main+0x5b>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <insert_element@plt>
jmp    11b7 <main+0x57>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <delete_element@plt>
jmp    11b7 <main+0x57>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <display_queue@plt>
jmp    11b7 <main+0x57>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c">>> c program to implement queue operations <<<\00"
@.str.1 = [23 x i8] c"\0A\0A 1.Insert an element\00"
@.str.2 = [22 x i8] c"\0A 2.Delete an element\00"
@.str.3 = [18 x i8] c"\0A 3.Display queue\00"
@.str.4 = [11 x i8] c"\0A 4.Front \00"
@.str.5 = [9 x i8] c"\0A 5.Exit\00"
@.str.6 = [22 x i8] c"\0A Enter your choice: \00"
@.str.7 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %23, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
switch i32 %12, label %22 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %21
]
13: ; preds = %4
%14 = call i32 (...) @insert_element()
br label %22
15: ; preds = %4
%16 = call i32 (...) @delete_element()
br label %22
17: ; preds = %4
%18 = call i32 (...) @display_queue()
br label %22
19: ; preds = %4
%20 = call i32 (...) @peek()
br label %22
21: ; preds = %4
store i32 0, i32* %1
br label %26
22: ; preds = %4, %19, %17, %15, %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = icmp ne i32 %24, 5
br i1 %25, label %4, label %26
26: ; preds = %21, %23
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [48 x i8] c">>> c program to implement queue operations <<<\00"
@.str.1 = [23 x i8] c"\0A\0A 1.Insert an element\00"
@.str.2 = [22 x i8] c"\0A 2.Delete an element\00"
@.str.3 = [18 x i8] c"\0A 3.Display queue\00"
@.str.4 = [11 x i8] c"\0A 4.Front \00"
@.str.5 = [9 x i8] c"\0A 5.Exit\00"
@.str.6 = [22 x i8] c"\0A Enter your choice: \00"
@.str.7 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %23, %0
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
switch i32 %12, label %23 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %26
]
13: ; preds = %4
%14 = call i32 (...) @insert_element()
br label %21
15: ; preds = %4
%16 = call i32 (...) @delete_element()
br label %21
17: ; preds = %4
%18 = call i32 (...) @display_queue()
br label %21
19: ; preds = %4
%20 = call i32 (...) @peek()
br label %21
21: ; preds = %19, %17, %15, %13
%22 = load i32, i32* %1
br label %23
23: ; preds = %21, %4
%24 = phi i32 [ %22, %21 ], [ %12, %4 ]
%25 = icmp eq i32 %24, 5
br i1 %25, label %26, label %4
26: ; preds = %23, %4
ret i32 0
}