user: Translate the below assembly code into C programming language:

```asm
<fwrite_base32hex_nonquote>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x2008(%rsp)
  xor    %eax,%eax
  movabs $0xcccccccccccccccd,%rdx
  mov    %rsi,%rax
  mul    %rdx
  shr    $0x2,%rdx
  lea    0x0(,%rdx,8),%ecx
  lea    (%rdx,%rdx,4),%rdx
  mov    %rsi,%rax
  sub    %rdx,%rax
  cmp    $0x3,%rax
  je     L6
  mov    %ecx,%ebp
  ja     L239
  cmp    $0x1,%rax
  je     L62
  cmp    $0x2,%rax
  jne    L213
  lea    0x4(%rcx),%ebp
  jmp    L213
L62:
  lea    0x2(%rcx),%ebp
L213:
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  lea    (%rcx,%rax,8),%r12d
  cmp    $0x1fff,%r12d
  jg     L305
  test   %r14,%r14
  je     L95
  mov    %rsp,%rbx
L187:
  lea    0x1(%r15),%rdi
  lea    (%rdi,%r14,1),%rax
  mov    %rbx,%r8
  mov    $0x0,%edx
  mov    $0x0,%r10d
  lea    D4(%rip),%r9
  jmp    L161
L6:
  lea    0x5(%rcx),%ebp
  jmp    L213
L239:
  lea    0x7(%rcx),%ebp
  jmp    L213
L305:
  lea    0x1(%r12),%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %r14,%r14
  jne    L187
  jmp    L188
  mov    %ecx,%esi
  shr    $0x3,%sil
  mov    %sil,(%r8)
  shl    $0x2,%ecx
  and    $0x1c,%ecx
  mov    %cl,0x1(%r8)
L54:
  lea    0x1(%rdx),%ecx
  movslq %ecx,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  lea    (%rdx,%rdx,4),%esi
  sub    %esi,%ecx
  mov    %ecx,%edx
L1:
  add    $0x1,%rdi
  cmp    %rax,%rdi
  je     L32
L161:
  movzbl -0x1(%rdi),%ecx
  cmp    $0x4,%edx
  ja     L67
  mov    %edx,%esi
  movslq (%r9,%rsi,4),%rsi
  add    %r9,%rsi
  notrack jmp *%rsi
  mov    %ecx,%esi
  shr    $0x6,%sil
  or     %sil,0x1(%r8)
  mov    %ecx,%esi
  shr    %sil
  and    $0x1f,%esi
  mov    %sil,0x2(%r8)
  shl    $0x4,%ecx
  and    $0x10,%ecx
  mov    %cl,0x3(%r8)
  jmp    L54
  mov    %ecx,%esi
  shr    $0x4,%sil
  or     %sil,0x3(%r8)
  add    %ecx,%ecx
  and    $0x1e,%ecx
  mov    %cl,0x4(%r8)
  jmp    L54
  mov    %ecx,%esi
  shr    $0x7,%sil
  or     %sil,0x4(%r8)
  mov    %ecx,%esi
  shr    $0x2,%sil
  and    $0x1f,%esi
  mov    %sil,0x5(%r8)
  shl    $0x3,%ecx
  and    $0x18,%ecx
  mov    %cl,0x6(%r8)
  jmp    L54
  mov    %ecx,%edx
  shr    $0x5,%dl
  or     %dl,0x6(%r8)
  and    $0x1f,%ecx
  mov    %cl,0x7(%r8)
  jmp    L286
L67:
  lea    0x1(%rdx),%ecx
  movslq %ecx,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  lea    (%rdx,%rdx,4),%esi
  sub    %esi,%ecx
  mov    %ecx,%edx
  jne    L1
L286:
  add    $0x8,%r8
  mov    %r10d,%edx
  jmp    L1
L95:
  mov    %rsp,%rbx
L32:
  test   %r12d,%r12d
  jle    L255
L188:
  mov    %r12d,%r15d
  mov    $0x0,%r14d
  jmp    L40
L143:
  cmp    $0x1f,%al
  ja     L106
  add    $0x57,%eax
  mov    %al,(%rbx,%r14,1)
  jmp    L88
L106:
  mov    $0x0,%edi
  call   <assert@plt>
  jmp    L88
L125:
  movb   $0x3d,(%rbx,%r14,1)
L88:
  add    $0x1,%r14
  cmp    %r15,%r14
  je     L255
L40:
  cmp    %r14d,%ebp
  jle    L125
  movzbl (%rbx,%r14,1),%eax
  cmp    $0x9,%al
  ja     L143
  add    $0x30,%eax
  mov    %al,(%rbx,%r14,1)
  jmp    L88
L255:
  movslq %r12d,%rax
  movb   $0x0,(%rbx,%rax,1)
  mov    %r13,%rcx
  mov    $0x1,%edx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <fwrite@plt>
  cmp    $0x1fff,%r12d
  jg     L70
L167:
  mov    0x2008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L232
  add    $0x2018,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L70:
  mov    %rbx,%rdi
  call   <free@plt>
  jmp    L167
L232:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void fwrite_base32hex_nonquote(char *p, size_t len, FILE *fp) {
  int out_len = 8 * (len / 5);
  int bufsize, i;
  int byte = 0;
  unsigned char s[8193];
  unsigned char *buf, *start;
  switch (len % 5) {
  case 1:
    out_len += 2;
    break;
  case 2:
    out_len += 4;
    break;
  case 3:
    out_len += 5;
    break;
  case 4:
    out_len += 7;
    break;
  }
  bufsize = 8 * (len / 5) + (len % 5 == 0 ? 0 : 8);
  if (bufsize < 8192) {
    buf = s;
  } else {
    buf = malloc(bufsize + 1);
  }
  start = buf;
  while (len--) {
    unsigned char n = *p;
    switch (byte) {
    case 0:
      buf[0] = n >> 3;
      buf[1] = (n & 0x07) << 2;
      break;
    case 1:
      buf[1] |= (n >> 6) & 0x03;
      buf[2] = (n >> 1) & 0x1f;
      buf[3] = (n & 0x01) << 4;
      break;
    case 2:
      buf[3] |= (n >> 4) & 0x0f;
      buf[4] = (n & 0x0f) << 1;
      break;
    case 3:
      buf[4] |= (n >> 7) & 0x01;
      buf[5] = (n >> 2) & 0x1f;
      buf[6] = (n & 0x03) << 3;
      break;
    case 4:
      buf[6] |= (n >> 5) & 0x07;
      buf[7] = n & 0x1f;
      break;
    }
    p++;
    byte = (byte + 1) % 5;
    if (byte == 0) {
      buf += 8;
    }
  }
  buf = start;
  for (i = 0; i < bufsize; i++) {
    if (i < out_len) {
      if (buf[i] < 10) {
        buf[i] += '0';
      } else if (buf[i] < 32) {
        buf[i] += 'a' - 10;
      } else {
        assert(0);
      }
    } else {
      buf[i] = '=';
    }
  }
  buf[bufsize] = '\0';
  fwrite(buf, bufsize, 1, fp);
  if (bufsize >= 8192) {
    free(buf);
  }
}
```