user: 请将以下的汇编代码转换成C语言代码：

```asm
<getline>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L195
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r13
  test   %rsi,%rsi
  je     L195
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L151
  mov    (%rsi),%rsi
  test   %rsi,%rsi
  jne    L50
L151:
  movq   $0x0,(%rbx)
  movq   $0x0,0x0(%rbp)
  mov    $0x1,%r15d
  mov    $0x0,%r12d
  mov    $0x78,%r14d
L160:
  mov    %r14d,%esi
  mov    (%rbx),%rdi
  call   <realloc@plt>
  test   %rax,%rax
  je     L34
  mov    %rax,(%rbx)
  movslq %r14d,%rsi
  mov    %rsi,0x0(%rbp)
  movslq %r12d,%r14
  sub    %r14,%rsi
  mov    %r14,%rdi
  add    (%rbx),%rdi
  mov    %r13,%rdx
  call   <fgets@plt>
  test   %rax,%rax
  jne    L173
  mov    %r13,%rdi
  call   <feof@plt>
  test   %r12d,%r12d
  je     L34
  test   %rax,%rax
  jne    L49
L34:
  mov    $0xffffffff,%r12d
  test   %r15d,%r15d
  je     L49
  mov    (%rbx),%rdi
  call   <free@plt>
  movq   $0x0,(%rbx)
  movq   $0x0,0x0(%rbp)
  jmp    L49
L195:
  mov    D17(%rip),%rax
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%r12d
  jmp    L49
L50:
  cmp    $0x3c,%rsi
  jbe    L48
  call   <fgets@plt>
  test   %rax,%rax
  je     L25
  mov    $0x0,%r15d
  mov    $0x0,%r12d
  mov    $0x0,%r14d
L173:
  mov    %r13,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L188
  mov    %r14,%rdx
  not    %rdx
  add    0x0(%rbp),%rdx
  mov    %r14,%rdi
  add    (%rbx),%rdi
  mov    $0xa,%esi
  call   <memchr@plt>
  test   %rax,%rax
  je     L60
  sub    (%rbx),%rax
  lea    0x1(%rax),%r12d
L49:
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L188:
  mov    %r14,%rdi
  add    (%rbx),%rdi
  call   <strlen@plt>
  add    %eax,%r12d
  jmp    L49
L60:
  mov    0x0(%rbp),%eax
  lea    -0x1(%rax),%r12d
L193:
  mov    0x0(%rbp),%rax
  mov    $0x78,%r14d
  cmp    $0x3b,%rax
  jbe    L160
  lea    (%rax,%rax,1),%r14d
  jmp    L160
L48:
  mov    $0x0,%r15d
  mov    $0x0,%r12d
  jmp    L193
L25:
  mov    %r13,%rdi
  call   <feof@plt>
  mov    $0xffffffff,%r12d
  jmp    L49
```

assistant: ```c
ssize_t getline(char **buf, size_t *len, FILE *stream) {
  int i = 0, new_len, my_malloc = 0;
  char *nl, *new_buf;
  if (buf == NULL || len == NULL) {
    errno = EINVAL;
    return -1;
  }
  if (*buf == NULL || *len == 0) {
    *buf = NULL;
    *len = 0;
    my_malloc = 1;
  }
  if (*len <= 60)
    goto alloc;
  while (1) {
    if (fgets(*buf + i, *len - i, stream) == NULL) {
      if (!feof(stream) || i == 0) {
        goto error;
      } else {
        return i;
      }
    }
    if (feof(stream)) {
      return i + strlen(*buf + i);
    }
    if ((nl = memchr(*buf + i, '\n', *len - i - 1)) == NULL) {
      i = *len - 1;
    alloc:
      new_len = *len < 60 ? 120 : *len * 2;
      if ((new_buf = realloc(*buf, new_len)) == NULL)
        goto error;
      *buf = new_buf;
      *len = new_len;
    } else {
      return nl - *buf + 1;
    }
  }
error:
  if (my_malloc) {
    free(*buf);
    *buf = NULL;
    *len = 0;
  }
  return -1;
}
```