// File: /workspace/github_cpp_makefile_star2_O2/ALSchwalm[P]entrospy/entrospy/graph.cpp
// Function: operator<<(std::ostream&, EntropyGraph const&)
std::ostream& operator<<(std::ostream& out, const EntropyGraph& graph) {
    out << boost::format("set term qt noenhanced size 1024, 768\n"
                         "set title '%1%'\n"
                         "set grid\n"
                         "set xlabel 'address'\n"
                         "set ylabel 'entropy'\n"
                         "set xtics rotate by -30\n"
                         "set format x '%%.0f'\n"
                         "set style line 1 lc rgb '#A0A0A0' lt 0 lw 2\n"
                         "set grid back ls 1\n") %
               graph.m_title;

    std::vector<std::string> points_cfg;
    uint64_t max_file_size = 0;
    for (const auto& pv : graph.m_scores) {
        const auto& path = pv.first;
        auto file_size = boost::filesystem::file_size(path);
        if (file_size > max_file_size) {
            max_file_size = file_size;
        }

        std::string p =
            boost::str(boost::format("'-' title '%1%' with points") % path);
        points_cfg.emplace_back(p);
    }

    out << boost::format("plot [0:%1%] [0:1] %2%") % max_file_size %
               boost::algorithm::join(points_cfg, ", ");
    out << "\n";

    for (const auto& pv : graph.m_scores) {
        const auto& scores = pv.second;
        for (const auto& score : scores) {
            auto position = score.first;
            double value = score.second;

            out << position << " " << value << "\n";
        }
        out << "e\n";
    }
    out << "quit\n";
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4305(%rip), %rsi      # 0x16d3d
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x99b6
movq %r14, %rdi
movq %r15, 0x8(%rsp)
movq %r15, %rsi
callq 0x1156b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x12d49
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x9c02
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq 0x60(%rax), %rbp
addq $0x50, %rax
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %r14
cmpq 0x18(%rsp), %rbp
je 0x12b25
leaq 0x20(%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x8540
movq %r15, %rdi
callq 0x12e64
movq %rax, %r12
movq %r15, %rdi
callq 0x87d8
cmpq 0x10(%rsp), %r12
jbe 0x12ad3
movq %r12, 0x10(%rsp)
movq %r15, %rdi
leaq 0x4336(%rip), %rsi      # 0x16e13
callq 0x99b6
movq %r15, %rdi
movq %r13, %rsi
callq 0x1156b
movq %r14, %rdi
movq %rax, %rsi
callq 0x124e8
movq %r15, %rdi
callq 0x9c02
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x12e6c
movq %r14, %rdi
callq 0x87d8
movq %rbp, %rdi
callq 0x8440
movq %rax, %rbp
jmp 0x12a9a
leaq 0x4303(%rip), %rsi      # 0x16e2f
leaq 0x58(%rsp), %rdi
callq 0x99b6
leaq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x122f0
movq %rax, %r14
leaq 0x2aab(%rip), %rdx      # 0x155fa
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x9aa2
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0x1156b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x12d49
leaq 0x38(%rsp), %rdi
callq 0x87d8
leaq 0x58(%rsp), %rdi
callq 0x9c02
leaq 0x4280(%rip), %rsi      # 0x16e11
movq %rbx, %rdi
callq 0x83b0
movq 0x8(%rsp), %rax
movq 0x60(%rax), %r12
leaq 0x47c9(%rip), %r15      # 0x17372
leaq 0x4261(%rip), %r13      # 0x16e11
cmpq 0x18(%rsp), %r12
je 0x12c23
movq 0x40(%r12), %rbp
movq 0x48(%r12), %r14
cmpq %r14, %rbp
je 0x12c07
movq (%rbp), %rsi
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x8390
movq %rax, %rdi
movq %r15, %rsi
callq 0x83b0
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x8630
movq %rax, %rdi
movq %r13, %rsi
callq 0x83b0
addq $0x18, %rbp
jmp 0x12bc1
movq %rbx, %rdi
leaq 0x4235(%rip), %rsi      # 0x16e46
callq 0x83b0
movq %r12, %rdi
callq 0x8440
movq %rax, %r12
jmp 0x12bb0
leaq 0x421f(%rip), %rsi      # 0x16e49
movq %rbx, %rdi
callq 0x83b0
leaq 0x20(%rsp), %rdi
callq 0x9cf2
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12c96
jmp 0x12c96
jmp 0x12ca5
jmp 0x12ca5
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x87d8
jmp 0x12c99
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x9c02
jmp 0x12cb2
jmp 0x12ca5
jmp 0x12ca5
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x12c8f
jmp 0x12ca5
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x87d8
jmp 0x12ca8
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x9c02
jmp 0x12ca8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9cf2
movq %rbx, %rdi
callq 0x86f0