// File: 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:
subq $0xd88, %rsp            # imm = 0xD88
movq %rdi, 0xd78(%rsp)
movq 0xd78(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0xd70(%rsp)
leaq 0xd68(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movl $0x1, %esi
callq 0x119340
movq 0x50(%rsp), %rdi
callq 0x119380
jmp 0x118bcb
leaq 0xd37(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x1116a0
movq 0x40(%rsp), %rdx
leaq 0x32f8e8(%rip), %rsi    # 0x4484d1
leaq 0xd38(%rsp), %rdi
callq 0x118970
jmp 0x118bf8
leaq 0xd68(%rsp), %rdi
leaq 0xd38(%rsp), %rsi
leaq 0xd70(%rsp), %rdx
xorl %ecx, %ecx
callq 0x1193e0
jmp 0x118c19
leaq 0xd38(%rsp), %rdi
callq 0x1117e8
leaq 0xd37(%rsp), %rdi
callq 0x1117d0
leaq 0xd10(%rsp), %rdi
callq 0x119490
jmp 0x118c42
leaq 0xd10(%rsp), %rdi
leaq 0xd68(%rsp), %rsi
callq 0x119540
jmp 0x118c59
leaq 0x298(%rsp), %rdi
movl $0x7f, %esi
callq 0x1195f0
jmp 0x118c6d
leaq 0x3e8(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x119720
jmp 0x118c84
leaq 0x298(%rsp), %rdi
callq 0x119f50
movq 0x48(%rsp), %rsi
addq $0x20, %rsi
leaq 0x3e8(%rsp), %rdi
leaq 0xd10(%rsp), %rdx
callq 0x119fc0
movb %al, 0x3f(%rsp)
jmp 0x118cb5
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x118d95
jmp 0x118cc3
movb $0x0, 0xd87(%rsp)
movl $0x1, 0x294(%rsp)
jmp 0x119085
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
jmp 0x1190d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
jmp 0x118d2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
leaq 0xd38(%rsp), %rdi
callq 0x1117e8
leaq 0xd37(%rsp), %rdi
callq 0x1117d0
jmp 0x1190d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
jmp 0x1190ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
leaq 0x298(%rsp), %rdi
callq 0x119f50
jmp 0x1190ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
jmp 0x1190bd
leaq 0x32f7fd(%rip), %rsi    # 0x448599
leaq 0x90(%rsp), %rdi
movl $0x10, %edx
callq 0x111270
jmp 0x118db0
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x90(%rsp,%rax), %rdi
callq 0x111060
movb %al, 0x3e(%rsp)
jmp 0x118dcf
movb 0x3e(%rsp), %al
testb $0x1, %al
jne 0x118dd9
jmp 0x118e17
movb $0x0, 0xd87(%rsp)
movl $0x1, 0x294(%rsp)
jmp 0x119078
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd60(%rsp)
movl %eax, 0xd5c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x111510
jmp 0x1190bd
callq 0x11a850
movq 0x48(%rsp), %rax
movsd %xmm0, 0x50(%rax)
callq 0x11a850
movq 0x48(%rsp), %rax
movaps 0x32a2a9(%rip), %xmm1   # 0x4430e0
pxor %xmm1, %xmm0
movlpd %xmm0, 0x58(%rax)
movl $0xa, %edi
callq 0x11a860
movl %eax, 0x38(%rsp)
jmp 0x118e50
movl 0x38(%rsp), %eax
movl %eax, 0x8c(%rsp)
movl 0x8c(%rsp), %esi
leaq 0x90(%rsp), %rdi
callq 0x1110d0
jmp 0x118e71
movq 0x48(%rsp), %rax
movabsq $0x3f0a36e2eb1c432d, %rcx # imm = 0x3F0A36E2EB1C432D
movq %rcx, 0x78(%rsp)
movsd 0x40(%rax), %xmm1
movsd 0x48(%rax), %xmm0
subsd %xmm1, %xmm0
callq 0x11a8c0
movsd %xmm0, 0x30(%rsp)
jmp 0x118ea0
movsd 0x30(%rsp), %xmm0
movsd 0x32a16a(%rip), %xmm1   # 0x443018
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x11a880
movq %rax, 0x28(%rsp)
jmp 0x118ece
movq 0x48(%rsp), %rax
movq 0x28(%rsp), %rcx
movsd (%rcx), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x40(%rax), %xmm0
movsd %xmm0, 0xd70(%rsp)
movq 0x48(%rsp), %rax
movsd 0xd70(%rsp), %xmm1
movsd 0x48(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x118ffe
leaq 0xd10(%rsp), %rdi
callq 0x11a8e0
movsd %xmm0, 0x20(%rsp)
jmp 0x118f25
movq 0x48(%rsp), %rax
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x68(%rsp), %xmm1
movsd 0x50(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x118f59
movq 0x48(%rsp), %rax
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x50(%rax)
jmp 0x118f7d
movq 0x48(%rsp), %rax
movsd 0x68(%rsp), %xmm0
ucomisd 0x58(%rax), %xmm0
jbe 0x118f7b
movq 0x48(%rsp), %rax
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x58(%rax)
jmp 0x118f7d
movsd 0xd70(%rsp), %xmm0
leaq 0x90(%rsp), %rdi
callq 0x111570
movq %rax, 0x18(%rsp)
jmp 0x118f9a
movq 0x18(%rsp), %rdi
leaq 0x32f5fc(%rip), %rsi    # 0x4485a2
callq 0x111420
movq %rax, 0x10(%rsp)
jmp 0x118fb2
movq 0x10(%rsp), %rdi
movsd 0x68(%rsp), %xmm0
callq 0x111570
movq %rax, 0x8(%rsp)
jmp 0x118fc9
movq 0x8(%rsp), %rdi
leaq 0x334146(%rip), %rsi    # 0x44d11b
callq 0x111420
jmp 0x118fdc
jmp 0x118fde
movsd 0x80(%rsp), %xmm0
addsd 0xd70(%rsp), %xmm0
movsd %xmm0, 0xd70(%rsp)
jmp 0x118ef3
movq 0x48(%rsp), %rax
movsd 0x50(%rax), %xmm1
movsd 0x58(%rax), %xmm0
subsd %xmm1, %xmm0
callq 0x11a8c0
movsd %xmm0, (%rsp)
jmp 0x11901d
movq 0x48(%rsp), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x329feb(%rip), %xmm0   # 0x443020
mulsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x58(%rsp), %xmm1
movsd 0x50(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rax)
movsd 0x58(%rsp), %xmm0
addsd 0x58(%rax), %xmm0
movsd %xmm0, 0x58(%rax)
movb $0x1, 0xd87(%rsp)
movl $0x1, 0x294(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x111510
leaq 0x3e8(%rsp), %rdi
callq 0x11a900
leaq 0xd10(%rsp), %rdi
callq 0x11ab00
leaq 0xd68(%rsp), %rdi
callq 0x11ab40
movb 0xd87(%rsp), %al
andb $0x1, %al
addq $0xd88, %rsp            # imm = 0xD88
retq
leaq 0x3e8(%rsp), %rdi
callq 0x11a900
leaq 0xd10(%rsp), %rdi
callq 0x11ab00
leaq 0xd68(%rsp), %rdi
callq 0x11ab40
movq 0xd60(%rsp), %rdi
callq 0x111480
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)