// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: prt_scaf_res_t(scaf_res_t*, ma_ug_t*, ma_ug_t*, char const*)
void prt_scaf_res_t(scaf_res_t *pa, ma_ug_t *ref, ma_ug_t *ctg, const char *cn)
{
    uint32_t k, i, z, a_n; ma_utg_t *rch; ul_vec_t *idx; uc_block_t *a; 
    for(i = 0; i < ctg->u.n; i++) {
        rch = &(ctg->u.a[i]); idx = &(pa->a[i]);
        fprintf(stderr, "[M::%s] %s%.6u%c. rch->len::%u, rch->n::%u, idx->n::%u\n", __func__, cn, i + 1, "lc"[rch->circ], (uint32_t)rch->len, (uint32_t)rch->n, (uint32_t)idx->bb.n);
        if(idx->bb.n > 1) fprintf(stderr, "[M::%s::>>>>>>] idx->n::%u\n", __func__, (uint32_t)idx->bb.n);
        // for (k = 0; k < idx->bb.n; k++) {
        //     fprintf(stderr, "[k->%u::utg%.6u%c(len->%u::n->%u)]\tq::[%u, %u)\t%c\tt::[%u, %u)\n", 
        //             k, (idx->bb.a[k].hid) + 1, "lc"[ref->u.a[(idx->bb.a[k].hid)].circ], ref->u.a[(idx->bb.a[k].hid)].len, ref->u.a[(idx->bb.a[k].hid)].n,
        //             idx->bb.a[k].qs, idx->bb.a[k].qe, "+-"[idx->bb.a[k].rev], idx->bb.a[k].ts, idx->bb.a[k].te);
        // }

        for (k = 0; k < idx->bb.n; k++) {
            a = idx->bb.a + idx->bb.a[k].ts; a_n = idx->bb.a[k].te - idx->bb.a[k].ts;
            fprintf(stderr, "q::[%u, %u)\n", idx->bb.a[k].qs, idx->bb.a[k].qe);
            for (z = 0; z < a_n; z++) fprintf(stderr, "utg%.6u%c,", (a[z].hid)+1, "lc"[ref->u.a[a[z].hid].circ]);
            fprintf(stderr, "\n");
            for (z = 0; z < a_n; z++) fprintf(stderr, "utg%.6u%c[%u,%u),", (a[z].hid)+1, "lc"[ref->u.a[a[z].hid].circ], a[z].qs, a[z].qe);
            fprintf(stderr, "\n");
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x20(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x1b5667(%rip), %rbp    # 0x252fe0
xorl %eax, %eax
movq %rdx, 0x18(%rsp)
movl %eax, %eax
cmpq %rax, (%rdx)
jbe 0x9db60
movq 0x10(%rdx), %rcx
imulq $0x28, %rax, %rdx
movq 0x10(%rsp), %rsi
movq (%rsi), %rbx
movq (%rbp), %rdi
leal 0x1(%rax), %r8d
movl (%rcx,%rdx), %r10d
movl 0x10(%rcx,%rdx), %r11d
movl %r10d, %ecx
shrl $0x1f, %ecx
leaq 0x148cd2(%rip), %rdx    # 0x1e668b
movsbl (%rcx,%rdx), %r9d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
imulq $0x58, %rax, %r14
movl 0x20(%rbx,%r14), %r15d
subq $0x8, %rsp
leaq 0x14bdc5(%rip), %rsi    # 0x1e979e
leaq 0x14bdf6(%rip), %rdx    # 0x1e97d6
movq 0x28(%rsp), %rcx
movl %r8d, 0xc(%rsp)
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movq 0x20(%rbx,%r14), %rcx
cmpq $0x2, %rcx
jae 0x9db42
leaq (%rbx,%r14), %rax
addq $0x20, %rax
xorl %r14d, %r14d
movq %rax, 0x28(%rsp)
movl %r14d, %r14d
cmpq %r14, (%rax)
jbe 0x9db34
movq 0x10(%rax), %rbx
imulq $0x24, %r14, %rax
movl 0xc(%rbx,%rax), %ecx
imulq $0x24, %rcx, %rdx
movq %rdx, 0x30(%rsp)
leaq (%rbx,%rdx), %r15
movl 0x10(%rbx,%rax), %r12d
subl %ecx, %r12d
movq (%rbp), %rdi
movl 0x4(%rbx,%rax), %edx
movl 0x8(%rbx,%rax), %ecx
leaq 0x155abf(%rip), %rsi    # 0x1f3519
xorl %eax, %eax
callq 0x22b0
imulq $0x24, %r12, %r12
movq %rbp, %rax
xorl %r13d, %r13d
movq %rax, %rbp
movq (%rax), %rsi
cmpq %r13, %r12
je 0x9dab5
movl (%r15,%r13), %eax
leal 0x1(%rax), %edx
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
movl (%rcx,%rax), %eax
shrl $0x1f, %eax
leaq 0x148bf4(%rip), %rcx    # 0x1e668b
movsbl (%rax,%rcx), %ecx
movq %rsi, %rdi
leaq 0x14bd5c(%rip), %rsi    # 0x1e9801
xorl %eax, %eax
callq 0x22b0
addq $0x24, %r13
movq %rbp, %rax
jmp 0x9da6b
pushq $0xa
popq %r13
movl %r13d, %edi
callq 0x2270
movq 0x30(%rsp), %rax
addq %rax, %rbx
addq $0x8, %rbx
xorl %r15d, %r15d
movq (%rbp), %rsi
cmpq %r15, %r12
je 0x9db1f
movl -0x8(%rbx,%r15), %eax
movl -0x4(%rbx,%r15), %r8d
leal 0x1(%rax), %edx
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
movl (%rcx,%rax), %eax
shrl $0x1f, %eax
leaq 0x148b8b(%rip), %rcx    # 0x1e668b
movsbl (%rax,%rcx), %ecx
movl (%rbx,%r15), %r9d
movq %rsi, %rdi
leaq 0x14bcfa(%rip), %rsi    # 0x1e980c
xorl %eax, %eax
callq 0x22b0
addq $0x24, %r15
jmp 0x9dad0
movl %r13d, %edi
callq 0x2270
incl %r14d
movq 0x28(%rsp), %rax
jmp 0x9da1a
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %eax
jmp 0x9d980
movq (%rbp), %rdi
leaq 0x14bc98(%rip), %rsi    # 0x1e97e5
leaq 0x14bc82(%rip), %rdx    # 0x1e97d6
xorl %eax, %eax
callq 0x22b0
jmp 0x9da0a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq