// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r15
leaq 0x3a860(%rip), %rsi     # 0x1f9d42
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x3b1ab(%rip), %rsi     # 0x1fa6a1
movq %r15, %rdi
callq 0x2210
movq %rax, %rbp
movq %r15, %rdi
callq 0x2220
testq %rbp, %rbp
je 0x1bf7be
movq 0x18(%r12), %rax
movq %rax, 0x10(%rsp)
leaq 0x1f0(%r12), %rax
movq %rax, 0x20(%rsp)
xorl %r8d, %r8d
movq %rbp, 0x8(%rsp)
cmpq 0x208(%r12), %r8
jae 0x1bf7a8
movq 0x20(%rsp), %rdi
movq %r8, %rsi
pushq $0x1
popq %rdx
movq %r8, 0x18(%rsp)
callq 0x1ba426
movq 0x18(%rsp), %r8
testq %rax, %rax
je 0x1bf7a0
movq %rax, %r15
movq %r8, %rax
shlq $0x4, %rax
movq %rax, 0x30(%rsp)
imulq $0x58, %r8, %rax
movq %rax, 0x28(%rsp)
xorl %r13d, %r13d
xorl %eax, %eax
movq %r15, 0x38(%rsp)
cmpq 0x8(%r15), %rax
jae 0x1bf7a0
movq %rax, 0x40(%rsp)
movq (%r15), %rax
movl (%rax,%r13), %ebp
movq %r8, %rcx
subq 0x208(%r12), %rcx
jae 0x1bf616
movq 0x30(%r12), %rcx
movq 0x10(%rcx), %rsi
movq 0x48(%rcx), %rdi
movq 0x30(%rsp), %rcx
movl 0x8(%rsi,%rcx), %edx
movq (%rsi,%rcx), %rcx
movq 0x28(%rsp), %rsi
movl 0x18(%rdi,%rsi), %r9d
movl 0x14(%rax,%r13), %r11d
movl 0x4(%rax,%r13), %r10d
movl 0x8(%rax,%r13), %ebx
movl 0x18(%rax,%r13), %r14d
movzbl 0x24(%rax,%r13), %eax
andl $0x3f, %eax
leaq 0x24c34(%rip), %rsi     # 0x1e4223
movsbl (%rax,%rsi), %r15d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3a752(%rip), %rsi     # 0x1f9d56
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
jmp 0x1bf68b
leal 0x1(%rcx), %edx
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rsi
imulq $0x28, %rcx, %rcx
movl (%rsi,%rcx), %r9d
movl %r9d, %ecx
shrl $0x1f, %ecx
leaq 0x27054(%rip), %rsi     # 0x1e668b
movsbl (%rcx,%rsi), %ecx
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl 0x14(%rax,%r13), %r11d
movl 0x4(%rax,%r13), %r10d
movl 0x8(%rax,%r13), %ebx
movl 0x18(%rax,%r13), %r14d
movzbl 0x24(%rax,%r13), %eax
andl $0x3f, %eax
leaq 0x24bbd(%rip), %rsi     # 0x1e4223
movsbl (%rax,%rsi), %r15d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3a704(%rip), %rsi     # 0x1f9d7f
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
addq $0x30, %rsp
movq %rbp, %rax
subq 0x208(%r12), %rax
movq 0x38(%rsp), %r15
jae 0x1bf6fd
movq 0x30(%r12), %rax
imulq $0x58, %rbp, %rsi
shlq $0x4, %rbp
movq 0x10(%rax), %rcx
movq 0x48(%rax), %rax
movl 0x8(%rcx,%rbp), %edx
movq (%rcx,%rbp), %rcx
movq (%r15), %rdi
movl 0x18(%rax,%rsi), %r9d
movl (%rdi,%r13), %r8d
movl 0xc(%rdi,%r13), %r10d
movl 0x1c(%rdi,%r13), %r11d
movl 0x10(%rdi,%r13), %ebx
movl 0x20(%rdi,%r13), %r14d
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x3a6c0(%rip), %rsi     # 0x1f9dad
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
jmp 0x1bf761
leal 0x1(%rax), %edx
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
movl (%rcx,%rax), %r9d
movl %r9d, %eax
shrl $0x1f, %eax
leaq 0x26f6d(%rip), %rcx     # 0x1e668b
movsbl (%rax,%rcx), %ecx
movq (%r15), %rax
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl (%rax,%r13), %r8d
movl 0xc(%rax,%r13), %r10d
movl 0x1c(%rax,%r13), %r11d
movl 0x10(%rax,%r13), %ebx
movl 0x20(%rax,%r13), %r14d
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x3a67f(%rip), %rsi     # 0x1f9dd2
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movq (%r15), %rax
movzbl 0x24(%rax,%r13), %ecx
movl %ecx, %edx
shrl $0x6, %edx
andl $0x1, %edx
shrl $0x7, %ecx
movq %rbp, %rdi
leaq 0x3a67a(%rip), %rsi     # 0x1f9dfd
xorl %eax, %eax
callq 0x22b0
movq 0x40(%rsp), %rax
incq %rax
addq $0x28, %r13
movq 0x18(%rsp), %r8
jmp 0x1bf584
incq %r8
jmp 0x1bf531
movq %rbp, %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