user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<nseel_simple_tokenizer>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r14
  mov    %rsi,%rbp
  mov    %rdx,%r15
  mov    %rcx,%r13
  mov    (%rdi),%rbx
  test   %rcx,%rcx
  je     L87
  mov    (%rcx),%eax
  cmp    $0x1,%eax
  je     L612
  cmp    $0x27,%eax
  je     L236
  cmp    $0x22,%eax
  je     L236
  cmp    %rsi,%rbx
  jae    L117
L358:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L550
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  jne    L358
L117:
  mov    $0x0,%eax
  mov    $0x0,%r12d
  jmp    L135
L236:
  mov    %eax,%ecx
  mov    %rbx,%r12
  cmp    %rbp,%rbx
  jb     L373
  mov    %rbx,%rbp
  mov    $0x0,%eax
  mov    $0x0,%r12d
  jmp    L135
L550:
  mov    %rbx,%r12
L61:
  cmp    %rbp,%r12
  jae    L117
  movzbl (%r12),%edi
  cmp    $0x24,%dil
  je     L396
  test   %r13,%r13
  setne  0xf(%rsp)
  movzbl 0xf(%rsp),%esi
  cmp    $0x2f,%dil
  sete   %al
  and    %sil,%al
  jne    L531
L148:
  movsbl %dil,%edi
  call   <isalnum@plt>
  test   %rax,%rax
  jne    L506
  movzbl (%r12),%ecx
  lea    -0x23(%rcx),%eax
  cmp    $0x1,%al
  jbe    L506
  cmp    $0x5f,%cl
  jne    L293
L506:
  mov    %r12,%rbx
  cmpb   $0x24,(%r12)
  je     L496
L82:
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  ja     L209
  mov    %rbx,%rbp
  jmp    L481
L87:
  mov    %rbx,%rdi
  call   <nseel_skip_space_and_comments@plt>
  mov    %rax,%r12
  jmp    L61
L396:
  lea    0x3(%r12),%rax
  cmp    %rax,%rbp
  jbe    L338
  cmpb   $0x27,0x1(%r12)
  je     L620
L338:
  test   %r13,%r13
  setne  0xf(%rsp)
  jmp    L148
L620:
  cmpb   $0x27,0x3(%r12)
  jne    L338
  lea    0x4(%r12),%rbp
  jmp    L481
L531:
  lea    -0x1(%rbp),%rdx
  cmp    %rdx,%r12
  jae    L202
  movzbl 0x1(%r12),%edx
  cmp    $0x2f,%dl
  je     L270
  mov    %al,0xf(%rsp)
  cmp    $0x2a,%dl
  jne    L148
L270:
  cmp    $0x2f,%dl
  je     L90
  movl   $0x1,0x0(%r13)
  lea    0x2(%r12),%rbx
  cmp    %rbx,%rbp
  ja     L483
  mov    %rbx,%rbp
  jmp    L481
L90:
  mov    %r12,%rax
L407:
  add    $0x1,%rax
  cmp    %rax,%rbp
  je     L481
  movzbl (%rax),%edx
  cmp    $0xa,%dl
  je     L618
  cmp    $0xd,%dl
  jne    L407
L618:
  mov    %rax,%rbp
  jmp    L481
L575:
  cmp    %rbx,%rbp
  jbe    L372
L483:
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmpb   $0x2a,-0x1(%rbx)
  jne    L575
  cmp    %rbx,%rbp
  jbe    L575
  cmpb   $0x2f,(%rbx)
  jne    L483
  lea    0x2(%rax),%rbp
  test   %r13,%r13
  je     L481
  movl   $0x0,0x0(%r13)
  jmp    L481
L372:
  mov    %rbx,%rbp
  jmp    L481
L202:
  mov    %al,0xf(%rsp)
  jmp    L148
L496:
  lea    -0x1(%rbp),%rax
  cmp    %rax,%r12
  jae    L82
  cmpb   $0x7e,0x1(%r12)
  sete   %bl
  movzbl %bl,%ebx
  add    %r12,%rbx
  jmp    L82
L60:
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  je     L481
L209:
  movsbl (%rbx),%edi
  call   <isalnum@plt>
  test   %rax,%rax
  jne    L60
  movzbl (%rbx),%eax
  cmp    $0x2e,%al
  je     L60
  cmp    $0x5f,%al
  je     L60
  mov    %rbx,%rbp
  jmp    L481
L293:
  cmp    $0x27,%cl
  je     L282
  cmp    $0x22,%cl
  je     L282
  lea    0x1(%r12),%rbp
  jmp    L481
L282:
  lea    0x1(%r12),%rbx
  cmpb   $0x0,0xf(%rsp)
  je     L152
  movsbl %cl,%eax
  mov    %eax,0x0(%r13)
L152:
  cmp    %rbx,%rbp
  ja     L373
  mov    %rbx,%rbp
  jmp    L481
L554:
  cmp    %cl,%dl
  je     L306
  mov    %rax,%rbx
L136:
  cmp    %rbx,%rbp
  jbe    L507
L373:
  lea    0x1(%rbx),%rax
  movzbl (%rbx),%edx
  cmp    %rax,%rbp
  jbe    L554
  add    $0x2,%rbx
  cmp    $0x5c,%dl
  je     L136
  jmp    L554
L306:
  mov    %rax,%rbp
  test   %r13,%r13
  je     L481
  movl   $0x0,0x0(%r13)
  jmp    L481
L507:
  mov    %rbx,%rbp
L481:
  mov    %ebp,%eax
  sub    %r12d,%eax
  cmp    %r12,%rbp
  mov    $0x0,%edx
  cmovbe %rdx,%r12
L135:
  mov    %rbp,(%r14)
  mov    %eax,(%r15)
  mov    %r12,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L612:
  mov    %rbx,%r12
  cmp    %rsi,%rbx
  jb     L483
  mov    %rbx,%rbp
  mov    $0x0,%eax
  mov    $0x0,%r12d
  jmp    L135
```

assistant: ```c
const char *nseel_simple_tokenizer(const char **ptr, const char *endptr, int32_t *lenOut, int32_t *state) {
  const char *p = *ptr;
  const char *rv = p;
  char delim;
  if (state) {
    if (*state == 1)
      goto in_comment;
    if (*state == '\'' || *state == '\"') {
      delim = (char)*state;
      goto in_string;
    }
    while (p < endptr && isspace(p[0]))
      p++;
  } else {
    p = nseel_skip_space_and_comments(p, endptr);
  }
  if (p >= endptr) {
    *ptr = endptr;
    *lenOut = 0;
    return NULL;
  }
  rv = p;
  if (*p == '$' && p + 3 < endptr && p[1] == '\'' && p[3] == '\'') {
    p += 4;
  } else if (state && *p == '/' && p < endptr - 1 && (p[1] == '/' || p[1] == '*')) {
    if (p[1] == '/') {
      while (p < endptr && *p != '\r' && *p != '\n')
        p++;
    } else {
      if (state)
        *state = 1;
      p += 2;
    in_comment:
      while (p < endptr) {
        const char c = *p++;
        if (c == '*' && p < endptr && *p == '/') {
          p++;
          if (state)
            *state = 0;
          break;
        }
      }
    }
  } else if (isalnum(*p) || *p == '_' || *p == '#' || *p == '$') {
    if (*p == '$' && p < endptr - 1 && p[1] == '~')
      p++;
    p++;
    while (p < endptr && (isalnum(*p) || *p == '_' || *p == '.'))
      p++;
  } else if (*p == '\'' || *p == '\"') {
    delim = *p++;
    if (state)
      *state = delim;
  in_string:
    while (p < endptr) {
      const char c = *p++;
      if (p < endptr && c == '\\')
        p++;
      else if (c == delim) {
        if (state)
          *state = 0;
        break;
      }
    }
  } else {
    p++;
  }
  *ptr = p;
  *lenOut = (int32_t)(p - rv);
  return p > rv ? rv : NULL;
}
```