// File: chhylp123[P]hifiasm/inter.cpp
// Function: ul_refine_alignment(ug_opt_t const*, asg_t*)
uint64_t ul_refine_alignment(const ug_opt_t *uopt, asg_t *sg)
{
	fprintf(stderr, "[M::%s::] ==> UL refinement...\n", __func__);
	mg_idxopt_t opt; uldat_t sl; int32_t cutoff;
	init_aux_table(); ha_opt_update_cov(&asm_opt, asm_opt.hom_cov);
	cutoff = asm_opt.max_n_chain;
	init_mg_opt(&opt, !(asm_opt.flag&HA_F_NO_HPC), 19, 10, cutoff, asm_opt.max_n_chain, asm_opt.ul_error_rate, asm_opt.ul_error_rate, asm_opt.ul_error_rate_low, asm_opt.ul_error_rate_hpc, asm_opt.ul_ec_round);
	ul_idx_t *uu = gen_ul_idx_t(uopt, NULL, sg, 0, 0, 0);///record contained reads; is_el = is_del = 0	
	init_uldat_t(&sl, NULL, NULL, &opt, CHUNK_SIZE, asm_opt.thread_num, uopt, uu); sl.rg = sg;
	if(work_ul_gchains(&sl)) {
		free(UL_INF.ridx.idx.a); free(UL_INF.ridx.occ.a); memset(&(UL_INF.ridx), 0, sizeof(UL_INF.ridx));
		gen_ul_vec_rid_t(&UL_INF, &R_INF, NULL);
		kt_for(sl.n_thread, update_ovlp_src, &sl, R_INF.total_reads);
		kt_for(sl.n_thread, update_ovlp_src_bl, &sl, R_INF.total_reads);
		destroy_ul_idx_t(uu);
		return 1;
	} else {
		destroy_ul_idx_t(uu);
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq 0xc4886(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
leaq 0x95e9e(%rip), %rsi     # 0x395602
leaq 0x95eb7(%rip), %rdx     # 0x395622
movb $0x0, %al
callq 0x22a0
callq 0x9690
leaq 0xc507a(%rip), %rax     # 0x3c47f8
movl 0xd0(%rax), %esi
leaq 0xc506d(%rip), %rdi     # 0x3c47f8
callq 0x3b60
leaq 0xc5061(%rip), %rax     # 0x3c47f8
movl 0xe8(%rax), %eax
movl %eax, -0x18c(%rbp)
leaq 0xc504e(%rip), %rax     # 0x3c47f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %esi
movl -0x18c(%rbp), %r8d
leaq 0xc502e(%rip), %rax     # 0x3c47f8
movl 0xe8(%rax), %r9d
leaq 0xc5020(%rip), %rax     # 0x3c47f8
movsd 0x228(%rax), %xmm0
leaq 0xc5011(%rip), %rax     # 0x3c47f8
movsd 0x228(%rax), %xmm1
leaq 0xc5002(%rip), %rax     # 0x3c47f8
movsd 0x230(%rax), %xmm2
leaq 0xc4ff3(%rip), %rax     # 0x3c47f8
movsd 0x238(%rax), %xmm3
leaq 0xc4fe4(%rip), %rax     # 0x3c47f8
movl 0x240(%rax), %eax
leaq -0xa0(%rbp), %rdi
movl $0x13, %edx
movl $0xa, %ecx
movl %eax, (%rsp)
callq 0x282cf0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rsi
movq %r9, %rcx
movq %r9, %r8
callq 0x2fc690
movq %rax, -0x198(%rbp)
leaq 0xc4f9c(%rip), %rax     # 0x3c47f8
movslq 0x7c(%rax), %r9
movq -0x10(%rbp), %r10
movq -0x198(%rbp), %rax
leaq -0x188(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
leaq -0xa0(%rbp), %rcx
movl $0x3b9aca00, %r8d       # imm = 0x3B9ACA00
movq %rdx, %rsi
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2fd4f0
movq -0x18(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x2ebdc0
cmpq $0x0, %rax
je 0x2ff967
leaq 0xc5afc(%rip), %rax     # 0x3c53b8
movq 0x28(%rax), %rdi
callq 0x2210
leaq 0xc5aec(%rip), %rax     # 0x3c53b8
movq 0x40(%rax), %rdi
callq 0x2210
leaq 0xc5adc(%rip), %rdi     # 0x3c53b8
addq $0x18, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2100
leaq 0xc5ac5(%rip), %rdi     # 0x3c53b8
leaq 0xc59d6(%rip), %rsi     # 0x3c52d0
xorl %eax, %eax
movl %eax, %edx
callq 0x2f0d10
movq -0x130(%rbp), %rax
movl %eax, %edi
leaq 0xc59bd(%rip), %rax     # 0x3c52d0
movq 0x50(%rax), %rcx
leaq -0x195e(%rip), %rsi     # 0x2fdfc0
leaq -0x188(%rbp), %rdx
callq 0x16d710
movq -0x130(%rbp), %rax
movl %eax, %edi
leaq 0xc5996(%rip), %rax     # 0x3c52d0
movq 0x50(%rax), %rcx
leaq -0x1825(%rip), %rsi     # 0x2fe120
leaq -0x188(%rbp), %rdx
callq 0x16d710
movq -0x198(%rbp), %rdi
callq 0x2fc8d0
movq $0x1, -0x8(%rbp)
jmp 0x2ff97b
movq -0x198(%rbp), %rdi
callq 0x2fc8d0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopl (%rax,%rax)