// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk-extras/exprtk_gnuplot_multi.cpp
// Function: exprtk_gnuplot_fx::generate_gp_script()
bool generate_gp_script()
   {
      std::ofstream stream("plot.gp");

      if (!stream)
      {
         return false;
      }

      double min_x = +std::numeric_limits<double>::max();
      double max_x = -std::numeric_limits<double>::max();
      double min_y = +std::numeric_limits<double>::max();
      double max_y = -std::numeric_limits<double>::max();

      for (std::size_t i = 0; i < curve_list_.size(); ++i)
      {
         exprtk_fx_curve& curve = curve_list_[i];

         if (curve.min_x_ < min_x) min_x = curve.min_x_;
         if (curve.max_x_ > max_x) max_x = curve.max_x_;
         if (curve.min_y_ < min_y) min_y = curve.min_y_;
         if (curve.max_y_ > max_y) max_y = curve.max_y_;
      }

      stream << "set term png\n";
      stream << "set output 'plot.png'\n";
      stream << "set xrange[" << min_x << ":" << max_x <<"]\n";
      stream << "set yrange[" << min_y << ":" << max_y <<"]\n";
      stream << "set xzeroaxis\n";
      stream << "set yzeroaxis\n";
      stream << "plot \\\n";

      for (std::size_t i = 0; i < curve_list_.size(); ++i)
      {
         stream << "'data.dat" << i << "' using 1:2:(1.0) smooth unique title '" << curve_list_[i].title_;
         stream << (((i + 1) < curve_list_.size()) ? "',\\\n"  : "'\n");
      }

      return true;
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
leaq 0x12ee2e(%rip), %rsi    # 0x23fccb
leaq 0x28(%rsp), %r14
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x10e170
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x48(%rsp,%rax), %eax
movl %eax, 0x24(%rsp)
testb $0x5, %al
je 0x110ee6
testb $0x5, 0x24(%rsp)
sete %bl
leaq 0x28(%rsp), %rdi
callq 0x10e3d0
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rbx), %r14
movsd 0x1251b6(%rip), %xmm0   # 0x2360a8
movsd 0x1251b6(%rip), %xmm1   # 0x2360b0
xorl %r15d, %r15d
movsd %xmm1, 0x10(%rsp)
movsd %xmm1, (%rsp)
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x110978
cmpq %rax, %r15
jae 0x110f73
movq %r14, %rdi
movq %r15, %rsi
callq 0x235a36
movsd 0x40(%rax), %xmm0
movsd 0x48(%rax), %xmm1
minsd 0x10(%rsp), %xmm0
maxsd 0x18(%rsp), %xmm1
movsd 0x50(%rax), %xmm2
minsd (%rsp), %xmm2
movsd 0x58(%rax), %xmm3
maxsd 0x8(%rsp), %xmm3
incq %r15
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
jmp 0x110f14
leaq 0x12ed59(%rip), %rsi    # 0x23fcd3
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
leaq 0x12ed56(%rip), %rsi    # 0x23fce1
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
leaq 0x12ed5c(%rip), %rsi    # 0x23fcf8
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x10e3b0
leaq 0x12a8e1(%rip), %rsi    # 0x23b89c
movq %rax, %rdi
callq 0x10e2e0
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x10e3b0
leaq 0x12ed2c(%rip), %rsi    # 0x23fd04
movq %rax, %rdi
callq 0x10e2e0
leaq 0x12ed20(%rip), %rsi    # 0x23fd07
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
movq %rax, %rdi
movsd (%rsp), %xmm0
callq 0x10e3b0
leaq 0x12a897(%rip), %rsi    # 0x23b89c
movq %rax, %rdi
callq 0x10e2e0
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x10e3b0
leaq 0x12ece2(%rip), %rsi    # 0x23fd04
movq %rax, %rdi
callq 0x10e2e0
leaq 0x12ece2(%rip), %rsi    # 0x23fd13
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
leaq 0x12ece0(%rip), %rsi    # 0x23fd22
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
leaq 0x12ecde(%rip), %rsi    # 0x23fd31
leaq 0x28(%rsp), %rdi
callq 0x10e2e0
xorl %r15d, %r15d
leaq 0x28(%rsp), %r13
leaq 0x12ec89(%rip), %rbp    # 0x23fcf5
movq %rbx, %rdi
callq 0x110978
cmpq %rax, %r15
jae 0x110ec0
movq %r13, %rdi
leaq 0x12ecb2(%rip), %rsi    # 0x23fd39
callq 0x10e2e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x10e270
movq %rax, %rdi
leaq 0x12eca2(%rip), %rsi    # 0x23fd43
callq 0x10e2e0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x235a36
movq %r12, %rdi
movq %rax, %rsi
callq 0x10e150
incq %r15
movq %rbx, %rdi
callq 0x110978
cmpq %rax, %r15
movq %rbp, %rsi
leaq 0x12ec94(%rip), %rax    # 0x23fd6b
cmovbq %rax, %rsi
movq %r13, %rdi
callq 0x10e2e0
jmp 0x11106c
jmp 0x1110e7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x10e3d0
movq %rbx, %rdi
callq 0x10e340