#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*/ backward();
int /*<<< orphan*/ forward();
int /*<<< orphan*/ insert_after(int, int);
int /*<<< orphan*/ insert_before(int, int);
int /*<<< orphan*/ insert_begin(int);
int /*<<< orphan*/ insert_end(int);
scalar_t__ is_empty();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove_node(int);
int main() {
  if (is_empty())
    printf("DLL is empty\n");
  insert_end(3);
  if (!is_empty())
    printf("DLL is not empty\n");
  backward();
  insert_end(4);
  insert_end(5);
  backward();
  insert_begin(1);
  forward();
  insert_before(3, 2);
  insert_after(5, 7);
  insert_after(5, 6);
  forward();
  remove_node(1);
  forward();
  remove_node(7);
  backward();
  remove_node(4);
  forward();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <is_empty@plt>
cmp    $0x0,%rax
je     11bc <main+0x2c>
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1030 <insert_end@plt>
mov    $0x0,%al
call   1070 <is_empty@plt>
cmp    $0x0,%rax
jne    11e3 <main+0x53>
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <backward@plt>
mov    $0x4,%edi
call   1030 <insert_end@plt>
mov    $0x5,%edi
call   1030 <insert_end@plt>
mov    $0x0,%al
call   1060 <backward@plt>
mov    $0x1,%edi
call   1090 <insert_begin@plt>
mov    $0x0,%al
call   1080 <forward@plt>
mov    $0x3,%edi
mov    $0x2,%esi
call   1050 <insert_before@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   10b0 <insert_after@plt>
mov    $0x5,%edi
mov    $0x6,%esi
call   10b0 <insert_after@plt>
mov    $0x0,%al
call   1080 <forward@plt>
mov    $0x1,%edi
call   10a0 <remove_node@plt>
mov    $0x0,%al
call   1080 <forward@plt>
mov    $0x7,%edi
call   10a0 <remove_node@plt>
mov    $0x0,%al
call   1060 <backward@plt>
mov    $0x4,%edi
call   10a0 <remove_node@plt>
mov    $0x0,%al
call   1080 <forward@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %rax,%rax
je     11a9 <main+0x19>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   1040 <insert_end@plt>
xor    %eax,%eax
call   1070 <is_empty@plt>
test   %rax,%rax
jne    11cb <main+0x3b>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <backward@plt>
mov    $0x4,%edi
call   1040 <insert_end@plt>
mov    $0x5,%edi
call   1040 <insert_end@plt>
xor    %eax,%eax
call   1060 <backward@plt>
mov    $0x1,%edi
call   1090 <insert_begin@plt>
xor    %eax,%eax
call   1080 <forward@plt>
mov    $0x3,%edi
mov    $0x2,%esi
call   1050 <insert_before@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   10b0 <insert_after@plt>
mov    $0x5,%edi
mov    $0x6,%esi
call   10b0 <insert_after@plt>
xor    %eax,%eax
call   1080 <forward@plt>
mov    $0x1,%edi
call   10a0 <remove_node@plt>
xor    %eax,%eax
call   1080 <forward@plt>
mov    $0x7,%edi
call   10a0 <remove_node@plt>
xor    %eax,%eax
call   1060 <backward@plt>
mov    $0x4,%edi
call   10a0 <remove_node@plt>
xor    %eax,%eax
call   1080 <forward@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"DLL is empty\0A\00"
@.str.1 = [18 x i8] c"DLL is not empty\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @is_empty()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i32 @insert_end(i32 3)
%8 = call i64 (...) @is_empty()
%9 = icmp ne i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = call i32 (...) @backward()
%14 = call i32 @insert_end(i32 4)
%15 = call i32 @insert_end(i32 5)
%16 = call i32 (...) @backward()
%17 = call i32 @insert_begin(i32 1)
%18 = call i32 (...) @forward()
%19 = call i32 @insert_before(i32 3, i32 2)
%20 = call i32 @insert_after(i32 5, i32 7)
%21 = call i32 @insert_after(i32 5, i32 6)
%22 = call i32 (...) @forward()
%23 = call i32 @remove_node(i32 1)
%24 = call i32 (...) @forward()
%25 = call i32 @remove_node(i32 7)
%26 = call i32 (...) @backward()
%27 = call i32 @remove_node(i32 4)
%28 = call i32 (...) @forward()
ret i32 0
}

LLVM IR (-O2):
@str = [17 x i8] c"DLL is not empty\00"
@str.2 = [13 x i8] c"DLL is empty\00"
define i32 @main() {
%1 = tail call i64 (...) @is_empty()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @insert_end(i32 3)
%7 = tail call i64 (...) @is_empty()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = tail call i32 (...) @backward()
%13 = tail call i32 @insert_end(i32 4)
%14 = tail call i32 @insert_end(i32 5)
%15 = tail call i32 (...) @backward()
%16 = tail call i32 @insert_begin(i32 1)
%17 = tail call i32 (...) @forward()
%18 = tail call i32 @insert_before(i32 3, i32 2)
%19 = tail call i32 @insert_after(i32 5, i32 7)
%20 = tail call i32 @insert_after(i32 5, i32 6)
%21 = tail call i32 (...) @forward()
%22 = tail call i32 @remove_node(i32 1)
%23 = tail call i32 (...) @forward()
%24 = tail call i32 @remove_node(i32 7)
%25 = tail call i32 (...) @backward()
%26 = tail call i32 @remove_node(i32 4)
%27 = tail call i32 (...) @forward()
ret i32 0
}