// File: /workspace/github_cpp_makefile_star2_O3/amadvance[P]tommyds/check.c
// Function: test_hashdyn
void test_hashdyn(void)
{
	tommy_hashdyn hashdyn;
	struct object_hash* HASH;
	unsigned i, j, n;
	unsigned limit;
	const unsigned size = TOMMY_SIZE;
	const unsigned module = TOMMY_SIZE / 4;

	HASH = malloc(size * sizeof(struct object_hash));

	for(i=0;i<size;++i)
		HASH[i].value = i % module;

	START("hashdyn stack");
	limit = 5 * isqrt(size);
	for(n=0;n<=limit;++n) {
		/* last iteration is full size */
		if (n == limit)
			n = limit = size;

		tommy_hashdyn_init(&hashdyn);

		/* insert */
		for(i=0;i<n;++i)
			tommy_hashdyn_insert(&hashdyn, &HASH[i].node, &HASH[i], HASH[i].value);

		if (tommy_hashdyn_memory_usage(&hashdyn) < n * sizeof(void*))
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

		if (tommy_hashdyn_count(&hashdyn) != n)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

		the_count = 0;
		tommy_hashdyn_foreach(&hashdyn, count_callback);
		if (the_count != n)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

		/* remove in backward order */
		for(i=0;i<n/2;++i)
			tommy_hashdyn_remove_existing(&hashdyn, &HASH[n-i-1].node);

		/* remove missing */
		for(i=0;i<n/2;++i)
			if (tommy_hashdyn_remove(&hashdyn, search_callback, &HASH[n-i-1], HASH[n-i-1].value) != 0)
				/* LCOV_EXCL_START */
				abort();
				/* LCOV_EXCL_STOP */

		/* remove search */
		for(i=0;i<n/2;++i)
			if (tommy_hashdyn_remove(&hashdyn, search_callback, &HASH[n/2-i-1], HASH[n/2-i-1].value) == 0)
				/* LCOV_EXCL_START */
				abort();
				/* LCOV_EXCL_STOP */

		tommy_hashdyn_done(&hashdyn);
	}
	STOP();

	START("hashdyn queue");
	limit = isqrt(size) / 16;
	for(n=0;n<=limit;++n) {
		/* last iteration is full size */
		if (n == limit)
			n = limit = size;

		tommy_hashdyn_init(&hashdyn);

		/* insert first run */
		for(j=0,i=0;i<n;++i)
			tommy_hashdyn_insert(&hashdyn, &HASH[i].node, &HASH[i], HASH[i].value);

		the_count = 0;
		tommy_hashdyn_foreach_arg(&hashdyn, count_arg_callback, &the_count);
		if (the_count != n)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */

		/* insert all the others */
		for(;i<size;++i,++j) {
			/* insert one */
			tommy_hashdyn_insert(&hashdyn, &HASH[i].node, &HASH[i], HASH[i].value);

			/* remove one */
			tommy_hashdyn_remove_existing(&hashdyn, &HASH[j].node);
		}

		for(;j<size;++j)
			if (tommy_hashdyn_remove(&hashdyn, search_callback, &HASH[j], HASH[j].value) == 0)
				/* LCOV_EXCL_START */
				abort();
				/* LCOV_EXCL_STOP */

		tommy_hashdyn_done(&hashdyn);
	}
	STOP();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0x3567e00, %edi        # imm = 0x3567E00
callq 0x10c0
movq %rax, %rbx
xorl %eax, %eax
xorl %ecx, %ecx
movl %eax, %edx
imulq $0x431bde83, %rdx, %rdx # imm = 0x431BDE83
shrq $0x30, %rdx
imull $0x3d090, %edx, %edx    # imm = 0x3D090
movl %eax, %esi
subl %edx, %esi
movl %esi, (%rbx,%rcx)
addq $0x38, %rcx
incl %eax
cmpq $0x3567e00, %rcx        # imm = 0x3567E00
jne 0x302b
movq $-0x20, %rax
leaq 0x8dae(%rip), %rcx      # 0xbe10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x3062
movl $0x0, 0x8d84(%rip)      # 0xbe00
leaq 0x4240(%rip), %rax      # 0x72c3
movq %rax, 0x1008d86(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x1008d82(%rip)   # 0x100be18
xorl %ebp, %ebp
movl $0x1388, %eax           # imm = 0x1388
leaq 0x20(%rsp), %r14
cmpl %eax, %ebp
movl $0xf4240, %ecx          # imm = 0xF4240
cmovel %ecx, %ebp
cmovel %ecx, %eax
movl %eax, 0x8(%rsp)
movq %r14, %rdi
callq 0x57f8
testl %ebp, %ebp
je 0x30e8
movq %rbp, %r12
movl %ebp, %ebp
movq %rbp, %r15
movq %rbx, %r13
leaq 0x8(%r13), %rsi
movslq (%r13), %rcx
movq %r14, %rdi
movq %r13, %rdx
callq 0x5837
addq $0x38, %r13
decq %r15
jne 0x30ca
jmp 0x30ed
movq %rbp, %r12
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x5a48
leaq (,%rbp,8), %rcx
cmpq %rcx, %rax
jb 0x3393
cmpq %rbp, 0x38(%rsp)
jne 0x3393
movl $0x0, 0x1008d05(%rip)   # 0x100be20
movq %r14, %rdi
leaq -0xe2d(%rip), %rsi      # 0x22f8
callq 0x59ac
movq %r12, %rbp
cmpl %ebp, 0x1008ced(%rip)   # 0x100be20
jne 0x3393
cmpl $0x2, %ebp
jb 0x31e2
movl %ebp, %eax
shrl %eax
movl %eax, %r12d
movq %rbp, (%rsp)
leal -0x1(%rbp), %r15d
movq %r12, %r13
movl %r15d, %ebp
movl %ebp, %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x5898
decl %ebp
decq %r13
jne 0x3157
movq %r12, %r13
movq (%rsp), %rbp
cmpl $0x2, %ebp
jb 0x31e2
movl %r15d, %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rdx
movslq (%rbx,%rax), %rcx
movq %r14, %rdi
leaq -0x196(%rip), %rsi      # 0x3003
callq 0x58fa
testq %rax, %rax
jne 0x3393
decl %r15d
decq %r13
jne 0x3180
cmpl $0x2, %ebp
jb 0x31e2
leal -0x1(%r12), %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rdx
movslq (%rbx,%rax), %rcx
movq %r14, %rdi
leaq -0x1cc(%rip), %rsi      # 0x3003
callq 0x58fa
testq %rax, %rax
je 0x3393
decq %r12
jne 0x31b4
movq %r14, %rdi
callq 0x582f
incl %ebp
movl 0x8(%rsp), %eax
cmpl %eax, %ebp
jbe 0x30a2
callq 0x1312
movq $-0x20, %rax
leaq 0x8c05(%rip), %rcx      # 0xbe10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x320b
movl $0x0, 0x8bdb(%rip)      # 0xbe00
leaq 0x40a5(%rip), %rax      # 0x72d1
movq %rax, 0x1008bdd(%rip)   # 0x100be10
callq 0x12e3
movq %rax, 0x1008bd9(%rip)   # 0x100be18
leaq 0x8(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
movl $0x3e, %r12d
leaq 0x20(%rsp), %r14
leaq -0x25a(%rip), %r13      # 0x3003
cmpl %r12d, %r15d
movl $0xf4240, %eax          # imm = 0xF4240
cmovel %eax, %r15d
cmovel %eax, %r12d
movq %r14, %rdi
callq 0x57f8
movl %r15d, %eax
movq %rax, (%rsp)
movq %r15, 0x8(%rsp)
testl %r15d, %r15d
je 0x32a9
movq (%rsp), %r15
movq %rbx, %rbp
leaq 0x8(%rbp), %rsi
movslq (%rbp), %rcx
movq %r14, %rdi
movq %rbp, %rdx
callq 0x5837
addq $0x38, %rbp
decq %r15
jne 0x328d
movl $0x0, 0x1008b6d(%rip)   # 0x100be20
movq %r14, %rdi
leaq -0xfbe(%rip), %rsi      # 0x22ff
leaq 0x1008b5c(%rip), %rdx   # 0x100be20
callq 0x59f3
movq 0x8(%rsp), %rbp
cmpl %ebp, 0x1008b4c(%rip)   # 0x100be20
jne 0x3393
xorl %eax, %eax
cmpl $0xf423f, %ebp          # imm = 0xF423F
ja 0x333d
movl %r12d, 0x14(%rsp)
movl $0xf4240, %r12d         # imm = 0xF4240
subl %ebp, %r12d
imulq $0x38, (%rsp), %r15
movq %r12, (%rsp)
movq 0x18(%rsp), %rbp
leaq (%r15,%rbp), %rsi
leaq (%r15,%rbp), %rdx
addq $-0x8, %rdx
movslq (%rdx), %rcx
movq %r14, %rdi
callq 0x5837
movq %r14, %rdi
movq %rbp, %rsi
callq 0x5898
addq $0x38, %rbp
decq %r12
jne 0x3300
movq 0x8(%rsp), %rbp
testl %ebp, %ebp
movl 0x14(%rsp), %r12d
movq (%rsp), %rax
je 0x3368
movl %eax, %eax
imulq $0x38, %rax, %r15
leaq (%rbx,%r15), %rdx
movslq (%rbx,%r15), %rcx
movq %r14, %rdi
movq %r13, %rsi
callq 0x58fa
testq %rax, %rax
je 0x3393
addq $0x38, %r15
cmpq $0x3567e00, %r15        # imm = 0x3567E00
jne 0x3343
movq %r14, %rdi
callq 0x582f
leal 0x1(%rbp), %eax
cmpl %r12d, %ebp
movl %eax, %r15d
jb 0x325d
callq 0x1312
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040