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

```asm
<base64_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r15
  test   %rdi,%rdi
  je     L128
  test   %rsi,%rsi
  je     L128
L42:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  lea    (%rax,%rax,2),%eax
  lea    0x3(%rax),%ebp
  test   %eax,%eax
  cmovns %eax,%ebp
  sar    $0x2,%ebp
  mov    %ebp,0x1c(%rsp)
  test   $0x3,%bl
  jne    L124
L50:
  cmpq   $0x0,(%r15)
  je     L120
L23:
  movslq %ebp,%rdx
  mov    (%r15),%rdi
  mov    $0x0,%esi
  call   <memset@plt>
  movslq %ebx,%rax
  cmpb   $0x3d,-0x2(%r12,%rax,1)
  je     L70
L99:
  cmpb   $0x3d,-0x1(%r12,%rax,1)
  je     L69
L115:
  cmp    $0x3,%ebx
  jle    L24
  lea    -0x4(%rbx),%eax
  shr    $0x2,%eax
  add    $0x1,%eax
  mov    %eax,%eax
  lea    (%rax,%rax,2),%rax
  mov    %rax,0x10(%rsp)
  mov    $0x0,%r14d
  mov    $0x0,%ebx
L5:
  movzbl 0x1(%r12),%eax
  mov    %al,0x18(%rsp)
  movzbl 0x2(%r12),%ebp
  cmp    $0x3d,%bpl
  cmove  %ebx,%ebp
  movzbl 0x3(%r12),%r13d
  cmp    $0x3d,%r13b
  cmove  %ebx,%r13d
  movzbl (%r12),%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    %eax,0xc(%rsp)
  movzbl 0x18(%rsp),%esi
  mov    %esi,0x18(%rsp)
  mov    %esi,%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    (%r15),%rdx
  sar    $0x4,%eax
  movzbl 0xc(%rsp),%ecx
  lea    (%rax,%rcx,4),%eax
  mov    %al,(%rdx,%r14,1)
  mov    0x18(%rsp),%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    %eax,0xc(%rsp)
  movzbl %bpl,%ebp
  mov    %ebp,%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    (%r15),%rcx
  mov    0xc(%rsp),%edx
  shl    $0x4,%edx
  sar    $0x2,%eax
  add    %eax,%edx
  mov    %dl,0x1(%rcx,%r14,1)
  mov    %ebp,%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    %eax,%ebp
  movzbl %r13b,%edi
  mov    %ebx,%eax
  call   <b64toi@plt>
  mov    (%r15),%rdx
  shl    $0x6,%ebp
  add    %eax,%ebp
  mov    %bpl,0x2(%rdx,%r14,1)
  add    $0x4,%r12
  add    $0x3,%r14
  cmp    0x10(%rsp),%r14
  jne    L5
L24:
  mov    0x1c(%rsp),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L128:
  mov    $0xfffffcff,%ecx
  mov    $0x39,%edx
  lea    D36(%rip),%rsi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <exit_on_error_m@plt>
  jmp    L42
L124:
  mov    $0xfffffcff,%ecx
  mov    $0x41,%edx
  lea    D36(%rip),%rsi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <exit_on_error_m@plt>
  jmp    L50
L120:
  movslq %ebp,%rdi
  call   <malloc@plt>
  mov    %rax,(%r15)
  jmp    L23
L70:
  lea    -0x1(%rbp),%esi
  mov    %esi,0x1c(%rsp)
  jmp    L99
L69:
  subl   $0x1,0x1c(%rsp)
  jmp    L115
```

tool_calls: name: parse_data
arguments: data_label: D36
datatype: string
name: parse_data
arguments: data_label: D9
datatype: string

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