user: 请从给定的汇编指令推导出C源代码:

```asm
<base64decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  cmpb   $0x3d,-0x3(%rdi,%rsi,1)
  je     L92
  cmpb   $0x3d,-0x2(%rdi,%rsi,1)
  je     L95
  cmpb   $0x3d,-0x1(%rdi,%rsi,1)
  jne    L76
  sub    $0x1,%rbx
  jmp    L76
  nopw   0x0(%rax,%rax,1)
L95:
  sub    $0x2,%rbx
L76:
  lea    (%rbx,%rbx,2),%rax
  add    %rax,%rax
  lea    0x7(%rax),%rdi
  cmovns %rax,%rdi
  sar    $0x3,%rdi
  mov    %rdi,(%rdx)
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r15
  test   %rbx,%rbx
  jle    L49
  lea    -0x1(%rbx),%rax
  and    $0xfffffffffffffffc,%rax
  lea    0x4(%r13,%rax,1),%r14
  lea    0x0(%r13,%rbx,1),%rax
  mov    %rax,(%rsp)
  jmp    L52
  nopl   0x0(%rax,%rax,1)
L113:
  call   <b2n@plt>
  movsbl 0x1(%r13),%edi
  add    $0x3,%r15
  mov    %eax,%r12d
  call   <b2n@plt>
  movsbl 0x2(%r13),%edi
  shl    $0x2,%r12d
  mov    %eax,%ebp
  call   <b2n@plt>
  movsbl 0x3(%r13),%edi
  movzbl %al,%ebx
  call   <b2n@plt>
  movzbl %bpl,%esi
  mov    %ebx,%ebp
  shl    $0x6,%ebx
  mov    %esi,%edi
  sar    $0x2,%ebp
  or     %ebx,%eax
  sar    $0x4,%edi
  and    $0xf,%ebp
  shl    $0x4,%esi
  mov    %al,-0x1(%r15)
  and    $0x3,%edi
  or     %esi,%ebp
  mov    %bpl,-0x2(%r15)
  or     %edi,%r12d
  mov    %r12b,-0x3(%r15)
L50:
  add    $0x4,%r13
  cmp    %r13,%r14
  je     L49
L52:
  mov    (%rsp),%rax
  movsbl 0x0(%r13),%edi
  sub    %r13,%rax
  cmp    $0x2,%rax
  je     L68
  cmp    $0x3,%rax
  jne    L113
  call   <b2n@plt>
  movsbl 0x1(%r13),%edi
  add    $0x4,%r13
  add    $0x2,%r15
  mov    %eax,%ebp
  call   <b2n@plt>
  movsbl -0x2(%r13),%edi
  shl    $0x2,%ebp
  mov    %eax,%ebx
  call   <b2n@plt>
  movzbl %bl,%esi
  mov    %esi,%edi
  mov    %eax,%ebx
  shl    $0x4,%esi
  sar    $0x4,%edi
  shr    $0x2,%bx
  and    $0x3,%edi
  and    $0xf,%ebx
  or     %edi,%ebp
  or     %esi,%ebx
  mov    %bpl,-0x2(%r15)
  mov    %bl,-0x1(%r15)
  cmp    %r13,%r14
  jne    L52
L49:
  movb   $0x0,(%r15)
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L68:
  call   <b2n@plt>
  movsbl 0x1(%r13),%edi
  add    $0x1,%r15
  mov    %eax,%ebx
  call   <b2n@plt>
  shl    $0x2,%ebx
  shr    $0x4,%ax
  and    $0x3,%eax
  or     %eax,%ebx
  mov    %bl,-0x1(%r15)
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L92:
  sub    $0x3,%rbx
  jmp    L76
```

assistant: ```c
unsigned char *base64decode(char *base64, long size, long *outsize) {
  long real_size;
  unsigned char c0, c1, c2, c3;
  if (base64[size - 1 - 2] == '=')
    real_size = size - 3;
  else if (base64[size - 1 - 1] == '=')
    real_size = size - 2;
  else if (base64[size - 1] == '=')
    real_size = size - 1;
  else
    real_size = size;
  *outsize = real_size * 6 / 8;
  unsigned char *res = (unsigned char *)malloc(real_size * 6 / 8);
  unsigned char *res_p = res;
  int rest_bit = 8;
  int idx;
  for (idx = 0; idx < real_size; idx += 4) {
    switch (real_size - idx) {
    case 2:
      c0 = b2n(base64[idx + 0]);
      c1 = b2n(base64[idx + 1]);
      res_p[0] = c0 << 2 | (c1 & 0x30) >> 4;
      res_p += 1;
      break;
    case 3:
      c0 = b2n(base64[idx + 0]);
      c1 = b2n(base64[idx + 1]);
      c2 = b2n(base64[idx + 2]);
      res_p[0] = c0 << 2 | (c1 & 0x30) >> 4;
      res_p[1] = c1 << 4 | (c2 & 0x3c) >> 2;
      res_p += 2;
      break;
    default:
      c0 = b2n(base64[idx + 0]);
      c1 = b2n(base64[idx + 1]);
      c2 = b2n(base64[idx + 2]);
      c3 = b2n(base64[idx + 3]);
      res_p[0] = c0 << 2 | (c1 & 0x30) >> 4;
      res_p[1] = c1 << 4 | (c2 & 0x3c) >> 2;
      res_p[2] = c2 << 6 | c3;
      res_p += 3;
      break;
    }
  }
  *res_p = 0;
  return res;
}
```