// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movl $0xffe, %eax            # imm = 0xFFE
cmpl %eax, %esi
cmovll %esi, %eax
movl %eax, 0xc(%rsp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, %r14
movl 0x10(%r12), %esi
addl %esi, %esi
movq %rax, %rdi
callq 0x118b11
cmpl $0x1f, 0x4(%r12)
je 0x114da4
xorl %r10d, %r10d
movq 0x20(%r12), %rax
movq %r10, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r13
xorl %ebp, %ebp
movq %r10, 0x10(%rsp)
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x114c4d
movb (%r13), %cl
movl $0x1, %edx
shlq %cl, %rdx
jmp 0x114c4f
xorl %edx, %edx
cmpq %rdx, %rbp
jae 0x114d8a
movq 0x8(%r13), %rcx
movl %ebp, %edx
shrl $0x5, %edx
movl (%rcx,%rdx,4), %ecx
btl %ebp, %ecx
jae 0x114d82
movq (%rax,%rbp,8), %rbx
movb 0x4(%r12), %cl
shrq %cl, %rbx
cmpq $0x0, 0x10(%r14)
je 0x114c8e
movb (%r14), %cl
movl $0x1, %r15d
shll %cl, %r15d
jmp 0x114c91
xorl %r15d, %r15d
movl %r15d, %eax
shrl %eax
movl %r15d, %ecx
shrl $0x2, %ecx
addl %eax, %ecx
cmpl %ecx, 0x4(%r14)
jb 0x114cc9
leal 0x1(%r15), %esi
movq %r14, %rdi
callq 0x118b11
testl %eax, %eax
js 0x114d4d
movb (%r14), %cl
movl $0x1, %r15d
shll %cl, %r15d
movq 0x10(%rsp), %r10
shlq $0xc, %rbx
orq %r10, %rbx
imull $0x9e3779b9, %ebx, %edx # imm = 0x9E3779B9
movb (%r14), %al
xorl %ecx, %ecx
subb %al, %cl
shrl %cl, %edx
movl %r15d, %ecx
decl %ecx
movq 0x8(%r14), %rax
movl %edx, %r15d
movl %r15d, %esi
shrl $0x5, %esi
movl (%rax,%rsi,4), %esi
btl %r15d, %esi
jae 0x114d16
movq 0x10(%r14), %rsi
movl %r15d, %edi
leaq (%rdi,%rdi,4), %rdi
cmpq %rbx, (%rsi,%rdi,2)
je 0x114d16
incl %r15d
andl %ecx, %r15d
cmpl %edx, %r15d
jne 0x114ceb
movl %r15d, %edx
movl $0x1, %esi
movl %r15d, %ecx
shll %cl, %esi
shrl $0x5, %edx
movl (%rax,%rdx,4), %edi
movb $0x1, %cl
btl %r15d, %edi
jb 0x114d54
movq 0x10(%r14), %rcx
movl %r15d, %r8d
leaq (%r8,%r8,4), %r8
movq %rbx, (%rcx,%r8,2)
orl %edi, %esi
movl %esi, (%rax,%rdx,4)
incl 0x4(%r14)
xorl %ecx, %ecx
jmp 0x114d54
xorl %ecx, %ecx
movq 0x10(%rsp), %r10
testb %cl, %cl
jne 0x114d82
movq 0x10(%r13), %rax
movl (%rax,%rbp,8), %eax
movl $0xfff, %ecx            # imm = 0xFFF
andl %ecx, %eax
cmpl 0xc(%rsp), %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cmovgl %ecx, %eax
movq 0x10(%r14), %rcx
movl %r15d, %edx
leaq (%rdx,%rdx,4), %rdx
movw %ax, 0x8(%rcx,%rdx,2)
incq %rbp
jmp 0x114c36
movb 0x4(%r12), %cl
movl $0x1, %eax
shll %cl, %eax
incq %r10
cltq
cmpq %rax, %r10
jl 0x114c1f
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq