// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
movq %rdi, %r15
movq 0x261aae(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x210222(%rip), %rsi    # 0x23875e
leaq 0x21023b(%rip), %rdx    # 0x23877e
xorl %eax, %eax
callq 0x22b0
callq 0x3366f
leaq 0x262202(%rip), %r13    # 0x28a758
movl 0xd0(%r13), %esi
movq %r13, %rdi
callq 0x2f59
movl (%r13), %eax
movl 0xe8(%r13), %ecx
notl %eax
andl $0x1, %eax
movsd 0x228(%r13), %xmm0
movups 0x230(%r13), %xmm1
movl 0x240(%r13), %edx
movabsq $0x130000000a, %rsi     # imm = 0x130000000A
leaq 0xf0(%rsp), %rbp
movq %rsi, (%rbp)
movl %ecx, 0x14(%rbp)
movl %eax, 0x10(%rbp)
movabsq $0x7a12000002710, %rax  # imm = 0x7A12000002710
movq %rax, 0x8(%rbp)
movabsq $0x271000000014, %rax   # imm = 0x271000000014
movq %rax, 0x18(%rbp)
movabsq $0x3f0000003e428f5c, %rax # imm = 0x3F0000003E428F5C
movq %rax, 0x50(%rbp)
movabsq $0x271000000019, %rax   # imm = 0x271000000019
movq %rax, 0x28(%rbp)
movaps 0x20b258(%rip), %xmm2   # 0x233840
movups %xmm2, 0x30(%rbp)
movabsq $0xb00000005, %rax      # imm = 0xB00000005
movq %rax, 0x20(%rbp)
movaps 0x20b24f(%rip), %xmm2   # 0x233850
movups %xmm2, 0x40(%rbp)
movl $0x3f4ccccd, 0x58(%rbp) # imm = 0x3F4CCCCD
movl %ecx, 0x80(%rbp)
movsd %xmm0, 0x60(%rbp)
movsd %xmm0, 0x68(%rbp)
movups %xmm1, 0x70(%rbp)
movl %edx, 0x84(%rbp)
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1dbb50
movq %rax, %r12
movslq 0x7c(%r13), %rbx
leaq 0x8(%rsp), %r13
movl $0xe8, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x20e0
movq %rbp, 0x10(%r13)
movq $0x3b9aca00, 0x50(%r13) # imm = 0x3B9ACA00
movq %rbx, 0x58(%r13)
xorl %ebx, %ebx
movq %r12, 0x30(%r13)
movq %r15, 0x28(%r13)
movq %r14, 0x20(%r13)
movq %r13, %rdi
callq 0x25425
testq %rax, %rax
je 0x286f1
leaq 0x262c90(%rip), %rbx    # 0x28b318
movq 0x28(%rbx), %rdi
callq 0x2220
movq 0x40(%rbx), %rdi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x28(%rbx)
movups %xmm0, 0x18(%rbx)
leaq 0x262b80(%rip), %r14    # 0x28b230
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1d6bbe
leaq 0x8(%rsp), %rbx
movl 0x58(%rbx), %edi
movq 0x50(%r14), %rcx
leaq 0x1b3d92(%rip), %rsi    # 0x1dc462
movq %rbx, %rdx
callq 0x1047b4
movl 0x58(%rbx), %edi
movq 0x50(%r14), %rcx
leaq 0x1b3e2c(%rip), %rsi    # 0x1dc512
movq %rbx, %rdx
callq 0x1047b4
pushq $0x1
popq %rbx
movq %r12, %rdi
callq 0x1dbcbe
movq %rbx, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq