// File: /workspace/github_cpp_makefile_star2_O1/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 $0x108, %rsp            # imm = 0x108
movq %rdi, 0x8(%rsp)
movl %esi, %eax
notl %eax
testb $0xc, %al
je 0x1149c6
movq %r9, %r13
movl %r8d, %r14d
movl %ecx, %r12d
movl %edx, %r15d
movl %esi, %ebp
cmpq $0x0, 0x148(%rsp)
je 0x1144c1
testb $0x4, %bpl
jne 0x1144b4
testb $0x8, %bpl
je 0x1144c1
movq 0x148(%rsp), %rdi
callq 0x334af
jmp 0x1144c1
movq 0x148(%rsp), %rdi
callq 0x32550
movl 0x158(%rsp), %eax
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movl $0x4, 0x44(%rsp)
movabsq $0x40000000c, %rcx      # imm = 0x40000000C
movq %rcx, 0x58(%rsp)
movq $0x1312d00, 0x60(%rsp)  # imm = 0x1312D00
movl %r12d, 0x48(%rsp)
movl %r15d, 0x50(%rsp)
testb $0x2, %bpl
movl $0x1, %ecx
cmovel %r14d, %ecx
movl %ecx, 0x4c(%rsp)
xorl %ecx, %ecx
movl $0x0, %esi
testb $0x1, %bpl
jne 0x11452d
movq 0x8(%rsp), %rdx
movl 0xac(%rdx), %esi
movq 0x160(%rsp), %rdx
movl %esi, 0x40(%rsp)
movq 0x8(%rsp), %rdi
movl 0x7c(%rdi), %esi
movl %esi, 0x5c(%rsp)
testl %eax, %eax
je 0x11454f
movl 0x100(%rdi), %ecx
movl 0x168(%rsp), %eax
movl %ecx, 0x68(%rsp)
testq %rdx, %rdx
je 0x114563
movl (%rdx), %ecx
jmp 0x114568
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0x40(%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, 0x3c(%rsp)
cmpq $0x0, 0x148(%rsp)
setne %al
movl %ebp, %ecx
shrb $0x4, %cl
andb %al, %cl
movb %cl, 0x5(%rsp)
cmpq $0x0, 0x150(%rsp)
setne %cl
testb %bpl, %bpl
sets %dl
andb %cl, %dl
testb $0xc, %bpl
setne %cl
andb %al, %cl
movb %cl, 0x7(%rsp)
leaq 0x1dde(%rip), %rax      # 0x1163a0
leaq 0x2d67(%rip), %rcx      # 0x117330
movb %dl, 0x6(%rsp)
testb %dl, %dl
cmovneq %rax, %rcx
movq %rcx, 0x78(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq $0x0, 0x28(%rsp)
xorl %r12d, %r12d
movq 0x8(%rsp), %rbp
movq %r13, 0x20(%rsp)
movl $0x1, %eax
cmpq $0x0, 0x150(%rsp)
jne 0x114607
movslq 0x4(%rbp), %rax
cmpq %rax, %rbx
jge 0x114950
movq 0x8(%rbp), %rax
movq (%rax,%rbx,8), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movq %r14, 0xa8(%rsp)
cmpb $0x0, 0x6(%rsp)
je 0x11467c
movq 0x150(%rsp), %rax
movq %rax, 0xf8(%rsp)
jmp 0x1146a4
cmpb $0x0, 0x5(%rsp)
je 0x114759
movq 0x148(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x3372c
xorl %r15d, %r15d
cmpb $0x0, 0x7(%rsp)
je 0x1146be
movq 0x148(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x80(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, 0x90(%rsp)
testq %r13, %r13
je 0x11471f
movq %r13, 0xe0(%rsp)
movl $0x0, 0x94(%rsp)
movl (%r13), %eax
cmpl 0x48(%rsp), %eax
jne 0x114988
movl 0x4(%r13), %eax
cmpl 0x58(%rsp), %eax
je 0x1148a4
jmp 0x114988
testq %r12, %r12
je 0x114782
movq %r12, 0xd8(%rsp)
movl $0x1, 0x94(%rsp)
movl (%r12), %eax
cmpl 0x48(%rsp), %eax
jne 0x1149a7
movl 0x4(%r12), %eax
cmpl 0x58(%rsp), %eax
je 0x1148a4
jmp 0x1149a7
leaq 0x11ee47(%rip), %rsi    # 0x2335a7
callq 0x22d0
testq %rax, %rax
je 0x11479f
movq %rax, %r15
movq %rax, %rdi
callq 0x114034
movq %rax, 0xb0(%rsp)
jmp 0x1146a7
movl $0x1, 0x94(%rsp)
movl 0x58(%rsp), %r14d
cmpl $0xc, %r14d
jge 0x1147a7
xorl %eax, %eax
jmp 0x11489c
xorl %r12d, %r12d
jmp 0x114925
movl 0x40(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x48(%rsp), %ebp
movl $0x1, %edi
movl $0x28, %esi
callq 0x2120
movq %rax, %r12
movl %ebp, (%rax)
movl %r14d, 0x4(%rax)
movl $0x1, %ebp
movl %r14d, %ecx
shll %cl, %ebp
movslq %ebp, %rdi
movl $0x10, %esi
callq 0x2120
movl %r14d, %ecx
movq %rax, %r14
movq %r12, 0x18(%rsp)
movq %rax, 0x20(%r12)
movl %ecx, 0x38(%rsp)
cmpl $0x1f, %ecx
je 0x114833
cmpl $0x2, %ebp
movl $0x1, %r12d
cmovgel %ebp, %r12d
shlq $0x4, %r12
xorl %r13d, %r13d
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, (%r14,%r13)
addq $0x10, %r13
cmpq %r13, %r12
jne 0x114817
movl 0x14(%rsp), %edx
testl %edx, %edx
setle %al
movl 0x34(%rsp), %edi
movl %edi, %r12d
movl 0x38(%rsp), %esi
subl %esi, %r12d
setle %cl
orb %al, %cl
jne 0x11488d
movq 0x18(%rsp), %rax
movl %edx, 0x8(%rax)
movl %edi, 0xc(%rax)
cmpl $0x1f, %esi
je 0x11488d
cmpl $0x2, %ebp
movl $0x1, %eax
cmovll %eax, %ebp
shlq $0x4, %rbp
xorl %r13d, %r13d
movl %r12d, %edi
movl 0x14(%rsp), %esi
callq 0x112e4a
movq %rax, 0x8(%r14,%r13)
addq $0x10, %r13
cmpq %r13, %rbp
jne 0x114873
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %rbp
movq 0x18(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rax
testq %rax, %rax
je 0x1148b9
movq $0x0, 0x18(%rax)
movl $0x3, %edi
movq 0x78(%rsp), %rsi
leaq 0x80(%rsp), %rdx
movl $0x3, %ecx
callq 0x104984
cmpb $0x0, 0x5(%rsp)
je 0x1148eb
leaq 0xb8(%rsp), %rdi
callq 0x33667
jmp 0x114907
cmpb $0x0, 0x6(%rsp)
jne 0x114907
movq 0xb0(%rsp), %rdi
callq 0x114405
movq %r15, %rdi
callq 0x2390
movq 0x80(%rsp), %rax
movq 0xa8(%rsp), %r14
cmpl $0x2, 0xc(%rax)
jge 0x114941
movq 0xd8(%rsp), %r12
testq %r12, %r12
je 0x114939
movq 0x28(%rsp), %rax
addq 0x18(%r12), %rax
movq %rax, 0x28(%rsp)
incq %rbx
jmp 0x1145f3
leaq 0xa0(%rsp), %rdi
callq 0x14805
jmp 0x11491d
testq %r12, %r12
je 0x11495f
movq 0x28(%rsp), %rax
movq %rax, 0x18(%r12)
testq %r12, %r12
je 0x114973
cmpl $0x0, 0x40(%rsp)
jle 0x114973
movq %r12, %rdi
callq 0x1132c7
movq %r12, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x119856(%rip), %rdi    # 0x22e1e5
leaq 0x119199(%rip), %rsi    # 0x22db2f
leaq 0x11986f(%rip), %rcx    # 0x22e20c
movl $0x3be, %edx            # imm = 0x3BE
callq 0x2110
leaq 0x1198e0(%rip), %rdi    # 0x22e28e
leaq 0x11917a(%rip), %rsi    # 0x22db2f
leaq 0x119850(%rip), %rcx    # 0x22e20c
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x2110
leaq 0x1192f4(%rip), %rdi    # 0x22dcc1
leaq 0x11915b(%rip), %rsi    # 0x22db2f
leaq 0x11931f(%rip), %rcx    # 0x22dcfa
movl $0x3de, %edx            # imm = 0x3DE
callq 0x2110