// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_annotation_tools.h
// Function: SimpleCoordsBed::loadSimpleCoords(std::basic_ifstream<char, std::char_traits<char>>*&, std::map<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<int>, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
std::map<string, std::vector<std::vector<string> > > loadSimpleCoords(std::ifstream*& bedFile, std::map<int,string>& linearToGenomeCoordMap) {
        std::map<string, std::vector<std::vector<string> > > coordsScaffoldMap;
        std::vector<std::vector<string> > coordsInScaffold;
        int linearPosition = 0; // Linear positions will be 0-indexed (will start at zero)
        string line;
        // Do the first line to find the name of the first scaffold
        getline(*bedFile, line);
        std::vector<string> bedVector = split(line, '\t');
        string currentScaffold = bedVector[0];
        int left = atoi(bedVector[1].c_str());
        int right = atoi(bedVector[2].c_str());
        int intervalLength = right - left;
        coordsInScaffold.push_back(bedVector);
        
        for (int i = 0; i < intervalLength; i++) {
            // Mapping will be 1-indexed, as in VCF files
            linearToGenomeCoordMap[linearPosition+i] = currentScaffold+"\t"+numToString(left+i+1);
        } linearPosition = linearPosition + intervalLength;
        
        //
        while (getline(*bedFile, line)) {
            std::vector<string> bedVector = split(line, '\t');
            string scaffold = bedVector[0];
            int left = atoi(bedVector[1].c_str());
            int right = atoi(bedVector[2].c_str());
            int intervalLength = right - left;
            
            for (int i = 0; i < intervalLength; i++) {
                // Mapping will be 1-indexed, as in VCF files
                int pos = linearPosition+i;
                if (pos % 1000000 == 0)
                    std::cerr << "Loaded and mapped " << pos/1000000 << "Mb" << std::endl;
                linearToGenomeCoordMap[pos] = currentScaffold+"\t"+numToString(left+i+1);
            } linearPosition = linearPosition + intervalLength;
            
            if (scaffold == currentScaffold) {
                coordsInScaffold.push_back(bedVector);
            } else {
                coordsScaffoldMap[currentScaffold] = coordsInScaffold;
                coordsInScaffold.clear();
                currentScaffold = scaffold;
            }
        }
        return coordsScaffoldMap;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rcx, 0x18(%rsp)
leaq 0x8(%rdi), %rax
andl $0x0, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rdi, 0x8(%rsp)
andq $0x0, 0x28(%rdi)
andq $0x0, 0x30(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movb $0x0, (%rax)
movq %rdx, 0x40(%rsp)
movq (%rdx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x80a0
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x9
popq %rdx
callq 0x40349
movq 0xa0(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x8600
leaq 0xa0(%rsp), %r15
movq (%r15), %r14
movq 0x20(%r14), %rdi
callq 0x86f0
movl %eax, %ebx
movq 0x40(%r14), %rdi
callq 0x86f0
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x29502
subl %ebx, %ebp
incl %ebx
xorl %r14d, %r14d
testl %ebp, %ebp
movl $0x0, %r13d
movl %ebp, (%rsp)
cmovgl %ebp, %r13d
leaq 0x118(%rsp), %r12
leaq 0xf8(%rsp), %rbp
leaq 0xb8(%rsp), %r15
cmpl %r14d, %r13d
je 0x291da
movq %r12, %rdi
leaq 0x80(%rsp), %rsi
leaq 0x70ca5(%rip), %rdx     # 0x99e1e
callq 0x28806
leal (%rbx,%r14), %esi
movq %rbp, %rdi
callq 0x28ad3
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x28a48
movl %r14d, 0xd8(%rsp)
movq 0x18(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x2952e
movq %rax, %rdi
movq %r15, %rsi
callq 0x8550
movq %r15, %rdi
callq 0x8978
movq %rbp, %rdi
callq 0x8978
movq %r12, %rdi
callq 0x8978
incl %r14d
jmp 0x29162
leaq 0x60(%rsp), %r14
leaq 0x48(%rsp), %r15
leaq 0xb8(%rsp), %rbp
leaq 0xf8(%rsp), %r12
leaq 0xd8(%rsp), %r13
leaq 0x118(%rsp), %rbx
movq 0x40(%rsp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x80a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x293cd
movq %r15, %rdi
movq %r14, %rsi
pushq $0x9
popq %rdx
callq 0x40349
movq 0x48(%rsp), %rsi
movq %rbp, %rdi
callq 0x8600
movq 0x48(%rsp), %r14
movq 0x20(%r14), %rdi
callq 0x86f0
movl %eax, %ebp
movq 0x40(%r14), %rdi
callq 0x86f0
subl %ebp, %eax
incl %ebp
testl %eax, %eax
movl $0x0, %r14d
movl %eax, 0x14(%rsp)
cmovgl %eax, %r14d
movl (%rsp), %r15d
subl $0x1, %r14d
jb 0x2933b
movl %r15d, 0x4(%rsp)
movl %r15d, %eax
cltd
movl $0xf4240, %ecx          # imm = 0xF4240
idivl %ecx
testl %edx, %edx
jne 0x292d0
movq 0xb3d51(%rip), %rdi     # 0xdcfe8
leaq 0x6d0ab(%rip), %rsi     # 0x96349
callq 0x8480
movq %rax, %rdi
movl 0x4(%rsp), %eax
cltd
movl $0xf4240, %ecx          # imm = 0xF4240
idivl %ecx
movl %eax, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x6d099(%rip), %rsi     # 0x9635c
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq %r12, %rdi
leaq 0x80(%rsp), %rsi
leaq 0x70b3c(%rip), %rdx     # 0x99e1e
callq 0x28806
movq %r13, %rdi
movl %ebp, %esi
callq 0x28ad3
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x28a48
movq 0x18(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x28bfa
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8550
movq %rbx, %rdi
callq 0x8978
movq %r13, %rdi
callq 0x8978
movq %r12, %rdi
callq 0x8978
incl %ebp
incl %r15d
jmp 0x29272
leaq 0xb8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x80(%rsp), %r14
movq %r14, %rsi
callq 0x26b06
testb %al, %al
je 0x29373
leaq 0x20(%rsp), %rdi
leaq 0x48(%rsp), %r15
movq %r15, %rsi
callq 0x29502
leaq 0x60(%rsp), %r14
jmp 0x293b1
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2957c
leaq 0x60(%rsp), %r14
leaq 0x48(%rsp), %r15
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x295e2
leaq 0x20(%rsp), %rdi
callq 0x296c0
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
callq 0x82a0
movl 0x14(%rsp), %eax
addl %eax, (%rsp)
movq %rbp, %rdi
callq 0x8978
movq %r15, %rdi
callq 0x28a08
jmp 0x29204
leaq 0x80(%rsp), %rdi
callq 0x8978
leaq 0xa0(%rsp), %rdi
callq 0x28a08
leaq 0x60(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x29054
movq 0x8(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29468
movq %rax, %rbx
jmp 0x294ce
jmp 0x2941e
movq %rax, %rbx
jmp 0x294db
movq %rax, %rbx
jmp 0x294b7
jmp 0x29468
jmp 0x29468
movq %rax, %rbx
jmp 0x29459
movq %rax, %rbx
jmp 0x2944c
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x8978
leaq 0xf8(%rsp), %rdi
callq 0x8978
leaq 0x118(%rsp), %rdi
callq 0x8978
jmp 0x294c1
movq %rax, %rbx
jmp 0x294c1
jmp 0x294a7
jmp 0x294a7
movq %rax, %rbx
jmp 0x29498
movq %rax, %rbx
jmp 0x2948b
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x8978
leaq 0xd8(%rsp), %rdi
callq 0x8978
leaq 0xf8(%rsp), %rdi
callq 0x8978
jmp 0x294aa
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x8978
leaq 0x48(%rsp), %rdi
callq 0x28a08
leaq 0x80(%rsp), %rdi
callq 0x8978
leaq 0xa0(%rsp), %rdi
callq 0x28a08
leaq 0x60(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x29054
movq 0x8(%rsp), %rdi
callq 0x2a588
movq %rbx, %rdi
callq 0x8870
nop