#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__ dequeue(int *);
int /*<<< orphan*/ enqueue(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, j;
  for (i = 0; i <= 3; i++) {
    enqueue(i);
  }
  for (j = 0; j <= 1; j++) {
    dequeue(&j);
    printf("Dequed value = %d \n", j);
  }
  for (i = 4; i <= 8; i++) {
    enqueue(i);
  }
  while (dequeue(&j)) {
    printf("Dequed value = %d \n", j);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     1166 <main+0x36>
mov    -0x8(%rbp),%edi
call   1050 <enqueue@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     119d <main+0x6d>
lea    -0xc(%rbp),%rdi
call   1040 <dequeue@plt>
mov    -0xc(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116d <main+0x3d>
movl   $0x4,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     11c4 <main+0x94>
mov    -0x8(%rbp),%edi
call   1050 <enqueue@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a4 <main+0x74>
jmp    11c9 <main+0x99>
lea    -0xc(%rbp),%rdi
call   1040 <dequeue@plt>
cmp    $0x0,%rax
je     11f0 <main+0xc0>
mov    -0xc(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0x99>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <enqueue@plt>
mov    $0x1,%edi
call   1050 <enqueue@plt>
mov    $0x2,%edi
call   1050 <enqueue@plt>
mov    $0x3,%edi
call   1050 <enqueue@plt>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%r14
lea    0xe93(%rip),%rbx
nopl   (%rax)
mov    %r14,%rdi
call   1040 <dequeue@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
test   %eax,%eax
jle    1170 <main+0x40>
mov    $0x4,%edi
call   1050 <enqueue@plt>
mov    $0x5,%edi
call   1050 <enqueue@plt>
mov    $0x6,%edi
call   1050 <enqueue@plt>
mov    $0x7,%edi
call   1050 <enqueue@plt>
mov    $0x8,%edi
call   1050 <enqueue@plt>
lea    0x4(%rsp),%rdi
call   1040 <dequeue@plt>
test   %rax,%rax
je     11f9 <main+0xc9>
lea    0xe25(%rip),%r14
lea    0x4(%rsp),%rbx
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <dequeue@plt>
test   %rax,%rax
jne    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Dequed value = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @enqueue(i32 0)
%4 = tail call i32 @enqueue(i32 1)
%5 = tail call i32 @enqueue(i32 2)
%6 = tail call i32 @enqueue(i32 3)
store i32 0, i32* %1
br label %7
7: ; preds = %0, %7
%8 = call i64 @dequeue(i32* %1)
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
%13 = icmp slt i32 %11, 1
br i1 %13, label %7, label %14
14: ; preds = %7
%15 = call i32 @enqueue(i32 4)
%16 = call i32 @enqueue(i32 5)
%17 = call i32 @enqueue(i32 6)
%18 = call i32 @enqueue(i32 7)
%19 = call i32 @enqueue(i32 8)
%20 = call i64 @dequeue(i32* %1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %14, %22
%23 = load i32, i32* %1
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = call i64 @dequeue(i32* %1)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %22
27: ; preds = %22, %14
ret i32 0
}