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

```asm
<getline>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L16
  mov    %rsi,%rbp
  test   %rsi,%rsi
  je     L16
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  mov    %rdx,%r13
  test   %rdi,%rdi
  je     L219
  mov    (%rsi),%rsi
  test   %rsi,%rsi
  je     L219
  cmp    $0x3c,%rsi
  jbe    L213
  call   <fgets@plt>
  test   %rax,%rax
  je     L210
  mov    %r13,%rdi
  xor    %r15d,%r15d
  xor    %r12d,%r12d
  xor    %r14d,%r14d
  call   <feof@plt>
  test   %rax,%rax
  je     L121
L159:
  mov    (%rbx),%rdi
  add    %r14,%rdi
  call   <strlen@plt>
  add    %eax,%r12d
  jmp    L105
  xchg   %ax,%ax
L219:
  movq   $0x0,(%rbx)
  xor    %edi,%edi
  mov    $0x78,%esi
  movq   $0x0,0x0(%rbp)
  call   <realloc@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L78
  mov    %rax,(%rbx)
  mov    %r13,%rdx
  mov    $0x78,%esi
  movq   $0x78,0x0(%rbp)
  call   <fgets@plt>
  test   %rax,%rax
  je     L163
  mov    $0x1,%r15d
  xor    %r12d,%r12d
  xor    %r14d,%r14d
L120:
  mov    %r13,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L159
L121:
  mov    (%rbx),%rdi
  mov    %r14,%rdx
  mov    $0xa,%esi
  not    %rdx
  add    0x0(%rbp),%rdx
  add    %r14,%rdi
  call   <memchr@plt>
  test   %rax,%rax
  je     L8
  sub    (%rbx),%rax
  lea    0x1(%rax),%r12d
L105:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L8:
  mov    0x0(%rbp),%rsi
  mov    (%rbx),%rdi
  lea    -0x1(%rsi),%r12d
L72:
  mov    $0x78,%r14d
  cmp    $0x3b,%rsi
  jbe    L142
  lea    (%rsi,%rsi,1),%r14d
L142:
  mov    %r14d,%esi
  call   <realloc@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  je     L137
  mov    %rax,(%rbx)
  movslq %r14d,%rax
  movslq %r12d,%r14
  mov    %rax,0x0(%rbp)
  sub    %r14,%rax
  lea    (%rdx,%r14,1),%rdi
  mov    %r13,%rdx
  mov    %rax,%rsi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L120
  mov    %r13,%rdi
  call   <feof@plt>
  test   %r12d,%r12d
  je     L137
  test   %rax,%rax
  jne    L105
L137:
  test   %r15d,%r15d
  je     L53
  nopw   0x0(%rax,%rax,1)
L78:
  mov    (%rbx),%rdi
  mov    $0xffffffff,%r12d
  call   <free@plt>
  movq   $0x0,(%rbx)
  movq   $0x0,0x0(%rbp)
  jmp    L105
  nopw   0x0(%rax,%rax,1)
L210:
  mov    %r13,%rdi
  call   <feof@plt>
L53:
  mov    $0xffffffff,%r12d
  jmp    L105
  nopl   0x0(%rax,%rax,1)
L163:
  mov    %r13,%rdi
  call   <feof@plt>
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L16:
  mov    D2(%rip),%rax
  mov    $0xffffffff,%r12d
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    %edx,(%rax)
  jmp    L105
L213:
  xor    %r15d,%r15d
  xor    %r12d,%r12d
  jmp    L72
```

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