// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CalculateCandidateBins(unsigned int const&, unsigned int const&, std::set<unsigned short, std::less<unsigned short>, std::allocator<unsigned short>>&)
void BamStandardIndex::CalculateCandidateBins(const uint32_t& begin,
                                              const uint32_t& end,
                                              set<uint16_t>& candidateBins)
{
    // initialize list, bin '0' is always a valid bin
    candidateBins.insert(0);

    // get rest of bins that contain this region
    unsigned int k;
    for (k =    1 + (begin>>26); k <=    1 + (end>>26); ++k) { candidateBins.insert(k); }
    for (k =    9 + (begin>>23); k <=    9 + (end>>23); ++k) { candidateBins.insert(k); }
    for (k =   73 + (begin>>20); k <=   73 + (end>>20); ++k) { candidateBins.insert(k); }
    for (k =  585 + (begin>>17); k <=  585 + (end>>17); ++k) { candidateBins.insert(k); }
    for (k = 4681 + (begin>>14); k <= 4681 + (end>>14); ++k) { candidateBins.insert(k); }
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq 0x98(%rsp), %rdi
movw $0x0, 0x96(%rsp)
leaq 0x96(%rsp), %rsi
callq 0x77230
movq %rax, 0x80(%rsp)
movb %dl, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movl (%rax), %eax
shrl $0x1a, %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movl (%rcx), %ecx
shrl $0x1a, %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
ja 0xb0e72
movq 0x98(%rsp), %rdi
movl 0x7c(%rsp), %eax
movw %ax, 0x7a(%rsp)
leaq 0x7a(%rsp), %rsi
callq 0x77230
movq %rax, 0x68(%rsp)
movb %dl, 0x70(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xb0e29
movq 0xa8(%rsp), %rax
movl (%rax), %eax
shrl $0x17, %eax
addl $0x9, %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movl (%rcx), %ecx
shrl $0x17, %ecx
addl $0x9, %ecx
cmpl %ecx, %eax
ja 0xb0ecf
movq 0x98(%rsp), %rdi
movl 0x7c(%rsp), %eax
movw %ax, 0x66(%rsp)
leaq 0x66(%rsp), %rsi
callq 0x77230
movq %rax, 0x50(%rsp)
movb %dl, 0x58(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xb0e86
movq 0xa8(%rsp), %rax
movl (%rax), %eax
shrl $0x14, %eax
addl $0x49, %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movl (%rcx), %ecx
shrl $0x14, %ecx
addl $0x49, %ecx
cmpl %ecx, %eax
ja 0xb0f2c
movq 0x98(%rsp), %rdi
movl 0x7c(%rsp), %eax
movw %ax, 0x4e(%rsp)
leaq 0x4e(%rsp), %rsi
callq 0x77230
movq %rax, 0x38(%rsp)
movb %dl, 0x40(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xb0ee3
movq 0xa8(%rsp), %rax
movl (%rax), %eax
shrl $0x11, %eax
addl $0x249, %eax            # imm = 0x249
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movl (%rcx), %ecx
shrl $0x11, %ecx
addl $0x249, %ecx            # imm = 0x249
cmpl %ecx, %eax
ja 0xb0f8e
movq 0x98(%rsp), %rdi
movl 0x7c(%rsp), %eax
movw %ax, 0x36(%rsp)
leaq 0x36(%rsp), %rsi
callq 0x77230
movq %rax, 0x20(%rsp)
movb %dl, 0x28(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xb0f42
movq 0xa8(%rsp), %rax
movl (%rax), %eax
shrl $0xe, %eax
addl $0x1249, %eax           # imm = 0x1249
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movq 0xa0(%rsp), %rcx
movl (%rcx), %ecx
shrl $0xe, %ecx
addl $0x1249, %ecx           # imm = 0x1249
cmpl %ecx, %eax
ja 0xb0ff0
movq 0x98(%rsp), %rdi
movl 0x7c(%rsp), %eax
movw %ax, 0x1e(%rsp)
leaq 0x1e(%rsp), %rsi
callq 0x77230
movq %rax, 0x8(%rsp)
movb %dl, 0x10(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xb0fa4
addq $0xb8, %rsp
retq
nopl (%rax,%rax)