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

```asm
<base64_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x1,-0x38(%rbp)
  jne    L91
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <base64_encode_one@plt>
  jmp    L77
L91:
  cmpq   $0x2,-0x38(%rbp)
  jne    L55
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <base64_encode_two@plt>
  jmp    L77
L55:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x38(%rbp),%rcx
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  mov    %rax,%rdx
  add    %rdx,%rdx
  add    %rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  test   %rax,%rax
  je     L25
  mov    -0x38(%rbp),%rcx
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mov    %rcx,%rax
  mul    %rdx
  shr    %rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  sub    %rax,%rcx
  mov    %rcx,%rdx
  mov    -0x38(%rbp),%rax
  sub    %rdx,%rax
  add    $0x3,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rcx
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  mov    %rax,%rdx
  add    %rdx,%rdx
  add    %rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  mov    %eax,%edx
  mov    $0x3,%eax
  sub    %edx,%eax
  mov    %eax,-0x20(%rbp)
L25:
  movw   $0x0,-0xb(%rbp)
  movb   $0x0,-0x9(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L41
L82:
  mov    -0x1c(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  shl    $0x2,%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <base64_encode_chunk@plt>
  addl   $0x1,-0x1c(%rbp)
L41:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  sub    $0x1,%rax
  cmp    %rax,%rcx
  jb     L82
  mov    -0x38(%rbp),%rax
  sub    -0x18(%rbp),%rax
  lea    0x3(%rax),%rsi
  mov    -0x18(%rbp),%rax
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mul    %rdx
  shr    %rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  lea    -0x3(%rax),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0xb(%rbp),%rax
  mov    %rsi,%rdx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%rax
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  sub    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  lea    -0xb(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <base64_encode_chunk@plt>
  cmpl   $0x0,-0x20(%rbp)
  je     L79
  mov    -0x18(%rbp),%rax
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  shl    $0x2,%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x3d,(%rax)
  cmpl   $0x2,-0x20(%rbp)
  jne    L79
  mov    -0x18(%rbp),%rax
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    %rax
  shl    $0x2,%rax
  lea    -0x2(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x3d,(%rax)
L79:
  mov    $0x0,%eax
L77:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
int base64_encode(char *out, const char *in, size_t size) {
  if (size == 1) {
    return base64_encode_one(out, in);
  }
  if (size == 2) {
    return base64_encode_two(out, in);
  }
  size_t size_ = size;
  int padding = 0;
  if (size % 3) {
    size_ = (size + (3 - (size % 3)));
    padding = (size + (3 - (size % 3))) - size;
  }
  int i;
  char last_bytes[3] = {0, 0, 0};
  for (i = 0; i < (size_ / 3) - 1; ++i) {
    base64_encode_chunk(out + (i * 4), in + (i * 3));
  }
  memcpy(last_bytes, in + (3 * ((size_ / 3) - 1)), 3 - (size_ - size));
  base64_encode_chunk(out + (4 * ((size_ / 3) - 1)), last_bytes);
  if (padding) {
    out[((size_ / 3) * 4) - 1] = '=';
    if (padding == 2) {
      out[((size_ / 3) * 4) - 2] = '=';
    }
  }
  return 0;
}
```