user: 请将以下的汇编代码转换成C语言代码：

```asm
<encode_base64>:
  endbr64
  push   %r15
  mov    %esi,%eax
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rax,%r13
  push   %r12
  push   %rbp
  mov    $0xaaaaaaab,%ebp
  push   %rbx
  imul   %rax,%rbp
  sub    $0x18,%rsp
  shr    $0x21,%rbp
  mov    %rdx,(%rsp)
  mov    %rax,0x8(%rsp)
  cmp    $0x2,%eax
  jbe    L33
  mov    %rdx,%rbx
  mov    %rdi,%r14
  xor    %r12d,%r12d
  nopw   0x0(%rax,%rax,1)
L37:
  movzbl (%r14),%edi
  add    $0x1,%r12d
  add    $0x3,%r14
  add    $0x4,%rbx
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,-0x4(%rbx)
  movzbl -0x3(%r14),%edi
  movzbl -0x2(%r14),%eax
  shl    $0x4,%edi
  shr    $0x4,%al
  and    $0x30,%edi
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,-0x3(%rbx)
  movzbl -0x2(%r14),%edi
  movzbl -0x1(%r14),%eax
  shl    $0x2,%edi
  shr    $0x6,%al
  and    $0x3c,%edi
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,-0x2(%rbx)
  movzbl -0x1(%r14),%edi
  and    $0x3f,%edi
  call   <binary_to_base64@plt>
  mov    %al,-0x1(%rbx)
  cmp    %r12d,%ebp
  ja     L37
  lea    -0x1(%rbp),%eax
  mov    $0x3,%ecx
  add    $0x1,%rax
  cmp    $0x2,%r13d
  lea    (%rax,%rax,2),%rdx
  cmovbe %rcx,%rdx
  shl    $0x2,%rax
  add    %rdx,%r15
  cmp    $0x2,%r13d
  mov    $0x4,%edx
  cmovbe %rdx,%rax
  add    %rax,(%rsp)
L33:
  mov    0x8(%rsp),%r12
  mov    $0xaaaaaaab,%eax
  imul   %rax,%r12
  shr    $0x21,%r12
  lea    (%r12,%r12,2),%eax
  mov    %r13d,%r12d
  sub    %eax,%r12d
  cmp    $0x1,%r12d
  je     L49
  cmp    $0x2,%r12d
  je     L19
  mov    (%rsp),%rax
  movb   $0x0,(%rax)
L30:
  add    $0x18,%rsp
  mov    %r13d,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <encode_base64_length@plt>
  nopl   0x0(%rax)
L49:
  movzbl (%r15),%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    (%rsp),%rbx
  mov    %al,(%rbx)
  movzbl (%r15),%edi
  shl    $0x4,%edi
  and    $0x30,%edi
  call   <binary_to_base64@plt>
  mov    $0x3d3d,%edx
  movb   $0x0,0x4(%rbx)
  mov    %al,0x1(%rbx)
  mov    %dx,0x2(%rbx)
  jmp    L30
L19:
  movzbl (%r15),%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    (%rsp),%rbx
  mov    %al,(%rbx)
  movzbl (%r15),%edi
  movzbl 0x1(%r15),%eax
  shl    $0x4,%edi
  shr    $0x4,%al
  and    $0x30,%edi
  or     %eax,%edi
  movzbl %dil,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x1(%rbx)
  movzbl 0x1(%r15),%edi
  shl    $0x2,%edi
  and    $0x3c,%edi
  call   <binary_to_base64@plt>
  mov    %al,0x2(%rbx)
  mov    $0x3d,%eax
  mov    %ax,0x3(%rbx)
  jmp    L30
```

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