#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*/ add(int);
int /*<<< orphan*/ create_array_queue(int);
int /*<<< orphan*/ destroy_array_queue();
int front();
int /*<<< orphan*/ getchar();
int is_empty();
int pop();
int /*<<< orphan*/ printf(char *, int);
int size();
int main() {
  int tmp = 0;
  create_array_queue(12);
  add(10);
  add(20);
  add(30);
  tmp = pop();
  printf("tmp = %d\n", tmp);
  tmp = front();
  printf("tmp = %d\n", tmp);
  add(40);
  printf("is_empty() = %d\n", is_empty());
  printf("size() = %d\n", size());
  while (!is_empty())
    printf("%d\n", pop());
  destroy_array_queue();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0xc,%edi
call   1090 <create_array_queue@plt>
mov    $0xa,%edi
call   1040 <add@plt>
mov    $0x14,%edi
call   1040 <add@plt>
mov    $0x1e,%edi
call   1040 <add@plt>
mov    $0x0,%al
call   1080 <pop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe1e(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   10b0 <front@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe05(%rip),%rdi
call   1060 <printf@plt>
mov    $0x28,%edi
call   1040 <add@plt>
mov    $0x0,%al
call   1070 <is_empty@plt>
mov    %eax,%esi
lea    0xdf0(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <size@plt>
mov    %eax,%esi
lea    0xdec(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1250 <main+0xc0>
jmp    126a <main+0xda>
mov    $0x0,%al
call   1080 <pop@plt>
mov    %eax,%esi
lea    0xdc4(%rip),%rdi
call   1060 <printf@plt>
jmp    1234 <main+0xa4>
mov    $0x0,%al
call   1050 <destroy_array_queue@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc,%edi
call   1090 <create_array_queue@plt>
mov    $0xa,%edi
call   1040 <add@plt>
mov    $0x14,%edi
call   1040 <add@plt>
mov    $0x1e,%edi
call   1040 <add@plt>
xor    %eax,%eax
call   1080 <pop@plt>
lea    0xe39(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
call   10b0 <front@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    $0x28,%edi
call   1040 <add@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
lea    0xe10(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
call   1030 <size@plt>
lea    0xe0c(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %eax,%eax
jne    124c <main+0xbc>
lea    0xdfc(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %eax,%eax
je     1230 <main+0xa0>
xor    %eax,%eax
call   1050 <destroy_array_queue@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"tmp = %d\0A\00"
@.str.1 = [17 x i8] c"is_empty() = %d\0A\00"
@.str.2 = [13 x i8] c"size() = %d\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @create_array_queue(i32 12)
%4 = call i32 @add(i32 10)
%5 = call i32 @add(i32 20)
%6 = call i32 @add(i32 30)
%7 = call i32 (...) @pop()
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @front()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @add(i32 40)
%14 = call i32 (...) @is_empty()
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 (...) @size()
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %22, %0
%19 = call i32 (...) @is_empty()
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 (...) @pop()
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %18
25: ; preds = %18
%26 = call i32 (...) @destroy_array_queue()
%27 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"tmp = %d\0A\00"
@.str.1 = [17 x i8] c"is_empty() = %d\0A\00"
@.str.2 = [13 x i8] c"size() = %d\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @create_array_queue(i32 12)
%2 = tail call i32 @add(i32 10)
%3 = tail call i32 @add(i32 20)
%4 = tail call i32 @add(i32 30)
%5 = tail call i32 (...) @pop()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @front()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @add(i32 40)
%10 = tail call i32 (...) @is_empty()
%11 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @size()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @is_empty()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %0, %16
%17 = tail call i32 (...) @pop()
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = tail call i32 (...) @is_empty()
%20 = icmp eq i32 %19, 0
br i1 %20, label %16, label %21
21: ; preds = %16, %0
%22 = tail call i32 (...) @destroy_array_queue()
%23 = tail call i32 (...) @getchar()
ret i32 0
}