// File: /workspace/github_cpp_makefile_star2_O3/grame-cncm[P]digraph/./dglib/digraphop.hh
// Function: std::vector<std::vector<char, std::allocator<char>>, std::allocator<std::vector<char, std::allocator<char>>>> parallelize<char, int>(digraph<char, int> const&)
inline std::vector<std::vector<N>> parallelize(const digraph<N, A>& g)
{
    //-----------------------------------------------------------
    // Find the level of a node n -> {m1,m2,...} such that
    //		level(n -> {})			= 0
    //		level(n -> {m1,m2,...})	= 1 + std::max(level(mi))
    //-----------------------------------------------------------
    using Levelfun = std::function<int(const N&, std::map<N, int>&)>;

    Levelfun level = [&g, &level](const N& n1, std::map<N, int>& levelcache) -> int {
        auto p = levelcache.find(n1);
        if (p != levelcache.end()) {
            return p->second;
        } else {
            int l = -1;
            for (const auto& e : g.connections(n1)) {
                l = std::max(l, level(e.first, levelcache));
            }
            return levelcache[n1] = l + 1;
        }
    };

    std::map<N, int> levelcache;
    // compute the level of each node in the graph
    int l = -1;
    for (const N& n : g.nodes()) {
        l = std::max(l, level(n, levelcache));
    }
    // create a graph for each level and place
    // each node in the appropriate level
    std::vector<std::vector<N>> v;
    v.resize(l + 1);
    for (const N& n : g.nodes()) {
        v[levelcache[n]].push_back(n);
    }

    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
movq %rsi, (%rax)
movq %rax, 0x8(%rax)
leaq 0x24f(%rip), %rcx       # 0x1adf6
movq %rcx, 0x18(%rax)
leaq 0x24a(%rip), %rcx       # 0x1adfc
movq %rcx, 0x10(%rax)
leaq 0x30(%rsp), %rax
movl $0x0, (%rax)
xorl %r15d, %r15d
movq %r15, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %r15, 0x20(%rax)
movq (%rsi), %r14
movq 0x18(%r14), %r12
addq $0x8, %r14
cmpq %r14, %r12
je 0x1ac31
movq %r13, (%rsp)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %r13
leaq 0x28(%rsp), %rbp
cmpq $0x0, 0x18(%rsp)
je 0x1ace0
leaq 0x20(%r12), %rsi
movq %r13, %rdi
movq %rbp, %rdx
callq *0x20(%rsp)
cmpl %eax, %r15d
cmovlel %eax, %r15d
movq %r12, %rdi
callq 0x21b0
movq %rax, %r12
cmpq %r14, %rax
jne 0x1abf8
incl %r15d
movq (%rsp), %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1ad74
movq (%r13), %r13
movq 0x18(%r13), %r14
addq $0x8, %r13
cmpq %r13, %r14
je 0x1acab
leaq 0x28(%rsp), %r15
leaq 0x20(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x17950
movslq (%rax), %rax
movq (%rbx), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x1ac93
movb (%r12), %al
movb %al, (%rsi)
incq 0x8(%rdi)
jmp 0x1ac9b
movq %r12, %rdx
callq 0x1a89a
movq %r14, %rdi
callq 0x21b0
movq %rax, %r14
cmpq %r13, %rax
jne 0x1ac60
leaq 0x28(%rsp), %rdi
callq 0x176c6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1acce
leaq 0x8(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2090
jmp 0x1ad26
jmp 0x1acf0
jmp 0x1aceb
movq %rax, %r14
jmp 0x1acfb
movq %rax, %r14
movq %rbx, %rdi
callq 0x1ad2e
leaq 0x28(%rsp), %rdi
callq 0x176c6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1ad1e
leaq 0x8(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r14, %rdi
callq 0x2250
movq %rax, %rdi
callq 0x31c5