user: Please show me the C implementation that matches the assembly code listed below:

```asm
<fnmatch_internal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %r8d,-0x84(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x28(%rbp)
  mov    D95(%rip),%rax
  mov    (%rax),%eax
  and    -0x84(%rbp),%eax
  test   %eax,%eax
  je     L344
  mov    -0x78(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L344
  mov    -0x68(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L344
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L344:
  mov    -0x70(%rbp),%rax
  mov    %eax,%esi
  mov    -0x84(%rbp),%ecx
  lea    -0x50(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <pat_next@plt>
  mov    %eax,-0x58(%rbp)
  cmpl   $0xfffffffb,-0x58(%rbp)
  je     L15
  cmpl   $0xfffffffe,-0x58(%rbp)
  jne    L258
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L15:
  addq   $0x1,-0x68(%rbp)
  subq   $0x1,-0x70(%rbp)
  nop
  nop
  mov    -0x70(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strnlen@plt>
  mov    %rax,-0x70(%rbp)
  mov    -0x68(%rbp),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L144
L258:
  mov    -0x80(%rbp),%rax
  mov    %eax,%ecx
  lea    -0x48(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <str_next@plt>
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jg     L113
  cmpl   $0x0,-0x58(%rbp)
  je     L179
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L179:
  mov    $0x0,%eax
  jmp    L152
L113:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x78(%rbp)
  mov    -0x48(%rbp),%rax
  sub    %rax,-0x80(%rbp)
  cmpl   $0xfffffffd,-0x58(%rbp)
  jne    L372
  mov    -0x54(%rbp),%edx
  mov    -0x68(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <match_bracket@plt>
  test   %eax,%eax
  jne    L403
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L372:
  cmpl   $0xfffffffc,-0x58(%rbp)
  je     L403
  mov    -0x54(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  je     L403
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L403:
  mov    -0x50(%rbp),%rax
  add    %rax,-0x68(%rbp)
  mov    -0x50(%rbp),%rax
  sub    %rax,-0x70(%rbp)
  nop
  jmp    L344
L64:
  mov    -0x20(%rbp),%rax
  sub    -0x40(%rbp),%rax
  mov    %eax,%esi
  mov    -0x84(%rbp),%ecx
  lea    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <pat_next@plt>
  cmp    $0xfffffffb,%eax
  je     L422
  cmp    $0xfffffffe,%eax
  jne    L331
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L422:
  movq   $0x0,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x38(%rbp)
  jmp    L321
L331:
  addq   $0x1,-0x28(%rbp)
  nop
L321:
  mov    -0x50(%rbp),%rax
  add    %rax,-0x40(%rbp)
L144:
  mov    -0x40(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jb     L64
  mov    -0x80(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strnlen@plt>
  mov    %rax,-0x80(%rbp)
  mov    -0x78(%rbp),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x80(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jae    L269
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L269:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L205
L475:
  mov    -0x30(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  js     L58
  subq   $0x1,-0x30(%rbp)
  jmp    L438
L58:
  nop
L93:
  subq   $0x1,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0xffffff80,%eax
  cmp    $0x3f,%eax
  ja     L438
  mov    -0x30(%rbp),%rax
  cmp    -0x78(%rbp),%rax
  ja     L93
L438:
  subq   $0x1,-0x28(%rbp)
L205:
  mov    -0x30(%rbp),%rax
  cmp    -0x78(%rbp),%rax
  jbe    L333
  cmpq   $0x0,-0x28(%rbp)
  jne    L475
L333:
  cmpq   $0x0,-0x28(%rbp)
  je     L191
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L191:
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x40(%rbp)
L207:
  mov    -0x20(%rbp),%rax
  sub    -0x40(%rbp),%rax
  mov    %eax,%esi
  mov    -0x84(%rbp),%ecx
  lea    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <pat_next@plt>
  mov    %eax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  add    %rax,-0x40(%rbp)
  mov    -0x18(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    %eax,%ecx
  lea    -0x48(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <str_next@plt>
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jg     L364
  cmpl   $0x0,-0x58(%rbp)
  je     L274
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L364:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x30(%rbp)
  cmpl   $0xfffffffd,-0x58(%rbp)
  jne    L262
  mov    -0x50(%rbp),%rax
  neg    %rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <match_bracket@plt>
  test   %eax,%eax
  jne    L207
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L262:
  cmpl   $0xfffffffc,-0x58(%rbp)
  je     L207
  mov    -0x54(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  je     L207
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L274:
  nop
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L471
L605:
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x78(%rbp),%rax
  mov    %rax,-0x30(%rbp)
L100:
  mov    -0x20(%rbp),%rax
  sub    -0x40(%rbp),%rax
  mov    %eax,%esi
  mov    -0x84(%rbp),%ecx
  lea    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <pat_next@plt>
  mov    %eax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  add    %rax,-0x40(%rbp)
  cmpl   $0xfffffffb,-0x58(%rbp)
  jne    L175
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x78(%rbp)
  jmp    L379
L175:
  mov    -0x18(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    %eax,%ecx
  lea    -0x48(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <str_next@plt>
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jne    L4
  mov    D90(%rip),%rax
  mov    (%rax),%eax
  jmp    L152
L4:
  cmpl   $0xfffffffd,-0x58(%rbp)
  jne    L136
  mov    -0x50(%rbp),%rax
  neg    %rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <match_bracket@plt>
  test   %eax,%eax
  jne    L360
  jmp    L379
L136:
  cmpl   $0xfffffffc,-0x58(%rbp)
  je     L360
  mov    -0x54(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jne    L34
L360:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x30(%rbp)
  jmp    L100
L34:
  nop
L379:
  cmpl   $0xfffffffb,-0x58(%rbp)
  jne    L143
  jmp    L471
L143:
  mov    -0x18(%rbp),%rax
  sub    -0x78(%rbp),%rax
  mov    %eax,%ecx
  lea    -0x48(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <str_next@plt>
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jle    L565
  mov    -0x48(%rbp),%rax
  add    %rax,-0x78(%rbp)
  jmp    L471
L565:
  addq   $0x1,-0x78(%rbp)
  jmp    L575
L208:
  addq   $0x1,-0x78(%rbp)
L575:
  mov    -0x18(%rbp),%rax
  sub    -0x78(%rbp),%rax
  mov    %eax,%ecx
  lea    -0x48(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <str_next@plt>
  test   %eax,%eax
  js     L208
L471:
  mov    -0x68(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jb     L605
  mov    $0x0,%eax
L152:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L235
  call   <__stack_chk_fail@plt>
L235:
  leave
  ret
```

assistant: ```c
int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n, int flags) {
  const char *p, *ptail, *endpat;
  const char *s, *stail, *endstr;
  size_t pinc, sinc, tailcnt = 0;
  int c, k;
  if (flags & FNM_PERIOD) {
    if (*str == '.' && *pat != '.')
      return FNM_NOMATCH;
  }
  for (;;) {
    switch ((c = pat_next(pat, m, &pinc, flags))) {
    case -2:
      return FNM_NOMATCH;
    case -5:
      pat++;
      m--;
      break;
    default:
      k = str_next(str, n, &sinc);
      if (k <= 0)
        return (c == 0) ? 0 : FNM_NOMATCH;
      str += sinc;
      n -= sinc;
      if (c == -3) {
        if (!match_bracket(pat, k))
          return FNM_NOMATCH;
      } else if (c != -4 && k != c) {
        return FNM_NOMATCH;
      }
      pat += pinc;
      m -= pinc;
      continue;
    }
    break;
  }
  m = strnlen(pat, m);
  endpat = pat + m;
  for (p = ptail = pat; p < endpat; p += pinc) {
    switch (pat_next(p, endpat - p, &pinc, flags)) {
    case -2:
      return FNM_NOMATCH;
    case -5:
      tailcnt = 0;
      ptail = p + 1;
      break;
    default:
      tailcnt++;
      break;
    }
  }
  n = strnlen(str, n);
  endstr = str + n;
  if (n < tailcnt)
    return FNM_NOMATCH;
  for (s = endstr; s > str && tailcnt; tailcnt--) {
    if (s[-1] < 128U)
      s--;
    else
      while ((unsigned char)*--s - 0x80U < 0x40 && s > str)
        ;
  }
  if (tailcnt)
    return FNM_NOMATCH;
  stail = s;
  p = ptail;
  for (;;) {
    c = pat_next(p, endpat - p, &pinc, flags);
    p += pinc;
    if ((k = str_next(s, endstr - s, &sinc)) <= 0) {
      if (c != 0)
        return FNM_NOMATCH;
      break;
    }
    s += sinc;
    if (c == -3) {
      if (!match_bracket(p - pinc, k))
        return FNM_NOMATCH;
    } else if (c != -4 && k != c) {
      return FNM_NOMATCH;
    }
  }
  endstr = stail;
  endpat = ptail;
  while (pat < endpat) {
    p = pat;
    s = str;
    for (;;) {
      c = pat_next(p, endpat - p, &pinc, flags);
      p += pinc;
      if (c == -5) {
        pat = p;
        str = s;
        break;
      }
      k = str_next(s, endstr - s, &sinc);
      if (!k)
        return FNM_NOMATCH;
      if (c == -3) {
        if (!match_bracket(p - pinc, k))
          break;
      } else if (c != -4 && k != c) {
        break;
      }
      s += sinc;
    }
    if (c == -5)
      continue;
    k = str_next(str, endstr - str, &sinc);
    if (k > 0)
      str += sinc;
    else
      for (str++; str_next(str, endstr - str, &sinc) < 0; str++)
        ;
  }
  return 0;
}
```