// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/htab.cpp
// Function: gen_hh(ha_ct_t const*, int)
static yak_ft_t *gen_hh(const ha_ct_t *h, int max_cnt)
{
	int i;
	yak_ft_t *hh;
	if (max_cnt > YAK_MAX_COUNT - 1) max_cnt = YAK_MAX_COUNT - 1;
	if (max_cnt > INT16_MAX - 1) max_cnt = INT16_MAX - 1;
	hh = yak_ft_init();
	yak_ft_resize(hh, h->tot * 2);
	for (i = 0; i < 1<<h->pre; ++i) {
		yak_ct_t *ht = h->h[i].h;
		khint_t k, l;
		for (k = 0; k < kh_end(ht); ++k) {
			if (kh_exist(ht, k)) {
				uint64_t y = kh_key(ht, k) >> h->pre << YAK_COUNTER_BITS | i;
				int absent;
				l = yak_ft_put(hh, y, &absent);
				if (absent) {
					int cnt = kh_key(ht, k) & YAK_MAX_COUNT;
					kh_val(hh, l) = cnt > max_cnt? INT16_MAX : cnt;
				}
			}
		}
	}
	return hh;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0xffe, %eax            # imm = 0xFFE
cmpl %eax, %esi
cmovll %esi, %eax
movl %eax, 0xc(%rsp)
callq 0xdaa9e
movq %rax, %r14
movl 0x10(%rbx), %esi
addl %esi, %esi
movq %rax, %rdi
callq 0xdaaa9
movq %rbx, %r11
xorl %r12d, %r12d
movb 0x4(%r11), %cl
pushq $0x1
popq %rax
shll %cl, %eax
cltq
cmpq %rax, %r12
jge 0xd60c8
movq 0x20(%r11), %rax
movq %r12, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rbp
xorl %r13d, %r13d
movq %r12, 0x10(%rsp)
movq 0x10(%rbp), %rax
testq %rax, %rax
je 0xd5f8b
movb (%rbp), %cl
pushq $0x1
popq %rdx
shlq %cl, %rdx
jmp 0xd5f8d
xorl %edx, %edx
cmpq %rdx, %r13
jae 0xd60c0
movq 0x8(%rbp), %rcx
movq %r13, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r13d, %ecx
jae 0xd60b8
movq (%rax,%r13,8), %r15
movb 0x4(%r11), %cl
shrq %cl, %r15
cmpq $0x0, 0x10(%r14)
je 0xd5fcc
movb (%r14), %cl
pushq $0x1
popq %rax
movl %eax, %ebx
shll %cl, %ebx
jmp 0xd5fce
xorl %ebx, %ebx
movl %ebx, %eax
shrl %eax
movl %ebx, %ecx
shrl $0x2, %ecx
addl %eax, %ecx
cmpl %ecx, 0x4(%r14)
jae 0xd5fe4
movl (%r14), %ecx
jmp 0xd600c
movq %r11, %r12
leal 0x1(%rbx), %esi
movq %r14, %rdi
callq 0xdaaa9
testl %eax, %eax
js 0xd6086
movl (%r14), %ecx
pushq $0x1
popq %rax
movl %eax, %ebx
shll %cl, %ebx
movq %r12, %r11
movq 0x10(%rsp), %r12
shlq $0xc, %r15
orq %r12, %r15
imull $0x9e3779b9, %r15d, %eax # imm = 0x9E3779B9
negb %cl
shrl %cl, %eax
decl %ebx
movq 0x8(%r14), %rdx
movl %eax, %ecx
movl %ecx, %esi
shrl $0x5, %esi
movl (%rdx,%rsi,4), %r8d
pushq $0x1
popq %rdi
shll %cl, %edi
btl %ecx, %r8d
jae 0xd6065
movq 0x10(%r14), %r9
movl %ecx, %r10d
imulq $0xa, %r10, %r10
cmpq %r15, (%r9,%r10)
je 0xd6065
incl %ecx
andl %ebx, %ecx
cmpl %eax, %ecx
jne 0xd6026
movl %eax, %esi
shrl $0x5, %esi
pushq $0x1
popq %rdi
movl %eax, %ecx
shll %cl, %edi
movl (%rdx,%rsi,4), %r8d
jmp 0xd6067
movl %ecx, %eax
testl %r8d, %edi
jne 0xd60b8
movq 0x10(%r14), %rcx
movl %eax, %eax
imulq $0xa, %rax, %r9
movq %r15, (%rcx,%r9)
orl %r8d, %edi
movl %edi, (%rdx,%rsi,4)
incl 0x4(%r14)
jmp 0xd6094
movq 0x10(%r14), %rcx
movl %ebx, %eax
movq %r12, %r11
movq 0x10(%rsp), %r12
movq 0x10(%rbp), %rdx
movl (%rdx,%r13,8), %edx
movl $0xfff, %esi            # imm = 0xFFF
andl %esi, %edx
cmpl 0xc(%rsp), %edx
movl $0x7fff, %esi           # imm = 0x7FFF
cmovgl %esi, %edx
imulq $0xa, %rax, %rax
movw %dx, 0x8(%rcx,%rax)
incq %r13
jmp 0xd5f77
incq %r12
jmp 0xd5f4c
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq