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

```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     L99
  mov    (%rdx),%rbp
  mov    %rdi,%r14
  mov    %rdx,%r15
  xor    %r13d,%r13d
  test   %rbp,%rbp
  je     L41
L70:
  movl   $0x0,0x20(%rsp)
  test   %rsi,%rsi
  je     L149
  movzbl (%r14),%eax
  lea    0x1(%r14),%rbx
  mov    %r13,%r12
  add    %rsi,%r14
  movl   $0x1,0x1c(%rsp)
  mov    %al,0x24(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L84
  nop
L24:
  add    $0x1,%rbx
L84:
  test   %r12,%r12
  je     L137
  cmp    $0x7,%r13
  ja     L137
  mov    (%r15),%rdi
  add    %r12,%r12
  mov    %r12,%rsi
  mov    %r12,%r13
  sub    %rdi,%rbp
  call   <realloc@plt>
  sub    %rbp,%r13
  mov    %rax,(%r15)
  test   %rax,%rax
  je     L99
  add    %rax,%rbp
L137:
  movslq 0x1c(%rsp),%rax
  cmp    %rbx,%r14
  je     L165
  movzbl (%rbx),%ecx
  lea    0x1(%rax),%edx
  mov    %edx,0x1c(%rsp)
  mov    %cl,0x24(%rsp,%rax,1)
  cmp    $0x3,%edx
  jne    L24
  lea    0x24(%rsp),%r11
  mov    0x4(%rsp),%r9d
  mov    (%rsp),%r8d
  mov    %rbp,%rdi
  mov    0x8(%rsp),%rcx
  lea    0x1c(%rsp),%rdx
  mov    %r11,%rsi
  call   <encode_base64@plt>
  add    %rax,%rbp
  sub    %rax,%r13
  jmp    L24
  nopl   (%rax)
L165:
  test   %eax,%eax
  je     L149
  cmp    $0x2,%eax
  jg     L153
  mov    $0x2,%edx
  lea    0x24(%rsp),%r11
  xor    %esi,%esi
  sub    %eax,%edx
  lea    (%r11,%rax,1),%rdi
  mov    %r11,0x8(%rsp)
  add    $0x1,%rdx
  call   <memset@plt>
  mov    0x8(%rsp),%r11
L35:
  mov    0x4(%rsp),%r9d
  mov    (%rsp),%r8d
  mov    %rbp,%rdi
  mov    %r11,%rsi
  lea    0x20(%rsp),%rcx
  lea    0x1c(%rsp),%rdx
  call   <encode_base64@plt>
  add    %rax,%rbp
L149:
  movb   $0x0,0x0(%rbp)
  mov    %rbp,%rax
  sub    (%r15),%rax
L127:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L99:
  xor    %eax,%eax
  jmp    L127
  nopl   0x0(%rax)
L41:
  mov    $0x40,%edi
  mov    %rsi,0x8(%rsp)
  call   <malloc@plt>
  mov    %rax,(%r15)
  mov    %rax,%rbp
  test   %rax,%rax
  je     L99
  mov    0x8(%rsp),%rsi
  mov    $0x40,%r13d
  jmp    L70
L153:
  lea    0x24(%rsp),%r11
  jmp    L35
L0:
  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;
}
```