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

   const std::string pythagorean_triples_program =
      " const var num_triples := 1000;                "
      " var triple_count      := 0;                   "
      " var n                 := 2;                   "
      "                                               "
      " while (true)                                  "
      " {                                             "
      "    for (var i := 1; i < n; i += 1)            "
      "    {                                          "
      "       var a := n^2 - i^2;                     "
      "       var b := 2 * n * i;                     "
      "       var c := n^2 + i^2;                     "
      "                                               "
      "       if (a > b) a <=> b;                     "
      "       if (b > c) b <=> c;                     "
      "       if (a > b) a <=> b;                     "
      "                                               "
      "       println('(', a ,',', b ,',', c ,')');   "
      "                                               "
      "       if ((triple_count += 1) >= num_triples) "
      "       {                                       "
      "          return [];                           "
      "       };                                      "
      "    };                                         "
      "                                               "
      "    n += 1;                                    "
      " }                                             ";

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

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

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser_t parser;
   parser.compile(pythagorean_triples_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 0x12b29d(%rip), %rsi    # 0x23b5c8
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1102c8
leaq 0x50(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x11058a
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x11061c
leaq 0x12b25c(%rip), %rsi    # 0x23b5cf
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1102c8
leaq 0x8(%rsp), %rdi
leaq 0x208(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x110640
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
leaq 0x10(%rsp), %rdi
callq 0x110708
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x110768
leaq 0xb8(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x1107c4
leaq 0x208(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x1108d4
leaq 0xb8(%rsp), %rdi
callq 0x110eec
leaq 0x208(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x110f34
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x208(%rsp), %rdi
callq 0x1113b6
leaq 0x10(%rsp), %rdi
callq 0x1114f0
leaq 0x8(%rsp), %rdi
callq 0x111506
leaq 0x50(%rsp), %rdi
callq 0x111548
leaq 0x30(%rsp), %rdi
callq 0x10e5c8
addq $0xb30, %rsp            # imm = 0xB30
popq %rbx
retq
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x110eec
jmp 0x1104b9
jmp 0x11046f
movq %rax, %rbx
jmp 0x1104b9
jmp 0x110488
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
jmp 0x1104c3
movq %rax, %rbx
jmp 0x1104c3
movq %rax, %rbx
jmp 0x1104cd
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x10e5c8
jmp 0x1104d7
movq %rax, %rbx
jmp 0x1104d7
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x1113b6
leaq 0x10(%rsp), %rdi
callq 0x1114f0
leaq 0x8(%rsp), %rdi
callq 0x111506
leaq 0x50(%rsp), %rdi
callq 0x111548
leaq 0x30(%rsp), %rdi
callq 0x10e5c8
movq %rbx, %rdi
callq 0x10e310