// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %rax
movq %rax, (%rsp)
leaq 0x1(%rbx), %rbp
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x25, %eax
jne 0x198b2
movzbl 0x1(%r15), %r12d
cmpq $0x66, %r12
jne 0x198e4
cmpb $0x5b, 0x2(%r15)
je 0x19862
movq 0x10(%r14), %rdi
leaq 0x353f(%rip), %rsi      # 0x1cd9a
xorl %eax, %eax
callq 0x108d7
addq $0x2, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x19c87
movq %rax, %r13
cmpq (%r14), %rbx
je 0x1987f
movzbl -0x1(%rbx), %edi
jmp 0x19881
xorl %edi, %edi
leaq -0x1(%r13), %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x19d1f
testl %eax, %eax
jne 0x19b18
movzbl (%rbx), %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x19d1f
movq %r13, %r15
testl %eax, %eax
jne 0x19831
jmp 0x19b18
cmpl $0x27, %eax
jg 0x198d0
testl %eax, %eax
je 0x19ab4
cmpl $0x24, %eax
jne 0x198fe
cmpb $0x0, 0x1(%r15)
jne 0x198fe
jmp 0x19bad
cmpl $0x29, %eax
je 0x19a89
cmpl $0x28, %eax
je 0x19ab9
jmp 0x198fe
cmpl $0x62, %r12d
je 0x1995b
callq 0x4580
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
jne 0x19a03
movq %r14, %rdi
movq %r15, %rsi
callq 0x19c87
movq %rax, %r13
cmpq 0x8(%r14), %rbx
jae 0x19927
movzbl (%rbx), %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x19db0
testl %eax, %eax
setne %al
jmp 0x19929
xorl %eax, %eax
movzbl (%r13), %ecx
cmpl $0x3f, %ecx
jne 0x199c9
testb %al, %al
je 0x19953
leaq 0x1(%r13), %rdx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1980e
testq %rax, %rax
jne 0x19b1a
incq %r13
jmp 0x1982e
movb 0x2(%r15), %al
testb %al, %al
je 0x1996a
cmpb $0x0, 0x3(%r15)
jne 0x19980
movq 0x10(%r14), %rdi
leaq 0x3472(%rip), %rsi      # 0x1cde7
xorl %eax, %eax
callq 0x108d7
movb 0x2(%r15), %al
cmpb %al, (%rbx)
jne 0x19b18
movq 0x8(%r14), %rcx
incq %rbx
cmpq %rcx, %rbx
jae 0x19b18
movb 0x3(%r15), %dl
movl $0x1, %esi
movb (%rbx), %dil
cmpb %dl, %dil
jne 0x199af
decl %esi
jne 0x199bc
jmp 0x199f4
xorl %r8d, %r8d
cmpb %al, %dil
sete %r8b
addl %r8d, %esi
incq %rbx
cmpq %rcx, %rbx
jne 0x199a1
jmp 0x19b18
cmpl $0x2a, %ecx
je 0x19b54
cmpl $0x2b, %ecx
je 0x19b4d
cmpl $0x2d, %ecx
je 0x19b73
testb %al, %al
je 0x19b18
movq %rbp, %rbx
jmp 0x1982a
incq %rbx
addq $0x4, %r15
movq %r15, %r13
jmp 0x1982a
cmpb $0x31, %r12b
movq (%rsp), %rbp
jb 0x19a26
leal -0x31(%r12), %eax
cmpl 0x18(%r14), %eax
jge 0x19a26
movl %eax, %ecx
shlq $0x4, %rcx
cmpq $-0x1, 0x8(%rbp,%rcx)
jne 0x19a38
movq 0x10(%r14), %rdi
leaq 0x340c(%rip), %rsi      # 0x1ce3d
xorl %eax, %eax
callq 0x108d7
cltq
shlq $0x4, %rax
movq 0x8(%rbp,%rax), %r13
movq 0x8(%r14), %rcx
subq %rbx, %rcx
cmpq %r13, %rcx
jb 0x19b18
addq %rbp, %rax
movq (%rax), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4380
testl %eax, %eax
jne 0x19b18
testq %rbx, %rbx
movl $0x0, %eax
je 0x19b1a
addq %r13, %rbx
addq $0x2, %r15
movq %r15, %r13
jmp 0x1982a
incq %r15
movl 0x18(%r14), %eax
movq %rax, %rcx
shlq $0x4, %rcx
addq %r14, %rcx
addq $0x18, %rcx
movq (%rsp), %r13
testl %eax, %eax
jle 0x19ad4
decl %eax
cmpq $-0x1, (%rcx)
leaq -0x10(%rcx), %rcx
jne 0x19aa2
jmp 0x19ae6
movq %rbx, %rax
jmp 0x19b1a
cmpb $0x29, 0x1(%r15)
jne 0x19b29
addq $0x2, %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
jmp 0x19b3a
movq 0x10(%r14), %rdi
leaq 0x32f0(%rip), %rsi      # 0x1cdcf
xorl %eax, %eax
callq 0x108d7
movslq %eax, %r12
shlq $0x4, %r12
movq %rbx, %rax
subq (%r13,%r12), %rax
movq %rax, 0x8(%r13,%r12)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1980e
testq %rax, %rax
jne 0x19b1a
addq %r12, %r13
movq $-0x1, 0x8(%r13)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19c1d
testb %al, %al
je 0x19b18
incq %rbx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19de1
movq %r13, %rbp
incq %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1980e
testq %rax, %rax
jne 0x19b1a
cmpq 0x8(%r14), %rbx
jae 0x19b18
movzbl (%rbx), %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x19db0
testl %eax, %eax
je 0x19b18
incq %rbx
jmp 0x19b79
xorl %eax, %eax
cmpq 0x8(%r14), %rbx
cmoveq %rbx, %rax
jmp 0x19b1a