// File: /workspace/github_cpp_makefile_star2_O1/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 0x4498d
movq %rdx, -0x8(%rsp)
leaq 0xc(%rdx), %r11
xorl %eax, %eax
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movl (%r11), %edx
movl -0xc(%r11), %ebp
andl %r9d, %ebp
cmpl %ebp, %edx
jb 0x44973
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, %rbx
subq %r13, %rbx
movq %r13, %rdx
subq %r14, %rdx
cmpl %r13d, %r14d
cmovaeq %rbx, %rdx
testq %r15, %r15
js 0x448d5
cmpq %r15, %rdx
setle %dl
jmp 0x44901
cmpl %r13d, %r14d
cmovbl %r14d, %r13d
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
setbe %bl
cmpq -0x10(%rsp), %rdx
setle %dl
orb %bl, %dl
testb %dl, %dl
je 0x44968
testq %rsi, %rsi
je 0x44986
movl 0x4(%rsi), %r13d
movl 0x8(%rsi), %r14d
subl %ebp, %r14d
subl %r12d, %r13d
movq %r14, %rdx
subq %r13, %rdx
movq %r13, %r12
subq %r14, %r12
cmpl %r13d, %r14d
cmovaeq %rdx, %r12
testq %r15, %r15
js 0x44938
cmpq %r15, %r12
setle %dl
jmp 0x44964
cmpl %r13d, %r14d
cmovbl %r14d, %r13d
xorps %xmm1, %xmm1
cvtsi2sd %r12, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
setbe %bl
cmpq -0x10(%rsp), %r12
setle %dl
orb %bl, %dl
testb %dl, %dl
jne 0x44986
movq $-0x1, -0x8(%r11)
incq %rax
incq %r10
addq $0x10, %r11
cmpq %r10, %rcx
jne 0x4487c
movq %rcx, %r10
movq -0x8(%rsp), %rdx
jmp 0x44992
xorl %r10d, %r10d
xorl %eax, %eax
testq %rsi, %rsi
sete %r11b
cmpq %rcx, %r10
setge %r9b
testq %rcx, %rcx
setle %r10b
orb %r11b, %r10b
orb %r9b, %r10b
jne 0x44ad2
leaq 0x1(%rcx), %r10
shlq $0x4, %rcx
addq %rdx, %rcx
addq $-0x4, %rcx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq $-0x1, %r11
movl (%rcx), %ebx
movl -0xc(%rcx), %r9d
andl %edx, %r9d
cmpl %r9d, %ebx
jb 0x44ac1
cmpl $0x2, %ebx
movq %r8, %rbx
cmovbq %r11, %rbx
testq %rdi, %rdi
je 0x44a54
movl -0x8(%rcx), %r14d
movl -0x4(%rcx), %r12d
subl 0x8(%rdi), %r12d
subl 0x4(%rdi), %r14d
movq %r12, %r9
subq %r14, %r9
movq %r14, %r15
subq %r12, %r15
cmpl %r14d, %r12d
cmovaeq %r9, %r15
testq %rbx, %rbx
js 0x44a20
cmpq %rbx, %r15
setle %bpl
jmp 0x44a4f
cmpl %r14d, %r12d
cmovbl %r12d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r14, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
setbe %r9b
cmpq -0x10(%rsp), %r15
setle %bpl
orb %r9b, %bpl
testb %bpl, %bpl
je 0x44ab6
movl 0x4(%rsi), %r14d
movl 0x8(%rsi), %r12d
subl -0x4(%rcx), %r12d
subl -0x8(%rcx), %r14d
movq %r12, %r9
subq %r14, %r9
movq %r14, %r15
subq %r12, %r15
cmpl %r14d, %r12d
cmovaeq %r9, %r15
testq %rbx, %rbx
js 0x44a84
cmpq %rbx, %r15
setle %bl
jmp 0x44ab2
cmpl %r14d, %r12d
cmovbl %r12d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %r14, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
setbe %r9b
cmpq -0x10(%rsp), %r15
setle %bl
orb %r9b, %bl
testb %bl, %bl
jne 0x44ad2
movq $-0x1, -0x8(%rcx)
incq %rax
decq %r10
addq $-0x10, %rcx
cmpq $0x1, %r10
jg 0x449ce
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq