// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk/exprtk_simple_example_08.cpp
// Function: void composite<double>()
void composite()
{
   typedef exprtk::symbol_table<T>         symbol_table_t;
   typedef exprtk::expression<T>           expression_t;
   typedef exprtk::parser<T>               parser_t;
   typedef exprtk::parser_error::type      err_t;
   typedef exprtk::function_compositor<T>  compositor_t;
   typedef typename compositor_t::function function_t;

   T x = T(1);
   T y = T(2);

   compositor_t compositor;

   symbol_table_t& symbol_table = compositor.symbol_table();
   symbol_table.add_constants();
   symbol_table.add_variable("x",x);
   symbol_table.add_variable("y",y);

   compositor.add(
      function_t("f")     // f(x) = sin(x / pi)
      .var("x")
      .expression( "sin(x / pi)" ));

   compositor.add(
      function_t("g")     // g(x,y) = 3[f(x) + f(y)]
      .vars("x", "y")
      .expression( "3*[f(x) + f(y)]" ));

   std::string expression_string = "g(1 + f(x), f(y) / 2)";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;

   if (!parser.compile(expression_string,expression))
   {
      printf("Error: %s\tExpression: %s\n",
             parser.error().c_str(),
             expression_string.c_str());

      for (std::size_t i = 0; i < parser.error_count(); ++i)
      {
         const err_t error = parser.get_error(i);

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

      return;
   }

   const T result = expression.value();

   printf("%s = %e\n", expression_string.c_str(), result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x14e8, %rsp           # imm = 0x14E8
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x60(%rsp)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x58(%rsp)
leaq 0xb00(%rsp), %rbx
movq %rbx, %rdi
callq 0x1128ce
movq %rbx, %rdi
callq 0x1129da
leaq 0x130d50(%rip), %rsi    # 0x2430a1
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x1122c8
leaq 0xb00(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x60(%rsp), %rdx
xorl %ecx, %ecx
callq 0x112a00
leaq 0x1d8(%rsp), %rdi
callq 0x1105c8
leaq 0x130feb(%rip), %rsi    # 0x243381
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x1122c8
leaq 0xb00(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
xorl %ecx, %ecx
callq 0x112a00
leaq 0x1d8(%rsp), %rdi
callq 0x1105c8
leaq 0x130cdb(%rip), %rsi    # 0x2430b6
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x1122c8
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x112a7c
leaq 0x130c98(%rip), %rsi    # 0x2430a1
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1122c8
leaq 0x218(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x11d5be
leaq 0x130d18(%rip), %rsi    # 0x243149
leaq 0x38(%rsp), %rdi
leaq 0xd(%rsp), %rdx
callq 0x1122c8
leaq 0x1f8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x110550
leaq 0xb00(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
xorl %edx, %edx
callq 0x112a6c
leaq 0x38(%rsp), %rdi
callq 0x1105c8
leaq 0x18(%rsp), %rdi
callq 0x1105c8
leaq 0x1d8(%rsp), %rdi
callq 0x112ac8
leaq 0x88(%rsp), %rdi
callq 0x1105c8
leaq 0x130bcb(%rip), %rsi    # 0x243069
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1122c8
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x112a7c
leaq 0x130bd5(%rip), %rsi    # 0x2430a1
leaq 0x18(%rsp), %rdi
leaq 0xd(%rsp), %rdx
callq 0x1122c8
leaq 0x130e9f(%rip), %rsi    # 0x243381
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1122c8
leaq 0x1d8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x112ae8
movq %rax, %rbx
leaq 0x130c43(%rip), %rsi    # 0x243155
leaq 0x68(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1122c8
leaq 0x20(%rbx), %rdi
leaq 0x68(%rsp), %rsi
callq 0x110550
leaq 0xb00(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x112a6c
leaq 0x68(%rsp), %rdi
callq 0x1105c8
leaq 0x38(%rsp), %rdi
callq 0x1105c8
leaq 0x18(%rsp), %rdi
callq 0x1105c8
leaq 0x1d8(%rsp), %rdi
callq 0x112ac8
leaq 0x88(%rsp), %rdi
callq 0x1105c8
leaq 0x130be5(%rip), %rsi    # 0x243165
leaq 0x18(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x1122c8
leaq 0x38(%rsp), %rdi
callq 0x112b14
leaq 0x38(%rsp), %rdi
leaq 0xb00(%rsp), %rsi
callq 0x112b74
leaq 0x88(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x112bd0
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x112ce0
leaq 0x88(%rsp), %rdi
callq 0x1132f8
leaq 0x1d8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x113340
testb %al, %al
je 0x11265d
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x18(%rsp), %rsi
leaq 0x130bc0(%rip), %rdi    # 0x2431d6
movb $0x1, %al
callq 0x110060
leaq 0x1d8(%rsp), %rdi
callq 0x113982
leaq 0x38(%rsp), %rdi
callq 0x113abc
leaq 0x18(%rsp), %rdi
callq 0x1105c8
leaq 0xb00(%rsp), %rdi
callq 0x113ad2
addq $0x14e8, %rsp           # imm = 0x14E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x88(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x1137c2
leaq 0x88(%rsp), %rbx
movq (%rbx), %rsi
movq 0x18(%rsp), %rdx
leaq 0x130af2(%rip), %rdi    # 0x24317b
xorl %eax, %eax
callq 0x110060
movq %rbx, %rdi
callq 0x1105c8
leaq 0x10(%rsp), %r12
leaq 0x68(%rsp), %r13
leaq 0x130aec(%rip), %rbp    # 0x243195
xorl %r14d, %r14d
movq %r14, 0x10(%rsp)
leaq 0x4e0(%rsp), %rdi
callq 0x118eec
cmpq %rax, %r14
jae 0x11261d
movq %rbx, %rdi
leaq 0x1d8(%rsp), %rsi
movq %r12, %rdx
callq 0x113816
movq 0x10(%rsp), %r15
movq 0xb0(%rsp), %r14
movl 0xb8(%rsp), %esi
movq %r13, %rdi
callq 0x1138aa
movq 0x68(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq 0x18(%rsp), %r9
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x110060
movq %r13, %rdi
callq 0x1105c8
movq %rbx, %rdi
callq 0x113956
movq 0x10(%rsp), %r14
incq %r14
jmp 0x1126ac
jmp 0x1127e1
jmp 0x1127e1
jmp 0x1127e1
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x1132f8
jmp 0x112803
jmp 0x11275b
movq %rax, %rbx
jmp 0x112803
movq %rax, %rbx
jmp 0x11280d
jmp 0x11279f
jmp 0x1127b3
jmp 0x1127b3
jmp 0x11277b
jmp 0x112780
jmp 0x112785
jmp 0x11279f
jmp 0x11277b
movq %rax, %rbx
jmp 0x1127c0
movq %rax, %rbx
jmp 0x1127ca
movq %rax, %rbx
jmp 0x1127d7
jmp 0x11279f
jmp 0x112790
jmp 0x11279f
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
jmp 0x112812
jmp 0x11279f
movq %rax, %rbx
jmp 0x112817
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x1105c8
jmp 0x1127b6
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x1105c8
leaq 0x18(%rsp), %rdi
callq 0x1105c8
leaq 0x1d8(%rsp), %rdi
callq 0x112ac8
leaq 0x88(%rsp), %rdi
jmp 0x112812
movq %rax, %rbx
jmp 0x1127f6
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x113956
leaq 0x1d8(%rsp), %rdi
callq 0x113982
leaq 0x38(%rsp), %rdi
callq 0x113abc
leaq 0x18(%rsp), %rdi
callq 0x1105c8
leaq 0xb00(%rsp), %rdi
callq 0x113ad2
movq %rbx, %rdi
callq 0x110310