// File: /workspace/github_cpp_makefile_star2_O1/grame-cncm[P]digraph/./dglib/digraphop.hh
// Function: digraph<char, int> subgraph<char, int>(digraph<char, int> const&, std::set<char, std::less<char>, std::allocator<char>> const&)
digraph<N, A> subgraph(const digraph<N, A>& G, const std::set<N>& S)
{
    digraph<N, A> R;     // the (R)esulting graph
    std::set<N>   W{S};  // nodes (W)aiting to be processed
    std::set<N>   P;     // nodes already (P)rocessed
    while (!W.empty()) {
        std::set<N> M;  // (M)ore nodes to process at next iteration
        for (auto n : W) {
            R.add(n);     // add n to the resulting graph
            P.insert(n);  // mark n as processed
            for (const auto& a : G.connections(n)) {
                R.add(n, a.first, a.second);       // add its adjacent nodes
                if (P.find(a.first) == P.end()) {  // is it new ?
                    M.insert(a.first);             // we will have to process it
                }
            }
        }
        W = M;
    }
    return R;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r14
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
callq 0x14de0
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x5720
leaq 0x80(%rsp), %rbp
movl $0x0, (%rbp)
xorl %eax, %eax
movq %rax, 0x8(%rbp)
movq %rbp, 0x10(%rbp)
movq %rbp, 0x18(%rbp)
movq %rax, 0x20(%rbp)
cmpq %rax, 0x70(%rsp)
je 0x1665b
leaq 0x6(%rsp), %r12
leaq 0x7(%rsp), %r15
movl $0x0, 0x20(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x28(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq 0x60(%rsp), %r13
leaq 0x50(%rsp), %rax
cmpq %rax, %r13
je 0x16635
movb 0x20(%r13), %al
movb %al, 0x7(%rsp)
movq (%rbx), %r14
movb %al, 0x6(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x3e28
addq $0x30, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x177c6
leaq 0x78(%rsp), %rdi
movq %r15, %rsi
callq 0x3e28
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
movq %r15, %rsi
callq 0x17cbe
movq %rax, %r14
movq %r13, 0x10(%rsp)
movq 0x18(%rax), %r13
addq $0x8, %r14
cmpq %r14, %r13
je 0x16615
leaq 0x20(%r13), %r12
leaq 0x24(%r13), %rcx
movq (%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x176e8
movq 0x88(%rsp), %rcx
movq %rbp, %rax
testq %rcx, %rcx
je 0x165dd
movb (%r12), %dl
movq %rbp, %rax
xorl %esi, %esi
cmpb %dl, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x165c6
movq %rbp, %rcx
cmpq %rbp, %rax
je 0x165f3
movb (%r12), %cl
cmpb 0x20(%rax), %cl
cmovlq %rbp, %rax
movq %rax, %rcx
cmpq %rbp, %rcx
jne 0x16605
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x3e28
movq %r13, %rdi
callq 0x21b0
movq %rax, %r13
cmpq %r14, %rax
jne 0x16599
movq 0x10(%rsp), %rdi
callq 0x21b0
movq %rax, %r13
leaq 0x50(%rsp), %rax
cmpq %rax, %r13
leaq 0x6(%rsp), %r12
jne 0x1653a
leaq 0x48(%rsp), %rdi
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0x1a47a
movq %r14, %rdi
callq 0x39fc
cmpq $0x0, 0x70(%rsp)
jne 0x16504
leaq 0x78(%rsp), %rdi
callq 0x39fc
leaq 0x48(%rsp), %rdi
callq 0x39fc
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x166b0
jmp 0x1668f
jmp 0x1668f
jmp 0x1668f
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x39fc
leaq 0x78(%rsp), %rdi
callq 0x39fc
leaq 0x48(%rsp), %rdi
callq 0x39fc
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x166be
callq 0x35d6
movq %r14, %rdi
callq 0x2250