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

```asm
<base64_decode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  jmp    L41
L125:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L108
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jg     L108
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  sub    $0x41,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L193
L108:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L97
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jg     L97
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  sub    $0x47,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L193
L97:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L176
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L176
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  add    $0x4,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L193
L176:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L116
  mov    -0x18(%rbp),%rax
  movb   $0x3e,(%rax)
  jmp    L193
L116:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L127
  mov    -0x18(%rbp),%rax
  movb   $0x3f,(%rax)
  jmp    L193
L127:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  jne    L221
  mov    -0x18(%rbp),%rax
  movb   $0xff,(%rax)
  jmp    L193
L221:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L193:
  addq   $0x1,-0x10(%rbp)
  addq   $0x1,-0x18(%rbp)
L41:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L125
  movl   $0x0,-0x28(%rbp)
  jmp    L174
L142:
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x2,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x3(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x4,-0x28(%rbp)
L174:
  mov    -0x24(%rbp),%eax
  sub    $0x4,%eax
  cmp    %eax,-0x28(%rbp)
  jl     L142
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  je     L87
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x2,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x3(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L64
L87:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  je     L204
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x2,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  shl    $0x6,%eax
  mov    %eax,%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L64
L204:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  je     L37
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  sar    $0x4,%al
  lea    (%rdx,%rax,1),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  shl    $0x4,%eax
  mov    %eax,%ecx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L64
L37:
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L64:
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x24(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    %eax,%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D5
type: string
name: parse_data
arguments: data_label: D2
type: string

tool: D5: 
%c:Not a valid base64 string


tool: D2: Not a valid base64 string

assistant: ```c
void base64_decode(char *src, char *dst, int *decode_len) {
  char *q = malloc(strlen(src) + 1);
  char *p = dst;
  char *temp = q;
  char *s = src;
  int len = strlen(src), i;
  memset(q, 0, strlen(src) + 1);
  while (*s) {
    if (*s >= 'A' && *s <= 'Z')
      *temp = *s - 'A';
    else if (*s >= 'a' && *s <= 'z')
      *temp = *s - 'a' + 26;
    else if (*s >= '0' && *s <= '9')
      *temp = *s - '0' + 52;
    else if (*s == '+')
      *temp = 62;
    else if (*s == '/')
      *temp = 63;
    else if (*s == '=')
      *temp = -1;
    else {
      printf("\n%c:Not a valid base64 string\n", *s);
      exit(0);
    }
    ++s;
    ++temp;
  }
  for (i = 0; i < len - 4; i += 4) {
    *p++ = (*(q + i) << 2) + (*(q + i + 1) >> 4);
    *p++ = (*(q + i + 1) << 4) + (*(q + i + 2) >> 2);
    *p++ = (*(q + i + 2) << 6) + (*(q + i + 3));
  }
  if (*(q + i + 3) != -1) {
    *p++ = (*(q + i) << 2) + (*(q + i + 1) >> 4);
    *p++ = (*(q + i + 1) << 4) + (*(q + i + 2) >> 2);
    *p++ = (*(q + i + 2) << 6) + *(q + i + 3);
  } else if (*(q + i + 2) != -1) {
    *p++ = (*(q + i) << 2) + (*(q + i + 1) >> 4);
    *p++ = (*(q + i + 1) << 4) + (*(q + i + 2) >> 2);
    *p++ = (*(q + i + 2) << 6);
  } else if (*(q + i + 1) != -1) {
    *p++ = (*(q + i) << 2) + (*(q + i + 1) >> 4);
    *p++ = (*(q + i + 1) << 4);
  } else {
    printf("Not a valid base64 string\n");
    exit(0);
  }
  *p = 0;
  *decode_len = len * 6 / 8;
  free(q);
}
```