// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: regen_ul_ov_t_lst(ul_idx_t const*, overlap_region_alloc*, kv_ul_ov_t*)
void regen_ul_ov_t_lst(const ul_idx_t *uref, overlap_region_alloc* olist, kv_ul_ov_t *idx)
{
	uint64_t k; ul_ov_t *p; idx->n = 0;
	kv_resize(ul_ov_t, *idx, olist->length);
	for (k = 0; k < olist->length; k++) {
		// fprintf(stderr, "---[M::%s::utg%.6dl] q[%d, %d), t[%d, %d), tot::%u, cis::%u\n", __func__, 
        // (int32_t)olist->list[k].y_id+1, olist->list[k].x_pos_s, olist->list[k].x_pos_e+1,
		// olist->list[k].y_pos_s, olist->list[k].y_pos_e+1,
		// olist->list[k].overlapLen, olist->list[k].align_length);
		p = &(idx->a[idx->n++]);
		p->qn = k; p->qs = olist->list[k].x_pos_s; p->qe = olist->list[k].x_pos_e+1;
        p->tn = olist->list[k].y_id; p->el = 1; p->rev = olist->list[k].y_pos_strand;
        p->sec = olist->list[k].non_homopolymer_errors;
		if(p->rev) {
            p->ts = uref->ug->u.a[p->tn].len - (olist->list[k].y_pos_e+1); 
            p->te = uref->ug->u.a[p->tn].len - olist->list[k].y_pos_s;
        } else {
            p->ts = olist->list[k].y_pos_s; 
            p->te = olist->list[k].y_pos_e+1;
        }
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
andq $0x0, 0x8(%rdx)
movq %rdi, %r15
movq 0x10(%rsi), %rax
cmpq %rax, 0x10(%rdx)
jae 0x170d34
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, 0x10(%rbx)
movq (%rbx), %rdi
imulq $0x1c, %rcx, %rsi
callq 0x2370
movq %rax, (%rbx)
xorl %eax, %eax
movl $0x40000000, %ecx       # imm = 0x40000000
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
cmpq 0x10(%r14), %rdi
jae 0x170e28
movq (%rbx), %r9
movq 0x8(%rbx), %r8
leaq 0x1(%r8), %r10
movq %r10, 0x8(%rbx)
imulq $0x1c, %r8, %r10
leaq (%r9,%r10), %r8
movl %edi, (%r9,%r10)
movq (%r14), %r11
movl 0x4(%r11,%rax), %ebp
movl %ebp, 0x4(%r9,%r10)
movl 0x8(%r11,%rax), %ebp
incl %ebp
movl %ebp, 0x8(%r9,%r10)
movl 0x10(%r11,%rax), %r11d
movl %r11d, 0xc(%r9,%r10)
movl 0x18(%r9,%r10), %ebp
orl %ecx, %ebp
movl %ebp, 0x18(%r9,%r10)
movq (%r14), %r12
movl 0x1c(%r12,%rax), %r12d
movl %r12d, %r13d
shll $0x1f, %r13d
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
orl %r13d, %ebp
movl %ebp, 0x18(%r9,%r10)
movq (%r14), %rbp
movl 0x30(%rbp,%rax), %ebp
andl %edx, %ebp
orl %r13d, %ebp
orl %ecx, %ebp
movl %ebp, 0x18(%r9,%r10)
testb $0x1, %r12b
jne 0x170de7
movq (%r14), %r9
movl 0x14(%r9,%rax), %r10d
movl %r10d, 0x10(%r8)
movl 0x18(%r9,%rax), %r9d
incl %r9d
jmp 0x170e16
movq (%r15), %r9
movq 0x10(%r9), %r9
imulq $0x28, %r11, %r10
movl (%r9,%r10), %r11d
andl %esi, %r11d
movq (%r14), %r12
movl 0x18(%r12,%rax), %ebp
notl %ebp
addl %r11d, %ebp
movl %ebp, 0x10(%r8)
movl (%r9,%r10), %r9d
andl %esi, %r9d
subl 0x14(%r12,%rax), %r9d
movl %r9d, 0x14(%r8)
incq %rdi
addq $0xa8, %rax
jmp 0x170d47
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq