// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/htab.cpp
// Function: ha_pt_ul_gen(hifiasm_opt_t const*, void const*, ma_utg_v*, int, int, int)
ha_pt_t *ha_pt_ul_gen(const hifiasm_opt_t *asm_opt, const void *flt_tab, ma_utg_v *us, int k, int w, int cutoff)
{
	ha_ct_t *ct;
	ha_pt_t *pt;
	///HAF_COUNT_EXACT: no bf
	ct = ha_count(asm_opt, HAF_COUNT_EXACT|HAF_UG_READ, !(asm_opt->flag&HA_F_NO_HPC), k, w, NULL, flt_tab, NULL, us, 0, NULL, 0);
	fprintf(stderr, "[M::%s::%.3f*%.2f] ==> counted %ld distinct minimizer k-mers\n", __func__,
			yak_realtime(), yak_cpu_usage(), (long)ct->tot);
	///minimizer with YAK_MAX_COUNT occ may apper > YAK_MAX_COUNT times, so it may lead to overflow at ha_pt_gen
	if (flt_tab == 0) {
        if (cutoff > YAK_MAX_COUNT - 1) cutoff = YAK_MAX_COUNT - 1;
        ha_ct_shrink(ct, /**2**/1, cutoff, asm_opt->thread_num);
    } else {
        ///Note: here is just to remove minimizer appearing YAK_MAX_COUNT times
        ///minimizer with YAK_MAX_COUNT occ may apper > YAK_MAX_COUNT times, so it may lead to overflow at ha_pt_gen
        ha_ct_shrink(ct, /**2**/1, YAK_MAX_COUNT - 1, asm_opt->thread_num);
    }
	
	pt = ha_pt_gen(ct, asm_opt->thread_num, 1);
	ha_count(asm_opt, HAF_COUNT_EXACT|HAF_UG_READ, !(asm_opt->flag&HA_F_NO_HPC), k, w, pt, flt_tab, NULL, us, 0, NULL, 0);
	//ha_pt_sort(pt, asm_opt->thread_num);
	fprintf(stderr, "[M::%s::%.3f*%.2f] ==> indexed %ld positions\n", __func__,
			yak_realtime(), yak_cpu_usage(), (long)pt->tot_pos);
	return pt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r13d
movl %r8d, 0xc(%rsp)
movl %ecx, %r15d
movq %rdx, %rax
movq %rdx, (%rsp)
movq %rsi, %rbx
movq %rdi, %r12
movl (%rdi), %edx
notl %edx
andl $0x1, %edx
subq $0x30, %rsp
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x18(%rsp)
andq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq %rsi, (%rsp)
movl $0x81, %esi
xorl %r9d, %r9d
callq 0x119f0d
addq $0x30, %rsp
movq %rax, %r14
movq 0x2814a9(%rip), %rax    # 0x294fe0
movq (%rax), %rbp
callq 0x1365ef
movsd %xmm0, 0x10(%rsp)
callq 0x1366b8
movaps %xmm0, %xmm1
movq 0x10(%r14), %rcx
leaq 0x2264d3(%rip), %rsi    # 0x23a02b
leaq 0x22650a(%rip), %rdx    # 0x23a069
movq %rbp, %rdi
movsd 0x10(%rsp), %xmm0
movb $0x2, %al
callq 0x22b0
movl $0xffe, %eax            # imm = 0xFFE
cmpl %eax, %r13d
cmovgel %eax, %r13d
testq %rbx, %rbx
cmovnel %eax, %r13d
movl 0x7c(%r12), %ecx
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
callq 0x137e4
movl 0x7c(%r12), %esi
movq %r14, %rdi
movl %ebp, %edx
callq 0x118cb9
movq %rax, %r13
movl (%r12), %edx
notl %edx
andl $0x1, %edx
movq %r12, %rdi
movl $0x81, %esi
movl %r15d, %ecx
movl 0xc(%rsp), %r8d
movq %rax, %r9
pushq $0x0
pushq $0x0
pushq $0x0
pushq 0x18(%rsp)
pushq $0x0
pushq %rbx
callq 0x119f0d
addq $0x30, %rsp
movq 0x2813fe(%rip), %rax    # 0x294fe0
movq (%rax), %rbx
callq 0x1365ef
movsd %xmm0, (%rsp)
callq 0x1366b8
movaps %xmm0, %xmm1
movq 0x10(%r13), %rcx
leaq 0x226474(%rip), %rsi    # 0x23a076
movq %rbx, %rdi
leaq 0x22645d(%rip), %rdx    # 0x23a069
movsd (%rsp), %xmm0
movb $0x2, %al
callq 0x22b0
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq