// File: /workspace/github_cpp_makefile_star2_O2/orbitcowboy[P]gnuplot-cpp/./gnuplot_i.hpp
// Function: Gnuplot::plot_image(unsigned char const*, unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Gnuplot& Gnuplot::plot_image(const unsigned char * ucPicBuf,
                             const unsigned int iWidth,
                             const unsigned int iHeight,
                             const std::string &title)
{
    std::ofstream tmp;
    std::string name = create_tmpfile(tmp);
    if (name.empty())
    {
        return *this;
    }

    //
    // write the data to file
    //
    int iIndex = 0;
    for(unsigned int iRow = 0; iRow < iHeight; ++iRow)
    {
        for(unsigned int iColumn = 0; iColumn < iWidth; ++iColumn)
        {
            tmp << iColumn << " " << iRow  << " "
                << static_cast<float>(ucPicBuf[iIndex++]) << std::endl;
        }
    }

    tmp.flush();
    tmp.close();

    std::ostringstream cmdstr;
    //
    // command to be sent to gnuplot
    //
    if (nplots > 0  &&  two_dim == true)
    {
        cmdstr << "replot ";
    }
    else
    {
        cmdstr << "plot ";
    }

    if (title.empty())
    {
        cmdstr << "\"" << name << "\" with image";
    }
    else
    {
        cmdstr << "\"" << name << "\" title \"" << title << "\" with image";
    }

    //
    // Do the actual plot
    //
    return cmd(cmdstr.str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %r8, %r12
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, 0x18(%rsp)
movq %rdi, %rbx
leaq 0x1e8(%rsp), %r15
movq %r15, %rdi
callq 0x3380
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x53a0
cmpq $0x0, 0x38(%rsp)
je 0x5329
movq %r12, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movl %r14d, %eax
movq %rax, 0x20(%rsp)
movl %ebp, %r12d
xorl %r13d, %r13d
leaq 0x1e8(%rsp), %rbp
leaq 0x50a5(%rip), %r14      # 0xa269
xorl %ecx, %ecx
cmpq 0x20(%rsp), %r13
je 0x523d
movslq %ecx, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x28(%rsp)
leaq (%rax,%rcx), %rbx
xorl %r15d, %r15d
cmpq %r15, %r12
je 0x5230
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3160
movq %rax, %rdi
movq %r14, %rsi
callq 0x31f0
movq %rax, %rdi
movq %r13, %rsi
callq 0x3160
movq %rax, %rdi
movq %r14, %rsi
callq 0x31f0
movzbl (%rbx,%r15), %ecx
cvtsi2ss %ecx, %xmm0
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x3100
incq %r15
jmp 0x51e1
incq %r13
movq 0x28(%rsp), %rcx
addq %r15, %rcx
jmp 0x51c6
leaq 0x1e8(%rsp), %rdi
callq 0x3170
leaq 0x1e8(%rsp), %rdi
callq 0x32d0
leaq 0x70(%rsp), %rdi
callq 0x32a0
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r14
leaq 0x4fa9(%rip), %rsi      # 0xa21b
leaq 0x4fa4(%rip), %rax      # 0xa21d
testb $0x1, 0x9(%rbx)
cmoveq %rax, %rsi
cmpl $0x0, 0xc(%rbx)
cmovleq %rax, %rsi
leaq 0x70(%rsp), %rdi
callq 0x31f0
cmpq $0x0, 0x8(%r14)
je 0x52cc
leaq 0x50f1(%rip), %rsi      # 0xa392
leaq 0x70(%rsp), %rdi
callq 0x31f0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0x31e0
leaq 0x4fe1(%rip), %rsi      # 0xa2a0
movq %rax, %rdi
callq 0x31f0
movq %r14, %rsi
jmp 0x52e2
leaq 0x50bf(%rip), %rsi      # 0xa392
leaq 0x70(%rsp), %rdi
callq 0x31f0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0x31e0
leaq 0x4fa2(%rip), %rsi      # 0xa293
movq %rax, %rdi
callq 0x31f0
leaq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x3320
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x38d6
leaq 0x50(%rsp), %rdi
callq 0x3448
leaq 0x70(%rsp), %rdi
callq 0x3070
leaq 0x30(%rsp), %rdi
callq 0x3448
leaq 0x1e8(%rsp), %rdi
callq 0x32e0
movq %rbx, %rax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3448
jmp 0x5372
jmp 0x536f
jmp 0x537e
movq %rax, %rbx
jmp 0x538b
jmp 0x537e
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3070
jmp 0x5381
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3448
leaq 0x1e8(%rsp), %rdi
callq 0x32e0
movq %rbx, %rdi
callq 0x33b0