// File: /workspace/github_cpp_makefile_star2_O1/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, %ebx
movl %esi, %ebp
movq %rdi, %r15
movq (%rdi), %r14
movq 0x8(%rdi), %rsi
movq 0x20(%rdi), %r12
movq 0x10(%rdi), %rdi
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0xe2f48
testq %rax, %rax
je 0xe418b
movq 0x18(%r14), %rax
xorl (%rax), %ebx
cmpl $0x1, %ebx
je 0xe433b
leaq 0x147b74(%rip), %rdi    # 0x22bce7
leaq 0x145b27(%rip), %rsi    # 0x229ca1
leaq 0x147ba2(%rip), %rcx    # 0x22bd23
movl $0x631f, %edx           # imm = 0x631F
callq 0x2110
movq 0x8(%r15), %rdi
xorl %esi, %esi
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0xe2f48
testq %rax, %rax
je 0xe434a
movq 0x18(%r14), %rax
movl (%rax), %eax
xorl $0x1, %ebx
cmpl %ebx, %eax
jne 0xe4353
movq 0x38(%r14), %rdx
testq %rdx, %rdx
je 0xe41fd
movq 0x48(%r14), %rsi
xorl %edi, %edi
xorl %ecx, %ecx
movl (%rsi,%rdi,4), %r8d
cmpl %ebp, %r8d
je 0xe41f0
cmpl %eax, %r8d
je 0xe41f0
movq 0x8(%r15), %r9
movq 0x20(%r9), %r9
shrl %r8d
movl (%r9,%r8,8), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
addq %r8, %rcx
incq %rdi
movl %edi, %r8d
cmpq %r8, %rdx
ja 0xe41c9
jmp 0xe41ff
xorl %ecx, %ecx
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdi
movq 0x20(%rsi), %rdx
movl %ebp, %r8d
shrl %r8d
movl (%rdx,%r8,8), %r8d
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
andq %r9, %r8
addq %rcx, %r8
shrl %eax
movl (%rdx,%rax,8), %r12d
andq %r9, %r12
addq %r8, %r12
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0xe2f48
testq %rax, %rax
je 0xe426a
movq 0x18(%r14), %rax
cmpl %ebx, (%rax)
je 0xe433b
leaq 0x147a95(%rip), %rdi    # 0x22bce7
leaq 0x145a48(%rip), %rsi    # 0x229ca1
leaq 0x147ac3(%rip), %rcx    # 0x22bd23
movl $0x6331, %edx           # imm = 0x6331
callq 0x2110
movsd 0x14120e(%rip), %xmm1   # 0x225480
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdi
movl %ebp, %edx
movl %ebx, %ecx
movsd %xmm1, (%rsp)
movapd %xmm1, %xmm0
xorl %r8d, %r8d
movq %r14, %r9
callq 0xe3b74
movq %rax, %r13
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdi
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0xe2f48
testq %rax, %rax
jne 0xe4333
movsd (%rsp), %xmm1
addsd 0x1411c0(%rip), %xmm1   # 0x225480
testl %r13d, %r13d
je 0xe42d3
movsd 0x140fa3(%rip), %xmm0   # 0x225270
ucomisd %xmm1, %xmm0
ja 0xe4272
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdi
movsd 0x1458b5(%rip), %xmm0   # 0x229b98
movl %ebp, %edx
movl %ebx, %ecx
xorl %r8d, %r8d
movq %r14, %r9
callq 0xe3b74
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdi
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0xe2f48
testq %rax, %rax
je 0xe433b
movq 0x18(%r14), %rax
cmpl %ebx, (%rax)
je 0xe433b
leaq 0x1479cc(%rip), %rdi    # 0x22bce7
leaq 0x14597f(%rip), %rsi    # 0x229ca1
leaq 0x1479fa(%rip), %rcx    # 0x22bd23
movl $0x6341, %edx           # imm = 0x6341
callq 0x2110
movq 0x18(%r14), %rax
cmpl %ebx, (%rax)
jne 0xe4372
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x140257(%rip), %rdi    # 0x2245a8
jmp 0xe435a
leaq 0x14798d(%rip), %rdi    # 0x22bce7
leaq 0x145940(%rip), %rsi    # 0x229ca1
leaq 0x1479bb(%rip), %rcx    # 0x22bd23
movl $0x6328, %edx           # imm = 0x6328
callq 0x2110
leaq 0x14796e(%rip), %rdi    # 0x22bce7
leaq 0x145921(%rip), %rsi    # 0x229ca1
leaq 0x14799c(%rip), %rcx    # 0x22bd23
movl $0x6339, %edx           # imm = 0x6339
callq 0x2110