#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 *queue, int front, int rear) {
  int i;
  if (front == -1) {
    printf("\nQueue is Empty!\n");
    return;
  }
  printf("\nQueue is as follows->\n");
  for (i = front; i <= rear; i++) {
    if (i == 5)
      i = 0;
    printf(" %d", queue[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    113f <display+0x2f>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <display+0x95>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1197 <display+0x87>
cmpl   $0x5,-0x14(%rbp)
jne    1170 <display+0x60>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <display+0x43>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
cmp    $0xffffffff,%esi
je     11a8 <display+0x78>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
cmp    %r13d,%ebp
jg     1190 <display+0x60>
xor    %r12d,%r12d
lea    0xe9d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x5,%ebp
cmove  %r12d,%ebp
movslq %ebp,%rbx
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1(%rbx),%ebp
cmp    %r13d,%ebx
jl     1170 <display+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xe6c(%rip),%rdi
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AQueue is Empty!\0A\00"
@.str.1 = [24 x i8] c"\0AQueue is as follows->\0A\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @display(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %35
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %5
store i32 %14, i32* %7
br label %15
15: ; preds = %30, %12
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, 5
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %7
br label %23
23: ; preds = %22, %19
%24 = load i32*, i32** %4
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %23
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %15
33: ; preds = %15
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %10
ret void
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c" %d\00"
@str = [23 x i8] c"\0AQueue is as follows->\00"
@str.4 = [17 x i8] c"\0AQueue is Empty!\00"
define void @display(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, -1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
br label %22
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%9 = icmp sgt i32 %1, %2
br i1 %9, label %20, label %10
10: ; preds = %7, %10
%11 = phi i32 [ %18, %10 ], [ %1, %7 ]
%12 = icmp eq i32 %11, 5
%13 = select i1 %12, i32 0, i32 %11
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nsw i32 %13, 1
%19 = icmp slt i32 %13, %2
br i1 %19, label %10, label %20
20: ; preds = %10, %7
%21 = tail call i32 @putchar(i32 10)
br label %22
22: ; preds = %20, %5
ret void
}