user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<cfstore_fnmatch>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r13
  mov    %rsi,0x8(%rsp)
  mov    %edx,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsi,%r12
  mov    %edx,%r15d
  and    $0x4,%r15d
  jmp    L540
L527:
  test   %bl,%bl
  je     L505
  cmp    $0x2a,%bl
  jne    L287
  movzbl 0x1(%r13),%eax
  cmp    $0x2a,%al
  jne    L661
L72:
  add    $0x1,%rbp
  movzbl 0x0(%rbp),%eax
  cmp    $0x2a,%al
  je     L72
  mov    %rbp,%r13
L536:
  movzbl (%r12),%ebx
  cmp    $0x2e,%bl
  je     L220
L608:
  test   %al,%al
  je     L701
  cmp    $0x2f,%al
  jne    L671
  test   $0x2,%r14b
  je     L671
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L540
  mov    $0x1,%eax
  jmp    L53
L287:
  mov    %rbp,%r13
  jmp    L442
L492:
  mov    %rbp,%r13
  jmp    L442
L505:
  test   $0x8,%r14b
  je     L264
  mov    $0x0,%eax
  cmpb   $0x2f,(%r12)
  je     L53
L264:
  cmpb   $0x0,(%r12)
  setne  %al
  movzbl %al,%eax
L53:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L39
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L92:
  movzbl (%r12),%eax
  test   %al,%al
  je     L58
  cmp    $0x2f,%al
  je     L731
  cmp    $0x2e,%al
  jne    L150
  test   %r15d,%r15d
  je     L150
  cmp    0x8(%rsp),%r12
  je     L598
  test   $0x2,%r14b
  je     L150
  cmpb   $0x2f,-0x1(%r12)
  jne    L150
  mov    $0x1,%eax
  jmp    L53
L731:
  test   $0x2,%r14b
  jne    L667
L150:
  add    $0x1,%r12
  mov    %rbp,%r13
  jmp    L540
L661:
  mov    %rbp,%r13
  jmp    L536
L220:
  test   %r15d,%r15d
  je     L608
  cmp    0x8(%rsp),%r12
  je     L504
  test   $0x2,%r14b
  je     L608
  cmpb   $0x2f,-0x1(%r12)
  jne    L608
  mov    $0x1,%eax
  jmp    L53
L701:
  mov    %r14d,%eax
  and    $0x2,%eax
  je     L53
  mov    $0x0,%eax
  test   $0x8,%r14b
  jne    L53
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  jmp    L53
L607:
  add    $0x1,%r12
  movzbl (%r12),%ebx
  test   %bl,%bl
  je     L315
L648:
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <cfstore_fnmatch>
  test   %eax,%eax
  je     L53
  cmp    $0x2f,%bl
  jne    L607
  test   $0x2,%r14b
  je     L607
  mov    $0x1,%eax
  jmp    L53
L315:
  mov    $0x1,%eax
  jmp    L53
L671:
  mov    %r14d,%ebp
  and    $0xfffffffb,%ebp
  mov    $0x1,%eax
  test   %bl,%bl
  jne    L648
  jmp    L53
L466:
  movzbl (%r12),%esi
  test   %sil,%sil
  je     L282
  cmp    $0x2f,%sil
  je     L412
  cmp    $0x2e,%sil
  jne    L562
  test   %r15d,%r15d
  je     L562
  cmp    0x8(%rsp),%r12
  je     L534
  test   $0x2,%r14b
  je     L562
  cmpb   $0x2f,-0x1(%r12)
  jne    L562
  mov    $0x1,%eax
  jmp    L53
L412:
  test   $0x2,%r14b
  jne    L242
L562:
  lea    0x10(%rsp),%rcx
  movsbl %sil,%esi
  mov    %r14d,%edx
  mov    %rbp,%rdi
  call   <rangematch@plt>
  test   %eax,%eax
  je     L507
  cmp    $0x1,%eax
  je     L201
  cmp    $0xffffffff,%eax
  je     L748
L597:
  add    $0x1,%r12
  mov    %rbp,%r13
  jmp    L540
L201:
  mov    0x10(%rsp),%rbp
  jmp    L597
L748:
  mov    %rbp,%r13
  jmp    L442
L506:
  mov    %rbp,%r13
L442:
  cmp    %bl,(%r12)
  je     L33
  test   $0x10,%r14b
  je     L391
  movzbl %bl,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
  movzbl (%r12),%edi
  call   <tolower@plt>
  cmp    %eax,%ebx
  jne    L473
L33:
  add    $0x1,%r12
L540:
  lea    0x1(%r13),%rbp
  movzbl 0x0(%r13),%ebx
  cmp    $0x3f,%bl
  je     L92
  jle    L527
  cmp    $0x5b,%bl
  je     L466
  cmp    $0x5c,%bl
  jne    L492
  test   $0x1,%r14b
  jne    L506
  movzbl 0x1(%r13),%eax
  test   %al,%al
  je     L453
  add    $0x2,%r13
  mov    %eax,%ebx
  jmp    L442
L453:
  mov    %rbp,%r13
  jmp    L442
L58:
  mov    $0x1,%eax
  jmp    L53
L667:
  mov    $0x1,%eax
  jmp    L53
L598:
  mov    $0x1,%eax
  jmp    L53
L504:
  mov    $0x1,%eax
  jmp    L53
L282:
  mov    $0x1,%eax
  jmp    L53
L242:
  mov    $0x1,%eax
  jmp    L53
L534:
  mov    $0x1,%eax
  jmp    L53
L507:
  mov    $0x1,%eax
  jmp    L53
L391:
  mov    $0x1,%eax
  jmp    L53
L473:
  mov    $0x1,%eax
  jmp    L53
L39:
  call   <__stack_chk_fail@plt>
```

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;
    }
}
```