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

```asm
<encode_base64>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,%r14d
  mov    %rdx,%r15
  mov    %esi,%r13d
  mov    $0xaaaaaaab,%eax
  imul   %rax,%r13
  shr    $0x21,%r13
  cmp    $0x2,%esi
  jbe    L36
  mov    %rdx,%rbp
  mov    %rdi,%rbx
  mov    $0x0,%r12d
L70:
  movzbl (%rbx),%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x0(%rbp)
  movzbl (%rbx),%edi
  shl    $0x4,%edi
  and    $0x30,%edi
  movzbl 0x1(%rbx),%eax
  shr    $0x4,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x1(%rbp)
  movzbl 0x1(%rbx),%edi
  shl    $0x2,%edi
  and    $0x3c,%edi
  movzbl 0x2(%rbx),%eax
  shr    $0x6,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x2(%rbp)
  movzbl 0x2(%rbx),%edi
  and    $0x3f,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x3(%rbp)
  add    $0x3,%rbx
  add    $0x4,%rbp
  add    $0x1,%r12d
  cmp    %r12d,%r13d
  ja     L70
  lea    -0x1(%r13),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,2),%rdx
  cmp    $0x2,%r14d
  mov    $0x3,%ecx
  cmovbe %rcx,%rdx
  add    %rdx,0x8(%rsp)
  shl    $0x2,%rax
  cmp    $0x2,%r14d
  mov    $0x4,%edx
  cmovbe %rdx,%rax
  add    %rax,%r15
L36:
  mov    %r14d,%eax
  mov    $0xaaaaaaab,%edx
  imul   %rdx,%rax
  shr    $0x21,%rax
  lea    (%rax,%rax,2),%edx
  mov    %r14d,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  je     L19
  cmp    $0x2,%eax
  je     L43
  test   %eax,%eax
  je     L42
L39:
  mov    %r14d,%edi
  call   <encode_base64_length@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L42:
  movb   $0x0,(%r15)
  jmp    L39
L19:
  mov    0x8(%rsp),%rbx
  movzbl (%rbx),%eax
  mov    %al,0x8(%rsp)
  mov    %eax,%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,(%r15)
  movzbl (%rbx),%edi
  shl    $0x4,%edi
  and    $0x30,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x1(%r15)
  movb   $0x3d,0x2(%r15)
  movb   $0x3d,0x3(%r15)
  movb   $0x0,0x4(%r15)
  jmp    L39
L43:
  mov    0x8(%rsp),%rbx
  movzbl (%rbx),%eax
  mov    %al,0x8(%rsp)
  mov    %eax,%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,(%r15)
  movzbl (%rbx),%edi
  shl    $0x4,%edi
  and    $0x30,%edi
  movzbl 0x1(%rbx),%eax
  mov    %al,0x8(%rsp)
  shr    $0x4,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x1(%r15)
  movzbl 0x1(%rbx),%edi
  shl    $0x2,%edi
  and    $0x3c,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x2(%r15)
  movb   $0x3d,0x3(%r15)
  movb   $0x0,0x4(%r15)
  jmp    L39
```

assistant: ```c
unsigned int encode_base64(unsigned char input[], unsigned int input_length, unsigned char output[]) {
  unsigned int full_sets = input_length / 3;
  for (unsigned int i = 0; i < full_sets; ++i) {
    output[0] = binary_to_base64(input[0] >> 2);
    output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4);
    output[2] = binary_to_base64((input[1] & 0x0F) << 2 | input[2] >> 6);
    output[3] = binary_to_base64(input[2] & 0x3F);
    input += 3;
    output += 4;
  }
  switch (input_length % 3) {
  case 0:
    output[0] = '\0';
    break;
  case 1:
    output[0] = binary_to_base64(input[0] >> 2);
    output[1] = binary_to_base64((input[0] & 0x03) << 4);
    output[2] = '=';
    output[3] = '=';
    output[4] = '\0';
    break;
  case 2:
    output[0] = binary_to_base64(input[0] >> 2);
    output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4);
    output[2] = binary_to_base64((input[1] & 0x0F) << 2);
    output[3] = '=';
    output[4] = '\0';
    break;
  }
  return encode_base64_length(input_length);
}
```