// File: /workspace/github_cpp_makefile_star2_O1/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 0x8e49(%rip), %rcx      # 0xae10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x1fc7
movl $0x0, 0x8e1f(%rip)      # 0xae00
leaq 0x521c(%rip), %rax      # 0x7204
movq %rax, 0x1008e21(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1008e1d(%rip)   # 0x100ae18
leaq -0xe36(%rip), %rsi      # 0x11cc
leaq 0x8(%rsp), %rdi
callq 0x49de
xorl %eax, %eax
movq %r14, %rcx
movl %eax, (%rcx)
incq %rax
addq $0x38, %rcx
cmpq $0x3d090, %rax          # imm = 0x3D090
jne 0x2011
movl $0x3d090, %r13d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
movq %r14, %r12
leaq 0x8(%r12), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x49ec
cmpq %rax, %r12
jne 0x2329
addq $0x38, %r12
decq %r13
jne 0x2030
leaq 0x8(%rsp), %rdi
callq 0x4ca1
cmpq $0x7a11ff, %rax         # imm = 0x7A11FF
jbe 0x2329
cmpq $0x3d090, 0x18(%rsp)    # imm = 0x3D090
jne 0x2329
movl $0x0, 0x1008d9f(%rip)   # 0x100ae20
leaq 0x2a6(%rip), %rsi       # 0x232e
leaq 0x8(%rsp), %rdi
callq 0x4c24
cmpl $0x3d090, 0x1008d84(%rip) # imm = 0x3D090
jne 0x2329
movl $0x0, 0x1008d74(%rip)   # 0x100ae20
leaq 0x1008d6d(%rip), %rdx   # 0x100ae20
leaq 0x27b(%rip), %rsi       # 0x2335
leaq 0x8(%rsp), %rdi
callq 0x4c59
cmpl $0x3d090, 0x1008d52(%rip) # imm = 0x3D090
jne 0x2329
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq -0xf16(%rip), %r12      # 0x11cc
leaq (%rbx,%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x4b7e
testq %rax, %rax
je 0x2329
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4bd6
testq %rax, %rax
je 0x2329
addq $0x38, %rbp
cmpq $0x6acfc0, %rbp         # imm = 0x6ACFC0
jne 0x20e2
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 0x49ec
cmpq %r13, %rax
je 0x2329
incl %ebp
cmpl $0x3d090, %ebp          # imm = 0x3D090
jne 0x212f
movl $0x8, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4bf4
addq $0x38, %r12
cmpq $0x6acfc8, %r12         # imm = 0x6ACFC8
jne 0x215f
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4aac
testq %rax, %rax
jne 0x2329
addq $0x38, %r12
cmpq $0x6acfc0, %r12         # imm = 0x6ACFC0
jne 0x2180
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq -0xfe4(%rip), %r12      # 0x11cc
leaq (%rbx,%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x4b7e
testq %rax, %rax
jne 0x2329
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4bd6
testq %rax, %rax
jne 0x2329
addq $0x38, %rbp
cmpq $0x6acfc0, %rbp         # imm = 0x6ACFC0
jne 0x21b0
leaq 0x6acfc0(%rbx), %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
leaq (%r12,%r13), %rsi
movq %r15, %rdi
callq 0x4aac
testq %rax, %rax
je 0x2329
addq $0x38, %r13
cmpq $0x6acfc0, %r13         # imm = 0x6ACFC0
jne 0x21fb
movl $0x3d090, %eax          # imm = 0x3D090
movq %r14, %rcx
movl %eax, (%rcx)
addq $0x38, %rcx
decq %rax
jne 0x2225
movl $0x3d090, %r13d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
movq %r14, %r12
leaq 0x8(%r12), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x49ec
cmpq %rax, %r12
jne 0x2329
addq $0x38, %r12
decq %r13
jne 0x223e
movl $0x8, %r12d
leaq 0x8(%rsp), %r15
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x4bf4
addq $0x38, %r12
cmpq $0xd59f88, %r12         # imm = 0xD59F88
jne 0x226b
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 $0x38, %rcx
addq $-0x3f, %rax
cmpq $-0xf05370, %rax        # imm = 0xFF0FAC90
jne 0x2289
movl $0x3d090, %r12d         # imm = 0x3D090
leaq 0x8(%rsp), %r15
leaq 0x8(%r14), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x49ec
cmpq %rax, %r14
jne 0x2329
addq $0x38, %r14
decq %r12
jne 0x22d4
movl $0x8, %r15d
leaq 0x8(%rsp), %r14
leaq (%rbx,%r15), %rsi
movq %r14, %rdi
callq 0x4bf4
addq $0x38, %r15
cmpq $0xd59f88, %r15         # imm = 0xD59F88
jne 0x22fc
callq 0x1312
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040