user: 请从给定的汇编指令推导出C源代码:

```asm
<b64_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  lea    D0(%rip),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L46
L8:
  movl   $0x1,-0x2c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  sar    $0x2,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x4,%eax
  and    $0x30,%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x40,-0x24(%rbp)
  movl   $0x40,-0x20(%rbp)
  cmpq   $0x4,-0x50(%rbp)
  ja     L27
  mov    $0xffffffff,%eax
  jmp    L17
L27:
  cmpq   $0x1,-0x40(%rbp)
  jbe    L59
  addl   $0x1,-0x2c(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  sar    $0x4,%eax
  add    %eax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  and    $0x3c,%eax
  mov    %eax,-0x24(%rbp)
  cmpq   $0x2,-0x40(%rbp)
  jbe    L59
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  sar    $0x6,%eax
  add    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  and    $0x3f,%eax
  mov    %eax,-0x20(%rbp)
  addl   $0x1,-0x2c(%rbp)
L59:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x18(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  sub    %rax,-0x40(%rbp)
  subq   $0x4,-0x50(%rbp)
L46:
  cmpq   $0x0,-0x40(%rbp)
  jne    L8
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  sub    -0x48(%rbp),%rax
  sub    $0x1,%eax
L17:
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D0
type_infered: string

tool: D0: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=

assistant: ```c
int b64_encode(const void *src, size_t srclen, void *dest, size_t destsize) {
  char *Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  const uint8_t *input = src;
  char *output = dest;
  while (srclen > 0) {
    int skip = 1;
    int i0 = input[0] >> 2;
    int i1 = (input[0] & 0x3) << 4;
    int i2 = 64;
    int i3 = 64;
    if (destsize < 5)
      return -1;
    if (srclen > 1) {
      skip++;
      i1 += input[1] >> 4;
      i2 = (input[1] & 0xF) << 2;
      if (srclen > 2) {
        i2 += input[2] >> 6;
        i3 = input[2] & 0x3F;
        skip++;
      }
    }
    *output++ = Base64[i0];
    *output++ = Base64[i1];
    *output++ = Base64[i2];
    *output++ = Base64[i3];
    input += skip;
    srclen -= skip;
    destsize -= 4;
  }
  *output++ = 0;
  return output - (char *)dest - 1;
}
```