// File: /workspace/github_cpp_makefile_star2_O1/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), %rbx
leaq 0xfe7ef(%rip), %rax     # 0x28b230
leaq (%r14,%r14,2), %rdi
shlq $0x3, %rdi
movq 0x78(%rax), %r15
addq %rdi, %r15
leaq 0xfdd01(%rip), %rcx     # 0x28a758
movq 0x2b8(%rcx), %r13
movq 0xc8(%rsi,%rdx), %rdx
testq %rdx, %rdx
je 0x18cb29
cmpq $0x1, %rdx
jne 0x18cb9a
cmpl $0x0, 0xc(%r15)
je 0x18cb9a
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %edx, %edx
movq (%r15), %r8
leaq (%rdx,%rdx,4), %rsi
movl 0xc(%r8,%rsi,8), %edi
cmpl 0x4(%r8,%rsi,8), %edi
jb 0x18cb17
movq 0x78(%rax), %r8
leaq (%rdi,%rdi,2), %rdi
cmpl $0x0, 0xc(%r8,%rdi,8)
je 0x18cb17
leaq (%r8,%rdi,8), %rdi
movl $0x18, %r8d
xorl %r9d, %r9d
movq (%rdi), %r10
movq (%r15), %r14
movq (%r14,%rsi,8), %r11
shrq $0x20, %r11
cmpl %r11d, -0xc(%r10,%r8)
jne 0x18cb07
leaq (%r14,%rsi,8), %r14
movq (%r10,%r8), %rbp
xorq 0x18(%r14), %rbp
js 0x18cafb
movzbl (%r12,%r11), %r11d
cmpq %r11, %r13
jge 0x18cafb
movl 0xc(%r14), %r11d
movzbl (%r12,%r11), %r11d
cmpq %r11, %r13
jl 0x18cb07
orq %rcx, (%r10,%r8)
movq (%r15), %r10
orq %rcx, 0x18(%r10,%rsi,8)
incq %r9
movl 0xc(%rdi), %r10d
addq $0x28, %r8
cmpq %r10, %r9
jb 0x18cac0
incq %rdx
movl 0xc(%r15), %esi
cmpq %rsi, %rdx
jb 0x18ca90
jmp 0x18cb9a
movb $-0x1, (%r12,%r14)
addq 0x78(%rax), %rdi
leaq 0x4d0(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r14,8), %rdx
movq 0x2c0(%rcx), %rcx
movsd 0x954c8(%rip), %xmm0    # 0x222018
movl $0x1, %r8d
callq 0x1834ac
cmpq %r13, %rax
jg 0x18cb9a
movb %al, (%r12,%r14)
cmpl $0x0, 0xc(%r15)
je 0x18cb93
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 0x18cb7c
incq 0xc0(%rbx)
movl $0x80, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18db6a