// File: /workspace/github_cpp_makefile_star2_O3/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, 0x8(%rsp)
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r15
leaq 0x3c160(%rip), %rsi     # 0x247d83
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x3caab(%rip), %rsi     # 0x2486e2
movq %r15, %rdi
callq 0x2210
movq %r15, %rdi
movq %rax, %r15
callq 0x2220
testq %r15, %r15
je 0x20bf4f
movq 0x8(%rsp), %rax
movq 0x208(%rax), %rax
testq %rax, %rax
je 0x20bf39
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x20(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
movq %r15, 0x10(%rsp)
movq 0x8(%rsp), %rcx
movq 0x220(%rcx), %rcx
movl (%rcx,%r8,4), %ecx
cmpq %rdx, %rcx
je 0x20bf2d
movq 0x8(%rsp), %rsi
movq 0x1f0(%rsi), %r12
testq %r12, %r12
je 0x20bf2d
shlq $0x5, %rcx
addq %rcx, %r12
cmpq $0x0, 0x8(%r12)
je 0x20bf2d
movq %r8, %rax
shlq $0x4, %rax
movq %rax, 0x38(%rsp)
imulq $0x58, %r8, %rax
movq %rax, 0x30(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r8, 0x40(%rsp)
movq %r12, 0x28(%rsp)
movq (%r12), %rax
movl (%rax,%rbp), %ebx
movq %r8, %rcx
movq 0x8(%rsp), %rdx
subq 0x208(%rdx), %rcx
jae 0x20bd7d
movq 0x8(%rsp), %r12
movq 0x30(%r12), %rcx
movq 0x10(%rcx), %rsi
movq 0x48(%rcx), %rdi
movq 0x38(%rsp), %rcx
movl 0x8(%rsi,%rcx), %edx
movq (%rsi,%rcx), %rcx
movq 0x30(%rsp), %rsi
movl 0x18(%rdi,%rsi), %r9d
movl 0x14(%rax,%rbp), %r11d
movl 0x4(%rax,%rbp), %esi
movq %rsi, 0x18(%rsp)
movl 0x8(%rax,%rbp), %r14d
movl 0x18(%rax,%rbp), %r10d
movzbl 0x24(%rax,%rbp), %eax
andl $0x3f, %eax
leaq 0x26583(%rip), %rsi     # 0x2322d3
movsbl (%rax,%rsi), %r15d
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
leaq 0x3c032(%rip), %rsi     # 0x247d97
xorl %eax, %eax
pushq %r15
pushq %r10
pushq %r14
pushq %r11
pushq 0x40(%rsp)
callq 0x22b0
jmp 0x20bdfd
leal 0x1(%rcx), %edx
movq 0x20(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rcx,%rcx,4), %rcx
movl (%rsi,%rcx,8), %r9d
movl %r9d, %ecx
shrl $0x1f, %ecx
leaq 0x2899d(%rip), %rsi     # 0x23473b
movsbl (%rcx,%rsi), %ecx
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl 0x14(%rax,%rbp), %r11d
movl 0x4(%rax,%rbp), %esi
movq %rsi, 0x18(%rsp)
movl 0x8(%rax,%rbp), %r14d
movl 0x18(%rax,%rbp), %r15d
movzbl 0x24(%rax,%rbp), %eax
andl $0x3f, %eax
movq 0x8(%rsp), %r12
leaq 0x264fe(%rip), %rsi     # 0x2322d3
movsbl (%rax,%rsi), %r10d
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
leaq 0x3bfd6(%rip), %rsi     # 0x247dc0
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r14
pushq %r11
pushq 0x40(%rsp)
callq 0x22b0
addq $0x30, %rsp
movq %rbx, %rax
subq 0x208(%r12), %rax
jae 0x20be73
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
imulq $0x58, %rbx, %rsi
shlq $0x4, %rbx
movq 0x10(%rax), %rcx
movq 0x48(%rax), %rax
movl 0x8(%rcx,%rbx), %edx
movq (%rcx,%rbx), %rcx
movq 0x28(%rsp), %r12
movq (%r12), %rdi
movl 0x18(%rax,%rsi), %r9d
movl (%rdi,%rbp), %r8d
movl 0xc(%rdi,%rbp), %r10d
movl 0x1c(%rdi,%rbp), %r11d
movl 0x10(%rdi,%rbp), %ebx
movl 0x20(%rdi,%rbp), %r14d
movq 0x10(%rsp), %r15
movq %r15, %rdi
leaq 0x3bf8b(%rip), %rsi     # 0x247dee
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x22b0
jmp 0x20bedc
leal 0x1(%rax), %edx
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %r9d
movl %r9d, %eax
shrl $0x1f, %eax
leaq 0x288a7(%rip), %rcx     # 0x23473b
movsbl (%rax,%rcx), %ecx
movq 0x28(%rsp), %r12
movq (%r12), %rax
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movl (%rax,%rbp), %r8d
movl 0xc(%rax,%rbp), %r10d
movl 0x1c(%rax,%rbp), %r11d
movl 0x10(%rax,%rbp), %ebx
movl 0x20(%rax,%rbp), %r14d
movq 0x10(%rsp), %r15
movq %r15, %rdi
leaq 0x3bf45(%rip), %rsi     # 0x247e13
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 0x3bf40(%rip), %rsi     # 0x247e3e
xorl %eax, %eax
callq 0x22b0
incq %r13
addq $0x28, %rbp
cmpq 0x8(%r12), %r13
movq 0x40(%rsp), %r8
jb 0x20bce8
movq 0x8(%rsp), %rax
movq 0x208(%rax), %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
incq %r8
cmpq %rax, %r8
jb 0x20bc83
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