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

```asm
<advance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  mov    %rax,%rbx
  mov    -0x28(%rbp),%eax
  cltq
  mov    %rax,%r12
L41:
  mov    %r12,%rax
  lea    0x1(%rax),%r12
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0xb,%eax
  ja     L120
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D24(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D24(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    %r12,%rax
  lea    0x1(%rax),%r12
  movzbl (%rax),%edx
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L241
  mov    $0x0,%eax
  jmp    L185
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  test   %al,%al
  jne    L93
  mov    $0x0,%eax
  jmp    L185
  movzbl (%rbx),%eax
  test   %al,%al
  je     L200
  mov    $0x0,%eax
  jmp    L185
  mov    $0x1,%eax
  jmp    L185
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    $0x1,%edx
  mov    %eax,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <cclass@plt>
  test   %eax,%eax
  je     L267
  movzbl (%r12),%eax
  movsbq %al,%rax
  mov    %rax,%r12
  jmp    L211
L267:
  mov    $0x0,%eax
  jmp    L185
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    $0x0,%edx
  mov    %eax,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <cclass@plt>
  test   %eax,%eax
  je     L187
  movzbl (%r12),%eax
  movsbq %al,%rax
  mov    %rax,%r12
  jmp    L211
L187:
  mov    $0x0,%eax
  jmp    L185
  mov    %rbx,%r13
  nop
L238:
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  test   %al,%al
  jne    L238
  jmp    L76
  mov    %rbx,%r13
  nop
L52:
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%edx
  movzbl (%r12),%eax
  cmp    %al,%dl
  je     L52
  add    $0x1,%r12
  jmp    L76
  mov    %rbx,%r13
  nop
L134:
  lea    -0x1(%r12),%rax
  movzbl (%rax),%eax
  cmp    $0x7,%al
  sete   %al
  movzbl %al,%edx
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <cclass@plt>
  test   %eax,%eax
  jne    L134
  movzbl (%r12),%eax
  movsbq %al,%rax
  mov    %rax,%r12
  nop
L76:
  sub    $0x1,%rbx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <advance>
  test   %eax,%eax
  je     L217
  mov    $0x1,%eax
  jmp    L185
L217:
  cmp    %r13,%rbx
  ja     L76
  mov    $0x0,%eax
  jmp    L185
L120:
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf2@plt>
  jmp    L41
L241:
  nop
  jmp    L41
L93:
  nop
  jmp    L41
L200:
  nop
L211:
  jmp    L41
L185:
  add    $0x18,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D21
type_guessed: string

tool: D21: RE botch


assistant: ```c
advance(alp, aep) {
  register char *lp, *ep, *curlp;
  char *nextep;
  lp = alp;
  ep = aep;
  for (;;)
    switch (*ep++) {
    case 2:
      if (*ep++ == *lp++)
        continue;
      return (0);
    case 4:
      if (*lp++)
        continue;
      return (0);
    case 10:
      if (*lp == 0)
        continue;
      return (0);
    case 11:
      return (1);
    case 6:
      if (cclass(ep, *lp++, 1)) {
        ep = +*ep;
        continue;
      }
      return (0);
    case 8:
      if (cclass(ep, *lp++, 0)) {
        ep = +*ep;
        continue;
      }
      return (0);
    case 4 | 01:
      curlp = lp;
      while (*lp++)
        ;
      goto star;
    case 2 | 01:
      curlp = lp;
      while (*lp++ == *ep)
        ;
      ep++;
      goto star;
    case 6 | 01:
    case 8 | 01:
      curlp = lp;
      while (cclass(ep, *lp++, ep[-1] == (6 | 01)))
        ;
      ep = +*ep;
      goto star;
    star:
      do {
        lp--;
        if (advance(lp, ep))
          return (1);
      } while (lp > curlp);
      return (0);
    default:
      printf2("RE botch\n");
    }
}
```