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

```asm
<split>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0xa,-0x1c(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L16
  cmpq   $0x0,-0x28(%rbp)
  je     L16
  cmpq   $0x0,-0x30(%rbp)
  jne    L9
L16:
  mov    $0xffffffff,%eax
  jmp    L12
L9:
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L31
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L12
L99:
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    %rdx,(%rax)
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L71
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L12
L71:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  mov    -0x10(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x20(%rbp)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jne    L31
  addl   $0xa,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
L31:
  mov    -0x30(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L99
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x1c(%rbp)
  jne    L79
  addl   $0x2,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
L79:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    -0x38(%rbp),%rdx
  mov    (%rdx),%rcx
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  add    %rcx,%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  mov    -0x10(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  mov    -0x20(%rbp),%eax
L12:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D16
datatype: string
name: read_data
arguments: tag: D10
datatype: string

tool: D16: malloc List

tool: D10: split: malloc list element

assistant: ```c
int split(const char *Input, char *Delim, char ***List) {
  int Found;
  int MaxFound;
  int Length;
  int DelimLen;
  const char *Remain;
  char *Position;
  DelimLen = strlen(Delim);
  Found = 0;
  Remain = Input;
  MaxFound = 10;
  if ((List == NULL) || (Input == NULL) || (Delim == NULL)) {
    return -1;
  }
  if ((*List = (char **)malloc(MaxFound * sizeof(char *))) == NULL) {
    perror("malloc List");
    return -1;
  }
  while ((Position = strstr(Remain, Delim)) != NULL) {
    Length = Position - Remain;
    if ((((*List)[Found]) = (char *)malloc(sizeof(char) * (Length + 1))) == NULL) {
      perror("split: malloc list element");
      return -1;
    }
    strncpy(((*List)[Found]), Remain, Length);
    ((*List)[Found])[Length] = 0;
    Found++;
    Remain = Position + DelimLen;
    if (Found == MaxFound) {
      MaxFound += 10;
      *List = (char **)realloc(*List, MaxFound * sizeof(char *));
    }
  }
  if (Found + 1 == MaxFound) {
    MaxFound += 2;
    *List = (char **)realloc(*List, MaxFound * sizeof(char *));
  }
  Length = strlen(Remain);
  ((*List)[Found]) = (char *)malloc(sizeof(char) * (Length + 1));
  strncpy(((*List)[Found]), Remain, Length);
  ((*List)[Found])[Length] = 0;
  Found++;
  ((*List)[Found]) = NULL;
  return Found;
}
```