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

```asm
<tokenizeCommand>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L213
L38:
  movzbl (%r12),%eax
  lea    0x1(%r12),%rsi
  xor    %r8d,%r8d
  test   %al,%al
  je     L302
  xor    %edx,%edx
  mov    $0x9,%ecx
  jmp    L105
  nopl   0x0(%rax,%rax,1)
L314:
  cmp    $0x6e,%al
  je     L212
  cmp    $0x74,%al
  cmove  %ecx,%eax
L279:
  mov    %al,(%rbx)
  and    $0xfffffffe,%edx
  add    $0x1,%rbx
  xor    %edi,%edi
L131:
  movzbl (%rsi),%eax
  add    $0x1,%rsi
  test   %al,%al
  je     L7
L105:
  mov    %edx,%edi
  and    $0x1,%edi
  jne    L314
  test   $0x2,%dl
  je     L222
  cmp    $0x22,%al
  je     L73
  cmp    $0x5c,%al
  je     L281
  add    $0x1,%rsi
  mov    %al,(%rbx)
  add    $0x1,%rbx
  movzbl -0x1(%rsi),%eax
  test   %al,%al
  jne    L105
  nopl   0x0(%rax)
L7:
  test   %edi,%edi
  jne    L248
  test   $0x2,%dl
  jne    L76
  and    $0x4,%edx
  je     L302
  movb   $0x0,(%rbx)
L302:
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L222:
  mov    %edx,%edi
  and    $0x4,%edi
  cmp    $0xa,%al
  jg     L104
  cmp    $0x8,%al
  jg     L231
  test   %edi,%edi
  je     L124
L276:
  mov    %edx,%edi
  mov    %al,(%rbx)
  add    $0x1,%rbx
  and    $0x1,%edi
  jmp    L131
  nopl   (%rax)
L104:
  cmp    $0x20,%al
  je     L231
  test   %edi,%edi
  jne    L28
  nopl   0x0(%rax)
L124:
  cmp    %r8d,%ebp
  je     L230
  movslq %r8d,%rdi
  or     $0x4,%edx
  add    $0x1,%r8d
  mov    %rbx,0x0(%r13,%rdi,8)
  mov    %edx,%r9d
L191:
  mov    %r9d,%edx
  mov    %r9d,%edi
  or     $0x2,%edx
  and    $0x1,%edi
  cmp    $0x22,%al
  je     L131
  mov    %r9d,%edx
  cmp    $0x5c,%al
  jne    L276
L281:
  or     $0x1,%edx
  mov    $0x1,%edi
  jmp    L131
  nopl   0x0(%rax,%rax,1)
L212:
  mov    $0xa,%eax
  jmp    L279
  nopw   0x0(%rax,%rax,1)
L231:
  test   %edi,%edi
  je     L131
  movb   $0x0,(%rbx)
  and    $0xfffffffb,%edx
  xor    %edi,%edi
  add    $0x1,%rbx
  jmp    L131
  nopl   0x0(%rax)
L73:
  and    $0xfffffffd,%edx
  jmp    L131
  nopl   0x0(%rax,%rax,1)
L213:
  mov    $0x20,%esi
  lea    D18(%rip),%rdi
  call   <__assert@plt>
  jmp    L38
L230:
  mov    $0xffffffff,%r8d
  jmp    L302
L76:
  lea    D15(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%r8d
  jmp    L302
L248:
  lea    D7(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%r8d
  jmp    L302
L28:
  mov    %edx,%r9d
  jmp    L191
```

tool_calls: name: disassemble_data
arguments: data_label: D18
type_guessed: string
name: disassemble_data
arguments: data_label: D15
type_guessed: string
name: disassemble_data
arguments: data_label: D7
type_guessed: string

tool: D18: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Touhid18/Nachos/refs/heads/master/bin/nachos/test/sh.c

tool: D15: Unmatched ".


tool: D7: Unmatched \.


assistant: ```c
int tokenizeCommand(char *command, int maxTokens, char *tokens[], char *storage) {
  const int quotingCharacter = 0x00000001;
  const int quotingString = 0x00000002;
  const int startedArg = 0x00000004;
  int state = 0;
  int numTokens = 0;
  char c;
  ((maxTokens > 0) ? (void)0 : __assert("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Touhid18/Nachos/refs/heads/master/bin/nachos/test/sh.c", 32));
  while ((c = *(command++)) != '\0') {
    if (state & quotingCharacter) {
      switch (c) {
      case 't':
        c = '\t';
        break;
      case 'n':
        c = '\n';
        break;
      }
      *(storage++) = c;
      state &= ~quotingCharacter;
    } else if (state & quotingString) {
      switch (c) {
      case '\\':
        state |= quotingCharacter;
        break;
      case '"':
        state &= ~quotingString;
        break;
      default:
        *(storage++) = c;
        break;
      }
    } else {
      switch (c) {
      case ' ':
      case '\t':
      case '\n':
        if (state & startedArg) {
          *(storage++) = '\0';
          state &= ~startedArg;
        }
        break;
      default:
        if (!(state & startedArg)) {
          if (numTokens == maxTokens) {
            return -1;
          }
          tokens[numTokens++] = storage;
          state |= startedArg;
        }
        switch (c) {
        case '\\':
          state |= quotingCharacter;
          break;
        case '"':
          state |= quotingString;
          break;
        default:
          *(storage++) = c;
          break;
        }
      }
    }
  }
  if (state & quotingCharacter) {
    printf("Unmatched \\.\n");
    return -1;
  }
  if (state & quotingString) {
    printf("Unmatched \".\n");
    return -1;
  }
  if (state & startedArg) {
    *(storage++) = '\0';
  }
  return numTokens;
}
```