user: Converte this assembly snippet into its equivalent C code:

```asm
<base64_decode>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  push   %rbx
  mov    %rbp,%rdi
  mov    %edx,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  je     L102
  sub    $0x1,%eax
  xor    %r13d,%r13d
  lea    0x1(%r15,%rax,1),%r12
  lea    0x14(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L85
  nopl   0x0(%rax,%rax,1)
L60:
  add    $0x1,%r15
  cmp    %r12,%r15
  je     L112
L85:
  movzbl (%r15),%edi
  cmp    $0x3d,%dil
  je     L112
  call   <is_base64@plt>
  test   %rax,%rax
  je     L112
  movzbl (%r15),%ecx
  movslq %r13d,%rax
  add    $0x1,%r13d
  mov    %cl,0x14(%rsp,%rax,1)
  cmp    $0x4,%r13d
  jne    L60
  mov    0x8(%rsp),%r14
  lea    0x18(%rsp),%r13
L13:
  movzbl (%r14),%edi
  add    $0x1,%r14
  call   <base64_chars_find@plt>
  mov    %al,-0x1(%r14)
  cmp    %r14,%r13
  jne    L13
  movzbl 0x15(%rsp),%esi
  movzbl 0x14(%rsp),%ecx
  xor    %edx,%edx
  mov    %ebx,%r13d
  movzbl 0x16(%rsp),%eax
  lea    0x10(%rsp),%r14
  mov    %esi,%r8d
  shl    $0x4,%esi
  sar    $0x4,%r8d
  and    $0x3,%r8d
  lea    (%r8,%rcx,4),%ecx
  mov    %cl,%dl
  mov    %eax,%ecx
  shl    $0x6,%eax
  add    0x17(%rsp),%al
  sar    $0x2,%ecx
  mov    %al,0x12(%rsp)
  lea    0x13(%rsp),%rax
  and    $0xf,%ecx
  mov    %rax,(%rsp)
  add    %esi,%ecx
  mov    %cl,%dh
  mov    %dx,0x10(%rsp)
L20:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %r13,%rax
  jae    L111
  mov    %rbp,%rdi
  add    $0x1,%r14
  call   <strlen@plt>
  movzbl -0x1(%r14),%esi
  mov    %sil,0x0(%rbp,%rax,1)
  cmp    %r14,(%rsp)
  jne    L20
L111:
  add    $0x1,%r15
  xor    %r13d,%r13d
  cmp    %r12,%r15
  jne    L85
  nopl   0x0(%rax)
L112:
  test   %r13d,%r13d
  je     L102
  cmp    $0x3,%r13d
  jg     L168
  lea    0x14(%rsp),%r12
  movslq %r13d,%rcx
  mov    $0x4,%edx
  add    %r12,%rcx
  sub    %r13d,%edx
  je     L105
  xor    %eax,%eax
L47:
  mov    %eax,%esi
  add    $0x1,%eax
  movb   $0x0,(%rcx,%rsi,1)
  cmp    %edx,%eax
  jb     L47
L105:
  lea    0x18(%rsp),%r14
L125:
  movzbl (%r12),%edi
  add    $0x1,%r12
  call   <base64_chars_find@plt>
  mov    %al,-0x1(%r12)
  cmp    %r12,%r14
  jne    L125
  movzbl 0x15(%rsp),%ecx
  movzbl 0x14(%rsp),%edx
  xor    %esi,%esi
  movzbl 0x16(%rsp),%eax
  mov    %ecx,%edi
  shl    $0x4,%ecx
  sar    $0x4,%edi
  and    $0x3,%edi
  lea    (%rdi,%rdx,4),%edx
  mov    %dl,%sil
  mov    %eax,%edx
  shl    $0x6,%eax
  add    0x17(%rsp),%al
  sar    $0x2,%edx
  mov    %al,0x12(%rsp)
  and    $0xf,%edx
  add    %ecx,%edx
  mov    %esi,%ecx
  mov    %dl,%ch
  mov    %cx,0x10(%rsp)
  cmp    $0x1,%r13d
  je     L102
  lea    -0x2(%r13),%eax
  mov    %ebx,%ebx
  lea    0x10(%rsp),%r12
  lea    0x11(%rsp,%rax,1),%r13
  jmp    L31
  nopl   0x0(%rax)
L120:
  mov    %rbp,%rdi
  add    $0x1,%r12
  call   <strlen@plt>
  movzbl -0x1(%r12),%edx
  mov    %dl,0x0(%rbp,%rax,1)
  cmp    %r12,%r13
  je     L102
L31:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %rbx,%rax
  jb     L120
L102:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x28,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <strlen@plt>
  xchg   %ax,%ax
L168:
  lea    0x14(%rsp),%r12
  jmp    L105
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
size_t base64_decode(unsigned char const *encoded_string, unsigned char *ret, unsigned int retsize) {
  int in_len, i = 0, j = 0, in_ = 0;
  unsigned char char_array_4[4], char_array_3[3];
  memset(ret, 0, retsize);
  in_len = strlen(encoded_string);
  while (in_len-- && (encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
    char_array_4[i++] = encoded_string[in_];
    in_++;
    if (i == 4) {
      for (i = 0; i < 4; i++)
        char_array_4[i] = base64_chars_find(char_array_4[i]);
      char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
      char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
      char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
      for (i = 0; (i < 3) && strlen(ret) < retsize; i++)
        ret[strlen(ret)] = char_array_3[i];
      i = 0;
    }
  }
  if (i) {
    for (j = i; j < 4; j++)
      char_array_4[j] = 0;
    for (j = 0; j < 4; j++)
      char_array_4[j] = base64_chars_find(char_array_4[j]);
    char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
    char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
    char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
    for (j = 0; (j < i - 1) && strlen(ret) < retsize; j++) {
      ret[strlen(ret)] = char_array_3[j];
    }
  }
  return strlen(ret);
}
```