#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 **, struct node **, int);
int /*<<< orphan*/ queue_init(struct node **, struct node **);
int queue_out(struct node **, 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);
  for (temp = 0; temp < 20; temp++) {
    if (1 != queue_enter(&p_queue_header, &p_queue_tail, array[temp])) {
      printf("enter error!\n");
      queue_destory(p_queue_tail);
      return 0;
    }
  }
  queue_print(p_queue_tail);
  for (temp = 0; temp < 20; temp++) {
    printf("queue out:%d\n", queue_out(&p_queue_header, &p_queue_tail));
  }
  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
call   1090 <queue_init@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1213 <main+0xa3>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%edx
lea    -0x70(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1070 <queue_enter@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     1200 <main+0x90>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <queue_destory@plt>
movl   $0x0,-0x4(%rbp)
jmp    1271 <main+0x101>
jmp    1205 <main+0x95>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11af <main+0x3f>
mov    -0x68(%rbp),%rdi
call   1040 <queue_print@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1258 <main+0xe8>
lea    -0x70(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1080 <queue_out@plt>
mov    %eax,%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1223 <main+0xb3>
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
call   1090 <queue_init@plt>
xor    %ebx,%ebx
lea    0xe67(%rip),%r12
nopl   0x0(%rax)
mov    (%rbx,%r12,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <queue_enter@plt>
cmp    $0x1,%eax
jne    13b5 <main+0x245>
add    $0x4,%rbx
cmp    $0x50,%rbx
jne    11a0 <main+0x30>
mov    0x8(%rsp),%rdi
call   1050 <queue_print@plt>
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
lea    0xe68(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <queue_out@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%rdi
call   1050 <queue_print@plt>
jmp    13c1 <main+0x251>
lea    0xca2(%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"
@.str.1 = [14 x i8] c"queue out:%d\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)
store i32 0, i32* %2
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %26
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** %5, %struct.node** %4, i32 %15)
%17 = icmp ne i32 1, %16
br i1 %17, label %18, label %22
18: ; preds = %11
%19 = call i32 (i8*, ...) @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 %43
22: ; preds = %11
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %8
26: ; preds = %8
%27 = load %struct.node*, %struct.node** %4
%28 = call i32 @queue_print(%struct.node* %27)
store i32 0, i32* %2
br label %29
29: ; preds = %35, %26
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 20
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = call i32 @queue_out(%struct.node** %5, %struct.node** %4)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %29
38: ; preds = %29
%39 = load %struct.node*, %struct.node** %4
%40 = call i32 @queue_print(%struct.node* %39)
%41 = load %struct.node*, %struct.node** %4
%42 = call i32 @queue_destory(%struct.node* %41)
store i32 0, i32* %1
br label %43
43: ; preds = %38, %18
%44 = load i32, i32* %1
ret i32 %44
}

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.1 = [14 x i8] c"queue out:%d\0A\00"
@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)
br label %9
6: ; preds = %9
%7 = add nuw nsw i64 %10, 1
%8 = icmp eq i64 %7, 20
br i1 %8, label %17, label %9
9: ; preds = %0, %6
%10 = phi i64 [ 0, %0 ], [ %7, %6 ]
%11 = getelementptr inbounds [20 x i32], [20 x i32]* @__const.main.array, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @queue_enter(%struct.node** %2, %struct.node** %1, i32 %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %6, label %15
15: ; preds = %9
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %62
17: ; preds = %6
%18 = load %struct.node*, %struct.node** %1
%19 = call i32 @queue_print(%struct.node* %18)
%20 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = call i32 @queue_out(%struct.node** %2, %struct.node** %1)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load %struct.node*, %struct.node** %1
%61 = call i32 @queue_print(%struct.node* %60)
br label %62
62: ; preds = %17, %15
%63 = load %struct.node*, %struct.node** %1
%64 = call i32 @queue_destory(%struct.node* %63)
ret i32 0
}