// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/htab.cpp
// Function: yak_pt_m_resize(yak_pt_t*, unsigned int)
KRADIX_SORT_INIT(ha64, uint64_t, generic_key, 8)

typedef struct {
	yak_pt_t *h;
	uint64_t n;
	ha_idxpos_t *a;
	ha_idxposl_t *al;
} ha_pt1_t;

struct ha_pt_s {
	int k, pre;
	uint64_t tot, tot_pos;
	ha_pt1_t *h;
};

typedef struct {
	const ha_ct_t *ct;
	ha_pt_t *pt;
	int is_l;
} pt_gen_aux_t;


static void worker_pt_shrink(void *data, long i, int tid) // callback for kt_for()
{
    ha_pt_t *h = (ha_pt_t*)data;
	ha_pt1_t *b = &h->h[i];
    yak_pt_t *f = NULL;
    khint_t k;
    f = yak_pt_init();
    for (k = 0, b->n = 0; k < kh_end(b->h); ++k) {
        if (kh_exist(b->h, k)) {
			if(kh_val(b->h, k) <= 0) continue;
			int absent; khint_t l;
			l = yak_pt_put(f, (kh_key(b->h, k) >> h->pre) << YAK_COUNTER_BITS, &absent);
			kh_val(f, l) = b->n; 
			b->n += kh_key(b->h, k) & YAK_MAX_COUNT;
        }
    }
    yak_pt_destroy(b->h);
    h->h[i].h = f;
	CALLOC(b->a, b->n);///need fix
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %eax, %eax
movl %esi, %ecx
cmpl $0x2, %ecx
jb 0xd8173
shrl %ecx
incl %eax
jmp 0xd8168
leal -0x1(%rsi), %ecx
andl %esi, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %eax
cmpl $0x3, %eax
pushq $0x2
popq %r15
cmovael %eax, %r15d
pushq $0x1
popq %rbp
movl %ebp, %r8d
movl %r15d, %ecx
shll %cl, %r8d
movl %r8d, %ecx
shrl %ecx
movl %r8d, %edx
shrl $0x2, %edx
addl %ecx, %edx
xorl %r12d, %r12d
cmpl %edx, 0x4(%rbx)
ja 0xd834c
movl %r8d, %ecx
shrl $0x3, %ecx
andl $-0x4, %ecx
cmpl $0x5, %eax
pushq $0x4
popq %rsi
cmovael %ecx, %esi
pushq $0x1
popq %rdi
movq %r8, %r13
callq 0x2120
pushq $-0x1
popq %r12
testq %rax, %rax
je 0xd834c
movq %rax, %r14
movl %r15d, (%rsp)
movq 0x10(%rbx), %rdi
movl %r13d, %esi
testq %rdi, %rdi
movq %r13, %rax
movq %rsi, 0x8(%rsp)
je 0xd8202
movb (%rbx), %cl
movl %ebp, %r15d
shll %cl, %r15d
cmpl %eax, %r15d
jb 0xd8205
jmp 0xd8224
xorl %r15d, %r15d
movq %rax, %r13
shlq $0x4, %rsi
callq 0x2370
testq %rax, %rax
je 0xd8344
movq %rax, %rdi
movq %rax, 0x10(%rbx)
movq %r13, %rax
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %r8d
pushq $0x20
popq %rax
subl (%rsp), %eax
movl %eax, 0x4(%rsp)
movl %r15d, %r9d
xorl %ecx, %ecx
movq %rbx, 0x18(%rsp)
cmpq %r9, %rcx
je 0xd8314
movq 0x8(%rbx), %r10
movl %ecx, %r11d
shrl $0x5, %r11d
movl (%r10,%r11,4), %esi
movl %ebp, %r15d
shll %cl, %r15d
btl %ecx, %esi
jae 0xd830c
leaq (%r10,%r11,4), %rax
movq %rcx, 0x20(%rsp)
movq %rcx, %r11
shlq $0x4, %r11
movq (%rdi,%r11), %r12
movq 0x8(%rdi,%r11), %rdx
notl %r15d
andl %esi, %r15d
movl %r15d, (%rax)
movq %r12, %rcx
shrq $0xc, %rcx
imull $0x9e3779b9, %ecx, %esi # imm = 0x9E3779B9
movl 0x4(%rsp), %ecx
shrl %cl, %esi
movl %esi, %r13d
shrl $0x5, %r13d
movl (%r14,%r13,4), %ebx
movl %ebp, %r15d
movl %esi, %ecx
shll %cl, %r15d
btl %esi, %ebx
jae 0xd82bc
incl %esi
andl %r8d, %esi
jmp 0xd829d
orl %r15d, %ebx
movl %ebx, (%r14,%r13,4)
movl %esi, %ebx
cmpl %r9d, %esi
jae 0xd82f5
movl (%r10,%r13,4), %esi
testl %r15d, %esi
je 0xd82f5
leaq (%r10,%r13,4), %rax
shlq $0x4, %rbx
movq (%rdi,%rbx), %r13
movq 0x8(%rdi,%rbx), %r11
movq %r12, (%rdi,%rbx)
movq %rdx, 0x8(%rdi,%rbx)
movq %r11, %rdx
movq %r13, %r12
jmp 0xd8281
shlq $0x4, %rbx
movq %r12, (%rdi,%rbx)
movq %rdx, 0x8(%rdi,%rbx)
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %rcx
incq %rcx
jmp 0xd8241
cmpl 0x10(%rsp), %r9d
jbe 0xd832d
movq 0x8(%rsp), %rsi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rdi
callq 0x2220
movq %r14, 0x8(%rbx)
movl (%rsp), %eax
movl %eax, (%rbx)
xorl %r12d, %r12d
jmp 0xd834c
movq %r14, %rdi
callq 0x2220
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq