user: Converte this assembly snippet into its equivalent C code:

```asm
<fnmatch>:
  endbr64
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
L239:
  movzbl (%rbx),%eax
  movzbl 0x0(%rbp),%r12d
  lea    0x1(%rbx),%rdi
  cmp    $0x3f,%al
  je     L277
L363:
  jg     L320
  test   %al,%al
  je     L411
  cmp    $0x2a,%al
  jne    L334
  movzbl 0x1(%rbx),%eax
  mov    %rdi,%rbx
  cmp    $0x2a,%al
  jne    L341
  nopl   0x0(%rax,%rax,1)
L195:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  cmp    $0x2a,%al
  je     L195
L341:
  cmp    $0x2e,%r12b
  je     L103
L127:
  test   %al,%al
  je     L301
  cmp    $0x2f,%al
  jne    L28
  mov    D45(%rip),%rax
  mov    %r14d,%ecx
  and    (%rax),%ecx
  je     L28
  mov    %rbp,%rdi
  mov    $0x2f,%esi
  call   <index@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L239
L63:
  mov    D77(%rip),%rax
  mov    (%rax),%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L320:
  cmp    $0x5b,%al
  je     L135
  cmp    $0x5c,%al
  jne    L334
  mov    D82(%rip),%rdx
  mov    %r14d,%ecx
  and    (%rdx),%ecx
  jne    L334
  movzbl 0x1(%rbx),%edx
  test   %dl,%dl
  je     L334
  add    $0x2,%rbx
  mov    %edx,%eax
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L334:
  mov    %rdi,%rbx
L48:
  add    $0x1,%rbp
  cmp    %r12b,%al
  jne    L63
  movzbl (%rbx),%eax
  movzbl 0x0(%rbp),%r12d
  lea    0x1(%rbx),%rdi
  cmp    $0x3f,%al
  jne    L363
L277:
  test   %r12b,%r12b
  je     L63
  cmp    $0x2f,%r12b
  je     L461
  cmp    $0x2e,%r12b
  jne    L359
  mov    D57(%rip),%r15
  mov    %r14d,%eax
  and    (%r15),%eax
  je     L359
  cmp    %r13,%rbp
  je     L63
  mov    D45(%rip),%rax
  mov    %r14d,%esi
  and    (%rax),%esi
  je     L359
  cmpb   $0x2f,-0x1(%rbp)
  je     L63
  nopl   (%rax)
L359:
  add    $0x1,%rbp
  mov    %rdi,%rbx
  jmp    L239
  nopl   0x0(%rax)
L135:
  test   %r12b,%r12b
  je     L63
  cmp    $0x2f,%r12b
  jne    L179
  mov    D45(%rip),%rax
  mov    %r14d,%ecx
  and    (%rax),%ecx
  jne    L63
L179:
  movsbl %r12b,%esi
  mov    %r14d,%edx
  call   <rangematch@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L63
  add    $0x1,%rbp
  jmp    L239
  nopw   0x0(%rax,%rax,1)
L411:
  test   %r12b,%r12b
  jne    L63
L78:
  xor    %eax,%eax
L365:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L103:
  mov    D57(%rip),%r15
  mov    %r14d,%edx
  and    (%r15),%edx
  je     L127
  cmp    %r13,%rbp
  je     L63
  mov    D45(%rip),%rdx
  mov    %r14d,%esi
  and    (%rdx),%esi
  je     L127
  cmpb   $0x2f,-0x1(%rbp)
  jne    L127
  jmp    L63
  nopl   (%rax)
L461:
  mov    D45(%rip),%rax
  mov    %r14d,%ecx
  and    (%rax),%ecx
  jne    L63
  add    $0x1,%rbp
  mov    %rdi,%rbx
  jmp    L239
L28:
  test   %r12b,%r12b
  je     L63
  mov    D57(%rip),%r15
  jmp    L391
  nopl   0x0(%rax,%rax,1)
L422:
  movzbl 0x1(%rbp),%r12d
  add    $0x1,%rbp
  test   %r12b,%r12b
  je     L63
L391:
  mov    (%r15),%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  not    %edx
  and    %r14d,%edx
  call   <fnmatch>
  test   %eax,%eax
  je     L78
  cmp    $0x2f,%r12b
  jne    L422
  mov    D45(%rip),%rax
  mov    %r14d,%ecx
  and    (%rax),%ecx
  je     L422
  jmp    L63
L301:
  mov    D45(%rip),%rax
  and    (%rax),%r14d
  je     L78
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  call   <index@plt>
  test   %rax,%rax
  jne    L63
  xor    %eax,%eax
  jmp    L365
```

assistant: ```c
int fnmatch(const char *pattern, const char *string, int flags) {
  const char *stringstart = string;
  char c;
  char test;
  for (;;) {
    switch (c = *pattern++) {
    case '\0':
      return (*string == '\0' ? 0 : FNM_NOMATCH);
    case '?':
      if (*string == '\0') {
        return (FNM_NOMATCH);
      }
      if (*string == '/' && (flags & FNM_PATHNAME)) {
        return (FNM_NOMATCH);
      }
      if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) {
        return (FNM_NOMATCH);
      }
      ++string;
      break;
    case '*':
      c = *pattern;
      while (c == '*') {
        c = *++pattern;
      }
      if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) {
        return (FNM_NOMATCH);
      }
      if (c == '\0') {
        if (flags & FNM_PATHNAME) {
          return (index(string, '/') == NULL ? 0 : FNM_NOMATCH);
        } else {
          return (0);
        }
      } else if (c == '/' && flags & FNM_PATHNAME) {
        if ((string = index(string, '/')) == NULL) {
          return (FNM_NOMATCH);
        }
        break;
      }
      while ((test = *string) != '\0') {
        if (!fnmatch(pattern, string, flags & ~FNM_PERIOD)) {
          return (0);
        }
        if (test == '/' && flags & FNM_PATHNAME) {
          break;
        }
        ++string;
      }
      return (FNM_NOMATCH);
    case '[':
      if (*string == '\0') {
        return (FNM_NOMATCH);
      }
      if (*string == '/' && flags & FNM_PATHNAME) {
        return (FNM_NOMATCH);
      }
      if ((pattern = rangematch(pattern, *string, flags)) == NULL) {
        return (FNM_NOMATCH);
      }
      ++string;
      break;
    case '\\':
      if (!(flags & FNM_NOESCAPE)) {
        if ((c = *pattern++) == '\0') {
          c = '\\';
          --pattern;
        }
      }
    default:
      if (c != *string++) {
        return (FNM_NOMATCH);
      }
      break;
    }
  }
}
```