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

   const std::string mandelbrot_program =
      " width    := 118;                                  "
      " height   := 41;                                   "
      " imag_max := +1;                                   "
      " imag_min := -1;                                   "
      " real_max := +1;                                   "
      " real_min := -2.5;                                 "
      " x_step   := (real_max - real_min) / width;        "
      " y_step   := (imag_max - imag_min) / height;       "
      "                                                   "
      " for (var y := 0; y < height; y += 1)              "
      " {                                                 "
      "    imag := imag_min + (y_step * y);               "
      "                                                   "
      "    for (var x := 0; x < width; x += 1)            "
      "    {                                              "
      "       real   := real_min + x_step * x;            "
      "       z_real := real;                             "
      "       z_imag := imag;                             "
      "                                                   "
      "       for (var n := 0; n < 30; n += 1)            "
      "       {                                           "
      "          a := z_real^2;                           "
      "          b := z_imag^2;                           "
      "          plot_value := n;                         "
      "                                                   "
      "          if ((a + b) < 4)                         "
      "          {                                        "
      "             z_imag := 2 * z_real * z_imag + imag; "
      "             z_real := a - b + real;               "
      "          }                                        "
      "          else                                     "
      "             break;                                "
      "       };                                          "
      "                                                   "
      "       putch(61 - plot_value);                     "
      "    };                                             "
      "                                                   "
      "    println()                                      "
      " }                                                 ";

   exprtk::rtl::io::println<T> println;

   symbol_table_t symbol_table;
   symbol_table.add_function("putch"  , putch  );
   symbol_table.add_function("println", println);

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;
   parser.enable_unknown_symbol_resolver();
   parser.compile(mandelbrot_program,expression);

   expression.value();
}

// Assembly:
pushq %rbx
subq $0xb30, %rsp            # imm = 0xB30
leaq 0x12adef(%rip), %rsi    # 0x23b101
leaq 0x30(%rsp), %rdi
leaq 0x208(%rsp), %rdx
callq 0x1102c8
leaq 0x12b59c(%rip), %rsi    # 0x23b8c7
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1102c8
leaq 0x50(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x1105e0
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x110672
leaq 0x12b55b(%rip), %rsi    # 0x23b8ce
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1102c8
leaq 0x3bb(%rip), %rdx       # 0x11074a
leaq 0x8(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x110696
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
leaq 0x12b51f(%rip), %rsi    # 0x23b8d4
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1102c8
leaq 0x8(%rsp), %rdi
leaq 0x208(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x11075a
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
leaq 0x10(%rsp), %rdi
callq 0x110822
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x110882
leaq 0xb8(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x1108de
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x1109ee
leaq 0xb8(%rsp), %rdi
callq 0x111006
leaq 0x5e8(%rsp), %rax
movb $0x1, -0x18(%rax)
movq %rax, -0x8(%rax)
leaq 0x208(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x11104e
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x208(%rsp), %rdi
callq 0x1114d0
leaq 0x10(%rsp), %rdi
callq 0x11160a
leaq 0x8(%rsp), %rdi
callq 0x111620
leaq 0x50(%rsp), %rdi
callq 0x111662
leaq 0x30(%rsp), %rdi
callq 0x10e5c8
addq $0xb30, %rsp            # imm = 0xB30
popq %rbx
retq
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x111006
jmp 0x11050f
jmp 0x1104c1
movq %rax, %rbx
jmp 0x11050f
jmp 0x1104de
jmp 0x1104cc
jmp 0x1104de
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
jmp 0x110519
movq %rax, %rbx
jmp 0x110519
movq %rax, %rbx
jmp 0x110523
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
jmp 0x11052d
movq %rax, %rbx
jmp 0x11052d
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x1114d0
leaq 0x10(%rsp), %rdi
callq 0x11160a
leaq 0x8(%rsp), %rdi
callq 0x111620
leaq 0x50(%rsp), %rdi
callq 0x111662
leaq 0x30(%rsp), %rdi
callq 0x10e5c8
movq %rbx, %rdi
callq 0x10e310