// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk/exprtk_simple_example_07.cpp
// Function: void logic<double>()
void logic()
{
   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 = "not(A and B) or C";

   symbol_table_t symbol_table;
   symbol_table.create_variable("A");
   symbol_table.create_variable("B");
   symbol_table.create_variable("C");

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   printf(" # | A | B | C | %s\n"
          "---+---+---+---+-%s\n",
          expression_string.c_str(),
          std::string(expression_string.size(),'-').c_str());

   for (int i = 0; i < 8; ++i)
   {
      symbol_table.get_variable("A")->ref() = T((i & 0x01) ? 1 : 0);
      symbol_table.get_variable("B")->ref() = T((i & 0x02) ? 1 : 0);
      symbol_table.get_variable("C")->ref() = T((i & 0x04) ? 1 : 0);

      const int result = static_cast<int>(expression.value());

      printf(" %d | %d | %d | %d | %d \n",
             i,
             static_cast<int>(symbol_table.get_variable("A")->value()),
             static_cast<int>(symbol_table.get_variable("B")->value()),
             static_cast<int>(symbol_table.get_variable("C")->value()),
             result);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb18, %rsp            # imm = 0xB18
leaq 0x129de6(%rip), %rsi    # 0x23a101
leaq 0x40(%rsp), %rdi
leaq 0x1f0(%rsp), %rdx
callq 0x1102c8
movq %rsp, %rdi
pushq $0x1
popq %rsi
callq 0x110818
leaq 0x12e71c(%rip), %rsi    # 0x23ea5b
leaq 0x1f0(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1102c8
leaq 0xa0(%rsp), %rdx
andq $0x0, (%rdx)
movq %rsp, %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x11083c
leaq 0x1f0(%rsp), %rdi
callq 0x10e5c8
leaq 0x129d92(%rip), %rsi    # 0x23a113
leaq 0x1f0(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1102c8
leaq 0xa0(%rsp), %rdx
andq $0x0, (%rdx)
movq %rsp, %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x11083c
leaq 0x1f0(%rsp), %rdi
callq 0x10e5c8
leaq 0x129d4e(%rip), %rsi    # 0x23a111
leaq 0x1f0(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1102c8
leaq 0xa0(%rsp), %rdx
andq $0x0, (%rdx)
movq %rsp, %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x11083c
leaq 0x1f0(%rsp), %rdi
callq 0x10e5c8
leaq 0x20(%rsp), %rdi
callq 0x1108b8
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x110918
leaq 0xa0(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x110974
leaq 0x1f0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x110a84
leaq 0xa0(%rsp), %rdi
callq 0x11109c
leaq 0x1f0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x1110e4
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rsi
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xa0(%rsp), %rdi
pushq $0x2d
popq %rdx
callq 0x10e2c0
leaq 0xa0(%rsp), %rbx
movq (%rbx), %rdx
leaq 0x129c7f(%rip), %rdi    # 0x23a115
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e060
movq %rbx, %rdi
callq 0x10e5c8
leaq 0x12e5ac(%rip), %r14    # 0x23ea5b
leaq 0x80(%rsp), %rbp
movq %rsp, %r15
xorl %r13d, %r13d
cmpl $0x8, %r13d
je 0x110676
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x1102c8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111566
movl %r13d, %ecx
andl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
movq 0x28(%rax), %rax
movsd %xmm0, (%rax)
movq %rbx, %rdi
callq 0x10e5c8
movq %rbx, %rdi
leaq 0x129c0f(%rip), %rsi    # 0x23a113
movq %rbp, %rdx
callq 0x1102c8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111566
movl %r13d, %ecx
shrl %ecx
andl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
movq 0x28(%rax), %rax
movsd %xmm0, (%rax)
movq %rbx, %rdi
callq 0x10e5c8
movsd 0x124acd(%rip), %xmm0   # 0x235008
movsd %xmm0, 0x10(%rsp)
cmpl $0x4, %r13d
jae 0x110551
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x129bb6(%rip), %rsi    # 0x23a111
movq %rbp, %rdx
callq 0x1102c8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111566
movq 0x28(%rax), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movq %rbx, %rdi
callq 0x10e5c8
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0xf(%rsp), %rdx
callq 0x1102c8
movq %rbx, %rsi
movl %r13d, 0x1c(%rsp)
movq %rbp, %rbx
movq %r15, %r13
movq %r15, %rdi
callq 0x111566
movq 0x28(%rax), %rax
cvttsd2si (%rax), %ebp
movq %rbx, %r12
movq %rbx, %rdi
leaq 0x129b3f(%rip), %rsi    # 0x23a113
leaq 0xe(%rsp), %rdx
callq 0x1102c8
movq %r13, %rdi
movq %r12, %rsi
callq 0x111566
movq 0x28(%rax), %rax
cvttsd2si (%rax), %r14d
leaq 0x60(%rsp), %r12
movq %r12, %rdi
leaq 0x129b10(%rip), %rsi    # 0x23a111
leaq 0xd(%rsp), %rdx
callq 0x1102c8
movq %r13, %r15
movq %r13, %rdi
movq %r12, %rsi
callq 0x111566
cvttsd2si 0x10(%rsp), %r9d
movq 0x28(%rax), %rax
cvttsd2si (%rax), %r8d
leaq 0x129b0e(%rip), %rdi    # 0x23a13e
movl 0x1c(%rsp), %r13d
movl %r13d, %esi
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x10e060
movq %r12, %rdi
callq 0x10e5c8
movq %rbx, %rbp
movq %rbx, %rdi
callq 0x10e5c8
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
callq 0x10e5c8
incl %r13d
leaq 0x12e3ea(%rip), %r14    # 0x23ea5b
jmp 0x1104bd
leaq 0x1f0(%rsp), %rdi
callq 0x1115bc
leaq 0x20(%rsp), %rdi
callq 0x1116f6
movq %rsp, %rdi
callq 0x11170c
leaq 0x40(%rsp), %rdi
callq 0x10e5c8
addq $0xb18, %rsp            # imm = 0xB18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x110742
jmp 0x110742
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x11109c
jmp 0x110752
jmp 0x1106d2
movq %rax, %rbx
jmp 0x110752
jmp 0x1106f3
jmp 0x1106e1
jmp 0x1106f3
jmp 0x1106e1
jmp 0x1106f3
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x10e5c8
jmp 0x11075c
movq %rax, %rbx
jmp 0x11075c
movq %rax, %rbx
jmp 0x110764
jmp 0x110730
jmp 0x110730
jmp 0x110705
jmp 0x110742
movq %rax, %rbx
jmp 0x110719
jmp 0x110730
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x10e5c8
leaq 0x80(%rsp), %rdi
callq 0x10e5c8
jmp 0x110733
jmp 0x110742
jmp 0x110730
jmp 0x110742
jmp 0x110742
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x10e5c8
jmp 0x110745
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x1115bc
leaq 0x20(%rsp), %rdi
callq 0x1116f6
movq %rsp, %rdi
callq 0x11170c
leaq 0x40(%rsp), %rdi
callq 0x10e5c8
movq %rbx, %rdi
callq 0x10e320