#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 enqueue(int *arr, int item, int *pfront, int *prear) {
  if (*prear == 10 - 1) {
    printf("Queue is full\n");
    return;
  } else {
    printf("Enqueuing: %d\n", item);
    (*prear)++;
    arr[*prear] = item;
    if (*pfront == -1)
      *pfront = 0;
  }
}


x86 assembly (clang, -O0):
<enqueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x9,(%rax)
jne    1147 <enqueue+0x37>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <enqueue+0x80>
mov    -0xc(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    118b <enqueue+0x7b>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    1190 <enqueue+0x80>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enqueue>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpl   $0x9,(%rcx)
jne    1142 <enqueue+0x22>
lea    0xedc(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
mov    %ebp,0x4(%r15,%rax,4)
cmpl   $0xffffffff,(%r14)
jne    1176 <enqueue+0x56>
movl   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Enqueuing: %d\0A\00"
@str = [14 x i8] c"Queue is full\00"
define void @enqueue(i32* nocapture writeonly %0, i32 %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 9
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %18
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
store i32 %1, i32* %14
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %18
17: ; preds = %9
store i32 0, i32* %2
br label %18
18: ; preds = %9, %17, %7
ret void
}