// File: ArashPartow[P]exprtk/./exprtk.hpp
// Function: exprtk::details::expression_node<double>* exprtk::parser<double>::simplify<std::allocator<exprtk::details::expression_node<double>*>, std::allocator<bool>, std::vector>(std::vector<exprtk::details::expression_node<double>*, std::allocator<exprtk::details::expression_node<double>*>>&, std::vector<bool, std::allocator<bool>>&, bool)
inline expression_node_ptr simplify(Sequence<expression_node_ptr,Allocator1>& expression_list,
                                          Sequence<bool,Allocator2>& side_effect_list,
                                          const bool specialise_on_final_type = false)
      {
         if (expression_list.empty())
            return error_node();
         else if (1 == expression_list.size())
            return expression_list[0];

         Sequence<expression_node_ptr,Allocator1> tmp_expression_list;

         exprtk_debug(("simplify() - expression_list.size: %d  side_effect_list.size(): %d\n",
                       static_cast<int>(expression_list .size()),
                       static_cast<int>(side_effect_list.size())));

         bool return_node_present = false;

         for (std::size_t i = 0; i < (expression_list.size() - 1); ++i)
         {
            if (is_variable_node(expression_list[i]))
               continue;
            else if (
                      is_return_node  (expression_list[i]) ||
                      is_break_node   (expression_list[i]) ||
                      is_continue_node(expression_list[i])
                    )
            {
               tmp_expression_list.push_back(expression_list[i]);

               // Remove all subexpressions after first short-circuit
               // node has been encountered.

               for (std::size_t j = i + 1; j < expression_list.size(); ++j)
               {
                  free_node(node_allocator_, expression_list[j]);
               }

               return_node_present = true;

               break;
            }
            else if (
                      is_constant_node(expression_list[i]) ||
                      is_null_node    (expression_list[i]) ||
                      !side_effect_list[i]
                    )
            {
               free_node(node_allocator_, expression_list[i]);
               continue;
            }
            else
               tmp_expression_list.push_back(expression_list[i]);
         }

         if (!return_node_present)
         {
            tmp_expression_list.push_back(expression_list.back());
         }

         expression_list.swap(tmp_expression_list);

         if (tmp_expression_list.size() > expression_list.size())
         {
            exprtk_debug(("simplify() - Reduced subexpressions from %d to %d\n",
                          static_cast<int>(tmp_expression_list.size()),
                          static_cast<int>(expression_list    .size())));
         }

         if (
              return_node_present     ||
              side_effect_list.back() ||
              (expression_list.size() > 1)
            )
            state_.activate_side_effect("simplify()");

         if (1 == expression_list.size())
            return expression_list[0];
         else if (specialise_on_final_type && is_generally_string_node(expression_list.back()))
            return expression_generator_.vararg_function(details::e_smulti,expression_list);
         else
            return expression_generator_.vararg_function(details::e_multi,expression_list);
      }

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movb %cl, %al
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movq %rdx, 0x128(%rsp)
andb $0x1, %al
movb %al, 0x127(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x130(%rsp), %rdi
callq 0x37d750
testb $0x1, %al
jne 0x37d86d
jmp 0x37d87f
callq 0x2821f0
movq %rax, 0x140(%rsp)
jmp 0x37de9d
movq 0x130(%rsp), %rdi
callq 0x39d0d0
movq %rax, %rcx
movl $0x1, %eax
cmpq %rcx, %rax
jne 0x37d8ba
movq 0x130(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x39d110
movq (%rax), %rax
movq %rax, 0x140(%rsp)
jmp 0x37de9d
jmp 0x37d8bc
leaq 0x108(%rsp), %rdi
callq 0x3798f0
movb $0x0, 0x107(%rsp)
movq $0x0, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x130(%rsp), %rdi
callq 0x39d0d0
movq %rax, %rcx
movq 0x80(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x37dbea
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x23c960
movb %al, 0x7f(%rsp)
jmp 0x37d935
movb 0x7f(%rsp), %al
testb $0x1, %al
jne 0x37d93f
jmp 0x37d95d
jmp 0x37dbd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
jmp 0x37de8e
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x37d7a0
movb %al, 0x7e(%rsp)
jmp 0x37d980
movb 0x7e(%rsp), %al
testb $0x1, %al
jne 0x37d9e7
jmp 0x37d98a
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x3af660
movb %al, 0x7d(%rsp)
jmp 0x37d9ad
movb 0x7d(%rsp), %al
testb $0x1, %al
jne 0x37d9e7
jmp 0x37d9b7
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x3af6a0
movb %al, 0x7c(%rsp)
jmp 0x37d9da
movb 0x7c(%rsp), %al
testb $0x1, %al
jne 0x37d9e7
jmp 0x37daa5
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq %rax, %rsi
leaq 0x108(%rsp), %rdi
callq 0x37d3b0
jmp 0x37da0e
movq 0xf8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x130(%rsp), %rdi
callq 0x39d0d0
movq %rax, %rcx
movq 0x70(%rsp), %rax
cmpq %rcx, %rax
jae 0x37da98
movq 0x88(%rsp), %rax
addq $0x290, %rax            # imm = 0x290
movq %rax, 0x68(%rsp)
movq 0x130(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x39d110
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x284bd0
jmp 0x37da80
jmp 0x37da82
movq 0xe0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xe0(%rsp)
jmp 0x37da22
movb $0x1, 0x107(%rsp)
jmp 0x37dbea
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x39cbf0
movb %al, 0x67(%rsp)
jmp 0x37dac8
movb 0x67(%rsp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0x66(%rsp)
jne 0x37db5f
jmp 0x37dadd
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq (%rax), %rdi
callq 0x3af620
movb %al, 0x65(%rsp)
jmp 0x37db00
movb 0x65(%rsp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0x66(%rsp)
jne 0x37db5f
jmp 0x37db11
movq 0x128(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x55b6d0
movq %rdx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
jmp 0x37db32
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, 0xd0(%rsp)
movq %rax, 0xd8(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x55a8b0
xorb $-0x1, %al
movb %al, 0x66(%rsp)
movb 0x66(%rsp), %al
testb $0x1, %al
jne 0x37db69
jmp 0x37dba2
movq 0x88(%rsp), %rax
addq $0x290, %rax            # imm = 0x290
movq %rax, 0x48(%rsp)
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x284bd0
jmp 0x37dba0
jmp 0x37dbd1
movq 0x130(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x39d110
movq %rax, %rsi
leaq 0x108(%rsp), %rdi
callq 0x37d3b0
jmp 0x37dbc9
jmp 0x37dbcb
jmp 0x37dbcd
jmp 0x37dbcf
jmp 0x37dbd1
movq 0xf8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xf8(%rsp)
jmp 0x37d8dd
testb $0x1, 0x107(%rsp)
jne 0x37dc15
movq 0x130(%rsp), %rdi
callq 0x37d7e0
movq %rax, %rsi
leaq 0x108(%rsp), %rdi
callq 0x37d3b0
jmp 0x37dc13
jmp 0x37dc15
movq 0x130(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x55b730
leaq 0x108(%rsp), %rdi
callq 0x39d0d0
movq %rax, 0x40(%rsp)
movq 0x130(%rsp), %rdi
callq 0x39d0d0
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jbe 0x37dc58
jmp 0x37dc58
movb $0x1, %al
testb $0x1, 0x107(%rsp)
movb %al, 0x3f(%rsp)
jne 0x37dccd
movq 0x128(%rsp), %rdi
callq 0x55b790
movq %rdx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x37dc81
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x55a8b0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0x3f(%rsp)
jne 0x37dccd
movq 0x130(%rsp), %rdi
callq 0x39d0d0
cmpq $0x1, %rax
seta %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x37dcda
jmp 0x37dd6e
movq 0x88(%rsp), %rax
addq $0x3a8, %rax            # imm = 0x3A8
movq %rax, 0x18(%rsp)
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x11b6f0
movq 0x20(%rsp), %rdx
leaq 0x22d63e(%rip), %rsi    # 0x5ab349
leaq 0xa0(%rsp), %rdi
callq 0x134520
jmp 0x37dd1a
movq 0x18(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x3eb500
leaq 0xa0(%rsp), %rdi
callq 0x11b838
leaq 0x9f(%rsp), %rdi
callq 0x11b820
jmp 0x37dd6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
leaq 0x9f(%rsp), %rdi
callq 0x11b820
jmp 0x37de8e
movq 0x130(%rsp), %rdi
callq 0x39d0d0
movq %rax, %rcx
movl $0x1, %eax
cmpq %rcx, %rax
jne 0x37ddb4
movq 0x130(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x39d110
movq (%rax), %rax
movq %rax, 0x140(%rsp)
movl $0x1, 0x98(%rsp)
jmp 0x37de7f
testb $0x1, 0x127(%rsp)
je 0x37de33
movq 0x130(%rsp), %rdi
callq 0x37d7e0
movq (%rax), %rdi
callq 0x3a7600
movb %al, 0x17(%rsp)
jmp 0x37ddd9
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x37dde3
jmp 0x37de33
movq 0x88(%rsp), %rdi
addq $0x220, %rdi            # imm = 0x220
movl $0x5b, 0x94(%rsp)
movq 0x130(%rsp), %rdx
leaq 0x94(%rsp), %rsi
callq 0x39af30
movq %rax, 0x8(%rsp)
jmp 0x37de19
movq 0x8(%rsp), %rax
movq %rax, 0x140(%rsp)
movl $0x1, 0x98(%rsp)
jmp 0x37de7f
movq 0x88(%rsp), %rdi
addq $0x220, %rdi            # imm = 0x220
movl $0x5a, 0x90(%rsp)
movq 0x130(%rsp), %rdx
leaq 0x90(%rsp), %rsi
callq 0x39af30
movq %rax, (%rsp)
jmp 0x37de68
movq (%rsp), %rax
movq %rax, 0x140(%rsp)
movl $0x1, 0x98(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x37df90
jmp 0x37de9d
leaq 0x108(%rsp), %rdi
callq 0x37df90
jmp 0x37dead
movq 0x140(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
retq
movq 0xf0(%rsp), %rdi
callq 0x11b4e0
nopw (%rax,%rax)