user: 请从给定的汇编指令推导出C源代码:

```asm
<davidegrayson_nibble_sort_counter_word>:
  endbr64
  sub    $0x28,%rsp
  pxor   %xmm0,%xmm0
  mov    %rdi,%rax
  mov    %fs:0x28,%rdx
  mov    %rdx,0x18(%rsp)
  xor    %edx,%edx
  mov    %rdi,%rdx
  movaps %xmm0,(%rsp)
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x4,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x8,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0xc,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x10,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x14,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x18,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x1c,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x20,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x24,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x28,%rdx
  and    $0xf,%edx
  shr    $0x3c,%rax
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x2c,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x30,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x34,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  mov    %rdi,%rdx
  shr    $0x38,%rdx
  and    $0xf,%edx
  addb   $0x1,(%rsp,%rdx,1)
  addb   $0x1,(%rsp,%rax,1)
  movzbl 0x1(%rsp),%ecx
  test   %ecx,%ecx
  je     L265
  movabs $0x1000000000000000,%rsi
  xor    %edx,%edx
  xor    %eax,%eax
  nopl   0x0(%rax)
L5:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L5
L20:
  movzbl 0x2(%rsp),%ecx
  test   %ecx,%ecx
  je     L310
  movabs $0x2000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L127:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L127
L310:
  movzbl 0x3(%rsp),%ecx
  test   %ecx,%ecx
  je     L164
  movabs $0x3000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L261:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L261
L164:
  movzbl 0x4(%rsp),%ecx
  test   %ecx,%ecx
  je     L45
  movabs $0x4000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L173:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L173
L45:
  movzbl 0x5(%rsp),%ecx
  test   %ecx,%ecx
  je     L248
  movabs $0x5000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L318:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L318
L248:
  movzbl 0x6(%rsp),%ecx
  test   %ecx,%ecx
  je     L80
  movabs $0x6000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L26:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L26
L80:
  movzbl 0x7(%rsp),%ecx
  test   %ecx,%ecx
  je     L282
  movabs $0x7000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L124:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L124
L282:
  movzbl 0x8(%rsp),%ecx
  test   %ecx,%ecx
  je     L268
  movabs $0x8000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L15:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L15
L268:
  movzbl 0x9(%rsp),%ecx
  test   %ecx,%ecx
  je     L99
  movabs $0x9000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L59:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L59
L99:
  movzbl 0xa(%rsp),%ecx
  test   %ecx,%ecx
  je     L206
  movabs $0xa000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L12:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L12
L206:
  movzbl 0xb(%rsp),%ecx
  test   %ecx,%ecx
  je     L91
  movabs $0xb000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L311:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L311
L91:
  movzbl 0xc(%rsp),%ecx
  test   %ecx,%ecx
  je     L63
  movabs $0xc000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L230:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L230
L63:
  movzbl 0xd(%rsp),%ecx
  test   %ecx,%ecx
  je     L221
  movabs $0xd000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L92:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L92
L221:
  movzbl 0xe(%rsp),%ecx
  test   %ecx,%ecx
  je     L82
  movabs $0xe000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L287:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L287
L82:
  movzbl 0xf(%rsp),%ecx
  test   %ecx,%ecx
  je     L100
  movabs $0xf000000000000000,%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L113:
  shr    $0x4,%rax
  add    $0x1,%edx
  or     %rsi,%rax
  cmp    %ecx,%edx
  jne    L113
L100:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L237
  add    $0x28,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L265:
  xor    %eax,%eax
  jmp    L20
L237:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long davidegrayson_nibble_sort_counter_word(unsigned long w) {
  unsigned char frequency_map[0x10] = {0};
  frequency_map[w >> 0x00 & 0xf]++;
  frequency_map[w >> 0x04 & 0xf]++;
  frequency_map[w >> 0x08 & 0xf]++;
  frequency_map[w >> 0x0c & 0xf]++;
  frequency_map[w >> 0x10 & 0xf]++;
  frequency_map[w >> 0x14 & 0xf]++;
  frequency_map[w >> 0x18 & 0xf]++;
  frequency_map[w >> 0x1c & 0xf]++;
  frequency_map[w >> 0x20 & 0xf]++;
  frequency_map[w >> 0x24 & 0xf]++;
  frequency_map[w >> 0x28 & 0xf]++;
  frequency_map[w >> 0x2c & 0xf]++;
  frequency_map[w >> 0x30 & 0xf]++;
  frequency_map[w >> 0x34 & 0xf]++;
  frequency_map[w >> 0x38 & 0xf]++;
  frequency_map[w >> 0x3c & 0xf]++;
  unsigned long r = 0;
  for (unsigned int j = 0; j < frequency_map[0x1]; j++)
    r = ((unsigned long)0x1 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x2]; j++)
    r = ((unsigned long)0x2 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x3]; j++)
    r = ((unsigned long)0x3 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x4]; j++)
    r = ((unsigned long)0x4 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x5]; j++)
    r = ((unsigned long)0x5 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x6]; j++)
    r = ((unsigned long)0x6 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x7]; j++)
    r = ((unsigned long)0x7 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x8]; j++)
    r = ((unsigned long)0x8 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0x9]; j++)
    r = ((unsigned long)0x9 << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xa]; j++)
    r = ((unsigned long)0xa << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xb]; j++)
    r = ((unsigned long)0xb << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xc]; j++)
    r = ((unsigned long)0xc << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xd]; j++)
    r = ((unsigned long)0xd << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xe]; j++)
    r = ((unsigned long)0xe << 60) | (r >> 4);
  for (unsigned int j = 0; j < frequency_map[0xf]; j++)
    r = ((unsigned long)0xf << 60) | (r >> 4);
  return r;
}
```