// File: 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:
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, 0x2c8(%rsp)
movq 0x2c8(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x33486d(%rip), %rsi    # 0x44f110
leaq 0xc8(%rsp), %rdi
movl $0x10, %edx
callq 0x111280
movq 0xc8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xc8(%rsp,%rax), %rdi
callq 0x111060
movb %al, 0x7f(%rsp)
jmp 0x11a8d4
movb 0x7f(%rsp), %al
testb $0x1, %al
jne 0x11a8de
jmp 0x11a91c
movb $0x0, 0x2d7(%rsp)
movl $0x1, 0xb8(%rsp)
jmp 0x11ad20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x111520
jmp 0x11ad3e
callq 0x11c2b0
movsd %xmm0, 0xb0(%rsp)
callq 0x11c2b0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0xa8(%rsp)
callq 0x11c2b0
movsd %xmm0, 0xa0(%rsp)
callq 0x11c2b0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq 0x70(%rsp), %rdi
movq 0x90(%rsp), %rax
movq %rax, 0x68(%rsp)
callq 0x119a70
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x11aaab
movq 0x70(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x11a850
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movsd 0x40(%rax), %xmm1
movsd 0xb0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x11aa02
movq 0x88(%rsp), %rax
movsd 0x40(%rax), %xmm0
movsd %xmm0, 0xb0(%rsp)
movq 0x88(%rsp), %rax
movsd 0x48(%rax), %xmm0
ucomisd 0xa8(%rsp), %xmm0
jbe 0x11aa30
movq 0x88(%rsp), %rax
movsd 0x48(%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x88(%rsp), %rax
movsd 0x50(%rax), %xmm1
movsd 0xa0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x11aa62
movq 0x88(%rsp), %rax
movsd 0x50(%rax), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0x88(%rsp), %rax
movsd 0x58(%rax), %xmm0
ucomisd 0x98(%rsp), %xmm0
jbe 0x11aa90
movq 0x88(%rsp), %rax
movsd 0x58(%rax), %xmm0
movsd %xmm0, 0x98(%rsp)
jmp 0x11aa92
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x11a98e
leaq 0x334666(%rip), %rsi    # 0x44f118
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11aac1
leaq 0x33465e(%rip), %rsi    # 0x44f126
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11aad7
leaq 0x33465f(%rip), %rsi    # 0x44f13d
leaq 0xc8(%rsp), %rdi
callq 0x111430
movq %rax, 0x60(%rsp)
jmp 0x11aaf2
movq 0x60(%rsp), %rdi
movsd 0xb0(%rsp), %xmm0
callq 0x111590
movq %rax, 0x58(%rsp)
jmp 0x11ab0c
movq 0x58(%rsp), %rdi
leaq 0x330178(%rip), %rsi    # 0x44ac90
callq 0x111430
movq %rax, 0x50(%rsp)
jmp 0x11ab24
movq 0x50(%rsp), %rdi
movsd 0xa8(%rsp), %xmm0
callq 0x111590
movq %rax, 0x48(%rsp)
jmp 0x11ab3e
movq 0x48(%rsp), %rdi
leaq 0x3345ff(%rip), %rsi    # 0x44f149
callq 0x111430
jmp 0x11ab51
leaq 0x3345f4(%rip), %rsi    # 0x44f14c
leaq 0xc8(%rsp), %rdi
callq 0x111430
movq %rax, 0x40(%rsp)
jmp 0x11ab6c
movq 0x40(%rsp), %rdi
movsd 0xa0(%rsp), %xmm0
callq 0x111590
movq %rax, 0x38(%rsp)
jmp 0x11ab86
movq 0x38(%rsp), %rdi
leaq 0x3300fe(%rip), %rsi    # 0x44ac90
callq 0x111430
movq %rax, 0x30(%rsp)
jmp 0x11ab9e
movq 0x30(%rsp), %rdi
movsd 0x98(%rsp), %xmm0
callq 0x111590
movq %rax, 0x28(%rsp)
jmp 0x11abb8
movq 0x28(%rsp), %rdi
leaq 0x334585(%rip), %rsi    # 0x44f149
callq 0x111430
jmp 0x11abcb
leaq 0x334586(%rip), %rsi    # 0x44f158
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11abe1
leaq 0x33457f(%rip), %rsi    # 0x44f167
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11abf7
leaq 0x334578(%rip), %rsi    # 0x44f176
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11ac0d
movq $0x0, 0x80(%rsp)
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
callq 0x119a70
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x11ad0d
leaq 0x334536(%rip), %rsi    # 0x44f17e
leaq 0xc8(%rsp), %rdi
callq 0x111430
movq %rax, 0x18(%rsp)
jmp 0x11ac5c
movq 0x18(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x111700
movq %rax, 0x10(%rsp)
jmp 0x11ac75
movq 0x10(%rsp), %rdi
leaq 0x334507(%rip), %rsi    # 0x44f188
callq 0x111430
movq %rax, 0x8(%rsp)
jmp 0x11ac8d
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x11a850
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x111260
jmp 0x11acae
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rax
incq %rax
movq %rax, (%rsp)
callq 0x119a70
movq %rax, %rcx
movq (%rsp), %rax
subq %rcx, %rax
leaq 0x3344d8(%rip), %rax    # 0x44f1b0
leaq 0x33445b(%rip), %rsi    # 0x44f13a
cmovbq %rax, %rsi
leaq 0xc8(%rsp), %rdi
callq 0x111430
jmp 0x11acf2
jmp 0x11acf4
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
jmp 0x11ac19
movb $0x1, 0x2d7(%rsp)
movl $0x1, 0xb8(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x111520
movb 0x2d7(%rsp), %al
andb $0x1, %al
addq $0x2d8, %rsp            # imm = 0x2D8
retq
movq 0xc0(%rsp), %rdi
callq 0x111490
nopl (%rax,%rax)