// File: /workspace/github_cpp_makefile_star2_O3/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 0x1185f2
movq %r15, %rdi
callq 0x11863a
leaq 0x280(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x18db1b(%rip), %rsi    # 0x2a58d9
leaq 0x18db15(%rip), %rdx    # 0x2a58da
leaq 0x270(%rsp), %rdi
callq 0x180424
movq %rsp, %r15
leaq 0x270(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x118780
movq 0x270(%rsp), %rdi
cmpq %r12, %rdi
je 0x117e09
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x114080
leaq 0x40(%rsp), %rdi
callq 0x1188d0
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
je 0x117e45
sarq $0x3, %rcx
movq (%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %r15, %rax
je 0x117e52
cmpq (%rax), %rdx
je 0x117e52
addq $0x8, %rax
decq %rcx
jne 0x117e32
leaq 0x48(%rsp), %rdi
movq %rsp, %rsi
callq 0x11caba
leaq 0x70(%rsp), %rdi
movl $0x7f, %esi
callq 0x11895c
leaq 0x270(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x118a5c
leaq 0x170(%rsp), %rdi
callq 0x11ccbc
leaq 0x140(%rsp), %rdi
callq 0x11ccbc
leaq 0x110(%rsp), %rdi
callq 0x11ccbc
leaq 0xe0(%rsp), %rdi
callq 0x11ccbc
leaq 0xb0(%rsp), %rdi
callq 0x11ccbc
leaq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0x11ccbc
leaq 0x20(%rbx), %rsi
leaq 0x270(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x119280
testb %al, %al
je 0x117f3e
leaq 0x70(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1925f5(%rip), %rsi    # 0x2aa4e2
leaq 0x1925f6(%rip), %rdx    # 0x2aa4ea
callq 0x180424
addb $0x30, %r14b
leaq 0x70(%rsp), %rdi
movq 0x8(%rdi), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
xorl %edx, %edx
callq 0x114290
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x117f46
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x117f50
xorl %r15d, %r15d
jmp 0x118151
movupd (%rcx), %xmm0
movupd %xmm0, (%r12)
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 0x117f82
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x114080
movq 0x20(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl $0x10, %edx
callq 0x114150
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rcx
testb $0x5, 0x90(%rsp,%rcx)
sete %r15b
jne 0x118108
leaq 0x50(%rbx), %r14
leaq 0x58(%rbx), %rbp
movaps 0x189060(%rip), %xmm0   # 0x2a1020
movups %xmm0, 0x50(%rbx)
movq -0x18(%rax), %rax
movq $0xa, 0x78(%rsp,%rax)
movsd 0x40(%rbx), %xmm0
movsd 0x48(%rbx), %xmm1
movsd %xmm0, 0x8(%rsp)
ucomisd %xmm0, %xmm1
jae 0x117ffc
movsd 0x1890e1(%rip), %xmm0   # 0x2a10d0
movsd 0x1890e1(%rip), %xmm1   # 0x2a10d8
jmp 0x1180de
movl %r15d, 0x14(%rsp)
subsd %xmm0, %xmm1
andpd 0x189023(%rip), %xmm1   # 0x2a1030
divsd 0x1890ab(%rip), %xmm1   # 0x2a10c0
minsd 0x1890ab(%rip), %xmm1   # 0x2a10c8
movapd %xmm1, 0x60(%rsp)
leaq 0x18d9fa(%rip), %r15    # 0x2a5a24
leaq 0x19246d(%rip), %r12    # 0x2aa49e
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 0x118064
ucomisd (%rbp), %xmm1
movq %rbp, %rax
jbe 0x118068
movsd %xmm1, (%rax)
movsd 0x8(%rsp), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x1143b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x114500
movq %r13, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x1143b0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x114500
movsd 0x8(%rsp), %xmm0
addsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x48(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x118031
movsd (%rbp), %xmm0
movsd (%r14), %xmm1
leaq 0x30(%rsp), %r12
movl 0x14(%rsp), %r15d
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
andpd 0x188f42(%rip), %xmm2   # 0x2a1030
mulsd 0x188fea(%rip), %xmm2   # 0x2a10e0
subsd %xmm2, %xmm1
movsd %xmm1, (%r14)
addsd %xmm0, %xmm2
movsd %xmm2, (%rbp)
movq 0x2e8eb9(%rip), %rax    # 0x400fc8
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 0x1142e0
leaq 0x168(%rsp), %rdi
callq 0x114370
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x118151
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x114080
leaq 0x270(%rsp), %rdi
callq 0x119e1c
leaq 0x40(%rsp), %rdi
callq 0x11a0de
movq %rsp, %rdi
callq 0x11a12c
movl %r15d, %eax
addq $0xb98, %rsp            # imm = 0xB98
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1181f6
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x118212
movq 0x80(%rsp), %rsi
jmp 0x11820a
jmp 0x1181a5
jmp 0x1181b9
movq %rax, %rbx
jmp 0x118212
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x119238
jmp 0x11821f
movq %rax, %rbx
jmp 0x11821f
jmp 0x1181e4
movq %rax, %rbx
movq 0x270(%rsp), %rdi
cmpq %r12, %rdi
je 0x118229
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x114080
jmp 0x118229
jmp 0x1181e4
movq %rax, %rbx
jmp 0x118229
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1143d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x118212
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x114080
leaq 0x270(%rsp), %rdi
callq 0x119e1c
leaq 0x40(%rsp), %rdi
callq 0x11a0de
movq %rsp, %rdi
callq 0x11a12c
movq %rbx, %rdi
callq 0x114300
nop