// File: /workspace/github_cpp_makefile_star2_O1/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
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movq %rsi, (%rax)
movq %rax, 0x8(%rax)
leaq 0x246(%rip), %rcx       # 0x1ad7e
movq %rcx, 0x18(%rax)
leaq 0x241(%rip), %rcx       # 0x1ad84
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 0x1abc5
movq %r13, 0x20(%rsp)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rsp, %r13
leaq 0x28(%rsp), %rbp
cmpq $0x0, 0x10(%rsp)
je 0x1ac6f
leaq 0x20(%r12), %rsi
movq %r13, %rdi
movq %rbp, %rdx
callq *0x18(%rsp)
cmpl %eax, %r15d
cmovlel %eax, %r15d
movq %r12, %rdi
callq 0x21b0
movq %rax, %r12
cmpq %r14, %rax
jne 0x1ab88
incl %r15d
movq 0x20(%rsp), %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1acfc
movq (%r13), %r13
movq 0x18(%r13), %r14
addq $0x8, %r13
cmpq %r13, %r14
je 0x1ac3c
leaq 0x28(%rsp), %r15
leaq 0x20(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x1782a
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 0x1ac24
movb (%r12), %al
movb %al, (%rsi)
incq 0x8(%rdi)
jmp 0x1ac2c
movq %r12, %rdx
callq 0x1a7c6
movq %r14, %rdi
callq 0x21b0
movq %rax, %r14
cmpq %r13, %rax
jne 0x1abf1
leaq 0x28(%rsp), %rdi
callq 0x175a0
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x1ac5d
movq %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 0x1acb3
jmp 0x1ac7f
jmp 0x1ac7a
movq %rax, %r14
jmp 0x1ac8a
movq %rax, %r14
movq %rbx, %rdi
callq 0x1acbc
leaq 0x28(%rsp), %rdi
callq 0x175a0
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x1acab
movq %rsp, %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r14, %rdi
callq 0x2250
movq %rax, %rdi
callq 0x329c
nop