// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk/exprtk_simple_example_20.cpp
// Function: void vector_overflow_example<double>()
void vector_overflow_example()
{
   typedef exprtk::symbol_table<T> symbol_table_t;
   typedef exprtk::expression<T>   expression_t;
   typedef exprtk::parser<T>       parser_t;

   const std::string expression_str =
      " for (var i := 0; i < max(v0[],v1[]); i += 1) "
      " {                                            "
      "    v0[i] := (2 * v0[i]) + (v1[i] / 3);       "
      " }                                            ";

   T v0[5 ] = { 0, 1, 2, 3, 4 };
   T v1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

   vector_access_rtc vec_rtc;

   vec_rtc.vector_map[v0] = "v0";
   vec_rtc.vector_map[v1] = "v1";

   symbol_table_t symbol_table;
   expression_t   expression;
   parser_t       parser;

   symbol_table.add_vector("v0", v0);
   symbol_table.add_vector("v1", v1);

   expression.register_symbol_table(symbol_table);

   parser.register_vector_access_runtime_check(vec_rtc);

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

      return;
   }

   try
   {
      expression.value();
   }
   catch(std::runtime_error& exception)
   {
      printf("Exception: %s\n",exception.what());
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xb88, %rsp            # imm = 0xB88
leaq 0x12ae11(%rip), %rsi    # 0x23b125
leaq 0x38(%rsp), %rdi
leaq 0x260(%rsp), %rdx
callq 0x1102c8
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rax
movaps %xmm0, (%rax)
movaps 0x125cd5(%rip), %xmm0   # 0x236010
movups %xmm0, 0x8(%rax)
movaps 0x125cda(%rip), %xmm0   # 0x236020
movups %xmm0, 0x18(%rax)
leaq 0x12fa4f(%rip), %rsi    # 0x23fda0
pushq $0xa
popq %rcx
leaq 0x210(%rsp), %rbx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x24f267(%rip), %rcx    # 0x35f5d0
leaq 0x68(%rsp), %rdx
movq %rcx, -0x10(%rdx)
andl $0x0, (%rdx)
andq $0x0, 0x8(%rdx)
movq %rdx, 0x10(%rdx)
movq %rdx, 0x18(%rdx)
andq $0x0, 0x20(%rdx)
leaq 0x60(%rsp), %r14
leaq 0x260(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x1106b4
leaq 0x12ae38(%rip), %rsi    # 0x23b1de
movq %rax, %rdi
callq 0x10e580
leaq 0x260(%rsp), %rsi
movq %rbx, (%rsi)
movq %r14, %rdi
callq 0x1106b4
leaq 0x12ae19(%rip), %rsi    # 0x23b1e1
movq %rax, %rdi
callq 0x10e580
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x110704
leaq 0x18(%rsp), %rdi
callq 0x110728
leaq 0xc0(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x110788
leaq 0x260(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x110898
leaq 0xc0(%rsp), %rdi
callq 0x110eb0
leaq 0x12adbe(%rip), %rsi    # 0x23b1de
leaq 0xc0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1102c8
leaq 0x10(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x110ef8
leaq 0xc0(%rsp), %rdi
callq 0x10e5c8
leaq 0x12ad81(%rip), %rsi    # 0x23b1e1
leaq 0xc0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1102c8
leaq 0x10(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x210(%rsp), %rdx
callq 0x110f5a
leaq 0xc0(%rsp), %rdi
callq 0x10e5c8
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x110fbc
leaq 0x58(%rsp), %rax
leaq 0x260(%rsp), %rdi
movq %rax, 0x8e0(%rdi)
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x111018
testb %al, %al
je 0x1104e0
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x11051b
leaq 0xc0(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x11149a
leaq 0xc0(%rsp), %rbx
movq (%rbx), %rsi
movq 0x38(%rsp), %rdx
leaq 0x12acd8(%rip), %rdi    # 0x23b1e4
xorl %eax, %eax
callq 0x10e060
movq %rbx, %rdi
callq 0x10e5c8
leaq 0x260(%rsp), %rdi
callq 0x1114ee
leaq 0x18(%rsp), %rdi
callq 0x111628
leaq 0x10(%rsp), %rdi
callq 0x11163e
leaq 0x58(%rsp), %rdi
callq 0x111680
leaq 0x38(%rsp), %rdi
callq 0x10e5c8
addq $0xb88, %rsp            # imm = 0xB88
popq %rbx
popq %r14
retq
jmp 0x1105cb
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x1105ce
movq %rbx, %rdi
callq 0x10e050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
leaq 0x12ac81(%rip), %rdi    # 0x23b1fe
movq %rax, %rsi
xorl %eax, %eax
callq 0x10e060
callq 0x10e390
jmp 0x11051b
jmp 0x1105cb
jmp 0x110594
jmp 0x1105cb
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x10e5c8
jmp 0x1105ce
jmp 0x1105cb
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x110eb0
jmp 0x1105db
movq %rax, %rbx
jmp 0x1105db
movq %rax, %rbx
jmp 0x1105e5
jmp 0x1105f3
movq %rax, %rbx
jmp 0x11060a
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x1114ee
leaq 0x18(%rsp), %rdi
callq 0x111628
leaq 0x10(%rsp), %rdi
callq 0x11163e
jmp 0x1105f6
jmp 0x1105f3
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x111680
leaq 0x38(%rsp), %rdi
callq 0x10e5c8
movq %rbx, %rdi
callq 0x10e320