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

   std::vector<T> disks = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

   exprtk::rtl::io::package<T> io_package;

   symbol_table_t symbol_table;
   symbol_table.add_vector ("disks", disks);
   symbol_table.add_package(io_package);

   compositor_t compositor(symbol_table);

   compositor.load_variables(true);
   compositor.load_vectors  (true);

   compositor.add(
      function_t("move_disk")
      .vars("disk", "src_rod", "dest_rod")
      .expression
      (
         "println('Move disk', disk ,' from rod[', src_rod ,'] to rod[', dest_rod ,']');"
      ));

   compositor.add(
      function_t("tower_of_hanoi")
      .vars("n", "src", "dest", "aux")
      .expression
      (
         " if (n == 1)                            "
         " {                                      "
         "    move_disk(disks[0], src, dest);     "
         "    return [true];                      "
         " };                                     "
         "                                        "
         " tower_of_hanoi(n - 1, src, aux, dest); "
         "                                        "
         " move_disk(disks[n - 1], src, dest);    "
         "                                        "
         " tower_of_hanoi(n - 1, aux, dest, src); "
         "                                        "
      ));

   const std::string tower_of_hanoi_program =
      " tower_of_hanoi(disks[], 1, 2, 3); ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x15f8, %rsp           # imm = 0x15F8
leaq 0x1be1aa(%rip), %rsi    # 0x2da6b0
leaq 0xc10(%rsp), %rax
movl $0xa, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x90(%rsp), %rdi
leaq 0x2e8(%rsp), %rcx
movl $0xa, %edx
movq %rax, %rsi
callq 0x11d0a6
leaq 0x218(%rsp), %rdi
callq 0x11d0ec
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x11d1cc
leaq 0xc20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b9378(%rip), %rsi    # 0x2d58dd
leaq 0x1b9376(%rip), %rdx    # 0x2d58e2
leaq 0xc10(%rsp), %rdi
callq 0x11d016
leaq 0x8(%rsp), %rdi
leaq 0xc10(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x11d214
movq 0xc10(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c5b0
movq 0xc20(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x218(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1218ba
leaq 0xc10(%rsp), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x11d32c
movw $0x101, 0x15f0(%rsp)    # imm = 0x101
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b92ef(%rip), %rsi    # 0x2d58e3
leaq 0x1b92f1(%rip), %rdx    # 0x2d58ec
leaq 0xc8(%rsp), %rdi
callq 0x11d016
leaq 0x2e8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x11d4b4
leaq 0x40(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b92bb(%rip), %rsi    # 0x2d58e8
leaq 0x1b92b8(%rip), %rdx    # 0x2d58ec
leaq 0x30(%rsp), %rdi
callq 0x11d016
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b929f(%rip), %rsi    # 0x2d58ed
leaq 0x1b929f(%rip), %rdx    # 0x2d58f4
leaq 0x10(%rsp), %rdi
callq 0x11d016
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b9283(%rip), %rsi    # 0x2d58f5
leaq 0x1b9284(%rip), %rdx    # 0x2d58fd
leaq 0x70(%rsp), %rdi
callq 0x11d016
leaq 0x328(%rsp), %r15
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x70(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b923c(%rip), %rsi    # 0x2d58fe
leaq 0x1b9283(%rip), %rdx    # 0x2d594c
leaq 0x50(%rsp), %rdi
callq 0x11d016
leaq 0x308(%rsp), %r12
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x119520
leaq 0x1540(%rsp), %rdi
leaq 0x2e8(%rsp), %rsi
callq 0x123fe2
leaq 0x1548(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11c7bc
leaq 0xc10(%rsp), %rdi
leaq 0x2e8(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x122d40
testb %al, %al
je 0x11c7bc
leaq 0x2e8(%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 0x1570(%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 0x123c12
movq (%rax), %r12
leaq 0x2e8(%rsp), %rsi
leaq 0x1540(%rsp), %rdi
callq 0x123f66
movq %r12, %rdi
movq %rax, %rsi
callq 0x123c8e
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x11c7d8
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x11c7f2
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c809
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11c820
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x119090
movq %r15, %rdi
callq 0x12d1da
leaq 0x318(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x11c849
movq 0x318(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2f8(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
leaq 0xd8(%rsp), %r15
je 0x11c872
movq 0x2f8(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x11c88f
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b90ac(%rip), %rsi    # 0x2d594d
leaq 0x1b90b3(%rip), %rdx    # 0x2d595b
callq 0x11d016
leaq 0x2e8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x11d4b4
leaq 0x30(%rsp), %rdi
movq %rbp, (%rdi)
leaq 0x1b8ed7(%rip), %rsi    # 0x2d57a8
leaq 0x1b8ed1(%rip), %rdx    # 0x2d57a9
callq 0x11d016
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1b906b(%rip), %rsi    # 0x2d595c
leaq 0x1b9067(%rip), %rdx    # 0x2d595f
callq 0x11d016
leaq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1b904c(%rip), %rsi    # 0x2d5960
leaq 0x1b9049(%rip), %rdx    # 0x2d5964
callq 0x11d016
leaq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
movq %rax, (%rdi)
leaq 0x1bdd5a(%rip), %rsi    # 0x2da68e
leaq 0x1bdd56(%rip), %rdx    # 0x2da691
callq 0x11d016
leaq 0x328(%rsp), %r15
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x70(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0x12cf40
leaq 0xb8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b8fd6(%rip), %rsi    # 0x2d5965
leaq 0x1b91af(%rip), %rdx    # 0x2d5b45
leaq 0xa8(%rsp), %rdi
callq 0x11d016
leaq 0x308(%rsp), %r12
leaq 0xa8(%rsp), %rsi
movq %r12, %rdi
callq 0x119520
leaq 0x2e8(%rsp), %rsi
leaq 0x1540(%rsp), %rdi
callq 0x123fe2
leaq 0x1548(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11ca8f
leaq 0xc10(%rsp), %rdi
leaq 0x2e8(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x122d40
testb %al, %al
je 0x11ca8f
leaq 0x2e8(%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 0x1570(%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 0x123c12
movq (%rax), %r12
leaq 0x2e8(%rsp), %rsi
leaq 0x1540(%rsp), %rdi
callq 0x123f66
movq %r12, %rdi
movq %rax, %rsi
callq 0x123c8e
movq 0xa8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11caac
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
leaq 0x40(%rsp), %r12
je 0x11cacd
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x11caef
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x11cb0b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x11cb22
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x119090
movq %r15, %rdi
callq 0x12d1da
movq 0x308(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cb47
movq 0x318(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x2e8(%rsp), %rdi
cmpq %r14, %rdi
leaq 0xd8(%rsp), %r14
je 0x11cb6c
movq 0x2f8(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cb89
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x30(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1b8fae(%rip), %rsi    # 0x2d5b46
leaq 0x1b8fca(%rip), %rdx    # 0x2d5b69
callq 0x11d016
leaq 0x10(%rsp), %rdi
callq 0x11d58e
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
je 0x11cc0a
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x11cc19
movq 0x8(%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11cc19
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11cc0a
decq %rsi
cmpq %rbx, %rcx
je 0x11cc02
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11cbe9
negq %rsi
cmpq %rax, %rsi
jb 0x11cc19
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12d44c
leaq 0xc8(%rsp), %rdi
movl $0x7f, %esi
callq 0x11d628
leaq 0x2e8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x11d728
leaq 0x1c8(%rsp), %rdi
callq 0x12d632
leaq 0x198(%rsp), %rdi
callq 0x12d632
leaq 0x168(%rsp), %rdi
callq 0x12d632
leaq 0x138(%rsp), %rdi
callq 0x12d632
leaq 0x108(%rsp), %rdi
callq 0x12d632
leaq 0xd8(%rsp), %rdi
callq 0x12d632
leaq 0x2e8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x11df4c
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x2e8(%rsp), %rdi
callq 0x11e91e
leaq 0x10(%rsp), %rdi
callq 0x11ebe0
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x11cce2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc10(%rsp), %rdi
callq 0x11ec2e
leaq 0x8(%rsp), %rdi
callq 0x11ec90
leaq 0x2d8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11cd1a
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2c1da7(%rip), %rbx    # 0x3deac8
leaq 0x2b0(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11cd46
movq 0x2b0(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x270(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11cd67
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x248(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11cd8c
movq 0x248(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11cda9
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x119090
addq $0x15f8, %rsp           # imm = 0x15F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11cdd2
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x11df04
jmp 0x11ce83
movq %rax, %rbx
jmp 0x11ce83
movq %rax, %rbx
jmp 0x11ce8d
jmp 0x11ce26
jmp 0x11cf16
movq %rax, %rbx
jmp 0x11cf35
movq %rax, %rbx
jmp 0x11cf57
jmp 0x11ce0e
jmp 0x11ce16
jmp 0x11ce1e
jmp 0x11ce26
jmp 0x11ceed
movq %rax, %rbx
jmp 0x11cf0a
movq %rax, %rbx
jmp 0x11cf73
movq %rax, %rbx
jmp 0x11cf8f
movq %rax, %rbx
jmp 0x11cf9c
movq %rax, %rbx
jmp 0x11cfc1
jmp 0x11ce5b
jmp 0x11ce5b
movq %rax, %rbx
movq 0xc10(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cfce
movq 0xc20(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11cfce
movq %rax, %rbx
jmp 0x11cfce
movq %rax, %rbx
jmp 0x11cfd8
movq %rax, %rbx
jmp 0x11cfe5
movq %rax, %rbx
leaq 0x2e8(%rsp), %rdi
callq 0x11e91e
leaq 0x10(%rsp), %rdi
callq 0x11ebe0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x11cfc1
movq 0x40(%rsp), %rsi
jmp 0x11cfb9
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11cf19
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11cf19
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x11cef0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11cef0
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cf0a
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jne 0x11cf66
jmp 0x11cf73
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x11cf35
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x11cf57
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x11cf73
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x11cf8f
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2e8(%rsp), %rdi
callq 0x11d54e
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x11cfc1
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xc10(%rsp), %rdi
callq 0x11ec2e
leaq 0x8(%rsp), %rdi
callq 0x11ec90
leaq 0x218(%rsp), %rdi
callq 0x11ed26
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11d002
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x119090
movq %rbx, %rdi
callq 0x1192e0