// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/anchor.cpp
// Function: ug_map_lchain(ha_abufl_s*, unsigned int, char*, unsigned long, unsigned long, unsigned long, ul_idx_t const*, overlap_region_alloc*, Candidates_list*, double, double, int, int, kvec_t_u8_warp*, overlap_region*, kvec_t_u64_warp*, st_mt_t*, unsigned int*, unsigned int*, unsigned int, unsigned int, double, unsigned int, unsigned int, ha_mzl_t*, unsigned long, ha_mzl_t*, unsigned long, unsigned long, unsigned long, kv_u_trans_t*)
int64_t ug_map_lchain(ha_abufl_t *ab, uint32_t rid, char* rs, uint64_t rl, uint64_t mz_w, uint64_t mz_k, const ul_idx_t *uref, overlap_region_alloc *overlap_list, Candidates_list *cl, double bw_thres, double bw_thres_sec,
								 int max_n_chain, int apend_be, kvec_t_u8_warp* k_flag, overlap_region* f_cigar, kvec_t_u64_warp* dbg_ct, st_mt_t *sp, uint32_t *high_occ, uint32_t *low_occ, uint32_t is_accurate, 
								 uint32_t gen_off, double mcopy_rate, uint32_t mcopy_khit_cut, uint32_t is_hpc, ha_mzl_t *res, uint64_t res_n, ha_mzl_t *idx, uint64_t idx_n, uint64_t mzl_cutoff, uint64_t chain_cutoff, kv_u_trans_t *kov)
{
	int64_t max_skip, max_iter, max_dis, quick_check; double chn_pen_gap, chn_pen_skip;
	set_lchain_dp_op(is_accurate, mz_k, &max_skip, &max_iter, &max_dis, &chn_pen_gap, &chn_pen_skip, &quick_check);
	if((!overlap_list) || (!cl)) {
		ab->mz.n = 0;
		mz2_ha_sketch(rs, rl, mz_w, mz_k, rid, is_hpc, &ab->mz, NULL, asm_opt.mz_sample_dist, k_flag, dbg_ct, NULL, -1, asm_opt.dp_min_len, -1, sp, asm_opt.mz_rewin, 0, NULL);
		if(res) memcpy(res, ab->mz.a, ab->mz.n * (sizeof((*(ab->mz.a)))));
		return ab->mz.n;
	} else {
		sp->n = 0;
		minimizers_qgen_input(ab, rid, rs, rl, mz_w, mz_k, cl, k_flag, ha_flt_tab, ha_idx, NULL, uref, dbg_ct, sp, high_occ, low_occ, res, res_n, idx, idx_n, mzl_cutoff, chain_cutoff, kov);
		lchain_qgen_mcopy_input(cl, overlap_list, rid, rl, NULL, uref, apend_be, max_n_chain, max_skip, max_iter, max_dis, chn_pen_gap, chn_pen_skip, bw_thres, bw_thres_sec, quick_check, gen_off, mcopy_rate, mcopy_khit_cut, sp);
		return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm2, 0x20(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %r9, %r14
movq %r8, 0x8(%rsp)
movq %rcx, (%rsp)
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %rbx
movq 0xa0(%rsp), %r15
movl 0xe8(%rsp), %edi
leaq 0x38(%rsp), %rax
leaq 0x28(%rsp), %r10
leaq 0x50(%rsp), %rdx
leaq 0x48(%rsp), %rcx
leaq 0x40(%rsp), %r8
leaq 0x30(%rsp), %r9
movl %r14d, %esi
pushq %rax
pushq %r10
callq 0xea117
popq %rax
popq %rcx
cmpq $0x0, 0x98(%rsp)
setne %al
testq %r15, %r15
setne %cl
testb %cl, %al
je 0xee1ae
movq %r15, %rdx
movq 0x138(%rsp), %rax
movq 0x130(%rsp), %rcx
movq 0x128(%rsp), %r13
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %r8
movq 0x110(%rsp), %r9
movq 0xe0(%rsp), %r10
movq 0xd8(%rsp), %r11
movq 0x90(%rsp), %r12
movq 0xd0(%rsp), %r15
andq $0x0, (%r15)
movl %ebp, %esi
subq $0x90, %rsp
movq %rax, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq %r13, 0x70(%rsp)
movq %rdi, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq 0x198(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r10, 0x48(%rsp)
movq %r11, 0x40(%rsp)
movq %r15, 0x38(%rsp)
andq $0x0, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %rdx, %r14
movq %rdx, (%rsp)
movq %rbx, %rdi
callq 0xe7a3e
addq $0x90, %rsp
movslq 0xa8(%rsp), %rax
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
subq $0x8, %rsp
xorl %ebx, %ebx
movq %r14, %rdi
movq 0xa0(%rsp), %rsi
movl %ebp, %edx
movq 0x8(%rsp), %rcx
xorl %r8d, %r8d
movq %r12, %r9
movsd 0x18(%rsp), %xmm2
movsd 0x20(%rsp), %xmm3
movsd 0x28(%rsp), %xmm4
pushq %r15
movl 0x108(%rsp), %r10d
pushq %r10
movl 0x108(%rsp), %r10d
pushq %r10
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq 0x88(%rsp)
pushq %rax
movl 0xf8(%rsp), %eax
pushq %rax
callq 0xe9d85
addq $0x50, %rsp
jmp 0xee245
movl 0x100(%rsp), %r9d
movq 0xb8(%rsp), %r12
leaq 0x18(%rbx), %r15
andl $0x0, 0x18(%rbx)
leaq 0x16558b(%rip), %rcx    # 0x253758
movl 0xa0(%rcx), %eax
movl 0xa8(%rcx), %r11d
movl 0x1f8(%rcx), %r10d
movss 0xfe8b7(%rip), %xmm0    # 0x1ecaa0
movq %r13, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movl %r14d, %ecx
movl %ebp, %r8d
pushq $0x0
pushq $0x0
pushq %rax
pushq 0xe8(%rsp)
pushq %r10
pushq $-0x1
pushq $0x0
pushq 0x100(%rsp)
pushq %r12
pushq %r11
pushq $0x0
pushq %r15
callq 0xdf468
addq $0x60, %rsp
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0xee242
movq 0x20(%rbx), %rsi
movl 0x18(%rbx), %eax
imulq $0x18, %rax, %rdx
callq 0x2160
movl (%r15), %ebx
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq