user: What would the C source look like for the assembly code provided here?

```asm
<crypthead>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,(%rsp)
  mov    %r9d,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0xb,%edx
  jle    L57
  mov    %rsi,%r14
  mov    %rcx,%rbx
  mov    %r8,%r13
  mov    D5(%rip),%eax
  add    $0x1,%eax
  mov    %eax,D19(%rip)
  cmp    $0x1,%eax
  je     L55
L22:
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    (%rsp),%rdi
  call   <init_keys@plt>
  lea    0x1e(%rsp),%r12
  lea    0x28(%rsp),%r15
L12:
  mov    $0x0,%eax
  call   <rand@plt>
  sar    $0x7,%eax
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <decrypt_byte@plt>
  mov    %eax,0x8(%rsp)
  movzbl %bpl,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <update_keys@plt>
  movzbl 0x8(%rsp),%eax
  xor    %ebp,%eax
  mov    %al,(%r12)
  add    $0x1,%r12
  cmp    %r15,%r12
  jne    L12
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    (%rsp),%rdi
  call   <init_keys@plt>
  mov    $0x0,%ebp
L43:
  mov    %rbx,%rdi
  call   <decrypt_byte@plt>
  mov    %eax,%r15d
  movzbl 0x1e(%rsp,%rbp,1),%r12d
  movzbl %r12b,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <update_keys@plt>
  xor    %r15d,%r12d
  mov    %r12b,(%r14,%rbp,1)
  add    $0x1,%rbp
  cmp    $0xa,%rbp
  jne    L43
  mov    %rbx,%rdi
  call   <decrypt_byte@plt>
  mov    %eax,%ebp
  mov    0xc(%rsp),%r15d
  mov    %r15d,%r12d
  shr    $0x10,%r12d
  movzbl %r12b,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <update_keys@plt>
  xor    %r12d,%ebp
  mov    %bpl,0xa(%r14)
  mov    %rbx,%rdi
  call   <decrypt_byte@plt>
  mov    %eax,%r12d
  shr    $0x18,%r15d
  mov    %r15d,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <update_keys@plt>
  xor    %r15d,%r12d
  mov    %r12b,0xb(%r14)
  mov    $0xc,%eax
L57:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L18
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L55:
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  xor    $0xbb40e64e,%edi
  call   <srand@plt>
  jmp    L22
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int crypthead(const char *passwd, unsigned char *buf, int bufSize, unsigned int *pkeys, const unsigned int *pcrc_32_tab, unsigned int crcForCrypting) {
  int n;
  int t;
  int c;
  unsigned char header[12 - 2];
  static unsigned calls = 0;
  if (bufSize < 12)
    return 0;
  if (++calls == 1) {
    srand((unsigned)(time(NULL) ^ 3141592654UL));
  }
  init_keys(passwd, pkeys, pcrc_32_tab);
  for (n = 0; n < 12 - 2; n++) {
    c = (rand() >> 7) & 0xff;
    header[n] = (unsigned char)(t = decrypt_byte(pkeys), update_keys(pkeys, pcrc_32_tab, c), t ^ (c));
  }
  init_keys(passwd, pkeys, pcrc_32_tab);
  for (n = 0; n < 12 - 2; n++) {
    buf[n] = (unsigned char)(t = decrypt_byte(pkeys), update_keys(pkeys, pcrc_32_tab, header[n]), t ^ (header[n]));
  }
  buf[n++] = (unsigned char)(t = decrypt_byte(pkeys), update_keys(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff), t ^ ((int)(crcForCrypting >> 16) & 0xff));
  buf[n++] = (unsigned char)(t = decrypt_byte(pkeys), update_keys(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff), t ^ ((int)(crcForCrypting >> 24) & 0xff));
  return n;
}
```