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

```asm
<base64_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  lea    0x3(%rsi),%eax
  cmovns %esi,%eax
  xor    %ebx,%ebx
  sar    $0x2,%eax
  lea    (%rax,%rax,2),%edx
  movslq %esi,%rax
  cmpb   $0x3d,-0x1(%rdi,%rax,1)
  sete   %bl
  cmpb   $0x3d,-0x2(%rdi,%rax,1)
  je     L90
  mov    0x8(%rsp),%rsi
  cmpb   $0x3d,-0x3(%rsi,%rax,1)
  je     L79
L137:
  lea    0x4(%rdx),%r12d
L23:
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %rax,%rax
  je     L120
L41:
  mov    %r12d,%edx
  mov    0x18(%rsp),%r12
  xor    %esi,%esi
  sub    %ebx,%ebp
  mov    %r12,%rdi
  call   <memset@plt>
  test   %ebp,%ebp
  jle    L11
  lea    0x25(%rsp),%rax
  xor    %ebx,%ebx
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L158:
  mov    0x10(%rsp),%rdi
  mov    $0x4,%edx
  xor    %esi,%esi
  movslq %ebx,%r13
  mov    %r13,%r15
  xor    %r14d,%r14d
  call   <memset@plt>
  xor    %eax,%eax
L193:
  cmp    %r15d,%ebp
  jle    L84
  shl    $0x6,%eax
  add    $0x1,%r15d
  mov    %eax,%ebx
  mov    0x8(%rsp),%rax
  add    %r13,%rax
  movsbl (%rax,%r14,1),%edi
  add    $0x1,%r14
  call   <find_pos@plt>
  or     %ebx,%eax
  cmp    $0x4,%r14
  jne    L193
  mov    %eax,%edx
  movzbl %ah,%ecx
  mov    %r15d,%ebx
  sar    $0x10,%edx
  mov    %cl,0x1(%r12)
  mov    %dl,(%r12)
L185:
  mov    %al,0x2(%r12)
  add    $0x3,%r12
  cmp    %r15d,%ebp
  jg     L158
  nopw   0x0(%rax,%rax,1)
L18:
  movb   $0x0,(%r12)
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L111
  mov    0x18(%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L84:
  mov    $0x4,%edx
  sub    %r14d,%edx
  lea    (%rdx,%rdx,2),%ecx
  add    %ecx,%ecx
  shl    %cl,%eax
  test   %r14d,%r14d
  je     L18
  mov    %eax,%edx
  sar    $0x10,%edx
  mov    %dl,(%r12)
  cmp    $0x1,%r14d
  je     L58
  movzbl %ah,%ecx
  mov    %cl,0x1(%r12)
  cmp    $0x2,%r14d
  jne    L96
  add    $0x2,%r12
  jmp    L18
  nop
L96:
  mov    %r15d,%ebx
  jmp    L185
  nopl   0x0(%rax,%rax,1)
L79:
  add    $0x1,%ebx
  cmp    $0x2,%ebx
  je     L159
  lea    0x2(%rdx),%r12d
  cmp    $0x3,%ebx
  je     L23
  jmp    L137
  nopw   0x0(%rax,%rax,1)
L90:
  add    $0x1,%ebx
  cmpb   $0x3d,-0x3(%rdi,%rax,1)
  je     L79
  cmp    $0x2,%ebx
  jne    L137
L159:
  lea    0x3(%rdx),%r12d
  mov    $0x2,%ebx
  jmp    L23
L120:
  lea    D6(%rip),%rdi
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L41
L58:
  add    $0x1,%r12
  jmp    L18
L11:
  mov    0x18(%rsp),%r12
  jmp    L18
L111:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D6
type_guessed: string

tool: D6: No enough memory.


assistant: ```c
char *base64_decode(const char *data, int data_len) {
  int ret_len = (data_len / 4) * 3;
  int equal_count = 0;
  char *ret = NULL;
  char *f = NULL;
  int tmp = 0;
  int temp = 0;
  char need[3];
  int prepare = 0;
  int i = 0;
  if (*(data + data_len - 1) == '=') {
    equal_count += 1;
  }
  if (*(data + data_len - 2) == '=') {
    equal_count += 1;
  }
  if (*(data + data_len - 3) == '=') {
    equal_count += 1;
  }
  switch (equal_count) {
  case 0:
    ret_len += 4;
    break;
  case 1:
    ret_len += 4;
    break;
  case 2:
    ret_len += 3;
    break;
  case 3:
    ret_len += 2;
    break;
  }
  ret = (char *)malloc(ret_len);
  if (ret == NULL) {
    printf("No enough memory.\n");
    exit(0);
  }
  memset(ret, 0, ret_len);
  f = ret;
  while (tmp < (data_len - equal_count)) {
    temp = 0;
    prepare = 0;
    memset(need, 0, 4);
    while (temp < 4) {
      if (tmp >= (data_len - equal_count)) {
        break;
      }
      prepare = (prepare << 6) | (find_pos(data[tmp]));
      temp++;
      tmp++;
    }
    prepare = prepare << ((4 - temp) * 6);
    for (i = 0; i < 3; i++) {
      if (i == temp) {
        break;
      }
      *f = (char)((prepare >> ((2 - i) * 8)) & 0xFF);
      f++;
    }
  }
  *f = '\0';
  return ret;
}
```