// File: /workspace/github_cpp_makefile_star2_O3/amadvance[P]tommyds/check.c
// Function: test_tree
void test_tree(void)
{
	tommy_tree tree;
	struct object_tree* OBJ;
	unsigned i;
	const unsigned size = TOMMY_SIZE / 4;

	OBJ = malloc(size * sizeof(struct object_tree));

	START("tree");
	tommy_tree_init(&tree, &compare);

	/* forward order */
	for(i=0;i<size;++i)
		OBJ[i].value = i;

	/* insert */
	for(i=0;i<size;++i)
		if (tommy_tree_insert(&tree, &OBJ[i].node, &OBJ[i]) != &OBJ[i])
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	if (tommy_tree_memory_usage(&tree) < size * sizeof(tommy_tree_node))
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	if (tommy_tree_count(&tree) != size)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	the_count = 0;
	tommy_tree_foreach(&tree, count_callback);
	if (the_count != size)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	the_count = 0;
	tommy_tree_foreach_arg(&tree, count_arg_callback, &the_count);
	if (the_count != size)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	/* search present */
	for(i=0;i<size/2;++i) {
		if (tommy_tree_search(&tree, &OBJ[i]) == 0)
				/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
		if (tommy_tree_search_compare(&tree, &compare, &OBJ[i]) == 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	/* insert existing */
	for(i=0;i<size;++i) {
		struct object_tree EXTRA;
		EXTRA.value = i;
		if (tommy_tree_insert(&tree, &EXTRA.node, &EXTRA) == &EXTRA)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	/* remove existing */
	for(i=0;i<size/2;++i)
		tommy_tree_remove_existing(&tree, &OBJ[i].node);

	/* remove missing */
	for(i=0;i<size/2;++i)
		if (tommy_tree_remove(&tree, &OBJ[i]) != 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	/* search missing */
	for(i=0;i<size/2;++i) {
		if (tommy_tree_search(&tree, &OBJ[i]) != 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
		if (tommy_tree_search_compare(&tree, &compare, &OBJ[i]) != 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	/* remove present */
	for(i=0;i<size/2;++i)
		if (tommy_tree_remove(&tree, &OBJ[size/2+i]) == 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	/* reverse order */
	for(i=0;i<size;++i)
		OBJ[i].value = size - i;

	/* insert */
	for(i=0;i<size;++i)
		if (tommy_tree_insert(&tree, &OBJ[i].node, &OBJ[i]) != &OBJ[i])
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	/* remove all */
	for(i=0;i<size;++i)
		tommy_tree_remove_existing(&tree, &OBJ[i].node);

	/* random order */
	for(i=0;i<size;++i)
		OBJ[i].value = tommy_inthash_u32(i);

	/* insert */
	for(i=0;i<size;++i)
		if (tommy_tree_insert(&tree, &OBJ[i].node, &OBJ[i]) != &OBJ[i])
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	/* remove all */
	for(i=0;i<size;++i)
		tommy_tree_remove_existing(&tree, &OBJ[i].node);

	STOP();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl $0xd59f80, %edi         # imm = 0xD59F80
callq 0x10c0
movq %rax, %rbx
movq $-0x20, %rax
movq %rbx, %r14
leaq 0x9e7f(%rip), %rcx      # 0xbe10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1f91
movl $0x0, 0x9e55(%rip)      # 0xbe00
leaq 0x5252(%rip), %rax      # 0x7204
movq %rax, 0x1009e57(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x1009e53(%rip)   # 0x100be18
leaq -0xe00(%rip), %rsi      # 0x11cc
leaq 0x8(%rsp), %rdi
callq 0x4b5b
xorl %eax, %eax
movq %r14, %rcx
movl %eax, (%rcx)
incq %rax
addq $0x38, %rcx
cmpq $0x3d090, %rax          # imm = 0x3D090
jne 0x1fdb
movl $0x3d090, %r13d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
movq %r14, %r12
leaq 0x8(%r12), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x4b69
cmpq %rax, %r12
jne 0x22f3
addq $0x38, %r12
decq %r13
jne 0x1ffa
leaq 0x8(%rsp), %rdi
callq 0x4e50
cmpq $0x7a11ff, %rax         # imm = 0x7A11FF
jbe 0x22f3
cmpq $0x3d090, 0x18(%rsp)    # imm = 0x3D090
jne 0x22f3
movl $0x0, 0x1009dd5(%rip)   # 0x100be20
leaq 0x2a6(%rip), %rsi       # 0x22f8
leaq 0x8(%rsp), %rdi
callq 0x4dcd
cmpl $0x3d090, 0x1009dba(%rip) # imm = 0x3D090
jne 0x22f3
movl $0x0, 0x1009daa(%rip)   # 0x100be20
leaq 0x1009da3(%rip), %rdx   # 0x100be20
leaq 0x27b(%rip), %rsi       # 0x22ff
leaq 0x8(%rsp), %rdi
callq 0x4e05
cmpl $0x3d090, 0x1009d88(%rip) # imm = 0x3D090
jne 0x22f3
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq -0xee0(%rip), %r12      # 0x11cc
leaq (%rbx,%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x4cfb
testq %rax, %rax
je 0x22f3
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4d4b
testq %rax, %rax
je 0x22f3
addq $0x38, %rbp
cmpq $0x6acfc0, %rbp         # imm = 0x6ACFC0
jne 0x20ac
xorl %ebp, %ebp
leaq 0x28(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x20(%rsp), %r13
movl %ebp, 0x20(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x4b69
cmpq %r13, %rax
je 0x22f3
incl %ebp
cmpl $0x3d090, %ebp          # imm = 0x3D090
jne 0x20f9
movl $0x8, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4d9d
addq $0x38, %r12
cmpq $0x6acfc8, %r12         # imm = 0x6ACFC8
jne 0x2129
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4c29
testq %rax, %rax
jne 0x22f3
addq $0x38, %r12
cmpq $0x6acfc0, %r12         # imm = 0x6ACFC0
jne 0x214a
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq -0xfae(%rip), %r12      # 0x11cc
leaq (%rbx,%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x4cfb
testq %rax, %rax
jne 0x22f3
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4d4b
testq %rax, %rax
jne 0x22f3
addq $0x38, %rbp
cmpq $0x6acfc0, %rbp         # imm = 0x6ACFC0
jne 0x217a
leaq 0x6acfc0(%rbx), %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
leaq (%r12,%r13), %rsi
movq %r15, %rdi
callq 0x4c29
testq %rax, %rax
je 0x22f3
addq $0x38, %r13
cmpq $0x6acfc0, %r13         # imm = 0x6ACFC0
jne 0x21c5
movl $0x3d090, %eax          # imm = 0x3D090
movq %r14, %rcx
movl %eax, (%rcx)
addq $0x38, %rcx
decq %rax
jne 0x21ef
movl $0x3d090, %r13d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
movq %r14, %r12
leaq 0x8(%r12), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x4b69
cmpq %rax, %r12
jne 0x22f3
addq $0x38, %r12
decq %r13
jne 0x2208
movl $0x8, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4d9d
addq $0x38, %r12
cmpq $0xd59f88, %r12         # imm = 0xD59F88
jne 0x2235
xorl %eax, %eax
movq %r14, %rcx
movl %eax, %edx
shrl $0x11, %edx
xorl %eax, %edx
movl %edx, %esi
shll $0x9, %esi
imull $0xffffe010, %edx, %edi # imm = 0xFFFFE010
subl %esi, %edx
xorl %edi, %edx
leal (,%rdx,8), %esi
imull $0xffffe400, %edx, %edi # imm = 0xFFFFE400
subl %esi, %edx
xorl %edi, %edx
movl %edx, %esi
shrl $0xf, %esi
xorl %edx, %esi
movl %esi, (%rcx)
addq $-0x3f, %rax
addq $0x38, %rcx
cmpq $-0xf05370, %rax        # imm = 0xFF0FAC90
jne 0x2253
movl $0x3d090, %r12d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
leaq 0x8(%r14), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x4b69
cmpq %rax, %r14
jne 0x22f3
addq $0x38, %r14
decq %r12
jne 0x229e
movl $0x8, %r15d
leaq 0x8(%rsp), %r14
leaq (%rbx,%r15), %rsi
movq %r14, %rdi
callq 0x4d9d
addq $0x38, %r15
cmpq $0xd59f88, %r15         # imm = 0xD59F88
jne 0x22c6
callq 0x1312
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040