// File: /workspace/github_cpp_makefile_star2_O3/grame-cncm[P]digraph/./dglib/digraphop.hh
// Function: digraph<digraph<char, int>, int> mapnodes<digraph<char, int>, digraph<char, int>, int>(digraph<digraph<char, int>, int> const&, std::function<digraph<char, int> (digraph<char, int> const&)>)
inline digraph<M, A> mapnodes(const digraph<N, A>& g, std::function<M(const N&)> foo)
{
    digraph<M, A>  r;
    std::map<N, M> cache;
    // create a new graph with the transformed nodes
    for (const auto& n1 : g.nodes()) {
        M n2 = foo(n1);
        r.add(n2);
        cache.insert(std::make_pair(n1, n2));
    }

    // copy the connections
    for (const auto& n : g.nodes()) {
        for (const auto& cnx : g.connections(n)) {
            r.add(cache[n], cache[cnx.first], cnx.second);
        }
    }
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
callq 0x187e0
leaq 0x60(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, (%rsp)
movq (%r14), %rcx
movq 0x18(%rcx), %rax
leaq 0x8(%rcx), %r15
movq %rax, %r13
cmpq %r15, %rax
je 0x1558a
leaq 0x38(%rsp), %rbp
cmpq $0x0, 0x10(%r12)
je 0x1563f
leaq 0x20(%r13), %r14
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *0x18(%r12)
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x15503
movq 0x12ad3(%rip), %rcx     # 0x27fc8
cmpb $0x0, (%rcx)
je 0x154ff
incl 0x8(%rax)
jmp 0x15503
lock
incl 0x8(%rax)
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
callq 0x18832
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1551f
callq 0x3504
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x8(%rsp), %rdx
callq 0x19a86
leaq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x198d4
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1554b
callq 0x3504
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1555a
callq 0x3504
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x15569
callq 0x3504
movq %r13, %rdi
callq 0x21b0
movq %rax, %r13
cmpq %r15, %rax
jne 0x154b5
movq (%rsp), %rax
movq (%rax), %rcx
movq 0x18(%rcx), %rax
jmp 0x1558d
movq %r13, %rax
addq $0x8, %rcx
cmpq %rcx, %rax
je 0x15620
leaq 0x58(%rsp), %r12
movq %rcx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
leaq 0x20(%rax), %r13
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
movq %r13, %rsi
callq 0x19698
movq %rax, %rbp
movq 0x18(%rax), %r14
addq $0x8, %rbp
cmpq %rbp, %r14
je 0x1560c
movq %r12, %rdi
movq %r13, %rsi
callq 0x1986e
movq %rax, %r15
leaq 0x20(%r14), %rsi
movq %r12, %rdi
callq 0x1986e
leaq 0x30(%r14), %rcx
movq (%rbx), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x19240
movq %r14, %rdi
callq 0x21b0
movq %rax, %r14
cmpq %rbp, %rax
jne 0x155d0
movq 0x30(%rsp), %rdi
callq 0x21b0
movq 0x28(%rsp), %rcx
cmpq %rcx, %rax
jne 0x155a4
leaq 0x58(%rsp), %rdi
callq 0x19cf4
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2090
jmp 0x1567c
jmp 0x1567c
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x15669
callq 0x3504
jmp 0x15669
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x1984a
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1567f
callq 0x3504
jmp 0x1567f
jmp 0x1567c
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x19cf4
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x15697
callq 0x3504
movq %r14, %rdi
callq 0x2250
nop