// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: trans_sec_cut_filter_mmhap(kv_u_trans_t*, ma_ug_t*, asg_t*, ma_hit_t_alloc*)
void trans_sec_cut_filter_mmhap(kv_u_trans_t *ta, ma_ug_t *ug, asg_t *sg, ma_hit_t_alloc* src)
{
    uint64_t k, hom_cov, het_cov, hom_cut; 
    asg64_v b64; kv_init(b64);
    uint64_t *cc = gen_cov_rg(ug, sg, src);
    if(asm_opt.hom_global_coverage_set) {
        hom_cov = asm_opt.hom_global_coverage;
    } else {
        hom_cov = ((double)asm_opt.hom_global_coverage)/((double)HOM_PEAK_RATE);
    }
    het_cov = hom_cov/asm_opt.polyploidy;
    hom_cut = hom_cov + (het_cov*(0.5+(((double)asm_opt.polyploidy)*0.05)));

    fprintf(stderr, "+[M::%s]\thom_cov::%lu\thet_cov::%lu\thom_cut::%lu\n", __func__, 
        hom_cov, het_cov, hom_cut);

    for (k = 0; k < ug->g->n_seq; k++) {
        purge_ovlp_cov(k, ta, ug, sg, &b64, cc, hom_cut);
    }
    free(cc); kv_destroy(b64);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x107930
movq %rax, -0x60(%rbp)
leaq 0x2baedc(%rip), %rax    # 0x3c47f8
cmpl $0x0, 0x148(%rax)
je 0x109939
leaq 0x2baecc(%rip), %rax    # 0x3c47f8
movslq 0x144(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x10997e
leaq 0x2baeb8(%rip), %rax    # 0x3c47f8
cvtsi2sdl 0x144(%rax), %xmm0
movsd 0x27cef0(%rip), %xmm1   # 0x386840
divsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x27868d(%rip), %xmm1   # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x2bae6f(%rip), %rcx    # 0x3c47f8
movq %rcx, -0x68(%rbp)
movslq 0x1bc(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x38(%rbp)
movaps 0x278665(%rip), %xmm3   # 0x382010
movq -0x30(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x278664(%rip), %xmm2   # 0x382020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x38(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
cvtsi2sdl 0x1bc(%rax), %xmm2
movsd 0x27884d(%rip), %xmm3   # 0x382240
mulsd %xmm3, %xmm2
movsd 0x278871(%rip), %xmm3   # 0x382270
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x2785d6(%rip), %xmm1   # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x40(%rbp)
movq 0x2ba5a4(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r9
leaq 0x27dfd0(%rip), %rsi    # 0x387a22
leaq 0x27dffa(%rip), %rdx    # 0x387a53
movb $0x0, %al
callq 0x22a0
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x109ab9
movq -0x28(%rbp), %rax
movl %eax, %edi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x60(%rbp), %r9
movq -0x40(%rbp), %rax
leaq -0x58(%rbp), %r8
movq %rax, (%rsp)
callq 0x1094f0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x109a68
movq -0x60(%rbp), %rdi
callq 0x2210
movq -0x48(%rbp), %rdi
callq 0x2210
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)