// File: /workspace/github_cpp_makefile_star2_O3/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)
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, %r14
movl 0x10(%rbx), %esi
addl %esi, %esi
movq %rax, %rdi
callq 0x11e702
cmpl $0x1f, 0x4(%rbx)
je 0x11a811
movq %rbx, %r11
xorl %r15d, %r15d
movq 0x20(%r11), %rax
movq %r15, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r12
xorl %r13d, %r13d
movq %r15, 0x10(%rsp)
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x11a6be
movb (%r12), %cl
movl $0x1, %edx
shlq %cl, %rdx
jmp 0x11a6c0
xorl %edx, %edx
cmpq %rdx, %r13
jae 0x11a7f8
movq 0x8(%r12), %rcx
movq %r13, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r13d, %ecx
jae 0x11a7f0
movq (%rax,%r13,8), %rbp
movb 0x4(%r11), %cl
shrq %cl, %rbp
cmpq $0x0, 0x10(%r14)
je 0x11a700
movb (%r14), %cl
movl $0x1, %ebx
shll %cl, %ebx
jmp 0x11a702
xorl %ebx, %ebx
movl %ebx, %eax
shrl %eax
movl %ebx, %ecx
shrl $0x2, %ecx
addl %eax, %ecx
cmpl %ecx, 0x4(%r14)
jae 0x11a718
movl (%r14), %ecx
jmp 0x11a740
movq %r11, %r15
leal 0x1(%rbx), %esi
movq %r14, %rdi
callq 0x11e702
testl %eax, %eax
js 0x11a7bd
movl (%r14), %ecx
movl $0x1, %ebx
shll %cl, %ebx
movq %r15, %r11
movq 0x10(%rsp), %r15
shlq $0xc, %rbp
orq %r15, %rbp
imull $0x9e3779b9, %ebp, %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
movl $0x1, %edi
shll %cl, %edi
btl %ecx, %r8d
jae 0x11a79c
movq 0x10(%r14), %r9
movl %ecx, %r10d
leaq (%r10,%r10,4), %r10
cmpq %rbp, (%r9,%r10,2)
je 0x11a79c
incl %ecx
andl %ebx, %ecx
cmpl %eax, %ecx
jne 0x11a759
movl %eax, %esi
shrl $0x5, %esi
movl $0x1, %edi
movl %eax, %ecx
shll %cl, %edi
movl (%rdx,%rsi,4), %r8d
jmp 0x11a79e
movl %ecx, %eax
testl %r8d, %edi
jne 0x11a7f0
movq 0x10(%r14), %rcx
movl %eax, %eax
leaq (%rax,%rax,4), %r9
movq %rbp, (%rcx,%r9,2)
orl %r8d, %edi
movl %edi, (%rdx,%rsi,4)
incl 0x4(%r14)
jmp 0x11a7cb
movq 0x10(%r14), %rcx
movl %ebx, %eax
movq %r15, %r11
movq 0x10(%rsp), %r15
movq 0x10(%r12), %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
leaq (%rax,%rax,4), %rax
movw %dx, 0x8(%rcx,%rax,2)
incq %r13
jmp 0x11a6a6
movb 0x4(%r11), %cl
movl $0x1, %eax
shll %cl, %eax
incq %r15
cltq
cmpq %rax, %r15
jl 0x11a68f
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq