// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk-extras/exprtk_sumofprimes.cpp
// Function: void sum_of_primes<double>()
void sum_of_primes()
{
   typedef exprtk::symbol_table<T>         symbol_table_t;
   typedef exprtk::expression<T>           expression_t;
   typedef exprtk::parser<T>               parser_t;
   typedef exprtk::function_compositor<T>  compositor_t;
   typedef typename compositor_t::function function_t;

   symbol_table_t symbol_table;

   compositor_t compositor(symbol_table);

   // define function: sum_of_primes(z)
   compositor.add(
      function_t("sum_of_primes")
        .var("z")
        .expression(
          " var i     := 2;      "
          " var total := 0;      "
          " while (z > 1)        "
          " {                    "
          "    if (0 == (z % i)) "
          "    {                 "
          "       total += i;    "
          "       z /= i;        "
          "    }                 "
          "    else              "
          "       i += 1;        "
          " };                   "
          " total;               "));

   exprtk::rtl::io::println<T> println;

   symbol_table.add_function("println",println);

   const std::string sum_of_prime_factors_program =
      " for (var i := 1; i <= 100; i += 1) "
      " {                                  "
      "    println(i, sum_of_primes(i));   "
      " }                                  ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1518, %rsp           # imm = 0x1518
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11cb8a
leaq 0xb30(%rsp), %rdi
movq %rbx, %rsi
callq 0x11cbd2
leaq 0xc8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b93ad(%rip), %rsi    # 0x2d58e1
leaq 0x1b93b3(%rip), %rdx    # 0x2d58ee
leaq 0xb8(%rsp), %rdi
callq 0x11cafa
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x11cd5a
leaq 0x60(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b9382(%rip), %rsi    # 0x2d58ef
leaq 0x1b937c(%rip), %rdx    # 0x2d58f0
leaq 0x50(%rsp), %rdi
callq 0x11cafa
leaq 0x248(%rsp), %rbx
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x12b322
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1b934d(%rip), %rsi    # 0x2d58f1
leaq 0x1b9464(%rip), %rdx    # 0x2d5a0f
leaq 0x10(%rsp), %rdi
callq 0x11cafa
leaq 0x228(%rsp), %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x119520
leaq 0x1460(%rsp), %r14
leaq 0x208(%rsp), %rsi
movq %r14, %rdi
callq 0x120b30
leaq 0x1468(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11c69c
leaq 0xb30(%rsp), %rdi
leaq 0x208(%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x11f88e
testb %al, %al
je 0x11c69c
leaq 0x208(%rsp), %rsi
movq 0x88(%rsi), %rax
movq %rax, %rcx
subq 0x68(%rsi), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
movq 0x60(%rsi), %rax
movq 0x70(%rsi), %rdx
subq 0x78(%rsi), %rdx
subq 0x50(%rsi), %rax
sarq $0x5, %rdx
sarq $0x5, %rax
leaq (%rcx,%rcx,2), %rcx
shlq $0x8, %rcx
addq 0x1490(%rsp), %rcx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq %rdx, %rdi
addq %rcx, %rdi
callq 0x120760
movq (%rax), %r15
leaq 0x208(%rsp), %rsi
movq %r14, %rdi
callq 0x120ab4
movq %r15, %rdi
movq %rax, %rsi
callq 0x1207dc
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x11c6b3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11c6ca
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
movq %rbx, %rdi
callq 0x12b5bc
leaq 0x238(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c6f3
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x218(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x11c714
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0x11c731
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x208(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b92cd(%rip), %rsi    # 0x2d5a10
leaq 0x1b92cc(%rip), %rdx    # 0x2d5a16
callq 0x11cafa
leaq 0x50(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x11ce34
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c77e
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x208(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b9287(%rip), %rsi    # 0x2d5a17
leaq 0x1b9287(%rip), %rdx    # 0x2d5a1e
callq 0x11cafa
leaq 0x8(%rsp), %rbx
leaq 0x208(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x11cf3c
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c7d3
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1b923d(%rip), %rsi    # 0x2d5a1f
leaq 0x1b92c6(%rip), %rdx    # 0x2d5aaf
callq 0x11cafa
leaq 0x30(%rsp), %rdi
callq 0x11d0c6
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
subq %rcx, %rax
je 0x11c854
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x11c863
movq 0x8(%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11c863
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11c854
decq %rsi
cmpq %rbx, %rcx
je 0x11c84c
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11c833
negq %rsi
cmpq %rax, %rsi
jb 0x11c863
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12c7c2
leaq 0xb8(%rsp), %rdi
movl $0x7f, %esi
callq 0x11d160
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x11d260
leaq 0x1b8(%rsp), %rdi
callq 0x12c9a8
leaq 0x188(%rsp), %rdi
callq 0x12c9a8
leaq 0x158(%rsp), %rdi
callq 0x12c9a8
leaq 0x128(%rsp), %rdi
callq 0x12c9a8
leaq 0xf8(%rsp), %rdi
callq 0x12c9a8
leaq 0xc8(%rsp), %rdi
callq 0x12c9a8
leaq 0x208(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x11da84
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x208(%rsp), %rdi
callq 0x11e456
leaq 0x30(%rsp), %rdi
callq 0x11e718
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x11c92c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c94d
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2c3384(%rip), %rax    # 0x3dfcd8
leaq 0x80(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x11c979
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xb30(%rsp), %rdi
callq 0x11e7a8
leaq 0x8(%rsp), %rdi
callq 0x11e80a
addq $0x1518, %rsp           # imm = 0x1518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11c9b9
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x11da3c
jmp 0x11ca48
movq %rax, %rbx
jmp 0x11ca48
movq %rax, %rbx
jmp 0x11ca52
jmp 0x11c9e9
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x11ca69
movq 0x218(%rsp), %rsi
jmp 0x11ca61
movq %rax, %rbx
jmp 0x11ca69
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cad0
movq 0x218(%rsp), %rsi
jmp 0x11cac8
jmp 0x11ca28
jmp 0x11ca13
movq %rax, %rbx
jmp 0x11ca8f
movq %rax, %rbx
jmp 0x11caa6
movq %rax, %rbx
jmp 0x11cab3
movq %rax, %rbx
jmp 0x11cad0
movq %rax, %rbx
jmp 0x11cadd
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x11e456
leaq 0x30(%rsp), %rdi
callq 0x11e718
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x11ca69
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x50(%rsp), %rdi
callq 0x11e766
jmp 0x11cad0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x11ca8f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11caa6
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x208(%rsp), %rdi
callq 0x11cdf4
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cad0
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xb30(%rsp), %rdi
callq 0x11e7a8
leaq 0x8(%rsp), %rdi
callq 0x11e80a
movq %rbx, %rdi
callq 0x1192e0