// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: print_uls_ovs(ul_resolve_t*, char const*)
void print_uls_ovs(ul_resolve_t *uidx, const char *nn)
{
    char* gfa_name = NULL; MALLOC(gfa_name, strlen(nn)+50);
    sprintf(gfa_name, "%s.integer.ovlp.log", nn);
    FILE* fp = fopen(gfa_name, "w"); free(gfa_name);
    if (!fp) return;
    uint64_t i, k, qv, tv; ma_ug_t *ug = uidx->l1_ug; ul2ul_idx_t *ul2 = &(uidx->uovl); ul2ul_item_t *o;
    for (i = 0; i < ul2->uln; ++i) {
        o = get_ul_ovlp(ul2, ulg_id(*ul2, i), ulg_type(*ul2, i));
        if(!o) continue;
        for (k = 0; k < o->n; k++) {
            qv = i; tv = o->a[k].hid;
            if(ulg_type(uidx->uovl, qv)) {//ul read
                qv = ulg_id(uidx->uovl, qv);
                fprintf(fp, "%.*s(id::%lu)\t%u\t%u(i::%u)\t%u(i::%u)\t%c\t", (int32_t)uidx->idx->nid.a[qv].n, uidx->idx->nid.a[qv].a, 
                    i, uidx->idx->a[qv].rlen, o->a[k].qs, o->a[k].qs_k, o->a[k].qe, o->a[k].qe_k, "+-"[o->a[k].is_rev]);
            } else {///ug node
                qv = ulg_id(uidx->uovl, qv);
                fprintf(fp, "utg%.6d%c(id::%lu)\t%u\t%u(i::%u)\t%u(i::%u)\t%c\t", (int32_t)qv + 1, "lc"[ug->u.a[qv].circ], 
                    i, ug->u.a[qv].len, o->a[k].qs, o->a[k].qs_k, o->a[k].qe, o->a[k].qe_k, "+-"[o->a[k].is_rev]);
            }

            if(ulg_type(uidx->uovl, tv)) {//ul read
                tv = ulg_id(uidx->uovl, tv);
                fprintf(fp, "%.*s(id::%u)\t%u\t%u(i::%u)\t%u(i::%u)\t", (int32_t)uidx->idx->nid.a[tv].n, uidx->idx->nid.a[tv].a, 
                    o->a[k].hid, uidx->idx->a[tv].rlen, o->a[k].ts, o->a[k].ts_k, o->a[k].te, o->a[k].te_k);

            } else {
                tv = ulg_id(uidx->uovl, tv);
                fprintf(fp, "utg%.6d%c(id::%u)\t%u\t%u(i::%u)\t%u(i::%u)\t\t", (int32_t)tv + 1, "lc"[ug->u.a[tv].circ], 
                o->a[k].hid, ug->u.a[tv].len, o->a[k].ts, o->a[k].ts_k, o->a[k].te, o->a[k].te_k);
            }

            fprintf(fp, "del::%u\tct::%u\n", o->a[k].is_del, o->a[k].is_ct);
        }
    }
    fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r12
leaq 0x3b5a8(%rip), %rsi     # 0x23ba9f
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x3bef3(%rip), %rsi     # 0x23c3fe
movq %r12, %rdi
callq 0x2210
movq %rax, %r15
movq %r12, %rdi
callq 0x2220
testq %r15, %r15
je 0x2007f5
cmpq $0x0, 0x208(%rbx)
je 0x2007df
movq %rbx, %r10
movq 0x18(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r8d, %r8d
movq %r15, 0x8(%rsp)
movq %rbx, 0x30(%rsp)
movq 0x220(%r10), %rax
movl (%rax,%r8,4), %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r12
je 0x200570
shlq $0x5, %r12
addq 0x1f0(%r10), %r12
jmp 0x200573
xorl %r12d, %r12d
testq %r12, %r12
je 0x2007cf
cmpq $0x0, 0x8(%r12)
je 0x2007cf
movq %r8, %rax
shlq $0x4, %rax
movq %rax, 0x28(%rsp)
imulq $0x58, %r8, %rax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r8, 0x40(%rsp)
movq %r12, 0x38(%rsp)
movq (%r12), %rax
movl (%rax,%rbp), %r12d
movq %r8, %rcx
subq 0x208(%r10), %rcx
jae 0x200635
movq 0x30(%r10), %rcx
movq 0x10(%rcx), %rsi
movq 0x48(%rcx), %rdi
movq 0x28(%rsp), %rcx
movl 0x8(%rsi,%rcx), %edx
movq (%rsi,%rcx), %rcx
movq 0x20(%rsp), %rsi
movl 0x18(%rdi,%rsi), %r9d
movl 0x14(%rax,%rbp), %r11d
movl 0x4(%rax,%rbp), %esi
movq %rsi, 0x10(%rsp)
movl 0x8(%rax,%rbp), %ebx
movl 0x18(%rax,%rbp), %r14d
movzbl 0x24(%rax,%rbp), %eax
andl $0x3f, %eax
movq %r10, %r15
leaq 0x25bb7(%rip), %rsi     # 0x2261c3
movsbl (%rax,%rsi), %r10d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3b492(%rip), %rsi     # 0x23bab3
xorl %eax, %eax
pushq %r10
pushq %r14
pushq %rbx
pushq %r11
pushq 0x38(%rsp)
callq 0x22b0
jmp 0x2006b1
leal 0x1(%rcx), %edx
movq 0x18(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rcx,%rcx,4), %rcx
movl (%rsi,%rcx,8), %r9d
movl %r9d, %ecx
shrl $0x1f, %ecx
leaq 0x27fd5(%rip), %rsi     # 0x22862b
movsbl (%rcx,%rsi), %ecx
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl 0x14(%rax,%rbp), %r11d
movl 0x4(%rax,%rbp), %esi
movq %rsi, 0x10(%rsp)
movl 0x8(%rax,%rbp), %ebx
movl 0x18(%rax,%rbp), %r14d
movzbl 0x24(%rax,%rbp), %eax
andl $0x3f, %eax
movq %r10, %r15
leaq 0x25b39(%rip), %rsi     # 0x2261c3
movsbl (%rax,%rsi), %r10d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3b43d(%rip), %rsi     # 0x23badc
xorl %eax, %eax
pushq %r10
pushq %r14
pushq %rbx
pushq %r11
pushq 0x38(%rsp)
callq 0x22b0
addq $0x30, %rsp
movq %r12, %rax
subq 0x208(%r15), %rax
movq 0x38(%rsp), %rbx
jae 0x200724
movq 0x30(%r15), %rax
imulq $0x58, %r12, %rsi
shlq $0x4, %r12
movq 0x10(%rax), %rcx
movq 0x48(%rax), %rax
movl 0x8(%rcx,%r12), %edx
movq (%rcx,%r12), %rcx
movq (%rbx), %rdi
movl 0x18(%rax,%rsi), %r9d
movl (%rdi,%rbp), %r8d
movl 0xc(%rdi,%rbp), %r10d
movl 0x1c(%rdi,%rbp), %r11d
movq %rbx, %r12
movl 0x10(%rdi,%rbp), %ebx
movl 0x20(%rdi,%rbp), %r14d
movq 0x8(%rsp), %r15
movq %r15, %rdi
leaq 0x3b3f6(%rip), %rsi     # 0x23bb0a
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
jmp 0x20078a
leal 0x1(%rax), %edx
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %r9d
movl %r9d, %eax
shrl $0x1f, %eax
leaq 0x27ee6(%rip), %rcx     # 0x22862b
movsbl (%rax,%rcx), %ecx
movq (%rbx), %rax
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl (%rax,%rbp), %r8d
movl 0xc(%rax,%rbp), %r10d
movl 0x1c(%rax,%rbp), %r11d
movq %rbx, %r12
movl 0x10(%rax,%rbp), %ebx
movl 0x20(%rax,%rbp), %r14d
movq 0x8(%rsp), %r15
movq %r15, %rdi
leaq 0x3b3b3(%rip), %rsi     # 0x23bb2f
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movq (%r12), %rax
movzbl 0x24(%rax,%rbp), %ecx
movl %ecx, %edx
shrl $0x6, %edx
andl $0x1, %edx
shrl $0x7, %ecx
movq %r15, %rdi
leaq 0x3b3ae(%rip), %rsi     # 0x23bb5a
xorl %eax, %eax
callq 0x22b0
incq %r13
addq $0x28, %rbp
cmpq 0x8(%r12), %r13
movq 0x40(%rsp), %r8
movq 0x30(%rsp), %r10
jb 0x2005ac
incq %r8
cmpq 0x208(%r10), %r8
jb 0x20054e
movq %r15, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2190
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq