// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk-extras/exprtk_gnuplot.cpp
// Function: exprtk_gnuplot_fx::generate_data()
bool generate_data()
   {
      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(expression_,expression))
      {
         return false;
      }

      std::ofstream stream("data.dat");

      if (!stream)
      {
         return false;
      }

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

      stream << std::setprecision(10);

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

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

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

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

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

      min_y_ -= perc7_5;
      max_y_ += perc7_5;

      return true;
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb78, %rsp            # imm = 0xB78
movq %rdi, %rbx
andq $0x0, 0x8(%rsp)
movq %rsp, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1108c2
movq %r14, %rdi
callq 0x1108e6
leaq 0x12abca(%rip), %rsi    # 0x23b091
leaq 0x250(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x110418
movq %rsp, %rdi
leaq 0x250(%rsp), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x11090c
leaq 0x250(%rsp), %rdi
callq 0x10e608
leaq 0x20(%rsp), %rdi
callq 0x110978
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x1109d8
leaq 0x50(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x110a34
leaq 0x250(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x110b44
leaq 0x50(%rsp), %rdi
callq 0x11115c
leaq 0x20(%rbx), %rsi
leaq 0x250(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1111a4
testb %al, %al
je 0x11067e
leaq 0x12abf7(%rip), %rsi    # 0x23b159
leaq 0x50(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x10e170
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
testb $0x5, 0x70(%rsp,%rcx)
sete %bpl
jne 0x1106bc
movl %ebp, 0x14(%rsp)
leaq 0x50(%rbx), %r13
movaps 0x125a8a(%rip), %xmm0   # 0x236020
movups %xmm0, 0x50(%rbx)
movq -0x18(%rax), %rax
movq $0xa, 0x58(%rsp,%rax)
movsd 0x40(%rbx), %xmm0
movsd 0x48(%rbx), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
andpd 0x125a6f(%rip), %xmm2   # 0x236030
divsd 0x125ac7(%rip), %xmm2   # 0x236090
minsd 0x125ac7(%rip), %xmm2   # 0x236098
movapd %xmm2, 0x40(%rsp)
leaq 0x58(%rbx), %rbp
leaq 0x50(%rsp), %r14
leaq 0x12ab7b(%rip), %r15    # 0x23b162
leaq 0x12f6d8(%rip), %r12    # 0x23fcc6
movsd %xmm0, 0x8(%rsp)
ucomisd %xmm0, %xmm1
jb 0x110682
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd %xmm0, 0x18(%rsp)
movsd (%r13), %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movq %r13, %rax
ja 0x110632
ucomisd (%rbp), %xmm1
movq %rbp, %rax
jbe 0x110636
movsd %xmm1, (%rax)
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
callq 0x10e3a0
movq %rax, %rdi
movq %r15, %rsi
callq 0x10e2d0
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x10e3a0
movq %rax, %rdi
movq %r12, %rsi
callq 0x10e2d0
movsd 0x8(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd 0x48(%rbx), %xmm1
jmp 0x1105ee
xorl %ebp, %ebp
jmp 0x1106c6
movsd (%rbp), %xmm0
movsd (%r13), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
andpd 0x125993(%rip), %xmm2   # 0x236030
mulsd 0x1259fb(%rip), %xmm2   # 0x2360a0
subsd %xmm2, %xmm1
movsd %xmm1, (%r13)
addsd %xmm0, %xmm2
movsd %xmm2, (%rbp)
movl 0x14(%rsp), %ebp
leaq 0x50(%rsp), %rdi
callq 0x10e3c0
leaq 0x250(%rsp), %rdi
callq 0x111626
leaq 0x20(%rsp), %rdi
callq 0x111760
movq %rsp, %rdi
callq 0x111776
movl %ebp, %eax
addq $0xb78, %rsp            # imm = 0xB78
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1106fb
movq %rax, %rbx
jmp 0x11073e
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x11115c
jmp 0x11074b
jmp 0x110711
movq %rax, %rbx
jmp 0x11074b
jmp 0x11072c
movq %rax, %rbx
leaq 0x250(%rsp), %rdi
callq 0x10e608
jmp 0x110755
jmp 0x11072c
movq %rax, %rbx
jmp 0x110755
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x10e3c0
leaq 0x250(%rsp), %rdi
callq 0x111626
leaq 0x20(%rsp), %rdi
callq 0x111760
movq %rsp, %rdi
callq 0x111776
movq %rbx, %rdi
callq 0x10e330
nop