// File: 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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x126de5
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x28(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x28(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq 0x29d4af(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x20(%rbp), %rcx
movl -0x28(%rbp), %r8d
addl $0x1, %r8d
movq -0x38(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x25e7af(%rip), %rax    # 0x385303
movsbl (%rax,%rdx), %r9d
movq -0x38(%rbp), %rax
movl (%rax), %r11d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movq -0x38(%rbp), %rax
movl 0x10(%rax), %r10d
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
leaq 0x26190b(%rip), %rsi    # 0x388489
leaq 0x26193c(%rip), %rdx    # 0x3884c1
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x40(%rbp), %rax
cmpq $0x1, 0x20(%rax)
jbe 0x126bcd
movq 0x29d435(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, %ecx
leaq 0x261911(%rip), %rsi    # 0x3884d0
leaq 0x2618fb(%rip), %rdx    # 0x3884c1
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x126dd5
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
imulq $0x24, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
imulq $0x24, %rdx, %rdx
addq %rdx, %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x30(%rbp)
movq 0x29d39f(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
leaq 0x26b5b0(%rip), %rsi    # 0x392225
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x126cf4
movq 0x29d34e(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %esi
imulq $0x24, %rsi, %rsi
addq %rsi, %rcx
movl (%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25e62c(%rip), %rax    # 0x385303
movsbl (%rax,%rcx), %ecx
leaq 0x26180a(%rip), %rsi    # 0x3884ec
movb $0x0, %al
callq 0x22a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x126c83
movq 0x29d2e5(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x25fd23(%rip), %rsi    # 0x386a28
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x126daf
movq 0x29d2ba(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %esi
imulq $0x24, %rsi, %rsi
addq %rsi, %rcx
movl (%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25e598(%rip), %rax    # 0x385303
movsbl (%rax,%rcx), %ecx
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %esi
imulq $0x24, %rsi, %rsi
addq %rsi, %rax
movl 0x4(%rax), %r8d
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %esi
imulq $0x24, %rsi, %rsi
addq %rsi, %rax
movl 0x8(%rax), %r9d
leaq 0x26175d(%rip), %rsi    # 0x3884f7
movb $0x0, %al
callq 0x22a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x126d13
movq 0x29d22a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x25fc68(%rip), %rsi    # 0x386a28
movb $0x0, %al
callq 0x22a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x126bd4
jmp 0x126dd7
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x126aef
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)