// File: /workspace/github_cpp_makefile_star2_O1/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 0x3068
movq $-0x20, %rax
leaq 0x7d71(%rip), %rcx      # 0xae10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x309f
movl $0x0, 0x7d47(%rip)      # 0xae00
leaq 0x4203(%rip), %rax      # 0x72c3
movq %rax, 0x1007d49(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1007d45(%rip)   # 0x100ae18
xorl %r15d, %r15d
movl $0x1388, %eax           # imm = 0x1388
leaq 0x20(%rsp), %r14
leaq -0xa7(%rip), %r12       # 0x3040
cmpl %eax, %r15d
movl $0xf4240, %ecx          # imm = 0xF4240
cmovel %ecx, %r15d
cmovel %ecx, %eax
movl %eax, 0x10(%rsp)
movq %r14, %rdi
callq 0x566c
movl %r15d, %eax
movq %rax, 0x8(%rsp)
testl %r15d, %r15d
je 0x3133
movq 0x8(%rsp), %rbp
movq %rbx, %r13
leaq 0x8(%r13), %rsi
movslq (%r13), %rcx
movq %r14, %rdi
movq %r13, %rdx
callq 0x56ab
addq $0x38, %r13
decq %rbp
jne 0x3117
movq %r14, %rdi
callq 0x58cd
movq 0x8(%rsp), %rdx
leaq (,%rdx,8), %rcx
cmpq %rcx, %rax
jb 0x33e8
cmpq %rdx, 0x38(%rsp)
jne 0x33e8
movl $0x0, 0x1007cba(%rip)   # 0x100ae20
movq %r14, %rdi
leaq -0xe42(%rip), %rsi      # 0x232e
callq 0x5831
cmpl %r15d, 0x1007ca4(%rip)  # 0x100ae20
jne 0x33e8
movl %r15d, %eax
shrl %eax
movl %eax, 0x8(%rsp)
cmpl $0x2, %r15d
jb 0x31b7
movl 0x8(%rsp), %r13d
leal -0x1(%r15), %ebp
movl %ebp, %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x5713
decl %ebp
decq %r13
jne 0x319a
cmpl $0x2, %r15d
jb 0x31f0
movl 0x8(%rsp), %ebp
leal -0x1(%r15), %r13d
movl %r13d, %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rdx
movslq (%rbx,%rax), %rcx
movq %r14, %rdi
movq %r12, %rsi
callq 0x577a
testq %rax, %rax
jne 0x33e8
decl %r13d
decq %rbp
jne 0x31c5
cmpl $0x2, %r15d
jb 0x3224
movl 0x8(%rsp), %r13d
leal -0x1(%r13), %eax
imulq $0x38, %rax, %rax
leaq (%rbx,%rax), %rdx
movslq (%rbx,%rax), %rcx
movq %r14, %rdi
movq %r12, %rsi
callq 0x577a
testq %rax, %rax
je 0x33e8
decq %r13
jne 0x31fb
movq %r14, %rdi
callq 0x56a3
incl %r15d
movl 0x10(%rsp), %eax
cmpl %eax, %r15d
jbe 0x30e7
callq 0x1312
movq $-0x20, %rax
leaq 0x7bc1(%rip), %rcx      # 0xae10
incb 0x20(%rax,%rcx)
addq $0x20, %rax
cmpq $0xffffe0, %rax         # imm = 0xFFFFE0
jb 0x324f
movl $0x0, 0x7b97(%rip)      # 0xae00
leaq 0x4061(%rip), %rax      # 0x72d1
movq %rax, 0x1007b99(%rip)   # 0x100ae10
callq 0x12e3
movq %rax, 0x1007b95(%rip)   # 0x100ae18
leaq 0x8(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
movl $0x3e, %ecx
leaq 0x20(%rsp), %r14
leaq -0x260(%rip), %r12      # 0x3040
cmpl %ecx, %r13d
movl $0xf4240, %eax          # imm = 0xF4240
cmovel %eax, %r13d
cmovel %eax, %ecx
movl %ecx, 0x8(%rsp)
movq %r14, %rdi
callq 0x566c
movl $0x0, %r15d
testl %r13d, %r13d
je 0x32f5
movl %r13d, %r12d
movq %rbx, %rbp
xorl %r15d, %r15d
leaq 0x8(%rbp), %rsi
movslq (%rbp), %rcx
movq %r14, %rdi
movq %rbp, %rdx
callq 0x56ab
incq %r15
addq $0x38, %rbp
cmpq %r15, %r12
jne 0x32cf
leaq -0x2b5(%rip), %r12      # 0x3040
movl $0x0, 0x1007b21(%rip)   # 0x100ae20
movq %r14, %rdi
leaq -0xfd4(%rip), %rsi      # 0x2335
leaq 0x1007b10(%rip), %rdx   # 0x100ae20
callq 0x5878
movq %r13, 0x10(%rsp)
cmpl %r13d, 0x1007aff(%rip)  # 0x100ae20
jne 0x33e8
xorl %r13d, %r13d
cmpl $0xf423f, %r15d         # imm = 0xF423F
ja 0x3380
movl %r15d, %eax
movl $0xf4240, %r12d         # imm = 0xF4240
subl %r15d, %r12d
imulq $0x38, %rax, %r15
movq 0x18(%rsp), %rbp
xorl %r13d, %r13d
leaq (%r15,%rbp), %rsi
leaq (%r15,%rbp), %rdx
addq $-0x8, %rdx
movslq (%rdx), %rcx
movq %r14, %rdi
callq 0x56ab
movq %r14, %rdi
movq %rbp, %rsi
callq 0x5713
incq %r13
addq $0x38, %rbp
cmpq %r13, %r12
jne 0x334b
leaq -0x340(%rip), %r12      # 0x3040
cmpl $0xf423f, %r13d         # imm = 0xF423F
ja 0x33b5
movl %r13d, %eax
imulq $0x38, %rax, %r15
leaq (%rbx,%r15), %rdx
movslq (%rbx,%r15), %rcx
movq %r14, %rdi
movq %r12, %rsi
callq 0x577a
testq %rax, %rax
je 0x33e8
addq $0x38, %r15
cmpq $0x3567e00, %r15        # imm = 0x3567E00
jne 0x3390
movq %r14, %rdi
callq 0x56a3
movq 0x10(%rsp), %rdx
leal 0x1(%rdx), %eax
movl 0x8(%rsp), %ecx
cmpl %ecx, %edx
movl %eax, %r13d
jb 0x32a0
callq 0x1312
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040