// File: xnevs[P]bullimp/examples/compare.cpp
// Function: main
int main(int argc, char *argv[]) { 
    using namespace std;

    if(argc < 2) {
        cout << "Usage: ./compare test.AXX test.BXX" << endl;
        return 1;
    }

    ifstream in{argv[1], ios::in|ios::binary};
    if(!in.is_open()) return -1;

    auto pattern = read_amalfi<graph_type>(in);
    in.close();

    in.open(argv[2], ios::in|ios::binary);
    if(!in.is_open()) return -1;

    auto graph = read_amalfi<graph_type>(in);
    in.close();

    int count;
    chrono::time_point<chrono::steady_clock> start, end;
    chrono::milliseconds elapsed;

    count = 0;

    start = chrono::steady_clock::now();

    ullimp::ullimp_subgraph_iso(
            pattern,
            graph,
            [&count](auto const &a, auto const &b){
                ++count;
                return true;
            });

    end = chrono::steady_clock::now();
    elapsed = chrono::duration_cast<chrono::milliseconds>(end - start);

    cout << setw(8) << "ullimp: " << count << ", " << "time = " << elapsed.count() << " ms" << endl;


    count = 0;

    start = chrono::steady_clock::now();

    boost::vf2_subgraph_iso(
            pattern,
            graph,
            [&count](auto const &a, auto const &b){
                ++count;
                return true;
            });

    end = chrono::steady_clock::now();
    elapsed = chrono::duration_cast<chrono::milliseconds>(end - start);

    cout << setw(8) << "vf2: " << count << ", " << "time = " << elapsed.count() << " ms" << endl;
}

// Assembly:
subq $0x3f8, %rsp            # imm = 0x3F8
movl $0x0, 0x3f4(%rsp)
movl %edi, 0x3f0(%rsp)
movq %rsi, 0x3e8(%rsp)
cmpl $0x2, 0x3f0(%rsp)
jge 0x24ed
movq 0x22b16(%rip), %rdi     # 0x24fd8
leaq 0x18b3b(%rip), %rsi     # 0x1b004
callq 0x2140
movq %rax, %rdi
movq 0x22af0(%rip), %rsi     # 0x24fc8
callq 0x2180
movl $0x1, 0x3f4(%rsp)
jmp 0x2a5d
movq 0x3e8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd0(%rsp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x7c00
movq 0xd0(%rsp), %rsi
movl %eax, %edx
leaq 0x1e0(%rsp), %rdi
movq %rdi, 0xd8(%rsp)
callq 0x22a0
movq 0xd8(%rsp), %rdi
callq 0x2220
movb %al, 0xe3(%rsp)
jmp 0x2545
movb 0xe3(%rsp), %al
testb $0x1, %al
jne 0x2586
jmp 0x2552
movl $0xffffffff, 0x3f4(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1d0(%rsp)
jmp 0x2a50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
jmp 0x2a9a
leaq 0x198(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x7c20
jmp 0x259d
leaq 0x1e0(%rsp), %rdi
callq 0x2070
jmp 0x25ac
movq 0x3e8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc0(%rsp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x7c00
movl %eax, 0xcc(%rsp)
jmp 0x25d8
movl 0xcc(%rsp), %edx
movq 0xc0(%rsp), %rsi
leaq 0x1e0(%rsp), %rdi
callq 0x20f0
jmp 0x25f6
leaq 0x1e0(%rsp), %rdi
callq 0x2220
movb %al, 0xbf(%rsp)
jmp 0x260c
movb 0xbf(%rsp), %al
testb $0x1, %al
jne 0x264d
jmp 0x2619
movl $0xffffffff, 0x3f4(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1d0(%rsp)
jmp 0x2a43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
jmp 0x2a8d
leaq 0x160(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x7c20
jmp 0x2664
leaq 0x1e0(%rsp), %rdi
callq 0x2070
jmp 0x2673
leaq 0x150(%rsp), %rdi
callq 0x7d40
jmp 0x2682
leaq 0x148(%rsp), %rdi
callq 0x7d40
jmp 0x2691
movl $0x0, 0x15c(%rsp)
callq 0x21e0
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x15c(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x130(%rsp), %rdx
leaq 0x198(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x2ac0
jmp 0x26e8
callq 0x21e0
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x7da0
movq %rax, 0xb0(%rsp)
jmp 0x2724
movq 0xb0(%rsp), %rax
movq %rax, 0x118(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x7d70
movq %rax, 0xa8(%rsp)
jmp 0x274b
movq 0xa8(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x140(%rsp)
movl $0x8, %edi
callq 0x7df0
movl %eax, 0xa4(%rsp)
jmp 0x277e
movl 0xa4(%rsp), %eax
movl %eax, 0x114(%rsp)
movl 0x114(%rsp), %esi
movq 0x2283e(%rip), %rdi     # 0x24fd8
callq 0x21a0
movq %rax, 0x98(%rsp)
jmp 0x27a9
movq 0x98(%rsp), %rdi
leaq 0x1886f(%rip), %rsi     # 0x1b027
callq 0x2140
movq %rax, 0x90(%rsp)
jmp 0x27c7
movq 0x90(%rsp), %rdi
movl 0x15c(%rsp), %esi
callq 0x2260
movq %rax, 0x88(%rsp)
jmp 0x27e5
movq 0x88(%rsp), %rdi
leaq 0x1883c(%rip), %rsi     # 0x1b030
callq 0x2140
movq %rax, 0x80(%rsp)
jmp 0x2803
movq 0x80(%rsp), %rdi
leaq 0x18821(%rip), %rsi     # 0x1b033
callq 0x2140
movq %rax, 0x78(%rsp)
jmp 0x281e
leaq 0x140(%rsp), %rdi
callq 0x7e10
movq %rax, 0x70(%rsp)
jmp 0x2832
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x2290
movq %rax, 0x68(%rsp)
jmp 0x2848
movq 0x68(%rsp), %rdi
leaq 0x187e7(%rip), %rsi     # 0x1b03b
callq 0x2140
movq %rax, 0x60(%rsp)
jmp 0x2860
movq 0x60(%rsp), %rdi
movq 0x2275c(%rip), %rsi     # 0x24fc8
callq 0x2180
jmp 0x2873
movl $0x0, 0x15c(%rsp)
callq 0x21e0
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x15c(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdx
leaq 0x198(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x2b90
jmp 0x28ca
callq 0x21e0
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x7da0
movq %rax, 0x58(%rsp)
jmp 0x2903
movq 0x58(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x7d70
movq %rax, 0x50(%rsp)
jmp 0x2924
movq 0x50(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x140(%rsp)
movl $0x8, %edi
callq 0x7df0
movl %eax, 0x4c(%rsp)
jmp 0x2951
movl 0x4c(%rsp), %eax
movl %eax, 0xe4(%rsp)
movl 0xe4(%rsp), %esi
movq 0x2266e(%rip), %rdi     # 0x24fd8
callq 0x21a0
movq %rax, 0x40(%rsp)
jmp 0x2976
movq 0x40(%rsp), %rdi
leaq 0x186bd(%rip), %rsi     # 0x1b03f
callq 0x2140
movq %rax, 0x38(%rsp)
jmp 0x298e
movq 0x38(%rsp), %rdi
movl 0x15c(%rsp), %esi
callq 0x2260
movq %rax, 0x30(%rsp)
jmp 0x29a6
movq 0x30(%rsp), %rdi
leaq 0x1867e(%rip), %rsi     # 0x1b030
callq 0x2140
movq %rax, 0x28(%rsp)
jmp 0x29be
movq 0x28(%rsp), %rdi
leaq 0x18669(%rip), %rsi     # 0x1b033
callq 0x2140
movq %rax, 0x20(%rsp)
jmp 0x29d6
leaq 0x140(%rsp), %rdi
callq 0x7e10
movq %rax, 0x18(%rsp)
jmp 0x29ea
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x2290
movq %rax, 0x10(%rsp)
jmp 0x2a00
movq 0x10(%rsp), %rdi
leaq 0x1862f(%rip), %rsi     # 0x1b03b
callq 0x2140
movq %rax, 0x8(%rsp)
jmp 0x2a18
movq 0x8(%rsp), %rdi
movq 0x225a4(%rip), %rsi     # 0x24fc8
callq 0x2180
jmp 0x2a2b
leaq 0x160(%rsp), %rdi
callq 0x7e20
movl $0x0, 0x1d0(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x7e20
leaq 0x1e0(%rsp), %rdi
callq 0x2080
movl 0x3f4(%rsp), %eax
addq $0x3f8, %rsp            # imm = 0x3F8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x7e20
leaq 0x198(%rsp), %rdi
callq 0x7e20
leaq 0x1e0(%rsp), %rdi
callq 0x2080
movq 0x1d8(%rsp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)