user: What is the c source code of the assembly code below?

```asm
<cbbaseencode>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %esi,%ebp
  call   <assert@plt>
  test   %ebp,%ebp
  js     L63
L41:
  lea    0x8(,%rbp,4),%eax
  movslq %eax,%rdi
  imul   $0x55555556,%rdi,%rdi
  shr    $0x20,%rdi
  sar    $0x1f,%eax
  sub    %eax,%edi
  add    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L76
L106:
  test   %ebp,%ebp
  jle    L87
  lea    0x4(%r12),%rax
  mov    $0x0,%edx
  lea    D4(%rip),%rcx
  mov    $0x3d,%edi
  jmp    L44
L63:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  jmp    L41
L76:
  lea    D3(%rip),%rdi
  call   <cbmyfatal@plt>
  jmp    L106
L78:
  mov    %rax,%r8
  movzbl (%rbx),%esi
  shr    $0x2,%sil
  movzbl %sil,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x4(%rax)
  movzbl (%rbx),%esi
  shl    $0x4,%esi
  and    $0x30,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x3(%rax)
  movb   $0x3d,-0x2(%rax)
  mov    %edi,%esi
L37:
  mov    %sil,-0x1(%rax)
  add    $0x3,%rbx
  add    $0x3,%edx
  add    $0x4,%rax
  cmp    %edx,%ebp
  jle    L45
L44:
  mov    %ebp,%esi
  sub    %edx,%esi
  cmp    $0x1,%esi
  je     L78
  cmp    $0x2,%esi
  je     L101
  mov    %rax,%r8
  movzbl (%rbx),%esi
  shr    $0x2,%sil
  movzbl %sil,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x4(%rax)
  movzbl (%rbx),%esi
  shl    $0x4,%esi
  and    $0x30,%esi
  movzbl 0x1(%rbx),%r9d
  shr    $0x4,%r9b
  lea    (%r9,%rsi,1),%rsi
  and    $0x7f,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x3(%rax)
  movzbl 0x1(%rbx),%esi
  shl    $0x2,%esi
  and    $0x3c,%esi
  movzbl 0x2(%rbx),%r9d
  shr    $0x6,%r9b
  lea    (%r9,%rsi,1),%rsi
  and    $0x7f,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x2(%rax)
  movzbl 0x2(%rbx),%esi
  and    $0x3f,%esi
  movzbl (%rcx,%rsi,1),%esi
  jmp    L37
L101:
  mov    %rax,%r8
  movzbl (%rbx),%esi
  shr    $0x2,%sil
  movzbl %sil,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x4(%rax)
  movzbl (%rbx),%esi
  shl    $0x4,%esi
  and    $0x30,%esi
  movzbl 0x1(%rbx),%r9d
  shr    $0x4,%r9b
  lea    (%r9,%rsi,1),%rsi
  and    $0x7f,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x3(%rax)
  movzbl 0x1(%rbx),%esi
  shl    $0x2,%esi
  and    $0x3c,%esi
  movzbl (%rcx,%rsi,1),%esi
  mov    %sil,-0x2(%rax)
  mov    %edi,%esi
  jmp    L37
L87:
  mov    %r12,%r8
L45:
  movb   $0x0,(%r8)
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: tag: D4
datatype: string
name: unpack_data
arguments: tag: D3
datatype: string

tool: D4: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

tool: D3: 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;
}
```