// File: /workspace/github_cpp_makefile_star2_O3/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, %ebx
movl %edx, 0x8(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, %r15
leaq 0x1e8(%rsp), %r14
movq %r14, %rdi
callq 0x33b0
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6112
cmpq $0x0, 0x18(%rsp)
je 0x6029
movq %r12, 0x30(%rsp)
movq %r15, 0x38(%rsp)
testl %ebx, %ebx
je 0x5ee5
movl %ebx, %eax
movq %rax, 0x48(%rsp)
movl 0x8(%rsp), %ebp
xorl %r13d, %r13d
leaq 0x74f0(%rip), %rbx      # 0xd319
xorl %eax, %eax
cmpl $0x0, 0x8(%rsp)
je 0x5ed7
movl %eax, 0xc(%rsp)
movslq %eax, %r14
addq 0x40(%rsp), %r14
xorl %r15d, %r15d
leaq 0x1e8(%rsp), %rdi
movq %r15, %rsi
callq 0x3160
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3250
movq %r12, %rdi
movq %r13, %rsi
callq 0x3160
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3250
movzbl (%r14,%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq %r12, %rdi
callq 0x3350
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x31e0
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
incq %r15
cmpq %r15, %rbp
jne 0x5e45
movl 0xc(%rsp), %eax
addl %r15d, %eax
incq %r13
cmpq 0x48(%rsp), %r13
jne 0x5e2b
leaq 0x1e8(%rsp), %rdi
callq 0x3170
leaq 0x1e8(%rsp), %rdi
callq 0x32d0
leaq 0x70(%rsp), %rdi
callq 0x32b0
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r12
cmpl $0x0, 0xc(%r15)
setg %al
andb 0x9(%r15), %al
leaq 0x73a0(%rip), %rcx      # 0xd2cb
leaq 0x739b(%rip), %rsi      # 0xd2cd
cmovneq %rcx, %rsi
movzbl %al, %eax
leaq 0x5(,%rax,2), %rdx
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
callq 0x3250
cmpq $0x0, 0x8(%r14)
je 0x5f9b
leaq 0x74e6(%rip), %rsi      # 0xd442
leaq 0x70(%rsp), %rdi
movl $0x1, %edx
callq 0x3250
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x3250
movq %rax, %rbx
leaq 0x73c7(%rip), %rsi      # 0xd350
movl $0x9, %edx
movq %rax, %rdi
callq 0x3250
movq %r14, %r12
jmp 0x5faf
leaq 0x74a0(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3250
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x3250
leaq 0x737c(%rip), %rsi      # 0xd343
movl $0xc, %edx
movq %rax, %rdi
callq 0x3250
leaq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x3340
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0x3aba
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x600b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0xaf9e(%rip), %rsi      # 0x10fb0
leaq 0x70(%rsp), %rdi
callq 0x3140
leaq 0xe0(%rsp), %rdi
callq 0x30c0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6044
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0xaf55(%rip), %rax      # 0x10fa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x1f0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x1e8(%rsp,%rcx)
callq 0x31c0
leaq 0x2e0(%rsp), %rdi
callq 0x30c0
movq %r15, %rax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x60bf
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x60bf
jmp 0x60bc
jmp 0x60df
movq %rax, %rbx
jmp 0x60fd
jmp 0x60df
movq %rax, %rbx
movq 0xaeea(%rip), %rsi      # 0x10fb0
leaq 0x70(%rsp), %rdi
callq 0x3140
leaq 0xe0(%rsp), %rdi
callq 0x30c0
jmp 0x60e2
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x60fd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x1e8(%rsp), %rdi
callq 0x32e0
movq %rbx, %rdi
callq 0x33f0