// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]Dsuite/Dsuite_common.cpp
// Function: assignTreeLevelsAndLinkToTaxa(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<int, std::allocator<int>>, 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<int, std::allocator<int>>>>>&, std::vector<int, std::allocator<int>>&)
void assignTreeLevelsAndLinkToTaxa(string& treeLine, std::map<string,std::vector<int>>& taxaToLoc, std::vector<int>& levels) {
    // First take care of any branch lengths
    std::regex branchLengths(":.*?(?=,|\\))");
    treeLine = std::regex_replace(treeLine,branchLengths,"");
    //std::cerr << line << std::endl;

    // Now process the tree
    levels.assign(treeLine.length(),0); int currentLevel = 0;
    std::vector<string> treeTaxonNames;
    string currentTaxonName = "";
    int lastBegin = 0;
    for (int i = 0; i < treeLine.length(); ++i) {
        if (treeLine[i] == '(') {
            currentLevel++; levels[i] = currentLevel;
        } else if (treeLine[i] == ')') {
            currentLevel--; levels[i] = currentLevel;
            if (currentTaxonName != "") {
                if (taxaToLoc.count(currentTaxonName) == 1) { duplicateTreeValueError(currentTaxonName); }
                treeTaxonNames.push_back(currentTaxonName);
                taxaToLoc[currentTaxonName].push_back(lastBegin);
                taxaToLoc[currentTaxonName].push_back(i-1);
                currentTaxonName = "";
            }
        } else if (treeLine[i] == ',') {
            levels[i] = currentLevel;
            if (currentTaxonName != "") {
                treeTaxonNames.push_back(currentTaxonName);
                taxaToLoc[currentTaxonName].push_back(lastBegin);
                taxaToLoc[currentTaxonName].push_back(i-1);
                currentTaxonName = "";
            }
        } else {
            if (currentTaxonName == "")
                lastBegin = i;
            levels[i] = currentLevel;
            currentTaxonName += treeLine[i];
        }
    }
    //print_vector(treeTaxonNames, std::cout,'\n');
    //print_vector(treeLevels, std::cout,' ');
    //for (std::map<string,std::vector<int>>::iterator i = treeTaxonNamesToLoc.begin(); i != treeTaxonNamesToLoc.end(); i++) {
    //    std::cout << i->first << "\t" << i->second[0] << "\t" << i->second[1] << "\t" << treeLevels[i->second[0]] << "\t" << treeLevels[i->second[1]] << std::endl;
    //}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x69a7(%rip), %rsi      # 0x38ff1
leaq 0x48(%rsp), %r12
pushq $0x10
popq %rdx
movq %r12, %rdi
callq 0x20a1c
leaq 0x6970(%rip), %rcx      # 0x38fd1
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x20a82
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x7500
movq %r12, %rdi
callq 0x7898
movq 0x8(%r15), %rsi
andl $0x0, (%r12)
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x133f8
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x691a(%rip), %rsi      # 0x38fd1
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8102
leaq 0x8(%rsp), %rax
andl $0x0, (%rax)
xorl %r12d, %r12d
leaq 0x28(%rsp), %rbp
xorl %r13d, %r13d
cmpq %r12, 0x8(%r15)
jbe 0x3284d
movq (%r15), %rax
movzbl (%rax,%r12), %eax
cmpl $0x2c, %eax
je 0x327a1
cmpl $0x29, %eax
je 0x32711
cmpl $0x28, %eax
jne 0x32816
incl %r13d
movq (%rbx), %rax
movl %r13d, (%rax,%r12,4)
jmp 0x32845
decl %r13d
movq (%rbx), %rax
movl %r13d, (%rax,%r12,4)
movq %rbp, %rdi
leaq 0x68ac(%rip), %rsi      # 0x38fd1
callq 0x117d6
testb %al, %al
je 0x32845
movq %r14, %rdi
movq %rbp, %rsi
callq 0x32b28
cmpq $0x1, %rax
je 0x3287a
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xbdc2
movq %r14, %rdi
movq %rbp, %rsi
callq 0xbbee
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x18976
movq %r14, %rdi
movq %rbp, %rsi
callq 0xbbee
leal -0x1(%r12), %ecx
movl %ecx, 0xc(%rsp)
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0xd98a
movq %rbp, %rdi
leaq 0x683a(%rip), %rsi      # 0x38fd1
callq 0x7800
jmp 0x32845
movq (%rbx), %rax
movl %r13d, (%rax,%r12,4)
movq %rbp, %rdi
leaq 0x681f(%rip), %rsi      # 0x38fd1
callq 0x117d6
testb %al, %al
je 0x32845
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0xbdc2
movq %r14, %rdi
movq %rbp, %rsi
callq 0xbbee
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x18976
movq %r14, %rdi
movq %rbp, %rsi
callq 0xbbee
leal -0x1(%r12), %ecx
movl %ecx, 0xc(%rsp)
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0xd98a
movq %rbp, %rdi
leaq 0x67c2(%rip), %rsi      # 0x38fd1
callq 0x7800
jmp 0x32845
movq %rbp, %rdi
leaq 0x67b1(%rip), %rsi      # 0x38fd1
callq 0x813d
testb %al, %al
je 0x3282e
movl %r12d, 0x8(%rsp)
movq (%rbx), %rax
movl %r13d, (%rax,%r12,4)
movq (%r15), %rax
movsbl (%rax,%r12), %esi
movq %rbp, %rdi
callq 0x73a0
incq %r12
jmp 0x326d9
leaq 0x28(%rsp), %rdi
callq 0x7898
leaq 0x10(%rsp), %rdi
callq 0xb80c
leaq 0x48(%rsp), %rdi
callq 0x20dac
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28(%rsp), %rdi
callq 0x32533
movq %rax, %rbx
jmp 0x328a3
jmp 0x3288b
movq %rax, %rbx
jmp 0x328ad
jmp 0x32896
jmp 0x32896
jmp 0x32896
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7898
leaq 0x10(%rsp), %rdi
callq 0xb80c
leaq 0x48(%rsp), %rdi
callq 0x20dac
movq %rbx, %rdi
callq 0x7750