user: Please show me the C implementation that matches the assembly code listed below:

```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     L81
  movl   $0x0,0xc(%rsp)
  mov    %eax,%ebx
  xor    %r13d,%r13d
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  jmp    L94
L54:
  cmp    %edi,%ebp
  je     L232
  test   %dil,%dil
  je     L232
  cmp    %r13d,%ebp
  je     L82
  test   %r13d,%r13d
  mov    %edi,%r13d
  je     L82
  cs nopw 0x0(%rax,%rax,1)
L74:
  add    $0x1,%r15d
  add    $0x1,%r12
  cmp    %r15d,%ebx
  jl     L172
L94:
  movsbl (%r12),%edi
  test   %ebp,%ebp
  jne    L54
  call   <isspace@plt>
  mov    %r13d,%edi
  test   %rax,%rax
  jne    L36
  cmpb   $0x0,(%r12)
  jne    L289
L36:
  call   <isgraph@plt>
  test   %rax,%rax
  jne    L43
  add    $0x1,%r15d
  movsbl (%r12),%r13d
  add    $0x1,%r12
  cmp    %r15d,%ebx
  jge    L94
L172:
  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)
L232:
  test   %r13d,%r13d
  je     L254
  cmp    %r13d,%ebp
  je     L254
  movb   $0x0,(%r12)
  cmp    %r14d,0x8(%rsp)
  je     L205
L158:
  mov    (%rsp),%rdx
  mov    0xc(%rsp),%ecx
  movslq %r14d,%rax
  add    $0x1,%r14d
  mov    %ecx,(%rdx,%rax,4)
  movsbl (%r12),%r13d
  jmp    L74
  nopw   0x0(%rax,%rax,1)
L254:
  mov    %edi,%r13d
  jmp    L74
L43:
  movb   $0x0,(%r12)
  cmp    %r14d,0x8(%rsp)
  je     L143
L136:
  mov    (%rsp),%rsi
  mov    0xc(%rsp),%edx
  movslq %r14d,%rax
  add    $0x1,%r14d
  mov    %edx,(%rsi,%rax,4)
  movsbl (%r12),%r13d
  jmp    L74
  nopl   0x0(%rax)
L82:
  mov    %edi,%r13d
L225:
  mov    %r15d,0xc(%rsp)
  jmp    L74
  nopl   (%rax)
L205:
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jne    L124
  movl   $0x2,0x8(%rsp)
  mov    $0x8,%esi
L186:
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
  jmp    L158
  nopw   0x0(%rax,%rax,1)
L289:
  call   <isspace@plt>
  test   %r13d,%r13d
  movsbl (%r12),%r13d
  je     L225
  test   %rax,%rax
  jne    L225
  jmp    L74
  nopl   0x0(%rax)
L124:
  add    %eax,%eax
  mov    %eax,0x8(%rsp)
  lea    0x0(,%rax,4),%esi
  jmp    L186
  nop
L143:
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jne    L270
  movl   $0x2,0x8(%rsp)
  mov    $0x8,%esi
L281:
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
  jmp    L136
  nopw   0x0(%rax,%rax,1)
L270:
  add    %eax,%eax
  mov    %eax,0x8(%rsp)
  lea    0x0(,%rax,4),%esi
  jmp    L281
  nop
L81:
  xor    %r14d,%r14d
  jmp    L172
```

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