// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/anchor.cpp
// Function: ug_map_lchain_simple(ha_abufl_s*, unsigned int, char*, unsigned long, unsigned long, unsigned long, ul_idx_t const*, overlap_region_alloc*, Candidates_list*, 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)
int64_t ug_map_lchain_simple(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,
								 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)
{
	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, NULL);
		// 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);
		lchain_qgen_mcopy(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, quick_check, gen_off, mcopy_rate, chain_cutoff, mcopy_khit_cut, sp);
		return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movsd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x28(%rsp)
movq %r9, %r14
movq %r8, %r12
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movl %esi, 0xc(%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 0x10018d(%rip), %rcx    # 0x22e980
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 0x12e982
movq %rbp, %r11
movq 0x110(%rsp), %r13
movq 0x108(%rsp), %rdi
movq 0x100(%rsp), %rdx
movq 0xf8(%rsp), %rcx
movq 0xf0(%rsp), %rax
movq 0xc0(%rsp), %r9
movq 0xb8(%rsp), %r8
movq 0x70(%rsp), %r12
xorl %r15d, %r15d
cmpl $0x0, 0xc8(%rsp)
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x100126(%rip), %xmm0   # 0x22e998
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
mulsd 0xf6c6c(%rip), %xmm1    # 0x2254f0
movsd %xmm1, 0x18(%rsp)
setne %r15b
xorl %r14d, %r14d
movq 0xb0(%rsp), %r10
movq %r14, (%r10)
movl 0xc(%rsp), %ebp
movl %ebp, %esi
subq $0x90, %rsp
movq %r14, 0x80(%rsp)
movq %r13, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %rax, 0x58(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r9, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq %r10, 0x38(%rsp)
movq %r12, 0x28(%rsp)
movq %r14, 0x20(%rsp)
movq %r11, %r13
movq %r11, (%rsp)
movq %rbx, %rdi
callq 0x126d50
addq $0x90, %rsp
movslq 0x88(%rsp), %rax
subq $0x8, %rsp
movl $0x1388, %r10d          # imm = 0x1388
movq %r13, %rdi
movq 0x80(%rsp), %rsi
movl %ebp, %edx
movq 0x18(%rsp), %rcx
xorl %r8d, %r8d
movq %r12, %r9
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movsd 0x38(%rsp), %xmm3
movl 0xe0(%rsp), %r11d
pushq %r11
pushq 0x120(%rsp)
movl 0xe8(%rsp), %r11d
pushq %r11
pushq %r15
pushq %r10
pushq %r10
pushq $0x19
pushq %rax
movl 0xd8(%rsp), %eax
pushq %rax
callq 0x12847b
addq $0x50, %rsp
jmp 0x12ea1a
movl 0xe0(%rsp), %r9d
leaq 0x18(%rbx), %rbp
xorl %eax, %eax
movl %eax, 0x18(%rbx)
leaq 0x15bdbe(%rip), %rcx    # 0x28a758
movl 0xa0(%rcx), %r11d
movl 0xa8(%rcx), %r10d
movl 0x1f8(%rcx), %r15d
movss 0xfffe9(%rip), %xmm0    # 0x22e9a0
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl 0xc(%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 0x11dbad
addq $0x60, %rsp
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x12ea16
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