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

```asm
<base64Decode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdx,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L63
  mov    %rdi,%r14
  mov    %rsi,%r15
  mov    %rdx,%rbx
  test   %rdi,%rdi
  je     L63
  movabs $0x7473727d2424247c,%rax
  movabs $0x247b7a7978777675,%rdx
  mov    %rax,-0x90(%rbp)
  mov    %rdx,-0x88(%rbp)
  movabs $0x3f3e242424242424,%rax
  movabs $0x4746454443424140,%rdx
  mov    %rax,-0x80(%rbp)
  mov    %rdx,-0x78(%rbp)
  movabs $0x4f4e4d4c4b4a4948,%rax
  movabs $0x5756555453525150,%rdx
  mov    %rax,-0x70(%rbp)
  mov    %rdx,-0x68(%rbp)
  movabs $0x5958242424242424,%rax
  movabs $0x61605f5e5d5c5b5a,%rdx
  mov    %rax,-0x60(%rbp)
  mov    %rdx,-0x58(%rbp)
  movabs $0x6968676665646362,%rax
  movabs $0x71706f6e6d6c6b6a,%rdx
  mov    %rax,-0x50(%rbp)
  mov    %rdx,-0x48(%rbp)
  movb   $0x0,-0x40(%rbp)
  call   <strlen@plt>
  mov    %eax,%r12d
  movl   $0x0,(%rbx)
  mov    $0x2000,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,(%r15)
  lea    D10(%rip),%rsi
  call   <strcpy@plt>
  mov    %r12d,%eax
  lea    0xf(,%rax,4),%rax
  shr    $0x4,%rax
  shl    $0x4,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L43:
  cmp    %rdx,%rsp
  je     L303
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L43
L303:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L341
  orq    $0x0,-0x8(%rsp,%rdx,1)
L341:
  mov    %rsp,-0xb8(%rbp)
  mov    $0x0,%r8d
  mov    $0x0,%r9d
  mov    $0x0,%ebx
  mov    $0x0,%r13d
  mov    %r15,-0xc0(%rbp)
  jmp    L316
L23:
  cmp    %ebx,%r12d
  jb     L279
  test   %dl,%dl
  jne    L279
L263:
  mov    %ebx,%eax
  add    $0x1,%ebx
  mov    %eax,%eax
  movzbl (%r14,%rax,1),%eax
  lea    -0x2b(%rax),%edi
  mov    %r13d,%edx
  cmp    $0x4f,%dil
  ja     L23
  movzbl %al,%eax
  sub    $0x2b,%eax
  cltq
  movzbl -0x90(%rbp,%rax,1),%edx
  test   %dl,%dl
  je     L23
  lea    -0x3d(%rdx),%eax
  cmp    $0x24,%dl
  cmove  %r13d,%eax
  mov    %eax,%edx
  jmp    L23
L279:
  cmp    %ebx,%r12d
  jb     L116
  add    $0x1,%esi
  test   %dl,%dl
  je     L3
  mov    %ecx,%eax
  sub    $0x1,%edx
  mov    %dl,-0x94(%rbp,%rax,1)
  jmp    L3
L116:
  mov    %ecx,%eax
  movb   $0x0,-0x94(%rbp,%rax,1)
L3:
  add    $0x1,%ecx
  cmp    $0x3,%ecx
  ja     L134
  cmp    %r12d,%ebx
  ja     L134
L108:
  cmp    %ebx,%r12d
  jae    L263
  jmp    L116
L134:
  test   %esi,%esi
  jne    L140
L258:
  cmp    %r12d,%ebx
  ja     L79
  ja     L79
L316:
  mov    $0x0,%esi
  mov    $0x0,%ecx
  jmp    L108
L140:
  movzbl -0x93(%rbp),%edx
  movzbl -0x94(%rbp),%ecx
  shl    $0x2,%ecx
  mov    %edx,%eax
  shr    $0x4,%al
  or     %ecx,%eax
  mov    %al,-0x9a(%rbp)
  movzbl -0x92(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x2,%cl
  shl    $0x4,%edx
  or     %ecx,%edx
  mov    %dl,-0x99(%rbp)
  shl    $0x6,%eax
  or     -0x91(%rbp),%al
  mov    %al,-0x98(%rbp)
  sub    $0x1,%esi
  mov    %esi,-0xa4(%rbp)
  je     L162
  mov    $0x0,%r15d
  mov    %r12d,-0xa8(%rbp)
  mov    %ebx,-0xc4(%rbp)
  mov    %r9d,%ebx
  mov    %r14,-0xd0(%rbp)
  mov    %r8d,%r14d
L165:
  movzbl -0x9a(%rbp,%r15,1),%eax
  test   %al,%al
  jne    L50
  add    $0x1,%ebx
  mov    %r14d,%eax
  mov    -0xb0(%rbp),%rsi
  mov    %r15d,%edx
  add    (%rsi),%edx
  mov    -0xb8(%rbp),%rsi
  mov    %edx,(%rsi,%rax,4)
  lea    0x1(%r14),%r14d
L231:
  add    $0x1,%r15
  cmp    %r15d,-0xa4(%rbp)
  ja     L165
  mov    %ebx,%r9d
  mov    %r14d,%r8d
  mov    -0xa8(%rbp),%r12d
  mov    -0xc4(%rbp),%ebx
  mov    -0xd0(%rbp),%r14
L162:
  mov    -0xb0(%rbp),%rax
  mov    -0xa4(%rbp),%esi
  add    %esi,(%rax)
  jmp    L258
L50:
  movzbl %al,%edx
  lea    -0x97(%rbp),%r12
  lea    D7(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %r12,%rsi
  mov    -0xc0(%rbp),%rax
  mov    (%rax),%rdi
  call   <strcat@plt>
  test   %ebx,%ebx
  je     L231
  mov    %r14d,-0xc8(%rbp)
  mov    -0xc0(%rbp),%r14
L195:
  mov    %r12,%rsi
  mov    (%r14),%rdi
  call   <strcat@plt>
  sub    $0x1,%ebx
  jne    L195
  mov    -0xc8(%rbp),%r14d
  jmp    L231
L79:
  mov    -0xc0(%rbp),%r15
  test   %r8d,%r8d
  je     L62
  mov    -0xb8(%rbp),%rcx
  mov    %rcx,%rax
  lea    -0x1(%r8),%edx
  lea    0x4(%rcx,%rdx,4),%rsi
L209:
  mov    (%rax),%edx
  mov    (%r15),%rcx
  movb   $0x0,(%rcx,%rdx,1)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L209
L62:
  lea    -0x1(%r12),%eax
  mov    $0x0,%edx
  cmpb   $0x3d,(%r14,%rax,1)
  je     L27
L334:
  lea    (%r12,%r12,2),%eax
  shr    $0x2,%eax
  sub    %edx,%eax
  mov    -0xb0(%rbp),%rsi
  mov    %eax,(%rsi)
  mov    $0x0,%eax
  jmp    L115
L27:
  lea    -0x2(%r12),%eax
  cmpb   $0x3d,(%r14,%rax,1)
  sete   %dl
  movzbl %dl,%edx
  add    $0x1,%edx
  jmp    L334
L63:
  mov    $0x1,%eax
L115:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L276
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L276:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D10
type: string
name: retrieve_data
arguments: label: D7
type: string

tool: 

tool: D7: %c

assistant: ```c
int base64Decode(const char *encoded, char **decoded, int *decodedLen) {
  if (decoded == NULL || encoded == NULL) {
    return 1;
  }
  unsigned char in[4], out[3], v;
  char temp[3], chars[] = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
  unsigned int i, j = 0, pos, length = strlen(encoded);
  (*decodedLen) = 0;
  *decoded = (char *)malloc(sizeof(char) * 8192);
  strcpy((*decoded), "");
  int isNullTerminator = 0;
  unsigned int numNullTerminators = 0;
  unsigned nullTerminators[length];
  while (j <= length) {
    for (pos = 0, i = 0; i < 4 && j <= length; i++) {
      v = 0;
      while (j <= length && v == 0) {
        v = (unsigned char)encoded[j++];
        v = (unsigned char)((v < 43 || v > 122) ? 0 : chars[v - 43]);
        if (v) {
          v = (unsigned char)((v == '$') ? 0 : v - 61);
        }
      }
      if (j <= length) {
        pos++;
        if (v) {
          in[i] = (unsigned char)(v - 1);
        }
      } else {
        in[i] = 0;
      }
    }
    if (pos) {
      out[0] = (unsigned char)(in[0] << 2 | in[1] >> 4);
      out[1] = (unsigned char)(in[1] << 4 | in[2] >> 2);
      out[2] = (unsigned char)(((in[2] << 6) & 0xc0) | in[3]);
      for (i = 0; i < pos - 1; i++) {
        if (out[i] != '\0') {
          sprintf(temp, "%c", out[i]);
          strcat(*decoded, temp);
          while (isNullTerminator) {
            strcat(*decoded, temp);
            isNullTerminator--;
          }
        } else {
          isNullTerminator++;
          nullTerminators[numNullTerminators++] = *decodedLen + i;
        }
      }
      (*decodedLen) += i;
    }
  }
  for (i = 0; i < numNullTerminators; i++) {
    (*decoded)[nullTerminators[i]] = '\0';
  }
  int correction = 0;
  if (encoded[length - 1] == '=') {
    correction++;
    if (encoded[length - 2] == '=') {
      correction++;
    }
  }
  (*decodedLen) = (length * 3) / 4 - correction;
  return 0;
}
```