// File: /workspace/github_cpp_makefile_star2_O1/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 0x419a
xorl %r12d, %r12d
jmp 0x44e6
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 0x1f9a(%rip), %rbx      # 0x6186
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 0x42d0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20b0
testl %eax, %eax
je 0x4258
movq %r14, %rdi
leaq 0x1f56(%rip), %rsi      # 0x618e
callq 0x20b0
testq %r15, %r15
jne 0x42b3
testl %eax, %eax
jne 0x42b3
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x4afa
jmp 0x41ec
testq %r15, %r15
jne 0x4268
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2180
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x4a40
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4abc
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0x4a40
leaq 0xb8(%rsp), %rdi
movq %rbp, %rsi
callq 0x4a40
movq %rax, %rdi
movq %r13, %rsi
callq 0x4abc
jmp 0x41ec
movl $0x1c, %edx
movq 0x4d31(%rip), %rdi      # 0x8ff0
leaq 0x1ecd(%rip), %rsi      # 0x6193
callq 0x2250
jmp 0x41ec
movq 0xa0(%rsp), %rbx
leaq 0x90(%rsp), %rax
cmpq %rax, %rbx
je 0x4358
leaq 0xf8(%rsp), %r13
leaq 0xe8(%rsp), %r12
leaq 0x20(%rbx), %rsi
movq %r12, %rdi
callq 0x5a76
movq 0x108(%rsp), %rbp
movq 0x110(%rsp), %r14
leaq 0x108(%rsp), %rdi
callq 0x4cd6
movq 0xe8(%rsp), %rdi
cmpq %r13, %rdi
je 0x433b
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2210
cmpq %r14, %rbp
je 0x4358
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x90(%rsp), %rax
cmpq %rax, %rbx
jne 0x42f5
addq $0x20, %rbx
leaq 0xb8(%rsp), %rdx
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x45db
movq %rax, %r12
testq %r15, %r15
movq 0x8(%rsp), %r13
je 0x43bd
leaq 0xe8(%rsp), %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x2390
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x108(%rsp,%rax), %ebp
testb $0x5, %bpl
je 0x440e
leaq 0xe8(%rsp), %rdi
callq 0x2080
jmp 0x448f
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
cmpq %r15, %rbx
je 0x4492
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x4b9c
movq %r13, %rdi
movq %rax, %rsi
callq 0x4b36
movq %rax, %r14
addq $0x20, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5e5a
movq %rax, %rdi
movq %r14, %rsi
callq 0x2060
incq 0x10(%r14)
addq $0x20, %rbx
jmp 0x43c7
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 0x447c
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x4b9c
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4b36
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x5e5a
movq %rax, %rdi
movq %r13, %rsi
callq 0x2060
incq 0x10(%r13)
jmp 0x4420
leaq 0xe8(%rsp), %rdi
callq 0x2080
testb $0x5, %bpl
je 0x4492
xorl %r12d, %r12d
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x44ae
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x44ca
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x44e6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x2f0(%rsp), %rdi
callq 0x2080
leaq 0x88(%rsp), %rdi
callq 0x4c52
leaq 0xb8(%rsp), %rdi
callq 0x4c52
leaq 0x10(%rsp), %rdi
callq 0x4c18
movq %r12, %rax
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x454b
jmp 0x454b
movq %rax, %rbx
jmp 0x45af
jmp 0x454b
jmp 0x454b
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x2080
jmp 0x454e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x456a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4586
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x45a2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x2f0(%rsp), %rdi
callq 0x2080
leaq 0x88(%rsp), %rdi
callq 0x4c52
leaq 0xb8(%rsp), %rdi
callq 0x4c52
leaq 0x10(%rsp), %rdi
callq 0x4c18
movq %rbx, %rdi
callq 0x2370