// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
movl $0x2, %ebx
movq %rbx, (%rsp)
xorl %esi, %esi
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
callq 0x33933
movq (%r15), %rbp
movq %rbx, (%rsp)
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
movl $0x1, %r9d
callq 0x33933
movq %r15, 0x8(%rsp)
movq (%r15), %rax
movq %r13, 0x18(%rsp)
cmpq (%r13), %rax
jne 0x1890e3
testq %rax, %rax
je 0x188ecb
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rdx
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq %rax, %rsi
negq %rsi
leaq (%rax,%rcx), %rdi
decq %rdi
xorl %ecx, %ecx
movb (%rdx), %r8b
cmpb (%rdi,%rcx), %r8b
jne 0x188ecf
decq %rcx
incq %rdx
cmpq %rcx, %rsi
jne 0x188eb5
jmp 0x188edb
xorl %ecx, %ecx
jmp 0x188ed2
negq %rcx
cmpq %rax, %rcx
jne 0x189102
testq %r12, %r12
je 0x189048
movq %r14, 0x10(%rsp)
movq %rbp, %r14
incq %r14
movq %r12, %r15
movq %r14, 0x20(%rsp)
callq 0x2060
cltq
xorl %edx, %edx
divq %r14
movq %rdx, %rbx
callq 0x2060
cltq
xorl %edx, %edx
divq %r14
movq %rbx, %rax
subq %rdx, %rax
je 0x188f7f
movq %rdx, %r13
negq %rax
movq %rbx, %r14
subq %rdx, %r14
movq %rdx, %rbp
cmovbq %rbx, %rbp
cmovaq %rbx, %r13
cmovbeq %rax, %r14
movq $0x2, (%rsp)
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x33933
movq 0x10(%rbx), %rsi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
addq %rbp, %rdi
movq %r14, %rdx
movq 0x20(%rsp), %r14
callq 0x21a0
testl %eax, %eax
jne 0x189082
decq %r15
jne 0x188ef7
movq $0x2, (%rsp)
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %r15
movq %r15, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
movl $0x1, %r9d
callq 0x33933
callq 0x2060
cltq
xorl %edx, %edx
divq %r14
movq %rdx, %rbx
callq 0x2060
cltq
xorl %edx, %edx
divq %r14
movq %rbx, %rax
subq %rdx, %rax
je 0x18903d
movq %rdx, %r13
negq %rax
movq %rbx, %r14
subq %rdx, %r14
movq %rdx, %rbp
cmovbq %rbx, %rbp
cmovaq %rbx, %r13
cmovbeq %rax, %r14
movq $0x2, (%rsp)
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbp, %rcx
movq %r13, %r8
movl $0x1, %r9d
callq 0x33933
movq 0x10(%rbx), %rsi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
addq %rbp, %rdi
movq %r14, %rdx
movq 0x20(%rsp), %r14
callq 0x21a0
testl %eax, %eax
jne 0x1890a9
decq %r12
jne 0x188fb8
jmp 0x189073
movq $0x2, (%rsp)
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
movl $0x1, %r9d
callq 0x33933
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10bf57(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq $0x0, (%rsp)
leaq 0xb57f4(%rip), %rsi     # 0x23e88f
leaq 0xb5817(%rip), %rdx     # 0x23e8b9
movq 0x10(%rsp), %rcx
jmp 0x1890cc
movq 0x10bf30(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq $0x1, (%rsp)
leaq 0xb57cd(%rip), %rsi     # 0x23e88f
leaq 0xb57f0(%rip), %rdx     # 0x23e8b9
movq %r15, %rcx
movq %rbp, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
callq 0x2250
leaq 0xb574a(%rip), %rdi     # 0x23e834
leaq 0xb4f4a(%rip), %rsi     # 0x23e03b
leaq 0xb574b(%rip), %rcx     # 0x23e843
movl $0xbdd, %edx            # imm = 0xBDD
callq 0x2110
leaq 0xb577b(%rip), %rdi     # 0x23e884
leaq 0xb4f2b(%rip), %rsi     # 0x23e03b
leaq 0xb572c(%rip), %rcx     # 0x23e843
movl $0xbe2, %edx            # imm = 0xBE2
callq 0x2110