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

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

   symbol_table_t symbol_table;

   symbol_table.add_package(io_package);

   const std::string pyramid_program =
      " const var n := 30;                           "
      "                                              "
      " for (var i := 0; i < n; i += 1)              "
      " {                                            "
      "    for (var j := 0; j < n - i - 1; j += 1)   "
      "    {                                         "
      "       print(' ');                            "
      "    };                                        "
      "                                              "
      "    for (var j := 0; j < 2 * i + 1; j += 1)   "
      "    {                                         "
      "       print('*');                            "
      "    };                                        "
      "                                              "
      "    println();                                "
      " }                                            ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
subq $0xbb8, %rsp            # imm = 0xBB8
leaq 0xae8(%rsp), %rdi
callq 0x118d10
leaq 0xae0(%rsp), %rdi
movl $0x1, %esi
callq 0x118e60
jmp 0x118848
leaq 0xae0(%rsp), %rdi
leaq 0xae8(%rsp), %rsi
callq 0x118ea0
jmp 0x11885f
leaq 0xaaf(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x111650
movq 0x8(%rsp), %rdx
leaq 0x330cc8(%rip), %rsi    # 0x449545
leaq 0xab0(%rsp), %rdi
callq 0x118760
jmp 0x11888c
leaq 0xaaf(%rsp), %rdi
callq 0x111780
leaq 0xa88(%rsp), %rdi
callq 0x118ed0
jmp 0x1188a8
leaq 0xa88(%rsp), %rdi
leaq 0xae0(%rsp), %rsi
callq 0x118f80
jmp 0x1188bf
leaq 0x10(%rsp), %rdi
movl $0x7f, %esi
callq 0x119030
jmp 0x1188d0
leaq 0x160(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x119160
jmp 0x1188e4
leaq 0x10(%rsp), %rdi
callq 0x119990
leaq 0x160(%rsp), %rdi
leaq 0xab0(%rsp), %rsi
leaq 0xa88(%rsp), %rdx
callq 0x119a00
jmp 0x11890d
leaq 0xa88(%rsp), %rdi
callq 0x11a290
jmp 0x11891c
leaq 0x160(%rsp), %rdi
callq 0x11a2b0
leaq 0xa88(%rsp), %rdi
callq 0x11a4b0
leaq 0xab0(%rsp), %rdi
callq 0x111798
leaq 0xae0(%rsp), %rdi
callq 0x11a4f0
leaq 0xae8(%rsp), %rdi
callq 0x11a570
addq $0xbb8, %rsp            # imm = 0xBB8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
jmp 0x118a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
jmp 0x118a44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
leaq 0xaaf(%rsp), %rdi
callq 0x111780
jmp 0x118a44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
jmp 0x118a37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
jmp 0x118a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x119990
jmp 0x118a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xad8(%rsp)
movl %eax, 0xad4(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x11a2b0
leaq 0xa88(%rsp), %rdi
callq 0x11a4b0
leaq 0xab0(%rsp), %rdi
callq 0x111798
leaq 0xae0(%rsp), %rdi
callq 0x11a4f0
leaq 0xae8(%rsp), %rdi
callq 0x11a570
movq 0xad8(%rsp), %rdi
callq 0x111450
nopl (%rax,%rax)