// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/khashl/test-block.c
// Function: test_int
KHASHL_CMAP_INIT(, blockmap_t, blockmap, udb_data_t, int, hash_fn_block, hash_eq_block)

uint32_t test_int(uint32_t n, uint32_t x0)
{
	uint32_t i, x, z = 0;
	khint_t k;
	udb_data_t t0, t;
	uint8_t block[MAX_BLOCK_LEN];
	blockmap_t *h;

	t0.data = block;
	h = blockmap_init();
	for (i = 0, x = x0; i < n; ++i) {
		khint_t k;
		int absent;
		x = hash32(x);
		t0.len = get_key_block(n, x, t0.data);
		k = blockmap_put(h, t0, &absent);
		if (absent) {
			t.len = t0.len;
			t.data = (uint8_t*)malloc(t.len);
			memcpy(t.data, t0.data, t.len);
			kh_key(h, k) = t;
			kh_val(h, k) = 0;
		}
		z += ++kh_val(h, k);
	}
	fprintf(stderr, "# unique keys: %d; checksum: %u; capacity: %u\n", kh_size(h), z, kh_capacity(h));
	x = kh_size(h);
	for (k = 0; k != kh_end(h); ++k)
		if (kh_exist(h, k))
			free(kh_key(h, k).data);
	blockmap_destroy(h);
	return x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r12d
movl %edi, %r15d
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x1060
movq %rax, %rbx
movl $0x0, %r14d
testl %r15d, %r15d
je 0x14ed
movl %r15d, %ebp
shrl $0x2, %ebp
xorl %r14d, %r14d
movl %r12d, %eax
shll $0xf, %eax
notl %eax
addl %r12d, %eax
movl %eax, %ecx
shrl $0xa, %ecx
xorl %eax, %ecx
leal (%rcx,%rcx,8), %eax
movl %eax, %ecx
shrl $0x6, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xb, %eax
notl %eax
addl %ecx, %eax
movl %eax, %r12d
shrl $0x10, %r12d
xorl %eax, %r12d
movl %r12d, %eax
xorl %edx, %edx
divl %ebp
movl %edx, %eax
shll $0xf, %eax
notl %eax
addl %edx, %eax
movl %eax, %ecx
shrl $0xa, %ecx
xorl %eax, %ecx
leal (%rcx,%rcx,8), %eax
movl %eax, %ecx
shrl $0x6, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xb, %eax
notl %eax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x10, %ecx
xorl %eax, %ecx
movd %ecx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x10(%rsp)
movq %rbx, %rdi
pushq $0x10
popq %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x18f5
cmpl $0x0, 0xc(%rsp)
movl %eax, %r13d
je 0x14cb
pushq $0x10
popq %rdi
callq 0x1080
movdqa 0x10(%rsp), %xmm0
movdqu %xmm0, (%rax)
movq 0x10(%rbx), %rcx
imulq $0x18, %r13, %rdx
movl $0x10, (%rcx,%rdx)
movq %rax, 0x8(%rcx,%rdx)
movq 0x10(%rbx), %rax
andl $0x0, 0x10(%rax,%rdx)
movq 0x10(%rbx), %rax
imulq $0x18, %r13, %rcx
movl 0x10(%rax,%rcx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x10(%rax,%rcx)
addl %edx, %r14d
incl %r14d
decl %r15d
jne 0x140e
movq 0x2b04(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movl 0x4(%rbx), %edx
cmpq $0x0, 0x10(%rbx)
pushq $0x1
popq %r15
movl $0x0, %r8d
je 0x1513
movb (%rbx), %cl
movl %r15d, %r8d
shll %cl, %r8d
leaq 0xb5b(%rip), %rsi       # 0x2075
xorl %r12d, %r12d
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1070
movl 0x4(%rbx), %ebp
movq 0x10(%rbx), %rax
movl $0x0, %edx
testq %rax, %rax
je 0x153f
movb (%rbx), %cl
movl %r15d, %edx
shll %cl, %edx
cmpl %edx, %r12d
je 0x156d
movq 0x8(%rbx), %rcx
movl %r12d, %edx
shrl $0x5, %edx
movl (%rcx,%rdx,4), %ecx
btl %r12d, %ecx
jae 0x1568
movl %r12d, %ecx
imulq $0x18, %rcx, %rcx
movq 0x8(%rax,%rcx), %rdi
callq 0x1030
incl %r12d
jmp 0x152a
movq %rbx, %rdi
callq 0x174c
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)