// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk-extras/exprtk_factorize_pollard.cpp
// Function: void factorize_pollards_rho<double>()
void factorize_pollards_rho()
{
   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;

   // Form: n = p*q where p,q are prime
   T composites[] =
   {
       199203677,  779234623,  843093203,  883543291, 1197162971,
      1282615157, 1552390397, 1765737859, 1878769589, 1993904873,
      2257133471, 2520523529, 2579094799, 2853450949, 2935025369,
      3095780533, 3164132249, 3408963511, 4260042859, 4608613981,
      4654875857, 5085931997, 7278175081, 7289187463, 9206112101
   };

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

   symbol_table_t symbol_table;

   symbol_table.add_vector  ("composites", composites);
   symbol_table.add_function("println"   , println   );

   compositor_t compositor(symbol_table);

   compositor.add(function_t()
      .name("gcd")
      .var("x") .var("y")
      .expression
      (
         " x := abs(x);       "
         " y := abs(y);       "
         " while (0 != y)     "
         " {                  "
         "    var r := x % y; "
         "    x := y;         "
         "    y := r;         "
         " };                 "
         " x                  "
      ));

   compositor.add(function_t()
      .name("pollard_rho")
      .var("n")
      .expression
      (
         " var c  := 10;                "
         " var a1 := 1 + c;             "
         " var a2 := 11 + c;            "
         "                              "
         " while (gcd(n, a2 - a1) == 1) "
         " {                            "
         "    /* The Tortoise */        "
         "    a1 := (a1^2 + c) % n;     "
         "                              "
         "    /* The Hare */            "
         "    a2 := (a2^2 + c) % n;     "
         "    a2 := (a2^2 + c) % n;     "
         " };                           "
         "                              "
         " var g := gcd(n, a2 - a1);    "
         "                              "
         " n / g                        "
      ));

   const std::string factorize_composites_program =
      " for (var i := 0; i < composites[]; i += 1)                               "
      " {                                                                        "
      "    var n       := composites[i];                                         "
      "    var factor0 := pollard_rho(n);                                        "
      "    var factor1 := n / factor0;                                           "
      "                                                                          "
      "    if ((factor0 * factor1 == n) and (factor0 != 1))                      "
      "    {                                                                     "
      "       println('n: ', n, ' factors: { ', factor0 ,' , ', factor1 ,' } '); "
      "    }                                                                     "
      "    else                                                                  "
      "    {                                                                     "
      "       println('failed to factorize ', n);                                "
      "    }                                                                     "
      " }                                                                        "
      "                                                                          ";
   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x15f8, %rsp           # imm = 0x15F8
leaq 0x1be68a(%rip), %rsi    # 0x2dab90
leaq 0x1530(%rsp), %rdi
movl $0xc8, %edx
callq 0x119060
leaq 0x230(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b93b2(%rip), %rsi    # 0x2d58dd
leaq 0x1b93b1(%rip), %rdx    # 0x2d58e3
leaq 0x220(%rsp), %rdi
callq 0x11d03e
leaq 0x1b8(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x11d0ce
movq 0x220(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c571
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x119090
movq %rsp, %rdi
movl $0x1, %esi
callq 0x11d1d6
leaq 0x220(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b9354(%rip), %rsi    # 0x2d58e4
leaq 0x1b9357(%rip), %rdx    # 0x2d58ee
callq 0x11d03e
movq (%rsp), %rax
testq %rax, %rax
je 0x11c786
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x11c786
movq 0x228(%rsp), %rax
testq %rax, %rax
je 0x11c786
movq 0x220(%rsp), %rcx
movb (%rcx), %dl
andb $-0x21, %dl
addb $-0x41, %dl
cmpb $0x19, %dl
ja 0x11c786
cmpq $0x1, %rax
je 0x11c631
leaq -0x1(%rax), %rsi
movl $0x1, %edi
xorl %edx, %edx
movb (%rcx,%rdi), %r8b
cmpb $0x5f, %r8b
je 0x11c621
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x11c621
movl %r8d, %r9d
andb $-0x21, %r9b
addb $-0x41, %r9b
cmpb $0x1a, %r9b
jb 0x11c621
cmpq %rsi, %rdi
jae 0x11c62c
cmpb $0x2e, %r8b
jne 0x11c62c
incq %rdi
cmpq %rax, %rdi
setae %dl
jne 0x11c5f1
testb $0x1, %dl
je 0x11c652
leaq 0x1f0(%rbx), %rdi
leaq 0x220(%rsp), %rsi
callq 0x11fc50
addq $0x1f8, %rbx            # imm = 0x1F8
cmpq %rax, %rbx
sete %dl
testb $0x1, %dl
je 0x11c786
movq (%rsp), %rax
testq %rax, %rax
je 0x11c75c
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x11c75c
cmpq $0x0, 0x228(%rsp)
je 0x11c69d
leaq 0x220(%rsp), %rsi
movq %rbx, %rdi
callq 0x11fcda
addq $0x8, %rbx
cmpq %rax, %rbx
jne 0x11c786
cmpq $0x0, 0x228(%rsp)
je 0x11c6d4
movq (%rsp), %rax
movq 0x8(%rax), %rbx
leaq 0x188(%rbx), %rdi
leaq 0x220(%rsp), %rsi
callq 0x11ff1a
addq $0x190, %rbx            # imm = 0x190
cmpq %rax, %rbx
jne 0x11c786
cmpq $0x0, 0x228(%rsp)
je 0x11c707
movq (%rsp), %rax
movq 0x8(%rax), %rbx
leaq 0x150(%rbx), %rdi
leaq 0x220(%rsp), %rsi
callq 0x12015a
addq $0x158, %rbx            # imm = 0x158
cmpq %rax, %rbx
jne 0x11c786
cmpq $0x0, 0x228(%rsp)
je 0x11c734
movq (%rsp), %rax
movq 0x8(%rax), %rbx
leaq 0x38(%rbx), %rdi
leaq 0x220(%rsp), %rsi
callq 0x12039a
addq $0x40, %rbx
cmpq %rax, %rbx
jne 0x11c786
movq (%rsp), %rax
movq 0x8(%rax), %rbx
leaq 0x1f0(%rbx), %rdi
leaq 0x220(%rsp), %rsi
callq 0x11fc50
addq $0x1f8, %rbx            # imm = 0x1F8
cmpq %rax, %rbx
jne 0x11c786
movq (%rsp), %rax
movl $0x150, %edi            # imm = 0x150
addq 0x8(%rax), %rdi
leaq 0x220(%rsp), %rsi
leaq 0x1530(%rsp), %rdx
movl $0x19, %ecx
xorl %r8d, %r8d
callq 0x1205da
movq 0x220(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c7a3
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x220(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b913a(%rip), %rsi    # 0x2d58ef
leaq 0x1b913a(%rip), %rdx    # 0x2d58f6
callq 0x11d03e
movq %rsp, %rdi
leaq 0x220(%rsp), %rsi
leaq 0x1b8(%rsp), %rdx
callq 0x11d21e
movq 0x220(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c7f6
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x220(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x11d3a8
leaq 0xc08(%rsp), %rdi
callq 0x11d530
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b90d1(%rip), %rsi    # 0x2d58f7
leaq 0x1b90cd(%rip), %rdx    # 0x2d58fa
leaq 0x68(%rsp), %rdi
callq 0x11d03e
leaq 0xc08(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x119520
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b8fdc(%rip), %rsi    # 0x2d5835
leaq 0x1b8fd6(%rip), %rdx    # 0x2d5836
leaq 0x8(%rsp), %rdi
callq 0x11d03e
leaq 0xc48(%rsp), %r15
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x12c7ec
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b9961(%rip), %rsi    # 0x2d61f0
leaq 0x1b995b(%rip), %rdx    # 0x2d61f1
leaq 0x28(%rsp), %rdi
callq 0x11d03e
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x12c7ec
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b903e(%rip), %rsi    # 0x2d58fb
leaq 0x1b90eb(%rip), %rdx    # 0x2d59af
leaq 0x48(%rsp), %rdi
callq 0x11d03e
leaq 0xc28(%rsp), %r12
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
callq 0x119520
leaq 0xb50(%rsp), %rdi
leaq 0xc08(%rsp), %rsi
callq 0x1239f4
leaq 0xb58(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11c9b7
leaq 0x220(%rsp), %rdi
leaq 0xc08(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x122752
testb %al, %al
je 0x11c9b7
leaq 0xc08(%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 0xb80(%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 0x123624
movq (%rax), %r12
leaq 0xc08(%rsp), %rsi
leaq 0xb50(%rsp), %rdi
callq 0x123978
movq %r12, %rdi
movq %rax, %rsi
callq 0x1236a0
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c9ce
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11c9e5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11ca01
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x11ca18
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x119090
movq %r15, %rdi
callq 0x12ca86
leaq 0xc38(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x11ca41
movq 0xc38(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x11ca62
movq 0xc18(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc08(%rsp), %rdi
callq 0x11d530
leaq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1b8f2d(%rip), %rsi    # 0x2d59b0
leaq 0x1b8f31(%rip), %rdx    # 0x2d59bb
callq 0x11d03e
leaq 0xc08(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x119520
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1b8cf3(%rip), %rsi    # 0x2d57a8
leaq 0x1b8ced(%rip), %rdx    # 0x2d57a9
callq 0x11d03e
leaq 0xc48(%rsp), %r15
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x12c7ec
leaq 0x28(%rsp), %rdi
movq %rbp, (%rdi)
leaq 0x1b8ed7(%rip), %rsi    # 0x2d59bc
leaq 0x1b90ce(%rip), %rdx    # 0x2d5bba
callq 0x11d03e
leaq 0xc28(%rsp), %r12
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0x119520
leaq 0xc08(%rsp), %rsi
leaq 0xb50(%rsp), %rdi
callq 0x1239f4
leaq 0xb58(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11cbda
leaq 0x220(%rsp), %rdi
leaq 0xc08(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x122752
testb %al, %al
je 0x11cbda
leaq 0xc08(%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 0xb80(%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 0x123624
movq (%rax), %r12
leaq 0xc08(%rsp), %rsi
leaq 0xb50(%rsp), %rdi
callq 0x123978
movq %r12, %rdi
movq %rax, %rsi
callq 0x1236a0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11cbf1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cc0d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x11cc29
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x119090
movq %r15, %rdi
callq 0x12ca86
movq 0xc28(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cc4e
movq 0xc38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0xc08(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cc6b
movq 0xc18(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1b8f3c(%rip), %rsi    # 0x2d5bbb
leaq 0x1b93d5(%rip), %rdx    # 0x2d605b
callq 0x11d03e
leaq 0x28(%rsp), %rdi
callq 0x11d5fc
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
je 0x11ccf0
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x11ccfd
movq (%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11ccfd
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11ccf0
decq %rsi
cmpq %rbx, %rcx
je 0x11cce8
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11cccf
negq %rsi
cmpq %rax, %rsi
jb 0x11ccfd
leaq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x12ccf8
leaq 0x68(%rsp), %rdi
movl $0x7f, %esi
callq 0x11d696
leaq 0xc08(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x11d796
leaq 0x168(%rsp), %rdi
callq 0x12cede
leaq 0x138(%rsp), %rdi
callq 0x12cede
leaq 0x108(%rsp), %rdi
callq 0x12cede
leaq 0xd8(%rsp), %rdi
callq 0x12cede
leaq 0xa8(%rsp), %rdi
callq 0x12cede
leaq 0x78(%rsp), %rdi
callq 0x12cede
leaq 0xc08(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x11dfba
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0xc08(%rsp), %rdi
callq 0x11e98c
leaq 0x28(%rsp), %rdi
callq 0x11ec4e
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cdc2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x220(%rsp), %rdi
callq 0x11ec9c
movq %rsp, %rdi
callq 0x11ecfe
leaq 0x210(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11cdf8
movq 0x210(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2c1d91(%rip), %rax    # 0x3deb90
leaq 0x1e8(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x11ce24
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x119090
addq $0x15f8, %rsp           # imm = 0x15F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11cea6
jmp 0x11ce4c
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x11df72
jmp 0x11cf22
movq %rax, %rbx
jmp 0x11cf22
movq %rax, %rbx
jmp 0x11cf2c
jmp 0x11ce9c
jmp 0x11ce60
movq %rax, %rbx
jmp 0x11cf6b
jmp 0x11ce6a
movq %rax, %rbx
jmp 0x11cf87
jmp 0x11ce94
jmp 0x11ce9c
jmp 0x11ce78
movq %rax, %rbx
jmp 0x11cfb2
jmp 0x11ce82
movq %rax, %rbx
jmp 0x11cfc9
jmp 0x11ce8c
movq %rax, %rbx
jmp 0x11cfe5
movq %rax, %rbx
jmp 0x11cffc
movq %rax, %rbx
jmp 0x11d009
jmp 0x11ced1
movq %rax, %rbx
movq 0x220(%rsp), %rdi
cmpq %r14, %rdi
je 0x11d016
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11d016
jmp 0x11ced1
movq %rax, %rbx
jmp 0x11d016
movq %rax, %rbx
jmp 0x11d01e
movq %rax, %rbx
movq 0x220(%rsp), %rdi
cmpq %r14, %rdi
je 0x11d02b
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11d02b
movq %rax, %rbx
jmp 0x11d02b
movq %rax, %rbx
leaq 0xc08(%rsp), %rdi
callq 0x11e98c
leaq 0x28(%rsp), %rdi
callq 0x11ec4e
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11d009
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11d009
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11cf6b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cf87
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
jne 0x11cfef
jmp 0x11cffc
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cfb2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11cfc9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cfe5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cffc
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc08(%rsp), %rdi
callq 0x11d5bc
leaq 0x220(%rsp), %rdi
callq 0x11ec9c
movq %rsp, %rdi
callq 0x11ecfe
leaq 0x1b8(%rsp), %rdi
callq 0x11ed94
movq %rbx, %rdi
callq 0x1192e0