// File: /workspace/github_cpp_makefile_star2_O3/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 $0x168, %rsp            # imm = 0x168
movq %rdi, 0x68(%rsp)
movq 0x85bfb(%rip), %rbx     # 0x101fe8
leaq 0x5ad44(%rip), %rsi     # 0xd7138
movl $0x20, %edx
movq %rbx, %rdi
callq 0x84e0
movq 0x872b0(%rip), %rsi     # 0x1036b8
movq 0x872b1(%rip), %rdx     # 0x1036c0
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 0x5acce(%rip), %rsi     # 0xd7116
movl $0x21, %edx
movq %rbx, %rdi
callq 0x84e0
movq 0x8727c(%rip), %rsi     # 0x1036d8
movq 0x8727d(%rip), %rdx     # 0x1036e0
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 0x100(%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 0xe0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xc0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x140(%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 0x871ac(%rip), %rsi     # 0x1036b8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %r14, 0x110(%rsp)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
leaq 0xf0(%rsp), %rsi
movq %r14, %rdi
callq 0x8870
leaq 0x40(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
movl $0x5f, %edx
callq 0x4d650
movq 0x30(%rsp), %rax
leaq 0x40(%rsp), %rbx
movaps (%rbx), %xmm0
movq 0x10(%rbx), %rcx
movq %rcx, 0x30(%rsp)
movaps 0x20(%rsp), %xmm1
movaps %xmm0, 0x20(%rsp)
movq %rsp, %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x2e784
movq %rbx, %rdi
callq 0x2e784
leaq 0x51420(%rip), %rsi     # 0xcd9cb
leaq 0xb0(%rsp), %rdi
callq 0x8160
testl %eax, %eax
je 0x7c732
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0x1, %ebx
movq %rsp, %r14
leaq 0xb0(%rsp), %r13
leaq 0x40(%rsp), %r15
movq %r14, %rdi
leaq 0x110(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x465f2
movq %r13, %rdi
movq %r14, %rsi
callq 0x8540
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7c619
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 0x7c698
movl $0x9, %edx
movq 0x859a9(%rip), %rdi     # 0x101fe8
leaq 0x635cd(%rip), %rsi     # 0xdfc13
callq 0x84e0
movq 0x85996(%rip), %rdi     # 0x101fe8
movl %ebx, %esi
callq 0x8810
movq %rax, %rbp
movl $0x5, %edx
movq %rax, %rdi
leaq 0x5aaee(%rip), %rsi     # 0xd7159
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 0x138(%rsp), %rdi
callq 0x3b46e
movq %rax, %rdi
movq %r13, %rsi
callq 0x8270
movq %r15, %rdi
leaq 0xd0(%rsp), %rsi
movl $0x5f, %edx
callq 0x4d650
movq 0x30(%rsp), %rax
movaps 0x40(%rsp), %xmm0
movq 0x50(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movaps 0x20(%rsp), %xmm1
movaps %xmm0, 0x20(%rsp)
movaps %xmm1, (%rsp)
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r14, %rdi
callq 0x2e784
movq %r15, %rdi
callq 0x2e784
movq %r13, %rdi
leaq 0x512ab(%rip), %rsi     # 0xcd9cb
callq 0x8160
decl %r12d
incl %ebx
testl %eax, %eax
jne 0x7c5db
movq 0x20(%rsp), %rsi
addq $0x20, %rsi
leaq 0x138(%rsp), %rdi
callq 0x3b46e
leaq 0xb0(%rsp), %rsi
movq %rax, %rdi
callq 0x8270
movq 0x85889(%rip), %rdi     # 0x101fe8
leaq 0x634ad(%rip), %rsi     # 0xdfc13
movl $0x9, %edx
callq 0x84e0
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x85864(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
leaq 0x5a9c6(%rip), %rsi     # 0xd7159
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, 0x70(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%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 0x68(%rsp), %rax
movq 0x18(%rax), %r14
addq $0x8, %rax
movq %rax, 0x68(%rsp)
cmpq %rax, %r14
je 0x7cb0e
movq 0x857d0(%rip), %r13     # 0x101fe8
leaq 0x138(%rsp), %r15
movq 0x8(%rsp), %rdx
movq %rsp, %rdi
xorl %esi, %esi
leaq 0x5119a(%rip), %rcx     # 0xcd9cb
xorl %r8d, %r8d
callq 0x86c0
movl $0x9, %edx
movq %r13, %rdi
leaq 0x5a917(%rip), %rsi     # 0xd715f
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 0x7ca40
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x7, %edx
movq %r13, %rdi
leaq 0x5a8c0(%rip), %rsi     # 0xd7169
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 0x584b3(%rip), %rsi     # 0xd4d8a
callq 0x84e0
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3b46e
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x82f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x567fa(%rip), %rsi     # 0xd3104
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 0x59bcb(%rip), %rsi     # 0xd6504
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 0x50733(%rip), %rsi     # 0xcd0ab
callq 0x8160
movq 0x40(%r14), %rcx
movq (%rcx,%rbp), %rsi
testl %eax, %eax
je 0x7c9ed
addq $0x20, %rsi
movq %rsi, %rdi
leaq 0x50721(%rip), %rsi     # 0xcd0b8
callq 0x8160
testl %eax, %eax
jne 0x7ca04
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3b46e
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x579a4
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 0x7ca04
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x7ca04
movq %r15, %rdi
callq 0x3b46e
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rsp, %rdi
callq 0x8180
movq 0x40(%r14), %rax
movq (%rax,%rbp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x3133c
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 0x7c89a
movl $0x1, %edx
movq 0x8556c(%rip), %rdi     # 0x101fb8
leaq 0x53187(%rip), %rsi     # 0xcfbda
callq 0x84e0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq 0x85551(%rip), %rdi     # 0x101fb8
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 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x2ba06
movq 0x854f2(%rip), %rdi     # 0x101fb8
leaq 0x90(%rsp), %rsi
callq 0x501cd
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x7caf8
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x84f0
movq %rax, %r14
cmpq 0x68(%rsp), %rax
jne 0x7c820
movq 0x150(%rsp), %rbx
leaq 0x140(%rsp), %rax
cmpq %rax, %rbx
je 0x7cc0c
leaq 0x128(%rsp), %rbp
movq 0x85482(%rip), %r14     # 0x101fb8
leaq 0x5a634(%rip), %r15     # 0xd7171
leaq 0x118(%rsp), %r12
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
leaq 0x20(%rbx), %rdx
callq 0x5775a
cmpq 0x78(%rsp), %rax
jne 0x7cbf0
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, 0x118(%rsp)
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2ba06
movq %r14, %rdi
movq %r12, %rsi
callq 0x501cd
movq 0x118(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7cbf0
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
leaq 0x140(%rsp), %rax
cmpq %rax, %rbx
jne 0x7cb45
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7cc27
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x2e784
leaq 0x138(%rsp), %rdi
callq 0x3c6d4
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7cc63
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x7cc88
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%rsp), %rdi
callq 0x2e784
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x7ccb7
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7cd57
jmp 0x7cd2d
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
callq 0x8480
jmp 0x7cd7f
jmp 0x7cd2d
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7cd5a
movq 0x128(%rsp), %rsi
jmp 0x7cd49
jmp 0x7cd2d
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x7cd5a
movq 0xa0(%rsp), %rsi
jmp 0x7cd49
jmp 0x7cd57
jmp 0x7cd2d
jmp 0x7cd2d
jmp 0x7cd57
movq %rax, %rbx
jmp 0x7cd7f
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7cd5a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x7cd5a
jmp 0x7cd57
jmp 0x7cd57
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x7cd75
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x2e784
leaq 0x138(%rsp), %rdi
callq 0x3c6d4
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7cdb1
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x7cdd6
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%rsp), %rdi
callq 0x2e784
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x7ce05
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840