// File: /workspace/github_cpp_makefile_star2_O3/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 0x14ee8
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x5618
leaq 0x80(%rsp), %r12
movl $0x0, (%r12)
xorl %eax, %eax
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
cmpq %rax, 0x40(%rsp)
je 0x16769
leaq 0x48(%rsp), %r15
leaq 0x7(%rsp), %r13
movl $0x0, 0x50(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x58(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movq %rcx, 0x70(%rsp)
movq 0x30(%rsp), %rbp
leaq 0x20(%rsp), %rax
cmpq %rax, %rbp
je 0x16748
movb 0x20(%rbp), %al
movb %al, 0x6(%rsp)
movq (%rbx), %r14
movb %al, 0x7(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x3d48
addq $0x30, %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x178ea
leaq 0x78(%rsp), %rdi
leaq 0x6(%rsp), %rsi
callq 0x3d48
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
leaq 0x6(%rsp), %rsi
callq 0x17ddc
movq %rax, %r14
movq %rbp, 0x10(%rsp)
movq 0x18(%rax), %r13
addq $0x8, %r14
cmpq %r14, %r13
je 0x16728
leaq 0x20(%r13), %rbp
leaq 0x24(%r13), %rcx
movq (%rbx), %rdi
leaq 0x6(%rsp), %rsi
movq %rbp, %rdx
callq 0x1781e
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x1670d
movb (%rbp), %al
movq %r12, %r8
movq %r8, %rcx
movq %rdi, %rdx
movb 0x20(%rdi), %sil
xorl %edi, %edi
cmpb %al, %sil
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x166d8
cmpq %r12, %r8
je 0x1670d
cmpb %al, %sil
cmovlq %rcx, %rdx
cmpb 0x20(%rdx), %al
jge 0x16718
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3d48
movq %r13, %rdi
callq 0x21b0
movq %rax, %r13
cmpq %r14, %rax
jne 0x166ad
movq 0x10(%rsp), %rdi
callq 0x21b0
movq %rax, %rbp
leaq 0x20(%rsp), %rax
cmpq %rax, %rbp
leaq 0x7(%rsp), %r13
jne 0x1664b
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x1a562
movq %r15, %rdi
callq 0x3934
cmpq $0x0, 0x40(%rsp)
jne 0x16615
leaq 0x78(%rsp), %rdi
callq 0x3934
leaq 0x18(%rsp), %rdi
callq 0x3934
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x167be
jmp 0x1679d
jmp 0x1679d
jmp 0x1679d
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x3934
leaq 0x78(%rsp), %rdi
callq 0x3934
leaq 0x18(%rsp), %rdi
callq 0x3934
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x167cc
callq 0x3504
movq %r14, %rdi
callq 0x2250