// File: /workspace/github_cpp_makefile_star2_O3/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, %rbp
movq $0x0, (%rbp)
leaq -0x70a(%rip), %rsi      # 0x11cc
movq %rbp, %rdi
callq 0x482a
cmpq $0x0, (%rbp)
jne 0x1f60
movabsq $0x5851f42d4c957f2d, %r12 # imm = 0x5851F42D4C957F2D
movabsq $0x14057b7ef767814f, %r13 # imm = 0x14057B7EF767814F
movq 0xa504(%rip), %rcx      # 0xbe08
xorl %esi, %esi
movabsq $-0x17b7ffffffeff223, %r15 # imm = 0xE848000000100DDD
imulq %r12, %rcx
addq %r13, %rcx
cmpq $-0x86ac1, %rcx         # imm = 0xFFF7953F
ja 0x1910
movq %rcx, %rax
mulq %r15
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 0x196b
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rax)
movq %rdx, 0x8(%rdi)
movq 0x10(%rax), %rdi
jmp 0x1972
movq %rdx, 0x10(%rax)
movq %rbp, %rdi
movq $0x0, 0x8(%rax)
movq %rdx, (%rdi)
movq %rax, 0x18(%rax)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x1910
movq %rcx, 0xa474(%rip)      # 0xbe08
movq (%rsp), %rax
testq %rax, %rax
je 0x1f60
cmpq $0x0, 0x8(%rax)
je 0x1f60
movq $-0x20, %rax
leaq 0xa456(%rip), %rbp      # 0xbe10
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x19ba
movl $0x0, 0xa42c(%rip)      # 0xbe00
leaq 0x57c9(%rip), %rax      # 0x71a4
movq %rax, 0x100a42e(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a42a(%rip)   # 0x100be18
leaq -0x829(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x482a
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1a09
movl $0x0, 0xa3dd(%rip)      # 0xbe00
leaq 0x5777(%rip), %rax      # 0x71a1
movq %rax, 0x100a3df(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a3db(%rip)   # 0x100be18
leaq -0x860(%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 0xa393(%rip), %rcx      # 0xbe08
movabsq $0x28f5c28f5c28f5b, %rdi # imm = 0x28F5C28F5C28F5B
movq %rsp, %r10
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 %r12, %rcx
addq %r13, %rcx
cmpq $-0x11, %rcx
ja 0x1a99
cmpq %rdi, %rcx
ja 0x1ad7
imulq %r12, %rcx
addq %r13, %rcx
cmpq $-0x86ac1, %rcx         # imm = 0xFFF7953F
ja 0x1aab
movq %rcx, %rax
mulq %r15
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 0x1af6
movq 0x8(%rdx), %r9
movq %r9, 0x10(%r8)
movq %rax, 0x8(%rdx)
movq 0x10(%r8), %rdx
jmp 0x1afd
movq %rax, 0x10(%r8)
movq %r10, %rdx
movq $0x0, 0x8(%r8)
movq %rax, (%rdx)
movq %r8, 0x18(%r8)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x1a82
movq %rcx, 0xa2e5(%rip)      # 0xbe08
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1b2a
movl $0x0, 0xa2bc(%rip)      # 0xbe00
leaq 0x5668(%rip), %rax      # 0x71b3
movq %rax, 0x100a2be(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a2ba(%rip)   # 0x100be18
leaq -0x999(%rip), %rsi      # 0x11cc
movq %rsp, %r15
movq %r15, %rdi
callq 0x482a
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1b7c
movl $0x0, 0xa26a(%rip)      # 0xbe00
leaq 0x5613(%rip), %rax      # 0x71b0
movq %rax, 0x100a26c(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a268(%rip)   # 0x100be18
leaq -0x9d3(%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 0x1c0a
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rdx)
movq %rsi, 0x8(%rdi)
movq 0x10(%rdx), %rdi
jmp 0x1c11
movq %rsi, 0x10(%rdx)
movq %r15, %rdi
movq $0x0, 0x8(%rdx)
movq %rsi, (%rdi)
movq %rdx, 0x18(%rdx)
incq %rax
addq $0x38, %rdx
addq $0x14, %rcx
cmpq $0xf4240, %rax          # imm = 0xF4240
jne 0x1be7
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1c3a
movl $0x0, 0xa1ac(%rip)      # 0xbe00
leaq 0x5572(%rip), %rax      # 0x71cd
movq %rax, 0x100a1ae(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a1aa(%rip)   # 0x100be18
leaq -0xaa9(%rip), %rsi      # 0x11cc
movq %rsp, %r15
movq %r15, %rdi
callq 0x482a
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1c8c
movl $0x0, 0xa15a(%rip)      # 0xbe00
leaq 0x551d(%rip), %rax      # 0x71ca
movq %rax, 0x100a15c(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a158(%rip)   # 0x100be18
leaq -0xae3(%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 0x1d1e
movq 0x8(%rdi), %r8
movq %r8, 0x10(%rdx)
movq %rsi, 0x8(%rdi)
movq 0x10(%rdx), %rdi
jmp 0x1d25
movq %rsi, 0x10(%rdx)
movq %r15, %rdi
movq $0x0, 0x8(%rdx)
movq %rsi, (%rdi)
movq %rdx, 0x18(%rdx)
decl %eax
addq $0x38, %rdx
addq $0x14, %rcx
cmpq $0x1312d00, %rcx        # imm = 0x1312D00
jne 0x1cf9
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1d4e
movl $0x0, 0xa098(%rip)      # 0xbe00
leaq 0x546e(%rip), %rax      # 0x71dd
movq %rax, 0x100a09a(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a096(%rip)   # 0x100be18
leaq -0xbbd(%rip), %rsi      # 0x11cc
movq %rsp, %r15
movq %r15, %rdi
callq 0x482a
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1da0
movl $0x0, 0xa046(%rip)      # 0xbe00
leaq 0x5419(%rip), %rax      # 0x71da
movq %rax, 0x100a048(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x100a044(%rip)   # 0x100be18
leaq -0xbf7(%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 0x9ffc(%rip), %rcx      # 0xbe08
movabsq $-0x57ffffffffffde5, %rdi # imm = 0xFA8000000000021B
imulq %r12, %rcx
addq %r13, %rcx
cmpq $-0x227, %rcx           # imm = 0xFDD9
ja 0x1e16
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 0x1e67
movq 0x8(%r8), %r9
movq %r9, 0x10(%rax)
movq %rdx, 0x8(%r8)
movq 0x10(%rax), %r8
jmp 0x1e6e
movq %rdx, 0x10(%rax)
movq %r15, %r8
movq $0x0, 0x8(%rax)
movq %rdx, (%r8)
movq %rax, 0x18(%rax)
incq %rsi
cmpq $0xf4240, %rsi          # imm = 0xF4240
jne 0x1e16
movq %rcx, 0x9f78(%rip)      # 0xbe08
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1e97
movl $0x0, 0x9f4f(%rip)      # 0xbe00
leaq 0x5336(%rip), %rax      # 0x71ee
movq %rax, 0x1009f51(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x1009f4d(%rip)   # 0x100be18
leaq -0xd06(%rip), %rsi      # 0x11cc
movq %rsp, %rdi
callq 0x482a
callq 0x1312
movq $-0x20, %rax
incb 0x20(%rax,%rbp)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1ee6
movl $0x0, 0x9f00(%rip)      # 0xbe00
leaq 0x52e4(%rip), %rax      # 0x71eb
movq %rax, 0x1009f02(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x1009efe(%rip)   # 0x100be18
leaq -0xd3d(%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