#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 */
scalar_t__ isEmptyCQ(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
void deleteCQ(int CQ[], int *front, int *rear, int *key) {
  if (isEmptyCQ(front, rear)) {
    printf("Queue is empty");
    return;
  } else {
    *key = CQ[*front];
    CQ[*front] = -9999999;
    if (*front == *rear) {
      *rear = -1;
      *front = -1;
    } else if (*front == 5 - 1)
      *front = 0;
    else
      *front = *front + 1;
  }
  printf("\n\tFront = %d", *front);
}


x86 assembly (clang, -O0):
<deleteCQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <isEmptyCQ@plt>
cmp    $0x0,%rax
je     1162 <deleteCQ+0x42>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fc <deleteCQ+0xdc>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0xff676981,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    11b3 <deleteCQ+0x93>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    11e3 <deleteCQ+0xc3>
mov    -0x10(%rbp),%rax
cmpl   $0x4,(%rax)
jne    11cf <deleteCQ+0xaf>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11de <deleteCQ+0xbe>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11e3 <deleteCQ+0xc3>
jmp    11e8 <deleteCQ+0xc8>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteCQ>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <isEmptyCQ@plt>
test   %rax,%rax
je     115d <deleteCQ+0x3d>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
movslq (%rbx),%rax
mov    (%r12,%rax,4),%eax
mov    %eax,(%r15)
movslq (%rbx),%rax
movl   $0xff676981,(%r12,%rax,4)
ff
mov    (%rbx),%eax
cmp    (%r14),%eax
jne    1187 <deleteCQ+0x67>
movl   $0xffffffff,(%r14)
mov    $0xffffffff,%esi
jmp    1192 <deleteCQ+0x72>
lea    0x1(%rax),%ecx
xor    %esi,%esi
cmp    $0x4,%eax
cmovne %ecx,%esi
mov    %esi,(%rbx)
lea    0xe74(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Queue is empty\00"
@.str.1 = [13 x i8] c"\0A\09Front = %d\00"
define void @deleteCQ(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** %6
%10 = load i32*, i32** %7
%11 = call i64 @isEmptyCQ(i32* %9, i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %53
15: ; preds = %4
%16 = load i32*, i32** %5
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %16, i64 %19
%21 = load i32, i32* %20
%22 = load i32*, i32** %8
store i32 %21, i32* %22
%23 = load i32*, i32** %5
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %23, i64 %26
store i32 -9999999, i32* %27
%28 = load i32*, i32** %6
%29 = load i32, i32* %28
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = icmp eq i32 %29, %31
br i1 %32, label %33, label %36
33: ; preds = %15
%34 = load i32*, i32** %7
store i32 -1, i32* %34
%35 = load i32*, i32** %6
store i32 -1, i32* %35
br label %48
36: ; preds = %15
%37 = load i32*, i32** %6
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i32*, i32** %6
store i32 0, i32* %41
br label %47
42: ; preds = %36
%43 = load i32*, i32** %6
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
%46 = load i32*, i32** %6
store i32 %45, i32* %46
br label %47
47: ; preds = %42, %40
br label %48
48: ; preds = %47, %33
br label %49
49: ; preds = %48
%50 = load i32*, i32** %6
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %49, %13
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Queue is empty\00"
@.str.1 = [13 x i8] c"\0A\09Front = %d\00"
define void @deleteCQ(i32* nocapture %0, i32* %1, i32* %2, i32* nocapture writeonly %3) {
%5 = tail call i64 @isEmptyCQ(i32* %1, i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %28
9: ; preds = %4
%10 = load i32, i32* %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
store i32 %13, i32* %3
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %0, i64 %15
store i32 -9999999, i32* %16
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %9
store i32 -1, i32* %2
br label %25
21: ; preds = %9
%22 = icmp eq i32 %17, 4
%23 = add nsw i32 %17, 1
%24 = select i1 %22, i32 0, i32 %23
br label %25
25: ; preds = %21, %20
%26 = phi i32 [ -1, %20 ], [ %24, %21 ]
store i32 %26, i32* %1
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %7
ret void
}