// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rax, (%rsp)
leaq 0x10598a(%rip), %rax    # 0x254230
imulq $0x18, %r14, %rdi
movq 0x78(%rax), %r15
addq %rdi, %r15
leaq 0x104ea0(%rip), %rcx    # 0x253758
movq 0x2b8(%rcx), %r13
movq 0xc8(%rsi,%rdx), %rdx
testq %rdx, %rdx
je 0x14e978
cmpq $0x1, %rdx
jne 0x14e9e8
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %edx, %edx
movl 0xc(%r15), %edi
cmpq %rdi, %rdx
jae 0x14e9e8
movq (%r15), %r9
imulq $0x28, %rdx, %rdi
movl 0xc(%r9,%rdi), %r8d
cmpl 0x4(%r9,%rdi), %r8d
jae 0x14e90b
incq %rdx
jmp 0x14e8e6
imulq $0x18, %r8, %r8
addq 0x78(%rax), %r8
pushq $0x18
popq %r9
xorl %r10d, %r10d
movl 0xc(%r8), %r11d
cmpq %r11, %r10
jae 0x14e906
movq (%r8), %r11
movq (%r15), %r14
movq (%r14,%rdi), %rbx
shrq $0x20, %rbx
cmpl %ebx, -0xc(%r11,%r9)
jne 0x14e96f
addq %rdi, %r14
movq (%r11,%r9), %rbp
movq 0x18(%r14), %rsi
xorq %rbp, %rsi
js 0x14e960
movzbl (%r12,%rbx), %esi
cmpq %rsi, %r13
jge 0x14e960
movl 0xc(%r14), %esi
movzbl (%r12,%rsi), %esi
cmpq %rsi, %r13
jl 0x14e96f
orq %rcx, %rbp
movq %rbp, (%r11,%r9)
movq (%r15), %rsi
orq %rcx, 0x18(%rsi,%rdi)
incq %r10
addq $0x28, %r9
jmp 0x14e91a
movb $-0x1, (%r12,%r14)
addq 0x78(%rax), %rdi
movq (%rsp), %rdx
leaq 0x4d0(%rdx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r14,8), %rdx
movq 0x2c0(%rcx), %rcx
movsd 0x91675(%rip), %xmm0    # 0x1e0018
pushq $0x1
popq %r8
callq 0x145e4d
cmpq %r13, %rax
jg 0x14e9e8
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movb %al, (%r12,%r14)
pushq $0x18
popq %rax
xorl %edx, %edx
movl 0xc(%r15), %esi
cmpq %rsi, %rdx
jae 0x14e9dd
movq (%r15), %rsi
orq %rcx, (%rsi,%rax)
incq %rdx
addq $0x28, %rax
jmp 0x14e9c4
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 0x14f9cd