// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: debug_retrive_bqual(asg8_v*, asg8_v*, unsigned long, unsigned long)
void debug_retrive_bqual(asg8_v *vq, asg8_v *vt, uint64_t id, uint64_t rn)
{
    uint64_t k, n, z[2], s, e, rev;
    retrive_bqual(vq, NULL, id, -1, -1, 0, sc_bn); n = vq->n;
    retrive_bqual(vt, NULL, id, -1, -1, 1, sc_bn);
    assert(vq->n == vt->n);
    for (k = 0; k < vq->n && vq->a[k] == vt->a[vt->n - k - 1]; k++);
    // if((k == vq->n)) {
    //     fprintf(stderr, "[M::%s] id::%lu, k::%lu, n::%lu\n", __func__, id, k, ((uint64_t)vq->n));
    // }
    assert(k == vq->n);

    // if(id == 0) {
    //     s = 21519; e = 22332; rev = 0;
    //     retrive_bqual(vt, NULL, id, s, e, rev, sc_bn);
    //     if(memcmp(vq->a + s, vt->a, e - s)) {
    //         fprintf(stderr, "+[M::%s] id::%lu, t::[%lu, %lu), rev::%lu\n", __func__, id, s, e, rev);
    //         exit(1);
    //     }

    // }
    // return;

    for (k = 0, rev = 0; k < rn; k++) {
        z[0] = rand()%(n + 1); 
        z[1] = rand()%(n + 1); 
        if(z[0] == z[1]) continue;
        s = MIN(z[0], z[1]); e = MAX(z[0], z[1]);
        retrive_bqual(vt, NULL, id, s, e, rev, sc_bn);
        if(memcmp(vq->a + s, vt->a, e - s)) {
            fprintf(stderr, "[M::%s] id::%lu, t::[%lu, %lu), rev::%lu\n", __func__, id, s, e, rev);
            exit(1);
        }
    }
    

    retrive_bqual(vq, NULL, id, -1, -1, 1, sc_bn);
    for (k = 0, rev = 1; k < rn; k++) {
        z[0] = rand()%(n + 1); 
        z[1] = rand()%(n + 1); 
        if(z[0] == z[1]) continue;
        s = MIN(z[0], z[1]); e = MAX(z[0], z[1]);
        retrive_bqual(vt, NULL, id, s, e, rev, sc_bn);
        if(memcmp(vq->a + s, vt->a, e - s)) {
            fprintf(stderr, "[M::%s] id::%lu, t::[%lu, %lu), rev::%lu\n", __func__, id, s, e, rev);
            exit(1);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
pushq $0x2
popq %r14
movq %r14, (%rsp)
pushq $-0x1
popq %rbx
xorl %esi, %esi
movq %rbx, %rcx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0x7638
movq (%rbp), %rax
movq %rax, 0x10(%rsp)
movq %r14, (%rsp)
pushq $0x1
popq %r9
movq %r13, %rdi
xorl %esi, %esi
movq %r12, 0x8(%rsp)
movq %r12, %rdx
movq %rbx, %rcx
movq %rbx, %r8
callq 0x7638
movq %rbp, 0x18(%rsp)
movq (%rbp), %rax
cmpq (%r13), %rax
jne 0x144886
xorl %ecx, %ecx
movq %rax, %rdx
movq 0x10(%rsp), %r12
subq $0x1, %rdx
jb 0x1446b8
movq 0x18(%rsp), %rsi
movq 0x10(%rsi), %rsi
movb (%rsi,%rcx), %sil
movq 0x10(%r13), %rdi
cmpb -0x1(%rdi,%rax), %sil
jne 0x1446af
incq %rcx
movq %rdx, %rax
jmp 0x144689
testq %rax, %rax
jne 0x1448a5
movq %r13, 0x20(%rsp)
incq %r12
movq %r15, %r14
movq %r12, 0x10(%rsp)
subq $0x1, %r14
jb 0x144787
callq 0x2060
cltq
xorl %edx, %edx
divq %r12
movq %rdx, %rbx
callq 0x2060
cltq
xorl %edx, %edx
divq %r12
movq %rbx, %rax
subq %rdx, %rax
je 0x1446c8
movq %rdx, %r13
negq %rax
movq %rbx, %r12
subq %rdx, %r12
movq %rdx, %rbp
cmovbq %rbx, %rbp
cmovaq %rbx, %r13
cmovbeq %rax, %r12
movq $0x2, (%rsp)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x7638
movq 0x10(%rbx), %rsi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
addq %rbp, %rdi
movq %r12, %rdx
movq 0x10(%rsp), %r12
callq 0x21a0
testl %eax, %eax
je 0x1446c8
movq 0x10e87f(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
andq $0x0, (%rsp)
leaq 0xabfdf(%rip), %rsi     # 0x1f074f
leaq 0xac002(%rip), %rdx     # 0x1f0779
movq 0x8(%rsp), %rcx
movq %rbp, %r8
movq %r13, %r9
jmp 0x144868
movq $0x2, (%rsp)
pushq $-0x1
popq %rcx
pushq $0x1
popq %r9
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
movq %rcx, %r8
callq 0x7638
movq 0x20(%rsp), %r14
subq $0x1, %r15
jb 0x144877
callq 0x2060
cltq
xorl %edx, %edx
divq %r12
movq %rdx, %rbx
callq 0x2060
cltq
xorl %edx, %edx
divq %r12
movq %rbx, %rax
subq %rdx, %rax
je 0x1447af
movq %rdx, %rbp
negq %rax
movq %rbx, %r12
subq %rdx, %r12
movq %rdx, %r13
cmovbq %rbx, %r13
cmovaq %rbx, %rbp
cmovbeq %rax, %r12
movq $0x2, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
movq %rbp, %r8
pushq $0x1
popq %r9
callq 0x7638
movq 0x10(%r14), %rsi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
addq %r13, %rdi
movq %r12, %rdx
movq 0x10(%rsp), %r12
callq 0x21a0
testl %eax, %eax
je 0x1447af
movq 0x10e79c(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq $0x1, (%rsp)
leaq 0xabef9(%rip), %rsi     # 0x1f074f
leaq 0xabf1c(%rip), %rdx     # 0x1f0779
movq 0x8(%rsp), %rcx
movq %r13, %r8
movq %rbp, %r9
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %rdi
callq 0x2250
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xabe67(%rip), %rdi     # 0x1f06f4
leaq 0xab667(%rip), %rsi     # 0x1efefb
leaq 0xabe68(%rip), %rcx     # 0x1f0703
movl $0xbdd, %edx            # imm = 0xBDD
callq 0x2110
leaq 0xabe98(%rip), %rdi     # 0x1f0744
leaq 0xab648(%rip), %rsi     # 0x1efefb
leaq 0xabe49(%rip), %rcx     # 0x1f0703
movl $0xbe2, %edx            # imm = 0xBE2
callq 0x2110