user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<cbbaseencode>:
  endbr64
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  call   <assert@plt>
  test   %ebp,%ebp
  js     L33
L105:
  lea    0x8(,%rbp,4),%eax
  movslq %eax,%rdi
  sar    $0x1f,%eax
  imul   $0x55555556,%rdi,%rdi
  shr    $0x20,%rdi
  sub    %eax,%edi
  add    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L68
L11:
  mov    %r12,%rax
  test   %ebp,%ebp
  jle    L37
  xor    %ecx,%ecx
  lea    D3(%rip),%rsi
  jmp    L14
  xchg   %ax,%ax
L75:
  mov    %dl,-0x4(%rax)
  movzbl (%rbx),%edx
  movzbl 0x1(%rbx),%edi
  shl    $0x4,%edx
  shr    $0x4,%dil
  and    $0x30,%edx
  add    %rdi,%rdx
  and    $0x7f,%edx
  movzbl (%rsi,%rdx,1),%edx
  mov    %dl,-0x3(%rax)
  movzbl 0x1(%rbx),%edx
  movzbl 0x2(%rbx),%edi
  shl    $0x2,%edx
  and    $0x3c,%edx
  shr    $0x6,%dil
  add    %rdi,%rdx
  and    $0x7f,%edx
  movzbl (%rsi,%rdx,1),%edx
  mov    %dl,-0x2(%rax)
  movzbl 0x2(%rbx),%edx
  and    $0x3f,%edx
  movzbl (%rsi,%rdx,1),%edx
L80:
  add    $0x3,%ecx
  mov    %dl,-0x1(%rax)
  add    $0x3,%rbx
  cmp    %ecx,%ebp
  jle    L37
L14:
  movzbl (%rbx),%edx
  mov    %ebp,%edi
  add    $0x4,%rax
  sub    %ecx,%edi
  shr    $0x2,%dl
  movzbl %dl,%edx
  movzbl (%rsi,%rdx,1),%edx
  cmp    $0x1,%edi
  je     L95
  cmp    $0x2,%edi
  jne    L75
  mov    %dl,-0x4(%rax)
  movzbl (%rbx),%edx
  add    $0x3,%ecx
  add    $0x3,%rbx
  movzbl -0x2(%rbx),%edi
  shl    $0x4,%edx
  and    $0x30,%edx
  shr    $0x4,%dil
  add    %rdi,%rdx
  and    $0x7f,%edx
  movzbl (%rsi,%rdx,1),%edx
  mov    %dl,-0x3(%rax)
  movzbl -0x2(%rbx),%edx
  shl    $0x2,%edx
  and    $0x3c,%edx
  movzbl (%rsi,%rdx,1),%edx
  mov    %dl,-0x2(%rax)
  mov    $0x3d,%edx
  mov    %dl,-0x1(%rax)
  cmp    %ecx,%ebp
  jg     L14
L37:
  movb   $0x0,(%rax)
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L95:
  mov    %dl,-0x4(%rax)
  movzbl (%rbx),%edx
  movb   $0x3d,-0x2(%rax)
  shl    $0x4,%edx
  and    $0x30,%edx
  movzbl (%rsi,%rdx,1),%edx
  mov    %dl,-0x3(%rax)
  mov    $0x3d,%edx
  jmp    L80
  nopl   0x0(%rax)
L33:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  jmp    L105
  nopw   0x0(%rax,%rax,1)
L68:
  lea    D5(%rip),%rdi
  call   <cbmyfatal@plt>
  jmp    L11
```

tool_calls: name: retrieve_data
arguments: data_tag: D3
datatype: string
name: retrieve_data
arguments: data_tag: D5
datatype: string

tool: D3: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

tool: D5: out of memory

assistant: ```c
char *cbbaseencode(const char *ptr, int size) {
  char *tbl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  char *buf, *wp;
  const unsigned char *obj;
  int i;
  assert(ptr);
  if (size < 0)
    size = strlen(ptr);
  (((buf) = malloc(4 * (size + 2) / 3 + 1)) ? (buf) : cbmyfatal("out of memory"));
  obj = (const unsigned char *)ptr;
  wp = buf;
  for (i = 0; i < size; i += 3) {
    switch (size - i) {
    case 1:
      *wp++ = tbl[obj[0] >> 2];
      *wp++ = tbl[(obj[0] & 3) << 4];
      *wp++ = '=';
      *wp++ = '=';
      break;
    case 2:
      *wp++ = tbl[obj[0] >> 2];
      *wp++ = tbl[((obj[0] & 3) << 4) + (obj[1] >> 4)];
      *wp++ = tbl[(obj[1] & 0xf) << 2];
      *wp++ = '=';
      break;
    default:
      *wp++ = tbl[obj[0] >> 2];
      *wp++ = tbl[((obj[0] & 3) << 4) + (obj[1] >> 4)];
      *wp++ = tbl[((obj[1] & 0xf) << 2) + (obj[2] >> 6)];
      *wp++ = tbl[obj[2] & 0x3f];
      break;
    }
    obj += 3;
  }
  *wp = '\0';
  return buf;
}
```