// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lstrlib.c
// Function: match
static const char *match (MatchState *ms, const char *s, const char *p) {
  if (ms->matchdepth-- == 0)
    luaL_error(ms->L, "pattern too complex");
  init: /* using goto's to optimize tail recursion */
  if (p != ms->p_end) {  /* end of pattern? */
    switch (*p) {
      case '(': {  /* start capture */
        if (*(p + 1) == ')')  /* position capture? */
          s = start_capture(ms, s, p + 2, CAP_POSITION);
        else
          s = start_capture(ms, s, p + 1, CAP_UNFINISHED);
        break;
      }
      case ')': {  /* end capture */
        s = end_capture(ms, s, p + 1);
        break;
      }
      case '$': {
        if ((p + 1) != ms->p_end)  /* is the '$' the last char in pattern? */
          goto dflt;  /* no; go to default */
        s = (s == ms->src_end) ? s : NULL;  /* check end of string */
        break;
      }
      case L_ESC: {  /* escaped sequences not in the format class[*+?-]? */
        switch (*(p + 1)) {
          case 'b': {  /* balanced string? */
            s = matchbalance(ms, s, p + 2);
            if (s != NULL) {
              p += 4; goto init;  /* return match(ms, s, p + 4); */
            }  /* else fail (s == NULL) */
            break;
          }
          case 'f': {  /* frontier? */
            const char *ep; char previous;
            p += 2;
            if (*p != '[')
              luaL_error(ms->L, "missing '[' after '%%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)) {
              p = ep; goto init;  /* return match(ms, s, ep); */
            }
            s = NULL;  /* match failed */
            break;
          }
          case '0': case '1': case '2': case '3':
          case '4': case '5': case '6': case '7':
          case '8': case '9': {  /* capture results (%0-%9)? */
            s = match_capture(ms, s, uchar(*(p + 1)));
            if (s != NULL) {
              p += 2; goto init;  /* return match(ms, s, p + 2) */
            }
            break;
          }
          default: goto dflt;
        }
        break;
      }
      default: dflt: {  /* pattern class plus optional suffix */
        const char *ep = classend(ms, p);  /* points to optional suffix */
        /* does not match at least once? */
        if (!singlematch(ms, s, p, ep)) {
          if (*ep == '*' || *ep == '?' || *ep == '-') {  /* accept empty? */
            p = ep + 1; goto init;  /* return match(ms, s, ep + 1); */
          }
          else  /* '+' or no suffix */
            s = NULL;  /* fail */
        }
        else {  /* matched once */
          switch (*ep) {  /* handle optional suffix */
            case '?': {  /* optional */
              const char *res;
              if ((res = match(ms, s + 1, ep + 1)) != NULL)
                s = res;
              else {
                p = ep + 1; goto init;  /* else return match(ms, s, ep + 1); */
              }
              break;
            }
            case '+':  /* 1 or more repetitions */
              s++;  /* 1 match already done */
              /* FALLTHROUGH */
            case '*':  /* 0 or more repetitions */
              s = max_expand(ms, s, p, ep);
              break;
            case '-':  /* 0 or more repetitions (minimum) */
              s = min_expand(ms, s, p, ep);
              break;
            default:  /* no suffix */
              s++; p = ep; goto init;  /* return match(ms, s + 1, ep); */
          }
        }
        break;
      }
    }
  }
  ms->matchdepth++;
  return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movl 0x20(%rcx), %eax
movl %eax, %edx
addl $-0x1, %edx
movl %edx, 0x20(%rcx)
cmpl $0x0, %eax
jne 0x2e38e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x8b0f(%rip), %rsi      # 0x36e96
movb $0x0, %al
callq 0x1fbf0
jmp 0x2e390
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0x2e710
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
addl $-0x24, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x5, %eax
ja 0x2e5d3
movq -0x40(%rbp), %rax
leaq 0x87fa(%rip), %rcx      # 0x36bc0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x29, %eax
jne 0x2e3fc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x2, %rdx
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2e7d0
movq %rax, -0x10(%rbp)
jmp 0x2e41a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x1, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x2e7d0
movq %rax, -0x10(%rbp)
jmp 0x2e70e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x1, %rdx
callq 0x2e890
movq %rax, -0x10(%rbp)
jmp 0x2e70e
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0x2e454
jmp 0x2e5d5
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2e46c
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x2e474
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x2e474
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x2e70e
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0x4c(%rbp)
addl $-0x30, %eax
subl $0xa, %eax
jb 0x2e599
jmp 0x2e49a
movl -0x4c(%rbp), %eax
subl $0x62, %eax
je 0x2e4b1
jmp 0x2e4a4
movl -0x4c(%rbp), %eax
subl $0x66, %eax
je 0x2e4e7
jmp 0x2e5cc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x2, %rdx
callq 0x2e930
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2e4e2
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
jmp 0x2e5ce
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
je 0x2e515
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x899c(%rip), %rsi      # 0x36eaa
movb $0x0, %al
callq 0x1fbf0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2ea20
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x2e53a
xorl %eax, %eax
movl %eax, -0x50(%rbp)
jmp 0x2e545
movq -0x10(%rbp), %rax
movsbl -0x1(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $-0x1, %rdx
callq 0x2eb30
cmpl $0x0, %eax
jne 0x2e58f
movq -0x10(%rbp), %rax
movzbl (%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $-0x1, %rdx
callq 0x2eb30
cmpl $0x0, %eax
je 0x2e58f
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
movq $0x0, -0x10(%rbp)
jmp 0x2e5ce
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %edx
callq 0x2ec40
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2e5ca
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
jmp 0x2e5ce
jmp 0x2e5d5
jmp 0x2e70e
jmp 0x2e5d5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2ea20
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x2ece0
cmpl $0x0, %eax
jne 0x2e642
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0x2e624
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3f, %eax
je 0x2e624
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2e635
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
movq $0x0, -0x10(%rbp)
jmp 0x2e70c
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
addl $-0x2a, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x15, %eax
ja 0x2e6f1
movq -0x58(%rbp), %rax
leaq 0x8572(%rip), %rcx      # 0x36bd8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movq -0x30(%rbp), %rdx
addq $0x1, %rdx
callq 0x2e350
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x2e69c
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x2e6ad
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
jmp 0x2e70a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x2eda0
movq %rax, -0x10(%rbp)
jmp 0x2e70a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x2ee50
movq %rax, -0x10(%rbp)
jmp 0x2e70a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x2e390
jmp 0x2e70c
jmp 0x2e70e
jmp 0x2e710
movq -0x8(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)