user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<wby_base64_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <wby_base64_bufsize@plt>
  cmp    %rax,-0x30(%rbp)
  jae    L99
  mov    $0x1,%eax
  jmp    L38
L80:
  mov    -0x38(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x10,%eax
  mov    %eax,-0x14(%rbp)
  addq   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jae    L33
  mov    -0x38(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  jmp    L5
L33:
  mov    $0x0,%eax
L5:
  or     %eax,-0x14(%rbp)
  addq   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jae    L75
  mov    -0x38(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  jmp    L19
L75:
  mov    $0x0,%eax
L19:
  or     %eax,-0x14(%rbp)
  addq   $0x1,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  shr    $0x12,%eax
  and    $0x3f,%eax
  mov    %eax,-0x10(%rbp)
  shll   $0x6,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  shr    $0x12,%eax
  and    $0x3f,%eax
  mov    %eax,-0xc(%rbp)
  shll   $0x6,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  shr    $0x12,%eax
  and    $0x3f,%eax
  mov    %eax,-0x1c(%rbp)
  shll   $0x6,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  shr    $0x12,%eax
  and    $0x3f,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x40(%rbp)
  jae    L45
  movl   $0x40,-0x1c(%rbp)
L45:
  mov    -0x8(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jbe    L84
  movl   $0x40,-0x18(%rbp)
L84:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0x10(%rbp),%edx
  lea    D24(%rip),%rcx
  movzbl (%rdx,%rcx,1),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0xc(%rbp),%edx
  lea    D24(%rip),%rcx
  movzbl (%rdx,%rcx,1),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0x1c(%rbp),%edx
  lea    D24(%rip),%rcx
  movzbl (%rdx,%rcx,1),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%edx
  lea    D24(%rip),%rcx
  movzbl (%rdx,%rcx,1),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x20(%rbp)
  cmpl   $0x13,-0x20(%rbp)
  jne    L99
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movb   $0xd,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movb   $0xa,(%rax)
L99:
  mov    -0x8(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L80
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
L38:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D24
type_infered: string

tool: D24: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=

assistant: ```c
int wby_base64_encode(char *output, unsigned long output_size, const unsigned char *input, unsigned long input_size) {
  unsigned long i = 0;
  int line_out = 0;
  static const char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                            "abcdefghijklmnopqrstuvwxyz"
                            "0123456789+/=";
  if (output_size < wby_base64_bufsize(input_size))
    return 1;
  while (i < input_size) {
    unsigned int idx_0, idx_1, idx_2, idx_3;
    unsigned int i0;
    i0 = (unsigned int)(input[i]) << 16;
    i++;
    i0 |= (unsigned int)(i < input_size ? input[i] : 0) << 8;
    i++;
    i0 |= (i < input_size ? input[i] : 0);
    i++;
    idx_0 = (i0 & 0xfc0000) >> 18;
    i0 <<= 6;
    idx_1 = (i0 & 0xfc0000) >> 18;
    i0 <<= 6;
    idx_2 = (i0 & 0xfc0000) >> 18;
    i0 <<= 6;
    idx_3 = (i0 & 0xfc0000) >> 18;
    if (i - 1 > input_size)
      idx_2 = 64;
    if (i > input_size)
      idx_3 = 64;
    *output++ = enc[idx_0];
    *output++ = enc[idx_1];
    *output++ = enc[idx_2];
    *output++ = enc[idx_3];
    if (++line_out == 19) {
      *output++ = '\r';
      *output++ = '\n';
    }
  }
  *output = '\0';
  return 0;
}
```