// File: /workspace/github_cpp_makefile_star2_O1/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
subq $0x18, %rsp
movl %r8d, 0xc(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x2628e3(%rip), %rax    # 0x28a758
movl 0x7c(%rax), %edi
leaq 0x263499(%rip), %rbp    # 0x28b318
movq 0x50(%rbp), %rcx
leaq 0x1b415a(%rip), %rsi    # 0x1dbfe4
movq %r15, %rdx
callq 0x1047b4
movq 0x50(%rbp), %rax
xorl %r13d, %r13d
movl $0x0, %r14d
testq %rax, %rax
je 0x27ec7
pushq $0x1
popq %rcx
movq 0x48(%rbp), %rdx
addq $0x18, %rdx
xorl %r14d, %r14d
movl (%rdx), %esi
shrl $0x1f, %esi
addl %esi, %r14d
movl %ecx, %esi
addq $0x58, %rdx
incl %ecx
cmpq %rsi, %rax
ja 0x27eb2
movq 0x262112(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x21071a(%rip), %rsi    # 0x2385f2
leaq 0x210738(%rip), %rdx    # 0x238617
movl %r14d, %ecx
xorl %eax, %eax
callq 0x22b0
testl %r14d, %r14d
jne 0x27f00
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rbp
movq 0x28(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x27b3f
movq %rax, %r12
leaq 0x26283c(%rip), %r13    # 0x28a758
cmpl $0x0, 0xf0(%r13)
movq 0x10(%rsp), %rbx
je 0x27fa6
leaq 0x2634fe(%rip), %rdi    # 0x28b430
leaq 0x2634ff(%rip), %rsi    # 0x28b438
movq %rbx, %rdx
movq %r15, %rcx
callq 0x115c9a
testl %eax, %eax
je 0x27fa6
leaq 0x2634e1(%rip), %r14    # 0x28b430
movq (%r14), %rax
movq %rax, (%rbp)
leaq 0x2634db(%rip), %r15    # 0x28b438
movq (%r15), %rax
movq %rax, 0x8(%rbp)
movq %r12, 0x30(%rbp)
movq 0x68(%r13), %rsi
movq %rbp, %rdi
callq 0x1d8405
andq $0x0, (%r12)
movq %r12, %rdi
callq 0x1dbcbe
movq (%r14), %rdi
callq 0x114a78
movq (%r15), %rdi
callq 0x113930
andq $0x0, 0x30(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
pushq $0x1
popq %r13
jmp 0x27eee
movq (%r12), %rdi
movq 0x10(%rbp), %rsi
movl 0xc(%rsp), %edx
callq 0x246b6
leaq 0x263472(%rip), %rax    # 0x28b430
movq (%rax), %rdi
leaq 0x263470(%rip), %rax    # 0x28b438
movq (%rax), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x115aed
jmp 0x27f48