#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 */
struct queue {
  int dummy;
};

/* Variables and functions */
int DeQueue(struct queue *);
int /*<<< orphan*/ EnQueue(struct queue *, int);
struct queue *createQueue();
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct queue *Q = createQueue();
  int i;
  for (i = 0; i < 5; i++)
    EnQueue(Q, i + 1);
  for (i = 0; i < 6; i++) {
    int data = DeQueue(Q);
    printf("DeQueued data is %d\n", data);
  }
  EnQueue(Q, 10);
  int data = DeQueue(Q);
  printf("DeQueued data is %d\n", data);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <createQueue@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1188 <main+0x48>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1040 <EnQueue@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x21>
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11c2 <main+0x82>
mov    -0x10(%rbp),%rdi
call   1050 <DeQueue@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe51(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118f <main+0x4f>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1040 <EnQueue@plt>
mov    -0x10(%rbp),%rdi
call   1050 <DeQueue@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <createQueue@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
lea    0xe62(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <EnQueue@plt>
mov    %rbx,%rdi
call   1050 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.queue = type { i32 }
@.str = [21 x i8] c"DeQueued data is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.queue*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call %struct.queue* (...) @createQueue()
store %struct.queue* %6, %struct.queue** %2
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load %struct.queue*, %struct.queue** %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 @EnQueue(%struct.queue* %11, i32 %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
store i32 0, i32* %3
br label %19
19: ; preds = %27, %18
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 6
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load %struct.queue*, %struct.queue** %2
%24 = call i32 @DeQueue(%struct.queue* %23)
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %22
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %19
30: ; preds = %19
%31 = load %struct.queue*, %struct.queue** %2
%32 = call i32 @EnQueue(%struct.queue* %31, i32 10)
%33 = load %struct.queue*, %struct.queue** %2
%34 = call i32 @DeQueue(%struct.queue* %33)
store i32 %34, i32* %5
%35 = load i32, i32* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
%struct.queue = type { i32 }
@.str = [21 x i8] c"DeQueued data is %d\0A\00"
define i32 @main() {
%1 = tail call %struct.queue* (...) @createQueue()
%2 = tail call i32 @EnQueue(%struct.queue* %1, i32 1)
%3 = tail call i32 @EnQueue(%struct.queue* %1, i32 2)
%4 = tail call i32 @EnQueue(%struct.queue* %1, i32 3)
%5 = tail call i32 @EnQueue(%struct.queue* %1, i32 4)
%6 = tail call i32 @EnQueue(%struct.queue* %1, i32 5)
%7 = tail call i32 @DeQueue(%struct.queue* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @DeQueue(%struct.queue* %1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 @DeQueue(%struct.queue* %1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @DeQueue(%struct.queue* %1)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call i32 @DeQueue(%struct.queue* %1)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = tail call i32 @DeQueue(%struct.queue* %1)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = tail call i32 @EnQueue(%struct.queue* %1, i32 10)
%20 = tail call i32 @DeQueue(%struct.queue* %1)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}