#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 node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ queue_destory(struct node *);
int queue_enter(struct node **, int);
int /*<<< orphan*/ queue_init(struct node **, struct node **, int);
int /*<<< orphan*/ queue_out(struct node **);
int /*<<< orphan*/ queue_print(struct node *);
int main() {
  int temp = 0;
  int array[20] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10,
                   11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
  struct node *p_queue_tail;
  struct node *p_queue_header;
  queue_init(&p_queue_header, &p_queue_tail, 10);
  for (temp = 0; temp < 20; temp++) {
    if (1 != queue_enter(&p_queue_tail, array[temp])) {
      printf("enter error!\n");
      queue_destory(p_queue_tail);
      return 0;
    }
    queue_out(&p_queue_header);
  }
  queue_print(p_queue_tail);
  queue_destory(p_queue_tail);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x50,%edx
call   1060 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x68(%rbp),%rsi
mov    $0xa,%edx
call   1090 <queue_init@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1216 <main+0xa6>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    -0x68(%rbp),%rdi
call   1070 <queue_enter@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     11ff <main+0x8f>
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <queue_destory@plt>
movl   $0x0,-0x4(%rbp)
jmp    122f <main+0xbf>
lea    -0x70(%rbp),%rdi
call   1080 <queue_out@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b4 <main+0x44>
mov    -0x68(%rbp),%rdi
call   1040 <queue_print@plt>
mov    -0x68(%rbp),%rdi
call   1030 <queue_destory@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0xa,%edx
call   1080 <queue_init@plt>
xor    %ebx,%ebx
lea    0xe72(%rip),%r12
xchg   %ax,%ax
mov    (%rbx,%r12,1),%esi
mov    %r15,%rdi
call   1060 <queue_enter@plt>
cmp    $0x1,%eax
jne    11bf <main+0x5f>
mov    %r14,%rdi
call   1070 <queue_out@plt>
add    $0x4,%rbx
cmp    $0x50,%rbx
jne    1190 <main+0x30>
mov    0x8(%rsp),%rdi
call   1050 <queue_print@plt>
jmp    11cb <main+0x6b>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rdi
call   1030 <queue_destory@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@__const.main.array = [20 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20]
@.str = [14 x i8] c"enter error!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
%4 = alloca %struct.node*
%5 = alloca %struct.node*
store i32 0, i32* %1
store i32 0, i32* %2
%6 = bitcast [20 x i32]* %3 to i8*
%7 = call i32 @queue_init(%struct.node** %5, %struct.node** %4, i32 10)
store i32 0, i32* %2
br label %8
8: ; preds = %24, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @queue_enter(%struct.node** %4, i32 %15)
%17 = icmp ne i32 1, %16
br i1 %17, label %18, label %22
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%20 = load %struct.node*, %struct.node** %4
%21 = call i32 @queue_destory(%struct.node* %20)
store i32 0, i32* %1
br label %32
22: ; preds = %11
%23 = call i32 @queue_out(%struct.node** %5)
br label %24
24: ; preds = %22
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %8
27: ; preds = %8
%28 = load %struct.node*, %struct.node** %4
%29 = call i32 @queue_print(%struct.node* %28)
%30 = load %struct.node*, %struct.node** %4
%31 = call i32 @queue_destory(%struct.node* %30)
store i32 0, i32* %1
br label %32
32: ; preds = %27, %18
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
%struct.node = type { i32 }
@__const.main.array = [20 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20]
@str = [13 x i8] c"enter error!\00"
define i32 @main() {
%1 = alloca %struct.node*
%2 = alloca %struct.node*
%3 = bitcast %struct.node** %1 to i8*
%4 = bitcast %struct.node** %2 to i8*
%5 = call i32 @queue_init(%struct.node** %2, %struct.node** %1, i32 10)
br label %6
6: ; preds = %0, %14
%7 = phi i64 [ 0, %0 ], [ %16, %14 ]
%8 = getelementptr inbounds [20 x i32], [20 x i32]* @__const.main.array, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = call i32 @queue_enter(%struct.node** %1, i32 %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %21
14: ; preds = %6
%15 = call i32 @queue_out(%struct.node** %2)
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, 20
br i1 %17, label %18, label %6
18: ; preds = %14
%19 = load %struct.node*, %struct.node** %1
%20 = call i32 @queue_print(%struct.node* %19)
br label %21
21: ; preds = %18, %12
%22 = load %struct.node*, %struct.node** %1
%23 = call i32 @queue_destory(%struct.node* %22)
ret i32 0
}