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

```asm
<cfstore_fnmatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L606:
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x2a(%rbp)
  movsbl -0x2a(%rbp),%eax
  cmp    $0x5c,%eax
  je     L325
  cmp    $0x5c,%eax
  jg     L629
  cmp    $0x5b,%eax
  je     L336
  cmp    $0x5b,%eax
  jg     L629
  cmp    $0x3f,%eax
  je     L548
  cmp    $0x3f,%eax
  jg     L629
  test   %eax,%eax
  je     L620
  cmp    $0x2a,%eax
  je     L1
  jmp    L629
L620:
  mov    -0x44(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L172
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L172
  mov    $0x0,%eax
  jmp    L726
L172:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  setne  %al
  movzbl %al,%eax
  jmp    L726
L548:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L408
  mov    $0x1,%eax
  jmp    L726
L408:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L475
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L475
  mov    $0x1,%eax
  jmp    L726
L475:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L751
  mov    -0x44(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L751
  mov    -0x40(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  je     L27
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L751
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L751
L27:
  mov    $0x1,%eax
  jmp    L726
L751:
  addq   $0x1,-0x40(%rbp)
  jmp    L152
L1:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x2a(%rbp)
  jmp    L80
L800:
  addq   $0x1,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x2a(%rbp)
L80:
  cmpb   $0x2a,-0x2a(%rbp)
  je     L800
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L662
  mov    -0x44(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L662
  mov    -0x40(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  je     L559
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L662
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L662
L559:
  mov    $0x1,%eax
  jmp    L726
L662:
  cmpb   $0x0,-0x2a(%rbp)
  jne    L74
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L53
  mov    -0x44(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  jne    L425
  mov    -0x40(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L425
  mov    $0x1,%eax
  jmp    L726
L425:
  mov    $0x0,%eax
  jmp    L726
L53:
  mov    $0x0,%eax
  jmp    L726
L74:
  cmpb   $0x2f,-0x2a(%rbp)
  jne    L727
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L727
  mov    -0x40(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x40(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  jne    L126
  mov    $0x1,%eax
  jmp    L726
L270:
  mov    -0x44(%rbp),%eax
  and    $0xfffffffb,%eax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <cfstore_fnmatch>
  test   %eax,%eax
  jne    L79
  mov    $0x0,%eax
  jmp    L726
L79:
  cmpb   $0x2f,-0x29(%rbp)
  jne    L666
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  jne    L699
L666:
  addq   $0x1,-0x40(%rbp)
L727:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x29(%rbp)
  cmpb   $0x0,-0x29(%rbp)
  jne    L270
  jmp    L150
L699:
  nop
L150:
  mov    $0x1,%eax
  jmp    L726
L336:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L403
  mov    $0x1,%eax
  jmp    L726
L403:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L159
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L159
  mov    $0x1,%eax
  jmp    L726
L159:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L565
  mov    -0x44(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L565
  mov    -0x40(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  je     L101
  mov    -0x44(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L565
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L565
L101:
  mov    $0x1,%eax
  jmp    L726
L565:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%esi
  lea    -0x28(%rbp),%rcx
  mov    -0x44(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <rangematch@plt>
  cmp    $0x1,%eax
  je     L677
  cmp    $0x1,%eax
  jg     L622
  cmp    $0xffffffff,%eax
  je     L681
  test   %eax,%eax
  je     L117
  jmp    L622
L677:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L622
L117:
  mov    $0x1,%eax
  jmp    L726
L622:
  addq   $0x1,-0x40(%rbp)
  jmp    L152
L325:
  mov    -0x44(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L784
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x2a(%rbp)
  cmpb   $0x0,-0x2a(%rbp)
  jne    L784
  movb   $0x5c,-0x2a(%rbp)
  subq   $0x1,-0x38(%rbp)
  jmp    L629
L681:
  nop
  jmp    L629
L784:
  nop
L629:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x2a(%rbp)
  je     L576
  mov    -0x44(%rbp),%eax
  and    $0x10,%eax
  test   %eax,%eax
  je     L481
  movzbl -0x2a(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <tolower@plt>
  cmp    %eax,%ebx
  je     L576
L481:
  mov    $0x1,%eax
  jmp    L726
L576:
  addq   $0x1,-0x40(%rbp)
  jmp    L152
L126:
  nop
L152:
  jmp    L606
L726:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L239
  call   <__stack_chk_fail@plt>
L239:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int cfstore_fnmatch(const char *pattern, const char *string, int flags) {
  const char *stringstart;
  char *newp;
  char c, test;
  for (stringstart = string;;)
    switch (c = *pattern++) {
    case '\0':
      if ((flags & 0x08) && *string == '/')
        return (0);
      return (*string == '\0' ? 0 : 1);
    case '?':
      if (*string == '\0')
        return (1);
      if (*string == '/' && (flags & 0x02))
        return (1);
      if (*string == '.' && (flags & 0x04) && (string == stringstart || ((flags & 0x02) && *(string - 1) == '/')))
        return (1);
      ++string;
      break;
    case '*':
      c = *pattern;
      while (c == '*')
        c = *++pattern;
      if (*string == '.' && (flags & 0x04) && (string == stringstart || ((flags & 0x02) && *(string - 1) == '/')))
        return (1);
      if (c == '\0')
        if (flags & 0x02)
          return ((flags & 0x08) || strchr(string, '/') == NULL ? 0 : 1);
        else
          return (0);
      else if (c == '/' && flags & 0x02) {
        if ((string = strchr(string, '/')) == NULL)
          return (1);
        break;
      }
      while ((test = *string) != '\0') {
        if (!cfstore_fnmatch(pattern, string, flags & ~0x04))
          return (0);
        if (test == '/' && flags & 0x02)
          break;
        ++string;
      }
      return (1);
    case '[':
      if (*string == '\0')
        return (1);
      if (*string == '/' && (flags & 0x02))
        return (1);
      if (*string == '.' && (flags & 0x04) && (string == stringstart || ((flags & 0x02) && *(string - 1) == '/')))
        return (1);
      switch (rangematch(pattern, *string, flags, &newp)) {
      case (-1):
        goto norm;
      case 1:
        pattern = newp;
        break;
      case 0:
        return (1);
      }
      ++string;
      break;
    case '\\':
      if (!(flags & 0x01)) {
        if ((c = *pattern++) == '\0') {
          c = '\\';
          --pattern;
        }
      }
    default:
    norm:
      if (c == *string)
        ;
      else if ((flags & 0x10) && (tolower((unsigned char)c) == tolower((unsigned char)*string)))
        ;
      else
        return (1);
      string++;
      break;
    }
}
```