// File: /workspace/github_cpp_makefile_star2_O3/ArashPartow[P]exprtk-extras/exprtk_gcd.cpp
// Function: void gcd<double>()
void gcd()
{
   typedef exprtk::symbol_table<T>         symbol_table_t;
   typedef exprtk::expression<T>           expression_t;
   typedef exprtk::parser<T>               parser_t;
   typedef exprtk::function_compositor<T>  compositor_t;
   typedef typename compositor_t::function function_t;

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

   compositor_t compositor(symbol_table);

   // define function: gcd(x,y)
   compositor.add(
      function_t("gcd")
      .vars("x","y")
      .expression
      (
         " switch                         "
         " {                              "
         "    case 0 = x : 0;             "
         "    case 0 = y : x;             "
         "    case x = y : x;             "
         "    case x > y : gcd(x - y, y); "
         "    default    : gcd(x, y - x); "
         " }                              "
      ));

   const std::string gcd_program =
      " i := 0;                        "
      " while ((i += 1) < 100)         "
      " {                              "
      "    j := 0;                     "
      "    repeat                      "
      "       println(i, j, gcd(i,j)); "
      "    until ((j += 1) >= 100);    "
      " };                             ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x14c8, %rsp           # imm = 0x14C8
movq %rsp, %rdi
movl $0x1, %esi
callq 0x119aae
leaq 0xaf0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19648f(%rip), %rsi    # 0x2af955
leaq 0x19648f(%rip), %rdx    # 0x2af95c
leaq 0xae0(%rsp), %rdi
callq 0x119a18
leaq 0x76a(%rip), %rdx       # 0x119c4b
movq %rsp, %rdi
leaq 0xae0(%rsp), %rsi
callq 0x119af6
movq 0xae0(%rsp), %rdi
cmpq %r14, %rdi
je 0x11950e
movq 0xaf0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xae0(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x119c6c
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x19642c(%rip), %rsi    # 0x2af95d
leaq 0x196428(%rip), %rdx    # 0x2af960
leaq 0x68(%rsp), %rdi
callq 0x119a18
leaq 0x1b8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x119df4
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x196349(%rip), %rsi    # 0x2af8ad
leaq 0x196343(%rip), %rdx    # 0x2af8ae
leaq 0x28(%rsp), %rdi
callq 0x119a18
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x196783(%rip), %rsi    # 0x2afd08
leaq 0x19677d(%rip), %rdx    # 0x2afd09
leaq 0x8(%rsp), %rdi
callq 0x119a18
leaq 0x1f8(%rsp), %r14
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x1272a8
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x1272a8
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x196399(%rip), %rsi    # 0x2af961
leaq 0x196492(%rip), %rdx    # 0x2afa61
leaq 0x48(%rsp), %rdi
callq 0x119a18
leaq 0x1d8(%rsp), %r12
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
callq 0x116520
leaq 0x1410(%rsp), %r15
leaq 0x1b8(%rsp), %rsi
movq %r15, %rdi
callq 0x11edbc
leaq 0x1418(%rsp), %rcx
cmpq %rax, %rcx
jne 0x1196c0
leaq 0xae0(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x11db22
testb %al, %al
je 0x1196c0
leaq 0x1b8(%rsp), %rsi
movq 0x88(%rsi), %rax
movq %rax, %rcx
subq 0x68(%rsi), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
movq 0x60(%rsi), %rax
movq 0x70(%rsi), %rdx
subq 0x78(%rsi), %rdx
subq 0x50(%rsi), %rax
sarq $0x5, %rdx
sarq $0x5, %rax
leaq (%rcx,%rcx,2), %rcx
shlq $0x8, %rcx
addq 0x1440(%rsp), %rcx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq %rdx, %rdi
addq %rcx, %rdi
callq 0x11e9e0
movq (%rax), %r12
leaq 0x1b8(%rsp), %rsi
movq %r15, %rdi
callq 0x11ed40
movq %r12, %rdi
movq %rax, %rsi
callq 0x11ea5c
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x1196d7
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r15
je 0x1196f8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x11970f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x116090
movq %r14, %rdi
callq 0x127542
leaq 0x1e8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x119738
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x119759
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x119770
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x28(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1962e3(%rip), %rsi    # 0x2afa62
leaq 0x1963dc(%rip), %rdx    # 0x2afb62
callq 0x119a18
leaq 0x8(%rsp), %rdi
callq 0x119ece
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
je 0x1197c7
sarq $0x3, %rcx
movq (%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %rbx, %rax
je 0x1197d4
cmpq (%rax), %rdx
je 0x1197d4
addq $0x8, %rax
decq %rcx
jne 0x1197b4
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0x1277c8
leaq 0x68(%rsp), %rdi
movl $0x7f, %esi
callq 0x119f5a
leaq 0x1b8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x11a05a
leaq 0x168(%rsp), %rdi
callq 0x1279ae
leaq 0x138(%rsp), %rdi
callq 0x1279ae
leaq 0x108(%rsp), %rdi
callq 0x1279ae
leaq 0xd8(%rsp), %rdi
callq 0x1279ae
leaq 0xa8(%rsp), %rdi
callq 0x1279ae
leaq 0x78(%rsp), %rdi
callq 0x1279ae
leaq 0x598(%rsp), %rax
movb $0x1, -0x18(%rax)
movq %rax, -0x8(%rax)
leaq 0x1b8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x11a87e
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x1b8(%rsp), %rdi
callq 0x11b41a
leaq 0x8(%rsp), %rdi
callq 0x11b6dc
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x1198a4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xae0(%rsp), %rdi
callq 0x11b72a
movq %rsp, %rdi
callq 0x11b78c
addq $0x14c8, %rsp           # imm = 0x14C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1198dc
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x11a836
jmp 0x119950
movq %rax, %rbx
jmp 0x119950
movq %rax, %rbx
jmp 0x11995a
jmp 0x119905
jmp 0x119974
movq %rax, %rbx
jmp 0x1199af
movq %rax, %rbx
jmp 0x1199cb
movq %rax, %rbx
jmp 0x1199d8
movq %rax, %rbx
jmp 0x1199ef
jmp 0x119938
movq %rax, %rbx
movq 0xae0(%rsp), %rdi
cmpq %r14, %rdi
je 0x1199fc
movq 0xaf0(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x1199fc
movq %rax, %rbx
jmp 0x1199fc
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x11b41a
leaq 0x8(%rsp), %rdi
callq 0x11b6dc
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1199ef
movq 0x38(%rsp), %rsi
jmp 0x1199e7
movq %rax, %rbx
jmp 0x119993
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x119993
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1199af
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1199cb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x1b8(%rsp), %rdi
callq 0x119e8e
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1199ef
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xae0(%rsp), %rdi
callq 0x11b72a
movq %rsp, %rdi
callq 0x11b78c
movq %rbx, %rdi
callq 0x1162e0