// File: /workspace/github_cpp_makefile_star2_O3/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 0x68(%rsp), %rdi
callq 0x11ab8c
movq %rsp, %rdi
movl $0x1, %esi
callq 0x11ac6c
leaq 0x68(%rsp), %rdi
movq %rsp, %rsi
callq 0x11dabc
leaq 0xbc0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x197468(%rip), %rsi    # 0x2b1955
leaq 0x19746c(%rip), %rdx    # 0x2b1960
leaq 0xbb0(%rsp), %rdi
callq 0x11aaf6
leaq 0x53e8(%rip), %rdx      # 0x11f8f0
movq %rsp, %rdi
leaq 0xbb0(%rsp), %rsi
callq 0x11acb4
movq 0xbb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11a535
movq 0xbc0(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0xbb0(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x11ae0a
leaq 0x148(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x197406(%rip), %rsi    # 0x2b1961
leaq 0x197409(%rip), %rdx    # 0x2b196b
leaq 0x138(%rsp), %rdi
callq 0x11aaf6
leaq 0x288(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x11af92
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x19728c(%rip), %rsi    # 0x2b1820
leaq 0x197286(%rip), %rdx    # 0x2b1821
leaq 0x28(%rsp), %rdi
callq 0x11aaf6
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1973b5(%rip), %rsi    # 0x2b196a
leaq 0x1973af(%rip), %rdx    # 0x2b196b
leaq 0x8(%rsp), %rdi
callq 0x11aaf6
leaq 0x2c8(%rsp), %r14
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x128ac4
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x128ac4
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x197374(%rip), %rsi    # 0x2b196c
leaq 0x1974a8(%rip), %rdx    # 0x2b1aa7
leaq 0x48(%rsp), %rdi
callq 0x11aaf6
leaq 0x2a8(%rsp), %r12
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
callq 0x117520
leaq 0x14e0(%rsp), %r15
leaq 0x288(%rsp), %rsi
movq %r15, %rdi
callq 0x12102e
leaq 0x14e8(%rsp), %rcx
cmpq %rax, %rcx
jne 0x11a6f0
leaq 0xbb0(%rsp), %rdi
leaq 0x288(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x11fd94
testb %al, %al
je 0x11a6f0
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 0x120c52
movq (%rax), %r12
leaq 0x288(%rsp), %rsi
movq %r15, %rdi
callq 0x120fb2
movq %r12, %rdi
movq %rax, %rsi
callq 0x120cce
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x11a707
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x117090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r15
je 0x11a728
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x117090
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x11a73f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x117090
movq %r14, %rdi
callq 0x128d5e
leaq 0x2b8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a768
movq 0x2b8(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0x298(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a789
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x117090
movq 0x138(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11a7a6
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0x28(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1972f3(%rip), %rsi    # 0x2b1aa8
leaq 0x19760c(%rip), %rdx    # 0x2b1dc8
callq 0x11aaf6
leaq 0x8(%rsp), %rdi
callq 0x11b06c
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
je 0x11a7fd
sarq $0x3, %rcx
movq (%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %rbx, %rax
je 0x11a80a
cmpq (%rax), %rdx
je 0x11a80a
addq $0x8, %rax
decq %rcx
jne 0x11a7ea
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0x128fe4
leaq 0x138(%rsp), %rdi
movl $0x7f, %esi
callq 0x11b0f8
leaq 0x288(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x11b1f8
leaq 0x238(%rsp), %rdi
callq 0x1291ca
leaq 0x208(%rsp), %rdi
callq 0x1291ca
leaq 0x1d8(%rsp), %rdi
callq 0x1291ca
leaq 0x1a8(%rsp), %rdi
callq 0x1291ca
leaq 0x178(%rsp), %rdi
callq 0x1291ca
leaq 0x148(%rsp), %rdi
callq 0x1291ca
leaq 0x288(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x11ba1c
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x288(%rsp), %rdi
callq 0x11c5b8
leaq 0x8(%rsp), %rdi
callq 0x11c87a
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x11a8d3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0xbb0(%rsp), %rdi
callq 0x11c8c8
movq %rsp, %rdi
callq 0x11c92a
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a909
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0x28fe08(%rip), %rbx    # 0x3aa718
leaq 0x100(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a935
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a956
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0x98(%rsp), %rax
movq %rbx, -0x30(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11a97b
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x117090
addq $0x1598, %rsp           # imm = 0x1598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11a9a1
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x11b9d4
jmp 0x11aa1f
movq %rax, %rbx
jmp 0x11aa1f
movq %rax, %rbx
jmp 0x11aa29
jmp 0x11a9ca
jmp 0x11aa43
movq %rax, %rbx
jmp 0x11aa7e
movq %rax, %rbx
jmp 0x11aa9a
movq %rax, %rbx
jmp 0x11aaa7
movq %rax, %rbx
jmp 0x11aac4
jmp 0x11a9ff
movq %rax, %rbx
movq 0xbb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11aad1
movq 0xbc0(%rsp), %rsi
incq %rsi
callq 0x117090
jmp 0x11aad1
jmp 0x11a9ff
movq %rax, %rbx
jmp 0x11aad1
movq %rax, %rbx
jmp 0x11aad9
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
callq 0x11c5b8
leaq 0x8(%rsp), %rdi
callq 0x11c87a
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x11aac4
movq 0x38(%rsp), %rsi
jmp 0x11aabc
movq %rax, %rbx
jmp 0x11aa62
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x11aa62
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x117090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x11aa7e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x117090
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x11aa9a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0x288(%rsp), %rdi
callq 0x11b02c
movq 0x138(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11aac4
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x117090
leaq 0xbb0(%rsp), %rdi
callq 0x11c8c8
movq %rsp, %rdi
callq 0x11c92a
leaq 0x68(%rsp), %rdi
callq 0x11c9c0
movq %rbx, %rdi
callq 0x1172e0