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

```asm
<b64_encode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %ecx,(%rsp)
  mov    %r8d,0x4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdx,%rdx
  je     L156
  mov    %rdi,%r14
  mov    %rsi,%r12
  mov    %rdx,%r15
  mov    $0x0,%r13d
  cmpq   $0x0,(%rdx)
  je     L67
L61:
  mov    (%r15),%rbp
  movl   $0x0,0x20(%rsp)
  test   %r12,%r12
  je     L109
  movzbl (%r14),%eax
  movl   $0x1,0x1c(%rsp)
  mov    %al,0x24(%rsp)
  lea    0x1(%r14),%rbx
  add    %r12,%r14
  mov    %r13,%r12
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L13
L67:
  mov    $0x40,%edi
  call   <malloc@plt>
  mov    %rax,(%r15)
  test   %rax,%rax
  je     L48
  mov    $0x40,%r13d
  jmp    L61
L143:
  lea    0x1c(%rsp),%rdx
  lea    0x24(%rsp),%rsi
  mov    0x4(%rsp),%r9d
  mov    (%rsp),%r8d
  mov    0x8(%rsp),%rcx
  mov    %rbp,%rdi
  call   <encode_base64@plt>
  add    %rax,%rbp
  sub    %rax,%r13
  jmp    L102
L20:
  cmp    %rbx,%r14
  je     L87
  movzbl (%rbx),%ecx
  mov    0x1c(%rsp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,0x1c(%rsp)
  cltq
  mov    %cl,0x24(%rsp,%rax,1)
  cmp    $0x3,%edx
  je     L143
L102:
  add    $0x1,%rbx
L13:
  test   %r12,%r12
  je     L20
  cmp    $0x7,%r13
  ja     L20
  add    %r12,%r12
  mov    (%r15),%rdi
  sub    %rdi,%rbp
  mov    %r12,%r13
  sub    %rbp,%r13
  mov    %r12,%rsi
  call   <realloc@plt>
  mov    %rax,(%r15)
  test   %rax,%rax
  je     L25
  add    %rax,%rbp
  jmp    L20
L87:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  je     L109
  cmp    $0x2,%eax
  jg     L54
  cltq
L111:
  movb   $0x0,0x24(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    $0x2,%eax
  jle    L111
L54:
  lea    0x20(%rsp),%rcx
  lea    0x1c(%rsp),%rdx
  lea    0x24(%rsp),%rsi
  mov    0x4(%rsp),%r9d
  mov    (%rsp),%r8d
  mov    %rbp,%rdi
  call   <encode_base64@plt>
  add    %rax,%rbp
L109:
  movb   $0x0,0x0(%rbp)
  mov    %rbp,%rax
  sub    (%r15),%rax
L7:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L40
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L156:
  mov    $0x0,%eax
  jmp    L7
L48:
  mov    $0x0,%eax
  jmp    L7
L25:
  mov    $0x0,%eax
  jmp    L7
L40:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
size_t b64_encode(const char *s, size_t nbytes, char **pdst, int line_breaks, int cr) {
  if (!pdst)
    return 0;
  size_t max_len = 0, bytes_left = 0;
  if (!*pdst) {
    *pdst = (char *)malloc(max_len = bytes_left = 64);
    if (!*pdst)
      return 0;
  }
  char *dst = *pdst;
  int inbuf_size = 0, line_len = 0;
  unsigned char inbuf[4];
  for (int i = 0; i < nbytes; i++) {
    inbuf[inbuf_size++] = s[i];
    if (inbuf_size == 3) {
      size_t len = encode_base64(dst, inbuf, &inbuf_size, &line_len, line_breaks, cr);
      dst += len;
      bytes_left -= len;
    }
    if (max_len && (bytes_left < 8)) {
      max_len *= 2;
      size_t nbytes = dst - *pdst;
      bytes_left = max_len - nbytes;
      *pdst = (char *)realloc(*pdst, max_len);
      if (!*pdst)
        return 0;
      dst = *pdst + nbytes;
    }
  }
  if (inbuf_size) {
    for (int i = inbuf_size; i < 3; i++)
      inbuf[i] = 0;
    dst += encode_base64(dst, inbuf, &inbuf_size, &line_len, line_breaks, cr);
  }
  *dst = 0;
  return dst - *pdst;
}
```