// File: /workspace/github_cpp_makefile_star2_O3/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, %r15d
movl %edi, %r12d
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x1050
movq %rax, %r14
testl %r12d, %r12d
jne 0x13fa
xorl %ebp, %ebp
xorl %edx, %edx
xorl %r13d, %r13d
xorl %r8d, %r8d
jmp 0x1502
movl %r12d, %eax
shrl $0x2, %eax
movl %eax, 0x8(%rsp)
xorl %ebp, %ebp
movl %r12d, 0x4(%rsp)
movl %r12d, %ebx
movl %r15d, %eax
shll $0xf, %eax
notl %eax
addl %r15d, %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, %r15d
shrl $0x10, %r15d
xorl %eax, %r15d
movl %r15d, %eax
xorl %edx, %edx
divl 0x8(%rsp)
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 %r14, %rdi
pushq $0x10
popq %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x18d9
cmpl $0x0, 0xc(%rsp)
movq 0x10(%r14), %r13
movl %eax, %r12d
je 0x14d1
pushq $0x10
popq %rdi
callq 0x1070
movdqa 0x10(%rsp), %xmm0
movdqu %xmm0, (%rax)
imulq $0x18, %r12, %rcx
movl $0x10, (%r13,%rcx)
movq %rax, 0x8(%r13,%rcx)
andl $0x0, 0x10(%r13,%rcx)
pushq $0x1
popq %rax
jmp 0x14dc
imulq $0x18, %r12, %rax
movl 0x10(%r13,%rax), %eax
incl %eax
imulq $0x18, %r12, %rcx
movl %eax, 0x10(%r13,%rcx)
addl %eax, %ebp
decl %ebx
jne 0x140e
movl 0x4(%r14), %edx
movb (%r14), %cl
pushq $0x1
popq %r8
shll %cl, %r8d
movl 0x4(%rsp), %r12d
movq 0x2aef(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xb62(%rip), %rsi       # 0x2075
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1060
movl 0x4(%r14), %ebx
pushq $0x1
popq %rbp
xorl %r15d, %r15d
testl %r12d, %r12d
je 0x1534
movb (%r14), %cl
movl %ebp, %eax
shll %cl, %eax
jmp 0x1536
xorl %eax, %eax
cmpl %eax, %r15d
je 0x1564
movq 0x8(%r14), %rax
movl %r15d, %ecx
shrl $0x5, %ecx
movl (%rax,%rcx,4), %eax
btl %r15d, %eax
jae 0x155f
movl %r15d, %eax
imulq $0x18, %rax, %rax
movq 0x8(%r13,%rax), %rdi
callq 0x1030
incl %r15d
jmp 0x1526
movq %r14, %rdi
callq 0x173c
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)