// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: print_debug_scaffold_nodes(ug_opt_t*, usc_t*, unsigned int, asg_t*)
void print_debug_scaffold_nodes(ug_opt_t *uopt, usc_t *a, uint32_t a_n, asg_t *ng)
{
    uint32_t i, k, z, qn, tn, rl, hrl; usc_t *psa = NULL; ma_hit_t_alloc *s = NULL;
    UC_Read r0, r1; init_UC_Read(&r0); init_UC_Read(&r1);
    fprintf(stderr, "[M::%s] a_n::%u\n", __func__, a_n);
    for (i = 0; i < a_n; i++) {
        psa = &(a[i]);
        s = &(uopt->sources[psa->nid]);
        fprintf(stderr, "[M::%s::%u]%.*s(id::%u)\tlen::%lu\tulid::%u\trev::%u\tdel::%u\n", 
        __func__, i, (int32_t)Get_NAME_LENGTH(R_INF, psa->nid), 
        Get_NAME(R_INF, psa->nid), psa->nid, Get_READ_LENGTH(R_INF, psa->nid), psa->ulid>>1, psa->ulid&1, 
        ng->seq[psa->nid].del);

        recover_UC_Read(&r0, &R_INF, psa->nid);
        fprintf(stderr, "%.*s\n", (int32_t)Get_READ_LENGTH(R_INF, psa->nid), r0.seq);

        for (k = 0; k < s->length; k++) {
            qn = Get_qn(s->buffer[k]); tn = Get_tn(s->buffer[k]); assert(qn == psa->nid);
            fprintf(stderr, "q::[%u, %u)\t%c\tt::[%u, %u)\t%.*s(id::%u)\tlen::%lu\n", 
            Get_qs(s->buffer[k]), Get_qe(s->buffer[k]), "+-"[s->buffer[k].rev], 
            Get_ts(s->buffer[k]), Get_te(s->buffer[k]),
            (int32_t)Get_NAME_LENGTH(R_INF, tn), Get_NAME(R_INF, tn), tn, Get_READ_LENGTH(R_INF, tn));
            if(psa->raw_eof >= psa->raw_sof) {
                resize_UC_Read(&r0, Get_qe(s->buffer[k])-Get_qs(s->buffer[k]));
                recover_UC_Read_sub_region(r0.seq, Get_qs(s->buffer[k]), Get_qe(s->buffer[k])-Get_qs(s->buffer[k]), 0, &R_INF, qn);
                
                resize_UC_Read(&r1, Get_te(s->buffer[k])-Get_ts(s->buffer[k]));
                recover_UC_Read_sub_region(r1.seq, Get_ts(s->buffer[k]), Get_te(s->buffer[k])-Get_ts(s->buffer[k]), 0, &R_INF, tn);
                
                assert(Get_te(s->buffer[k])-Get_ts(s->buffer[k]) == Get_qe(s->buffer[k])-Get_qs(s->buffer[k]));
                rl = Get_te(s->buffer[k])-Get_ts(s->buffer[k]);
                if(s->buffer[k].rev) {
                    char t; hrl = rl>>1;
                    for (z = 0; z < hrl; z++) {
                        t = r1.seq[rl-z-1];
                        r1.seq[rl-z-1] = RC_CHAR(r1.seq[z]);
                        r1.seq[z] = RC_CHAR(t);
                    }
                    if(rl&1) r1.seq[z] = RC_CHAR(r1.seq[z]);
                }
                assert(memcmp(r0.seq, r1.seq, rl) == 0);
            }
        }
    }
    destory_UC_Read(&r0); destory_UC_Read(&r1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movq %rcx, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x9850
leaq -0xa0(%rbp), %rdi
callq 0x9850
movq 0x5b8d7(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x24(%rbp), %ecx
leaq 0x321c2(%rip), %rsi     # 0x39a8d8
leaq 0x321cc(%rip), %rdx     # 0x39a8e9
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x368d54
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
movl (%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq 0x5b877(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x34(%rbp), %ecx
leaq 0x5cb5a(%rip), %rax     # 0x3c52d0
movq 0x40(%rax), %rax
movq -0x58(%rbp), %rdx
movl (%rdx), %edx
addl $0x1, %edx
movl %edx, %edx
movq (%rax,%rdx,8), %rax
leaq 0x5cb40(%rip), %rdx     # 0x3c52d0
movq 0x40(%rdx), %rdx
movq -0x58(%rbp), %rsi
movl (%rsi), %esi
subq (%rdx,%rsi,8), %rax
movl %eax, %r8d
leaq 0x5cb28(%rip), %rax     # 0x3c52d0
movq 0x8(%rax), %r9
leaq 0x5cb1d(%rip), %rax     # 0x3c52d0
movq 0x40(%rax), %rax
movq -0x58(%rbp), %rdx
movl (%rdx), %edx
addq (%rax,%rdx,8), %r9
movq -0x58(%rbp), %rax
movl (%rax), %r14d
leaq 0x5cb01(%rip), %rax     # 0x3c52d0
movq 0x18(%rax), %rax
movq -0x58(%rbp), %rdx
movl (%rdx), %edx
movq (%rax,%rdx,8), %rbx
movq -0x58(%rbp), %rax
movl 0x4(%rax), %r11d
shrl %r11d
movq -0x58(%rbp), %rax
movl 0x4(%rax), %r10d
andl $0x1, %r10d
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x58(%rbp), %rdx
movl (%rdx), %edx
movl (%rax,%rdx,8), %eax
shrl $0x1f, %eax
leaq 0x320f5(%rip), %rsi     # 0x39a904
leaq 0x320d3(%rip), %rdx     # 0x39a8e9
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, %edx
leaq -0x80(%rbp), %rdi
leaq 0x5ca89(%rip), %rsi     # 0x3c52d0
callq 0xa380
movq 0x5b78d(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
leaq 0x5ca73(%rip), %rax     # 0x3c52d0
movq 0x18(%rax), %rax
movq -0x58(%rbp), %rcx
movl (%rcx), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %edx
movq -0x80(%rbp), %rcx
leaq 0x2e4d2(%rip), %rsi     # 0x396d4a
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0x368d44
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x3688d5
jmp 0x3688f4
leaq 0x32063(%rip), %rdi     # 0x39a93f
leaq 0x2d8d6(%rip), %rsi     # 0x3961b9
movl $0x3ae5, %edx           # imm = 0x3AE5
leaq 0x3205f(%rip), %rcx     # 0x39a94e
callq 0x2130
movq 0x5b6e5(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %edx
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %eax
movl %eax, %esi
leaq 0x1a54b(%rip), %rax     # 0x382e9b
movsbl (%rax,%rsi), %r8d
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl 0x10(%rax), %r9d
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl 0x14(%rax), %r14d
leaq 0x5c94a(%rip), %rax     # 0x3c52d0
movq 0x40(%rax), %rax
movl -0x44(%rbp), %esi
addl $0x1, %esi
movl %esi, %esi
movq (%rax,%rsi,8), %rax
leaq 0x5c933(%rip), %rsi     # 0x3c52d0
movq 0x40(%rsi), %rsi
movl -0x44(%rbp), %r10d
subq (%rsi,%r10,8), %rax
movl %eax, %ebx
leaq 0x5c91e(%rip), %rax     # 0x3c52d0
movq 0x8(%rax), %r11
leaq 0x5c913(%rip), %rax     # 0x3c52d0
movq 0x40(%rax), %rax
movl -0x44(%rbp), %esi
addq (%rax,%rsi,8), %r11
movl -0x44(%rbp), %r10d
leaq 0x5c8fd(%rip), %rax     # 0x3c52d0
movq 0x18(%rax), %rax
movl -0x44(%rbp), %esi
movq (%rax,%rsi,8), %rax
leaq 0x31fb1(%rip), %rsi     # 0x39a996
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x58(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x58(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jb 0x368d34
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0xa62c0
movq -0x80(%rbp), %rdi
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %eax
movl %eax, %esi
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, %eax
movl %eax, %edx
movl -0x40(%rbp), %eax
movl %eax, %r9d
xorl %ecx, %ecx
leaq 0x5c829(%rip), %r8      # 0x3c52d0
callq 0x9a30
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0xa62c0
movq -0xa0(%rbp), %rdi
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %esi
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
movl -0x44(%rbp), %eax
movl %eax, %r9d
xorl %ecx, %ecx
leaq 0x5c794(%rip), %r8      # 0x3c52d0
callq 0x9a30
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movq -0x60(%rbp), %rdx
movq (%rdx), %rdx
movl -0x38(%rbp), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rdx
movq (%rdx), %rdx
subl %edx, %ecx
cmpl %ecx, %eax
jne 0x368b99
jmp 0x368bb8
leaq 0x31e28(%rip), %rdi     # 0x39a9c8
leaq 0x2d612(%rip), %rsi     # 0x3961b9
movl $0x3af1, %edx           # imm = 0x3AF1
leaq 0x31d9b(%rip), %rcx     # 0x39a94e
callq 0x2130
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movl -0x38(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0x368cf7
movl -0x48(%rbp), %eax
shrl %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jae 0x368cb6
movq -0xa0(%rbp), %rax
movl -0x48(%rbp), %ecx
subl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0xa1(%rbp)
movq -0xa0(%rbp), %rax
movl -0x3c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x5b9fa(%rip), %rax     # 0x3c4650
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x5baf2(%rip), %rax     # 0x3c4755
movb (%rax,%rcx), %dl
movq -0xa0(%rbp), %rax
movl -0x48(%rbp), %ecx
subl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movzbl -0xa1(%rbp), %eax
movl %eax, %ecx
leaq 0x5b9c5(%rip), %rax     # 0x3c4650
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x5babd(%rip), %rax     # 0x3c4755
movb (%rax,%rcx), %dl
movq -0xa0(%rbp), %rax
movl -0x3c(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x368c18
movl -0x48(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x368cf5
movq -0xa0(%rbp), %rax
movl -0x3c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x5b978(%rip), %rax     # 0x3c4650
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x5ba70(%rip), %rax     # 0x3c4755
movb (%rax,%rcx), %dl
movq -0xa0(%rbp), %rax
movl -0x3c(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x368cf7
movq -0x80(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl -0x48(%rbp), %eax
movl %eax, %edx
callq 0x20b0
cmpl $0x0, %eax
jne 0x368d13
jmp 0x368d32
leaq 0x31d05(%rip), %rdi     # 0x39aa1f
leaq 0x2d498(%rip), %rsi     # 0x3961b9
movl $0x3afc, %edx           # imm = 0x3AFC
leaq 0x31c21(%rip), %rcx     # 0x39a94e
callq 0x2130
jmp 0x368d34
jmp 0x368d36
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x368886
jmp 0x368d46
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x36872b
leaq -0x80(%rbp), %rdi
callq 0x9670
leaq -0xa0(%rbp), %rdi
callq 0x9670
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)