// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/./process_vcf_annotation_tools.h
// Function: BedCoordinateFeatures::getFeaturesinRegion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int)
std::vector<std::vector <string> > getFeaturesinRegion(const string& scaffold, const int start, const int end) {
        std::vector<std::vector <string> > allFeatures;
        try {
            std::vector<std::vector<int> > featuresThisSc = BedFeatureMap.at(scaffold);
            //std::cerr << "There are " << aGThisSc[0].size() << " accessible intervals" << std::endl;
            /*for (std::map<std::string, std::vector<std::vector<int> > >::iterator i = accessibleGenomeMap.begin(); i != accessibleGenomeMap.end(); i++) {
             std::cerr << "There is scaffold: " << i->first << " in the map" << std::endl;
             } */
            
            
            // Binary search to find the first feature whose end coordinate is greater
            // or equal to the start of the region in question
            std::vector<int>::iterator itStart = lower_bound(featuresThisSc[1].begin(),featuresThisSc[1].end(),start);
            std::vector<int>::size_type index = std::distance(featuresThisSc[1].begin(), itStart);
            // Now check that the start coordinate of the feature is within
            
            // Sum the lengths
            while (featuresThisSc[0][index] <= end) {
                std::vector <string> feature;
                feature.push_back(scaffold); feature.push_back(numToString(featuresThisSc[0][index]));
                feature.push_back(numToString(featuresThisSc[1][index]));
                index++;
            }
            return allFeatures;
        } catch (const std::out_of_range& oor) {
            std::cerr << "No features on scaffold: " << scaffold << std::endl;
            return allFeatures;
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, (%rsp)
movq $0x0, 0x10(%rdi)
leaq 0x8(%rsi), %rdi
movq %rdx, %rsi
callq 0x4ba38
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4ba8c
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movq %rax, %r13
testq %rcx, %rcx
jle 0x4a227
movq %rax, %r13
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rsi
notq %rsi
addq %rcx, %rsi
leaq 0x4(,%rdx,4), %rcx
addq %r13, %rcx
cmpl %r15d, -0x4(%rcx)
cmovlq %rcx, %r13
cmovgeq %rdx, %rsi
movq %rsi, %rcx
testq %rsi, %rsi
jg 0x4a1f9
subq %rax, %r13
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpl %ebp, (%rax,%r13)
jg 0x4a2f6
leaq 0x30(%rsp), %rbx
leaq 0x40(%rsp), %r15
leaq 0x20(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x33db0
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r13), %esi
movq %r12, %rdi
callq 0x31297
movq %r15, %rdi
movq %r12, %rsi
callq 0x416a6
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4a29d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl (%rax,%r13), %esi
movq %r12, %rdi
callq 0x31297
movq %r15, %rdi
movq %r12, %rsi
callq 0x416a6
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4a2d4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r15, %rdi
callq 0x3123c
movq 0x8(%rsp), %rax
movq (%rax), %rax
leaq 0x4(%r13), %rcx
cmpl %ebp, 0x4(%rax,%r13)
movq %rcx, %r13
jle 0x4a24b
leaq 0x8(%rsp), %rdi
callq 0x4b0a4
movq (%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r12
movq %rax, %r15
jmp 0x4a35a
jmp 0x4a321
jmp 0x4a321
jmp 0x4a329
movq %rdx, %r12
movq %rax, %r15
jmp 0x4a346
movq %rdx, %r12
movq %rax, %r15
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4a346
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x40(%rsp), %rdi
callq 0x3123c
leaq 0x8(%rsp), %rdi
callq 0x4b0a4
cmpl $0x1, %r12d
jne 0x4a3b2
movq %r15, %rdi
callq 0x81c0
movq 0xc0c79(%rip), %rdi     # 0x10afe8
leaq 0x8bd12(%rip), %rsi     # 0xd6088
movl $0x19, %edx
callq 0x84e0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0xc0c5a(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rdi
callq 0x8200
callq 0x8760
jmp 0x4a300
movq %rax, %r15
jmp 0x4a3b2
movq %rax, %r15
callq 0x8760
movq (%rsp), %rdi
callq 0x31aa2
movq %r15, %rdi
callq 0x8840
movq %rax, %rdi
callq 0x287e1