// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/ecovlp.cpp
// Function: worker_hap_dc_ec_chemical_arc_mark(void*, long, int)
static void worker_hap_dc_ec_chemical_arc_mark(void *data, long i, int tid)
{
    ec_ovec_buf_t0 *b = &(((ec_ovec_buf_t*)data)->a[tid]);
    ma_hit_t_alloc *paf = &(R_INF.paf[i]), *rev; uint64_t k, z; int64_t cov, msk_cut = asm_opt.chemical_cov;
    uint8_t *msk = ((ec_ovec_buf_t*)data)->cr;

    if(b->cnt[1] == 0) {
        msk[i] = (uint8_t)-1;
        cov = cal_chemical_r_adv(&(R_INF.paf[i]), &b->v64, Get_READ_LENGTH((R_INF), i), asm_opt.chemical_flank, 0.02, 1);
        if(cov <= msk_cut) msk[i] = cov;
        if(cov <= msk_cut/**FORCE_CUT**/) {
            // fprintf(stderr, "-um-[M::%s]\tqn::%u::%.*s\n\n", __func__, (uint32_t)(i), (int)Get_NAME_LENGTH(R_INF, i), Get_NAME((R_INF), i));   
            for (k = 0; k < paf->length; k++) paf->buffer[k].del = 1; b->cnt[0]++;
        }
    } else if(b->cnt[1] == 1) {
        for (k = 0; k < paf->length; k++) {
            if((Get_qn(paf->buffer[k])) > (Get_tn(paf->buffer[k]))) continue;
            rev = &(R_INF.paf[paf->buffer[k].tn]);
            for (z = 0; z < rev->length; z++) {
                if((rev->buffer[z].tn == (Get_qn(paf->buffer[k])))) {
                    if((paf->buffer[k].del != rev->buffer[z].del) || (msk[Get_qn(paf->buffer[k])] <= msk_cut/**FORCE_CUT**/) || (msk[Get_tn(paf->buffer[k])] <= msk_cut/**FORCE_CUT**/)) {
                        paf->buffer[k].del = rev->buffer[z].del = 1;
                    }
                }
            }
        }
    }

   refresh_ec_ovec_buf_t0(b, REFRESH_N);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movslq %edx, %rax
imulq $0x5c0, %rax, %rdx      # imm = 0x5C0
movq (%rdi), %rsi
movq 0x10(%rdi), %r12
leaq (%rsi,%rdx), %rax
leaq 0x1009ea(%rip), %r11    # 0x296230
leaq (%r14,%r14,2), %rdi
shlq $0x3, %rdi
movq 0x78(%r11), %r15
addq %rdi, %r15
leaq 0xffefc(%rip), %rcx     # 0x295758
movq 0x2b8(%rcx), %r13
movq 0xc8(%rsi,%rdx), %rdx
testq %rdx, %rdx
movq %rax, (%rsp)
je 0x19594a
cmpq $0x1, %rdx
jne 0x1959bf
movl 0xc(%r15), %edi
testl %edi, %edi
je 0x1959bf
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %edx, %edx
movq (%r15), %r9
leaq (%rdx,%rdx,4), %rsi
movl 0xc(%r9,%rsi,8), %r8d
cmpl 0x4(%r9,%rsi,8), %r8d
jb 0x19593a
movq 0x78(%r11), %r9
leaq (%r8,%r8,2), %r10
movl 0xc(%r9,%r10,8), %r8d
testl %r8d, %r8d
je 0x19593a
leaq (%r9,%r10,8), %rdi
movl $0x18, %r9d
xorl %r10d, %r10d
movq (%rdi), %r11
movq (%r15), %rbx
movq (%rbx,%rsi,8), %rbp
shrq $0x20, %rbp
cmpl %ebp, -0xc(%r11,%r9)
jne 0x195920
leaq (%rbx,%rsi,8), %rbx
movq (%r11,%r9), %r14
movq 0x18(%rbx), %rax
xorq %r14, %rax
js 0x19590d
movzbl (%r12,%rbp), %eax
cmpq %rax, %r13
jge 0x19590d
movl 0xc(%rbx), %eax
movzbl (%r12,%rax), %eax
cmpq %rax, %r13
jl 0x195920
orq %rcx, %r14
movq %r14, (%r11,%r9)
movq (%r15), %rax
orq %rcx, 0x18(%rax,%rsi,8)
movl 0xc(%rdi), %r8d
incq %r10
movl %r8d, %eax
addq $0x28, %r9
cmpq %rax, %r10
jb 0x1958d0
movl 0xc(%r15), %edi
leaq 0x1008f6(%rip), %r11    # 0x296230
incq %rdx
movl %edi, %eax
cmpq %rax, %rdx
jb 0x19589a
jmp 0x1959bf
movb $-0x1, (%r12,%r14)
addq 0x78(%r11), %rdi
leaq 0x4d0(%rax), %rsi
movq 0x18(%r11), %rax
movq (%rax,%r14,8), %rdx
movq 0x2c0(%rcx), %rcx
movsd 0x986a7(%rip), %xmm0    # 0x22e018
movl $0x1, %r8d
callq 0x18aac7
cmpq %r13, %rax
jg 0x1959bf
movb %al, (%r12,%r14)
cmpl $0x0, 0xc(%r15)
je 0x1959b4
movl $0x18, %eax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %edx, %edx
movq (%r15), %rsi
orq %rcx, (%rsi,%rax)
incq %rdx
movl 0xc(%r15), %esi
addq $0x28, %rax
cmpq %rsi, %rdx
jb 0x19599d
movq (%rsp), %rax
incq 0xc0(%rax)
movl $0x80, %esi
movq (%rsp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19698b