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

```asm
<base64_decode_onvif>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x44(%rbp),%edx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L16
L53:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D2(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0xffffffff,-0x1c(%rbp)
  je     L159
  cmpl   $0x3,-0x20(%rbp)
  je     L14
  cmpl   $0x3,-0x20(%rbp)
  jg     L48
  cmpl   $0x2,-0x20(%rbp)
  je     L71
  cmpl   $0x2,-0x20(%rbp)
  jg     L48
  cmpl   $0x0,-0x20(%rbp)
  je     L68
  cmpl   $0x1,-0x20(%rbp)
  je     L137
  jmp    L48
L68:
  addl   $0x1,-0x20(%rbp)
  jmp    L48
L137:
  mov    -0x24(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  sar    $0x4,%eax
  and    $0x3,%eax
  or     %edx,%eax
  mov    %al,-0x25(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x20(%rbp)
  jmp    L48
L71:
  mov    -0x24(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  sar    $0x2,%eax
  and    $0xf,%eax
  or     %edx,%eax
  mov    %al,-0x25(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x20(%rbp)
  jmp    L48
L14:
  mov    -0x24(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x25(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl -0x25(%rbp),%edx
  mov    %dl,(%rax)
  movl   $0x0,-0x20(%rbp)
  nop
L48:
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
L159:
  addq   $0x1,-0x18(%rbp)
L16:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L64
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L53
L64:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L21
  mov    -0x10(%rbp),%rax
  sub    -0x40(%rbp),%rax
  jmp    L39
L21:
  mov    $0xffffffff,%eax
L39:
  pop    %rbp
  ret
```

assistant: ```c
int base64_decode_onvif(const char *source, unsigned char *target, unsigned int targetlen) {
  const char *cur;
  unsigned char *dest, *max_dest;
  int d, dlast, phase;
  unsigned char c;
  static int table[256] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
  d = dlast = phase = 0;
  dest = target;
  max_dest = dest + targetlen;
  for (cur = source; *cur != '\0' && dest < max_dest; ++cur) {
    d = table[(int)*cur];
    if (d != -1) {
      switch (phase) {
      case 0:
        ++phase;
        break;
      case 1:
        c = ((dlast << 2) | ((d & 0x30) >> 4));
        *dest++ = c;
        ++phase;
        break;
      case 2:
        c = (((dlast & 0xf) << 4) | ((d & 0x3c) >> 2));
        *dest++ = c;
        ++phase;
        break;
      case 3:
        c = (((dlast & 0x03) << 6) | d);
        *dest++ = c;
        phase = 0;
        break;
      }
      dlast = d;
    }
  }
  if (*cur == '\0') {
    return dest - target;
  }
  return -1;
}
```