// File: /workspace/github_cpp_makefile_star2_O3/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 0x119b0e
leaq 0xb30(%rsp), %rdi
movq %rbx, %rsi
callq 0x119b56
leaq 0xc8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x19647e(%rip), %rsi    # 0x2af959
leaq 0x196484(%rip), %rdx    # 0x2af966
leaq 0xb8(%rsp), %rdi
callq 0x119a78
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x119cde
leaq 0x60(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x196453(%rip), %rsi    # 0x2af967
leaq 0x19644d(%rip), %rdx    # 0x2af968
leaq 0x50(%rsp), %rdi
callq 0x119a78
leaq 0x248(%rsp), %rbx
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x126896
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x19641e(%rip), %rsi    # 0x2af969
leaq 0x196535(%rip), %rdx    # 0x2afa87
leaq 0x10(%rsp), %rdi
callq 0x119a78
leaq 0x228(%rsp), %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x116520
leaq 0x1460(%rsp), %r14
leaq 0x208(%rsp), %rsi
movq %r14, %rdi
callq 0x11dc56
leaq 0x1468(%rsp), %rcx
cmpq %rax, %rcx
jne 0x119643
leaq 0xb30(%rsp), %rdi
leaq 0x208(%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x11c9bc
testb %al, %al
je 0x119643
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 0x11d87a
movq (%rax), %r15
leaq 0x208(%rsp), %rsi
movq %r14, %rdi
callq 0x11dbda
movq %r15, %rdi
movq %rax, %rsi
callq 0x11d8f6
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x11965a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x119671
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x116090
movq %rbx, %rdi
callq 0x126b30
leaq 0x238(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11969a
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x218(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x1196bb
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0x1196d8
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x208(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x19639e(%rip), %rsi    # 0x2afa88
leaq 0x19639d(%rip), %rdx    # 0x2afa8e
callq 0x119a78
leaq 0x50(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x119db8
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x119725
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x208(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x196358(%rip), %rsi    # 0x2afa8f
leaq 0x196358(%rip), %rdx    # 0x2afa96
callq 0x119a78
leaq 0x8(%rsp), %rbx
leaq 0x208(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x119ec0
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x11977a
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x19630e(%rip), %rsi    # 0x2afa97
leaq 0x196397(%rip), %rdx    # 0x2afb27
callq 0x119a78
leaq 0x30(%rsp), %rdi
callq 0x11a02a
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
subq %rax, %rcx
je 0x1197d2
sarq $0x3, %rcx
movq 0x8(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %rbx, %rax
je 0x1197e1
cmpq (%rax), %rdx
je 0x1197e1
addq $0x8, %rax
decq %rcx
jne 0x1197bf
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1278ac
leaq 0xb8(%rsp), %rdi
movl $0x7f, %esi
callq 0x11a0b6
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x11a1b6
leaq 0x1b8(%rsp), %rdi
callq 0x127a92
leaq 0x188(%rsp), %rdi
callq 0x127a92
leaq 0x158(%rsp), %rdi
callq 0x127a92
leaq 0x128(%rsp), %rdi
callq 0x127a92
leaq 0xf8(%rsp), %rdi
callq 0x127a92
leaq 0xc8(%rsp), %rdi
callq 0x127a92
leaq 0x208(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x11a9da
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x208(%rsp), %rdi
callq 0x11b576
leaq 0x30(%rsp), %rdi
callq 0x11b838
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1198aa
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1198cb
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x28ff0e(%rip), %rax    # 0x3a97e0
leaq 0x80(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x1198f7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xb30(%rsp), %rdi
callq 0x11b8c8
leaq 0x8(%rsp), %rdi
callq 0x11b92a
addq $0x1518, %rsp           # imm = 0x1518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x119937
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x11a992
jmp 0x1199c6
movq %rax, %rbx
jmp 0x1199c6
movq %rax, %rbx
jmp 0x1199d0
jmp 0x119967
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x1199e7
movq 0x218(%rsp), %rsi
jmp 0x1199df
movq %rax, %rbx
jmp 0x1199e7
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x119a4e
movq 0x218(%rsp), %rsi
jmp 0x119a46
jmp 0x1199a6
jmp 0x119991
movq %rax, %rbx
jmp 0x119a0d
movq %rax, %rbx
jmp 0x119a24
movq %rax, %rbx
jmp 0x119a31
movq %rax, %rbx
jmp 0x119a4e
movq %rax, %rbx
jmp 0x119a5b
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x11b576
leaq 0x30(%rsp), %rdi
callq 0x11b838
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1199e7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x50(%rsp), %rdi
callq 0x11b886
jmp 0x119a4e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x119a0d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x119a24
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x208(%rsp), %rdi
callq 0x119d78
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0x119a4e
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xb30(%rsp), %rdi
callq 0x11b8c8
leaq 0x8(%rsp), %rdi
callq 0x11b92a
movq %rbx, %rdi
callq 0x1162e0