// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/htab.cpp
// Function: ha_count(hifiasm_opt_t const*, int, int, int, int, ha_pt_s*, void const*, All_reads*, ma_utg_v*, int, int*, int)
ha_ct_t *ha_count(const hifiasm_opt_t *asm_o, int flag, int HPC, int k, int w, ha_pt_t *p0, const void *flt_tab, All_reads *rs, ma_utg_v *us, int keep_adapter, int *low_freq, int unique_only)
{
	int i;
	int64_t n_seq = 0;
	uint64_t n_bs = 0;
	yak_copt_t opt;
	ha_ct_t *h = 0;
	assert(!(flag & HAF_RS_WRITE_LEN) || !(flag & HAF_RS_WRITE_SEQ)); // not both
	///for 0-th counting, flag = HAF_COUNT_ALL|HAF_RS_WRITE_LEN
	if (rs) {
		if (flag & HAF_RS_WRITE_LEN)
			init_All_reads(rs);
		else if (flag & HAF_RS_WRITE_SEQ)
			malloc_All_reads(rs);
	}
	yak_copt_init(&opt);
	opt.k = k;
	opt.is_HPC = HPC;
	///for ft-counting, shoud be 1
	opt.w = flag & HAF_COUNT_ALL? 1 : w;
	///for ft-counting, shoud be 37
	///for ha_pt_gen, shoud be 0
	opt.bf_shift = flag & HAF_COUNT_EXACT? 0 : asm_o->bf_shift;
	opt.n_thread = asm_o->thread_num;
	opt.adaLen = (keep_adapter? asm_o->adapterLen : 0);
	opt.min_rcnt = (low_freq?*low_freq:-1);
	opt.uq = (unique_only?1:0);
	
	n_bs = 0;
	///pending for integration
	/**
	if(rs && asm_o->ar && asm_o->ul_mod) {
		for (i = 0; i < asm_o->ar->n; ++i){
			h = yak_count(&opt, asm_o->ar->a[i], flag|HAF_CREATE_NEW, p0, h, flt_tab, rs, us, &n_seq);
			if(h) n_bs += h->bs;
		}
	}**/
	///asm_opt->num_reads is the number of fastq files
	for (i = 0; i < (us?1:asm_o->num_reads); ++i){
		h = yak_count(&opt, asm_o->read_file_names[i], flag|HAF_CREATE_NEW, p0, h, flt_tab, rs, us, &n_seq);
		if(h) n_bs += h->bs;
	}
	if(h) h->bs = n_bs;	
	if (h && opt.bf_shift > 0)
		ha_ct_destroy_bf(h);
	return h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r9, 0x68(%rsp)
movq %rdi, 0x10(%rsp)
movl %esi, %ebx
andl $0xc, %ebx
cmpl $0xc, %ebx
je 0x11a454
movl %r8d, %r14d
movl %ecx, %r12d
movl %edx, %r15d
movl %esi, %ebp
cmpq $0x0, 0x138(%rsp)
je 0x119f74
testb $0x4, %bpl
jne 0x119f67
testb $0x8, %bpl
je 0x119f74
movq 0x138(%rsp), %rdi
callq 0x32bbb
jmp 0x119f74
movq 0x138(%rsp), %rdi
callq 0x31c5c
movl 0x148(%rsp), %eax
movl $0x4, 0x3c(%rsp)
movl $0xc, 0x50(%rsp)
movq $0x1312d00, 0x58(%rsp)  # imm = 0x1312D00
movl %r12d, 0x40(%rsp)
movl %r15d, 0x48(%rsp)
testb $0x2, %bpl
movl $0x1, %ecx
cmovel %r14d, %ecx
movl %ecx, 0x44(%rsp)
xorl %ecx, %ecx
movl $0x0, %esi
testb $0x1, %bpl
movq 0x10(%rsp), %r14
jne 0x119fc8
movl 0xac(%r14), %esi
movq 0x150(%rsp), %rdx
movl %esi, 0x38(%rsp)
movl 0x7c(%r14), %esi
movl %esi, 0x54(%rsp)
testl %eax, %eax
movq 0x68(%rsp), %r15
je 0x119fec
movl 0x100(%r14), %ecx
movl 0x158(%rsp), %eax
movl %ecx, 0x60(%rsp)
testq %rdx, %rdx
je 0x11a000
movl (%rdx), %ecx
jmp 0x11a005
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0x38(%rsp), %rdx
movl %ecx, 0x2c(%rdx)
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, 0x14(%rdx)
movl %ebp, %eax
orl $0x20, %eax
movl %eax, 0x34(%rsp)
cmpq $0x0, 0x138(%rsp)
setne %al
movl %ebp, %ecx
shrb $0x4, %cl
andb %al, %cl
movb %cl, 0x9(%rsp)
cmpq $0x0, 0x140(%rsp)
setne %cl
testb %bpl, %bpl
sets %dl
andb %cl, %dl
movb %dl, 0xa(%rsp)
testl %ebx, %ebx
setne %cl
andb %al, %cl
movb %cl, 0xb(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq $0x0, 0x28(%rsp)
xorl %ebp, %ebp
movl $0x1, %eax
cmpq $0x0, 0x140(%rsp)
jne 0x11a07f
movslq 0x4(%r14), %rax
cmpq %rax, %r13
jge 0x11a3e4
movq 0x8(%r14), %rax
movq (%rax,%r13,8), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movq %r12, 0x98(%rsp)
cmpb $0x0, 0xa(%rsp)
je 0x11a0f1
movq 0x140(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x11a119
cmpb $0x0, 0x9(%rsp)
je 0x11a230
movq 0x138(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x32e2d
xorl %ebx, %ebx
cmpb $0x0, 0xb(%rsp)
je 0x11a132
movq 0x138(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, 0x70(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x80(%rsp)
testq %r15, %r15
je 0x11a196
movq %r15, 0xd0(%rsp)
movl $0x0, 0x84(%rsp)
movl (%r15), %eax
cmpl 0x40(%rsp), %eax
jne 0x11a416
movl 0x4(%r15), %eax
cmpl 0x50(%rsp), %eax
jne 0x11a416
movq 0xc8(%rsp), %rbp
testq %rbp, %rbp
jne 0x11a1cc
jmp 0x11a1d4
testq %rbp, %rbp
je 0x11a2ac
movq %rbp, 0xc8(%rsp)
movl $0x1, 0x84(%rsp)
movl (%rbp), %eax
cmpl 0x40(%rsp), %eax
jne 0x11a435
movl 0x4(%rbp), %eax
cmpl 0x50(%rsp), %eax
jne 0x11a435
movq $0x0, 0x18(%rbp)
cmpb $0x0, 0xa(%rsp)
je 0x11a1ff
movl $0x3, %edi
leaq 0x1cde(%rip), %rsi      # 0x11bec5
leaq 0x70(%rsp), %rdx
movl $0x3, %ecx
callq 0x1090f4
cmpb $0x0, 0x9(%rsp)
jne 0x11a221
jmp 0x11a26e
movl $0x3, %edi
leaq 0x2cb0(%rip), %rsi      # 0x11cebb
leaq 0x70(%rsp), %rdx
movl $0x3, %ecx
callq 0x1090f4
cmpb $0x0, 0x9(%rsp)
je 0x11a259
leaq 0xa8(%rsp), %rdi
callq 0x32d68
jmp 0x11a26e
leaq 0x1255c0(%rip), %rsi    # 0x23f7f7
callq 0x22d0
testq %rax, %rax
je 0x11a2a2
movq %rax, %rbx
movq %rax, %rdi
callq 0x119b01
movq %rax, 0xa0(%rsp)
jmp 0x11a11b
movq 0xa0(%rsp), %rdi
callq 0x119eb4
movq %rbx, %rdi
callq 0x2390
movq 0x70(%rsp), %rax
movq 0x98(%rsp), %r12
cmpl $0x2, 0xc(%rax)
jge 0x11a348
movq 0xc8(%rsp), %rbp
testq %rbp, %rbp
je 0x11a2a2
movq 0x28(%rsp), %rax
addq 0x18(%rbp), %rax
movq %rax, 0x28(%rsp)
jmp 0x11a2a4
xorl %ebp, %ebp
incq %r13
jmp 0x11a06b
movl $0x1, 0x84(%rsp)
movl 0x50(%rsp), %r12d
cmpl $0xc, %r12d
jge 0x11a2c9
xorl %ebp, %ebp
jmp 0x11a3d7
movq %rbx, 0x20(%rsp)
movl 0x38(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x40(%rsp), %ebx
movl $0x1, %edi
movl $0x28, %esi
callq 0x2120
movq %rax, %rbp
movl %ebx, (%rax)
movl %r12d, 0x4(%rax)
movl %r12d, %ebx
movl $0x1, %r12d
movl %ebx, %ecx
shll %cl, %r12d
movslq %r12d, %rdi
movl $0x10, %esi
callq 0x2120
movq %rax, 0x20(%rbp)
movl %ebx, 0x30(%rsp)
cmpl $0x1f, %ebx
jne 0x11a35a
movl 0xc(%rsp), %esi
testl %esi, %esi
setle %al
movl 0x1c(%rsp), %edx
cmpl $0x20, %edx
setl %cl
orb %al, %cl
jne 0x11a3cd
movl %esi, 0x8(%rbp)
movl %edx, 0xc(%rbp)
jmp 0x11a3cd
leaq 0x90(%rsp), %rdi
callq 0x140ef
jmp 0x11a285
movq %rax, %r14
cmpl $0x2, %r12d
movl $0x1, %eax
cmovll %eax, %r12d
shlq $0x4, %r12
xorl %ebx, %ebx
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, (%r14,%rbx)
addq $0x10, %rbx
cmpq %rbx, %r12
jne 0x11a370
movl 0xc(%rsp), %edx
testl %edx, %edx
setg %al
movl 0x1c(%rsp), %esi
movl %esi, %ebx
subl 0x30(%rsp), %ebx
setg %cl
testb %cl, %al
je 0x11a3cd
movl %edx, 0x8(%rbp)
movl %esi, 0xc(%rbp)
xorl %r15d, %r15d
movl %ebx, %edi
movl 0xc(%rsp), %esi
callq 0x11893a
movq %rax, 0x8(%r14,%r15)
addq $0x10, %r15
cmpq %r15, %r12
jne 0x11a3af
movq 0x68(%rsp), %r15
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %rbx
movq %rbp, 0xc8(%rsp)
jmp 0x11a18f
testq %rbp, %rbp
je 0x11a401
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rbp)
cmpl $0x0, 0x38(%rsp)
jle 0x11a401
movq %rbp, %rdi
callq 0x118da3
movq %rbp, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11ffd8(%rip), %rdi    # 0x23a3f5
leaq 0x11f91b(%rip), %rsi    # 0x239d3f
leaq 0x11fff1(%rip), %rcx    # 0x23a41c
movl $0x3be, %edx            # imm = 0x3BE
callq 0x2110
leaq 0x120062(%rip), %rdi    # 0x23a49e
leaq 0x11f8fc(%rip), %rsi    # 0x239d3f
leaq 0x11ffd2(%rip), %rcx    # 0x23a41c
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x2110
leaq 0x11fa76(%rip), %rdi    # 0x239ed1
leaq 0x11f8dd(%rip), %rsi    # 0x239d3f
leaq 0x11faa1(%rip), %rcx    # 0x239f0a
movl $0x3de, %edx            # imm = 0x3DE
callq 0x2110