// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/lua/src/lstrlib.c
// Function: match
static const char *match (MatchState *ms, const char *s, const char *p) {
  init: /* using goto's to optimize tail recursion */
  switch (*p) {
    case '(': {  /* start capture */
      if (*(p+1) == ')')  /* position capture? */
        return start_capture(ms, s, p+2, CAP_POSITION);
      else
        return start_capture(ms, s, p+1, CAP_UNFINISHED);
    }
    case ')': {  /* end capture */
      return end_capture(ms, s, p+1);
    }
    case L_ESC: {
      switch (*(p+1)) {
        case 'b': {  /* balanced string? */
          s = matchbalance(ms, s, p+2);
          if (s == NULL) return NULL;
          p+=4; goto init;  /* else return match(ms, s, p+4); */
        }
        case 'f': {  /* frontier? */
          const char *ep; char previous;
          p += 2;
          if (*p != '[')
            luaL_error(ms->L, "missing " LUA_QL("[") " after "
                               LUA_QL("%%f") " in pattern");
          ep = classend(ms, p);  /* points to what is next */
          previous = (s == ms->src_init) ? '\0' : *(s-1);
          if (matchbracketclass(uchar(previous), p, ep-1) ||
             !matchbracketclass(uchar(*s), p, ep-1)) return NULL;
          p=ep; goto init;  /* else return match(ms, s, ep); */
        }
        default: {
          if (isdigit(uchar(*(p+1)))) {  /* capture results (%0-%9)? */
            s = match_capture(ms, s, uchar(*(p+1)));
            if (s == NULL) return NULL;
            p+=2; goto init;  /* else return match(ms, s, p+2) */
          }
          goto dflt;  /* case default */
        }
      }
    }
    case '\0': {  /* end of pattern */
      return s;  /* match succeeded */
    }
    case '$': {
      if (*(p+1) == '\0')  /* is the `$' the last char in pattern? */
        return (s == ms->src_end) ? s : NULL;  /* check end of string */
      else goto dflt;
    }
    default: dflt: {  /* it is a pattern item */
      const char *ep = classend(ms, p);  /* points to what is next */
      int m = s<ms->src_end && singlematch(uchar(*s), p, ep);
      switch (*ep) {
        case '?': {  /* optional */
          const char *res;
          if (m && ((res=match(ms, s+1, ep+1)) != NULL))
            return res;
          p=ep+1; goto init;  /* else return match(ms, s, ep+1); */
        }
        case '*': {  /* 0 or more repetitions */
          return max_expand(ms, s, p, ep);
        }
        case '+': {  /* 1 or more repetitions */
          return (m ? max_expand(ms, s+1, p, ep) : NULL);
        }
        case '-': {  /* 0 or more repetitions (minimum) */
          return min_expand(ms, s, p, ep);
        }
        default: {
          if (!m) return NULL;
          s++; p=ep; goto init;  /* else return match(ms, s+1, ep); */
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x29, %eax
ja 0x27a1e
movq -0x50(%rbp), %rax
leaq 0x5538(%rip), %rcx      # 0x2cd20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x29, %eax
jne 0x27821
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x2, %rdx
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x27c20
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x1, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x27c20
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x1, %rdx
callq 0x27ce0
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0x54(%rbp)
subl $0x62, %eax
je 0x27881
jmp 0x27874
movl -0x54(%rbp), %eax
subl $0x66, %eax
je 0x278bf
jmp 0x27974
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x2, %rdx
callq 0x27d80
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x278ae
movq $0x0, -0x8(%rbp)
jmp 0x27b77
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
jmp 0x277c7
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
je 0x278ed
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x5628(%rip), %rsi      # 0x2cf0e
movb $0x0, %al
callq 0x1a8b0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x27e70
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x27912
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0x2791d
movq -0x18(%rbp), %rax
movsbl -0x1(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $-0x1, %rdx
callq 0x27f80
cmpl $0x0, %eax
jne 0x2795a
movq -0x18(%rbp), %rax
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $-0x1, %rdx
callq 0x27f80
cmpl $0x0, %eax
jne 0x27967
movq $0x0, -0x8(%rbp)
jmp 0x27b77
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x277c7
callq 0x5570
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x279d3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %edx
callq 0x28090
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x279c2
movq $0x0, -0x8(%rbp)
jmp 0x27b77
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x277c7
jmp 0x27a20
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x27a1c
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x27a07
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x27a0f
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0x27a0f
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27b77
jmp 0x27a20
jmp 0x27a20
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x27e70
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x61(%rbp)
jae 0x27a61
movq -0x18(%rbp), %rax
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x28130
cmpl $0x0, %eax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
movzbl %al, %eax
andl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
addl $-0x2a, %eax
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x15, %eax
ja 0x27b4e
movq -0x70(%rbp), %rax
leaq 0x5337(%rip), %rcx      # 0x2cdc8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x3c(%rbp)
je 0x27ad0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rdx
addq $0x1, %rdx
callq 0x277b0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x27ad0
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x277c7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x281c0
movq %rax, -0x8(%rbp)
jmp 0x27b77
cmpl $0x0, -0x3c(%rbp)
je 0x27b21
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x281c0
movq %rax, -0x78(%rbp)
jmp 0x27b29
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x27b29
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27b77
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x28290
movq %rax, -0x8(%rbp)
jmp 0x27b77
cmpl $0x0, -0x3c(%rbp)
jne 0x27b5e
movq $0x0, -0x8(%rbp)
jmp 0x27b77
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x277c7
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)