// File: chhylp123[P]hifiasm/inter.cpp
// Function: l2g_chain(ul_idx_t const*, kv_ul_ov_t*, vec_mg_lchain_t*)
void l2g_chain(const ul_idx_t *uref, kv_ul_ov_t *lidx, vec_mg_lchain_t *res)
{
	uint64_t k; 
	res->n = 0; kv_resize(mg_lchain_t, *res, lidx->n); res->n = lidx->n;
	for (k = 0; k < lidx->n; k++) {
		memset(&(res->a[k]), 0, sizeof(res->a[k]));
		res->a[k].v = (lidx->a[k].tn<<1)|(lidx->a[k].rev);
		res->a[k].off = lidx->a[k].qn; res->a[k].score = lidx->a[k].sec;
		res->a[k].qs = lidx->a[k].qs; res->a[k].qe = lidx->a[k].qe;
		res->a[k].rs = lidx->a[k].ts; res->a[k].re = lidx->a[k].te; 
		if(lidx->a[k].el) {
			res->a[k].score = retrieve_u_cov_region(uref, lidx->a[k].tn, 0, lidx->a[k].ts, lidx->a[k].te, NULL);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x29880c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x18(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x18(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x18(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x18(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x18(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x29880e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2989fd
movq -0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0x28, -0x20(%rbp), %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2100
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
shll %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rdx
addq %rdx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
orl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2989ea
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x20(%rbp), %rdx
addq %rdx, %rax
movl 0x14(%rax), %eax
movl %eax, %r8d
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %r9d
callq 0x110c0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x20(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
jmp 0x2989ec
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x298826
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)