// File: ArashPartow[P]exprtk/./exprtk.hpp
// Function: exprtk::details::sequence_match(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&, char&)
inline bool sequence_match(const std::string& pattern,
                                 const std::string& str,
                                 std::size_t&       diff_index,
                                 char_t&            diff_value)
      {
         if (str.empty())
         {
            return ("Z" == pattern);
         }
         else if ('*' == pattern[0])
            return false;

         typedef std::string::const_iterator itr_t;

         itr_t p_itr = pattern.begin();
         itr_t s_itr = str    .begin();

         const itr_t p_end = pattern.end();
         const itr_t s_end = str    .end();

         while ((s_end != s_itr) && (p_end != p_itr))
         {
            if ('*' == (*p_itr))
            {
               const char_t target = static_cast<char_t>(std::toupper(*(p_itr - 1)));

               if ('*' == target)
               {
                  diff_index = static_cast<std::size_t>(std::distance(str.begin(),s_itr));
                  diff_value = static_cast<char_t>(std::toupper(*p_itr));

                  return false;
               }
               else
                  ++p_itr;

               while (s_itr != s_end)
               {
                  if (target != std::toupper(*s_itr))
                     break;
                  else
                     ++s_itr;
               }

               continue;
            }
            else if (
                      ('?' != *p_itr) &&
                      std::toupper(*p_itr) != std::toupper(*s_itr)
                    )
            {
               diff_index = static_cast<std::size_t>(std::distance(str.begin(),s_itr));
               diff_value = static_cast<char_t>(std::toupper(*p_itr));

               return false;
            }

            ++p_itr;
            ++s_itr;
         }

         return (
                  (s_end == s_itr) &&
                  (
                    (p_end ==  p_itr) ||
                    ('*'   == *p_itr)
                  )
                );
      }

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq 0x70(%rsp), %rdi
callq 0x11b260
testb $0x1, %al
jne 0x552d5b
jmp 0x552d7a
movq 0x78(%rsp), %rsi
leaq 0x5df28(%rip), %rdi     # 0x5b0c8f
callq 0x551c00
andb $0x1, %al
movb %al, 0x87(%rsp)
jmp 0x55304f
movq 0x78(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11b770
movsbl (%rax), %ecx
movl $0x2a, %eax
cmpl %ecx, %eax
jne 0x552da1
movb $0x0, 0x87(%rsp)
jmp 0x55304f
jmp 0x552da3
movq 0x78(%rsp), %rdi
callq 0x11b210
movq %rax, 0x58(%rsp)
movq 0x70(%rsp), %rdi
callq 0x11b210
movq %rax, 0x50(%rsp)
movq 0x78(%rsp), %rdi
callq 0x11b730
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rdi
callq 0x11b730
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5514c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x552dfd
jmp 0x552e10
leaq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x5514c0
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x552e1d
jmp 0x552fe5
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %ecx
movl $0x2a, %eax
cmpl %ecx, %eax
jne 0x552f23
leaq 0x58(%rsp), %rdi
movl $0x1, %esi
callq 0x5532e0
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movb %al, 0x3f(%rsp)
movsbl 0x3f(%rsp), %ecx
movl $0x2a, %eax
cmpl %ecx, %eax
jne 0x552eca
movq 0x70(%rsp), %rdi
callq 0x11b210
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x551ad0
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, (%rax)
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movb %al, %cl
movq 0x60(%rsp), %rax
movb %cl, (%rax)
movb $0x0, 0x87(%rsp)
jmp 0x55304f
leaq 0x58(%rsp), %rdi
callq 0x5515d0
jmp 0x552ed6
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x5514c0
testb $0x1, %al
jne 0x552eeb
jmp 0x552f1e
movsbl 0x3f(%rsp), %eax
movl %eax, 0x8(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
je 0x552f12
jmp 0x552f1e
leaq 0x50(%rsp), %rdi
callq 0x5515d0
jmp 0x552ed6
jmp 0x552ddf
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %ecx
movl $0x3f, %eax
cmpl %ecx, %eax
je 0x552fca
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movl %eax, 0x4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
je 0x552fca
movq 0x70(%rsp), %rdi
callq 0x11b210
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x551ad0
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, (%rax)
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %edi
callq 0x11b1b0
movb %al, %cl
movq 0x60(%rsp), %rax
movb %cl, (%rax)
movb $0x0, 0x87(%rsp)
jmp 0x55304f
jmp 0x552fcc
leaq 0x58(%rsp), %rdi
callq 0x5515d0
leaq 0x50(%rsp), %rdi
callq 0x5515d0
jmp 0x552ddf
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x553320
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x3(%rsp)
jne 0x553003
jmp 0x553042
leaq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x553320
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0x2(%rsp)
jne 0x55303a
leaq 0x58(%rsp), %rdi
callq 0x551500
movsbl (%rax), %ecx
movl $0x2a, %eax
cmpl %ecx, %eax
sete %al
movb %al, 0x2(%rsp)
movb 0x2(%rsp), %al
movb %al, 0x3(%rsp)
movb 0x3(%rsp), %al
andb $0x1, %al
movb %al, 0x87(%rsp)
movb 0x87(%rsp), %al
andb $0x1, %al
addq $0x88, %rsp
retq