// File: /workspace/github_cpp_makefile_star2_O3/canzarlab[P]Trajan/src/newick.cpp
// Function: load_dag(char const*, char const*, std::map<newick_node*, std::__cxx11::list<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<newick_node*>, std::allocator<std::pair<newick_node* const, std::__cxx11::list<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::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, newick_node*, 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, newick_node*>>>&)
newick_node* load_dag(const char* f1, const char* f2, mnls& clade, msn& M)
{
    vss S;
    msvs C, P;
    ifstream ef(f1);
    if (!ef)
        return nullptr;

    string n1, n2, s;
    while (ef >> n1 >> n2 >> s)
    {
        if (s == "default")
        {
            if (!f2) swap(n1, n2);
            P[n1].push_back(n2);
            P[n2];
            C[n2].push_back(n1);
        }
        else if (s == "gene" && !f2)
            S.emplace_back(n1, n2);
        else
            cerr << "WARNING: unsupported entry!\n";
    }

    const auto& l = [](const svs& i){return i.second.empty();};
    const string& r = find_if(P.begin(), P.end(), l)->first;
    newick_node* root = load_dag_internal(r, M, C);

    if (f2)
    {
        ifstream lf(f2);
        if (!lf)
            return nullptr;

        while (lf >> n1 >> n2)
            clade[M[n2]].push_back(n1);
    }
    else
        for (const ss& p : S)
            clade[M[p.first]].push_back(p.second);

    return root;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f8, %rsp            # imm = 0x4F8
movq %rcx, (%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
leaq 0xc0(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x90(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x2f0(%rsp), %rdi
movl $0x8, %edx
callq 0x2390
movq 0x2f0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x310(%rsp,%rax)
je 0x439f
xorl %r12d, %r12d
jmp 0x46e2
movq %rbx, 0x8(%rsp)
leaq 0x58(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x78(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x2f0(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0x68(%rsp), %r14
leaq 0x2dc5(%rip), %rbx      # 0x71b6
movq %r12, %rdi
movq %r13, %rsi
callq 0x2290
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2290
movq %rax, %rdi
movq %r14, %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x44d5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20b0
testl %eax, %eax
je 0x445d
movq %r14, %rdi
leaq 0x2d81(%rip), %rsi      # 0x71be
callq 0x20b0
testq %r15, %r15
jne 0x44b8
testl %eax, %eax
jne 0x44b8
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x4d02
jmp 0x43f1
testq %r15, %r15
jne 0x446d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2180
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x4c48
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4cc4
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0x4c48
leaq 0xb8(%rsp), %rdi
movq %rbp, %rsi
callq 0x4c48
movq %rax, %rdi
movq %r13, %rsi
callq 0x4cc4
jmp 0x43f1
movl $0x1c, %edx
movq 0x5b2c(%rip), %rdi      # 0x9ff0
leaq 0x2cf8(%rip), %rsi      # 0x71c3
callq 0x2250
jmp 0x43f1
movq 0xa0(%rsp), %rbx
leaq 0x90(%rsp), %rax
cmpq %rax, %rbx
je 0x455d
leaq 0xf8(%rsp), %r13
leaq 0xe8(%rsp), %r12
leaq 0x20(%rbx), %rsi
movq %r12, %rdi
callq 0x5c56
movq 0x108(%rsp), %rbp
movq 0x110(%rsp), %r14
leaq 0x108(%rsp), %rdi
callq 0x4ee4
movq 0xe8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4540
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2210
cmpq %r14, %rbp
je 0x455d
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x90(%rsp), %rax
cmpq %rax, %rbx
jne 0x44fa
addq $0x20, %rbx
leaq 0xb8(%rsp), %rdx
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x47d7
movq %rax, %r12
testq %r15, %r15
movq 0x8(%rsp), %r13
je 0x45c2
leaq 0xe8(%rsp), %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x2390
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x108(%rsp,%rax)
je 0x4613
leaq 0xe8(%rsp), %rdi
callq 0x2080
xorl %r12d, %r12d
jmp 0x468e
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
cmpq %r15, %rbx
je 0x468e
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x4daa
movq %r13, %rdi
movq %rax, %rsi
callq 0x4d44
movq %rax, %r14
addq $0x20, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x6032
movq %rax, %rdi
movq %r14, %rsi
callq 0x2060
incq 0x10(%r14)
addq $0x20, %rbx
jmp 0x45cc
leaq 0xe8(%rsp), %rbx
leaq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2290
movq %rax, %rdi
movq %r15, %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4681
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x4daa
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4d44
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x6032
movq %rax, %rdi
movq %r13, %rsi
callq 0x2060
incq 0x10(%r13)
jmp 0x4625
leaq 0xe8(%rsp), %rdi
callq 0x2080
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x46aa
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x46c6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x46e2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x2f0(%rsp), %rdi
callq 0x2080
leaq 0x88(%rsp), %rdi
callq 0x4e60
leaq 0xb8(%rsp), %rdi
callq 0x4e60
leaq 0x10(%rsp), %rdi
callq 0x4e26
movq %r12, %rax
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4747
jmp 0x4747
movq %rax, %rbx
jmp 0x47ab
jmp 0x4747
jmp 0x4747
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x2080
jmp 0x474a
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x4766
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4782
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x479e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x2f0(%rsp), %rdi
callq 0x2080
leaq 0x88(%rsp), %rdi
callq 0x4e60
leaq 0xb8(%rsp), %rdi
callq 0x4e60
leaq 0x10(%rsp), %rdi
callq 0x4e26
movq %rbx, %rdi
callq 0x2370