// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk-extras/exprtk_riddle.cpp
// Function: void logical_deducation_riddle<double>()
void logical_deducation_riddle()
{
   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;

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

   symbol_table.add_function("println", println);

   compositor_t compositor(symbol_table);

   compositor.add(function_t()
      .name("constraint")
      .var("person_x").var("person_y")
      .expression
      (
         " person_x xor person_y; "
      ));

   const std::string logical_deducation_riddle_program =
      " const var number_of_culprits := 1;                                             "
      "                                                                                "
      " for (var Tori := false; Tori <= true; Tori += true)                            "
      " {                                                                              "
      "    for (var Annie := false; Annie <= true; Annie += true)                      "
      "    {                                                                           "
      "       for (var Betsy := false; Betsy <= true; Betsy += true)                   "
      "       {                                                                        "
      "          for (var Chloe := false; Chloe <= true; Chloe += true)                "
      "          {                                                                     "
      "             for (var Zoey := false; Zoey <= true; Zoey += true)                "
      "             {                                                                  "
      "                if (sum(Annie, Betsy, Chloe, Tori, Zoey) != number_of_culprits) "
      "                   continue;                                                    "
      "                                                                                "
      "                var solution :=                                                 "
      "                   constraint( not(Zoey)  , Annie     ) and /* Tori  */         "
      "                   constraint( not(Betsy) , not(Zoey) ) and /* Annie */         "
      "                   constraint( Zoey       , not(Tori) ) and /* Betsy */         "
      "                   constraint( Betsy      , Annie     ) and /* Chloe */         "
      "                   constraint( Chloe      , not(Tori) ) ;   /* Zoey  */         "
      "                                                                                "
      "                if (solution == true)                                           "
      "                {                                                               "
      "                   var culprit := '';                                           "
      "                   [*]                                                          "
      "                   {                                                            "
      "                      case Annie : culprit := 'Annie';                          "
      "                      case Betsy : culprit := 'Betsy';                          "
      "                      case Chloe : culprit := 'Chloe';                          "
      "                      case Tori  : culprit := 'Tori' ;                          "
      "                      case Zoey  : culprit := 'Zoey' ;                          "
      "                   };                                                           "
      "                                                                                "
      "                   println(culprit,' broke the window!');                       "
      "                }                                                               "
      "             }                                                                  "
      "          }                                                                     "
      "       }                                                                        "
      "    }                                                                           "
      " }                                                                              "
      "                                                                                ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

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

   expression.value();
}

// Assembly:
pushq %rbx
subq $0x1540, %rsp           # imm = 0x1540
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x113740
leaq 0x130dee(%rip), %rsi    # 0x24411d
leaq 0xb58(%rsp), %rdi
leaq 0x230(%rsp), %rdx
callq 0x1132d8
leaq 0x78(%rsp), %rdi
leaq 0xb58(%rsp), %rsi
callq 0x113764
leaq 0xb58(%rsp), %rdi
callq 0x1115d8
leaq 0x130dba(%rip), %rsi    # 0x244124
leaq 0xb58(%rsp), %rdi
leaq 0x230(%rsp), %rdx
callq 0x1132d8
leaq 0x10(%rsp), %rdi
leaq 0xb58(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x1137f6
leaq 0xb58(%rsp), %rdi
callq 0x1115d8
leaq 0xb58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1138be
leaq 0x230(%rsp), %rdi
callq 0x1139dc
leaq 0x130d63(%rip), %rsi    # 0x24412c
leaq 0xe0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1132d8
leaq 0x230(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x111550
leaq 0x130d40(%rip), %rsi    # 0x244137
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1132d8
leaq 0x270(%rsp), %rbx
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x11e698
leaq 0x130d1e(%rip), %rsi    # 0x244140
leaq 0x18(%rsp), %rdi
leaq 0xd(%rsp), %rdx
callq 0x1132d8
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x11e698
leaq 0x130d04(%rip), %rsi    # 0x244149
leaq 0x58(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x1132d8
leaq 0x250(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x111550
leaq 0xb58(%rsp), %rdi
leaq 0x230(%rsp), %rsi
xorl %edx, %edx
callq 0x1139cc
leaq 0x58(%rsp), %rdi
callq 0x1115d8
leaq 0x18(%rsp), %rdi
callq 0x1115d8
leaq 0x38(%rsp), %rdi
callq 0x1115d8
leaq 0xe0(%rsp), %rdi
callq 0x1115d8
leaq 0x230(%rsp), %rdi
callq 0x113a34
leaq 0x130ca6(%rip), %rsi    # 0x244162
leaq 0x38(%rsp), %rdi
leaq 0x230(%rsp), %rdx
callq 0x1132d8
leaq 0x18(%rsp), %rdi
callq 0x113a54
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x113ab4
leaq 0xe0(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x113b10
leaq 0x230(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x113c20
leaq 0xe0(%rsp), %rdi
callq 0x114238
leaq 0x230(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x114280
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x230(%rsp), %rdi
callq 0x114702
leaq 0x18(%rsp), %rdi
callq 0x11483c
leaq 0x38(%rsp), %rdi
callq 0x1115d8
leaq 0xb58(%rsp), %rdi
callq 0x114852
leaq 0x78(%rsp), %rdi
callq 0x1148a6
leaq 0x10(%rsp), %rdi
callq 0x1148bc
addq $0x1540, %rsp           # imm = 0x1540
popq %rbx
retq
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x114238
jmp 0x113624
jmp 0x1135a1
movq %rax, %rbx
jmp 0x113624
movq %rax, %rbx
jmp 0x11362e
jmp 0x1135d6
jmp 0x1135b2
movq %rax, %rbx
jmp 0x113647
jmp 0x1135bc
movq %rax, %rbx
jmp 0x113651
jmp 0x1135c6
movq %rax, %rbx
jmp 0x11365b
movq %rax, %rbx
jmp 0x113668
movq %rax, %rbx
jmp 0x113675
jmp 0x1135f5
movq %rax, %rbx
leaq 0xb58(%rsp), %rdi
callq 0x1115d8
jmp 0x113682
movq %rax, %rbx
jmp 0x113682
movq %rax, %rbx
leaq 0xb58(%rsp), %rdi
callq 0x1115d8
jmp 0x11368c
movq %rax, %rbx
jmp 0x11368c
movq %rax, %rbx
leaq 0x230(%rsp), %rdi
callq 0x114702
leaq 0x18(%rsp), %rdi
callq 0x11483c
leaq 0x38(%rsp), %rdi
callq 0x1115d8
jmp 0x113675
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x1115d8
leaq 0x18(%rsp), %rdi
callq 0x1115d8
leaq 0x38(%rsp), %rdi
callq 0x1115d8
leaq 0xe0(%rsp), %rdi
callq 0x1115d8
leaq 0x230(%rsp), %rdi
callq 0x113a34
leaq 0xb58(%rsp), %rdi
callq 0x114852
leaq 0x78(%rsp), %rdi
callq 0x1148a6
leaq 0x10(%rsp), %rdi
callq 0x1148bc
movq %rbx, %rdi
callq 0x111310