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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct dlist *dlist_append(struct dlist *, char *);
int /*<<< orphan*/ *dlist_find_custom(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ dlist_foreach(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *);
int /*<<< orphan*/ dlist_free(struct dlist *, int /*<<< orphan*/ *);
int dlist_index(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *dlist_nth_data(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *dlist_nth_node(int /*<<< orphan*/ *, int /*<<< orphan*/);
int dlist_position(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *dlist_remove(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
struct dlist *dlist_reverse(struct dlist *);
void test_nolist(void) {
  assert(dlist_index(NULL, 0) == -1);
  assert(dlist_position(NULL, NULL) == -1);
  assert(dlist_nth_node(NULL, 0) == NULL);
  assert(dlist_nth_data(NULL, 0) == NULL);
  assert(dlist_remove(NULL, NULL) == NULL);
  assert(dlist_reverse(NULL) == NULL);
  dlist_foreach(NULL, NULL, NULL);
  assert(dlist_find_custom(NULL, NULL, NULL) == NULL);
  struct dlist *dl = NULL;
  dl = dlist_append(dl, NULL);
  dlist_free(dl, NULL);
  dl = NULL;
  dl = dlist_append(dl, "one");
  dl = dlist_reverse(dl);
  dlist_free(dl, NULL);
}


x86 assembly (clang, -O0):
<test_nolist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   10a0 <dlist_index@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   10b0 <dlist_position@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1090 <dlist_nth_node@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   10c0 <dlist_nth_data@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1040 <dlist_remove@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <dlist_reverse@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1070 <dlist_foreach@plt>
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1060 <dlist_find_custom@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <dlist_append@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <dlist_free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd3a(%rip),%rsi
call   10d0 <dlist_append@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <dlist_reverse@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <dlist_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_nolist>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <dlist_index@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10b0 <dlist_position@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1090 <dlist_nth_node@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10c0 <dlist_nth_data@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <dlist_remove@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
call   1050 <dlist_reverse@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <dlist_foreach@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <dlist_find_custom@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10d0 <dlist_append@plt>
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <dlist_free@plt>
lea    0xd89(%rip),%rsi
xor    %edi,%edi
call   10d0 <dlist_append@plt>
mov    %rax,%rdi
call   1050 <dlist_reverse@plt>
mov    %rax,%rdi
xor    %esi,%esi
pop    %rax
jmp    1030 <dlist_free@plt>

LLVM IR (-O0):
%struct.dlist = type { i32 }
@.str = [4 x i8] c"one\00"
define void @test_nolist() {
%1 = alloca %struct.dlist*
%2 = call i32 @dlist_index(i32* null, i32 0)
%3 = icmp eq i32 %2, -1
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 @dlist_position(i32* null, i32* null)
%7 = icmp eq i32 %6, -1
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32* @dlist_nth_node(i32* null, i32 0)
%11 = icmp eq i32* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32* @dlist_nth_data(i32* null, i32 0)
%15 = icmp eq i32* %14, null
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32* @dlist_remove(i32* null, i32* null)
%19 = icmp eq i32* %18, null
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call %struct.dlist* @dlist_reverse(%struct.dlist* null)
%23 = icmp eq %struct.dlist* %22, null
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @dlist_foreach(i32* null, i32* null, i32* null)
%27 = call i32* @dlist_find_custom(i32* null, i32* null, i32* null)
%28 = icmp eq i32* %27, null
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
store %struct.dlist* null, %struct.dlist** %1
%31 = load %struct.dlist*, %struct.dlist** %1
%32 = call %struct.dlist* @dlist_append(%struct.dlist* %31, i8* null)
store %struct.dlist* %32, %struct.dlist** %1
%33 = load %struct.dlist*, %struct.dlist** %1
%34 = call i32 @dlist_free(%struct.dlist* %33, i32* null)
store %struct.dlist* null, %struct.dlist** %1
%35 = load %struct.dlist*, %struct.dlist** %1
%36 = call %struct.dlist* @dlist_append(%struct.dlist* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store %struct.dlist* %36, %struct.dlist** %1
%37 = load %struct.dlist*, %struct.dlist** %1
%38 = call %struct.dlist* @dlist_reverse(%struct.dlist* %37)
store %struct.dlist* %38, %struct.dlist** %1
%39 = load %struct.dlist*, %struct.dlist** %1
%40 = call i32 @dlist_free(%struct.dlist* %39, i32* null)
ret void
}

LLVM IR (-O2):
%struct.dlist = type { i32 }
@.str = [4 x i8] c"one\00"
define void @test_nolist() {
%1 = tail call i32 @dlist_index(i32* null, i32 0)
%2 = icmp eq i32 %1, -1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @dlist_position(i32* null, i32* null)
%6 = icmp eq i32 %5, -1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32* @dlist_nth_node(i32* null, i32 0)
%10 = icmp eq i32* %9, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32* @dlist_nth_data(i32* null, i32 0)
%14 = icmp eq i32* %13, null
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32* @dlist_remove(i32* null, i32* null)
%18 = icmp eq i32* %17, null
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call %struct.dlist* @dlist_reverse(%struct.dlist* null)
%22 = icmp eq %struct.dlist* %21, null
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @dlist_foreach(i32* null, i32* null, i32* null)
%26 = tail call i32* @dlist_find_custom(i32* null, i32* null, i32* null)
%27 = icmp eq i32* %26, null
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call %struct.dlist* @dlist_append(%struct.dlist* null, i8* null)
%31 = tail call i32 @dlist_free(%struct.dlist* %30, i32* null)
%32 = tail call %struct.dlist* @dlist_append(%struct.dlist* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%33 = tail call %struct.dlist* @dlist_reverse(%struct.dlist* %32)
%34 = tail call i32 @dlist_free(%struct.dlist* %33, i32* null)
ret void
}