// File: ArashPartow[P]exprtk/exprtk_simple_example_06.cpp
// Function: void vector_function<double>()
void vector_function()
{
   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 =
      " for (var i := 0; i < min(x[], y[], z[]); i += 1) "
      " {                                                "
      "    z[i] := 3sin(x[i]) + 2log(y[i]);              "
      " }                                                ";

   T x[] = { T(1.1), T(2.2), T(3.3), T(4.4), T(5.5) };
   T y[] = { T(1.1), T(2.2), T(3.3), T(4.4), T(5.5) };
   T z[] = { T(0.0), T(0.0), T(0.0), T(0.0), T(0.0) };

   symbol_table_t symbol_table;
   symbol_table.add_vector("x",x);
   symbol_table.add_vector("y",y);
   symbol_table.add_vector("z",z);

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
subq $0xc08, %rsp            # imm = 0xC08
leaq 0xbe7(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x111630
movq 0x20(%rsp), %rdx
leaq 0x32fd20(%rip), %rsi    # 0x448535
leaq 0xbe8(%rsp), %rdi
callq 0x118730
jmp 0x118824
leaq 0xbe7(%rsp), %rdi
callq 0x111750
xorps %xmm0, %xmm0
movaps %xmm0, 0xbb0(%rsp)
movaps %xmm0, 0xba0(%rsp)
movq $0x0, 0xbc0(%rsp)
movabsq $0x3ff199999999999a, %rdi # imm = 0x3FF199999999999A
movq %rdi, 0xba0(%rsp)
movabsq $0x400199999999999a, %rsi # imm = 0x400199999999999A
movq %rsi, 0xba8(%rsp)
movabsq $0x400a666666666666, %rdx # imm = 0x400A666666666666
movq %rdx, 0xbb0(%rsp)
movabsq $0x401199999999999a, %rcx # imm = 0x401199999999999A
movq %rcx, 0xbb8(%rsp)
movabsq $0x4016000000000000, %rax # imm = 0x4016000000000000
movq %rax, 0xbc0(%rsp)
movaps %xmm0, 0xb80(%rsp)
movaps %xmm0, 0xb70(%rsp)
movq $0x0, 0xb90(%rsp)
movq %rdi, 0xb70(%rsp)
movq %rsi, 0xb78(%rsp)
movq %rdx, 0xb80(%rsp)
movq %rcx, 0xb88(%rsp)
movq %rax, 0xb90(%rsp)
movaps %xmm0, 0xb50(%rsp)
movaps %xmm0, 0xb40(%rsp)
movq $0x0, 0xb60(%rsp)
leaq 0xb38(%rsp), %rdi
movl $0x1, %esi
callq 0x118f70
jmp 0x11891e
leaq 0xb17(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x111630
movq 0x18(%rsp), %rdx
leaq 0x32fb51(%rip), %rsi    # 0x44848d
leaq 0xb18(%rsp), %rdi
callq 0x118730
jmp 0x11894b
leaq 0xb38(%rsp), %rdi
leaq 0xb18(%rsp), %rsi
leaq 0xba0(%rsp), %rdx
callq 0x118fb0
jmp 0x11896a
leaq 0xb18(%rsp), %rdi
callq 0x111768
leaq 0xb17(%rsp), %rdi
callq 0x111750
leaq 0xaef(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x111630
movq 0x10(%rsp), %rdx
leaq 0x32fc5c(%rip), %rsi    # 0x4485fe
leaq 0xaf0(%rsp), %rdi
callq 0x118730
jmp 0x1189b1
leaq 0xb38(%rsp), %rdi
leaq 0xaf0(%rsp), %rsi
leaq 0xb70(%rsp), %rdx
callq 0x118fb0
jmp 0x1189d0
leaq 0xaf0(%rsp), %rdi
callq 0x111768
leaq 0xaef(%rsp), %rdi
callq 0x111750
leaq 0xac7(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x111630
movq 0x8(%rsp), %rdx
leaq 0x32fbf8(%rip), %rsi    # 0x448600
leaq 0xac8(%rsp), %rdi
callq 0x118730
jmp 0x118a17
leaq 0xb38(%rsp), %rdi
leaq 0xac8(%rsp), %rsi
leaq 0xb40(%rsp), %rdx
callq 0x118fb0
jmp 0x118a36
leaq 0xac8(%rsp), %rdi
callq 0x111768
leaq 0xac7(%rsp), %rdi
callq 0x111750
leaq 0xaa0(%rsp), %rdi
callq 0x119050
jmp 0x118a5f
leaq 0xaa0(%rsp), %rdi
leaq 0xb38(%rsp), %rsi
callq 0x119100
jmp 0x118a76
leaq 0x28(%rsp), %rdi
movl $0x7f, %esi
callq 0x1191b0
jmp 0x118a87
leaq 0x178(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1192e0
jmp 0x118a9b
leaq 0x28(%rsp), %rdi
callq 0x119b10
leaq 0x178(%rsp), %rdi
leaq 0xbe8(%rsp), %rsi
leaq 0xaa0(%rsp), %rdx
callq 0x119b80
jmp 0x118ac4
leaq 0xaa0(%rsp), %rdi
callq 0x11a410
jmp 0x118ad3
leaq 0x178(%rsp), %rdi
callq 0x11a430
leaq 0xaa0(%rsp), %rdi
callq 0x11a630
leaq 0xb38(%rsp), %rdi
callq 0x11a670
leaq 0xbe8(%rsp), %rdi
callq 0x111768
addq $0xc08, %rsp            # imm = 0xC08
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0xbe7(%rsp), %rdi
callq 0x111750
jmp 0x118cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118cad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118b85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0xb18(%rsp), %rdi
callq 0x111768
leaq 0xb17(%rsp), %rdi
callq 0x111750
jmp 0x118ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118bce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0xaf0(%rsp), %rdi
callq 0x111768
leaq 0xaef(%rsp), %rdi
callq 0x111750
jmp 0x118ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118c17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0xac8(%rsp), %rdi
callq 0x111768
leaq 0xac7(%rsp), %rdi
callq 0x111750
jmp 0x118ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
jmp 0x118c93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x119b10
jmp 0x118c93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xbd8(%rsp)
movl %eax, 0xbd4(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x11a430
leaq 0xaa0(%rsp), %rdi
callq 0x11a630
leaq 0xb38(%rsp), %rdi
callq 0x11a670
leaq 0xbe8(%rsp), %rdi
callq 0x111768
movq 0xbd8(%rsp), %rdi
callq 0x111430
nopw (%rax,%rax)