#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*/ expect_conc_llist_to_modify_lists();
int /*<<< orphan*/ expect_cons_llist_and_tail_llist_to_work_consistently();
int /*<<< orphan*/ expect_cons_llist_to_not_be_null();
int /*<<< orphan*/ expect_iter_llist_to_iterate_over_every_value();
int /*<<< orphan*/ expect_length_llist_to_work();
int /*<<< orphan*/ expect_map_llist_to_map_every_value();
int /*<<< orphan*/ expect_nil_llist_can_be_destroyed();
int /*<<< orphan*/ expect_nth_llist_to_work();
int /*<<< orphan*/ expect_push_llist_and_pop_llist_to_work_consistently();
int /*<<< orphan*/ expect_push_llist_to_accept_many_elements(int);
int /*<<< orphan*/ expect_reverse_llist_to_generate_a_reversed_list();
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void llist_test(int n_repetitions) {
  printf("\tLinked List Test Routine");
  for (; n_repetitions > 0; n_repetitions--) {
    expect_nil_llist_can_be_destroyed();
    expect_cons_llist_to_not_be_null();
    expect_cons_llist_and_tail_llist_to_work_consistently();
    expect_push_llist_and_pop_llist_to_work_consistently();
    expect_push_llist_to_accept_many_elements(1000000);
    expect_iter_llist_to_iterate_over_every_value();
    expect_reverse_llist_to_generate_a_reversed_list();
    expect_map_llist_to_map_every_value();
    expect_length_llist_to_work();
    expect_nth_llist_to_work();
    expect_conc_llist_to_modify_lists();
    printf(".");
    fflush(NULL);
  }
  printf("\n\tLinked List Tests Complete.\n");
}


x86 assembly (clang, -O0):
<llist_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe1e(%rip),%rdi
call   1080 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    1264 <llist_test+0x94>
mov    $0x0,%al
call   1090 <expect_nil_llist_can_be_destroyed@plt>
mov    $0x0,%al
call   10a0 <expect_cons_llist_to_not_be_null@plt>
mov    $0x0,%al
call   10c0 <expect_cons_llist_and_tail_llist_to_work_consistently@plt>
mov    $0x0,%al
call   10b0 <expect_push_llist_and_pop_llist_to_work_consistently@plt>
mov    $0xf4240,%edi
call   1050 <expect_push_llist_to_accept_many_elements@plt>
mov    $0x0,%al
call   10e0 <expect_iter_llist_to_iterate_over_every_value@plt>
mov    $0x0,%al
call   1030 <expect_reverse_llist_to_generate_a_reversed_list@plt>
mov    $0x0,%al
call   1040 <expect_map_llist_to_map_every_value@plt>
mov    $0x0,%al
call   10d0 <expect_length_llist_to_work@plt>
mov    $0x0,%al
call   1070 <expect_nth_llist_to_work@plt>
mov    $0x0,%al
call   1060 <expect_conc_llist_to_modify_lists@plt>
lea    0xdd2(%rip),%rdi
call   1080 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <fflush@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    11e7 <llist_test+0x17>
lea    0xdb1(%rip),%rdi
call   1080 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llist_test>:
push   %rbx
mov    %edi,%ebx
lea    0xe06(%rip),%rdi
call   10a0 <printf@plt>
test   %ebx,%ebx
jle    1279 <llist_test+0x89>
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <expect_nil_llist_can_be_destroyed@plt>
xor    %eax,%eax
call   10c0 <expect_cons_llist_to_not_be_null@plt>
xor    %eax,%eax
call   10e0 <expect_cons_llist_and_tail_llist_to_work_consistently@plt>
xor    %eax,%eax
call   10d0 <expect_push_llist_and_pop_llist_to_work_consistently@plt>
mov    $0xf4240,%edi
call   1050 <expect_push_llist_to_accept_many_elements@plt>
xor    %eax,%eax
call   1100 <expect_iter_llist_to_iterate_over_every_value@plt>
xor    %eax,%eax
call   1030 <expect_reverse_llist_to_generate_a_reversed_list@plt>
xor    %eax,%eax
call   1040 <expect_map_llist_to_map_every_value@plt>
xor    %eax,%eax
call   10f0 <expect_length_llist_to_work@plt>
xor    %eax,%eax
call   1090 <expect_nth_llist_to_work@plt>
xor    %eax,%eax
call   1070 <expect_conc_llist_to_modify_lists@plt>
mov    $0x2e,%edi
call   1060 <putchar@plt>
xor    %edi,%edi
call   1110 <fflush@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1210 <llist_test+0x20>
lea    0xd9a(%rip),%rdi
pop    %rbx
jmp    1080 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"\09Linked List Test Routine\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [31 x i8] c"\0A\09Linked List Tests Complete.\0A\00"
define void @llist_test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %21, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = call i32 (...) @expect_nil_llist_can_be_destroyed()
%9 = call i32 (...) @expect_cons_llist_to_not_be_null()
%10 = call i32 (...) @expect_cons_llist_and_tail_llist_to_work_consistently()
%11 = call i32 (...) @expect_push_llist_and_pop_llist_to_work_consistently()
%12 = call i32 @expect_push_llist_to_accept_many_elements(i32 1000000)
%13 = call i32 (...) @expect_iter_llist_to_iterate_over_every_value()
%14 = call i32 (...) @expect_reverse_llist_to_generate_a_reversed_list()
%15 = call i32 (...) @expect_map_llist_to_map_every_value()
%16 = call i32 (...) @expect_length_llist_to_work()
%17 = call i32 (...) @expect_nth_llist_to_work()
%18 = call i32 (...) @expect_conc_llist_to_modify_lists()
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @fflush(i32* null)
br label %21
21: ; preds = %7
%22 = load i32, i32* %2
%23 = add nsw i32 %22, -1
store i32 %23, i32* %2
br label %4
24: ; preds = %4
%25 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09Linked List Test Routine\00"
@str = [30 x i8] c"\0A\09Linked List Tests Complete.\00"
define void @llist_test(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %21
4: ; preds = %1, %4
%5 = phi i32 [ %19, %4 ], [ %0, %1 ]
%6 = tail call i32 (...) @expect_nil_llist_can_be_destroyed()
%7 = tail call i32 (...) @expect_cons_llist_to_not_be_null()
%8 = tail call i32 (...) @expect_cons_llist_and_tail_llist_to_work_consistently()
%9 = tail call i32 (...) @expect_push_llist_and_pop_llist_to_work_consistently()
%10 = tail call i32 @expect_push_llist_to_accept_many_elements(i32 1000000)
%11 = tail call i32 (...) @expect_iter_llist_to_iterate_over_every_value()
%12 = tail call i32 (...) @expect_reverse_llist_to_generate_a_reversed_list()
%13 = tail call i32 (...) @expect_map_llist_to_map_every_value()
%14 = tail call i32 (...) @expect_length_llist_to_work()
%15 = tail call i32 (...) @expect_nth_llist_to_work()
%16 = tail call i32 (...) @expect_conc_llist_to_modify_lists()
%17 = tail call i32 @putchar(i32 46)
%18 = tail call i32 @fflush(i32* null)
%19 = add nsw i32 %5, -1
%20 = icmp ugt i32 %5, 1
br i1 %20, label %4, label %21
21: ; preds = %4, %1
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}