// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk-extras/exprtk_binomial_coefficient.cpp
// Function: void n_choose_r<double>()
void n_choose_r()
{
   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;
   symbol_table.add_function("println",ncr_println);

   compositor_t compositor(symbol_table);

   // define function: ncr(n,r)
   compositor.add(
      function_t("ncr")
      .vars("n", "r")
      .expression
      (
        " switch                               "
        " {                                    "
        "    case n <= r : 1;                  "
        "    case r <= 0 : 1;                  "
        "    default     : ncr(n - 1, r - 1) + "
        "                  ncr(n - 1, r    ) ; "
        " }                                    "
      ));

   const std::string ncr_program =
      " var n := 25;                     "
      " for (var r := 1; r < n; r += 1)  "
      " {                                "
      "    println(n, r, ncr(n,r));      "
      " };                               ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbx
subq $0x14d0, %rsp           # imm = 0x14D0
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x113672
leaq 0x130dfe(%rip), %rsi    # 0x24411d
leaq 0xae8(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x1132c8
leaq 0x40f(%rip), %rdx       # 0x11374a
leaq 0x8(%rsp), %rdi
leaq 0xae8(%rsp), %rsi
callq 0x113696
leaq 0xae8(%rsp), %rdi
callq 0x1115c8
leaq 0xae8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x113786
leaq 0x130db2(%rip), %rsi    # 0x244125
leaq 0x70(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1132c8
leaq 0x1c0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x1138a4
leaq 0x130c4d(%rip), %rsi    # 0x243fe8
leaq 0x30(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x1132c8
leaq 0x130c07(%rip), %rsi    # 0x243fb8
leaq 0x10(%rsp), %rdi
leaq 0x5(%rsp), %rdx
callq 0x1132c8
leaq 0x1c0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x1138f0
movq %rax, %rbx
leaq 0x130d48(%rip), %rsi    # 0x244129
leaq 0x50(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x1132c8
leaq 0x20(%rbx), %rdi
leaq 0x50(%rsp), %rsi
callq 0x111550
leaq 0xae8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x113894
leaq 0x50(%rsp), %rdi
callq 0x1115c8
leaq 0x10(%rsp), %rdi
callq 0x1115c8
leaq 0x30(%rsp), %rdi
callq 0x1115c8
leaq 0x1c0(%rsp), %rdi
callq 0x11391c
leaq 0x70(%rsp), %rdi
callq 0x1115c8
leaq 0x130de8(%rip), %rsi    # 0x244234
leaq 0x30(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x1132c8
leaq 0x10(%rsp), %rdi
callq 0x11393c
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x11399c
leaq 0x70(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x1139f8
leaq 0x1c0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x113b08
leaq 0x70(%rsp), %rdi
callq 0x114120
leaq 0x1c0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x114168
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x1c0(%rsp), %rdi
callq 0x1145ea
leaq 0x10(%rsp), %rdi
callq 0x114724
leaq 0x30(%rsp), %rdi
callq 0x1115c8
leaq 0xae8(%rsp), %rdi
callq 0x11473a
leaq 0x8(%rsp), %rdi
callq 0x11478e
addq $0x14d0, %rsp           # imm = 0x14D0
popq %rbx
retq
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x114120
jmp 0x113568
jmp 0x113518
movq %rax, %rbx
jmp 0x113568
movq %rax, %rbx
jmp 0x113572
jmp 0x11353a
jmp 0x113526
movq %rax, %rbx
jmp 0x113586
movq %rax, %rbx
jmp 0x113590
movq %rax, %rbx
jmp 0x11359a
movq %rax, %rbx
jmp 0x1135a7
movq %rax, %rbx
jmp 0x1135b1
jmp 0x113553
movq %rax, %rbx
leaq 0xae8(%rsp), %rdi
callq 0x1115c8
jmp 0x1135be
movq %rax, %rbx
jmp 0x1135be
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0x1145ea
leaq 0x10(%rsp), %rdi
callq 0x114724
leaq 0x30(%rsp), %rdi
jmp 0x1135ac
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1115c8
leaq 0x10(%rsp), %rdi
callq 0x1115c8
leaq 0x30(%rsp), %rdi
callq 0x1115c8
leaq 0x1c0(%rsp), %rdi
callq 0x11391c
leaq 0x70(%rsp), %rdi
callq 0x1115c8
leaq 0xae8(%rsp), %rdi
callq 0x11473a
leaq 0x8(%rsp), %rdi
callq 0x11478e
movq %rbx, %rdi
callq 0x111310