// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: dbg_rsc(char*, unsigned long, char*, unsigned long, asg16_v*, char*, unsigned int)
void dbg_rsc(char *str0, uint64_t l0, char *str1, uint64_t l1, asg16_v *sc, char *real, uint32_t id)
{
    uint64_t ck, xk, yk, k, wx[2], wy[2]; uint32_t len; uint16_t c, bq, bt; 
    
    ck = xk = yk = 0;
    while (ck < sc->n) {
        wx[0] = xk; wy[0] = yk;
        ck = pop_trace_bp_f(sc, ck, &c, &bq, &bt, &len);
        if(c != 2) xk += len;
        if(c != 3) yk += len;
        wx[1] = xk; wy[1] = yk;
    }
    assert(xk == l0);

    // char cm[4], cc[4]; 
    // cm[0] = 'M'; cm[1] = 'S'; cm[2] = 'I'; cm[3] = 'D';
    // cc[0] = 'A'; cc[1] = 'C'; cc[2] = 'G'; cc[3] = 'T';

    ck = xk = yk = 0;
    while (ck < sc->n) {
        wx[0] = xk; wy[0] = yk;
        ck = pop_trace_bp_f(sc, ck, &c, &bq, &bt, &len);
        if(c != 2) xk += len;
        if(c != 3) yk += len;
        wx[1] = xk; wy[1] = yk;

        if(c == 0) {
            memcpy(str0 + wx[0], str1 + wy[0], (wx[1]-wx[0])*sizeof((*str1)));
        } else if(c == 1 || c == 3) {
            for (k = wx[0]; k < wx[1]; k++) str0[k] = s_H[bq]; 
        }
        // fprintf(stderr, "%u%c(%c)(x::[%lu,%ld))(y::[%lu,%ld))\n", len, cm[c], ((c==1)||(c==2))?(cc[bt]):('*'), wx[0], wx[1], wy[0], wy[1]); // s_H
    }

    if(memcmp(str0, real, l0*sizeof((*str0)))) {
        fprintf(stderr, "-0-[M::%s]\tid::%u\n", __func__, id);
        // for (k = 0; k < l0 && str0[k] == real[k]; k++);
        
        // fprintf(stderr, "-0-[M::%s]\tid::%u\tk::%lu\tl0::%lu\tnc::%c\toc::%c\n", __func__, id, k, l0, str0[k], real[k]);
        // exit(1);
    } else {
        // fprintf(stderr, "-1-[M::%s]\tid::%u\n", __func__, id);
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rdi, 0x8(%rsp)
movq (%r8), %rcx
testq %rcx, %rcx
movq %r8, 0x10(%rsp)
je 0x189e69
movq 0x10(%r8), %rdx
xorl %eax, %eax
xorl %r13d, %r13d
xorl %edi, %edi
movzwl (%rdx,%rdi,2), %r11d
movl %r11d, %r8d
shrl $0xe, %r8d
leal -0x2(%r8), %r9d
cmpl $0x2, %r9d
jae 0x189d91
movl %r11d, %r9d
shrl $0xc, %r9d
andl $0x3, %r9d
andl $0xfff, %r11d           # imm = 0xFFF
jmp 0x189da2
testl %r8d, %r8d
jne 0x189daa
andl $0x3fff, %r11d          # imm = 0x3FFF
movw $0xffff, %r9w           # imm = 0xFFFF
movl $0xffff, %r10d          # imm = 0xFFFF
jmp 0x189dc7
movl %r11d, %r9d
shrl $0xc, %r9d
andl $0x3, %r9d
movl %r11d, %r10d
shrl $0xa, %r10d
andl $0x3, %r10d
andl $0x3ff, %r11d           # imm = 0x3FF
movzwl %r11w, %r11d
incl %edi
cmpq %rdi, %rcx
jbe 0x189e4d
movzwl %r8w, %ebx
leal -0x2(%rbx), %ebp
movzwl (%rdx,%rdi,2), %r14d
movl %r14d, %r15d
shrl $0xe, %r15d
cmpl %r8d, %r15d
jne 0x189e4d
cmpl $0x2, %ebp
jae 0x189e03
movl %r14d, %r15d
shrl $0xc, %r15d
andl $0x3, %r15d
andl $0xfff, %r14d           # imm = 0xFFF
jmp 0x189e13
testl %ebx, %ebx
jne 0x189e1b
andl $0x3fff, %r14d          # imm = 0x3FFF
movw $0xffff, %r15w          # imm = 0xFFFF
movl $0xffff, %r12d          # imm = 0xFFFF
jmp 0x189e38
movl %r14d, %r15d
shrl $0xc, %r15d
andl $0x3, %r15d
movl %r14d, %r12d
shrl $0xa, %r12d
andl $0x3, %r12d
andl $0x3ff, %r14d           # imm = 0x3FF
cmpl %r10d, %r12d
jne 0x189e4d
cmpw %r15w, %r9w
jne 0x189e4d
addl %r14d, %r11d
incl %edi
cmpq %rdi, %rcx
ja 0x189dd9
movl %edi, %edi
cmpw $0x2, %r8w
movl %r11d, %r8d
cmoveq %r13, %r8
addq %r8, %rax
cmpq %rdi, %rcx
ja 0x189d67
jmp 0x189e6b
xorl %eax, %eax
movq %rsi, 0x20(%rsp)
cmpq %rsi, %rax
jne 0x18a068
movl 0x70(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x10(%rsp), %r8
movq (%r8), %rdx
testq %rdx, %rdx
je 0x18a010
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %r12, %rdi
movq 0x10(%r8), %r9
movzwl (%r9,%r13,2), %eax
movl %eax, %esi
shrl $0xe, %esi
movw $0xffff, %r11w          # imm = 0xFFFF
leal -0x2(%rsi), %ecx
cmpl $0x2, %ecx
jae 0x189ecb
movl %eax, %r8d
shrl $0xc, %r8d
andl $0x3, %r8d
movw $0xfff, %r10w           # imm = 0xFFF
jmp 0x189ef4
movw $0x3fff, %r10w          # imm = 0x3FFF
movw $0xffff, %r8w           # imm = 0xFFFF
testl %esi, %esi
je 0x189ef4
movl %eax, %r8d
shrl $0xc, %r8d
andl $0x3, %r8d
movl %eax, %r11d
shrl $0xa, %r11d
andl $0x3, %r11d
movw $0x3ff, %r10w           # imm = 0x3FF
movzwl %r10w, %r10d
andl %eax, %r10d
incl %r13d
cmpq %r13, %rdx
movl %r11d, 0x1c(%rsp)
jbe 0x189f81
movzwl %r11w, %r11d
movzwl %si, %r12d
leal -0x2(%r12), %ebp
movzwl (%r9,%r13,2), %r15d
movl %r15d, %ecx
shrl $0xe, %ecx
cmpl %esi, %ecx
jne 0x189f81
cmpl $0x2, %ebp
jae 0x189f3b
movl %r15d, %ebx
shrl $0xc, %ebx
andl $0x3, %ebx
andl $0xfff, %r15d           # imm = 0xFFF
jmp 0x189f4b
testl %r12d, %r12d
jne 0x189f52
andl $0x3fff, %r15d          # imm = 0x3FFF
movw $0xffff, %bx            # imm = 0xFFFF
movl $0xffff, %ecx           # imm = 0xFFFF
jmp 0x189f6b
movl %r15d, %ebx
shrl $0xc, %ebx
andl $0x3, %ebx
movl %r15d, %ecx
shrl $0xa, %ecx
andl $0x3, %ecx
andl $0x3ff, %r15d           # imm = 0x3FF
cmpl %r11d, %ecx
jne 0x189f81
cmpw %bx, %r8w
jne 0x189f81
addl %r15d, %r10d
incl %r13d
cmpq %r13, %rdx
ja 0x189f15
cmpw $0x2, %si
movl %r10d, %r15d
movq %r15, %rdx
movl $0x0, %ecx
cmoveq %rcx, %rdx
leaq (%rdx,%rdi), %r12
cmpw $0x3, %si
movl 0x1c(%rsp), %esi
cmovel %r8d, %esi
cmoveq %rcx, %r15
movzwl %ax, %ecx
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x189fcd
addq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rax
leaq (%rax,%r14), %rsi
callq 0x2160
movq 0x10(%rsp), %r8
jmp 0x189ffe
btl $0xe, %eax
movq 0x10(%rsp), %r8
leaq 0x100753(%rip), %r9     # 0x28a730
jae 0x189ffe
cmpq %r12, %rdi
jae 0x189ffe
movzwl %si, %eax
addq 0x8(%rsp), %rdi
xorl %ecx, %ecx
movb (%r9,%rax), %sil
movb %sil, (%rdi,%rcx)
incq %rcx
cmpq %rcx, %rdx
jne 0x189fee
movl %r13d, %r13d
addq %r15, %r14
movq (%r8), %rdx
cmpq %r13, %rdx
ja 0x189e9b
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x21a0
testl %eax, %eax
jne 0x18a037
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xfffa2(%rip), %rax     # 0x289fe0
movq (%rax), %rdi
leaq 0xa92c5(%rip), %rsi     # 0x23330d
leaq 0xa92d1(%rip), %rdx     # 0x233320
movl 0x18(%rsp), %ecx
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0
leaq 0xa9247(%rip), %rdi     # 0x2332b6
leaq 0xa7d75(%rip), %rsi     # 0x231deb
leaq 0xa9242(%rip), %rcx     # 0x2332bf
movl $0x172b, %edx           # imm = 0x172B
callq 0x2110