// File: /workspace/github_cpp_makefile_star2_O1/amadvance[P]tommyds/check.c
// Function: test_list
void test_list(void)
{
	struct object* LIST;
	struct object_vector* VECTOR;
	tommy_node* list;
	unsigned i;
	const unsigned size = TOMMY_SIZE;

	LIST = malloc(size * sizeof(struct object));
	VECTOR = malloc(size * sizeof(struct object_vector));

	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = 0;
	}

	tommy_list_init(&list);

	/* sort an empty list */
	tommy_list_sort(&list, compare);

	if (!tommy_list_empty(&list))
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	if (tommy_list_tail(&list) != 0)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	if (tommy_list_head(&list) != 0)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = rnd(size);
		tommy_list_insert_tail(&list, &LIST[i].node, &LIST[i]);
	}

	if (tommy_list_tail(&list) == 0)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	if (tommy_list_head(&list) == 0)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	START("sort random");
	tommy_list_sort(&list, compare);
	STOP();

	START("C qsort random");
	qsort(VECTOR, size, sizeof(VECTOR[0]), compare_vector);
	STOP();

	test_list_order(list);

	/* forward order with some (1%) random values */
	list = 0;
	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = i;
		if (rnd(100) == 0)
			VECTOR[i].value = LIST[i].value = rnd(size);
		tommy_list_insert_tail(&list, &LIST[i].node, &LIST[i]);
	}

	START("sort partially ordered");
	tommy_list_sort(&list, compare);
	STOP();

	START("C qsort partially ordered");
	qsort(VECTOR, size, sizeof(VECTOR[0]), compare_vector);
	STOP();

	test_list_order(list);

	/* forward order */
	list = 0;
	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = i;
		tommy_list_insert_tail(&list, &LIST[i].node, &LIST[i]);
	}

	START("sort forward");
	tommy_list_sort(&list, compare);
	STOP();

	START("C qsort forward");
	qsort(VECTOR, size, sizeof(VECTOR[0]), compare_vector);
	STOP();

	test_list_order(list);

	/* backward order */
	list = 0;
	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = size - 1 - i;
		tommy_list_insert_tail(&list, &LIST[i].node, &LIST[i]);
	}

	START("sort backward");
	tommy_list_sort(&list, compare);
	STOP();

	START("C qsort backward");
	qsort(VECTOR, size, sizeof(VECTOR[0]), compare_vector);
	STOP();

	test_list_order(list);

	/* use a small range of random value to insert a lot of duplicates */
	list = 0;
	for(i=0;i<size;++i) {
		VECTOR[i].value = LIST[i].value = rnd(size / 1000 + 2);
		tommy_list_insert_tail(&list, &LIST[i].node, &LIST[i]);
	}

	START("sort random duplicate");
	tommy_list_sort(&list, compare);
	STOP();

	START("C qsort random duplicate");
	qsort(VECTOR, size, sizeof(VECTOR[0]), compare_vector);
	STOP();

	test_list_order(list);

	free(LIST);
	free(VECTOR);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x3567e00, %edi        # imm = 0x3567E00
callq 0x10c0
movq %rax, %rbx
movl $0x1312d00, %edi        # imm = 0x1312D00
callq 0x10c0
movq %rax, %r14
xorl %eax, %eax
xorl %ecx, %ecx
movq %rbx, %rdx
movl %eax, (%rdx)
movl %eax, (%r14,%rcx)
addq $0x38, %rdx
addq $0x14, %rcx
cmpq $0x1312d00, %rcx        # imm = 0x1312D00
jne 0x18ad
movq %rsp, %r15
movq $0x0, (%r15)
leaq -0x709(%rip), %rsi      # 0x11cc
movq %r15, %rdi
callq 0x4700
cmpq $0x0, (%r15)
jne 0x1f96
movabsq $0x5851f42d4c957f2d, %r15 # imm = 0x5851F42D4C957F2D
movabsq $0x14057b7ef767814f, %r12 # imm = 0x14057B7EF767814F
movq 0x9506(%rip), %rcx      # 0xae08
xorl %esi, %esi
movabsq $-0x17b7ffffffeff223, %rbp # imm = 0xE848000000100DDD
imulq %r15, %rcx
addq %r12, %rcx
cmpq $-0x86ac1, %rcx         # imm = 0xFFF7953F
ja 0x190e
movq %rcx, %rax
mulq %rbp
movq %rcx, %rdi
subq %rdx, %rdi
shrq %rdi
addq %rdx, %rdi
shrq $0x2c, %rdi
imulq $0x38, %rsi, %rdx
leaq (%rbx,%rdx), %rax
movl %edi, (%rbx,%rdx)
leaq (%rsi,%rsi,4), %r8
movl %edi, (%r14,%r8,4)
addq %rbx, %rdx
addq $0x8, %rdx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1974
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rax)
movq %rdx, 0x8(%rdi)
movq $0x0, 0x8(%rax)
movq 0x10(%rax), %rdi
movq %rdx, (%rdi)
jmp 0x1984
movq %rdx, 0x10(%rax)
movq $0x0, 0x8(%rax)
movq %rdx, (%rsp)
movq %rax, 0x18(%rax)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x190e
movq %rcx, 0x9469(%rip)      # 0xae08
movq (%rsp), %rax
testq %rax, %rax
je 0x1f96
cmpq $0x0, 0x8(%rax)
je 0x1f96
testq %rax, %rax
je 0x1f96
movq $-0x20, %rax
leaq 0x9442(%rip), %r13      # 0xae10
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x19ce
movl $0x0, 0x9417(%rip)      # 0xae00
leaq 0x57b4(%rip), %rax      # 0x71a4
movq %rax, 0x1009419(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1009415(%rip)   # 0x100ae18
leaq -0x83e(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x4700
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1a1e
movl $0x0, 0x93c7(%rip)      # 0xae00
leaq 0x5761(%rip), %rax      # 0x71a1
movq %rax, 0x10093c9(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x10093c5(%rip)   # 0x100ae18
leaq -0x876(%rip), %rcx      # 0x11e4
movl $0xf4240, %esi          # imm = 0xF4240
movl $0x14, %edx
movq %r14, %rdi
callq 0x1060
callq 0x1312
movq (%rsp), %rdi
callq 0x184c
movq $0x0, (%rsp)
xorl %esi, %esi
movq 0x937d(%rip), %rcx      # 0xae08
movabsq $0x28f5c28f5c28f5b, %rdi # imm = 0x28F5C28F5C28F5B
imulq $0x38, %rsi, %rax
leaq (%rbx,%rax), %r8
movl %esi, (%rbx,%rax)
leaq (%rsi,%rsi,4), %rax
leaq (%r14,%rax,4), %r9
movl %esi, (%r14,%rax,4)
imulq %r15, %rcx
addq %r12, %rcx
cmpq $-0x11, %rcx
ja 0x1aac
cmpq %rdi, %rcx
ja 0x1aea
imulq %r15, %rcx
addq %r12, %rcx
cmpq $-0x86ac1, %rcx         # imm = 0xFFF7953F
ja 0x1abe
movq %rcx, %rax
mulq %rbp
movq %rcx, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x2c, %rax
movl %eax, (%r8)
movl %eax, (%r9)
leaq 0x8(%r8), %rax
movq (%rsp), %rdx
testq %rdx, %rdx
je 0x1b14
movq 0x8(%rdx), %r9
movq %r9, 0x10(%r8)
movq %rax, 0x8(%rdx)
movq $0x0, 0x8(%r8)
movq 0x10(%r8), %rdx
movq %rax, (%rdx)
jmp 0x1b24
movq %rax, 0x10(%r8)
movq $0x0, 0x8(%r8)
movq %rax, (%rsp)
movq %r8, 0x18(%r8)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x1a95
movq %rcx, 0x92c9(%rip)      # 0xae08
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1b46
movl $0x0, 0x929f(%rip)      # 0xae00
leaq 0x564b(%rip), %rax      # 0x71b3
movq %rax, 0x10092a1(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x100929d(%rip)   # 0x100ae18
leaq -0x9b6(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x4700
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1b96
movl $0x0, 0x924f(%rip)      # 0xae00
leaq 0x55f8(%rip), %rax      # 0x71b0
movq %rax, 0x1009251(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x100924d(%rip)   # 0x100ae18
leaq -0x9ee(%rip), %rcx      # 0x11e4
movl $0xf4240, %esi          # imm = 0xF4240
movl $0x14, %edx
movq %r14, %rdi
callq 0x1060
callq 0x1312
movq (%rsp), %rdi
callq 0x184c
movq $0x0, (%rsp)
xorl %eax, %eax
movq %r14, %rcx
movq %rbx, %rdx
movl %eax, (%rdx)
movl %eax, (%rcx)
leaq 0x8(%rdx), %rsi
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1c30
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rdx)
movq %rsi, 0x8(%rdi)
movq $0x0, 0x8(%rdx)
movq 0x10(%rdx), %rdi
movq %rsi, (%rdi)
jmp 0x1c40
movq %rsi, 0x10(%rdx)
movq $0x0, 0x8(%rdx)
movq %rsi, (%rsp)
movq %rdx, 0x18(%rdx)
incq %rax
addq $0x38, %rdx
addq $0x14, %rcx
cmpq $0xf4240, %rax          # imm = 0xF4240
jne 0x1c02
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1c5e
movl $0x0, 0x9187(%rip)      # 0xae00
leaq 0x554d(%rip), %rax      # 0x71cd
movq %rax, 0x1009189(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1009185(%rip)   # 0x100ae18
leaq -0xace(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x4700
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1cae
movl $0x0, 0x9137(%rip)      # 0xae00
leaq 0x54fa(%rip), %rax      # 0x71ca
movq %rax, 0x1009139(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1009135(%rip)   # 0x100ae18
leaq -0xb06(%rip), %rcx      # 0x11e4
movl $0xf4240, %esi          # imm = 0xF4240
movl $0x14, %edx
movq %r14, %rdi
callq 0x1060
callq 0x1312
movq (%rsp), %rdi
callq 0x184c
movq $0x0, (%rsp)
movl $0xf423f, %eax          # imm = 0xF423F
xorl %ecx, %ecx
movq %rbx, %rdx
movl %eax, (%rdx)
movl %eax, (%r14,%rcx)
leaq 0x8(%rdx), %rsi
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d4c
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rdx)
movq %rsi, 0x8(%rdi)
movq $0x0, 0x8(%rdx)
movq 0x10(%rdx), %rdi
movq %rsi, (%rdi)
jmp 0x1d5c
movq %rsi, 0x10(%rdx)
movq $0x0, 0x8(%rdx)
movq %rsi, (%rsp)
movq %rdx, 0x18(%rdx)
addq $0x38, %rdx
addq $0x14, %rcx
decl %eax
cmpq $0x1312d00, %rcx        # imm = 0x1312D00
jne 0x1d1c
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1d7a
movl $0x0, 0x906b(%rip)      # 0xae00
leaq 0x5441(%rip), %rax      # 0x71dd
movq %rax, 0x100906d(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1009069(%rip)   # 0x100ae18
leaq -0xbea(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x4700
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1dca
movl $0x0, 0x901b(%rip)      # 0xae00
leaq 0x53ee(%rip), %rax      # 0x71da
movq %rax, 0x100901d(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1009019(%rip)   # 0x100ae18
leaq -0xc22(%rip), %rcx      # 0x11e4
movl $0xf4240, %esi          # imm = 0xF4240
movl $0x14, %edx
movq %r14, %rdi
callq 0x1060
callq 0x1312
movq (%rsp), %rdi
callq 0x184c
movq $0x0, (%rsp)
xorl %esi, %esi
movq 0x8fd1(%rip), %rcx      # 0xae08
movabsq $-0x57ffffffffffde5, %rdi # imm = 0xFA8000000000021B
imulq %r15, %rcx
addq %r12, %rcx
cmpq $-0x227, %rcx           # imm = 0xFDD9
ja 0x1e41
movq %rcx, %rax
mulq %rdi
shrq $0x36, %rdx
imulq $0x38, %rsi, %r8
leaq (%rbx,%r8), %rax
movl %edx, (%rbx,%r8)
leaq (%rsi,%rsi,4), %r9
movl %edx, (%r14,%r9,4)
leaq (%rbx,%r8), %rdx
addq $0x8, %rdx
movq (%rsp), %r8
testq %r8, %r8
je 0x1e9d
movq 0x8(%r8), %r9
movq %r9, 0x10(%rax)
movq %rdx, 0x8(%r8)
movq $0x0, 0x8(%rax)
movq 0x10(%rax), %r8
movq %rdx, (%r8)
jmp 0x1ead
movq %rdx, 0x10(%rax)
movq $0x0, 0x8(%rax)
movq %rdx, (%rsp)
movq %rax, 0x18(%rax)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x1e41
movq %rcx, 0x8f44(%rip)      # 0xae08
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1ecb
movl $0x0, 0x8f1a(%rip)      # 0xae00
leaq 0x5301(%rip), %rax      # 0x71ee
movq %rax, 0x1008f1c(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1008f18(%rip)   # 0x100ae18
leaq -0xd3b(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x4700
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%r13)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1f1b
movl $0x0, 0x8eca(%rip)      # 0xae00
leaq 0x52ae(%rip), %rax      # 0x71eb
movq %rax, 0x1008ecc(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1008ec8(%rip)   # 0x100ae18
leaq -0xd73(%rip), %rcx      # 0x11e4
movl $0xf4240, %esi          # imm = 0xF4240
movl $0x14, %edx
movq %r14, %rdi
callq 0x1060
callq 0x1312
movq (%rsp), %rdi
callq 0x184c
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040