// File: 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x32, %rdi
shlq $0x0, %rdi
callq 0x2270
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x56d69(%rip), %rsi     # 0x398a73
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rdi
leaq 0x576b6(%rip), %rsi     # 0x3993d2
callq 0x2200
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2210
cmpq $0x0, -0x30(%rbp)
jne 0x341d3a
jmp 0x342320
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
addq $0x1f0, %rax            # imm = 0x1F0
movq %rax, -0x60(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x342317
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jb 0x341d96
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
subq 0x18(%rcx), %rax
movq %rax, -0x78(%rbp)
jmp 0x341d9e
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x60(%rbp), %rax
movq 0x18(%rax), %r8
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %r8, %rdx
cmovael %ecx, %eax
movslq %eax, %rdx
callq 0x3370e0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x341dd7
jmp 0x342306
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x342304
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x208(%rax), %rsi
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovael %ecx, %eax
cmpl $0x0, %eax
je 0x341f55
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x208(%rcx), %rax
jb 0x341e59
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
subq 0x208(%rcx), %rax
movq %rax, -0x80(%rbp)
jmp 0x341e61
movq -0x48(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x38(%rbp), %r8
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %rax
imulq $0x58, -0x48(%rbp), %rsi
addq %rsi, %rax
movl 0x18(%rax), %r9d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x4(%rax), %r14d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x14(%rax), %ebx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x8(%rax), %r11d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x18(%rax), %r10d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movb 0x24(%rax), %al
andb $0x3f, %al
movzbl %al, %eax
movl %eax, %esi
leaq 0x40f73(%rip), %rax     # 0x382e9b
movsbl (%rax,%rsi), %eax
leaq 0x56b54(%rip), %rsi     # 0x398a87
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x22a0
jmp 0x342076
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x208(%rcx), %rax
jb 0x341f7e
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
subq 0x208(%rcx), %rax
movq %rax, -0x88(%rbp)
jmp 0x341f89
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %edx
addl $0x1, %edx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x43342(%rip), %rax     # 0x385303
movsbl (%rax,%rcx), %ecx
movq -0x38(%rbp), %r8
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x48(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r9d
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x4(%rax), %r14d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x14(%rax), %ebx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x8(%rax), %r11d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x18(%rax), %r10d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movb 0x24(%rax), %al
andb $0x3f, %al
movzbl %al, %eax
movl %eax, %esi
leaq 0x40e4d(%rip), %rax     # 0x382e9b
movsbl (%rax,%rsi), %eax
leaq 0x56a57(%rip), %rsi     # 0x398ab0
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x50(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x208(%rax), %rsi
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovael %ecx, %eax
cmpl $0x0, %eax
je 0x3421aa
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x208(%rcx), %rax
jb 0x3420c4
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rcx
subq 0x208(%rcx), %rax
movq %rax, -0x90(%rbp)
jmp 0x3420cf
movq -0x50(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r8d
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %rax
imulq $0x58, -0x50(%rbp), %rsi
addq %rsi, %rax
movl 0x18(%rax), %r9d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0xc(%rax), %ebx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x1c(%rax), %r11d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x10(%rax), %r10d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x20(%rax), %eax
leaq 0x56951(%rip), %rsi     # 0x398ade
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movb $0x0, %al
callq 0x22a0
jmp 0x3422af
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x208(%rcx), %rax
jb 0x3421d3
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rcx
subq 0x208(%rcx), %rax
movq %rax, -0x98(%rbp)
jmp 0x3421de
movq -0x50(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %edx
addl $0x1, %edx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x50(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x430ed(%rip), %rax     # 0x385303
movsbl (%rax,%rcx), %ecx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r8d
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x50(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r9d
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0xc(%rax), %ebx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x1c(%rax), %r11d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x10(%rax), %r10d
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rax
movl 0x20(%rax), %eax
leaq 0x5686c(%rip), %rsi     # 0x398b03
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x30(%rbp), %rdi
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movb 0x24(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %edx
movq -0x68(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movb 0x24(%rax), %al
shrb $0x7, %al
movzbl %al, %ecx
leaq 0x56842(%rip), %rsi     # 0x398b2e
movb $0x0, %al
callq 0x22a0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x341ddf
jmp 0x342306
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x341d5c
movq -0x30(%rbp), %rdi
callq 0x21a0
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)