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

```asm
<submatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
L222:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0x5b,%eax
  je     L134
  cmp    $0x5b,%eax
  jg     L327
  cmp    $0x3f,%eax
  je     L232
  cmp    $0x3f,%eax
  jg     L327
  cmp    $0x2a,%eax
  je     L113
  cmp    $0x2a,%eax
  jg     L327
  test   %eax,%eax
  je     L78
  cmp    $0x24,%eax
  je     L70
  jmp    L327
L113:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L349
  mov    $0x1,%eax
  jmp    L208
L310:
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <match@plt>
  test   %eax,%eax
  je     L254
  mov    $0x1,%eax
  jmp    L208
L254:
  addq   $0x1,-0x18(%rbp)
L349:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L310
  mov    $0x0,%eax
  jmp    L208
L232:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L229
  mov    $0x0,%eax
  jmp    L208
L70:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  sete   %al
  movzbl %al,%eax
  jmp    L208
L78:
  mov    $0x1,%eax
  jmp    L208
L327:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%edx
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L294
  mov    $0x0,%eax
  jmp    L208
L134:
  movl   $0x0,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5e,%al
  je     L62
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x21,%al
  jne    L355
L62:
  mov    $0x1,%eax
  jmp    L165
L355:
  mov    $0x0,%eax
L165:
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L196
  addq   $0x1,-0x20(%rbp)
  jmp    L196
L216:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L92
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  ja     L30
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  ja     L30
  movl   $0x1,-0x8(%rbp)
L30:
  addq   $0x2,-0x20(%rbp)
  jmp    L196
L92:
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L196
  movl   $0x1,-0x8(%rbp)
L196:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  cmp    $0x5d,%al
  jne    L216
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jne    L102
  mov    $0x0,%eax
  jmp    L208
L102:
  addq   $0x1,-0x18(%rbp)
  jmp    L328
L229:
  nop
  jmp    L222
L294:
  nop
L328:
  jmp    L222
L208:
  leave
  ret
```

assistant: ```c
int submatch(unsigned char *name, unsigned char *pat) {
  int ok, negate_range;
  for (;;) {
    switch (*pat++) {
    case '*':
      if (!*pat)
        return (1);
      for (; *name; ++name)
        if (match(name, pat))
          return (1);
      return (0);
    case '?':
      if (!*name++)
        return (0);
      break;
    case '$':
      return (!*name);
    case 0:
      return (1);
    default:
      if (*name++ != pat[-1])
        return (0);
      break;
    case '[':
      ok = 0;
      negate_range = (*pat == '^' || *pat == '!');
      if (negate_range)
        ++pat;
      while (*pat++ != ']')
        if (*pat == '-') {
          if (pat[-1] <= *name && *name <= pat[1])
            ok = 1;
          pat += 2;
        } else if (pat[-1] == *name)
          ok = 1;
      if (ok == negate_range)
        return (0);
      ++name;
      break;
    }
  }
}
```