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

```asm
<RFC822LineRead>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  jmp    L74
L119:
  cmpl   $0xa,-0x30(%rbp)
  jne    L151
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x2c(%rbp)
  mov    D15(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  je     L160
  cmpl   $0xa,-0x2c(%rbp)
  je     L160
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L97
L160:
  mov    -0x38(%rbp),%rdx
  mov    -0x2c(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <ungetc@plt>
  jmp    L151
L97:
  movl   $0x20,-0x30(%rbp)
L151:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jne    L40
  addq   $0x50,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L116
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L22
L116:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x28(%rbp)
L40:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rax
  mov    -0x30(%rbp),%edx
  mov    %dl,(%rax)
  cmpl   $0xa,-0x30(%rbp)
  je     L75
L74:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x30(%rbp)
  mov    D15(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x30(%rbp)
  jne    L119
  jmp    L65
L75:
  nop
L65:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jne    L11
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L131
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L22
L131:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x28(%rbp)
L11:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpq   $0x0,-0x28(%rbp)
  je     L132
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L132
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x28(%rbp)
L132:
  mov    -0x28(%rbp),%rax
L22:
  leave
  ret
```

assistant: ```c
char *RFC822LineRead(FILE *in) {
  char *line = NULL;
  size_t max = 0;
  size_t idx = 0;
  int c;
  assert(in != NULL);
  while ((c = fgetc(in)) != EOF) {
    if (c == '\n') {
      int c1 = fgetc(in);
      if ((c1 == EOF) || (c1 == '\n') || !isspace(c1))
        ungetc(c1, in);
      else
        c = ' ';
    }
    if (idx == max) {
      char *n;
      max += 80;
      n = realloc(line, max);
      if (n == NULL) {
        free(line);
        return NULL;
      }
      line = n;
    }
    line[idx++] = c;
    if (c == '\n')
      break;
  }
  if (idx == max) {
    char *n;
    max += 1;
    n = realloc(line, max);
    if (n == NULL) {
      free(line);
      return NULL;
    }
    line = n;
  }
  line[idx] = '\0';
  if ((line != NULL) && (*line == '\n')) {
    free(line);
    line = NULL;
  }
  return line;
}
```