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

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

   symbol_table_t symbol_table;
   symbol_table.add_package(io_package);
   symbol_table.add_function("print_coeff",
                             [](T t)
                             {
                                printf("%6d", static_cast<unsigned int>(t));
                                return T(0);
                             });

   compositor_t compositor(symbol_table);

   compositor.add(
      function_t("n_choose_k")
      .vars("n","k")
      .expression
      (
        " switch                                      "
        " {                                           "
        "    case n <= k : 1;                         "
        "    case k <= 0 : 1;                         "
        "    default     : n_choose_k(n - 1, k - 1) + "
        "                  n_choose_k(n - 1, k    ) ; "
        " }                                           "
      ));

   const std::string pascals_triangle_program =
      " const var rows := 20;                            "
      "                                                  "
      " for (var n := 0; n < rows; n += 1)               "
      " {                                                "
      "    for (var s := 0; s <= (rows - n) - 2; s += 1) "
      "    {                                             "
      "       print('   ');                              "
      "    };                                            "
      "                                                  "
      "    for (var k := 0; k <= n; k += 1)              "
      "    {                                             "
      "       print_coeff(n_choose_k(n,k));              "
      "    };                                            "
      "                                                  "
      "    println();                                    "
      " }                                                ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1598, %rsp           # imm = 0x1598
leaq 0x1b8(%rsp), %rdi
callq 0x11cbf0
movq %rsp, %rdi
movl $0x1, %esi
callq 0x11ccd0
leaq 0x1b8(%rsp), %rdi
movq %rsp, %rsi
callq 0x11f97a
leaq 0xbc0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b9391(%rip), %rsi    # 0x2d58dd
leaq 0x1b9395(%rip), %rdx    # 0x2d58e8
leaq 0xbb0(%rsp), %rdi
callq 0x11cb60
leaq 0x5f53(%rip), %rdx      # 0x1224ba
movq %rsp, %rdi
leaq 0xbb0(%rsp), %rsi
callq 0x11cd18
movq 0xbb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c594
movq 0xbc0(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xbb0(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x11ce96
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b9332(%rip), %rsi    # 0x2d58e9
leaq 0x1b9335(%rip), %rdx    # 0x2d58f3
leaq 0x68(%rsp), %rdi
callq 0x11cb60
leaq 0x288(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x11d01e
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b91be(%rip), %rsi    # 0x2d57a8
leaq 0x1b91b8(%rip), %rdx    # 0x2d57a9
leaq 0x8(%rsp), %rdi
callq 0x11cb60
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b92e7(%rip), %rsi    # 0x2d58f2
leaq 0x1b92e1(%rip), %rdx    # 0x2d58f3
leaq 0x28(%rsp), %rdi
callq 0x11cb60
leaq 0x2c8(%rsp), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x12c9fc
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x12c9fc
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b92a6(%rip), %rsi    # 0x2d58f4
leaq 0x1b93da(%rip), %rdx    # 0x2d5a2f
leaq 0x48(%rsp), %rdi
callq 0x11cb60
leaq 0x2a8(%rsp), %r12
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
callq 0x119520
leaq 0x14e0(%rsp), %r15
leaq 0x288(%rsp), %rsi
movq %r15, %rdi
callq 0x123bfa
leaq 0x14e8(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11c746
leaq 0xbb0(%rsp), %rdi
leaq 0x288(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x122958
testb %al, %al
je 0x11c746
leaq 0x288(%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 0x1510(%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 0x12382a
movq (%rax), %r12
leaq 0x288(%rsp), %rsi
movq %r15, %rdi
callq 0x123b7e
movq %r12, %rdi
movq %rax, %rsi
callq 0x1238a6
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x11c75d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x18(%rsp), %r15
je 0x11c779
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x11c790
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
movq %r14, %rdi
callq 0x12cc96
leaq 0x2b8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c7b9
movq 0x2b8(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x298(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x78(%rsp), %r14
je 0x11c7df
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x11c7f6
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b922b(%rip), %rsi    # 0x2d5a30
leaq 0x1b9544(%rip), %rdx    # 0x2d5d50
callq 0x11cb60
leaq 0x28(%rsp), %rdi
callq 0x11d0f8
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
je 0x11c876
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x11c883
movq (%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11c883
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11c876
decq %rsi
cmpq %rbx, %rcx
je 0x11c86e
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11c855
negq %rsi
cmpq %rax, %rsi
jb 0x11c883
leaq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x12cf08
leaq 0x68(%rsp), %rdi
movl $0x7f, %esi
callq 0x11d192
leaq 0x288(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x11d292
leaq 0x168(%rsp), %rdi
callq 0x12d0ee
leaq 0x138(%rsp), %rdi
callq 0x12d0ee
leaq 0x108(%rsp), %rdi
callq 0x12d0ee
leaq 0xd8(%rsp), %rdi
callq 0x12d0ee
leaq 0xa8(%rsp), %rdi
callq 0x12d0ee
leaq 0x78(%rsp), %rdi
callq 0x12d0ee
leaq 0x288(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x11dab6
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x288(%rsp), %rdi
callq 0x11e488
leaq 0x28(%rsp), %rdi
callq 0x11e74a
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x11c943
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xbb0(%rsp), %rdi
callq 0x11e798
movq %rsp, %rdi
callq 0x11e7fa
leaq 0x278(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c979
movq 0x278(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x2c20d8(%rip), %rbx    # 0x3dea58
leaq 0x250(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c9a5
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x210(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c9c6
movq 0x210(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x1e8(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11c9eb
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x119090
addq $0x1598, %rsp           # imm = 0x1598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11ca0e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x11da6e
jmp 0x11ca8c
movq %rax, %rbx
jmp 0x11ca8c
movq %rax, %rbx
jmp 0x11ca96
jmp 0x11ca37
jmp 0x11cab0
movq %rax, %rbx
jmp 0x11cae6
movq %rax, %rbx
jmp 0x11cb02
movq %rax, %rbx
jmp 0x11cb0f
movq %rax, %rbx
jmp 0x11cb2b
jmp 0x11ca6c
movq %rax, %rbx
movq 0xbb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11cb38
movq 0xbc0(%rsp), %rsi
incq %rsi
callq 0x119090
jmp 0x11cb38
jmp 0x11ca6c
movq %rax, %rbx
jmp 0x11cb38
movq %rax, %rbx
jmp 0x11cb40
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
callq 0x11e488
leaq 0x28(%rsp), %rdi
callq 0x11e74a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cb2b
movq 0x18(%rsp), %rsi
jmp 0x11cb23
movq %rax, %rbx
jmp 0x11cacf
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x11cacf
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11cae6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x119090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11cb02
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0x288(%rsp), %rdi
callq 0x11d0b8
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x11cb2b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x119090
leaq 0xbb0(%rsp), %rdi
callq 0x11e798
movq %rsp, %rdi
callq 0x11e7fa
leaq 0x1b8(%rsp), %rdi
callq 0x11e890
movq %rbx, %rdi
callq 0x1192e0