// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_cbs.cpp
// Function: findUndeterminedRegions()
void findUndeterminedRegions() {
    // Open a connection to read from the genome file
    std::ifstream* genomeFile = new std::ifstream(opt::genomeFile.c_str());
    string genomeFileRoot = stripExtension(opt::genomeFile);
    string undeterminedRegionsFileName = genomeFileRoot + ".ns";
    std::ofstream* undeterminedRegionsFile = new std::ofstream(undeterminedRegionsFileName.c_str());
    
    string nextScaffoldName;
    getline(*genomeFile, nextScaffoldName);
    string currentScaffoldReference;
    int thisUndeterminedRegionStart;
    int thisUndeterminedRegionEnd;
    while (nextScaffoldName != "") {
        //std::cerr << "Processing " << nextScaffoldName << "..." << std::endl;
        string thisScaffold = nextScaffoldName;
        currentScaffoldReference = readScaffold(genomeFile, nextScaffoldName);
        *undeterminedRegionsFile << thisScaffold << "\t" << currentScaffoldReference.length() << std::endl;
        bool bInUndetermined = false;
        for (string::size_type i = 0; i != currentScaffoldReference.size(); i++) {
            if (currentScaffoldReference[i] == 'N') {
                if (!bInUndetermined)
                    thisUndeterminedRegionStart = (int)i;
                if (i == currentScaffoldReference.size()-1) {
                    if (bInUndetermined)
                        *undeterminedRegionsFile << thisUndeterminedRegionStart << "\t" << i << std::endl;
                    else
                        *undeterminedRegionsFile << i << "\t" << i << std::endl;
                }
                bInUndetermined = true;
            } else {
                if (bInUndetermined) {
                    thisUndeterminedRegionEnd = (int)i-1;
                    *undeterminedRegionsFile << thisUndeterminedRegionStart << "\t" << thisUndeterminedRegionEnd << std::endl;
                    bInUndetermined = false;
                }
            }
        }
    }
    
    string line;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0xc52bf(%rip), %rsi     # 0x10c058
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %rbx, 0x60(%rsp)
leaq 0xc52a6(%rip), %rsi     # 0x10c058
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x50803
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x2e45c
leaq 0x8eeda(%rip), %rsi     # 0xd5cc0
leaq 0x20(%rsp), %rdi
callq 0x88c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %rbx
movq 0x20(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x60(%rsp), %r14
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8870
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8ae1a(%rip), %rsi     # 0xd1c7f
movq %rsp, %rdi
callq 0x8160
testl %eax, %eax
je 0x470d0
leaq 0x78(%rsp), %r12
leaq 0xa8(%rsp), %r13
movq %r13, %r14
movq %r12, 0x68(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x2e45c
movq %r13, %rdi
leaq 0x60(%rsp), %rsi
movq %rsp, %rdx
callq 0x4956e
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x8540
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x46ee2
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8ad78(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x82f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r15, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x4709d
xorl %r12d, %r12d
xorl %ecx, %ecx
movq 0x40(%rsp), %rdx
cmpb $0x4e, (%rdx,%r12)
jne 0x46fc8
testb $0x1, %cl
cmovel %r12d, %ebp
decq %rax
movb $0x1, %r13b
cmpq %rax, %r12
jne 0x47086
testb $0x1, %cl
je 0x4702f
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8ace2(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq %r15, %rdi
movq %r12, %rsi
callq 0x82f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x47073
testb $0x1, %cl
je 0x4702a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8ac95(%rip), %rsi     # 0xd1c7e
callq 0x84e0
leaq -0x1(%r12), %rsi
movq %r15, %rdi
callq 0x8810
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r15, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
xorl %r13d, %r13d
jmp 0x47086
movl %ecx, %r13d
jmp 0x47086
movq %rbx, %rdi
movq %r12, %rsi
callq 0x82f0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8ac32(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq %r15, %rdi
movq %r12, %rsi
callq 0x82f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r15, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
incq %r12
movq 0x48(%rsp), %rax
movl %r13d, %ecx
cmpq %rax, %r12
movq %r14, %r13
jne 0x46f55
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %r12
cmpq %r12, %rdi
je 0x470b9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rsp, %rdi
leaq 0x8abbc(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
jne 0x46e85
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x470ec
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x47107
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x47123
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47144
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
jmp 0x471e7
jmp 0x47168
movq %rax, %r14
jmp 0x471ec
movq %rax, %r14
jmp 0x47208
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x47224
movq %rax, %r14
jmp 0x471d1
movq %rax, %r14
jmp 0x471b5
jmp 0x47191
movq %rax, %r14
jmp 0x4719e
movq %rax, %r14
leaq 0x78(%rsp), %r12
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x471b5
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x471d1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x471ec
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x47208
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47229
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840