user: Translate the below assembly code into C programming language:

```asm
<getline>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L122
  cmpq   $0x0,-0x40(%rbp)
  je     L122
  cmpq   $0x0,-0x48(%rbp)
  jne    L43
L122:
  mov    D72(%rip),%rax
  mov    (%rax),%edx
  mov    D43(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L86
L43:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L126
  mov    -0x40(%rbp),%rax
  movq   $0x80,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L126
  mov    D39(%rip),%rax
  mov    (%rax),%edx
  mov    D43(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L86
L126:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
L145:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,%ebx
  mov    D43(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x28(%rbp)
  cmp    $0xd,%ebx
  je     L145
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  cmp    %rax,%rdx
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpq   $0x1,-0x20(%rbp)
  ja     L186
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  add    %rdx,%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    -0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L101
  mov    D39(%rip),%rax
  mov    (%rax),%edx
  mov    D43(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L86
L101:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  sub    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  cmp    %rax,%rdx
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
L186:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L114
  mov    D43(%rip),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L86
L114:
  mov    D34(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%ebx
  jne    L173
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x18(%rbp)
  jne    L78
  mov    $0xffffffff,%eax
  jmp    L86
L173:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    %ebx,%edx
  mov    %dl,(%rax)
  subq   $0x1,-0x20(%rbp)
  cmp    $0xa,%ebx
  je     L170
  jmp    L145
L78:
  nop
  jmp    L125
L170:
  nop
L125:
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  sub    %rdx,%rax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
L86:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
  size_t nchars_avail;
  char *read_pos;
  int save_errno;
  ssize_t ret;
  register int c;
  if (!lineptr || !n || !stream) {
    errno = EINVAL;
    return -1;
  }
  if (!*lineptr) {
    *n = 128;
    *lineptr = malloc(*n);
    if (!*lineptr) {
      errno = ENOMEM;
      return -1;
    }
  }
  nchars_avail = *n;
  read_pos = *lineptr;
  for (;;) {
    c = getc(stream);
    save_errno = errno;
    if (c != '\r') {
      assert((*lineptr + *n) == (read_pos + nchars_avail));
      if (nchars_avail < 2) {
        *n *= 2;
        nchars_avail = *n + *lineptr - read_pos;
        *lineptr = realloc(*lineptr, *n);
        if (!*lineptr) {
          errno = ENOMEM;
          return -1;
        }
        read_pos = *n - nchars_avail + *lineptr;
        assert((*lineptr + *n) == (read_pos + nchars_avail));
      }
      if (ferror(stream)) {
        errno = save_errno;
        return -1;
      }
      if (c == EOF) {
        if (read_pos == *lineptr)
          return -1;
        else
          break;
      }
      *read_pos++ = c;
      nchars_avail--;
      if (c == '\n')
        break;
    }
  }
  *read_pos = '\0';
  ret = read_pos - *lineptr;
  return ret;
}
```