// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_use_map.cpp
// Function: processGenome(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>>> const&)
void processGenome(const std::map<string, std::vector<std::vector<string> > >& LGmap) {
    
    std::cerr << "Joining genomic scaffolds from: " << opt::inputFile << std::endl;
    std::cerr << "using linkage groups defined in: " << opt::LGfile << std::endl;
    
    string line;
    std::vector<string> currentScaffoldNum;
    string nextScaffoldNum;
    string currentScaffoldString;
    std::map<std::string, std::string> scaffoldStrings;
    std::ifstream* genomeFile = new std::ifstream(opt::inputFile.c_str());
    
    getline(*genomeFile, line);
    currentScaffoldNum = split(line, '_');
    int i = 0;
    while (currentScaffoldString != "") {
        i++;
        currentScaffoldString = readScaffold(genomeFile, nextScaffoldNum);
        if (i % 10 == 0)
            std::cerr << "scaffold " << i << " read" << std::endl;
        /*if (i == 118) {
            std::cerr << "scaffold " << i << " read; length: " << currentScaffoldString.length() << std::endl;
            std::cerr << "currentScaffoldNum[1]: " << currentScaffoldNum[1] << std::endl;
        } */
        scaffoldStrings[currentScaffoldNum[1]] = currentScaffoldString;
        currentScaffoldNum = split(nextScaffoldNum,'_');
    }
    scaffoldStrings[currentScaffoldNum[1]] = currentScaffoldString;
    std::cerr << "scaffold " << currentScaffoldNum[1] << " read" << std::endl;
    
    // std::cerr << "Hello?? " << std::endl;
    std::vector<string> scaffoldsInLinkageGroups;
    string LGString; LGString.reserve(100000000);
    for(std::map<string, std::vector<std::vector<string> > >::const_iterator it = LGmap.begin(); it != LGmap.end(); ++it) {
        LGString = "";
        std::cerr << "Building " << it->first << std::endl;
        for (std::vector<std::vector<string> >::size_type i = 0; i != it->second.size(); i++) {
            std::cerr << "Adding " << it->second[i][0] << " length: " << scaffoldStrings[it->second[i][0]].length() << "(" << it->second[i][2] << ")" << std::endl;
            if (it->second[i][1] == "+") {
                LGString.append(scaffoldStrings[it->second[i][0]]);
            } else if (it->second[i][1] == "-") {
                LGString.append(reverseComplementIUPAC(scaffoldStrings[it->second[i][0]]));
            }
            scaffoldsInLinkageGroups.push_back(it->second[i][0]);
        }
        std::cout << ">" << it->first << std::endl;
        print80bpPerLineStdOut(std::cout, LGString);
    }
    // Print remaining scaffolds (the ones that are not in linkage groups
    for(std::map<std::string, std::string>::iterator it = scaffoldStrings.begin(); it != scaffoldStrings.end(); ++it) {
        if (std::find(scaffoldsInLinkageGroups.begin(), scaffoldsInLinkageGroups.end(), it->first) ==  scaffoldsInLinkageGroups.end()) {
            std::cout << ">scaffold_" << it->first << std::endl;
            print80bpPerLineStdOut(std::cout, it->second);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x38(%rsp)
movq 0x8e7c7(%rip), %rbx     # 0x10afe8
leaq 0x61880(%rip), %rsi     # 0xde0a8
movl $0x20, %edx
movq %rbx, %rdi
callq 0x84e0
movq 0x8fe74(%rip), %rsi     # 0x10c6b0
movq 0x8fe75(%rip), %rdx     # 0x10c6b8
movq %rbx, %rdi
callq 0x84e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x6180a(%rip), %rsi     # 0xde086
movl $0x21, %edx
movq %rbx, %rdi
callq 0x84e0
movq 0x8fe40(%rip), %rsi     # 0x10c6d0
movq 0x8fe41(%rip), %rdx     # 0x10c6d8
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xf0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0xd0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xb0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x130(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0x8fd70(%rip), %rsi     # 0x10c6b0
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %r14, 0x100(%rsp)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
leaq 0xe0(%rsp), %rsi
movq %r14, %rdi
callq 0x8870
leaq 0x40(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
movl $0x5f, %edx
callq 0x50624
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps 0x20(%rsp), %xmm0
movq 0x30(%rsp), %rax
leaq 0x40(%rsp), %rbx
movups (%rbx), %xmm1
movaps %xmm1, 0x20(%rsp)
movq 0x10(%rbx), %rcx
movq %rcx, 0x30(%rsp)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movups %xmm1, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x3123c
movq %rbx, %rdi
callq 0x3123c
leaq 0x5529a(%rip), %rsi     # 0xd1c7f
leaq 0xa0(%rsp), %rdi
callq 0x8160
testl %eax, %eax
je 0x7cb74
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0x1, %ebx
movq %rsp, %r14
leaq 0xa0(%rsp), %r13
leaq 0x40(%rsp), %r15
movq %r14, %rdi
leaq 0x100(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x4956e
movq %r13, %rdi
movq %r14, %rsi
callq 0x8540
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7ca53
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movl %ebx, %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rcx, %rax
shrq $0x23, %rax
leal (%rax,%rax,4), %eax
leal (%r12,%rax,2), %eax
testl %eax, %eax
jne 0x7cad2
movl $0x9, %edx
movq 0x8e56f(%rip), %rdi     # 0x10afe8
leaq 0x6c11b(%rip), %rsi     # 0xe8b9b
callq 0x84e0
movq 0x8e55c(%rip), %rdi     # 0x10afe8
movl %ebx, %esi
callq 0x8810
movq %rax, %rbp
movl $0x5, %edx
movq %rax, %rdi
leaq 0x61624(%rip), %rsi     # 0xde0c9
callq 0x84e0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x20(%rsp), %rsi
addq $0x20, %rsi
leaq 0x128(%rsp), %rdi
callq 0x3e394
movq %rax, %rdi
movq %r13, %rsi
callq 0x8270
movq %r15, %rdi
leaq 0xc0(%rsp), %rsi
movl $0x5f, %edx
callq 0x50624
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps 0x20(%rsp), %xmm0
movq 0x30(%rsp), %rax
movups 0x40(%rsp), %xmm1
movaps %xmm1, 0x20(%rsp)
movq 0x50(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movaps (%rsp), %xmm1
movaps %xmm0, (%rsp)
movq %rax, 0x10(%rsp)
movups %xmm1, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r14, %rdi
callq 0x3123c
movq %r15, %rdi
callq 0x3123c
movq %r13, %rdi
leaq 0x5511d(%rip), %rsi     # 0xd1c7f
callq 0x8160
decl %r12d
incl %ebx
testl %eax, %eax
jne 0x7ca15
movq 0x20(%rsp), %rsi
addq $0x20, %rsi
leaq 0x128(%rsp), %rdi
callq 0x3e394
leaq 0xa0(%rsp), %rsi
movq %rax, %rdi
callq 0x8270
movq 0x8e447(%rip), %rdi     # 0x10afe8
leaq 0x6bff3(%rip), %rsi     # 0xe8b9b
movl $0x9, %edx
callq 0x84e0
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x8e422(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
leaq 0x614f4(%rip), %rsi     # 0xde0c9
movl $0x5, %edx
movq %rax, %rdi
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
xorl %eax, %eax
movq %rax, 0x70(%rsp)
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rsp, %rdi
movl $0x5f5e100, %esi        # imm = 0x5F5E100
callq 0x86f0
movq 0x38(%rsp), %rax
movq 0x18(%rax), %r14
addq $0x8, %rax
movq %rax, 0x38(%rsp)
cmpq %rax, %r14
je 0x7cf4d
movq 0x8e391(%rip), %r13     # 0x10afe8
leaq 0x128(%rsp), %r15
movq 0x8(%rsp), %rdx
movq %rsp, %rdi
xorl %esi, %esi
leaq 0x5500f(%rip), %rcx     # 0xd1c7f
xorl %r8d, %r8d
callq 0x86c0
movl $0x9, %edx
movq %r13, %rdi
leaq 0x61448(%rip), %rsi     # 0xde0cf
callq 0x84e0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r13, %rdi
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x48(%r14), %rax
cmpq 0x40(%r14), %rax
je 0x7ce7f
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x7, %edx
movq %r13, %rdi
leaq 0x613f1(%rip), %rsi     # 0xde0d9
callq 0x84e0
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r13, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x9, %edx
movq %rax, %rdi
leaq 0x5e534(%rip), %rsi     # 0xdb24a
callq 0x84e0
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3e394
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x82f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5c87b(%rip), %rsi     # 0xd95c4
callq 0x84e0
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x606fc(%rip), %rsi     # 0xdd474
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rdi
addq $0x20, %rdi
leaq 0x53aec(%rip), %rsi     # 0xd08a3
callq 0x8160
movq 0x40(%r14), %rcx
movq (%rcx,%rbp), %rsi
testl %eax, %eax
je 0x7ce2c
addq $0x20, %rsi
movq %rsi, %rdi
leaq 0x53ada(%rip), %rsi     # 0xd08b0
callq 0x8160
testl %eax, %eax
jne 0x7ce43
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3e394
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x57838
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rsp, %rdi
callq 0x8180
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7ce43
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x7ce43
movq %r15, %rdi
callq 0x3e394
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rsp, %rdi
callq 0x8180
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x33db0
incq %r12
movq 0x48(%r14), %rax
subq 0x40(%r14), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %rbp
cmpq %rax, %r12
jne 0x7ccd9
movl $0x1, %edx
movq 0x8e12d(%rip), %rdi     # 0x10afb8
leaq 0x59ae0(%rip), %rsi     # 0xd6972
callq 0x84e0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq 0x8e112(%rip), %rdi     # 0x10afb8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x2e45c
movq 0x8e0b3(%rip), %rdi     # 0x10afb8
leaq 0x80(%rsp), %rsi
callq 0x53342
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x7cf37
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x84f0
movq %rax, %r14
cmpq 0x38(%rsp), %rax
jne 0x7cc5f
movq 0x140(%rsp), %rbx
leaq 0x130(%rsp), %rax
cmpq %rax, %rbx
je 0x7d04b
leaq 0x118(%rsp), %rbp
movq 0x8e043(%rip), %r14     # 0x10afb8
leaq 0x61165(%rip), %r15     # 0xde0e1
leaq 0x108(%rsp), %r12
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
leaq 0x20(%rbx), %rdx
callq 0x575e4
cmpq 0x68(%rsp), %rax
jne 0x7d02f
movl $0xa, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x84e0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x84e0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r13, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq %rbp, 0x108(%rsp)
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2e45c
movq %r14, %rdi
movq %r12, %rsi
callq 0x53342
movq 0x108(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7d02f
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
leaq 0x130(%rsp), %rax
cmpq %rax, %rbx
jne 0x7cf84
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7d066
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
leaq 0x128(%rsp), %rdi
callq 0x3f5f4
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d0a2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d0c7
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%rsp), %rdi
callq 0x3123c
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d0f6
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d196
jmp 0x7d16c
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
callq 0x8480
jmp 0x7d1be
jmp 0x7d16c
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7d199
movq 0x118(%rsp), %rsi
jmp 0x7d188
jmp 0x7d16c
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x7d199
movq 0x90(%rsp), %rsi
jmp 0x7d188
jmp 0x7d196
jmp 0x7d16c
jmp 0x7d16c
jmp 0x7d196
movq %rax, %rbx
jmp 0x7d1be
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7d199
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x7d199
jmp 0x7d196
jmp 0x7d196
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7d1b4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
leaq 0x128(%rsp), %rdi
callq 0x3f5f4
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d1f0
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d215
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%rsp), %rdi
callq 0x3123c
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x7d244
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840