// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/process_vcf_get_sequences.cpp
// Function: print_split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<unsigned long, std::allocator<unsigned long>> const&, 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&, unsigned long, 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>>>>&, unsigned int, std::vector<unsigned long, std::allocator<unsigned long>> const&, int)
void print_split(const std::string& currentScaffoldNum, const std::vector<string::size_type>& splits, const std::vector<std::string>& sampleNames, const size_t numSamples, std::vector<std::string>& scaffoldStrings, const unsigned int totalProcessedVariants,const std::vector<string::size_type>& scaledSplits, const int fullScLength) {
    //for (std::vector<int>::size_type j = 0; j != splits.size(); j++) {
    
    std::cerr << "There are: " << splits.size() << " splits of size " << opt::splitNum << std::endl;
    
    std::ofstream* scaffoldFile;
    if (splits.size() == 0) {
        // Only print the whole scaffold if it contains a rasonble number of variants
        if (totalProcessedVariants % opt::splitNum > (opt::splitNum * 0.8)) {
            scaffoldFile = new std::ofstream(currentScaffoldNum.c_str());
            if (opt::bLDhat)
                *scaffoldFile << numSamples << "\t" << scaffoldStrings[0].length() << "\t" << "2" << std::endl;
            for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
                *scaffoldFile << ">" << sampleNames[i] << std::endl;
                print80bpPerLineFile(scaffoldFile, scaffoldStrings[i]);
                scaffoldStrings[i] = "";
            }
            scaffoldFile->close();
        } else {
            for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
                scaffoldStrings[i] = "";
            }
          
        }
    } else {
        string firstSplitFileName = currentScaffoldNum + "_1_" + numToString(splits[0]);
        scaffoldFile = new std::ofstream(firstSplitFileName.c_str());
        if (opt::bLDhat)
            *scaffoldFile << numSamples << "\t" << splits[0] << "\t" << "2" << std::endl;
        for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
            *scaffoldFile << ">" << sampleNames[i] << std::endl;
            print80bpPerLineFile(scaffoldFile, scaffoldStrings[i].substr(0,scaledSplits[0]));
        }
        scaffoldFile->close();
        
        for (std::vector<int>::size_type j = 1; j != splits.size(); j++) {
            string splitFileName = currentScaffoldNum + "_" + numToString(splits[j-1]+1) + "_" + numToString(splits[j]);
            scaffoldFile = new std::ofstream(splitFileName.c_str());
            if (opt::bLDhat)
                *scaffoldFile << numSamples << "\t" << (splits[j] - splits[j-1]) << "\t" << "2" << std::endl;
            for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
                *scaffoldFile << ">" << sampleNames[i] << std::endl;
                print80bpPerLineFile(scaffoldFile, scaffoldStrings[i].substr(scaledSplits[j-1], scaledSplits[j] - scaledSplits[j-1]));
            }
            scaffoldFile->close();
        }
        
        // Print the last part of the scaffold only if there are a reasonble number of variants
        if (totalProcessedVariants % opt::splitNum > (opt::splitNum * 0.8)) {
            string lastSplitFileName = currentScaffoldNum + "_" + numToString(splits[splits.size()-1]+1) + "_" + numToString(fullScLength);
            
            scaffoldFile = new std::ofstream(lastSplitFileName.c_str());
            if (opt::bLDhat)
                *scaffoldFile << numSamples << "\t" << (scaffoldStrings[0].length() - splits[splits.size()-1]) << "\t" << "2" << std::endl;
            for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
                *scaffoldFile << ">" << sampleNames[i] << std::endl;
                print80bpPerLineFile(scaffoldFile, scaffoldStrings[i].substr(scaledSplits[scaledSplits.size()-1],std::string::npos));
                scaffoldStrings[i] = "";
            }
            scaffoldFile->close();
        } else {
            for (std::vector<std::string>::size_type i = 0; i != numSamples; i++) {
                scaffoldStrings[i] = "";
            }
        }
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %r9d, %ebp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
movq 0x88b0d(%rip), %rdi     # 0xdcfe8
leaq 0x4f2bb(%rip), %rsi     # 0xa379d
callq 0x8480
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x8320
leaq 0x4f2a8(%rip), %rsi     # 0xa37a9
movq %rax, %rdi
callq 0x8480
movl 0x89f91(%rip), %esi     # 0xde4a0
movq %rax, %rdi
callq 0x8840
movq %rax, %rdi
callq 0x8230
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x54ac8
movl %ebp, 0x2c(%rsp)
leaq 0x4f283(%rip), %rdx     # 0xa37ba
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x28806
movq %rbx, 0x18(%rsp)
movq (%rbx), %rax
movq (%rax), %rsi
leaq 0x58(%rsp), %rdi
callq 0x554cb
movq %r15, 0x30(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x28a48
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x38(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %r12
movq 0xf8(%rsp), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movq %r12, (%rsp)
cmpb $0x0, 0x89ef2(%rip)     # 0xde4a6
je 0x5460b
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x8320
leaq 0x45854(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x8320
leaq 0x45832(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x4bea1(%rip), %rsi     # 0xa049c
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
xorl %ebx, %ebx
leaq 0x4a4fe(%rip), %r12     # 0x9eb12
leaq 0x158(%rsp), %r13
movq %rsp, %rbp
movq 0x8(%rsp), %r14
movq (%rsp), %rdi
subq $0x1, %r14
jb 0x5468d
movq %r12, %rsi
callq 0x8480
movq 0x20(%rsp), %rcx
movq (%rcx), %rsi
addq %rbx, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x10(%rsp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq %r13, %rdi
xorl %edx, %edx
callq 0x84b0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x42730
movq %r13, %rdi
callq 0x8978
addq $0x20, %rbx
jmp 0x54624
callq 0x8620
pushq $0x1
popq %rbx
leaq 0x98(%rsp), %rbp
leaq 0x138(%rsp), %r13
movq %rsp, %r12
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x3, %rax
cmpq %rax, %rbx
je 0x5489f
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
leaq 0x4f0ec(%rip), %rdx     # 0xa37bc
callq 0x28806
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax,%rbx,8), %rsi
incq %rsi
leaq 0x78(%rsp), %r15
movq %r15, %rdi
callq 0x554cb
leaq 0xb8(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x28a48
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
leaq 0x4f0a5(%rip), %rdx     # 0xa37bc
callq 0x28a29
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rsi
leaq 0xd8(%rsp), %r15
movq %r15, %rdi
callq 0x554cb
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x28a48
movq %r15, %rdi
callq 0x8978
movq %r14, %rdi
callq 0x8978
leaq 0xb8(%rsp), %rdi
callq 0x8978
leaq 0x78(%rsp), %rdi
callq 0x8978
movq %rbp, %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
leaq 0x4a385(%rip), %rbp     # 0x9eb12
movq %rax, %r14
movq 0x38(%rsp), %rsi
movq %rax, %rdi
pushq $0x10
popq %rdx
callq 0x84e0
movq %r14, (%rsp)
cmpb $0x0, 0x89cfb(%rip)     # 0xde4a6
je 0x54808
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x8320
movq %rax, %rdi
leaq 0x4565a(%rip), %rsi     # 0x99e1e
callq 0x8480
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbx,8), %rsi
subq -0x8(%rcx,%rbx,8), %rsi
movq %rax, %rdi
callq 0x8320
movq %rax, %rdi
leaq 0x45632(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x4bca1(%rip), %rsi     # 0xa049c
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %r14
xorl %r15d, %r15d
movq (%rsp), %rdi
subq $0x1, %r14
jb 0x54880
movq %rbp, %rsi
callq 0x8480
movq 0x20(%rsp), %rcx
movq (%rcx), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x10(%rsp), %rax
movq (%rax), %rsi
addq %r15, %rsi
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax,%rbx,8), %rdx
movq (%rax,%rbx,8), %rcx
subq %rdx, %rcx
movq %r13, %rdi
callq 0x84b0
movq %r12, %rdi
movq %r13, %rsi
callq 0x42730
movq %r13, %rdi
callq 0x8978
addq $0x20, %r15
jmp 0x54810
callq 0x8620
leaq 0x38(%rsp), %rdi
callq 0x8978
incq %rbx
leaq 0x98(%rsp), %rbp
jmp 0x546a8
movl 0x89bfb(%rip), %ecx     # 0xde4a0
movl 0x2c(%rsp), %eax
xorl %edx, %edx
divl %ecx
cvtsi2sd %rdx, %xmm0
cvtsi2sd %ecx, %xmm1
mulsd 0x4eb1a(%rip), %xmm1    # 0xa33d8
ucomisd %xmm1, %xmm0
jbe 0x54bf4
leaq 0x4eeed(%rip), %rdx     # 0xa37bc
leaq 0x98(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x28806
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax), %rsi
incq %rsi
leaq 0x78(%rsp), %rdi
callq 0x554cb
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x28a48
leaq 0x4eea0(%rip), %rdx     # 0xa37bc
leaq 0x58(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x28a29
leaq 0xd8(%rsp), %rdi
movl 0x1d8(%rsp), %esi
callq 0x28ad3
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x28a48
leaq 0xd8(%rsp), %rdi
callq 0x8978
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0xb8(%rsp), %rdi
callq 0x8978
leaq 0x78(%rsp), %rdi
callq 0x8978
leaq 0x98(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %r12
movq 0x38(%rsp), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movq %r12, (%rsp)
cmpb $0x1, 0x89aea(%rip)     # 0xde4a6
jne 0x54a21
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x8320
leaq 0x4544c(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rsi
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rcx
subq -0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x8320
leaq 0x4541c(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x4ba8b(%rip), %rsi     # 0xa049c
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
xorl %ebx, %ebx
leaq 0x4a0e8(%rip), %r14     # 0x9eb12
leaq 0x118(%rsp), %r13
pushq $-0x1
popq %r15
movq %rsp, %r12
leaq 0x453df(%rip), %rbp     # 0x99e1f
movq (%rsp), %rdi
subq $0x1, 0x8(%rsp)
jb 0x54c1e
movq %r14, %rsi
callq 0x8480
movq 0x20(%rsp), %rcx
movq (%rcx), %rsi
addq %rbx, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x10(%rsp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq 0x1d0(%rsp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax), %rdx
movq %r13, %rdi
movq %r15, %rcx
callq 0x84b0
movq %r12, %rdi
movq %r13, %rsi
callq 0x42730
movq %r13, %rdi
callq 0x8978
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rbx, %rdi
movq %rbp, %rsi
callq 0x88f0
addq $0x20, %rbx
jmp 0x54a40
movl 0x899d2(%rip), %ecx     # 0xde4a0
movl %ebp, %eax
xorl %edx, %edx
divl %ecx
cvtsi2sd %rdx, %xmm0
cvtsi2sd %ecx, %xmm1
mulsd 0x4e8f3(%rip), %xmm1    # 0xa33d8
ucomisd %xmm1, %xmm0
jbe 0x54c3c
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %r14
movq (%r15), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movq %r14, (%rsp)
cmpb $0x0, 0x89991(%rip)     # 0xde4a6
je 0x54b6c
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x8320
leaq 0x452f3(%rip), %r14     # 0x99e1e
movq %rax, %rdi
movq %r14, %rsi
callq 0x8480
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x8320
movq %rax, %rdi
movq %r14, %rsi
callq 0x8480
leaq 0x4b940(%rip), %rsi     # 0xa049c
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
xorl %ebx, %ebx
leaq 0x49f9d(%rip), %r15     # 0x9eb12
leaq 0x178(%rsp), %r13
movq %rsp, %rbp
leaq 0x45298(%rip), %r12     # 0x99e1f
movq 0x10(%rsp), %r14
movq (%rsp), %rdi
subq $0x1, 0x8(%rsp)
jb 0x54c66
movq %r15, %rsi
callq 0x8480
movq 0x20(%rsp), %rcx
movq (%rcx), %rsi
addq %rbx, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq (%r14), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0x8600
movq %rbp, %rdi
movq %r13, %rsi
callq 0x42730
movq %r13, %rdi
callq 0x8978
movq (%r14), %rdi
addq %rbx, %rdi
movq %r12, %rsi
callq 0x88f0
addq $0x20, %rbx
jmp 0x54b8c
xorl %ebx, %ebx
leaq 0x45222(%rip), %r14     # 0x99e1f
subq $0x1, 0x8(%rsp)
jb 0x54c2d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rbx, %rdi
movq %r14, %rsi
callq 0x88f0
addq $0x20, %rbx
jmp 0x54bfd
callq 0x8620
leaq 0x38(%rsp), %rdi
callq 0x8978
leaq 0xf8(%rsp), %rdi
callq 0x8978
jmp 0x54c6b
xorl %ebx, %ebx
leaq 0x451da(%rip), %r14     # 0x99e1f
subq $0x1, 0x8(%rsp)
jb 0x54c6b
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rbx, %rdi
movq %r14, %rsi
callq 0x88f0
addq $0x20, %rbx
jmp 0x54c45
callq 0x8620
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x84a0
jmp 0x54dbf
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdi
jmp 0x54d37
jmp 0x54d1a
jmp 0x54d4f
jmp 0x54d4a
jmp 0x54d45
jmp 0x54d40
jmp 0x54d8c
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdi
callq 0x84a0
jmp 0x54db2
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x8978
jmp 0x54ce4
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x54dba
jmp 0x54da5
jmp 0x54d8c
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
jmp 0x54dba
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0x54d9e
jmp 0x54d8c
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x8978
jmp 0x54d52
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x84a0
jmp 0x54da8
jmp 0x54d8c
movq %rax, %rbx
jmp 0x54d73
movq %rax, %rbx
jmp 0x54d69
movq %rax, %rbx
jmp 0x54d5c
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0xb8(%rsp), %rdi
callq 0x8978
leaq 0x78(%rsp), %rdi
callq 0x8978
leaq 0x98(%rsp), %rdi
jmp 0x54dad
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
jmp 0x54dad
jmp 0x54da5
movq %rax, %rbx
jmp 0x54db2
jmp 0x54da5
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x8978
jmp 0x54da8
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x8978
leaq 0xf8(%rsp), %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8870