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

```asm
<ksplit_core>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    (%rdx),%eax
  mov    %rdx,0x10(%rsp)
  mov    %eax,0x8(%rsp)
  mov    (%rcx),%rax
  mov    %rcx,0x18(%rsp)
  mov    %rax,(%rsp)
  call   <strlen@plt>
  test   %eax,%eax
  js     L194
  movl   $0x0,0xc(%rsp)
  mov    %eax,%ebx
  xor    %r13d,%r13d
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  jmp    L135
L46:
  cmp    %edi,%ebp
  je     L33
  test   %dil,%dil
  je     L33
  cmp    %r13d,%ebp
  je     L257
  test   %r13d,%r13d
  mov    %edi,%r13d
  je     L257
  cs nopw 0x0(%rax,%rax,1)
L202:
  add    $0x1,%r15d
  add    $0x1,%r12
  cmp    %r15d,%ebx
  jl     L285
L135:
  movsbl (%r12),%edi
  test   %ebp,%ebp
  jne    L46
  call   <isspace@plt>
  mov    %r13d,%edi
  test   %rax,%rax
  jne    L248
  cmpb   $0x0,(%r12)
  jne    L214
L248:
  call   <isgraph@plt>
  test   %rax,%rax
  jne    L18
  add    $0x1,%r15d
  movsbl (%r12),%r13d
  add    $0x1,%r12
  cmp    %r15d,%ebx
  jge    L135
L285:
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x18(%rsp),%rax
  mov    (%rsp),%rsi
  mov    %rsi,(%rax)
  add    $0x28,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L33:
  test   %r13d,%r13d
  je     L107
  cmp    %r13d,%ebp
  je     L107
  movb   $0x0,(%r12)
  cmp    %r14d,0x8(%rsp)
  je     L71
L170:
  mov    (%rsp),%rdx
  mov    0xc(%rsp),%ecx
  movslq %r14d,%rax
  add    $0x1,%r14d
  mov    %ecx,(%rdx,%rax,4)
  movsbl (%r12),%r13d
  jmp    L202
  nopw   0x0(%rax,%rax,1)
L107:
  mov    %edi,%r13d
  jmp    L202
L18:
  movb   $0x0,(%r12)
  cmp    %r14d,0x8(%rsp)
  je     L284
L98:
  mov    (%rsp),%rsi
  mov    0xc(%rsp),%edx
  movslq %r14d,%rax
  add    $0x1,%r14d
  mov    %edx,(%rsi,%rax,4)
  movsbl (%r12),%r13d
  jmp    L202
  nopl   0x0(%rax)
L257:
  mov    %edi,%r13d
L114:
  mov    %r15d,0xc(%rsp)
  jmp    L202
  nopl   (%rax)
L71:
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jne    L245
  movl   $0x2,0x8(%rsp)
  mov    $0x8,%esi
L251:
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
  jmp    L170
  nopw   0x0(%rax,%rax,1)
L214:
  call   <isspace@plt>
  test   %r13d,%r13d
  movsbl (%r12),%r13d
  je     L114
  test   %rax,%rax
  jne    L114
  jmp    L202
  nopl   0x0(%rax)
L245:
  add    %eax,%eax
  mov    %eax,0x8(%rsp)
  lea    0x0(,%rax,4),%esi
  jmp    L251
  nop
L284:
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jne    L149
  movl   $0x2,0x8(%rsp)
  mov    $0x8,%esi
L225:
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L149:
  add    %eax,%eax
  mov    %eax,0x8(%rsp)
  lea    0x0(,%rax,4),%esi
  jmp    L225
  nop
L194:
  xor    %r14d,%r14d
  jmp    L285
```

assistant: ```c
int ksplit_core(char *s, int delimiter, int *_max, int **_offsets) {
  int i, n, max, last_char, last_start, *offsets, l;
  n = 0;
  max = *_max;
  offsets = *_offsets;
  l = strlen(s);
  for (i = 0, last_char = last_start = 0; i <= l; ++i) {
    if (delimiter == 0) {
      if (isspace(s[i]) || s[i] == 0) {
        if (isgraph(last_char))
          do {
            if (_offsets) {
              s[i] = 0;
              if (n == max) {
                max = max ? max << 1 : 2;
                offsets = (int *)realloc(offsets, sizeof(int) * max);
              }
              offsets[n++] = last_start;
            } else
              ++n;
          } while (0);
      } else {
        if (isspace(last_char) || last_char == 0)
          last_start = i;
      }
    } else {
      if (s[i] == delimiter || s[i] == 0) {
        if (last_char != 0 && last_char != delimiter)
          do {
            if (_offsets) {
              s[i] = 0;
              if (n == max) {
                max = max ? max << 1 : 2;
                offsets = (int *)realloc(offsets, sizeof(int) * max);
              }
              offsets[n++] = last_start;
            } else
              ++n;
          } while (0);
      } else {
        if (last_char == delimiter || last_char == 0)
          last_start = i;
      }
    }
    last_char = s[i];
  }
  *_max = max;
  *_offsets = offsets;
  return n;
}
```