// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Hash_Table.cpp
// Function: filter_bad_seed_dp(k_mer_hit*, k_mer_hit*, k_mer_hit*, long, long, double, long)
int64_t filter_bad_seed_dp(k_mer_hit *sk, k_mer_hit *ek, k_mer_hit* a, int64_t a_n, int64_t max_lgap, double small_bw_rate, int64_t min_small_bw)
{
    int64_t k = 0; k_mer_hit *z; double bw_r; int64_t bw, mmgap, occ = 0;
    bw_r = small_bw_rate; bw = min_small_bw; mmgap = max_lgap;
    if(sk) {
        for (k = 0; k < a_n; k++) {
            z = &(a[k]); 
            if(z->cnt < z->readID) continue;
            mmgap = max_lgap;
            if(z->cnt <= 1) mmgap = -1;
            if((sk && (!hit_long_gap(sk, z, mmgap, bw_r, bw))) || 
                                (ek && (!hit_long_gap(z, ek, mmgap, bw_r, bw)))) {
                z->offset = z->self_offset = (uint32_t)-1; occ++;
            } else {
                break;
            }
        }
    }

    if(ek && k < a_n) {
        for (k = a_n-1; k >= 0; k--) {
            z = &(a[k]); 
            if(z->cnt < z->readID) continue;
            mmgap = max_lgap;
            if(z->cnt <= 1) mmgap = -1;
            if((sk && (!hit_long_gap(sk, z, mmgap, bw_r, bw))) || 
                                (ek && (!hit_long_gap(z, ek, mmgap, bw_r, bw)))) {
                z->offset = z->self_offset = (uint32_t)-1; occ++;
            } else {
                break;
            }
        }
    }

    return occ;    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x10(%rsp)
testq %rdi, %rdi
sete %al
testq %rcx, %rcx
setle %r9b
orb %al, %r9b
jne 0x44054
movq %rdx, -0x8(%rsp)
leaq 0xc(%rdx), %r11
xorl %eax, %eax
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movl (%r11), %edx
movl -0xc(%r11), %ebp
andl %ebx, %ebp
cmpl %ebp, %edx
jb 0x4403f
cmpl $0x2, %edx
movq %r8, %r15
movq $-0x1, %rdx
cmovbq %rdx, %r15
movl -0x4(%r11), %ebp
movl %ebp, %r14d
subl 0x8(%rdi), %r14d
movl -0x8(%r11), %r12d
movl %r12d, %r13d
subl 0x4(%rdi), %r13d
movq %r14, %r9
subq %r13, %r9
movq %r13, %rdx
subq %r14, %rdx
cmpl %r13d, %r14d
cmovaeq %r9, %rdx
testq %r15, %r15
js 0x43fa3
cmpq %r15, %rdx
jle 0x43fcb
jmp 0x44034
cmpl %r13d, %r14d
cmovbl %r14d, %r13d
cmpq -0x10(%rsp), %rdx
jle 0x43fcb
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
ja 0x44034
testq %rsi, %rsi
je 0x4418c
movl 0x4(%rsi), %r13d
movl 0x8(%rsi), %r14d
subl %ebp, %r14d
subl %r12d, %r13d
movq %r14, %r9
subq %r13, %r9
movq %r13, %rdx
subq %r14, %rdx
cmpl %r13d, %r14d
cmovaeq %r9, %rdx
testq %r15, %r15
js 0x44004
cmpq %r15, %rdx
jg 0x44034
jmp 0x44197
cmpl %r13d, %r14d
cmovbl %r14d, %r13d
cmpq -0x10(%rsp), %rdx
jle 0x44197
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x44197
movq $-0x1, -0x8(%r11)
incq %rax
incq %r10
addq $0x10, %r11
cmpq %r10, %rcx
jne 0x43f49
jmp 0x4418c
xorl %r10d, %r10d
xorl %eax, %eax
testq %rcx, %rcx
setle %r11b
testq %rsi, %rsi
sete %r9b
cmpq %rcx, %r10
setge %r10b
orb %r11b, %r9b
orb %r10b, %r9b
jne 0x4418c
leaq 0x1(%rcx), %r10
shlq $0x4, %rcx
addq %rdx, %rcx
addq $-0x4, %rcx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq $-0x1, %r11
movl (%rcx), %r9d
movl -0xc(%rcx), %ebx
andl %edx, %ebx
cmpl %ebx, %r9d
jb 0x4417b
cmpl $0x2, %r9d
movq %r8, %rbx
cmovbq %r11, %rbx
movl -0x4(%rcx), %ebp
testq %rdi, %rdi
je 0x440ed
movl %ebp, %r12d
subl 0x8(%rdi), %r12d
movl -0x8(%rcx), %r14d
movl %r14d, %r15d
subl 0x4(%rdi), %r15d
movq %r12, %r13
subq %r15, %r13
movq %r15, %r9
subq %r12, %r9
cmpl %r15d, %r12d
cmovaeq %r13, %r9
testq %rbx, %rbx
js 0x44148
cmpq %rbx, %r9
jle 0x440f1
jmp 0x44170
movl -0x8(%rcx), %r14d
movl 0x4(%rsi), %r15d
subl %r14d, %r15d
movl 0x8(%rsi), %r14d
subl %ebp, %r14d
movq %r14, %r12
subq %r15, %r12
movq %r15, %r9
subq %r14, %r9
cmpl %r15d, %r14d
cmovaeq %r12, %r9
testq %rbx, %rbx
js 0x4411e
cmpq %rbx, %r9
jg 0x44170
jmp 0x4418c
cmpl %r15d, %r14d
cmovbl %r14d, %r15d
cmpq -0x10(%rsp), %r9
jle 0x4418c
xorps %xmm1, %xmm1
cvtsi2sd %r9, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r15, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
ja 0x44170
jmp 0x4418c
cmpl %r15d, %r12d
cmovbl %r12d, %r15d
cmpq -0x10(%rsp), %r9
jle 0x440f1
xorps %xmm1, %xmm1
cvtsi2sd %r9, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r15, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x440f1
movq $-0x1, -0x8(%rcx)
incq %rax
decq %r10
addq $-0x10, %rcx
cmpq $0x1, %r10
ja 0x44095
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x8(%rsp), %rdx
jmp 0x44059