// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: rd_hamming_symm_simple(rd_hamming_t*, unsigned int, unsigned int)
void rd_hamming_symm_simple(rd_hamming_t *s, uint32_t st, uint32_t ed) // callback for kt_for()
{
    buf_t *b = &(s->a[0]); double step = 0.2, cuttoff; uint64_t max_dist = s->max_dist;
    // uint32_t st = s->rr->a[i]>>32, ed = (uint32_t)(s->rr->a[i]);
    uint32_t p, k, ncut;
    p = rd_hm_bub(s->g, s->ref, st, max_dist, b);
    if(p) {
        assert(b->S.a[0] == (ed^1));
        return;
    }
    ///recalculate max_dist
    p = rd_hm_bub(s->ref, NULL, st, max_dist, b);
    // if(!p) {
    //     fprintf(stderr, "[M::%s] st>>1::%u(st&1::%u), ed>>1::%u(ed&1::%u), max_dist::%lu\n", 
    //     __func__, st>>1, st&1, ed>>1, ed&1, max_dist);
    // }
    assert(p); assert(b->S.a[0] == (ed^1));
    for (k = max_dist = 0; k < b->b.n; ++k) {
        if(b->b.a[k]==st || b->b.a[k]==b->S.a[0]) continue;
        max_dist += s->ref->seq[b->b.a[k]>>1].len;
    }
    max_dist += s->ref->seq[st>>1].len;
    max_dist += s->ref->seq[b->S.a[0]>>1].len;
    p = rd_hm_bub(s->g, s->ref, st, max_dist, b);
    if(p) {
        assert(b->S.a[0] == (ed^1));
        return;
    }

    for (cuttoff = step; cuttoff < 1.0; cuttoff += step) {
        ncut = rd_hm_drop(s->g, s->ref, st, ed^1, cuttoff, 0, b);
        p = rd_hm_bub(s->g, s->ref, st, max_dist, b);
        if(p) {
            assert(b->S.a[0] == (ed^1));
            return;
        }
        if(!ncut) break;
    }
    rd_hm_drop(s->g, s->ref, st, ed^1, 1024, 0, b);   
    p = rd_hm_bub(s->g, s->ref, st, max_dist, b); 
    if(p) {
        assert(b->S.a[0] == (ed^1));
        return;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rbx
movq 0x8(%rdi), %rsi
movq 0x20(%rdi), %r15
movq 0x10(%rdi), %rdi
movl %ebp, %edx
movq %r15, %rcx
movq %rbx, %r8
callq 0xa6c6c
testq %rax, %rax
je 0xa7a6e
movq 0x18(%rbx), %rax
xorl (%rax), %r12d
cmpl $0x1, %r12d
je 0xa7c16
leaq 0x142381(%rip), %rdi    # 0x1e9dd7
leaq 0x140334(%rip), %rsi    # 0x1e7d91
leaq 0x1423af(%rip), %rcx    # 0x1e9e13
movl $0x631f, %edx           # imm = 0x631F
callq 0x2110
movq 0x8(%r14), %rdi
xorl %esi, %esi
movl %ebp, %edx
movq %r15, %rcx
movq %rbx, %r8
callq 0xa6c6c
testq %rax, %rax
je 0xa7c25
movq 0x18(%rbx), %rax
movl (%rax), %r15d
xorl %r15d, %r12d
cmpl $0x1, %r12d
jne 0xa7c2e
movq 0x38(%rbx), %rcx
xorl %eax, %eax
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rcx
jbe 0xa7ad7
movq 0x48(%rbx), %rsi
movl (%rsi,%rdx,4), %esi
cmpl %ebp, %esi
je 0xa7ad3
cmpl %r15d, %esi
je 0xa7ad3
movq 0x8(%r14), %rdi
movq 0x20(%rdi), %rdi
shrl %esi
movl (%rdi,%rsi,8), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq %rsi, %rax
incl %edx
jmp 0xa7aa6
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdi
movq 0x20(%rsi), %rcx
movl %ebp, %edx
shrl %edx
movl (%rcx,%rdx,8), %edx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
andq %r8, %rdx
addq %rdx, %rax
movl %r15d, %edx
shrl %edx
movl (%rcx,%rdx,8), %r12d
andq %r8, %r12
addq %rax, %r12
movl %ebp, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0xa6c6c
testq %rax, %rax
je 0xa7b43
movq 0x18(%rbx), %rax
cmpl %r15d, (%rax)
je 0xa7c16
leaq 0x1422ac(%rip), %rdi    # 0x1e9dd7
leaq 0x14025f(%rip), %rsi    # 0x1e7d91
leaq 0x1422da(%rip), %rcx    # 0x1e9e13
movl $0x6331, %edx           # imm = 0x6331
callq 0x2110
movsd 0x13b985(%rip), %xmm1   # 0x1e34d0
movsd 0x13b74d(%rip), %xmm0   # 0x1e32a0
ucomisd %xmm1, %xmm0
jbe 0xa7bab
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdi
movl %ebp, %edx
movl %r15d, %ecx
movsd %xmm1, (%rsp)
movapd %xmm1, %xmm0
xorl %r8d, %r8d
movq %rbx, %r9
callq 0xa74b1
movq %rax, %r13
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdi
movl %ebp, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0xa6c6c
testq %rax, %rax
jne 0xa7c0d
testl %r13d, %r13d
movsd (%rsp), %xmm1
je 0xa7bab
addsd 0x13b927(%rip), %xmm1   # 0x1e34d0
jmp 0xa7b4b
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdi
movsd 0x1400d5(%rip), %xmm0   # 0x1e7c90
movl %ebp, %edx
movl %r15d, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0xa74b1
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdi
movl %ebp, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0xa6c6c
testq %rax, %rax
je 0xa7c16
movq 0x18(%rbx), %rax
cmpl %r15d, (%rax)
je 0xa7c16
leaq 0x1421e2(%rip), %rdi    # 0x1e9dd7
leaq 0x140195(%rip), %rsi    # 0x1e7d91
leaq 0x142210(%rip), %rcx    # 0x1e9e13
movl $0x6341, %edx           # imm = 0x6341
callq 0x2110
movq 0x18(%rbx), %rax
cmpl %r15d, (%rax)
jne 0xa7c4d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13a98c(%rip), %rdi    # 0x1e25b8
jmp 0xa7c35
leaq 0x1421a2(%rip), %rdi    # 0x1e9dd7
leaq 0x140155(%rip), %rsi    # 0x1e7d91
leaq 0x1421d0(%rip), %rcx    # 0x1e9e13
movl $0x6328, %edx           # imm = 0x6328
callq 0x2110
leaq 0x142183(%rip), %rdi    # 0x1e9dd7
leaq 0x140136(%rip), %rsi    # 0x1e7d91
leaq 0x1421b1(%rip), %rcx    # 0x1e9e13
movl $0x6339, %edx           # imm = 0x6339
callq 0x2110