user: Translate the below assembly code into C programming language:

```asm
<base64_encode>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%rdx
  je     L108
  mov    %rdx,%rcx
  cmp    $0x2,%rdx
  je     L7
  movabs $0xaaaaaaaaaaaaaaab,%rsi
  mov    %rdx,%rax
  mov    %rcx,%r12
  mul    %rsi
  shr    %rdx
  lea    (%rdx,%rdx,2),%rax
  sub    %rax,%r12
  jne    L59
  xor    %eax,%eax
  movb   $0x0,0x27(%rsp)
  mov    $0x3,%r12d
  mov    %ax,0x25(%rsp)
  mov    %rdx,%rax
  sub    $0x1,%rax
  mov    %rdx,(%rsp)
  movl   $0x0,0xc(%rsp)
  mov    %rax,0x10(%rsp)
  je     L67
L26:
  mov    (%rsp),%rax
  mov    %r14,%rbx
  mov    %r13,%r15
  lea    (%rax,%rax,2),%rax
  mov    %rax,0x18(%rsp)
  lea    -0x3(%r13,%rax,1),%rbp
  nopw   0x0(%rax,%rax,1)
L68:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  add    $0x3,%r15
  add    $0x4,%rbx
  call   <base64_encode_chunk@plt>
  cmp    %r15,%rbp
  jne    L68
  mov    0x10(%rsp),%rax
  lea    0x25(%rsp),%rbp
  mov    %r12,%rdx
  mov    %rbp,%rdi
  lea    (%r14,%rax,4),%r8
  mov    0x18(%rsp),%rax
  mov    %r8,0x10(%rsp)
  lea    -0x3(%r13,%rax,1),%rsi
  call   <memcpy@plt>
  mov    0x10(%rsp),%rdi
  mov    %rbp,%rsi
  call   <base64_encode_chunk@plt>
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  je     L97
L32:
  mov    (%rsp),%rbx
  shl    $0x2,%rbx
  cmpl   $0x2,0xc(%rsp)
  movb   $0x3d,-0x1(%r14,%rbx,1)
  jne    L97
  movb   $0x3d,-0x2(%r14,%rbx,1)
L97:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L63
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L59:
  lea    0x3(%rcx),%rdx
  mov    $0x3,%eax
  xor    %edi,%edi
  movb   $0x0,0x27(%rsp)
  mov    %rdx,%rcx
  sub    %r12d,%eax
  mov    %di,0x25(%rsp)
  sub    %r12,%rcx
  mov    %eax,0xc(%rsp)
  mov    %rcx,%rax
  mul    %rsi
  shr    %rdx
  mov    %rdx,(%rsp)
  sub    $0x1,%rdx
  mov    %rdx,0x10(%rsp)
  jne    L26
  lea    0x25(%rsp),%rbp
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <base64_encode_chunk@plt>
  movq   $0x1,(%rsp)
  jmp    L32
  nopl   0x0(%rax)
L108:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L63
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10d0 <base64_encode_one@plt>
  nopl   0x0(%rax,%rax,1)
L7:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L63
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10c0 <base64_encode_two@plt>
L67:
  lea    0x25(%rsp),%rbp
  mov    %r13,%rsi
  mov    $0x3,%edx
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <base64_encode_chunk@plt>
  jmp    L97
L63:
  call   <__stack_chk_fail@plt>
```

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;
}
```