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

   symbol_table_t symbol_table;

   import_packages<T> import_package(symbol_table);

   symbol_table.add_function("import",import_package);

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;

   const std::string import_packages_program =
      " import('exprtk.rtl.io'     ); "
      " import('exprtk.rtl.io.file'); "
      " import('exprtk.rtl.vecops' ); "
      "                               "
      " var v[7] := [1:1];            "
      "                               "
      " println('v: ', v);            "
      "                               "
      " reverse(v);                   "
      "                               "
      " println('reversed v: ', v);   "
      "                               ";

   parser.compile(import_packages_program, expression);

   expression.value();
}

// Assembly:
subq $0x15b8, %rsp           # imm = 0x15B8
leaq 0x15b0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0x1, %esi
callq 0x11be40
movq 0x10(%rsp), %rsi
leaq 0xb10(%rsp), %rdi
callq 0x11be80
jmp 0x11b912
leaq 0xadf(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1146f0
movq 0x8(%rsp), %rdx
leaq 0x341c4e(%rip), %rsi    # 0x45d57e
leaq 0xae0(%rsp), %rdi
callq 0x11b820
jmp 0x11b93f
leaq 0x15b0(%rsp), %rdi
leaq 0xae0(%rsp), %rsi
leaq 0xb10(%rsp), %rdx
callq 0x11c150
jmp 0x11b95e
leaq 0xae0(%rsp), %rdi
callq 0x114858
leaq 0xadf(%rsp), %rdi
callq 0x114840
leaq 0xab8(%rsp), %rdi
callq 0x11c350
jmp 0x11b987
leaq 0xab8(%rsp), %rdi
leaq 0x15b0(%rsp), %rsi
callq 0x11c400
jmp 0x11b99e
leaq 0x40(%rsp), %rdi
movl $0x7f, %esi
callq 0x11c4b0
jmp 0x11b9af
leaq 0x190(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x11c5e0
jmp 0x11b9c3
leaq 0x40(%rsp), %rdi
callq 0x11ce10
leaq 0x1f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x1146f0
movq (%rsp), %rdx
leaq 0x341b9f(%rip), %rsi    # 0x45d585
leaq 0x20(%rsp), %rdi
callq 0x11b820
jmp 0x11b9f2
leaq 0x1f(%rsp), %rdi
callq 0x114840
leaq 0x190(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xab8(%rsp), %rdx
callq 0x11ce80
jmp 0x11ba18
leaq 0xab8(%rsp), %rdi
callq 0x11d710
jmp 0x11ba27
leaq 0x20(%rsp), %rdi
callq 0x114858
leaq 0x190(%rsp), %rdi
callq 0x11d730
leaq 0xab8(%rsp), %rdi
callq 0x11d930
leaq 0xb10(%rsp), %rdi
callq 0x11d970
leaq 0x15b0(%rsp), %rdi
callq 0x11d9e0
addq $0x15b8, %rsp           # imm = 0x15B8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
jmp 0x11bb83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
jmp 0x11babd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
leaq 0xae0(%rsp), %rdi
callq 0x114858
leaq 0xadf(%rsp), %rdi
callq 0x114840
jmp 0x11bb76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
jmp 0x11bb76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
jmp 0x11bb69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x11ce10
jmp 0x11bb69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
leaq 0x1f(%rsp), %rdi
callq 0x114840
jmp 0x11bb5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb08(%rsp)
movl %eax, 0xb04(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x114858
leaq 0x190(%rsp), %rdi
callq 0x11d730
leaq 0xab8(%rsp), %rdi
callq 0x11d930
leaq 0xb10(%rsp), %rdi
callq 0x11d970
leaq 0x15b0(%rsp), %rdi
callq 0x11d9e0
movq 0xb08(%rsp), %rdi
callq 0x1144e0
nopl (%rax)