#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_dlink_queue();
int /*<<< orphan*/ destroy_dlink_queue();
int front();
int is_empty();
int pop();
int /*<<< orphan*/ printf(char *, int);
int size();
void main() {
  int tmp = 0;
  create_dlink_queue();
  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_dlink_queue();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <create_dlink_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,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <front@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
mov    $0x28,%edi
call   1040 <add@plt>
mov    $0x0,%al
call   1070 <is_empty@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <size@plt>
mov    %eax,%esi
lea    0xe02(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1236 <main+0xb6>
jmp    1250 <main+0xd0>
mov    $0x0,%al
call   1080 <pop@plt>
mov    %eax,%esi
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
jmp    121a <main+0x9a>
mov    $0x0,%al
call   10a0 <destroy_dlink_queue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <create_dlink_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    0xe4c(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <front@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x28,%edi
call   1040 <add@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
lea    0xe21(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <size@plt>
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %eax,%eax
jne    123c <main+0xbc>
lea    0xe09(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %eax,%eax
je     1220 <main+0xa0>
xor    %eax,%eax
pop    %rbx
jmp    10a0 <destroy_dlink_queue@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"tmp=%d\0A\00"
@.str.1 = [15 x i8] c"is_empty()=%d\0A\00"
@.str.2 = [11 x i8] c"size()=%d\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32 (...) @create_dlink_queue()
%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 ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @front()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 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 ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @size()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 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_dlink_queue()
ret void
}