// File: /workspace/github_cpp_makefile_star2_O1/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 0xff8b6(%rip), %r13     # 0x28b230
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 0x182e86
addq 0x80(%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x182e86
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x33cf8
movq (%r14,%rbp), %r13
movq 0x8(%r14,%rbp), %r12
cmpq $0x2, %r12
jae 0x18b9d6
xorl %r8d, %r8d
xorl %eax, %eax
jmp 0x18ba48
movq %r12, %rcx
shrq %rcx
negq %rcx
leaq (%r12,%r13), %rdx
decq %rdx
xorl %eax, %eax
leaq 0xfec41(%rip), %rsi     # 0x28a630
leaq 0xfed3f(%rip), %rdi     # 0x28a735
movq %r13, %r9
xorl %r8d, %r8d
movzbl (%rdx,%rax), %r10d
movzbl (%r9), %r11d
movzbl (%rsi,%r11), %r11d
movb (%rdi,%r11), %r11b
movb %r11b, (%rdx,%rax)
movzbl (%rsi,%r10), %r10d
movb (%rdi,%r10), %r10b
movb %r10b, (%r9)
xorl %r11d, %r11d
cmpb $0x4e, %r10b
sete %r11b
xorl %r10d, %r10d
cmpb $0x4e, (%rdx,%rax)
sete %r10b
addq %r10, %r8
addq %r11, %r8
decq %rax
incq %r9
cmpq %rax, %rcx
jne 0x18b9fc
negq %rax
leaq 0xff7e1(%rip), %r14     # 0x28b230
testb $0x1, %r12b
je 0x18ba80
movzbl (%r13,%rax), %ecx
leaq 0xfebce(%rip), %rdx     # 0x28a630
movzbl (%rdx,%rcx), %ecx
leaq 0xfecc8(%rip), %rdx     # 0x28a735
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 0x33ef7
leaq 0xfecb6(%rip), %rax     # 0x28a758
cmpq $0x0, 0x2b0(%rax)
je 0x18bb1d
leaq 0x518(%r15), %rdi
movq $0x2, (%rsp)
xorl %esi, %esi
movq %rbx, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
callq 0x342bc
testq %r12, %r12
je 0x18baf7
xorl %eax, %eax
movq %r12, %rcx
movq 0x528(%r15), %rdx
movb (%rdx,%rax), %dl
movb %dl, -0x1(%r13,%rcx)
incq %rax
decq %rcx
jne 0x18bae0
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 0x340f3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq