// File: /workspace/github_cpp_makefile_star2_O1/ArashPartow[P]exprtk-extras/exprtk_e_10kdigits.cpp
// Function: void e_10k_digits<double>()
void e_10k_digits()
{
   typedef exprtk::symbol_table<T> symbol_table_t;
   typedef exprtk::expression<T>   expression_t;
   typedef exprtk::parser<T>       parser_t;

   symbol_table_t symbol_table;

   symbol_table.add_function("print",
                             [](T t) -> T
                             {
                                printf("%1d",static_cast<int>(t));
                                return T(1);
                             });

   const std::string e_10k_digits_spigot =
      " const var num_digits := 10000;                       "
      " var a[num_digits] := [2:1];                          "
      " var b[num_digits] := [1];                            "
      "                                                      "
      " print(2);                                            "
      "                                                      "
      " for (var digit := 0; digit < num_digits; digit += 1) "
      " {                                                    "
      "    b *= 10;                                          "
      "                                                      "
      "    for (var i := (b[] - 1); i > 0; i -= 1)           "
      "    {                                                 "
      "       var q := floor(b[i] / a[i]);                   "
      "       var r := floor(b[i] % a[i]);                   "
      "       b[i - 1] := b[i - 1] + q;                      "
      "       b[i] := r;                                     "
      "    };                                                "
      "                                                      "
      "    print(floor(b[0] / a[0]));                        "
      "                                                      "
      "    b[0] %= a[0];                                     "
      " }                                                    ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xac8, %rsp            # imm = 0xAC8
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x11962c
leaq 0x1b0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b0567(%rip), %rsi    # 0x2c98c1
leaq 0x1b0565(%rip), %rdx    # 0x2c98c6
leaq 0x1a0(%rsp), %rdi
callq 0x11959c
leaq 0x425b(%rip), %rdx      # 0x11d5d0
leaq 0x8(%rsp), %rbx
leaq 0x1a0(%rsp), %rsi
movq %rbx, %rdi
callq 0x119674
movq 0x1a0(%rsp), %rdi
cmpq %r14, %rdi
je 0x1193a7
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b0510(%rip), %rsi    # 0x2c98c7
leaq 0x1b09ad(%rip), %rdx    # 0x2c9d6b
leaq 0x30(%rsp), %rdi
callq 0x11959c
leaq 0x10(%rsp), %rdi
callq 0x1197f2
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
je 0x11942e
sarq $0x3, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
cmpq %rbx, %rcx
je 0x11943d
movq 0x8(%rsp), %rdx
cmpq (%rcx), %rdx
je 0x11943d
addq $0x8, %rcx
movl $0x1, %edi
subq %rsi, %rdi
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x11942e
decq %rsi
cmpq %rbx, %rcx
je 0x119426
leaq 0x8(%rcx), %r8
cmpq (%rcx), %rdx
movq %r8, %rcx
jne 0x11940d
negq %rsi
cmpq %rax, %rsi
jb 0x11943d
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x11e342
leaq 0x50(%rsp), %rdi
movl $0x7f, %esi
callq 0x11988c
leaq 0x1a0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x11998c
leaq 0x150(%rsp), %rdi
callq 0x11e544
leaq 0x120(%rsp), %rdi
callq 0x11e544
leaq 0xf0(%rsp), %rdi
callq 0x11e544
leaq 0xc0(%rsp), %rdi
callq 0x11e544
leaq 0x90(%rsp), %rdi
callq 0x11e544
leaq 0x60(%rsp), %rdi
callq 0x11e544
leaq 0x1a0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x11a1b0
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x1a0(%rsp), %rdi
callq 0x11ab82
leaq 0x10(%rsp), %rdi
callq 0x11ae44
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x1194fd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x8(%rsp), %rdi
callq 0x11ae92
addq $0xac8, %rsp            # imm = 0xAC8
popq %rbx
popq %r14
retq
jmp 0x119523
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x11a168
jmp 0x11955e
movq %rax, %rbx
jmp 0x11955e
movq %rax, %rbx
jmp 0x119568
jmp 0x119549
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11957f
movq 0x1b0(%rsp), %rsi
jmp 0x119577
movq %rax, %rbx
jmp 0x11957f
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x11ab82
leaq 0x10(%rsp), %rdi
callq 0x11ae44
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x11957f
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x8(%rsp), %rdi
callq 0x11ae92
movq %rbx, %rdi
callq 0x1162e0