// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: worker_hap_post_rev(void*, long, int)
static void worker_hap_post_rev(void *data, long i, int tid)
{
    ec_ovec_buf_t0 *b = &(((ec_ovec_buf_t*)data)->a[tid]);
    uint64_t k, l, kl, nn; char *a, c;
    // fprintf(stderr, "-0-[M::%s-beg] rid->%ld\n", __func__, i);
    // if (memcmp("m64012_190921_234837/139067658/ccs", Get_NAME((R_INF), i), Get_NAME_LENGTH((R_INF),i)) == 0) {
    //     fprintf(stderr, "-0-[M::%s-beg] rid->%ld\n", __func__, i);
    // } else if (memcmp("m64012_190921_234837/28968323/ccs", Get_NAME((R_INF), i), Get_NAME_LENGTH((R_INF),i)) == 0) {
    //     fprintf(stderr, "-1-[M::%s-beg] rid->%ld\n", __func__, i);
    // } else {
    //     return;
    // }
    // if(i != 2851) return;

    // if(scb.a[i].m < scc.a[i].n) {
    //     scb.a[i].m = scc.a[i].n;
    //     REALLOC(scb.a[i].a, scb.a[i].m);
    // }
    // scb.a[i].n = scc.a[i].n;
    // memcpy(scb.a[i].a, scc.a[i].a, scc.a[i].n*sizeof((*(scb.a[i].a))));

    flip_paf_rc(i, &(R_INF.paf[i]), &R_INF);
    flip_paf_rc(i, &(R_INF.reverse_paf[i]), &R_INF);

    recover_UC_Read(&b->self_read, &R_INF, i); 
    l = b->self_read.length; kl = l>>1; a = b->self_read.seq;
    for (k = nn = 0; k < kl; k++) {
        c = a[l-k-1]; a[l-k-1] = RC_CHAR(a[k]); a[k] = RC_CHAR(c);
        if(a[k] == 'N') nn++;
        if(a[l-k-1] == 'N') nn++;
    }
    if(l&1) {
        a[k] = RC_CHAR(a[k]); 
        if(a[k] == 'N') nn++;
    }

    ha_compress_base(Get_READ(R_INF, i), a, l, &R_INF.N_site[i], nn);

    if(asm_opt.is_sc) {
        retrive_bqual(&(b->v8q), NULL, i, -1, -1, 0, sc_bn);
        for (k = 0; k < l; k++) a[l - k - 1] = b->v8q.a[k];
        ha_compress_qual_bit(Get_QUAL(R_INF, i), a, l, sc_bn);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq (%rdi), %rbp
movslq %edx, %rax
imulq $0x5c0, %rax, %r14      # imm = 0x5C0
leaq (%r14,%rbp), %r15
leaq 0x106969(%rip), %r13    # 0x254230
imulq $0x18, %rsi, %r12
movq 0x78(%r13), %rsi
addq %r12, %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1458c7
addq 0x80(%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1458c7
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x715e
movq (%rbp,%r14), %r13
movq 0x8(%rbp,%r14), %r12
movq %r12, %rax
shrq %rax
leaq (%r12,%r13), %rsi
decq %rsi
xorl %r8d, %r8d
leaq 0x105d0f(%rip), %rdx    # 0x253630
leaq 0x105e0d(%rip), %rcx    # 0x253735
xorl %edi, %edi
cmpq %rdi, %rax
je 0x14d976
movzbl (%rsi), %r9d
movzbl (%r13,%rdi), %r10d
movzbl (%rdx,%r10), %r10d
movb (%rcx,%r10), %r10b
movb %r10b, (%rsi)
movzbl (%rdx,%r9), %r9d
movb (%rcx,%r9), %r9b
movb %r9b, (%r13,%rdi)
xorl %r10d, %r10d
cmpb $0x4e, %r9b
sete %r10b
xorl %r9d, %r9d
cmpb $0x4e, (%rsi)
sete %r9b
addq %r9, %r8
addq %r10, %r8
incq %rdi
decq %rsi
jmp 0x14d92a
testb $0x1, %r12b
je 0x14d999
movzbl (%r13,%rax), %esi
movzbl (%rdx,%rsi), %edx
movb (%rcx,%rdx), %cl
movb %cl, (%r13,%rax)
xorl %eax, %eax
cmpb $0x4e, %cl
sete %al
addq %rax, %r8
leaq 0x106890(%rip), %r14    # 0x254230
movq 0x10(%r14), %rax
leaq (,%rbx,8), %rcx
movq (%rax,%rbx,8), %rdi
addq (%r14), %rcx
movq %r13, %rsi
movq %r12, %rdx
callq 0x733a
leaq 0x105d93(%rip), %rax    # 0x253758
cmpq $0x0, 0x2b0(%rax)
je 0x14da36
leaq 0x518(%r15), %rdi
movq $0x2, (%rsp)
xorl %ebp, %ebp
pushq $-0x1
popq %rcx
xorl %esi, %esi
movq %rbx, %rdx
movq %rcx, %r8
xorl %r9d, %r9d
callq 0x7638
leaq -0x1(%r13), %rax
cmpq %rbp, %r12
je 0x14da12
movq 0x528(%r15), %rcx
movb (%rcx,%rbp), %cl
movb %cl, (%rax,%r12)
incq %rbp
decq %rax
jmp 0x14d9f7
movq 0x30(%r14), %rax
movq (%rax,%rbx,8), %rdi
pushq $0x2
popq %rcx
movq %r13, %rsi
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x74d3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq