user: What is the c source code of the assembly code below?

```asm
<fwrite_base32hex_nonquote>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x60,%rsp
  mov    %rdi,-0x2048(%rbp)
  mov    %rsi,-0x2050(%rbp)
  mov    %rdx,-0x2058(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x2050(%rbp),%rax
  movabs $0xcccccccccccccccd,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x2,%rax
  shl    $0x3,%eax
  mov    %eax,-0x2030(%rbp)
  movl   $0x0,-0x2028(%rbp)
  mov    -0x2050(%rbp),%rcx
  movabs $0xcccccccccccccccd,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x2,%rax
  mov    %rax,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  cmp    $0x4,%rax
  je     L3
  cmp    $0x4,%rax
  ja     L86
  cmp    $0x3,%rax
  je     L222
  cmp    $0x3,%rax
  ja     L86
  cmp    $0x1,%rax
  je     L85
  cmp    $0x2,%rax
  je     L287
  jmp    L86
L85:
  addl   $0x2,-0x2030(%rbp)
  jmp    L86
L287:
  addl   $0x4,-0x2030(%rbp)
  jmp    L86
L222:
  addl   $0x5,-0x2030(%rbp)
  jmp    L86
L3:
  addl   $0x7,-0x2030(%rbp)
  nop
L86:
  mov    -0x2050(%rbp),%rax
  movabs $0xcccccccccccccccd,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x2,%rax
  lea    0x0(,%rax,8),%esi
  mov    -0x2050(%rbp),%rcx
  movabs $0xcccccccccccccccd,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x2,%rax
  mov    %rax,%rdx
  shl    $0x2,%rdx
  add    %rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  test   %rax,%rax
  jne    L310
  mov    $0x0,%eax
  jmp    L56
L310:
  mov    $0x8,%eax
L56:
  add    %esi,%eax
  mov    %eax,-0x2024(%rbp)
  cmpl   $0x1fff,-0x2024(%rbp)
  jg     L92
  lea    -0x2010(%rbp),%rax
  mov    %rax,-0x2020(%rbp)
  jmp    L178
L92:
  mov    -0x2024(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x2020(%rbp)
L178:
  mov    -0x2020(%rbp),%rax
  mov    %rax,-0x2018(%rbp)
  jmp    L144
L278:
  mov    -0x2048(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x2031(%rbp)
  cmpl   $0x4,-0x2028(%rbp)
  ja     L316
  mov    -0x2028(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D19(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D19(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  movzbl -0x2031(%rbp),%eax
  shr    $0x3,%al
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x1,%rax
  and    $0x1c,%edx
  mov    %dl,(%rax)
  jmp    L316
  mov    -0x2020(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  movzbl -0x2031(%rbp),%eax
  shr    $0x6,%al
  or     %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  shr    %al
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x2,%rax
  and    $0x1f,%edx
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x3,%rax
  and    $0x10,%edx
  mov    %dl,(%rax)
  jmp    L316
  mov    -0x2020(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  movzbl -0x2031(%rbp),%eax
  shr    $0x4,%al
  or     %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x4,%rax
  and    $0x1e,%edx
  mov    %dl,(%rax)
  jmp    L316
  mov    -0x2020(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  movzbl -0x2031(%rbp),%eax
  shr    $0x7,%al
  or     %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x4,%rax
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  shr    $0x2,%al
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x5,%rax
  and    $0x1f,%edx
  mov    %dl,(%rax)
  movzbl -0x2031(%rbp),%eax
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x6,%rax
  and    $0x18,%edx
  mov    %dl,(%rax)
  jmp    L316
  mov    -0x2020(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  movzbl -0x2031(%rbp),%eax
  shr    $0x5,%al
  or     %eax,%edx
  mov    -0x2020(%rbp),%rax
  add    $0x6,%rax
  mov    %dl,(%rax)
  mov    -0x2020(%rbp),%rax
  add    $0x7,%rax
  movzbl -0x2031(%rbp),%edx
  and    $0x1f,%edx
  mov    %dl,(%rax)
  nop
L316:
  addq   $0x1,-0x2048(%rbp)
  mov    -0x2028(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    %edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  mov    %edx,-0x2028(%rbp)
  mov    -0x2028(%rbp),%ecx
  mov    %ecx,%edx
  shl    $0x2,%edx
  add    %ecx,%edx
  sub    %edx,%eax
  mov    %eax,-0x2028(%rbp)
  cmpl   $0x0,-0x2028(%rbp)
  jne    L144
  addq   $0x8,-0x2020(%rbp)
L144:
  mov    -0x2050(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x2050(%rbp)
  test   %rax,%rax
  jne    L278
  mov    -0x2018(%rbp),%rax
  mov    %rax,-0x2020(%rbp)
  movl   $0x0,-0x202c(%rbp)
  jmp    L94
L234:
  mov    -0x202c(%rbp),%eax
  cmp    -0x2030(%rbp),%eax
  jge    L117
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  ja     L142
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x2020(%rbp),%rax
  add    %rcx,%rax
  add    $0x30,%edx
  mov    %dl,(%rax)
  jmp    L107
L142:
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  ja     L58
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x2020(%rbp),%rax
  add    %rcx,%rax
  add    $0x57,%edx
  mov    %dl,(%rax)
  jmp    L107
L58:
  mov    $0x0,%edi
  call   <assert@plt>
  jmp    L107
L117:
  mov    -0x202c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movb   $0x3d,(%rax)
L107:
  addl   $0x1,-0x202c(%rbp)
L94:
  mov    -0x202c(%rbp),%eax
  cmp    -0x2024(%rbp),%eax
  jl     L234
  mov    -0x2024(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x2020(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x2058(%rbp),%rdx
  mov    -0x2024(%rbp),%esi
  mov    -0x2020(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <fwrite@plt>
  cmpl   $0x1fff,-0x2024(%rbp)
  jle    L2
  mov    -0x2020(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L2:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L294
  call   <__stack_chk_fail@plt>
L294:
  leave
  ret
```

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);
  }
}
```