user: What is the c source code of the assembly code below:

```asm
<rangematch>:
  endbr64
  push   %r15
  mov    %edx,%ecx
  mov    %edx,%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  movzbl (%rdi),%eax
  cmp    $0x21,%al
  sete   %bpl
  cmp    $0x5e,%al
  sete   %al
  or     %eax,%ebp
  cmp    $0x1,%bpl
  sbb    $0xffffffffffffffff,%rbx
  and    $0x10,%ecx
  jne    L465
  movzbl (%rbx),%eax
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%al
  je     L76
  and    $0x1,%r15d
  mov    %esi,%edi
  mov    $0x1,%esi
  jne    L115
  cmp    $0x5c,%al
  jne    L574
  nop
L253:
  movzbl 0x1(%rbx),%eax
  lea    0x2(%rbx),%r12
  mov    %r12,%rbx
  mov    %eax,%edx
  test   %al,%al
  jne    L216
  nopl   0x0(%rax)
L353:
  xor    %r12d,%r12d
L168:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L260:
  cmp    %dl,%dil
  cmove  %esi,%r15d
L70:
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%al
  je     L600
L242:
  cmp    $0x5c,%al
  je     L253
L574:
  mov    %eax,%edx
  mov    %r12,%rbx
  test   %al,%al
  je     L353
L216:
  movzbl (%rbx),%eax
  cmp    $0x2d,%al
  jne    L260
  movzbl 0x1(%rbx),%eax
  cmp    $0x5d,%al
  je     L418
  test   %al,%al
  jne    L619
L418:
  add    $0x1,%rbx
  cmp    %dl,%dil
  mov    $0x2d,%edx
  jne    L216
  mov    $0x1,%r15d
  jmp    L216
  nopl   0x0(%rax)
L16:
  cmp    %dl,%dil
  cmove  %r15d,%ecx
L3:
  add    $0x1,%r12
  cmp    $0x5d,%al
  je     L24
L115:
  mov    $0x5c,%edx
  cmp    $0x5c,%al
  je     L34
  mov    %eax,%edx
  test   %al,%al
  je     L353
L34:
  movzbl (%r12),%eax
  cmp    $0x2d,%al
  jne    L16
  movzbl 0x1(%r12),%esi
  cmp    $0x5d,%sil
  je     L582
  test   %sil,%sil
  jne    L236
L582:
  add    $0x1,%r12
  cmp    %dl,%dil
  mov    $0x2d,%edx
  jne    L34
  mov    %r15d,%ecx
  jmp    L34
  nopl   0x0(%rax,%rax,1)
L619:
  lea    0x2(%rbx),%r8
  cmp    $0x5c,%al
  je     L130
L445:
  mov    %r8,%rbx
  mov    %eax,%ecx
  movzbl (%rbx),%eax
  cmp    %dil,%dl
  ja     L70
  cmp    %dil,%cl
  lea    0x1(%rbx),%r12
  cmovae %esi,%r15d
  cmp    $0x5d,%al
  jne    L242
  nopl   0x0(%rax,%rax,1)
L600:
  movzbl %bpl,%ebp
  cmp    %r15d,%ebp
  jne    L168
  jmp    L353
  nopw   0x0(%rax,%rax,1)
L236:
  movzbl 0x2(%r12),%eax
  lea    0x2(%r12),%r8
  cmp    %dil,%dl
  ja     L120
  cmp    %dil,%sil
  jb     L120
  mov    %r8,%r12
  mov    %r15d,%ecx
  add    $0x1,%r12
  cmp    $0x5d,%al
  jne    L115
  nopw   0x0(%rax,%rax,1)
L24:
  mov    %ecx,%r15d
  movzbl %bpl,%ebp
  cmp    %r15d,%ebp
  jne    L168
  jmp    L353
  nopl   (%rax)
L465:
  movzbl %sil,%edi
  lea    0x1(%rbx),%r12
  call   <tolower@plt>
  movzbl (%rbx),%edx
  mov    %eax,%r13d
  cmp    $0x5d,%dl
  je     L76
  and    $0x1,%r15d
  mov    $0x1,%r14d
  je     L315
  xor    %ebx,%ebx
  jmp    L584
  nopl   0x0(%rax,%rax,1)
L375:
  cmp    %al,%r13b
  cmove  %r15d,%ebx
L617:
  add    $0x1,%r12
  cmp    $0x5d,%dl
  je     L535
L584:
  cmp    $0x5c,%dl
  je     L180
  test   %dl,%dl
  je     L353
L180:
  movzbl %dl,%edi
  call   <tolower@plt>
  movzbl (%r12),%edx
  mov    %eax,%r14d
  cmp    $0x2d,%dl
  jne    L375
  movzbl 0x1(%r12),%edi
  cmp    $0x5d,%dil
  je     L340
  test   %dil,%dil
  je     L340
  lea    0x2(%r12),%rax
  mov    %rax,0x8(%rsp)
  call   <tolower@plt>
  movzbl 0x2(%r12),%edx
  cmp    %r13b,%r14b
  ja     L243
  cmp    %al,%r13b
  ja     L243
  mov    0x8(%rsp),%r12
  mov    %r15d,%ebx
  jmp    L617
L124:
  cmp    %al,%r13b
  cmove  %r14d,%r15d
L384:
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%dl
  je     L600
L315:
  cmp    $0x5c,%dl
  je     L343
L599:
  mov    %r12,%rbx
  test   %dl,%dl
  je     L353
L616:
  movzbl %dl,%edi
  call   <tolower@plt>
  movzbl (%rbx),%edx
  mov    %eax,%r12d
  cmp    $0x2d,%dl
  jne    L124
  movzbl 0x1(%rbx),%edi
  cmp    $0x5d,%dil
  je     L314
  test   %dil,%dil
  je     L314
  lea    0x2(%rbx),%rax
  cmp    $0x5c,%dil
  je     L249
L615:
  mov    %rax,%rbx
  call   <tolower@plt>
  movzbl (%rbx),%edx
  cmp    %r13b,%r12b
  ja     L384
  cmp    %al,%r13b
  cmovbe %r14d,%r15d
  jmp    L384
  nopl   (%rax)
L314:
  add    $0x1,%rbx
  cmp    %r12b,%r13b
  jne    L616
  mov    $0x1,%r15d
  jmp    L616
  nopl   0x0(%rax)
L343:
  movzbl 0x1(%rbx),%edx
  lea    0x2(%rbx),%r12
  jmp    L599
  nopw   0x0(%rax,%rax,1)
L120:
  mov    %r8,%r12
  jmp    L3
L340:
  add    $0x1,%r12
  cmp    %r14b,%r13b
  jne    L180
  mov    %r15d,%ebx
  jmp    L180
L243:
  mov    0x8(%rsp),%r12
  jmp    L617
  nop
L130:
  movzbl 0x2(%rbx),%eax
  lea    0x3(%rbx),%r8
  test   %al,%al
  jne    L445
  jmp    L353
L535:
  mov    %ebx,%r15d
  jmp    L600
L249:
  movzbl 0x2(%rbx),%edi
  lea    0x3(%rbx),%rax
  test   %dil,%dil
  jne    L615
  jmp    L353
L76:
  xor    %r15d,%r15d
  jmp    L600
```

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