// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x430c(%rip), %rsi      # 0x19cdc
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0xa212
leaq 0x8(%rsp), %rsi
movq %r12, (%rsi)
leaq -0x9ed(%rip), %rax      # 0x14fff
movq %rax, 0x8(%rsi)
leaq -0x9f7(%rip), %rax      # 0x15000
movq %rax, 0x10(%rsi)
movq %r14, %rdi
callq 0x13f9c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x16003
cmpb $0x1, 0x140(%rsp)
jne 0x15a2d
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0x8560
movb $0x0, -0x8(%r14)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xa6d4
movq -0x28(%r14), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15a53
callq 0x8370
movq %rbx, 0x38(%rsp)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15a92
callq 0x8370
xorl %eax, %eax
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0x70(%rsp), %rdi
callq 0xa728
xorl %r14d, %r14d
movq %r14, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq %r14, 0x30(%rsp)
movq 0x60(%r12), %r15
movq %r12, 0x28(%rsp)
leaq 0x50(%r12), %rbx
cmpq %rbx, %r15
je 0x15c34
leaq 0x70(%rsp), %rbp
leaq 0x8(%rsp), %r13
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0xabea
movq %rbp, %rdi
xorl %esi, %esi
callq 0x8520
movq %rax, %r12
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x15b17
callq 0x8370
cmpq 0x30(%rsp), %r12
jbe 0x15b23
movq %r12, 0x30(%rsp)
movq %rbp, %rdi
leaq 0x4285(%rip), %rsi      # 0x19db2
callq 0xa212
leaq 0x20(%r15), %rax
movq %rax, 0x150(%rsp)
leaq -0xb46(%rip), %rax      # 0x14fff
movq %rax, 0x158(%rsp)
leaq -0xb54(%rip), %rax      # 0x15000
movq %rax, 0x160(%rsp)
movq %rbp, %rdi
leaq 0x150(%rsp), %rsi
callq 0x13f9c
movq %r13, %rdi
movq %rax, %rsi
callq 0x152fc
cmpb $0x1, 0x140(%rsp)
jne 0x15b96
leaq 0x148(%rsp), %rdi
callq 0x8560
movb $0x0, 0x140(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0xa6d4
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15bbd
callq 0x8370
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15bf7
callq 0x8370
movq %r14, 0x88(%rsp)
movl %r14d, 0x90(%rsp)
movq %r14, 0x98(%rsp)
movl %r14d, 0xa0(%rsp)
movq %r14, 0xa8(%rsp)
movq %rbp, %rdi
callq 0xa728
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x16162
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15c20
callq 0x8370
movq %r15, %rdi
callq 0x8440
movq %rax, %r15
cmpq %rbx, %rax
jne 0x15ad3
leaq 0x4193(%rip), %rsi      # 0x19dce
leaq 0x70(%rsp), %rdi
callq 0xa212
leaq 0x30(%rsp), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
leaq -0xc4a(%rip), %rax      # 0x1500f
movq %rax, 0x8(%r14)
leaq -0xc54(%rip), %rax      # 0x15010
movq %rax, 0x10(%r14)
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x13f9c
movq 0x40(%rsp), %rbp
movq 0x48(%rsp), %r15
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
cmpq %r15, %rbp
movq %rax, 0x60(%rsp)
je 0x15cb7
movq (%rbp), %rcx
movq 0x8(%rbp), %r8
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8410
addq $0x20, %rbp
cmpq %r15, %rbp
je 0x15d00
leaq 0x2967(%rip), %r12      # 0x1862a
leaq 0x8(%rsp), %r13
movq 0x10(%rsp), %rsi
movl $0x2, %r8d
movq %r13, %rdi
xorl %edx, %edx
movq %r12, %rcx
callq 0x8410
movq 0x10(%rsp), %rsi
movq (%rbp), %rcx
movq 0x8(%rbp), %r8
movq %r13, %rdi
xorl %edx, %edx
callq 0x8410
addq $0x20, %rbp
cmpq %r15, %rbp
jne 0x15cc8
leaq 0x150(%rsp), %rsi
movq %r14, (%rsi)
leaq -0xd13(%rip), %rax      # 0x14fff
movq %rax, 0x8(%rsi)
leaq -0xd1d(%rip), %rax      # 0x15000
movq %rax, 0x10(%rsi)
movq 0x60(%rsp), %rdi
callq 0x13f9c
movq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
callq 0x16003
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15d4f
callq 0x8370
cmpb $0x1, 0x140(%rsp)
jne 0x15d6e
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0x8560
movb $0x0, -0x8(%r14)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xa6d4
movq -0x28(%r14), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15d94
callq 0x8370
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15dce
callq 0x8370
xorl %eax, %eax
movq %rax, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0x70(%rsp), %rdi
callq 0xa728
leaq 0x3fd1(%rip), %rsi      # 0x19db0
movl $0x1, %edx
movq %rbp, %rdi
callq 0x8420
movq 0x28(%rsp), %rax
movq 0x60(%rax), %r14
cmpq %rbx, %r14
je 0x15ea1
leaq 0x450d(%rip), %r12      # 0x1a312
leaq 0x3fa4(%rip), %r13      # 0x19db0
movq %rbx, 0x68(%rsp)
movq 0x40(%r14), %r15
movq 0x48(%r14), %rbx
cmpq %rbx, %r15
je 0x15e74
movq (%r15), %rsi
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbp, %rdi
callq 0x8380
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x8420
movq %rbp, %rdi
movsd 0x28(%rsp), %xmm0
callq 0x85f0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x8420
addq $0x18, %r15
cmpq %rbx, %r15
movq 0x38(%rsp), %rbp
jne 0x15e1e
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x3f62(%rip), %rsi      # 0x19de5
callq 0x8420
movq %r14, %rdi
callq 0x8440
movq %rax, %r14
movq 0x68(%rsp), %rbx
cmpq %rbx, %rax
jne 0x15e11
leaq 0x3f40(%rip), %rsi      # 0x19de8
movl $0x5, %edx
movq %rbp, %rdi
callq 0x8420
leaq 0x40(%rsp), %rdi
callq 0xa578
movq %rbp, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15f20
jmp 0x15f39
jmp 0x15f48
jmp 0x15f48
jmp 0x15f20
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xa47c
jmp 0x15f55
jmp 0x15f48
jmp 0x15f48
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
jmp 0x15f12
jmp 0x15f48
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15f4b
callq 0x8370
jmp 0x15f4b
jmp 0x15f20
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15f3c
callq 0x8370
jmp 0x15f3c
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xa47c
jmp 0x15f4b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa578
movq %rbx, %rdi
callq 0x86a0
nop