// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x7353(%rip), %rsi      # 0x44061
leaq 0x58(%rsp), %r12
movq %r12, %rdi
movl $0x10, %edx
callq 0x27dee
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movl $0x0, (%rsp)
leaq 0x72f3(%rip), %r8       # 0x44041
leaq 0x10(%rsp), %rdi
movq %r12, %rcx
xorl %r9d, %r9d
callq 0x32de3
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x7520
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x3cd84
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7420
movq 0x8(%r15), %rsi
leaq 0x10(%rsp), %rdx
movl $0x0, (%rdx)
movq %rbx, %rdi
callq 0x16b12
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x10(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x7286(%rip), %rdx      # 0x44041
movq %rdx, %rsi
callq 0x88ba
movl $0x0, 0x8(%rsp)
cmpq $0x0, 0x8(%r15)
je 0x3cfcf
leaq 0x8(%r14), %rax
movq %rax, 0x50(%rsp)
xorl %ebp, %ebp
leaq 0x10(%rsp), %r13
xorl %r12d, %r12d
movq (%r15), %rax
movzbl (%rax,%rbp), %eax
cmpl $0x2c, %eax
je 0x3ce86
cmpl $0x29, %eax
je 0x3ce16
cmpl $0x28, %eax
jne 0x3ced6
incl %r12d
movq (%rbx), %rax
movl %r12d, (%rax,%rbp,4)
jmp 0x3cfc2
decl %r12d
movq (%rbx), %rax
movl %r12d, (%rax,%rbp,4)
movq %r13, %rdi
leaq 0x7217(%rip), %rsi      # 0x44041
callq 0x70f0
testl %eax, %eax
je 0x3cfc2
movq %r14, %rdi
movq %r13, %rsi
callq 0x3d91e
cmpq 0x50(%rsp), %rax
jne 0x3d00e
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0xd894
movq %r14, %rdi
movq %r13, %rsi
callq 0xd63e
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3cf66
movl 0x8(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3cf73
movq (%rbx), %rax
movl %r12d, (%rax,%rbp,4)
movq %r13, %rdi
leaq 0x71aa(%rip), %rsi      # 0x44041
callq 0x70f0
testl %eax, %eax
je 0x3cfc2
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0xd894
movq %r14, %rdi
movq %r13, %rsi
callq 0xd63e
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3cf08
movl 0x8(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3cf15
movq %r13, %rdi
leaq 0x7161(%rip), %rsi      # 0x44041
callq 0x70f0
testl %eax, %eax
jne 0x3ceed
movl %ebp, 0x8(%rsp)
movq (%rbx), %rax
movl %r12d, (%rax,%rbp,4)
movq (%r15), %rax
movsbl (%rax,%rbp), %esi
movq %r13, %rdi
callq 0x7390
jmp 0x3cfc2
movq %rax, %rdi
leaq 0x8(%rsp), %rdx
callq 0x20fc8
movq %r14, %rdi
movq %r13, %rsi
callq 0xd63e
leaq -0x1(%rbp), %rcx
movl %ecx, 0xc(%rsp)
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3cf3e
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3cf4b
movq %rax, %rdi
leaq 0xc(%rsp), %rdx
callq 0xf7bc
movq 0x18(%rsp), %rdx
movq %r13, %rdi
xorl %esi, %esi
leaq 0x70e5(%rip), %rcx      # 0x44041
xorl %r8d, %r8d
callq 0x7640
jmp 0x3cfc2
movq %rax, %rdi
leaq 0x8(%rsp), %rdx
callq 0x20fc8
movq %r14, %rdi
movq %r13, %rsi
callq 0xd63e
leaq -0x1(%rbp), %rcx
movl %ecx, 0xc(%rsp)
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3cf9c
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3cfa9
movq %rax, %rdi
leaq 0xc(%rsp), %rdx
callq 0xf7bc
movq 0x18(%rsp), %rdx
movq %r13, %rdi
xorl %esi, %esi
leaq 0x7087(%rip), %rcx      # 0x44041
xorl %r8d, %r8d
callq 0x7640
incq %rbp
cmpq %rbp, 0x8(%r15)
ja 0x3cde9
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3cfeb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7420
leaq 0x30(%rsp), %rdi
callq 0xd1ac
leaq 0x58(%rsp), %rdi
callq 0x2810a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x3cbc6
movq %rax, %rbx
jmp 0x3d063
movq %rax, %rbx
jmp 0x3d06d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x3d06d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7420
jmp 0x3d06d
jmp 0x3d044
jmp 0x3d044
jmp 0x3d044
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3d063
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7420
leaq 0x30(%rsp), %rdi
callq 0xd1ac
leaq 0x58(%rsp), %rdi
callq 0x2810a
movq %rbx, %rdi
callq 0x7740