// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: drenew_UL_reovlps(uldat_t*, ma_ug_t*, asg_t*, char*, int)
uint32_t drenew_UL_reovlps(uldat_t *sl, ma_ug_t *ug, asg_t *sg, char* gfa_name, int32_t cutoff)
{
	uint32_t k, f_occ;
	kt_for(asm_opt.thread_num, dcheck_ulalignments_mul, ug, UL_INF.n);
	for (k = f_occ = 0; k < UL_INF.n; k++) {
		if(UL_INF.a[k].rlen&((uint32_t)(0x80000000))) f_occ++;
	}
	fprintf(stderr, "[M::%s::] # wrong UL alignments::%u\n", __func__, f_occ);
	if(f_occ == 0) return 0;//all set

	ul_idx_t *uu = gen_ul_idx(sl->uopt, ug, sg);
	int exist = (asm_opt.load_index_from_disk? uidx_load(&ha_flt_tab, &ha_idx, gfa_name, ug) : 0);
    if(exist == 0) uidx_l_build(uu->ug, (mg_idxopt_t *)sl->opt, cutoff);
	if(exist == 0) uidx_write(ha_flt_tab, ha_idx, gfa_name, ug);
	sl->ha_flt_tab = ha_flt_tab; sl->ha_idx = (ha_pt_t *)ha_idx; sl->uu = uu;	

	// init_ucr_file_t(sl, gfa_name, 1);
	recorrect_ul_pipeline(sl, asm_opt.ar);
	// destory_ucr_file_t(sl);
	///do not free ug
	uu->ug = NULL; destroy_ul_idx_t(uu); ha_ft_destroy(ha_flt_tab); ha_pt_destroy(ha_idx);
	sl->ha_flt_tab = NULL; sl->ha_idx = NULL; sl->uu = NULL;
	return 1;
	// exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r13
leaq 0xaf1d2(%rip), %rax     # 0x295758
movl 0x7c(%rax), %edi
leaq 0xafd88(%rip), %rbx     # 0x296318
movq 0x50(%rbx), %rcx
leaq 0x15f(%rip), %rsi       # 0x1e66fa
movq %r15, %rdx
callq 0x108f2c
movq 0x50(%rbx), %rax
testq %rax, %rax
jne 0x1e65b5
callq 0x2a27e
xorl %ebx, %ebx
jmp 0x1e6607
movq %r13, (%rsp)
movq 0x48(%rbx), %rcx
addq $0x18, %rcx
xorl %r13d, %r13d
movl $0x1, %edx
movl (%rcx), %esi
shrl $0x1f, %esi
addl %esi, %r13d
movl %edx, %esi
addq $0x58, %rcx
incl %edx
cmpq %rsi, %rax
ja 0x1e65c9
movq 0xae9fb(%rip), %rax     # 0x294fe0
movq (%rax), %rdi
leaq 0x5e2d3(%rip), %rsi     # 0x2448c2
leaq 0x5e2f1(%rip), %rdx     # 0x2448e7
xorl %ebx, %ebx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x22b0
testl %r13d, %r13d
jne 0x1e6618
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %r13
movq 0x28(%r13), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x272c0
movq %rax, %r12
leaq 0xaf123(%rip), %rax     # 0x295758
cmpl $0x0, 0xf0(%rax)
je 0x1e66c7
leaq 0xafde7(%rip), %rdi     # 0x296430
leaq 0xafde8(%rip), %rsi     # 0x296438
movq %r14, %rdx
movq %r15, %rcx
callq 0x11b7de
testl %eax, %eax
je 0x1e66c7
leaq 0xafdca(%rip), %rbx     # 0x296430
movq (%rbx), %rax
movq %rax, (%r13)
leaq 0xafdc4(%rip), %r14     # 0x296438
movq (%r14), %rax
movq %rax, 0x8(%r13)
movq %r12, 0x30(%r13)
leaq 0xaf0d2(%rip), %rax     # 0x295758
movq 0x68(%rax), %rsi
movq %r13, %rdi
callq 0x1e24a1
xorl %r15d, %r15d
movq %r15, (%r12)
movq %r12, %rdi
callq 0x1e623f
movq (%rbx), %rdi
callq 0x11a4e8
movq (%r14), %rdi
callq 0x1193ff
movq %r15, 0x30(%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movl $0x1, %ebx
jmp 0x1e6607
movq (%r12), %rdi
movq 0x10(%r13), %rsi
movl %ebp, %edx
callq 0x2389e
leaq 0xafd53(%rip), %rax     # 0x296430
movq (%rax), %rdi
leaq 0xafd51(%rip), %rax     # 0x296438
movq (%rax), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x11b631
jmp 0x1e665f