// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq 0xb0(%rbp), %rax
movq 0xa8(%rbp), %rax
movq 0xa0(%rbp), %rax
movq 0x98(%rbp), %rax
movq 0x90(%rbp), %rax
movq 0x88(%rbp), %rax
movl 0x80(%rbp), %eax
movl 0x78(%rbp), %eax
movl 0x70(%rbp), %eax
movl 0x68(%rbp), %eax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movsd %xmm0, -0x68(%rbp)
movsd %xmm1, -0x70(%rbp)
movl 0x68(%rbp), %edi
movq -0x60(%rbp), %rax
movl %eax, %esi
leaq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x98(%rbp), %r9
leaq -0xa0(%rbp), %r10
leaq -0x90(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1aca80
cmpq $0x0, 0x18(%rbp)
je 0x1b4365
cmpq $0x0, 0x20(%rbp)
jne 0x1b4466
movq -0x38(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %esi
movq -0x58(%rbp), %rax
movl %eax, %edx
movq -0x60(%rbp), %rax
movl %eax, %ecx
movl -0x3c(%rbp), %r8d
movl 0x80(%rbp), %r9d
movq -0x38(%rbp), %r12
addq $0x18, %r12
leaq 0x210458(%rip), %rax    # 0x3c47f8
movl 0xa8(%rax), %r15d
movq 0x38(%rbp), %r14
movq 0x48(%rbp), %rbx
leaq 0x210442(%rip), %rax    # 0x3c47f8
movl 0x1f8(%rax), %r11d
movq 0x50(%rbp), %r10
leaq 0x210430(%rip), %rax    # 0x3c47f8
movl 0xa0(%rax), %eax
xorl %r13d, %r13d
movss 0x1cac97(%rip), %xmm0   # 0x37f070
xorl %r13d, %r13d
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movl %r11d, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movl $0x0, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
callq 0x1995e0
cmpq $0x0, 0x88(%rbp)
je 0x1b4456
movq 0x88(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
imulq $0x18, %rax, %rdx
callq 0x2180
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
movq %rax, -0x30(%rbp)
jmp 0x1b4674
movq 0x50(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, %esi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %r9
movq 0x20(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq 0x38(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq 0x211029(%rip), %rax    # 0x3c54d0
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
leaq 0x211020(%rip), %rax    # 0x3c54d8
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq 0x48(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq 0x50(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0x58(%rbp), %r13
movq 0x60(%rbp), %r12
movq 0x88(%rbp), %r15
movq 0x90(%rbp), %r14
movq 0x98(%rbp), %rbx
movq 0xa0(%rbp), %r11
movq 0xa8(%rbp), %r10
movq 0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
xorl %eax, %eax
movq -0xf0(%rbp), %rax
movq %rax, (%rsp)
movq -0xe8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xe0(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0xd8(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0xd0(%rbp), %rax
movq $0x0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq -0xc8(%rbp), %rax
movq %rax, 0x30(%rsp)
movq -0xc0(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0xb8(%rbp), %rax
movq %r13, 0x40(%rsp)
movq %r12, 0x48(%rsp)
movq %r15, 0x50(%rsp)
movq %r14, 0x58(%rsp)
movq %rbx, 0x60(%rsp)
movq %r11, 0x68(%rsp)
movq %r10, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movq $0x0, 0x80(%rsp)
callq 0x1a7ab0
movq 0x20(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x3c(%rbp), %edx
movq -0x50(%rbp), %rcx
movq 0x10(%rbp), %r9
movl 0x30(%rbp), %eax
movslq 0x28(%rbp), %r8
movq %r8, -0xb0(%rbp)
movq -0x78(%rbp), %r13
movq -0x80(%rbp), %r12
movq -0x88(%rbp), %r15
movsd -0x98(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
movsd -0x68(%rbp), %xmm2
movq -0x90(%rbp), %r14
movl 0x70(%rbp), %ebx
movsd -0x70(%rbp), %xmm3
movq 0xb0(%rbp), %r8
movl %r8d, %r11d
movl 0x78(%rbp), %r10d
movq 0x50(%rbp), %r8
movq %r8, -0xa8(%rbp)
xorl %r8d, %r8d
movl %eax, (%rsp)
movq -0xb0(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xa8(%rbp), %rax
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movl %ebx, 0x30(%rsp)
movl %r11d, 0x38(%rsp)
movl %r10d, 0x40(%rsp)
movq %rax, 0x48(%rsp)
callq 0x1a9ea0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)