#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 ll_node {
  int dummy;
};
typedef struct ll_node ll;

/* Variables and functions */
int /*<<< orphan*/ assert(struct ll_node *);
int /*<<< orphan*/ assertClear(struct ll_node *);
int /*<<< orphan*/ assertDequeue(struct ll_node *);
int /*<<< orphan*/ assertEmptyList(struct ll_node *);
int /*<<< orphan*/ assertFree(struct ll_node *);
int /*<<< orphan*/ assertListNode(struct ll_node *, int);
int /*<<< orphan*/ assertMultiItem(struct ll_node *);
int /*<<< orphan*/ assertSingleItem(struct ll_node *);
int /*<<< orphan*/ ll_append(struct ll_node *, struct ll_node *);
struct ll_node *ll_create_node(int *);
struct ll_node *ll_init();
int /*<<< orphan*/ ll_prepend(struct ll_node *, struct ll_node *);
int /*<<< orphan*/ printf(char *);
int main() {
  struct ll *list;
  struct ll_node *node, *node2, *node3;
  int val = 4, val2 = 5, val3 = 6;
  printf("Testing linkedlist...\n");
  list = ll_init();
  printf("Checking list has been allocated... ");
  assert(list);
  printf("OK\n");
  assertEmptyList(list);
  node = ll_create_node(&val);
  assertListNode(node, val);
  ll_append(list, node);
  assertSingleItem(list);
  node2 = ll_create_node(&val2);
  node3 = ll_create_node(&val3);
  assert(node2);
  assert(node3);
  ll_append(list, node2);
  ll_prepend(list, node3);
  assertMultiItem(list);
  assertDequeue(list);
  assertClear(list);
  assertFree(list);
  printf("\nAll tests passed!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x4,-0x24(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x6,-0x2c(%rbp)
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <ll_init@plt>
mov    %rax,-0x8(%rbp)
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1080 <assert@plt>
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <assertEmptyList@plt>
lea    -0x24(%rbp),%rdi
call   1070 <ll_create_node@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10b0 <assertListNode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <ll_append@plt>
mov    -0x8(%rbp),%rdi
call   1060 <assertSingleItem@plt>
lea    -0x28(%rbp),%rdi
call   1070 <ll_create_node@plt>
mov    %rax,-0x18(%rbp)
lea    -0x2c(%rbp),%rdi
call   1070 <ll_create_node@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <assert@plt>
mov    -0x20(%rbp),%rdi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10c0 <ll_append@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <ll_prepend@plt>
mov    -0x8(%rbp),%rdi
call   10e0 <assertMultiItem@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <assertDequeue@plt>
mov    -0x8(%rbp),%rdi
call   10f0 <assertClear@plt>
mov    -0x8(%rbp),%rdi
call   1090 <assertFree@plt>
lea    0xd72(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x4,0x4(%rsp)
movl   $0x5,0xc(%rsp)
movl   $0x6,0x8(%rsp)
lea    0xe1d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <ll_init@plt>
mov    %rax,%rbx
lea    0xde2(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <assert@plt>
lea    0xe09(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <assertEmptyList@plt>
lea    0x4(%rsp),%rdi
call   1080 <ll_create_node@plt>
mov    %rax,%r14
mov    0x4(%rsp),%esi
mov    %rax,%rdi
call   10c0 <assertListNode@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <ll_append@plt>
mov    %rbx,%rdi
call   1070 <assertSingleItem@plt>
lea    0xc(%rsp),%rdi
call   1080 <ll_create_node@plt>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
call   1080 <ll_create_node@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1090 <assert@plt>
mov    %r15,%rdi
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <ll_append@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <ll_prepend@plt>
mov    %rbx,%rdi
call   10f0 <assertMultiItem@plt>
mov    %rbx,%rdi
call   10e0 <assertDequeue@plt>
mov    %rbx,%rdi
call   1100 <assertClear@plt>
mov    %rbx,%rdi
call   10a0 <assertFree@plt>
lea    0xd6c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ll = type opaque
%struct.ll_node = type { i32 }
@.str = [23 x i8] c"Testing linkedlist...\0A\00"
@.str.1 = [37 x i8] c"Checking list has been allocated... \00"
@.str.2 = [4 x i8] c"OK\0A\00"
@.str.3 = [20 x i8] c"\0AAll tests passed!\0A\00"
define i32 @main() {
%1 = alloca %struct.ll*
%2 = alloca %struct.ll_node*
%3 = alloca %struct.ll_node*
%4 = alloca %struct.ll_node*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 4, i32* %5
store i32 5, i32* %6
store i32 6, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call %struct.ll_node* (...) @ll_init()
%10 = bitcast %struct.ll_node* %9 to %struct.ll*
store %struct.ll* %10, %struct.ll** %1
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%12 = load %struct.ll*, %struct.ll** %1
%13 = bitcast %struct.ll* %12 to %struct.ll_node*
%14 = call i32 @assert(%struct.ll_node* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = load %struct.ll*, %struct.ll** %1
%17 = bitcast %struct.ll* %16 to %struct.ll_node*
%18 = call i32 @assertEmptyList(%struct.ll_node* %17)
%19 = call %struct.ll_node* @ll_create_node(i32* %5)
store %struct.ll_node* %19, %struct.ll_node** %2
%20 = load %struct.ll_node*, %struct.ll_node** %2
%21 = load i32, i32* %5
%22 = call i32 @assertListNode(%struct.ll_node* %20, i32 %21)
%23 = load %struct.ll*, %struct.ll** %1
%24 = bitcast %struct.ll* %23 to %struct.ll_node*
%25 = load %struct.ll_node*, %struct.ll_node** %2
%26 = call i32 @ll_append(%struct.ll_node* %24, %struct.ll_node* %25)
%27 = load %struct.ll*, %struct.ll** %1
%28 = bitcast %struct.ll* %27 to %struct.ll_node*
%29 = call i32 @assertSingleItem(%struct.ll_node* %28)
%30 = call %struct.ll_node* @ll_create_node(i32* %6)
store %struct.ll_node* %30, %struct.ll_node** %3
%31 = call %struct.ll_node* @ll_create_node(i32* %7)
store %struct.ll_node* %31, %struct.ll_node** %4
%32 = load %struct.ll_node*, %struct.ll_node** %3
%33 = call i32 @assert(%struct.ll_node* %32)
%34 = load %struct.ll_node*, %struct.ll_node** %4
%35 = call i32 @assert(%struct.ll_node* %34)
%36 = load %struct.ll*, %struct.ll** %1
%37 = bitcast %struct.ll* %36 to %struct.ll_node*
%38 = load %struct.ll_node*, %struct.ll_node** %3
%39 = call i32 @ll_append(%struct.ll_node* %37, %struct.ll_node* %38)
%40 = load %struct.ll*, %struct.ll** %1
%41 = bitcast %struct.ll* %40 to %struct.ll_node*
%42 = load %struct.ll_node*, %struct.ll_node** %4
%43 = call i32 @ll_prepend(%struct.ll_node* %41, %struct.ll_node* %42)
%44 = load %struct.ll*, %struct.ll** %1
%45 = bitcast %struct.ll* %44 to %struct.ll_node*
%46 = call i32 @assertMultiItem(%struct.ll_node* %45)
%47 = load %struct.ll*, %struct.ll** %1
%48 = bitcast %struct.ll* %47 to %struct.ll_node*
%49 = call i32 @assertDequeue(%struct.ll_node* %48)
%50 = load %struct.ll*, %struct.ll** %1
%51 = bitcast %struct.ll* %50 to %struct.ll_node*
%52 = call i32 @assertClear(%struct.ll_node* %51)
%53 = load %struct.ll*, %struct.ll** %1
%54 = bitcast %struct.ll* %53 to %struct.ll_node*
%55 = call i32 @assertFree(%struct.ll_node* %54)
%56 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.ll_node = type { i32 }
@.str.1 = [37 x i8] c"Checking list has been allocated... \00"
@str = [22 x i8] c"Testing linkedlist...\00"
@str.4 = [3 x i8] c"OK\00"
@str.5 = [19 x i8] c"\0AAll tests passed!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 4, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 5, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 6, i32* %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%8 = tail call %struct.ll_node* (...) @ll_init()
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @assert(%struct.ll_node* %8)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%12 = tail call i32 @assertEmptyList(%struct.ll_node* %8)
%13 = call %struct.ll_node* @ll_create_node(i32* %1)
%14 = load i32, i32* %1
%15 = call i32 @assertListNode(%struct.ll_node* %13, i32 %14)
%16 = call i32 @ll_append(%struct.ll_node* %8, %struct.ll_node* %13)
%17 = call i32 @assertSingleItem(%struct.ll_node* %8)
%18 = call %struct.ll_node* @ll_create_node(i32* %2)
%19 = call %struct.ll_node* @ll_create_node(i32* %3)
%20 = call i32 @assert(%struct.ll_node* %18)
%21 = call i32 @assert(%struct.ll_node* %19)
%22 = call i32 @ll_append(%struct.ll_node* %8, %struct.ll_node* %18)
%23 = call i32 @ll_prepend(%struct.ll_node* %8, %struct.ll_node* %19)
%24 = call i32 @assertMultiItem(%struct.ll_node* %8)
%25 = call i32 @assertDequeue(%struct.ll_node* %8)
%26 = call i32 @assertClear(%struct.ll_node* %8)
%27 = call i32 @assertFree(%struct.ll_node* %8)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}