// File: /workspace/github_cpp_makefile_star2_O2/amadvance[P]tommyds/check.c
// Function: test_trie_inplace
void test_trie_inplace(void)
{
	tommy_trie_inplace trie_inplace;
	struct object_trie_inplace* OBJ;
	struct object_trie_inplace DUP[2];
	unsigned i;
	const unsigned size = TOMMY_SIZE * 4;

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

	for(i=0;i<size;++i)
		OBJ[i].value = i;

	START("trie_inplace");
	tommy_trie_inplace_init(&trie_inplace);

	/* insert */
	for(i=0;i<size;++i)
		tommy_trie_inplace_insert(&trie_inplace, &OBJ[i].node, &OBJ[i], OBJ[i].value);

	if (tommy_trie_inplace_memory_usage(&trie_inplace) < size * sizeof(tommy_trie_inplace_node))
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	if (tommy_trie_inplace_count(&trie_inplace) != size)
		/* LCOV_EXCL_START */
		abort();
		/* LCOV_EXCL_STOP */

	/* insert duplicates */
	for(i=0;i<2;++i) {
		DUP[i].value = 0;
		tommy_trie_inplace_insert(&trie_inplace, &DUP[i].node, &DUP[i], DUP[i].value);
	}

	/* search present */
	for(i=0;i<size/2;++i)
		if (tommy_trie_inplace_search(&trie_inplace, OBJ[i].value) == 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

	/* remove first duplicate */
	tommy_trie_inplace_remove_existing(&trie_inplace, &DUP[0].node);

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

	/* remove second duplicate */
	tommy_trie_inplace_remove_existing(&trie_inplace, &DUP[1].node);

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

	/* search missing */
	for(i=0;i<size/2;++i)
		if (tommy_trie_inplace_search(&trie_inplace, OBJ[i].value) != 0)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

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

	STOP();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movl $0x14fb1800, %edi       # imm = 0x14FB1800
callq 0x10b0
movq %rax, %rbx
xorl %eax, %eax
movq %rbx, %rcx
cmpq $0x3d0900, %rax         # imm = 0x3D0900
je 0x2f3b
movl %eax, (%rcx)
incq %rax
addq $0x58, %rcx
jmp 0x2f28
leaq 0x33be(%rip), %rdi      # 0x6300
callq 0x127d
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x421b
movl $0x3d0900, %r12d        # imm = 0x3D0900
movq %rbx, %r15
subq $0x1, %r12
jb 0x2f7e
leaq 0x8(%r15), %rsi
movslq (%r15), %rcx
movq %r14, %rdi
movq %r15, %rdx
callq 0x4236
addq $0x58, %r15
jmp 0x2f60
leaq 0xb0(%rsp), %rdi
callq 0x44d7
cmpq $0xf423fff, %rax        # imm = 0xF423FFF
jbe 0x30d7
cmpq $0x3d0900, 0x2b0(%rsp) # imm = 0x3D0900
jne 0x30d7
leaq 0x8(%rsp), %r15
xorl %r12d, %r12d
leaq 0xb0(%rsp), %r14
cmpq $0xb0, %r12
je 0x2fdd
leaq (%rsp,%r12), %rdx
andl $0x0, (%rdx)
leaq (%r15,%r12), %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x4236
addq $0x58, %r12
jmp 0x2fb9
xorl %ecx, %ecx
leaq 0xb0(%rsp), %r14
leaq 0x58(%rcx), %r15
cmpq $0xa7d8c58, %r15        # imm = 0xA7D8C58
je 0x300d
movslq (%rbx,%rcx), %rsi
movq %r14, %rdi
callq 0x30f0
movq %r15, %rcx
testq %rax, %rax
jne 0x2fe7
jmp 0x30d7
leaq 0x8(%rsp), %rsi
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x43fd
pushq $0x8
popq %r15
cmpq $0xa7d8c08, %r15        # imm = 0xA7D8C08
je 0x3041
leaq (%rbx,%r15), %rsi
movq %r14, %rdi
callq 0x43fd
addq $0x58, %r15
jmp 0x3026
leaq 0x60(%rsp), %rsi
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x43fd
xorl %ecx, %ecx
leaq 0x58(%rcx), %r15
cmpq $0xa7d8c58, %r15        # imm = 0xA7D8C58
je 0x307b
movslq (%rbx,%rcx), %rsi
movq %r14, %rdi
callq 0x42d6
movq %r15, %rcx
testq %rax, %rax
je 0x3058
jmp 0x30d7
xorl %ecx, %ecx
leaq 0xb0(%rsp), %r14
leaq 0x58(%rcx), %r15
cmpq $0xa7d8c58, %r15        # imm = 0xA7D8C58
je 0x30a8
movslq (%rbx,%rcx), %rsi
movq %r14, %rdi
callq 0x30f0
movq %r15, %rcx
testq %rax, %rax
je 0x3085
jmp 0x30d7
xorl %ecx, %ecx
leaq 0xb0(%rsp), %r14
leaq 0x58(%rcx), %r15
cmpq $0xa7d8c58, %r15        # imm = 0xA7D8C58
je 0x30dc
movslq 0xa7d8c00(%rbx,%rcx), %rsi
movq %r14, %rdi
callq 0x42d6
movq %r15, %rcx
testq %rax, %rax
jne 0x30b2
callq 0x1040
callq 0x12cf
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r14
popq %r15
retq