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

```asm
<decode_base64>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x10(%rsp)
  test   %rsi,%rsi
  je     L148
  cmpb   $0x0,(%rsi)
  mov    %rsi,%rbx
  jne    L175
L148:
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L175:
  mov    %rsi,%rdi
  xor    %ebp,%ebp
  call   <strlen@plt>
  mov    $0x1,%esi
  lea    0x1(%rax),%edi
  call   <calloc@plt>
  movsbl (%rbx),%edi
  mov    %rax,0x18(%rsp)
  test   %dil,%dil
  je     L171
  nopl   0x0(%rax,%rax,1)
L180:
  call   <is_base64@plt>
  test   %rax,%rax
  je     L72
L37:
  movzbl (%rbx),%eax
  mov    0x18(%rsp),%rcx
  add    $0x1,%rbx
  lea    0x1(%rbp),%r13d
  mov    %al,(%rcx,%rbp,1)
  movsbl (%rbx),%edi
  test   %dil,%dil
  je     L196
  movslq %r13d,%rbp
  call   <is_base64@plt>
  test   %rax,%rax
  jne    L37
L72:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L180
  test   %ebp,%ebp
  je     L171
  mov    %ebp,%r13d
L196:
  lea    -0x1(%r13),%eax
  mov    0x18(%rsp),%r15
  mov    0x10(%rsp),%rbp
  mov    $0x1,%r14d
  and    $0xfffffffc,%eax
  add    $0x5,%eax
  mov    %eax,0xc(%rsp)
  jmp    L19
  nopl   (%rax)
L111:
  movsbl 0x2(%r15),%r8d
  lea    0x2(%r14),%eax
  mov    %r8d,%r10d
  cmp    %eax,%r13d
  jle    L99
L38:
  movsbl 0x3(%r15),%r11d
  mov    %r11d,%r9d
L160:
  mov    %r9b,0x7(%rsp)
  mov    %r10b,0x6(%rsp)
  mov    %r11d,0x8(%rsp)
  mov    %r8d,(%rsp)
  call   <decode@plt>
  mov    %r12d,%edi
  mov    %eax,%ebx
  call   <decode@plt>
  mov    (%rsp),%edi
  shl    $0x2,%ebx
  mov    %eax,%r12d
  call   <decode@plt>
  mov    0x8(%rsp),%edi
  mov    %al,(%rsp)
  call   <decode@plt>
  movzbl 0x6(%rsp),%r10d
  mov    %r12d,%edi
  movzbl (%rsp),%edx
  shr    $0x4,%dil
  movzbl 0x7(%rsp),%r9d
  or     %edi,%ebx
  cmp    $0x3d,%r10b
  mov    %bl,0x0(%rbp)
  je     L54
  mov    %edx,%edi
  shl    $0x4,%r12d
  add    $0x2,%rbp
  shr    $0x2,%dil
  or     %edi,%r12d
  mov    %r12b,-0x1(%rbp)
L22:
  cmp    $0x3d,%r9b
  je     L45
  shl    $0x6,%edx
  add    $0x1,%rbp
  or     %eax,%edx
  mov    %dl,-0x1(%rbp)
L45:
  add    $0x4,%r15
  add    $0x4,%r14d
  cmp    %r14d,0xc(%rsp)
  je     L83
L19:
  movsbl (%r15),%edi
  mov    $0x41,%r12d
  cmp    %r14d,%r13d
  jle    L149
  movsbl 0x1(%r15),%r12d
L149:
  lea    0x1(%r14),%eax
  cmp    %eax,%r13d
  jg     L111
  lea    0x2(%r14),%eax
  mov    $0x41,%r8d
  mov    $0x41,%r10d
  cmp    %eax,%r13d
  jg     L38
L99:
  mov    $0x41,%r11d
  mov    $0x41,%r9d
  jmp    L160
L54:
  add    $0x1,%rbp
  jmp    L22
  cs nopw 0x0(%rax,%rax,1)
L83:
  mov    %ebp,%r12d
  sub    0x10(%rsp),%r12d
L138:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  jmp    L148
  nopw   0x0(%rax,%rax,1)
L171:
  xor    %r12d,%r12d
  jmp    L138
```

assistant: ```c
int decode_base64(unsigned char *dest, const char *src) {
  if (src && *src) {
    unsigned char *p = dest;
    int k, l = strlen(src) + 1;
    unsigned char *buf = calloc(l, sizeof(unsigned char));
    for (k = 0, l = 0; src[k]; k++) {
      if (is_base64(src[k])) {
        buf[l++] = src[k];
      }
    }
    for (k = 0; k < l; k += 4) {
      char c1 = 'A', c2 = 'A', c3 = 'A', c4 = 'A';
      unsigned char b1 = 0, b2 = 0, b3 = 0, b4 = 0;
      c1 = buf[k];
      if (k + 1 < l) {
        c2 = buf[k + 1];
      }
      if (k + 2 < l) {
        c3 = buf[k + 2];
      }
      if (k + 3 < l) {
        c4 = buf[k + 3];
      }
      b1 = decode(c1);
      b2 = decode(c2);
      b3 = decode(c3);
      b4 = decode(c4);
      *p++ = ((b1 << 2) | (b2 >> 4));
      if (c3 != '=') {
        *p++ = (((b2 & 0xf) << 4) | (b3 >> 2));
      }
      if (c4 != '=') {
        *p++ = (((b3 & 0x3) << 6) | b4);
      }
    }
    free(buf);
    return (p - dest);
  }
  return 0;
}
```