// File: /workspace/github_cpp_makefile_star2_O3/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 0x420f(%rip), %rsi      # 0x19b97
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0xa13e
leaq 0x8(%rsp), %rsi
movq %r12, (%rsi)
leaq -0x98f(%rip), %rax      # 0x15015
movq %rax, 0x8(%rsi)
leaq -0x999(%rip), %rax      # 0x15016
movq %rax, 0x10(%rsi)
movq %r14, %rdi
callq 0x13fb0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15fbb
cmpb $0x1, 0x140(%rsp)
jne 0x159e5
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0x8560
movb $0x0, -0x8(%r14)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xa606
movq -0x28(%r14), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15a0b
callq 0x8370
movq %rbx, 0x38(%rsp)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15a4a
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 0xa65a
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 0x15bec
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 0xab6e
movq %rbp, %rdi
xorl %esi, %esi
callq 0x8520
movq %rax, %r12
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x15acf
callq 0x8370
cmpq 0x30(%rsp), %r12
jbe 0x15adb
movq %r12, 0x30(%rsp)
movq %rbp, %rdi
leaq 0x4188(%rip), %rsi      # 0x19c6d
callq 0xa13e
leaq 0x20(%r15), %rax
movq %rax, 0x150(%rsp)
leaq -0xae8(%rip), %rax      # 0x15015
movq %rax, 0x158(%rsp)
leaq -0xaf6(%rip), %rax      # 0x15016
movq %rax, 0x160(%rsp)
movq %rbp, %rdi
leaq 0x150(%rsp), %rsi
callq 0x13fb0
movq %r13, %rdi
movq %rax, %rsi
callq 0x15312
cmpb $0x1, 0x140(%rsp)
jne 0x15b4e
leaq 0x148(%rsp), %rdi
callq 0x8560
movb $0x0, 0x140(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0xa606
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15b75
callq 0x8370
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15baf
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 0xa65a
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x1611a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15bd8
callq 0x8370
movq %r15, %rdi
callq 0x8440
movq %rax, %r15
cmpq %rbx, %rax
jne 0x15a8b
leaq 0x4096(%rip), %rsi      # 0x19c89
leaq 0x70(%rsp), %rdi
callq 0xa13e
leaq 0x30(%rsp), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
leaq -0xbec(%rip), %rax      # 0x15025
movq %rax, 0x8(%r14)
leaq -0xbf6(%rip), %rax      # 0x15026
movq %rax, 0x10(%r14)
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x13fb0
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 0x15c6f
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 0x15cb8
leaq 0x29af(%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 0x15c80
leaq 0x150(%rsp), %rsi
movq %r14, (%rsi)
leaq -0xcb5(%rip), %rax      # 0x15015
movq %rax, 0x8(%rsi)
leaq -0xcbf(%rip), %rax      # 0x15016
movq %rax, 0x10(%rsi)
movq 0x60(%rsp), %rdi
callq 0x13fb0
movq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
callq 0x15fbb
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15d07
callq 0x8370
cmpb $0x1, 0x140(%rsp)
jne 0x15d26
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0x8560
movb $0x0, -0x8(%r14)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xa606
movq -0x28(%r14), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x15d4c
callq 0x8370
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15d86
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 0xa65a
leaq 0x3ed4(%rip), %rsi      # 0x19c6b
movl $0x1, %edx
movq %rbp, %rdi
callq 0x8420
movq 0x28(%rsp), %rax
movq 0x60(%rax), %r14
cmpq %rbx, %r14
je 0x15e59
leaq 0x4415(%rip), %r12      # 0x1a1d2
leaq 0x3ea7(%rip), %r13      # 0x19c6b
movq %rbx, 0x68(%rsp)
movq 0x40(%r14), %r15
movq 0x48(%r14), %rbx
cmpq %rbx, %r15
je 0x15e2c
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 0x15dd6
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x3e65(%rip), %rsi      # 0x19ca0
callq 0x8420
movq %r14, %rdi
callq 0x8440
movq %rax, %r14
movq 0x68(%rsp), %rbx
cmpq %rbx, %rax
jne 0x15dc9
leaq 0x3e43(%rip), %rsi      # 0x19ca3
movl $0x5, %edx
movq %rbp, %rdi
callq 0x8420
leaq 0x40(%rsp), %rdi
callq 0xa4a4
movq %rbp, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15ed8
jmp 0x15ef1
jmp 0x15f00
jmp 0x15f00
jmp 0x15ed8
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xa3a8
jmp 0x15f0d
jmp 0x15f00
jmp 0x15f00
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
jmp 0x15eca
jmp 0x15f00
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15f03
callq 0x8370
jmp 0x15f03
jmp 0x15ed8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x15ef4
callq 0x8370
jmp 0x15ef4
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xa3a8
jmp 0x15f03
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa4a4
movq %rbx, %rdi
callq 0x86a0
nop