// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movsd %xmm2, 0x30(%rsp)
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x20(%rsp)
movq %r9, %r14
movq %r8, %r12
movq %rcx, 0x8(%rsp)
movq %rdx, %r13
movl %esi, 0x4(%rsp)
movq %rdi, %rbx
xorl %eax, %eax
cmpl $0x0, 0xc8(%rsp)
setne %al
movq 0x80(%rsp), %rbp
movl %r14d, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
leaq 0x106427(%rip), %rcx    # 0x23ab90
mulsd (%rcx,%rax,8), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x2380
cmpq $0x0, 0x78(%rsp)
setne %al
testq %rbp, %rbp
setne %cl
testb %cl, %al
je 0x134902
movq %rbp, %rdx
movq 0x118(%rsp), %r9
movq 0x110(%rsp), %r8
movq 0x100(%rsp), %rbp
movq 0xf8(%rsp), %rcx
movq 0xf0(%rsp), %rax
movq 0xc0(%rsp), %r11
movq 0xb8(%rsp), %r10
movq 0x70(%rsp), %r13
xorl %r15d, %r15d
cmpl $0x0, 0xc8(%rsp)
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x1063c0(%rip), %xmm0   # 0x23aba8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
mulsd 0xfcdf6(%rip), %xmm1    # 0x2315f0
movsd %xmm1, 0x10(%rsp)
setne %r15b
xorl %r14d, %r14d
movq 0xb0(%rsp), %r12
movq %r14, (%r12)
movq %rbx, %rdi
movl 0x4(%rsp), %ebx
movl %ebx, %esi
subq $0x90, %rsp
movq %r9, 0x80(%rsp)
movq %r8, 0x78(%rsp)
movq 0x198(%rsp), %r8
movq %r8, 0x70(%rsp)
movq %rbp, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %rax, 0x58(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r11, 0x48(%rsp)
movq %r10, 0x40(%rsp)
movq %r12, 0x38(%rsp)
movq %r13, 0x28(%rsp)
movq %r14, 0x20(%rsp)
movq %rdx, %rbp
movq %rdx, (%rsp)
callq 0x12cc36
addq $0x90, %rsp
movslq 0x88(%rsp), %rax
subq $0x8, %rsp
movl $0x1388, %r10d          # imm = 0x1388
movq %rbp, %rdi
movq 0x80(%rsp), %rsi
movl %ebx, %edx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
movq %r13, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movsd 0x30(%rsp), %xmm3
movsd 0x38(%rsp), %xmm4
pushq %r12
movl 0xe8(%rsp), %r11d
pushq %r11
movl 0xe8(%rsp), %r11d
pushq %r11
pushq %r15
pushq %r10
pushq %r10
pushq $0x19
pushq %rax
movl 0xd8(%rsp), %eax
pushq %rax
callq 0x12f718
addq $0x50, %rsp
jmp 0x13499a
movl 0xe0(%rsp), %r9d
leaq 0x18(%rbx), %rbp
xorl %eax, %eax
movl %eax, 0x18(%rbx)
leaq 0x160e3e(%rip), %rcx    # 0x295758
movl 0xa0(%rcx), %r11d
movl 0xa8(%rcx), %r10d
movl 0x1f8(%rcx), %r15d
movss 0x106279(%rip), %xmm0   # 0x23abb0
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl 0x4(%rsp), %r8d
pushq %rax
pushq %rax
pushq %r11
pushq 0xc8(%rsp)
pushq %r15
pushq $-0x1
pushq %rax
pushq 0xe0(%rsp)
pushq 0xd8(%rsp)
pushq %r10
pushq %rax
pushq %rbp
callq 0x123ac6
addq $0x60, %rsp
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x134996
movq 0x20(%rbx), %rsi
movl 0x18(%rbx), %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
callq 0x2160
movl (%rbp), %r14d
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq