// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk-extras/exprtk_immutable_symbol_table_example.cpp
// Function: void immutable_symtab_example<double>()
void immutable_symtab_example()
{
   typedef exprtk::symbol_table<T> symbol_table_t;
   typedef exprtk::expression<T>   expression_t;
   typedef exprtk::parser<T>       parser_t;

   T x = 1.1;
   T y = 2.2;
   T z = 3.3;
   T w = 4.4;

   symbol_table_t mutable_symbol_table;
   symbol_table_t immutable_symbol_table(symbol_table_t::symtab_mutability_type::e_immutable);

   mutable_symbol_table.add_variable("x", x);
   mutable_symbol_table.add_variable("y", y);

   immutable_symbol_table.add_variable("z", z);
   immutable_symbol_table.add_variable("w", w);

   expression_t expression;
   expression.register_symbol_table(immutable_symbol_table);
   expression.register_symbol_table(mutable_symbol_table  );

   parser_t parser;

   const std::vector<std::string> expressions =
   {
      "x := y + (z / w)",     // ok - will compile
      "y := y / x + (z / w)", // ok - will compile
      "z := y + x - w",       // Error - will not compile
      "z ==  (w := y / x)",   // Error - will not compile
   };

   for (const auto& expression_str : expressions)
   {

      if (!parser.compile(expression_str, expression))
      {
         for (std::size_t error_idx = 0; error_idx < parser.error_count(); ++error_idx)
         {
            const auto error = parser.get_error(error_idx);

            printf("Error: %02d Pos: %02d Type: [%14s] Message: %s\tExpression: %s\n",
                   static_cast<unsigned int>(error_idx),
                   static_cast<unsigned int>(error.token.position),
                   exprtk::parser_error::to_str(error.mode).c_str(),
                   error.diagnostic.c_str(),
                   expression_str.c_str());
         }

         continue;
      }

      // Modify all the variables from both the immutable
      // and mutable symbol tables

      x += 1.1;
      y += 2.2;
      z += 3.3;
      w += 4.4;

      expression.value();
   }

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb08, %rsp            # imm = 0xB08
movabsq $0x3ff199999999999a, %rax # imm = 0x3FF199999999999A
movq %rax, 0x28(%rsp)
movabsq $0x400199999999999a, %rax # imm = 0x400199999999999A
movq %rax, 0x20(%rsp)
movabsq $0x400a666666666666, %rax # imm = 0x400A666666666666
movq %rax, 0x18(%rsp)
movabsq $0x401199999999999a, %rax # imm = 0x401199999999999A
movq %rax, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x119bea
movq %rsp, %rdi
movl $0x2, %esi
callq 0x119bea
leaq 0x1f0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1af487(%rip), %rsi    # 0x2c8861
leaq 0x1af481(%rip), %rdx    # 0x2c8862
leaq 0x1e0(%rsp), %rdi
callq 0x119b5a
leaq 0x8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x28(%rsp), %rdx
xorl %ecx, %ecx
callq 0x119c32
movq 0x1e0(%rsp), %rdi
cmpq %r14, %rdi
je 0x119424
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1e0(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1af639(%rip), %rsi    # 0x2c8a6f
leaq 0x1af633(%rip), %rdx    # 0x2c8a70
callq 0x119b5a
leaq 0x8(%rsp), %rbx
leaq 0x1e0(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x119c32
movq 0x1e0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11947b
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1e0(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1af47c(%rip), %rsi    # 0x2c8909
leaq 0x1af476(%rip), %rdx    # 0x2c890a
callq 0x119b5a
movq %rsp, %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x18(%rsp), %rdx
xorl %ecx, %ecx
callq 0x119c32
movq 0x1e0(%rsp), %rdi
cmpq %r14, %rdi
je 0x1194cd
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1e0(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1af45f(%rip), %rsi    # 0x2c893e
leaq 0x1af459(%rip), %rdx    # 0x2c893f
callq 0x119b5a
movq %rsp, %r15
leaq 0x1e0(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x119c32
movq 0x1e0(%rsp), %rdi
cmpq %r14, %rdi
je 0x119522
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x38(%rsp), %rdi
callq 0x119da0
leaq 0x40(%rsp), %r14
movq (%r14), %rcx
movq 0x8(%r14), %rax
subq %rcx, %rax
je 0x119589
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %r15, %rcx
je 0x119594
movq (%rsp), %rdx
cmpq (%rcx), %rdx
je 0x119594
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x119589
decq %rsi
cmpq %r15, %rcx
je 0x119581
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x119568
negq %rsi
cmpq %rax, %rsi
jb 0x119594
movq %rsp, %rsi
movq %r14, %rdi
callq 0x11e788
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
subq %rcx, %rax
je 0x1195f0
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x1195fd
movq 0x8(%rsp), %rdx
cmpq (%rcx), %rdx
je 0x1195fd
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x1195f0
decq %rsi
cmpq %rbx, %rcx
je 0x1195e8
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x1195cf
negq %rsi
cmpq %rax, %rsi
jb 0x1195fd
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x11e788
leaq 0x90(%rsp), %rdi
movl $0x7f, %esi
callq 0x119e3a
leaq 0x1e0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x119f3a
leaq 0x190(%rsp), %rdi
callq 0x11e98a
leaq 0x160(%rsp), %rdi
callq 0x11e98a
leaq 0x130(%rsp), %rdi
callq 0x11e98a
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
callq 0x11e98a
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
callq 0x11e98a
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0x11e98a
movq %r14, -0x10(%r14)
leaq 0x1af285(%rip), %rsi    # 0x2c890b
leaq 0x1af28e(%rip), %rdx    # 0x2c891b
leaq 0x90(%rsp), %r14
movq %r14, %rdi
callq 0x119b5a
leaq 0xb0(%rsp), %r15
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1af264(%rip), %rsi    # 0x2c891c
leaq 0x1af271(%rip), %rdx    # 0x2c8930
movq %r15, %rdi
callq 0x119b5a
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1af257(%rip), %rsi    # 0x2c8931
leaq 0x1af25e(%rip), %rdx    # 0x2c893f
movq %r12, %rdi
callq 0x119b5a
leaq 0xf0(%rsp), %r15
movq %rbx, (%r15)
leaq 0x1af245(%rip), %rsi    # 0x2c8940
leaq 0x1af250(%rip), %rdx    # 0x2c8952
movq %r15, %rdi
callq 0x119b5a
leaq 0x58(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rcx
movl $0x4, %edx
callq 0x11a75e
movq $-0x80, %r14
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x119741
movq (%rbx), %rsi
incq %rsi
callq 0x116090
addq $-0x20, %rbx
addq $0x20, %r14
jne 0x11972d
movq 0x58(%rsp), %rbx
movq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq %rax, %rbx
je 0x1199ee
movabsq $-0x30c30c30c30c30c3, %r12 # imm = 0xCF3CF3CF3CF3CF3D
leaq 0x1e0(%rsp), %rdi
movq %rbx, %rsi
leaq 0x38(%rsp), %rdx
callq 0x11a7a6
testb %al, %al
je 0x1197f9
movsd 0x28(%rsp), %xmm0
addsd 0x1aa874(%rip), %xmm0   # 0x2c4008
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%rsp), %xmm0
addsd 0x1aa868(%rip), %xmm0   # 0x2c4010
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
addsd 0x1aa85c(%rip), %xmm0   # 0x2c4018
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
addsd 0x1aa850(%rip), %xmm0   # 0x2c4020
movsd %xmm0, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
addq $0x20, %rbx
cmpq 0x30(%rsp), %rbx
jne 0x11976d
jmp 0x1199ee
movq $-0x1, %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x530(%rsp), %rax
movq %rax, %rcx
subq 0x510(%rsp), %rcx
sarq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
leaq (%rcx,%rcx,2), %rax
movq 0x518(%rsp), %rcx
subq 0x520(%rsp), %rcx
sarq $0x3, %rcx
imulq %r12, %rcx
addq %rax, %rcx
movq 0x4f8(%rsp), %rsi
movq 0x508(%rsp), %rax
subq %rsi, %rax
sarq $0x3, %rax
imulq %r12, %rax
addq %rcx, %rax
cmpq %rax, %r14
jae 0x1197e5
movq %rsi, %rdx
subq 0x500(%rsp), %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
leaq (%r14,%rdx), %rcx
cmpq $0x2, %rcx
ja 0x11988c
addq %rbp, %rsi
jmp 0x1198dc
testq %rcx, %rcx
jle 0x1198a6
movq %rcx, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
jmp 0x1198bf
movq %r13, %rax
subq %rdx, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq %rdx
notq %rdx
movq 0x510(%rsp), %rax
imulq $-0x1f8, %rdx, %rdi     # imm = 0xFE08
addq (%rax,%rdx,8), %rdi
imulq $0xa8, %rcx, %rsi
addq %rdi, %rsi
leaq 0x90(%rsp), %rdi
callq 0x197906
movq 0xb8(%rsp), %r15
movl 0xc0(%rsp), %esi
leaq 0x70(%rsp), %rdi
callq 0x11b177
movq 0x70(%rsp), %rcx
movq 0xc8(%rsp), %r8
movq (%rbx), %r9
leaq 0x1af03a(%rip), %rdi    # 0x2c8953
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x116050
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x119948
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x11996d
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x119992
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x1199b7
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x1199dc
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x116090
incq %r14
addq $0xa8, %rbp
decq %r13
jmp 0x119805
leaq 0x58(%rsp), %rdi
callq 0x11b28e
leaq 0x1e0(%rsp), %rdi
callq 0x11b2ea
leaq 0x38(%rsp), %rdi
callq 0x11b5ac
movq %rsp, %rdi
callq 0x11b5fa
leaq 0x8(%rsp), %rdi
callq 0x11b5fa
addq $0xb08, %rsp            # imm = 0xB08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1165cc
movb $0x1, %al
jmp 0x119a6a
jmp 0x119a5b
movq %rax, %rbx
xorl %eax, %eax
movq %r12, %r15
jmp 0x119a6a
movq %rax, %rbx
xorl %eax, %eax
jmp 0x119a6a
movq %rax, %rbx
xorl %eax, %eax
movq %r14, %r15
cmpq %r15, %r14
sete %cl
orb %al, %cl
jne 0x119b1e
addq $-0x10, %r15
leaq 0x90(%rsp), %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x119a98
movq (%r15), %rsi
incq %rsi
callq 0x116090
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x119a84
jmp 0x119b1e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x11a716
jmp 0x119b2b
jmp 0x119af8
jmp 0x119aee
jmp 0x119acc
jmp 0x119aee
jmp 0x119acc
jmp 0x119aee
jmp 0x119acc
jmp 0x119aee
movq %rax, %rbx
movq 0x1e0(%rsp), %rdi
cmpq %r14, %rdi
je 0x119b35
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x119b35
movq %rax, %rbx
jmp 0x119b35
movq %rax, %rbx
jmp 0x119b3d
movq %rax, %rbx
jmp 0x119b2b
jmp 0x119aff
movq %rax, %rbx
jmp 0x119b14
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x11b224
leaq 0x58(%rsp), %rdi
callq 0x11b28e
leaq 0x1e0(%rsp), %rdi
callq 0x11b2ea
leaq 0x38(%rsp), %rdi
callq 0x11b5ac
movq %rsp, %rdi
callq 0x11b5fa
leaq 0x8(%rsp), %rdi
callq 0x11b5fa
movq %rbx, %rdi
callq 0x1162e0