// File: canzarlab[P]Trajan/src/convert.cpp
// Function: main
int main(int argc, char** argv)
{
    if (argc != 4)
    {
        cout << "usage: " << argv[0] << " <input.dot> <out-dag> <out-map>" << endl;
        return EXIT_FAILURE;
    }

    graph_t graph(0);
    dynamic_properties dp(ignore_other_properties);

    property_map<graph_t, vertex_name_t>::type name =
        get(vertex_name, graph);
    dp.property("node_id", name);

    property_map<graph_t, vertex_label_t>::type vertex_label =
        get(vertex_label_t(), graph);
    dp.property("label", vertex_label);

    property_map<graph_t, edge_color_t>::type color =
        get(edge_color, graph);
    dp.property("color", color);

    property_map<graph_t, edge_label_t>::type edge_label =
        get(edge_label_t(), graph);
    dp.property("label", edge_label);

    ref_property_map<graph_t*, string> gname(get_property(graph, graph_name));
    dp.property("name", gname);

    ifstream gvgraph(argv[1]);
    if (!read_graphviz(gvgraph, graph, dp, "node_id"))
    {
        cout << "error reading dot file" << endl;
        return EXIT_FAILURE;
    }

    ofstream fdag(argv[2]);
    graph_traits<graph_t>::edge_iterator ei, ei_end;
    for (tie(ei, ei_end) = edges(graph); ei != ei_end; ++ei)
        fdag << name[target(*ei, graph)] << " " << name[source(*ei, graph)] << " default\n";

    ofstream fmap(argv[3]);
    graph_traits<graph_t>::vertex_iterator vi, vi_end;
    for (tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
    {
        string lab = vertex_label[*vi];
        size_t beg = lab.find('=') + 1;
        size_t end = lab.find('|');
        size_t len = end - beg;
        fmap << lab.substr(beg, len) << " " << name[*vi] << '\n';
    }

    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb80, %rsp            # imm = 0xB80
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x4, -0x8(%rbp)
je 0x674b
movq 0x278ca(%rip), %rdi     # 0x2dfd0
leaq 0x148f7(%rip), %rsi     # 0x1b004
callq 0x6230
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x6230
movq %rax, %rdi
leaq 0x148e1(%rip), %rsi     # 0x1b00c
callq 0x6230
movq %rax, %rdi
movq 0x2786e(%rip), %rsi     # 0x2dfa8
callq 0x62a0
movl $0x1, -0x4(%rbp)
jmp 0x737b
leaq -0x90(%rbp), %rdi
movq %rdi, -0xa78(%rbp)
callq 0x6390
movq -0xa78(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x73d0
jmp 0x6770
xorl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x7400
jmp 0x6783
leaq -0x70(%rbp), %rdi
callq 0x74a0
leaq -0x90(%rbp), %rdi
callq 0x6150
leaq 0xd21(%rip), %rsi       # 0x74c0
leaq -0x110(%rbp), %rdi
xorl %edx, %edx
callq 0x74f0
jmp 0x67af
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x7530
jmp 0x67c4
leaq -0x110(%rbp), %rdi
callq 0x7590
xorl %edi, %edi
leaq -0x48(%rbp), %rsi
callq 0x75c0
movl %edx, -0xa84(%rbp)
movq %rax, -0xa80(%rbp)
jmp 0x67ea
movl -0xa84(%rbp), %eax
movq -0xa80(%rbp), %rcx
movq %rcx, -0x130(%rbp)
movl %eax, -0x128(%rbp)
movl -0x128(%rbp), %eax
movl %eax, -0x118(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0xa90(%rbp)
callq 0x6450
movq -0xa90(%rbp), %rdx
leaq 0x147ee(%rip), %rsi     # 0x1b02d
leaq -0x150(%rbp), %rdi
callq 0x7700
jmp 0x684d
movups -0x120(%rbp), %xmm0
movaps %xmm0, -0x170(%rbp)
movq -0x170(%rbp), %rdx
movl -0x168(%rbp), %ecx
leaq -0xf0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x7600
jmp 0x687d
leaq -0x150(%rbp), %rdi
callq 0x6150
leaq -0x151(%rbp), %rdi
callq 0x62c0
leaq -0x48(%rbp), %rdi
callq 0x77b0
movq %rax, -0xa98(%rbp)
jmp 0x68a7
movq -0xa98(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0xaa0(%rbp)
callq 0x6450
movq -0xaa0(%rbp), %rdx
leaq 0x1475f(%rip), %rsi     # 0x1b035
leaq -0x1a8(%rbp), %rdi
callq 0x7700
jmp 0x68e4
movups -0x180(%rbp), %xmm0
movaps %xmm0, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x77e0
jmp 0x690e
leaq -0x1a8(%rbp), %rdi
callq 0x6150
leaq -0x1a9(%rbp), %rdi
callq 0x62c0
xorl %edi, %edi
leaq -0x48(%rbp), %rsi
callq 0x78e0
movl %eax, -0xaa4(%rbp)
jmp 0x6939
movl -0xaa4(%rbp), %eax
movl %eax, -0x1c4(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0xab0(%rbp)
callq 0x6450
movq -0xab0(%rbp), %rdx
leaq 0x146d5(%rip), %rsi     # 0x1b03b
leaq -0x1e8(%rbp), %rdi
callq 0x7700
jmp 0x6974
movl -0x1c4(%rbp), %eax
movl %eax, -0x1f0(%rbp)
movl -0x1f0(%rbp), %edx
leaq -0xf0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x7910
jmp 0x699b
leaq -0x1e8(%rbp), %rdi
callq 0x6150
leaq -0x1e9(%rbp), %rdi
callq 0x62c0
leaq -0x48(%rbp), %rdi
callq 0x7a00
jmp 0x69be
leaq -0x219(%rbp), %rdi
movq %rdi, -0xab8(%rbp)
callq 0x6450
movq -0xab8(%rbp), %rdx
leaq 0x14656(%rip), %rsi     # 0x1b035
leaq -0x218(%rbp), %rdi
callq 0x7700
jmp 0x69ed
movb -0x1f1(%rbp), %al
movb %al, -0x21a(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x7a20
jmp 0x6a0e
leaq -0x218(%rbp), %rdi
callq 0x6150
leaq -0x219(%rbp), %rdi
callq 0x62c0
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x7b10
movq %rax, -0xac0(%rbp)
jmp 0x6a3a
movq -0xac0(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x7b40
jmp 0x6a4f
leaq -0x249(%rbp), %rdi
movq %rdi, -0xac8(%rbp)
callq 0x6450
movq -0xac8(%rbp), %rdx
leaq 0x145d1(%rip), %rsi     # 0x1b041
leaq -0x248(%rbp), %rdi
callq 0x7700
jmp 0x6a7e
movq -0x228(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x7b60
jmp 0x6aa8
leaq -0x248(%rbp), %rdi
callq 0x6150
leaq -0x249(%rbp), %rdi
callq 0x62c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x460(%rbp), %rdi
movl $0x8, %edx
callq 0x6480
jmp 0x6adb
leaq -0x481(%rbp), %rdi
movq %rdi, -0xad0(%rbp)
callq 0x6450
movq -0xad0(%rbp), %rdx
leaq 0x14531(%rip), %rsi     # 0x1b02d
leaq -0x480(%rbp), %rdi
callq 0x7700
jmp 0x6b0a
leaq -0x460(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
leaq -0x480(%rbp), %rcx
callq 0x7c60
movb %al, -0xad1(%rbp)
jmp 0x6b30
movb -0xad1(%rbp), %al
xorb $-0x1, %al
movb %al, -0xad2(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x6150
leaq -0x481(%rbp), %rdi
callq 0x62c0
movb -0xad2(%rbp), %al
testb $0x1, %al
jne 0x6b65
jmp 0x6de6
movq 0x27464(%rip), %rdi     # 0x2dfd0
leaq 0x144d3(%rip), %rsi     # 0x1b046
callq 0x6230
movq %rax, -0xae0(%rbp)
jmp 0x6b81
movq -0xae0(%rbp), %rdi
movq 0x27419(%rip), %rsi     # 0x2dfa8
callq 0x62a0
jmp 0x6b96
movl $0x1, -0x4(%rbp)
movl $0x1, -0x488(%rbp)
jmp 0x7335
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6bdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x74a0
leaq -0x90(%rbp), %rdi
callq 0x6150
jmp 0x7387
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x7590
jmp 0x7370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6c6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x6150
leaq -0x151(%rbp), %rdi
callq 0x62c0
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6cb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x6150
leaq -0x1a9(%rbp), %rdi
callq 0x62c0
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6cf5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x6150
leaq -0x1e9(%rbp), %rdi
callq 0x62c0
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6d38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x6150
leaq -0x219(%rbp), %rdi
callq 0x62c0
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6d7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x6150
leaq -0x249(%rbp), %rdi
callq 0x62c0
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x6dbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x6150
leaq -0x481(%rbp), %rdi
callq 0x62c0
jmp 0x7358
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7358
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x688(%rbp), %rdi
movl $0x10, %edx
callq 0x62d0
jmp 0x6e01
leaq -0x6d0(%rbp), %rdi
callq 0x7cc0
jmp 0x6e0f
leaq -0x718(%rbp), %rdi
callq 0x7cc0
jmp 0x6e1d
leaq -0x7a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x7d10
jmp 0x6e2f
leaq -0x7b8(%rbp), %rdi
leaq -0x6d0(%rbp), %rsi
leaq -0x718(%rbp), %rdx
callq 0x7f90
jmp 0x6e4b
leaq -0x7b8(%rbp), %rdi
leaq -0x7a8(%rbp), %rsi
callq 0x7fd0
jmp 0x6e60
leaq -0x7a8(%rbp), %rdi
callq 0x8020
leaq -0x6d0(%rbp), %rdi
leaq -0x718(%rbp), %rsi
callq 0x8050
movb %al, -0xae1(%rbp)
jmp 0x6e87
movb -0xae1(%rbp), %al
testb $0x1, %al
jne 0x6e96
jmp 0x7010
leaq -0x7d0(%rbp), %rdi
leaq -0x6d0(%rbp), %rsi
callq 0x8160
jmp 0x6eab
leaq -0x7d0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x8140
movq %rax, -0xaf0(%rbp)
jmp 0x6ec4
movq -0xaf0(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x80f0
movq %rax, -0xaf8(%rbp)
jmp 0x6ee0
movq -0xaf8(%rbp), %rsi
leaq -0x688(%rbp), %rdi
callq 0x6220
movq %rax, -0xb00(%rbp)
jmp 0x6efc
movq -0xb00(%rbp), %rdi
leaq 0x144b1(%rip), %rsi     # 0x1b3bb
callq 0x6230
movq %rax, -0xb08(%rbp)
jmp 0x6f18
leaq -0x7e8(%rbp), %rdi
leaq -0x6d0(%rbp), %rsi
callq 0x8160
jmp 0x6f2d
leaq -0x7e8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x81a0
movq %rax, -0xb10(%rbp)
jmp 0x6f46
movq -0xb10(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x80f0
movq %rax, -0xb18(%rbp)
jmp 0x6f62
movq -0xb18(%rbp), %rsi
movq -0xb08(%rbp), %rdi
callq 0x6220
movq %rax, -0xb20(%rbp)
jmp 0x6f7e
movq -0xb20(%rbp), %rdi
leaq 0x140d1(%rip), %rsi     # 0x1b05d
callq 0x6230
jmp 0x6f93
jmp 0x6f95
leaq -0x6d0(%rbp), %rdi
callq 0x81c0
jmp 0x6fa3
jmp 0x6e6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7327
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x731b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x730f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x7a8(%rbp), %rdi
callq 0x8020
jmp 0x730f
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x9e8(%rbp), %rdi
movl $0x10, %edx
callq 0x62d0
jmp 0x702b
leaq -0x9f0(%rbp), %rdi
callq 0x82f0
jmp 0x7039
leaq -0x9f8(%rbp), %rdi
callq 0x82f0
jmp 0x7047
leaq -0x48(%rbp), %rdi
callq 0x8310
movq %rdx, -0xb30(%rbp)
movq %rax, -0xb28(%rbp)
jmp 0x7060
movq -0xb30(%rbp), %rax
movq -0xb28(%rbp), %rcx
movq %rcx, -0xa08(%rbp)
movq %rax, -0xa00(%rbp)
leaq -0xa18(%rbp), %rdi
leaq -0x9f0(%rbp), %rsi
leaq -0x9f8(%rbp), %rdx
callq 0x8390
jmp 0x7098
leaq -0xa18(%rbp), %rdi
leaq -0xa08(%rbp), %rsi
callq 0x83d0
jmp 0x70ad
jmp 0x70af
leaq -0x9f0(%rbp), %rdi
leaq -0x9f8(%rbp), %rsi
callq 0x8400
movb %al, -0xb31(%rbp)
jmp 0x70ca
movb -0xb31(%rbp), %al
testb $0x1, %al
jne 0x70d9
jmp 0x72c0
leaq -0x9f0(%rbp), %rdi
callq 0x8480
movq %rax, -0xb40(%rbp)
jmp 0x70ee
movq -0xb40(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0x8440
movq %rax, -0xb48(%rbp)
jmp 0x710a
movq -0xb48(%rbp), %rsi
leaq -0xa38(%rbp), %rdi
callq 0x60d0
jmp 0x711f
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0xb58(%rbp)
leaq -0xa38(%rbp), %rdi
movq %rdi, -0xb50(%rbp)
movl $0x3d, %esi
callq 0x6360
movq -0xb58(%rbp), %rdx
movq -0xb50(%rbp), %rdi
incq %rax
movq %rax, -0xa40(%rbp)
movl $0x7c, %esi
callq 0x6360
movq -0xb50(%rbp), %rsi
movq %rax, -0xa48(%rbp)
movq -0xa48(%rbp), %rax
movq -0xa40(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0xa50(%rbp)
movq -0xa40(%rbp), %rdx
movq -0xa50(%rbp), %rcx
leaq -0xa70(%rbp), %rdi
callq 0x6280
jmp 0x71a6
leaq -0x9e8(%rbp), %rdi
leaq -0xa70(%rbp), %rsi
callq 0x6220
movq %rax, -0xb60(%rbp)
jmp 0x71c2
movq -0xb60(%rbp), %rdi
leaq 0x141eb(%rip), %rsi     # 0x1b3bb
callq 0x6230
movq %rax, -0xb68(%rbp)
jmp 0x71de
leaq -0x9f0(%rbp), %rdi
callq 0x8480
movq %rax, -0xb70(%rbp)
jmp 0x71f3
movq -0xb70(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x80f0
movq %rax, -0xb78(%rbp)
jmp 0x720f
movq -0xb78(%rbp), %rsi
movq -0xb68(%rbp), %rdi
callq 0x6220
movq %rax, -0xb80(%rbp)
jmp 0x722b
movq -0xb80(%rbp), %rdi
movl $0xa, %esi
callq 0x6310
jmp 0x723e
leaq -0xa70(%rbp), %rdi
callq 0x6150
leaq -0xa38(%rbp), %rdi
callq 0x6150
leaq -0x9f0(%rbp), %rdi
callq 0x84b0
jmp 0x7264
jmp 0x70af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x7303
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x72b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xa70(%rbp), %rdi
callq 0x6150
leaq -0xa38(%rbp), %rdi
callq 0x6150
jmp 0x7303
movl $0x0, -0x4(%rbp)
movl $0x1, -0x488(%rbp)
leaq -0x9e8(%rbp), %rdi
callq 0x63c0
leaq -0x718(%rbp), %rdi
callq 0x84e0
leaq -0x6d0(%rbp), %rdi
callq 0x84e0
leaq -0x688(%rbp), %rdi
callq 0x63c0
jmp 0x7335
leaq -0x9e8(%rbp), %rdi
callq 0x63c0
leaq -0x718(%rbp), %rdi
callq 0x84e0
leaq -0x6d0(%rbp), %rdi
callq 0x84e0
leaq -0x688(%rbp), %rdi
callq 0x63c0
jmp 0x7358
leaq -0x460(%rbp), %rdi
callq 0x6080
leaq -0xf0(%rbp), %rdi
callq 0x8500
leaq -0x48(%rbp), %rdi
callq 0x8530
jmp 0x737b
leaq -0x460(%rbp), %rdi
callq 0x6080
leaq -0xf0(%rbp), %rdi
callq 0x8500
leaq -0x48(%rbp), %rdi
callq 0x8530
jmp 0x7387
movl -0x4(%rbp), %eax
addq $0xb80, %rsp            # imm = 0xB80
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x6440
nopw %cs:(%rax,%rax)
nopl (%rax)