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

   T x[] = { T(1), T(2), T(3), T(4), T(5) };

   std::vector<T> y;

   y.push_back(T(5)); y.push_back(T(6));
   y.push_back(T(7)); y.push_back(T(8));
   y.push_back(T(9)); y.push_back(T(0));

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

   norm<T> norm_;

   symbol_table.add_function("norm",norm_);

   const std::string vector_norm_program[] =
      {
         " norm(x)          ",
         " norm(x,1)        ",
         " norm(x,2)        ",
         " norm(x,3)        ",
         " norm(x,4)        ",
         " norm(x,5)        ",
         " norm(2x+1)       ",
         " norm(2x+1,1)     ",
         " norm(2x+1,2)     ",
         " norm(2x+1,3)     ",
         " norm(2x+1,4)     ",
         " norm(2x+1,5)     ",
         " norm(2x+y/3-4)   ",
         " norm(2x+y/3-4,1) ",
         " norm(2x+y/3-4,2) ",
         " norm(2x+y/3-4,3) ",
         " norm(2x+y/3-4,4) ",
         " norm(2x+y/3-4,5) "
      };

   const std::size_t vecnorm_program_size = sizeof(vector_norm_program) / sizeof(std::string);

   parser_t parser;

   for (std::size_t i = 0; i < vecnorm_program_size; ++i)
   {
      expression_t expression;
      expression.register_symbol_table(symbol_table);

      parser.compile(vector_norm_program[i], expression);

      printf("%s = %15.8f\n",
             vector_norm_program[i].c_str(),
             expression.value());
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd68, %rsp            # imm = 0xD68
movaps 0x126d05(%rip), %xmm0   # 0x237010
movaps %xmm0, 0x40(%rsp)
movaps 0x126d09(%rip), %xmm0   # 0x237020
movaps %xmm0, 0x50(%rsp)
movabsq $0x4014000000000000, %rax # imm = 0x4014000000000000
movq %rax, 0x60(%rsp)
leaq 0x20(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
leaq 0x440(%rsp), %rsi
movq %rax, (%rsi)
callq 0x1119d2
movabsq $0x4018000000000000, %rax # imm = 0x4018000000000000
leaq 0x440(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1119d2
movabsq $0x401c000000000000, %rax # imm = 0x401C000000000000
leaq 0x440(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1119d2
movabsq $0x4020000000000000, %rax # imm = 0x4020000000000000
leaq 0x440(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1119d2
movabsq $0x4022000000000000, %rax # imm = 0x4022000000000000
leaq 0x440(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1119d2
leaq 0x440(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x1119d2
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x110964
leaq 0x12bdf0(%rip), %rsi    # 0x23c1e1
leaq 0x440(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1102b8
leaq 0x18(%rsp), %rdi
leaq 0x440(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x110988
leaq 0x440(%rsp), %rdi
callq 0x10e5b8
leaq 0x12c0a4(%rip), %rsi    # 0x23c4d5
leaq 0x440(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1102b8
leaq 0x18(%rsp), %rdi
leaq 0x440(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x1109ea
leaq 0x440(%rsp), %rdi
callq 0x10e5b8
leaq 0x68(%rsp), %rdi
callq 0x110a54
leaq 0x12be0e(%rip), %rsi    # 0x23c289
leaq 0x440(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1102b8
leaq 0x18(%rsp), %rdi
leaq 0x440(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x110ab6
leaq 0x440(%rsp), %rdi
callq 0x10e5b8
leaq 0x12bdd3(%rip), %rsi    # 0x23c28e
leaq 0xb0(%rsp), %rbx
leaq 0x440(%rsp), %rdx
movq %rbx, %rdi
callq 0x1102b8
leaq 0xd0(%rsp), %r14
leaq 0x12bdbf(%rip), %rsi    # 0x23c2a1
leaq 0x2f0(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0xf0(%rsp), %r14
leaq 0x12bdb3(%rip), %rsi    # 0x23c2b4
leaq 0x17(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x110(%rsp), %r14
leaq 0x12bdaa(%rip), %rsi    # 0x23c2c7
leaq 0x16(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x130(%rsp), %r14
leaq 0x12bda1(%rip), %rsi    # 0x23c2da
leaq 0x15(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x150(%rsp), %r14
leaq 0x12bd98(%rip), %rsi    # 0x23c2ed
leaq 0x14(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x170(%rsp), %r14
leaq 0x12bd8f(%rip), %rsi    # 0x23c300
leaq 0x13(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x190(%rsp), %r14
leaq 0x12bd86(%rip), %rsi    # 0x23c313
leaq 0x12(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x1b0(%rsp), %r14
leaq 0x12bd7d(%rip), %rsi    # 0x23c326
leaq 0x11(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x1d0(%rsp), %r14
leaq 0x12bd74(%rip), %rsi    # 0x23c339
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x1f0(%rsp), %r14
leaq 0x12bd6b(%rip), %rsi    # 0x23c34c
leaq 0xf(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x210(%rsp), %r14
leaq 0x12bd62(%rip), %rsi    # 0x23c35f
leaq 0xe(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x230(%rsp), %r14
leaq 0x12bd59(%rip), %rsi    # 0x23c372
leaq 0xd(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x250(%rsp), %r14
leaq 0x12bd50(%rip), %rsi    # 0x23c385
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x270(%rsp), %r14
leaq 0x12bd47(%rip), %rsi    # 0x23c398
leaq 0xb(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x290(%rsp), %r14
leaq 0x12bd3e(%rip), %rsi    # 0x23c3ab
leaq 0xa(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x2b0(%rsp), %r14
leaq 0x12bd35(%rip), %rsi    # 0x23c3be
leaq 0x9(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x2d0(%rsp), %r14
leaq 0x12bd2c(%rip), %rsi    # 0x23c3d1
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x1102b8
leaq 0x2f0(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x110b7e
leaq 0x440(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x110c8e
leaq 0x2f0(%rsp), %rbx
movq %rbx, %rdi
callq 0x1112a6
xorl %ebp, %ebp
leaq 0x18(%rsp), %r14
leaq 0x440(%rsp), %r15
leaq 0x12bce7(%rip), %r12    # 0x23c3e4
cmpq $0x240, %rbp            # imm = 0x240
je 0x110763
movq %rbx, %rdi
callq 0x1112ee
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11134e
leaq (%rsp,%rbp), %r13
addq $0xb0, %r13
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1113aa
movq (%r13), %r13
movq 0x2f0(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x10e060
movq %rbx, %rdi
callq 0x11182c
addq $0x20, %rbp
jmp 0x1106fd
leaq 0x440(%rsp), %rdi
callq 0x111842
movl $0x220, %ebx            # imm = 0x220
leaq (%rsp,%rbx), %rdi
addq $0xb0, %rdi
callq 0x10e5b8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x110775
leaq 0x68(%rsp), %rdi
callq 0x11197c
leaq 0x18(%rsp), %rdi
callq 0x111990
leaq 0x20(%rsp), %rdi
callq 0x236f08
addq $0xd68, %rsp            # imm = 0xD68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq 0x2f0(%rsp), %rdi
callq 0x1112a6
jmp 0x11087e
movq %rax, %r15
jmp 0x11087e
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
jmp 0x1107fc
movq %rax, %r15
addq $-0x20, %r14
movq %r14, %rdi
callq 0x10e5b8
cmpq %rbx, %r14
jne 0x1107ff
jmp 0x11089d
jmp 0x110829
movq %rax, %r15
leaq 0x440(%rsp), %rdi
callq 0x10e5b8
jmp 0x11089d
movq %rax, %r15
jmp 0x11089d
jmp 0x110846
jmp 0x110834
jmp 0x110846
movq %rax, %r15
leaq 0x440(%rsp), %rdi
callq 0x10e5b8
jmp 0x1108a7
movq %rax, %r15
jmp 0x1108a7
jmp 0x110857
jmp 0x110857
jmp 0x110857
jmp 0x110857
jmp 0x110857
jmp 0x110857
movq %rax, %r15
jmp 0x1108b1
movq %rax, %r15
jmp 0x110871
movq %rax, %r15
leaq 0x2f0(%rsp), %rdi
callq 0x11182c
leaq 0x440(%rsp), %rdi
callq 0x111842
movl $0x220, %ebx            # imm = 0x220
leaq (%rsp,%rbx), %rdi
addq $0xb0, %rdi
callq 0x10e5b8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x110883
leaq 0x68(%rsp), %rdi
callq 0x11197c
leaq 0x18(%rsp), %rdi
callq 0x111990
leaq 0x20(%rsp), %rdi
callq 0x236f08
movq %r15, %rdi
callq 0x10e310