user: What would the C source look like for the assembly code provided here:

```asm
<qfile_read>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  movq   $0x400,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L123
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L123
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x20(%rbp)
L123:
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L54
L51:
  cmpq   $0x0,-0x20(%rbp)
  je     L96
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  je     L107
L96:
  cmpq   $0x0,-0x18(%rbp)
  jne    L121
  mov    -0x28(%rbp),%rax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L10
  mov    $0x0,%eax
  jmp    L68
L121:
  mov    -0x28(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x18(%rbp)
  jne    L10
  shlq   -0x28(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L77
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L68
L77:
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L10:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x10(%rbp),%rdx
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  mov    %dl,(%rax)
L54:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x2c(%rbp)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  jne    L51
  jmp    L28
L107:
  nop
L28:
  cmpq   $0x0,-0x18(%rbp)
  jne    L42
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x2c(%rbp)
  jne    L42
  mov    $0x0,%eax
  jmp    L68
L42:
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpq   $0x0,-0x40(%rbp)
  je     L73
  mov    -0x40(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
L73:
  mov    -0x10(%rbp),%rax
L68:
  leave
  ret
```

assistant: ```c
void *qfile_read(FILE *fp, size_t *nbytes) {
  size_t memsize = 1024;
  size_t size = 0;
  if (nbytes != NULL && *nbytes > 0) {
    memsize = *nbytes;
    size = *nbytes;
  }
  int c;
  size_t c_count;
  char *data = NULL;
  for (c_count = 0; (c = fgetc(fp)) != EOF;) {
    if (size > 0 && c_count == size)
      break;
    if (c_count == 0) {
      data = (char *)malloc(sizeof(char) * memsize);
      if (data == NULL) {
        ;
        return NULL;
      }
    } else if (c_count == memsize - 1) {
      memsize *= 2;
      char *datatmp = (char *)malloc(sizeof(char) * (memsize + 1));
      if (datatmp == NULL) {
        ;
        free(data);
        return NULL;
      }
      memcpy(datatmp, data, c_count);
      free(data);
      data = datatmp;
    }
    data[c_count++] = (char)c;
  }
  if (c_count == 0 && c == EOF)
    return NULL;
  data[c_count] = '\0';
  if (nbytes != NULL)
    *nbytes = c_count;
  return (void *)data;
}
```