// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x18, %rsp
movq %rsi, %rbx
movq (%rdi), %r14
movslq %edx, %rax
imulq $0x5c0, %rax, %rbp      # imm = 0x5C0
leaq (%r14,%rbp), %r15
leaq 0x102033(%rip), %r13    # 0x296230
leaq (,%rsi,8), %rax
movq %rax, 0x10(%rsp)
leaq (%rax,%rax,2), %r12
movq 0x78(%r13), %rsi
addq %r12, %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x18a49d
addq 0x80(%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x18a49d
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x333e0
movq (%r14,%rbp), %r13
movq 0x8(%r14,%rbp), %r12
cmpq $0x2, %r12
jae 0x194259
xorl %r8d, %r8d
xorl %eax, %eax
jmp 0x1942cb
movq %r12, %rax
shrq %rax
movq %rax, %rcx
negq %rcx
leaq (%r12,%r13), %rdx
decq %rdx
xorl %esi, %esi
leaq 0x1013bb(%rip), %rdi    # 0x295630
leaq 0x1014b9(%rip), %r9     # 0x295735
movq %r13, %r10
xorl %r8d, %r8d
movzbl (%rdx,%rsi), %r11d
movzbl (%r10), %r14d
movzbl (%rdi,%r14), %r14d
movb (%r9,%r14), %bpl
movb %bpl, (%rdx,%rsi)
movzbl (%rdi,%r11), %r11d
movb (%r9,%r11), %r11b
movb %r11b, (%r10)
xorl %r14d, %r14d
cmpb $0x4e, %r11b
sete %r14b
xorl %r11d, %r11d
cmpb $0x4e, (%rdx,%rsi)
sete %r11b
addq %r11, %r8
addq %r14, %r8
decq %rsi
incq %r10
cmpq %rsi, %rcx
jne 0x194282
testb $0x1, %r12b
leaq 0x101f5a(%rip), %r14    # 0x296230
je 0x194303
movzbl (%r13,%rax), %ecx
leaq 0x10134b(%rip), %rdx    # 0x295630
movzbl (%rdx,%rcx), %ecx
leaq 0x101445(%rip), %rdx    # 0x295735
movb (%rdx,%rcx), %cl
movb %cl, (%r13,%rax)
xorl %eax, %eax
cmpb $0x4e, %cl
sete %al
addq %rax, %r8
movq 0x10(%r14), %rax
movq (%rax,%rbx,8), %rdi
movq 0x10(%rsp), %rcx
addq (%r14), %rcx
movq %r13, %rsi
movq %r12, %rdx
callq 0x335d2
leaq 0x101433(%rip), %rax    # 0x295758
cmpq $0x0, 0x2b0(%rax)
je 0x1943a0
leaq 0x518(%r15), %rdi
movq $0x2, (%rsp)
xorl %esi, %esi
movq %rbx, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
callq 0x33933
testq %r12, %r12
je 0x19437a
xorl %eax, %eax
movq %r12, %rcx
movq 0x528(%r15), %rdx
movb (%rdx,%rax), %dl
movb %dl, -0x1(%r13,%rcx)
incq %rax
decq %rcx
jne 0x194363
movq 0x30(%r14), %rax
movq (%rax,%rbx,8), %rdi
movl $0x2, %ecx
movq %r13, %rsi
movq %r12, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33797
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq