// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x778, %rsp            # imm = 0x778
movq %rsi, %rbx
cmpl $0x4, %edi
jne 0x589b
movq %rbx, 0x8(%rsp)
leaq 0x388(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rsi
callq 0x52a0
leaq 0x10(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
xorl %esi, %esi
callq 0x5b42
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x50c0
leaq 0x378(%rsp), %rdi
callq 0x50c0
andq $0x0, (%rbx)
leaq 0x602(%rip), %rsi       # 0x5b95
leaq 0xd8(%rsp), %rdi
callq 0x6772
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x5ba0
leaq 0xd8(%rsp), %rdi
callq 0x5be6
leaq 0x6a77(%rip), %rsi      # 0xc03d
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x5c8e
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x5bf6
leaq 0xd8(%rsp), %rdi
callq 0x50c0
leaq 0x6a3d(%rip), %rsi      # 0xc045
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x5c8e
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x5cca
leaq 0xd8(%rsp), %rdi
callq 0x50c0
leaq 0x6a03(%rip), %rsi      # 0xc04b
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x5c8e
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
xorl %edx, %edx
callq 0x5d60
leaq 0xd8(%rsp), %rdi
callq 0x50c0
leaq 0x69c0(%rip), %rsi      # 0xc045
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x5c8e
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x5dfe
leaq 0xd8(%rsp), %rdi
callq 0x50c0
leaq 0x40(%rsp), %rdi
callq 0x7de6
movq %rax, %rbx
leaq 0x6984(%rip), %rsi      # 0xc051
leaq 0xd8(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x5c8e
leaq 0x68(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdx
callq 0x5e9a
leaq 0xd8(%rsp), %rdi
callq 0x50c0
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xd8(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x5360
leaq 0x6919(%rip), %rsi      # 0xc03d
leaq 0x378(%rsp), %rdi
leaq 0x578(%rsp), %rdx
callq 0x5c8e
leaq 0xd8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x378(%rsp), %rcx
callq 0x5f2f
movl %eax, %ebx
leaq 0x378(%rsp), %rdi
callq 0x50c0
testb %bl, %bl
je 0x58d8
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
leaq 0x378(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x5200
xorps %xmm0, %xmm0
movups %xmm0, 0x339(%rsp)
movaps %xmm0, 0x330(%rsp)
movups %xmm0, 0x2e9(%rsp)
movaps %xmm0, 0x2e0(%rsp)
leaq 0x578(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5f8d
leaq 0x330(%rsp), %rax
leaq 0x48(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x2e0(%rsp), %rax
movq %rax, 0x8(%rdi)
leaq 0x578(%rsp), %rsi
callq 0x600e
leaq 0x330(%rsp), %r14
leaq 0x2e0(%rsp), %r15
leaq 0x6bce(%rip), %rbp      # 0xc3cb
leaq 0x48(%rsp), %rbx
leaq 0x6864(%rip), %r12      # 0xc06d
movq %r14, %rdi
movq %r15, %rsi
callq 0x603c
testb %al, %al
je 0x58fb
leaq 0x578(%rsp), %rdi
movq %r14, %rsi
callq 0x6082
movq 0x28(%rsp), %rax
imulq $0x60, 0x580(%rsp), %rcx
leaq (%rax,%rcx), %rsi
addq $0x18, %rsi
leaq 0x378(%rsp), %rdi
callq 0x5190
movq %rax, %rdi
movq %rbp, %rsi
callq 0x51a0
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6082
movq 0x28(%rsp), %rax
imulq $0x60, 0x48(%rsp), %rcx
leaq (%rax,%rcx), %rsi
addq $0x18, %rsi
movq %r13, %rdi
callq 0x5190
movq %rax, %rdi
movq %r12, %rsi
callq 0x51a0
movq %r14, %rdi
callq 0x60a6
jmp 0x5809
movq 0x1172e(%rip), %rdi     # 0x16fd0
leaq 0x676b(%rip), %rsi      # 0xc014
callq 0x51a0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x51a0
leaq 0x675c(%rip), %rsi      # 0xc01c
movq %rax, %rdi
callq 0x51a0
movq %rax, %rdi
callq 0x50d0
pushq $0x1
popq %rbx
jmp 0x5a1e
movq 0x116f1(%rip), %rdi     # 0x16fd0
leaq 0x6770(%rip), %rsi      # 0xc056
callq 0x51a0
movq %rax, %rdi
callq 0x50d0
pushq $0x1
popq %rbx
jmp 0x59fd
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
leaq 0x578(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x5200
movq 0x30(%rsp), %rax
subq 0x28(%rsp), %rax
pushq $0x60
popq %rcx
cqto
idivq %rcx
movq %rax, %rbx
pushq $0x38
popq %rbp
leaq 0x48(%rsp), %r14
leaq 0xb8(%rsp), %r12
pushq $0xa
popq %r15
subq $0x1, %rbx
jb 0x59e1
movq 0x28(%rsp), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0x52a0
movq %r14, %rdi
pushq $0x3d
popq %rsi
xorl %edx, %edx
callq 0x5270
leaq 0x1(%rax), %r13
movq %r14, %rdi
pushq $0x7c
popq %rsi
xorl %edx, %edx
callq 0x5270
subq %r13, %rax
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x51e0
leaq 0x578(%rsp), %rdi
movq %r12, %rsi
callq 0x5190
movq %rax, %rdi
leaq 0x6a28(%rip), %rsi      # 0xc3cb
callq 0x51a0
movq 0x28(%rsp), %rcx
leaq (%rcx,%rbp), %rsi
addq $-0x20, %rsi
movq %rax, %rdi
callq 0x5190
movq %rax, %rdi
movl %r15d, %esi
callq 0x5220
movq %r12, %rdi
callq 0x50c0
movq %r14, %rdi
callq 0x50c0
addq $0x60, %rbp
jmp 0x593d
leaq 0x578(%rsp), %rdi
callq 0x52d0
leaq 0x378(%rsp), %rdi
callq 0x52d0
xorl %ebx, %ebx
leaq 0xd8(%rsp), %rdi
callq 0x5060
leaq 0x68(%rsp), %rdi
callq 0x613e
leaq 0x10(%rsp), %rdi
callq 0x6154
movl %ebx, %eax
addq $0x778, %rsp            # imm = 0x778
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5ae0
jmp 0x5ae0
jmp 0x5ae0
jmp 0x5a5a
jmp 0x5a5a
movq %rax, %rbx
leaq 0x378(%rsp), %rdi
callq 0x50c0
jmp 0x5b19
movq %rax, %rbx
jmp 0x5b19
jmp 0x5a89
jmp 0x5a74
jmp 0x5a89
jmp 0x5a74
jmp 0x5a89
jmp 0x5a74
jmp 0x5a89
jmp 0x5a74
jmp 0x5a89
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x50c0
jmp 0x5b26
movq %rax, %rbx
jmp 0x5b26
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x5be6
jmp 0x5b30
movq %rax, %rbx
jmp 0x5b30
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x50c0
jmp 0x5ac3
movq %rax, %rbx
leaq 0x378(%rsp), %rdi
callq 0x50c0
jmp 0x5b3a
movq %rax, %rbx
jmp 0x5aff
movq %rax, %rbx
jmp 0x5af5
jmp 0x5ae0
jmp 0x5ae0
movq %rax, %rbx
jmp 0x5b0c
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x50c0
leaq 0x48(%rsp), %rdi
callq 0x50c0
leaq 0x578(%rsp), %rdi
callq 0x52d0
leaq 0x378(%rsp), %rdi
callq 0x52d0
leaq 0xd8(%rsp), %rdi
callq 0x5060
leaq 0x68(%rsp), %rdi
callq 0x613e
leaq 0x10(%rsp), %rdi
callq 0x6154
movq %rbx, %rdi
callq 0x5330