// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1538, %rsp           # imm = 0x1538
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x119bc0
leaq 0x238(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x19648d(%rip), %rsi    # 0x2af955
leaq 0x19648c(%rip), %rdx    # 0x2af95b
leaq 0x228(%rsp), %rdi
callq 0x119b2a
leaq 0x70(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x119c08
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0x11950b
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x228(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x19643f(%rip), %rsi    # 0x2af95c
leaq 0x19643f(%rip), %rdx    # 0x2af963
callq 0x119b2a
leaq 0x8(%rsp), %rdi
leaq 0x228(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x119d10
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0x11955d
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x228(%rsp), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x119e7a
leaq 0xc10(%rsp), %rdi
callq 0x11a002
leaq 0xe8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1963d2(%rip), %rsi    # 0x2af964
leaq 0x1963d5(%rip), %rdx    # 0x2af96e
leaq 0xd8(%rsp), %rdi
callq 0x119b2a
leaq 0xc10(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x116520
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1963a4(%rip), %rsi    # 0x2af96f
leaq 0x1963a5(%rip), %rdx    # 0x2af977
leaq 0x30(%rsp), %rdi
callq 0x119b2a
leaq 0xc50(%rsp), %r14
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x127430
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x196377(%rip), %rsi    # 0x2af978
leaq 0x196378(%rip), %rdx    # 0x2af980
leaq 0x10(%rsp), %rdi
callq 0x119b2a
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x127430
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x196352(%rip), %rsi    # 0x2af981
leaq 0x196363(%rip), %rdx    # 0x2af999
leaq 0x50(%rsp), %rdi
callq 0x119b2a
leaq 0xc30(%rsp), %r12
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x116520
leaq 0xb58(%rsp), %r15
leaq 0xc10(%rsp), %rsi
movq %r15, %rdi
callq 0x11ef16
leaq 0xb60(%rsp), %rcx
cmpq %rax, %rcx
jne 0x119727
leaq 0x228(%rsp), %rdi
leaq 0xc10(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x11dc7c
testb %al, %al
je 0x119727
leaq 0xc10(%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 0xb88(%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 0x11eb3a
movq (%rax), %r12
leaq 0xc10(%rsp), %rsi
movq %r15, %rdi
callq 0x11ee9a
movq %r12, %rdi
movq %rax, %rsi
callq 0x11ebb6
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x11973e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
leaq 0x40(%rsp), %r15
je 0x11975f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x119776
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x119793
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x116090
movq %r14, %rdi
callq 0x1276ca
leaq 0xc40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1197bc
movq 0xc40(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xc20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1197dd
movq 0xc20(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x30(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1961ae(%rip), %rsi    # 0x2af99a
leaq 0x196ec7(%rip), %rdx    # 0x2b06ba
callq 0x119b2a
leaq 0x10(%rsp), %rdi
callq 0x11a0ce
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rax, %rcx
je 0x119835
sarq $0x3, %rcx
movq 0x8(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
cmpq %rbx, %rax
je 0x119844
cmpq (%rax), %rdx
je 0x119844
addq $0x8, %rax
decq %rcx
jne 0x119822
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x127950
leaq 0xd8(%rsp), %rdi
movl $0x7f, %esi
callq 0x11a15a
leaq 0xc10(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x11a25a
leaq 0x1d8(%rsp), %rdi
callq 0x127b36
leaq 0x1a8(%rsp), %rdi
callq 0x127b36
leaq 0x178(%rsp), %rdi
callq 0x127b36
leaq 0x148(%rsp), %rdi
callq 0x127b36
leaq 0x118(%rsp), %rdi
callq 0x127b36
leaq 0xe8(%rsp), %rdi
callq 0x127b36
leaq 0xc10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x11aa7e
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0xc10(%rsp), %rdi
callq 0x11b61a
leaq 0x10(%rsp), %rdi
callq 0x11b8dc
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x11990d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x228(%rsp), %rdi
callq 0x11b92a
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11993b
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x28ef0e(%rip), %rax    # 0x3a8850
leaq 0xa0(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x119967
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0x8(%rsp), %rdi
callq 0x11b9ce
addq $0x1538, %rsp           # imm = 0x1538
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11999a
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x11aa36
jmp 0x119a4e
movq %rax, %rbx
jmp 0x119a4e
movq %rax, %rbx
jmp 0x119a58
jmp 0x1199d2
jmp 0x1199ae
movq %rax, %rbx
jmp 0x119a94
jmp 0x1199b8
movq %rax, %rbx
jmp 0x119ab0
jmp 0x1199c2
movq %rax, %rbx
jmp 0x119acc
movq %rax, %rbx
jmp 0x119ae9
movq %rax, %rbx
jmp 0x119af6
jmp 0x119a05
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0x119b03
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x119b03
movq %rax, %rbx
jmp 0x119b03
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0x119b0d
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x119b0d
movq %rax, %rbx
jmp 0x119b0d
movq %rax, %rbx
leaq 0xc10(%rsp), %rdi
callq 0x11b61a
leaq 0x10(%rsp), %rdi
callq 0x11b8dc
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x119af6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
jmp 0x119af6
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x119a94
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x119ab0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x119acc
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x116090
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x119ae9
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x116090
leaq 0xc10(%rsp), %rdi
callq 0x11a08e
leaq 0x228(%rsp), %rdi
callq 0x11b92a
leaq 0x70(%rsp), %rdi
callq 0x11b98c
leaq 0x8(%rsp), %rdi
callq 0x11b9ce
movq %rbx, %rdi
callq 0x1162e0