user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<rangematch>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  mov    %edx,%edi
  mov    %edx,0x8(%rsp)
  mov    %esi,%r14d
  movzbl (%r12),%eax
  cmp    $0x21,%al
  sete   %dl
  cmp    $0x5e,%al
  sete   %al
  mov    %edx,%ecx
  or     %eax,%ecx
  mov    %cl,0xf(%rsp)
  cmp    $0x1,%cl
  sbb    $0xffffffffffffffff,%r12
  and    $0x10,%edi
  mov    %edi,%r15d
  jne    L219
L60:
  lea    0x1(%r12),%rbp
  movzbl (%r12),%ebx
  cmp    $0x5d,%bl
  je     L124
  mov    $0x0,%r13d
  mov    0x8(%rsp),%eax
  and    $0x1,%eax
  mov    %eax,0x8(%rsp)
  jmp    L90
L219:
  movzbl %sil,%edi
  call   <tolower@plt>
  mov    %eax,%r14d
  jmp    L60
L181:
  cmpl   $0x0,0x8(%rsp)
  jne    L42
  lea    0x2(%r12),%rbp
  movzbl 0x1(%r12),%ebx
  jmp    L65
L77:
  movzbl %bl,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
  jmp    L265
L250:
  lea    0x2(%rbp),%rdx
  cmp    $0x5c,%al
  je     L135
L105:
  mov    %rdx,%rbp
L128:
  test   %r15d,%r15d
  jne    L63
L54:
  cmp    %r14b,%bl
  ja     L156
  cmp    %al,%r14b
  mov    $0x1,%eax
  cmovbe %eax,%r13d
  jmp    L156
L135:
  cmpl   $0x0,0x8(%rsp)
  jne    L105
  lea    0x3(%rbp),%rdx
  movzbl 0x2(%rbp),%eax
  test   %al,%al
  je     L34
  mov    %rdx,%rbp
  jmp    L128
L63:
  movzbl %al,%edi
  call   <tolower@plt>
  jmp    L54
L50:
  cmp    %bl,%r14b
  mov    $0x1,%eax
  cmove  %eax,%r13d
L156:
  lea    0x1(%rbp),%rax
  movzbl 0x0(%rbp),%ebx
  cmp    $0x5d,%bl
  je     L145
L137:
  mov    %rbp,%r12
  mov    %rax,%rbp
L90:
  cmp    $0x5c,%bl
  je     L181
L65:
  test   %bl,%bl
  je     L162
L42:
  test   %r15d,%r15d
  jne    L77
L265:
  movzbl 0x0(%rbp),%edx
  cmp    $0x2d,%dl
  jne    L50
  movzbl 0x1(%rbp),%eax
  cmp    $0x5d,%al
  je     L249
  test   %al,%al
  jne    L250
L249:
  cmp    %bl,%r14b
  je     L252
  lea    0x1(%rbp),%rax
  movzbl 0x0(%rbp),%ebx
  jmp    L137
L124:
  mov    %rbp,%rax
  mov    $0x0,%r13d
L145:
  movzbl 0xf(%rsp),%edx
  cmp    %r13d,%edx
  mov    $0x0,%edx
  cmove  %rdx,%rax
L176:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L162:
  mov    $0x0,%eax
  jmp    L176
L34:
  mov    $0x0,%eax
  jmp    L176
L252:
  lea    0x1(%rbp),%rax
  mov    %edx,%ebx
  mov    $0x1,%r13d
  jmp    L137
```

assistant: ```c
const char *rangematch(const char *pattern, char test, int flags) {
  int negate, ok;
  char c, c2;
  if ((negate = (*pattern == '!' || *pattern == '^')))
    ++pattern;
  if (flags & 0x10)
    test = tolower((unsigned char)test);
  for (ok = 0; (c = *pattern++) != ']';) {
    if (c == '\\' && !(flags & 0x01))
      c = *pattern++;
    if (c == '\0')
      return (NULL);
    if (flags & 0x10)
      c = tolower((unsigned char)c);
    if (*pattern == '-' && (c2 = *(pattern + 1)) != '\0' && c2 != ']') {
      pattern += 2;
      if (c2 == '\\' && !(flags & 0x01))
        c2 = *pattern++;
      if (c2 == '\0')
        return (NULL);
      if (flags & 0x10)
        c2 = tolower((unsigned char)c2);
      if ((unsigned char)c <= (unsigned char)test && (unsigned char)test <= (unsigned char)c2)
        ok = 1;
    } else if (c == test)
      ok = 1;
  }
  return (ok == negate ? NULL : pattern);
}
```