#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*/ printf(char *, ...);
void display(int a[], int *fp1, int *rp1, int *fp2, int *rp2) {
  int i = 0;
  if (*fp1 == -1)
    printf("FRONT QUEUE is Empty...!\n\n");
  else {
    printf("FRONT QUEUE Elements are...\n");
    i = *fp1;
    while (i <= *rp1) {
      printf("%d\n", a[i]);
      i++;
    }
  }
  if (*fp2 == -1)
    printf("BACK QUEUE is Empty...!\n\n");
  else {
    i = *rp2;
    while (i >= *fp2) {
      printf("%d\n", a[i]);
      i--;
    }
  }
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1153 <display+0x43>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <display+0x95>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jg     11a0 <display+0x90>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116a <display+0x5a>
jmp    11a5 <display+0x95>
mov    -0x20(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    11c5 <display+0xb5>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <display+0xf9>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jl     1204 <display+0xf4>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ce <display+0xbe>
jmp    1209 <display+0xf9>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdi,%rbx
cmpl   $0xffffffff,(%rsi)
je     117d <display+0x5d>
mov    %rdx,%r12
mov    %rsi,%r13
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
movslq 0x0(%r13),%rbp
cmp    (%r12),%ebp
jg     1189 <display+0x69>
add    $0xffffffffffffffff,%rbp
lea    0xea0(%rip),%r13
mov    0x4(%rbx,%rbp,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq (%r12),%rax
add    $0x1,%rbp
cmp    %rax,%rbp
jl     1160 <display+0x40>
jmp    1189 <display+0x69>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%eax
cmp    $0xffffffff,%eax
je     11d9 <display+0xb9>
movslq (%r15),%rbp
cmp    %eax,%ebp
jl     11ca <display+0xaa>
add    $0x1,%rbp
lea    0xe5d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x4(%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq (%r14),%rax
add    $0xffffffffffffffff,%rbp
cmp    %rax,%rbp
jg     11b0 <display+0x90>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe40(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"FRONT QUEUE is Empty...!\0A\0A\00"
@.str.1 = [29 x i8] c"FRONT QUEUE Elements are...\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [26 x i8] c"BACK QUEUE is Empty...!\0A\0A\00"
define void @display(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
store i32 0, i32* %11
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %36
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
store i32 %20, i32* %11
br label %21
21: ; preds = %26, %17
%22 = load i32, i32* %11
%23 = load i32*, i32** %8
%24 = load i32, i32* %23
%25 = icmp sle i32 %22, %24
br i1 %25, label %26, label %35
26: ; preds = %21
%27 = load i32*, i32** %6
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %21
35: ; preds = %21
br label %36
36: ; preds = %35, %15
%37 = load i32*, i32** %9
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %60
42: ; preds = %36
%43 = load i32*, i32** %10
%44 = load i32, i32* %43
store i32 %44, i32* %11
br label %45
45: ; preds = %50, %42
%46 = load i32, i32* %11
%47 = load i32*, i32** %9
%48 = load i32, i32* %47
%49 = icmp sge i32 %46, %48
br i1 %49, label %50, label %59
50: ; preds = %45
%51 = load i32*, i32** %6
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %11
%58 = add nsw i32 %57, -1
store i32 %58, i32* %11
br label %45
59: ; preds = %45
br label %60
60: ; preds = %59, %40
ret void
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [28 x i8] c"FRONT QUEUE Elements are...\00"
@str.4 = [25 x i8] c"BACK QUEUE is Empty...!\0A\00"
@str.5 = [26 x i8] c"FRONT QUEUE is Empty...!\0A\00"
define void @display(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4) {
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
br label %26
10: ; preds = %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = icmp sgt i32 %12, %13
br i1 %14, label %26, label %15
15: ; preds = %10
%16 = sext i32 %12 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ %16, %15 ], [ %22, %17 ]
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = add nsw i64 %18, 1
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %18, %24
br i1 %25, label %17, label %26
26: ; preds = %17, %10, %8
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
br label %45
31: ; preds = %26
%32 = load i32, i32* %4
%33 = icmp slt i32 %32, %27
br i1 %33, label %45, label %34
34: ; preds = %31
%35 = sext i32 %32 to i64
br label %36
36: ; preds = %34, %36
%37 = phi i64 [ %35, %34 ], [ %41, %36 ]
%38 = getelementptr inbounds i32, i32* %0, i64 %37
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = add i64 %37, -1
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = icmp sgt i64 %37, %43
br i1 %44, label %36, label %45
45: ; preds = %36, %31, %29
ret void
}