user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<nextline>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L163
  mov    $0x0,%eax
  jmp    L56
L84:
  addq   $0x1,-0x8(%rbp)
L163:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L135
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L135
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  jne    L84
L135:
  mov    -0x8(%rbp),%rax
  sub    -0x28(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L169
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L32
  addq   $0x1,-0x8(%rbp)
  jmp    L169
L32:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  jne    L169
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L169
  addq   $0x2,-0x8(%rbp)
L169:
  cmpl   $0x0,-0xc(%rbp)
  jne    L57
  mov    -0x8(%rbp),%rax
  jmp    L56
L57:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L50
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    -0x18(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L92
L50:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  cmp    %rax,%rdx
  jae    L92
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    -0x18(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
L92:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L11
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <debug@plt>
  mov    $0x0,%eax
  jmp    L56
L11:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  mov    -0xc(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  sub    $0x1,%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L56:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D6
data_type: string

tool: D6: [nextline] Insufficient memory!


assistant: ```c
const char *nextline(char **lineptr, size_t *n, const char *text) {
  int len;
  const char *to = text;
  if (!*to)
    return NULL;
  while (*to && *to != '\n' && *to != '\r')
    to++;
  len = to - text + 1;
  if (*to) {
    if (*to == '\n')
      to++;
    else if (*to == '\r' && *(to + 1) == '\n')
      to += 2;
  }
  if (!len)
    return to;
  if (!*lineptr) {
    *lineptr = malloc(len);
    *n = len;
  } else if (*n < len) {
    *lineptr = realloc(*lineptr, len);
    *n = len;
  }
  if (!*lineptr) {
    debug("[nextline] Insufficient memory!\n");
    return 0;
  }
  memcpy(*lineptr, text, len);
  (*lineptr)[len - 1] = 0;
  return to;
}
```