user: Please show me the C implementation that matches the assembly code listed below:

```asm
<base64_decode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L29
  cmpq   $0x0,-0x40(%rbp)
  jne    L90
L29:
  mov    $0xfffffcff,%ecx
  mov    $0x39,%edx
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <exit_on_error_m@plt>
L90:
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x14(%rbp),%eax
  and    $0x3,%eax
  test   %eax,%eax
  je     L28
  mov    $0xfffffcff,%ecx
  mov    $0x41,%edx
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <exit_on_error_m@plt>
L28:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L102
  mov    -0x18(%rbp),%eax
  cltq
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
L102:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  jne    L81
  subl   $0x1,-0x18(%rbp)
L81:
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  jne    L92
  subl   $0x1,-0x18(%rbp)
  jmp    L92
L94:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x24(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x23(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  je     L58
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  jmp    L106
L58:
  mov    $0x0,%eax
L106:
  mov    %al,-0x22(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  je     L1
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  jmp    L114
L1:
  mov    $0x0,%eax
L114:
  mov    %al,-0x21(%rbp)
  movzbl -0x24(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  lea    0x0(,%rax,4),%ebx
  movzbl -0x23(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  sar    $0x4,%eax
  mov    %eax,%ecx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    (%rbx,%rcx,1),%edx
  mov    %dl,(%rax)
  movzbl -0x23(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  shl    $0x4,%eax
  and    $0xfffffff0,%eax
  mov    %eax,%ebx
  movzbl -0x22(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  sar    $0x2,%eax
  mov    %eax,%ecx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rdx,%rax
  lea    (%rbx,%rcx,1),%edx
  mov    %dl,(%rax)
  movzbl -0x22(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  shl    $0x6,%eax
  and    $0xffffffc0,%eax
  mov    %eax,%ebx
  movzbl -0x21(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <b64toi@plt>
  mov    %eax,%ecx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x2,%rax
  add    %rdx,%rax
  lea    (%rbx,%rcx,1),%edx
  mov    %dl,(%rax)
  addl   $0x4,-0x20(%rbp)
  addl   $0x3,-0x1c(%rbp)
L92:
  mov    -0x14(%rbp),%eax
  sub    $0x3,%eax
  cmp    %eax,-0x20(%rbp)
  jl     L94
  mov    -0x18(%rbp),%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D33
type: string
name: read_data
arguments: tag: D9
type: string

tool: D33: base64_decode

tool: D9: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aozkesek/c_cplusplus/refs/heads/master/liblicense/base64.c

assistant: ```c
int base64_decode(const unsigned char *source, unsigned char **target) {
  if (!source || !target)
    exit_on_error_m("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aozkesek/c_cplusplus/refs/heads/master/liblicense/base64.c", __FUNCTION__, 57, -0x0301);
  int i = 0, j = 0, slen = strlen((const char *)source), tlen = (slen * 3 / 4);
  if (slen % 4)
    exit_on_error_m("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aozkesek/c_cplusplus/refs/heads/master/liblicense/base64.c", __FUNCTION__, 65, -0x0301);
  if (!(*target))
    *target = malloc(tlen);
  memset(*target, 0, tlen);
  if (source[slen - 2] == '=')
    tlen--;
  if (source[slen - 1] == '=')
    tlen--;
  while (i <= slen - 4) {
    unsigned char b0 = source[i], b1 = source[i + 1], b2 = source[i + 2] == '=' ? 0 : source[i + 2], b3 = source[i + 3] == '=' ? 0 : source[i + 3];
    (*target)[j] = (b64toi(b0) << 2) + (b64toi(b1) >> 4);
    (*target)[j + 1] = ((b64toi(b1) & 0xf) << 4) + (b64toi(b2) >> 2);
    (*target)[j + 2] = ((b64toi(b2) & 0x3) << 6) + b64toi(b3);
    i += 4;
    j += 3;
  }
  return tlen;
}
```