user: What would the C source look like for the assembly code provided here:

```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    L376
  movzbl (%rbx),%eax
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%al
  je     L44
  and    $0x1,%r15d
  mov    %esi,%edi
  mov    $0x1,%esi
  jne    L386
  cmp    $0x5c,%al
  jne    L423
  nop
L555:
  movzbl 0x1(%rbx),%eax
  lea    0x2(%rbx),%r12
  mov    %r12,%rbx
  mov    %eax,%edx
  test   %al,%al
  jne    L611
  nopl   0x0(%rax)
L426:
  xor    %r12d,%r12d
L352:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L537:
  cmp    %dl,%dil
  cmove  %esi,%r15d
L368:
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%al
  je     L223
L216:
  cmp    $0x5c,%al
  je     L555
L423:
  mov    %eax,%edx
  mov    %r12,%rbx
  test   %al,%al
  je     L426
L611:
  movzbl (%rbx),%eax
  cmp    $0x2d,%al
  jne    L537
  movzbl 0x1(%rbx),%eax
  cmp    $0x5d,%al
  je     L266
  test   %al,%al
  jne    L490
L266:
  add    $0x1,%rbx
  cmp    %dl,%dil
  mov    $0x2d,%edx
  jne    L611
  mov    $0x1,%r15d
  jmp    L611
  nopl   0x0(%rax)
L127:
  cmp    %dl,%dil
  cmove  %r15d,%ecx
L597:
  add    $0x1,%r12
  cmp    $0x5d,%al
  je     L441
L386:
  mov    $0x5c,%edx
  cmp    $0x5c,%al
  je     L27
  mov    %eax,%edx
  test   %al,%al
  je     L426
L27:
  movzbl (%r12),%eax
  cmp    $0x2d,%al
  jne    L127
  movzbl 0x1(%r12),%esi
  cmp    $0x5d,%sil
  je     L215
  test   %sil,%sil
  jne    L100
L215:
  add    $0x1,%r12
  cmp    %dl,%dil
  mov    $0x2d,%edx
  jne    L27
  mov    %r15d,%ecx
  jmp    L27
  nopl   0x0(%rax,%rax,1)
L490:
  lea    0x2(%rbx),%r8
  cmp    $0x5c,%al
  je     L370
L159:
  mov    %r8,%rbx
  mov    %eax,%ecx
  movzbl (%rbx),%eax
  cmp    %dil,%dl
  ja     L368
  cmp    %dil,%cl
  lea    0x1(%rbx),%r12
  cmovae %esi,%r15d
  cmp    $0x5d,%al
  jne    L216
  nopl   0x0(%rax,%rax,1)
L223:
  movzbl %bpl,%ebp
  cmp    %r15d,%ebp
  jne    L352
  jmp    L426
  nopw   0x0(%rax,%rax,1)
L100:
  movzbl 0x2(%r12),%eax
  lea    0x2(%r12),%r8
  cmp    %dil,%dl
  ja     L375
  cmp    %dil,%sil
  jb     L375
  mov    %r8,%r12
  mov    %r15d,%ecx
  add    $0x1,%r12
  cmp    $0x5d,%al
  jne    L386
  nopw   0x0(%rax,%rax,1)
L441:
  mov    %ecx,%r15d
  movzbl %bpl,%ebp
  cmp    %r15d,%ebp
  jne    L352
  jmp    L426
  nopl   (%rax)
L376:
  movzbl %sil,%edi
  lea    0x1(%rbx),%r12
  call   <tolower@plt>
  movzbl (%rbx),%edx
  mov    %eax,%r13d
  cmp    $0x5d,%dl
  je     L44
  and    $0x1,%r15d
  mov    $0x1,%r14d
  je     L1
  xor    %ebx,%ebx
  jmp    L19
  nopl   0x0(%rax,%rax,1)
L377:
  cmp    %al,%r13b
  cmove  %r15d,%ebx
L240:
  add    $0x1,%r12
  cmp    $0x5d,%dl
  je     L173
L19:
  cmp    $0x5c,%dl
  je     L32
  test   %dl,%dl
  je     L426
L32:
  movzbl %dl,%edi
  call   <tolower@plt>
  movzbl (%r12),%edx
  mov    %eax,%r14d
  cmp    $0x2d,%dl
  jne    L377
  movzbl 0x1(%r12),%edi
  cmp    $0x5d,%dil
  je     L262
  test   %dil,%dil
  je     L262
  lea    0x2(%r12),%rax
  mov    %rax,0x8(%rsp)
  call   <tolower@plt>
  movzbl 0x2(%r12),%edx
  cmp    %r13b,%r14b
  ja     L644
  cmp    %al,%r13b
  ja     L644
  mov    0x8(%rsp),%r12
  mov    %r15d,%ebx
  jmp    L240
L533:
  cmp    %al,%r13b
  cmove  %r14d,%r15d
L140:
  lea    0x1(%rbx),%r12
  cmp    $0x5d,%dl
  je     L223
L1:
  cmp    $0x5c,%dl
  je     L439
L493:
  mov    %r12,%rbx
  test   %dl,%dl
  je     L426
L450:
  movzbl %dl,%edi
  call   <tolower@plt>
  movzbl (%rbx),%edx
  mov    %eax,%r12d
  cmp    $0x2d,%dl
  jne    L533
  movzbl 0x1(%rbx),%edi
  cmp    $0x5d,%dil
  je     L624
  test   %dil,%dil
  je     L624
  lea    0x2(%rbx),%rax
  cmp    $0x5c,%dil
  je     L79
L539:
  mov    %rax,%rbx
  call   <tolower@plt>
  movzbl (%rbx),%edx
  cmp    %r13b,%r12b
  ja     L140
  cmp    %al,%r13b
  cmovbe %r14d,%r15d
  jmp    L140
  nopl   (%rax)
L624:
  add    $0x1,%rbx
  cmp    %r12b,%r13b
  jne    L450
  mov    $0x1,%r15d
  jmp    L450
  nopl   0x0(%rax)
L439:
  movzbl 0x1(%rbx),%edx
  lea    0x2(%rbx),%r12
  jmp    L493
  nopw   0x0(%rax,%rax,1)
L375:
  mov    %r8,%r12
  jmp    L597
L262:
  add    $0x1,%r12
  cmp    %r14b,%r13b
  jne    L32
  mov    %r15d,%ebx
  jmp    L32
L644:
  mov    0x8(%rsp),%r12
  jmp    L240
  nop
L370:
  movzbl 0x2(%rbx),%eax
  lea    0x3(%rbx),%r8
  test   %al,%al
  jne    L159
  jmp    L426
L173:
  mov    %ebx,%r15d
  jmp    L223
L79:
  movzbl 0x2(%rbx),%edi
  lea    0x3(%rbx),%rax
  test   %dil,%dil
  jne    L539
  jmp    L426
L44:
  xor    %r15d,%r15d
  jmp    L223
```

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