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

```asm
<base64ntostr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L58
L71:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x14(%rbp)
  movl   $0xffffffff,-0x1c(%rbp)
  cmpl   $0x40,-0x14(%rbp)
  jbe    L188
  cmpl   $0x5a,-0x14(%rbp)
  ja     L188
  mov    -0x14(%rbp),%eax
  sub    $0x41,%eax
  mov    %eax,-0x1c(%rbp)
L188:
  cmpl   $0x60,-0x14(%rbp)
  jbe    L152
  cmpl   $0x7a,-0x14(%rbp)
  ja     L152
  mov    -0x14(%rbp),%eax
  sub    $0x47,%eax
  mov    %eax,-0x1c(%rbp)
L152:
  cmpl   $0x2f,-0x14(%rbp)
  jbe    L120
  cmpl   $0x39,-0x14(%rbp)
  ja     L120
  mov    -0x14(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0x1c(%rbp)
L120:
  cmpl   $0x2b,-0x14(%rbp)
  jne    L184
  movl   $0x3e,-0x1c(%rbp)
L184:
  cmpl   $0x2f,-0x14(%rbp)
  jne    L136
  movl   $0x3f,-0x1c(%rbp)
L136:
  cmpl   $0x0,-0x1c(%rbp)
  js     L83
  cmpl   $0x3,-0x18(%rbp)
  je     L141
  cmpl   $0x3,-0x18(%rbp)
  jg     L153
  cmpl   $0x2,-0x18(%rbp)
  je     L181
  cmpl   $0x2,-0x18(%rbp)
  jg     L153
  cmpl   $0x0,-0x18(%rbp)
  je     L147
  cmpl   $0x1,-0x18(%rbp)
  je     L146
  jmp    L153
L147:
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L153
L146:
  mov    -0x20(%rbp),%eax
  lea    0x0(,%rax,4),%esi
  mov    -0x1c(%rbp),%eax
  sar    $0x4,%eax
  and    $0x3,%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  lea    (%rsi,%rcx,1),%edx
  mov    %dl,(%rax)
  mov    -0x1c(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L153
L181:
  mov    -0x1c(%rbp),%eax
  sar    $0x2,%eax
  mov    %eax,%esi
  mov    -0x20(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  lea    (%rsi,%rcx,1),%edx
  mov    %dl,(%rax)
  mov    -0x1c(%rbp),%eax
  and    $0x3,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L153
L141:
  mov    -0x20(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%ecx
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  lea    (%rcx,%rsi,1),%edx
  mov    %dl,(%rax)
  movl   $0xffffffff,-0x18(%rbp)
  nop
L153:
  addl   $0x1,-0x18(%rbp)
L83:
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
L58:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L88
  mov    -0x38(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  test   %rax,%rax
  jne    L71
L88:
  mov    -0x8(%rbp),%rax
  sub    -0x28(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
size_t base64ntostr(char *dst, const char *src, size_t srclen) {
  const unsigned char *s = (unsigned char *)src;
  int v, i, phase;
  unsigned char *p = (unsigned char *)dst;
  v = i = phase = 0;
  *p = 0;
  while (*s && srclen--) {
    unsigned int c = *s++;
    i = -1;
    if (c >= 'A' && c <= 'Z')
      i = c - 'A';
    if (c >= 'a' && c <= 'z')
      i = c - 'a' + 26;
    if (c >= '0' && c <= '9')
      i = c - '0' + 52;
    if (c == '+')
      i = 62;
    if (c == '/')
      i = 63;
    if (i >= 0) {
      switch (phase) {
      case 0:
        v = i;
        break;
      case 1:
        *p++ = (v << 2) + ((i & 0x30) >> 4);
        v = i << 4;
        break;
      case 2:
        *p++ = v + (i >> 2);
        v = i & 3;
        break;
      case 3:
        *p++ = (v << 6) + i;
        phase = -1;
        break;
      }
      phase++;
    }
    *p = 0;
  }
  return p - (unsigned char *)dst;
}
```