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

```asm
<nodelist_common_string_appends_and_extends>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %rdx,(%rsp)
  mov    (%rdi),%r12
  test   %rcx,%rcx
  je     L32
  mov    %rdi,%r14
  mov    %rcx,%r15
  mov    %r8,%rbp
  test   %r12,%r12
  je     L32
  test   %r8,%r8
  lea    D13(%rip),%rax
  cmove  %rax,%rbp
  cmpb   $0x0,(%r12)
  lea    D0(%rip),%rax
  cmove  %rax,%rbp
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  mov    %rax,0x18(%rsp)
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  mov    %rax,0x20(%rsp)
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rax,0x28(%rsp)
  add    %r13,%rbx
  mov    %rbx,0x10(%rsp)
  mov    %rbx,%r13
  add    %rax,%r13
  mov    0x8(%rsp),%rax
  mov    (%rax),%rbx
  cmp    %r13,%rbx
  jae    L28
L21:
  add    (%rsp),%rbx
  cmp    %rbx,%r13
  ja     L21
  lea    0x1(%rbx),%rsi
  mov    %r12,%rdi
  call   <realloc@plt>
  test   %rax,%rax
  mov    $0x0,%edx
  cmove  %rdx,%rbx
  mov    %rax,(%r14)
  mov    0x8(%rsp),%rax
  mov    %rbx,(%rax)
  mov    (%r14),%r12
  test   %r12,%r12
  je     L68
L28:
  mov    0x18(%rsp),%rdi
  add    %r12,%rdi
  mov    0x20(%rsp),%rdx
  mov    %rbp,%rsi
  call   <strncpy@plt>
  mov    0x10(%rsp),%rdi
  add    (%r14),%rdi
  mov    0x28(%rsp),%rdx
  mov    %r15,%rsi
  call   <strncpy@plt>
  mov    (%r14),%rax
  movb   $0x0,(%rax,%r13,1)
  mov    $0x0,%eax
L19:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L32:
  mov    $0xffffffff,%eax
  jmp    L19
L68:
  mov    $0xffffffff,%eax
  jmp    L19
```

tool_calls: name: unpack_data
arguments: tag: D13
data_type: string
name: unpack_data
arguments: tag: D0
data_type: string

tool: D13:  

tool: 

assistant: ```c
int nodelist_common_string_appends_and_extends(char **p_io_string, size_t *p_current_length, size_t inc_length, char *string2append, char *separator) {
  int fstatus = -1;
  size_t new_output_length;
  size_t new_string_length;
  size_t output_string_length;
  size_t separator_length;
  size_t append_length;
  char *default_separator = " ";
  char *local_separator;
  if (*p_io_string != NULL && string2append != NULL) {
    if (separator != NULL)
      local_separator = separator;
    else
      local_separator = default_separator;
    if (strlen(*p_io_string) == 0)
      local_separator = "";
    output_string_length = strlen(*p_io_string);
    separator_length = strlen(local_separator);
    append_length = strlen(string2append);
    new_string_length = output_string_length + separator_length + append_length;
    if (new_string_length > *p_current_length) {
      new_output_length = *p_current_length;
      while (new_string_length > new_output_length)
        new_output_length += inc_length;
      *p_io_string = (char *)realloc(*p_io_string, (new_output_length + 1) * sizeof(char));
      if (*p_io_string != NULL)
        *p_current_length = new_output_length;
      else
        *p_current_length = 0;
    }
    if (*p_io_string != NULL) {
      strncpy(*p_io_string + output_string_length, local_separator, separator_length);
      strncpy(*p_io_string + output_string_length + separator_length, string2append, append_length);
      *(*p_io_string + output_string_length + separator_length + append_length) = '\0';
      fstatus = 0;
    }
  }
  return fstatus;
}
```