user: Demonstrate the C code that generates the assembly output below:

```asm
<doapr_outch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %rcx,-0x20(%rbp)
  mov    %r8d,-0x24(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L158
  cmpq   $0x0,-0x10(%rbp)
  je     L64
L158:
  mov    $0x1,%eax
  jmp    L52
L64:
  mov    $0x0,%eax
L52:
  mov    %eax,%edi
  call   <assert@plt>
  cmpq   $0x0,-0x10(%rbp)
  je     L109
  jmp    L45
L113:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L123
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L35
  mov    -0x20(%rbp),%rax
  movq   $0x400,(%rax)
L35:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <OPENSSL_malloc@plt>
  mov    -0x10(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L142
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L142:
  mov    -0x8(%rbp),%rax
  movq   $0x0,(%rax)
  jmp    L45
L123:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  lea    0x400(%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <OPENSSL_realloc@plt>
  mov    -0x10(%rbp),%rdx
  mov    %rax,(%rdx)
L45:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jae    L113
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L80
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L59
L80:
  mov    $0x1,%eax
  jmp    L146
L59:
  mov    $0x0,%eax
L146:
  mov    %eax,%edi
  call   <assert@plt>
L109:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jae    L157
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L5
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rsi
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rdx
  mov    %rcx,(%rdx)
  add    %rsi,%rax
  mov    -0x24(%rbp),%edx
  mov    %dl,(%rax)
  jmp    L157
L5:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rsi
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rdx
  mov    %rcx,(%rdx)
  add    %rsi,%rax
  mov    -0x24(%rbp),%edx
  mov    %dl,(%rax)
  nop
L157:
  nop
  leave
  ret
```

assistant: ```c
void doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int c) {
  assert(*sbuffer != NULL || buffer != NULL);
  if (buffer) {
    while (*currlen >= *maxlen) {
      if (*buffer == NULL) {
        if (*maxlen == 0)
          *maxlen = 1024;
        *buffer = OPENSSL_malloc(*maxlen);
        if (*currlen > 0) {
          assert(*sbuffer != NULL);
          memcpy(*buffer, *sbuffer, *currlen);
        }
        *sbuffer = NULL;
      } else {
        *maxlen += 1024;
        *buffer = OPENSSL_realloc(*buffer, *maxlen);
      }
    }
    assert(*sbuffer != NULL || *buffer != NULL);
  }
  if (*currlen < *maxlen) {
    if (*sbuffer)
      (*sbuffer)[(*currlen)++] = (char)c;
    else
      (*buffer)[(*currlen)++] = (char)c;
  }
  return;
}
```