#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 *arr, int front, int rear, int tag, int size) {
  if (front == -1) {
    printf("\nQueue is empty");
  } else {
    printf("\n");
    while (front != rear) {
      printf("%d   ", *(arr + front));
      front = (front + 1) % size;
    }
    printf("%d   ", *(arr + front));
  }
}


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)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1146 <display+0x36>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <display+0x94>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     118b <display+0x7b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1154 <display+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
cmp    $0xffffffff,%esi
je     118f <display+0x6f>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %ebx,%ebp
je     1172 <display+0x52>
lea    0xec4(%rip),%r12
nopl   0x0(%rax)
movslq %ebp,%rbp
mov    (%r14,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
mov    %ebp,%eax
cltd
idiv   %r15d
mov    %edx,%ebp
cmp    %ebx,%edx
jne    1150 <display+0x30>
mov    %ebx,%ebp
movslq %ebp,%rax
mov    (%r14,%rax,4),%esi
lea    0xe90(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"\0AQueue is empty\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"%d \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
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
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %39
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %21, %15
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
%30 = load i32, i32* %10
%31 = srem i32 %29, %30
store i32 %31, i32* %7
br label %17
32: ; preds = %17
%33 = load i32*, i32** %6
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %32, %13
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AQueue is empty\00"
@.str.2 = [6 x i8] c"%d \00"
define void @display(i32* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %1, -1
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %27
9: ; preds = %5
%10 = tail call i32 @putchar(i32 10)
%11 = icmp eq i32 %1, %2
br i1 %11, label %21, label %12
12: ; preds = %9, %12
%13 = phi i32 [ %19, %12 ], [ %1, %9 ]
%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 ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nsw i32 %13, 1
%19 = srem i32 %18, %4
%20 = icmp eq i32 %19, %2
br i1 %20, label %21, label %12
21: ; preds = %12, %9
%22 = phi i32 [ %1, %9 ], [ %2, %12 ]
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %0, i64 %23
%25 = load i32, i32* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %21, %7
ret void
}