user: 下面的汇编指令对应的C源代码是什么:

```asm
<getstr>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  test   %rsi,%rsi
  sete   %al
  test   %rdx,%rdx
  mov    %r8,0x18(%rsp)
  sete   %dl
  or     %dl,%al
  jne    L51
  mov    %rdi,%r14
  test   %rdi,%rdi
  je     L51
  mov    (%rdi),%r12
  mov    %rsi,%r13
  test   %r12,%r12
  je     L60
  mov    (%rsi),%ebp
  mov    %r8,%rax
L128:
  sub    %eax,%ebp
  add    %rax,%r12
  movsbl %cl,%eax
  mov    %eax,0x14(%rsp)
  jmp    L83
  nopl   0x0(%rax)
L132:
  mov    D13(%rip),%rax
  cmp    %ebx,(%rax)
  je     L27
L123:
  mov    %r15,%rdi
  mov    %rdx,0x8(%rsp)
  call   <ferror@plt>
  mov    0x8(%rsp),%rdx
  test   %rax,%rax
  jne    L27
  mov    %bl,(%rdx)
  lea    0x1(%rdx),%r12
  sub    $0x1,%ebp
  cmp    %ebx,0x14(%rsp)
  je     L76
L83:
  mov    %r15,%rdi
  call   <getc@plt>
  movslq %ebp,%rdx
  xor    %edi,%edi
  mov    %eax,%ebx
  mov    0x0(%r13),%rax
  sub    %rdx,%rax
  mov    %r12,%rdx
  sub    (%r14),%rdx
  cmp    %rdx,%rax
  sete   %dil
  call   <assert@plt>
  mov    %r12,%rdx
  cmp    $0x1,%ebp
  jg     L132
  mov    0x0(%r13),%rax
  mov    (%r14),%rdi
  cmp    $0x41,%rax
  lea    (%rax,%rax,1),%rcx
  lea    0x40(%rax),%rsi
  cmovae %rcx,%rsi
  mov    %rsi,0x0(%r13)
  lea    (%rdi,%rsi,1),%r12
  sub    %rdx,%r12
  mov    %r12d,%ebp
  call   <realloc@plt>
  mov    %rax,(%r14)
  mov    %rax,%rdx
  test   %rax,%rax
  je     L51
  movslq %r12d,%r12
  mov    $0x1,%edi
  sub    %r12,%rdx
  add    0x0(%r13),%rdx
  mov    %rdx,0x8(%rsp)
  call   <assert@plt>
  mov    D13(%rip),%rax
  mov    0x8(%rsp),%rdx
  cmp    %ebx,(%rax)
  jne    L123
L27:
  cmp    %rdx,(%r14)
  je     L51
L16:
  movb   $0x0,(%rdx)
  mov    0x18(%rsp),%rcx
  mov    %edx,%eax
  add    (%r14),%rcx
  add    $0x28,%rsp
  pop    %rbx
  sub    %ecx,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L76:
  mov    %r12,%rdx
  jmp    L16
  nopl   (%rax)
L60:
  movq   $0x40,(%rsi)
  mov    $0x40,%edi
  mov    %cl,0x8(%rsp)
  call   <malloc@plt>
  mov    %rax,(%r14)
  mov    %rax,%r12
  test   %rax,%rax
  je     L51
  movzbl 0x8(%rsp),%ecx
  mov    0x18(%rsp),%rax
  mov    $0x40,%ebp
  jmp    L128
  nopl   0x0(%rax)
L51:
  add    $0x28,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int getstr(char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset) {
  int nchars_avail;
  char *read_pos;
  int ret;
  if (!lineptr || !n || !stream)
    return -1;
  if (!*lineptr) {
    *n = 64;
    *lineptr = malloc(*n);
    if (!*lineptr)
      return -1;
  }
  nchars_avail = *n - offset;
  read_pos = *lineptr + offset;
  for (;;) {
    register int c = getc(stream);
    assert(*n - nchars_avail == read_pos - *lineptr);
    if (nchars_avail < 2) {
      if (*n > 64)
        *n *= 2;
      else
        *n += 64;
      nchars_avail = *n + *lineptr - read_pos;
      *lineptr = realloc(*lineptr, *n);
      if (!*lineptr)
        return -1;
      read_pos = *n - nchars_avail + *lineptr;
      assert(*n - nchars_avail == read_pos - *lineptr);
    }
    if (c == EOF || ferror(stream)) {
      if (read_pos == *lineptr)
        return -1;
      else
        break;
    }
    *read_pos++ = c;
    nchars_avail--;
    if (c == terminator)
      break;
  }
  *read_pos = '\0';
  ret = read_pos - (*lineptr + offset);
  return ret;
}
```