// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: gen_gl_aln(overlap_region_alloc*, ul_idx_t const*, kv_ul_ov_t*)
void gen_gl_aln(overlap_region_alloc* olist, const ul_idx_t *uref, kv_ul_ov_t *res)
{
	uint64_t k; ul_ov_t *p = NULL;
	res->n = 0; kv_resize(ul_ov_t, *res, 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, err::%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, olist->list[k].non_homopolymer_errors);
		p = &(res->a[res->n++]); assert(olist->list[k].overlapLen >= olist->list[k].align_length);
		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->sec = olist->list[k].align_length; 
		p->rev = olist->list[k].y_pos_strand; p->el = (olist->list[k].is_match==1?1:0); 
		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 %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq $0x0, 0x8(%rdx)
movq 0x10(%rdi), %rax
cmpq %rax, 0x10(%rdx)
jae 0x1b42b7
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
leaq 0x1(%rcx), %rax
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
leaq (%rax,%rax,8), %rax
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
callq 0x2370
movq %rax, (%rbx)
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x1b43cb
movq (%r15), %r8
xorl %eax, %eax
movl $0xc0000000, %ecx       # imm = 0xC0000000
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %esi, %esi
movq 0x8(%rbx), %r10
leaq 0x1(%r10), %rdi
movq %rdi, 0x8(%rbx)
movl 0x28(%r8,%rax), %r9d
cmpl %r9d, 0x20(%r8,%rax)
jb 0x1b43d4
leaq (%r10,%r10,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %r10, %rdi
addq (%rbx), %rdi
movl %esi, (%rdi)
movl 0x4(%r8,%rax), %r10d
movl %r10d, 0x4(%rdi)
movl 0x8(%r8,%rax), %r10d
incl %r10d
movl %r10d, 0x8(%rdi)
movl 0x10(%r8,%rax), %r8d
movl %r8d, 0xc(%rdi)
andl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movl 0x18(%rdi), %r10d
andl %ecx, %r10d
orl %r9d, %r10d
movl %r10d, 0x18(%rdi)
movq (%r15), %r11
movl 0x1c(%r11,%rax), %r11d
movl %r11d, %ebp
shll $0x1f, %ebp
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
orl %ebp, %r10d
movl %r10d, 0x18(%rdi)
movq (%r15), %r10
xorl %r12d, %r12d
cmpb $0x1, 0x2c(%r10,%rax)
sete %r12b
shll $0x1e, %r12d
orl %r9d, %r12d
orl %ebp, %r12d
movl %r12d, 0x18(%rdi)
testb $0x1, %r11b
jne 0x1b4386
movq (%r15), %r8
movl 0x14(%r8,%rax), %r9d
movl %r9d, 0x10(%rdi)
movl 0x18(%r8,%rax), %r9d
incl %r9d
jmp 0x1b43b4
movq (%r14), %r9
movq 0x10(%r9), %r9
leaq (%r8,%r8,4), %r10
movl (%r9,%r10,8), %r11d
andl %edx, %r11d
movq (%r15), %r8
movl 0x18(%r8,%rax), %ebp
notl %ebp
addl %r11d, %ebp
movl %ebp, 0x10(%rdi)
movl (%r9,%r10,8), %r9d
andl %edx, %r9d
subl 0x14(%r8,%rax), %r9d
movl %r9d, 0x14(%rdi)
incq %rsi
addq $0xa8, %rax
cmpq 0x10(%r15), %rsi
jb 0x1b42d1
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8cd19(%rip), %rdi     # 0x2410f4
leaq 0x8b879(%rip), %rsi     # 0x23fc5b
leaq 0x8cd44(%rip), %rcx     # 0x24112d
movl $0x1470, %edx           # imm = 0x1470
callq 0x2110