user: Please show me the C implementation that matches the assembly code listed below:

```asm
<base32_decode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movb   $0x0,-0x15(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L109
  cmpq   $0x0,-0x30(%rbp)
  je     L109
  cmpl   $0x0,-0x34(%rbp)
  jne    L135
L109:
  mov    $0xffffffff,%eax
  jmp    L156
L135:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L208
L32:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x15(%rbp)
  cmpb   $0x20,-0x15(%rbp)
  je     L191
  cmpb   $0x9,-0x15(%rbp)
  je     L191
  cmpb   $0xd,-0x15(%rbp)
  je     L191
  cmpb   $0xa,-0x15(%rbp)
  je     L191
  cmpb   $0x2d,-0x15(%rbp)
  je     L191
  shll   $0x5,-0x14(%rbp)
  cmpb   $0x30,-0x15(%rbp)
  jne    L205
  movb   $0x4f,-0x15(%rbp)
  jmp    L73
L205:
  cmpb   $0x31,-0x15(%rbp)
  jne    L34
  movb   $0x4c,-0x15(%rbp)
  jmp    L73
L34:
  cmpb   $0x38,-0x15(%rbp)
  jne    L73
  movb   $0x42,-0x15(%rbp)
L73:
  cmpb   $0x40,-0x15(%rbp)
  jle    L209
  cmpb   $0x5a,-0x15(%rbp)
  jle    L167
L209:
  cmpb   $0x60,-0x15(%rbp)
  jle    L76
  cmpb   $0x7a,-0x15(%rbp)
  jg     L76
L167:
  movzbl -0x15(%rbp),%eax
  and    $0x1f,%eax
  sub    $0x1,%eax
  mov    %al,-0x15(%rbp)
  jmp    L64
L76:
  cmpb   $0x31,-0x15(%rbp)
  jle    L96
  cmpb   $0x37,-0x15(%rbp)
  jg     L96
  movzbl -0x15(%rbp),%eax
  sub    $0x18,%eax
  mov    %al,-0x15(%rbp)
  jmp    L64
L96:
  mov    $0xffffffff,%eax
  jmp    L156
L64:
  movsbl -0x15(%rbp),%eax
  or     %eax,-0x14(%rbp)
  addl   $0x5,-0x10(%rbp)
  cmpl   $0x7,-0x10(%rbp)
  jle    L150
  mov    -0x14(%rbp),%eax
  movzbl %al,%edx
  mov    -0x10(%rbp),%eax
  sub    $0x8,%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%ecx
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x8,-0x10(%rbp)
  jmp    L150
L191:
  nop
L150:
  addq   $0x1,-0x8(%rbp)
L208:
  mov    -0xc(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jge    L88
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L32
L88:
  mov    -0xc(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jge    L247
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L247:
  mov    -0xc(%rbp),%eax
L156:
  pop    %rbp
  ret
```

assistant: ```c
int base32_decode(const unsigned char *encoded, unsigned char *result, int bufSize) {
  int buffer = 0;
  int bitsLeft = 0;
  int count = 0;
  const unsigned char *ptr = encoded;
  char ch = 0;
  if ((encoded == NULL) || (result == NULL) || (bufSize == 0))
    return -1;
  for (ptr = encoded; count < bufSize && *ptr; ++ptr) {
    ch = *ptr;
    if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' || ch == '-')
      continue;
    buffer <<= 5;
    if (ch == '0') {
      ch = 'O';
    } else if (ch == '1') {
      ch = 'L';
    } else if (ch == '8') {
      ch = 'B';
    }
    if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
      ch = (ch & 0x1F) - 1;
    } else if (ch >= '2' && ch <= '7') {
      ch -= '2' - 26;
    } else {
      return -1;
    }
    buffer |= ch;
    bitsLeft += 5;
    if (bitsLeft >= 8) {
      result[count++] = (unsigned char)buffer >> (bitsLeft - 8);
      bitsLeft -= 8;
    }
  }
  if (count < bufSize)
    result[count] = '\000';
  return count;
}
```