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

   const std::string bubblesort_program =
      " var upper_bound := v[];                      "
      "                                              "
      " repeat                                       "
      "    var new_upper_bound := 0;                 "
      "                                              "
      "    for (var i := 1; i < upper_bound; i += 1) "
      "    {                                         "
      "       if (v[i - 1] > v[i])                   "
      "       {                                      "
      "          v[i - 1] <=> v[i];                  "
      "          new_upper_bound := i;               "
      "       };                                     "
      "    };                                        "
      "                                              "
      "    upper_bound := new_upper_bound;           "
      "                                              "
      " until (upper_bound <= 1);                    ";

   T v[] = { T(9.1), T(2.2), T(1.3), T(5.4), T(7.5), T(4.6), T(3.7) };

   symbol_table_t symbol_table;
   symbol_table.add_vector("v",v);

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbx
subq $0xb00, %rsp            # imm = 0xB00
leaq 0x12ae13(%rip), %rsi    # 0x23b105
leaq 0x30(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x1102a8
movaps 0x12fc35(%rip), %xmm0   # 0x23ff40
movaps %xmm0, 0x70(%rsp)
movaps 0x12fc19(%rip), %xmm0   # 0x23ff30
movaps %xmm0, 0x60(%rsp)
movaps 0x12fbfd(%rip), %xmm0   # 0x23ff20
movaps %xmm0, 0x50(%rsp)
movabsq $0x400d99999999999a, %rax # imm = 0x400D99999999999A
movq %rax, 0x80(%rsp)
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x11053a
leaq 0x12b0c6(%rip), %rsi    # 0x23b414
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x1102a8
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x11055e
leaq 0x1d8(%rsp), %rdi
callq 0x10e5a8
leaq 0x10(%rsp), %rdi
callq 0x1105c0
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x110620
leaq 0x88(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x11067c
leaq 0x1d8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x11078c
leaq 0x88(%rsp), %rdi
callq 0x110da4
leaq 0x1d8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x110dec
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x1d8(%rsp), %rdi
callq 0x11126e
leaq 0x10(%rsp), %rdi
callq 0x1113a8
leaq 0x8(%rsp), %rdi
callq 0x1113be
leaq 0x30(%rsp), %rdi
callq 0x10e5a8
addq $0xb00, %rsp            # imm = 0xB00
popq %rbx
retq
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x110da4
jmp 0x110473
jmp 0x110440
movq %rax, %rbx
jmp 0x110473
jmp 0x110459
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x10e5a8
jmp 0x11047d
movq %rax, %rbx
jmp 0x11047d
movq %rax, %rbx
jmp 0x110487
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x11126e
leaq 0x10(%rsp), %rdi
callq 0x1113a8
leaq 0x8(%rsp), %rdi
callq 0x1113be
leaq 0x30(%rsp), %rdi
callq 0x10e5a8
movq %rbx, %rdi
callq 0x10e300