// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk-extras/exprtk_gnuplot_multi.cpp
// Function: exprtk_gnuplot_fx::generate_data(unsigned long, exprtk_fx_curve&)
bool generate_data(const std::size_t index, exprtk_fx_curve& curve)
   {
      typedef exprtk::symbol_table<double> symbol_table_t;
      typedef exprtk::expression<double>   expression_t;
      typedef exprtk::parser<double>       parser_t;

      double x = 0.0;

      symbol_table_t symbol_table;
      symbol_table.add_constants();
      symbol_table.add_variable("x",x);

      expression_t expression;
      expression.register_symbol_table(symbol_table);

      parser_t parser;

      if (!parser.compile(curve.expression_,expression))
      {
         return false;
      }

      const std::string file_name = std::string("data.dat") + (char)('0' + index);

      std::ofstream stream(file_name.c_str());

      if (!stream)
      {
         return false;
      }

      curve.min_y_ = +std::numeric_limits<double>::max();
      curve.max_y_ = -std::numeric_limits<double>::max();

      stream << std::setprecision(10);

      const double increment = std::min(0.00005,std::abs(curve.max_x_ - curve.min_x_) / 1000.0);

      for (x = curve.min_x_; x <= curve.max_x_; x += increment)
      {
         const double y = expression.value();

              if (y < curve.min_y_) curve.min_y_ = y;
         else if (y > curve.max_y_) curve.max_y_ = y;

         stream << x << "\t" << y << "\n";
      }

      const double diff_y  = std::abs(curve.max_y_ - curve.min_y_);
      const double perc7_5 = diff_y * 0.075; //7.5%

      curve.min_y_ -= perc7_5;
      curve.max_y_ += perc7_5;

      return true;
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb98, %rsp            # imm = 0xB98
movq %rdx, %rbx
movq %rsi, %r14
movq $0x0, 0x8(%rsp)
movq %rsp, %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x11a67c
movq %r15, %rdi
callq 0x11a6c4
leaq 0x280(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1afa2f(%rip), %rsi    # 0x2c9861
leaq 0x1afa29(%rip), %rdx    # 0x2c9862
leaq 0x270(%rsp), %rdi
callq 0x19997c
movq %rsp, %r15
leaq 0x270(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x11a80a
movq 0x270(%rsp), %rdi
cmpq %r12, %rdi
je 0x119e7d
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x116080
leaq 0x40(%rsp), %rdi
callq 0x11a978
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %rax
subq %rcx, %rax
je 0x119ee2
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %r15, %rcx
je 0x119eef
movq (%rsp), %rdx
cmpq (%rcx), %rdx
je 0x119eef
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x119ee2
decq %rsi
cmpq %r15, %rcx
je 0x119eda
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x119ec1
negq %rsi
cmpq %rax, %rsi
jb 0x119eef
leaq 0x48(%rsp), %rdi
movq %rsp, %rsi
callq 0x11f260
leaq 0x70(%rsp), %rdi
movl $0x7f, %esi
callq 0x11aa12
leaq 0x270(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x11ab12
leaq 0x170(%rsp), %rdi
callq 0x11f462
leaq 0x140(%rsp), %rdi
callq 0x11f462
leaq 0x110(%rsp), %rdi
callq 0x11f462
leaq 0xe0(%rsp), %rdi
callq 0x11f462
leaq 0xb0(%rsp), %rdi
callq 0x11f462
leaq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0x11f462
leaq 0x20(%rbx), %rsi
leaq 0x270(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x11b336
testb %al, %al
je 0x119fda
leaq 0x70(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b450e(%rip), %rsi    # 0x2ce498
leaq 0x1b450f(%rip), %rdx    # 0x2ce4a0
callq 0x19997c
addb $0x30, %r14b
leaq 0x70(%rsp), %rdi
movq 0x8(%rdi), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
xorl %edx, %edx
callq 0x116290
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x119fe1
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x119fea
xorl %ebp, %ebp
jmp 0x11a1dd
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x11a01c
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x116080
movq 0x20(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl $0x10, %edx
callq 0x116150
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rcx
testb $0x5, 0x90(%rsp,%rcx)
sete %bpl
jne 0x11a194
movl %ebp, 0x14(%rsp)
leaq 0x50(%rbx), %r14
leaq 0x58(%rbx), %rbp
movaps 0x1aafc2(%rip), %xmm0   # 0x2c5020
movups %xmm0, 0x50(%rbx)
movq -0x18(%rax), %rax
movq $0xa, 0x78(%rsp,%rax)
movsd 0x40(%rbx), %xmm0
movsd 0x48(%rbx), %xmm2
movsd %xmm0, 0x8(%rsp)
movsd 0x48(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jb 0x11a157
subsd %xmm0, %xmm2
andpd 0x1aaf96(%rip), %xmm2   # 0x2c5030
divsd 0x1ab00e(%rip), %xmm2   # 0x2c50b0
minsd 0x1ab00e(%rip), %xmm2   # 0x2c50b8
movapd %xmm2, 0x60(%rsp)
leaq 0x1af8f5(%rip), %r15    # 0x2c99ac
leaq 0x1b4396(%rip), %r12    # 0x2ce454
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd %xmm0, 0x18(%rsp)
movsd (%r14), %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movq %r14, %rax
ja 0x11a0f1
ucomisd (%rbp), %xmm1
movq %rbp, %rax
jbe 0x11a0f5
movsd %xmm1, (%rax)
movsd 0x8(%rsp), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x1163b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x116500
movq %r13, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x1163b0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x116500
movsd 0x8(%rsp), %xmm0
addsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x48(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x11a0be
movsd (%rbp), %xmm0
movsd (%r14), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
andpd 0x1aaebf(%rip), %xmm2   # 0x2c5030
mulsd 0x1aaf47(%rip), %xmm2   # 0x2c50c0
subsd %xmm2, %xmm1
movsd %xmm1, (%r14)
addsd %xmm0, %xmm2
movsd %xmm2, (%rbp)
leaq 0x30(%rsp), %r14
movl 0x14(%rsp), %ebp
movq 0x31be2d(%rip), %rax    # 0x435fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x78(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x70(%rsp,%rcx)
callq 0x1162e0
leaq 0x168(%rsp), %rdi
callq 0x116370
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x11a1dd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x116080
leaq 0x270(%rsp), %rdi
callq 0x11bd08
leaq 0x40(%rsp), %rdi
callq 0x11bfca
movq %rsp, %rdi
callq 0x11c018
movl %ebp, %eax
addq $0xb98, %rsp            # imm = 0xB98
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x11a281
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x11a29d
movq 0x80(%rsp), %rsi
jmp 0x11a295
jmp 0x11a230
jmp 0x11a244
movq %rax, %rbx
jmp 0x11a29d
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x11b2ee
jmp 0x11a2aa
movq %rax, %rbx
jmp 0x11a2aa
jmp 0x11a26f
movq %rax, %rbx
movq 0x270(%rsp), %rdi
cmpq %r12, %rdi
je 0x11a2b4
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x116080
jmp 0x11a2b4
jmp 0x11a26f
movq %rax, %rbx
jmp 0x11a2b4
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1163d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x11a29d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x116080
leaq 0x270(%rsp), %rdi
callq 0x11bd08
leaq 0x40(%rsp), %rdi
callq 0x11bfca
movq %rsp, %rdi
callq 0x11c018
movq %rbx, %rdi
callq 0x116300