// File: xnevs[P]bullimp/examples/simple.cpp
// Function: main
int main() { 
    using namespace boost;
    using namespace ullimp;

    graph_type pattern;
    auto u0 = add_vertex(pattern);
    auto u1 = add_vertex(pattern);
    auto u2 = add_vertex(pattern);
    add_edge(u0, u1, pattern);
    add_edge(u1, u2, pattern);
    add_edge(u2, u0, pattern);

    graph_type graph;
    auto v0 = add_vertex(graph);
    auto v1 = add_vertex(graph);
    auto v2 = add_vertex(graph);
    auto v3 = add_vertex(graph);
    add_edge(v0, v1, graph);
    add_edge(v1, v2, graph);
    add_edge(v2, v0, graph);
    add_edge(v1, v3, graph);
    add_edge(v3, v0, graph);

    auto index_map_p = get(vertex_index, pattern);
    auto index_map_g = get(vertex_index, graph);

    int count = 0;
    ullimp_subgraph_iso(pattern,
                        graph,
                        [&count, &pattern, &index_map_p, &index_map_g](auto const & iso, auto const & isoInv) {
                            std::cout << "found isomorphism:" << std::endl;
                            BGL_FORALL_VERTICES(u, pattern, graph_type) {
                                std::cout << "  " << index_map_p[u] << " -> " << index_map_g[iso[u]] << std::endl;
                            }
                            ++count;
                            return true;
                        });

    std::cout << "isomorphism count = " << count << std::endl;
}

// Assembly:
subq $0x268, %rsp            # imm = 0x268
leaq 0x230(%rsp), %rdi
movq %rdi, 0x68(%rsp)
leaq 0x22f(%rsp), %rsi
callq 0x5d90
movq 0x68(%rsp), %rdi
callq 0x5e00
movq %rax, 0x70(%rsp)
jmp 0x23f2
movq 0x70(%rsp), %rax
movq %rax, 0x220(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x5e00
movq %rax, 0x60(%rsp)
jmp 0x2413
movq 0x60(%rsp), %rax
movq %rax, 0x208(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x5e00
movq %rax, 0x58(%rsp)
jmp 0x2434
movq 0x58(%rsp), %rax
movq %rax, 0x200(%rsp)
movq 0x220(%rsp), %rsi
movq 0x208(%rsp), %rdx
leaq 0x1e0(%rsp), %rdi
leaq 0x230(%rsp), %rcx
callq 0x5e80
jmp 0x2468
movq 0x208(%rsp), %rsi
movq 0x200(%rsp), %rdx
leaq 0x1c0(%rsp), %rdi
leaq 0x230(%rsp), %rcx
callq 0x5e80
jmp 0x248f
movq 0x200(%rsp), %rsi
movq 0x220(%rsp), %rdx
leaq 0x1a0(%rsp), %rdi
leaq 0x230(%rsp), %rcx
callq 0x5e80
jmp 0x24b6
leaq 0x168(%rsp), %rdi
leaq 0x167(%rsp), %rsi
callq 0x5d90
jmp 0x24cd
leaq 0x168(%rsp), %rdi
callq 0x5e00
movq %rax, 0x50(%rsp)
jmp 0x24e1
movq 0x50(%rsp), %rax
movq %rax, 0x158(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x5e00
movq %rax, 0x48(%rsp)
jmp 0x2502
movq 0x48(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x5e00
movq %rax, 0x40(%rsp)
jmp 0x2523
movq 0x40(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x5e00
movq %rax, 0x38(%rsp)
jmp 0x2544
movq 0x38(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x158(%rsp), %rsi
movq 0x150(%rsp), %rdx
leaq 0x120(%rsp), %rdi
leaq 0x168(%rsp), %rcx
callq 0x5e80
jmp 0x2578
movq 0x150(%rsp), %rsi
movq 0x148(%rsp), %rdx
leaq 0x100(%rsp), %rdi
leaq 0x168(%rsp), %rcx
callq 0x5e80
jmp 0x259f
movq 0x148(%rsp), %rsi
movq 0x158(%rsp), %rdx
leaq 0xe0(%rsp), %rdi
leaq 0x168(%rsp), %rcx
callq 0x5e80
jmp 0x25c6
movq 0x150(%rsp), %rsi
movq 0x140(%rsp), %rdx
leaq 0xc0(%rsp), %rdi
leaq 0x168(%rsp), %rcx
callq 0x5e80
jmp 0x25ed
movq 0x140(%rsp), %rsi
movq 0x158(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
leaq 0x168(%rsp), %rcx
callq 0x5e80
jmp 0x2614
xorl %edi, %edi
leaq 0x230(%rsp), %rsi
callq 0x5ec0
jmp 0x2625
xorl %edi, %edi
leaq 0x168(%rsp), %rsi
callq 0x5ec0
jmp 0x2636
movl $0x0, 0x98(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x230(%rsp), %rdi
movq %rdi, 0x80(%rsp)
leaq 0x9f(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x9d(%rsp), %rax
movq %rax, 0x90(%rsp)
vmovdqu 0x78(%rsp), %ymm0
movq %rsp, %rax
vmovdqu %ymm0, (%rax)
leaq 0x168(%rsp), %rsi
vzeroupper
callq 0x2760
jmp 0x269d
movq 0x17934(%rip), %rdi     # 0x19fd8
leaq 0xf959(%rip), %rsi      # 0x12004
callq 0x2110
movq %rax, 0x30(%rsp)
jmp 0x26b7
movq 0x30(%rsp), %rdi
movl 0x98(%rsp), %esi
callq 0x21f0
movq %rax, 0x28(%rsp)
jmp 0x26cf
movq 0x28(%rsp), %rdi
movq 0x178ed(%rip), %rsi     # 0x19fc8
callq 0x2150
jmp 0x26e2
leaq 0x168(%rsp), %rdi
callq 0x5ee0
leaq 0x230(%rsp), %rdi
callq 0x5ee0
xorl %eax, %eax
addq $0x268, %rsp            # imm = 0x268
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x218(%rsp)
movl %eax, 0x214(%rsp)
jmp 0x273d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x218(%rsp)
movl %eax, 0x214(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x5ee0
leaq 0x230(%rsp), %rdi
callq 0x5ee0
movq 0x218(%rsp), %rdi
callq 0x2200
nopw (%rax,%rax)