// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
movl $0x2, %ebx
movq %rbx, (%rsp)
xorl %esi, %esi
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
callq 0x342bc
movq (%r13), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
movl $0x1, %r9d
callq 0x342bc
movq %r13, 0x18(%rsp)
movq (%r13), %rax
movq %r12, 0x20(%rsp)
movq (%r12), %rcx
cmpq %rcx, %rax
jne 0x181b58
testq %rax, %rax
je 0x18197a
movq 0x18(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x20(%rsp), %rsi
movq 0x10(%rsi), %rsi
addq %rcx, %rsi
decq %rsi
xorl %ecx, %ecx
movb (%rdx,%rcx), %dil
cmpb (%rsi), %dil
jne 0x18197c
incq %rcx
decq %rsi
cmpq %rcx, %rax
jne 0x181961
movq %rax, %rcx
jmp 0x18197c
xorl %ecx, %ecx
cmpq %rax, %rcx
jne 0x181b77
testq %r15, %r15
je 0x181a30
movq 0x28(%rsp), %rax
leaq 0x1(%rax), %r12
movq %r15, %r14
movq %r12, 0x30(%rsp)
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 0x181a27
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 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x342bc
movq 0x10(%rbx), %rsi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
addq %rbp, %rdi
movq %r12, %rdx
movq 0x30(%rsp), %r12
callq 0x21a0
testl %eax, %eax
jne 0x181b08
decq %r14
jne 0x18199f
movq $0x2, (%rsp)
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
movl $0x1, %r9d
callq 0x342bc
testq %r15, %r15
movq 0x28(%rsp), %r14
je 0x181af9
incq %r14
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 0x181af0
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 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
movl $0x1, %r9d
callq 0x342bc
movq 0x10(%rbx), %rsi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
addq %rbp, %rdi
movq %r12, %rdx
callq 0x21a0
testl %eax, %eax
jne 0x181b1c
decq %r15
jne 0x181a6e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1084d1(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
movq $0x0, (%rsp)
jmp 0x181b2e
movq 0x1084bd(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
movq $0x1, (%rsp)
leaq 0xb0b0a(%rip), %rsi     # 0x23263f
leaq 0xb0b2d(%rip), %rdx     # 0x232669
movq 0x10(%rsp), %rcx
movq %rbp, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
callq 0x2250
leaq 0xb0a85(%rip), %rdi     # 0x2325e4
leaq 0xb0285(%rip), %rsi     # 0x231deb
leaq 0xb0a86(%rip), %rcx     # 0x2325f3
movl $0xbdd, %edx            # imm = 0xBDD
callq 0x2110
leaq 0xb0ab6(%rip), %rdi     # 0x232634
leaq 0xb0266(%rip), %rsi     # 0x231deb
leaq 0xb0a67(%rip), %rcx     # 0x2325f3
movl $0xbe2, %edx            # imm = 0xBE2
callq 0x2110