// File: ArashPartow[P]exprtk/exprtk_simple_example_03.cpp
// Function: void polynomial<double>()
void polynomial()
{
   typedef exprtk::symbol_table<T> symbol_table_t;
   typedef exprtk::expression<T>   expression_t;
   typedef exprtk::parser<T>       parser_t;

   const std::string expression_string =
      "25x^5 - 35x^4 - 15x^3 + 40x^2 - 15x + 1";

   const T r0 = T(0);
   const T r1 = T(1);
         T  x = T(0);

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

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;
   parser.compile(expression_string,expression);

   const T delta = T(1.0 / 100.0);

   for (x = r0; x <= r1; x += delta)
   {
      printf("%19.15f\t%19.15f\n", x, expression.value());
   }
}

// Assembly:
subq $0xb48, %rsp            # imm = 0xB48
leaq 0xb27(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x111640
movq 0x20(%rsp), %rdx
leaq 0x32ed20(%rip), %rsi    # 0x447545
leaq 0xb28(%rsp), %rdi
callq 0x118740
jmp 0x118834
leaq 0xb27(%rsp), %rdi
callq 0x111760
movq $0x0, 0xb08(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xb00(%rsp)
movq $0x0, 0xaf8(%rsp)
leaq 0xaf0(%rsp), %rdi
movl $0x1, %esi
callq 0x118e00
jmp 0x11887f
leaq 0xacf(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x111640
movq 0x18(%rsp), %rdx
leaq 0x32ec00(%rip), %rsi    # 0x44749d
leaq 0xad0(%rsp), %rdi
callq 0x118740
jmp 0x1188ac
leaq 0xaf0(%rsp), %rdi
leaq 0xad0(%rsp), %rsi
leaq 0xaf8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x118e40
jmp 0x1188cd
leaq 0xad0(%rsp), %rdi
callq 0x111778
leaq 0xacf(%rsp), %rdi
callq 0x111760
leaq 0xaa8(%rsp), %rdi
callq 0x118ef0
jmp 0x1188f6
leaq 0xaa8(%rsp), %rdi
leaq 0xaf0(%rsp), %rsi
callq 0x118fa0
jmp 0x11890d
leaq 0x30(%rsp), %rdi
movl $0x7f, %esi
callq 0x119050
jmp 0x11891e
leaq 0x180(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x119180
jmp 0x118932
leaq 0x30(%rsp), %rdi
callq 0x1199b0
leaq 0x180(%rsp), %rdi
leaq 0xb28(%rsp), %rsi
leaq 0xaa8(%rsp), %rdx
callq 0x119a20
jmp 0x11895b
movsd 0x3296a5(%rip), %xmm0   # 0x442008
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xaf8(%rsp)
movsd 0x329693(%rip), %xmm0   # 0x442010
ucomisd 0xaf8(%rsp), %xmm0
jb 0x118ae4
movsd 0xaf8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xaa8(%rsp), %rdi
callq 0x11a2b0
movsd %xmm0, 0x10(%rsp)
jmp 0x1189b0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0x32ebaa(%rip), %rdi    # 0x44756d
movb $0x2, %al
callq 0x111080
jmp 0x1189cc
jmp 0x1189ce
movsd 0x329632(%rip), %xmm0   # 0x442008
addsd 0xaf8(%rsp), %xmm0
movsd %xmm0, 0xaf8(%rsp)
jmp 0x118975
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
leaq 0xb27(%rsp), %rdi
callq 0x111760
jmp 0x118b47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
jmp 0x118b3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
jmp 0x118a60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
leaq 0xad0(%rsp), %rdi
callq 0x111778
leaq 0xacf(%rsp), %rdi
callq 0x111760
jmp 0x118b2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
jmp 0x118b2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
jmp 0x118b20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x1199b0
jmp 0x118b20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb18(%rsp)
movl %eax, 0xb14(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x11a2d0
jmp 0x118b20
leaq 0x180(%rsp), %rdi
callq 0x11a2d0
leaq 0xaa8(%rsp), %rdi
callq 0x11a4d0
leaq 0xaf0(%rsp), %rdi
callq 0x11a510
leaq 0xb28(%rsp), %rdi
callq 0x111778
addq $0xb48, %rsp            # imm = 0xB48
retq
leaq 0xaa8(%rsp), %rdi
callq 0x11a4d0
leaq 0xaf0(%rsp), %rdi
callq 0x11a510
leaq 0xb28(%rsp), %rdi
callq 0x111778
movq 0xb18(%rsp), %rdi
callq 0x111440
nopw %cs:(%rax,%rax)
nop