user: 请将以下的汇编代码转换成C语言代码:

```asm
<davidegrayson_nibble_sort_counter_word>:
  endbr64
  sub    $0x28,%rsp
  mov    %rdi,%rax
  mov    %fs:0x28,%rdx
  mov    %rdx,0x18(%rsp)
  xor    %edx,%edx
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    %rdi,%rdx
  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
  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)
  shr    $0x3c,%rax
  addb   $0x1,(%rsp,%rax,1)
  movzbl 0x1(%rsp),%ecx
  test   %ecx,%ecx
  je     L152
  mov    $0x0,%edx
  mov    $0x0,%eax
  movabs $0x1000000000000000,%rsi
L277:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L277
L26:
  movzbl 0x2(%rsp),%ecx
  test   %ecx,%ecx
  je     L125
  mov    $0x0,%edx
  movabs $0x2000000000000000,%rsi
L66:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L66
L125:
  movzbl 0x3(%rsp),%ecx
  test   %ecx,%ecx
  je     L232
  mov    $0x0,%edx
  movabs $0x3000000000000000,%rsi
L319:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L319
L232:
  movzbl 0x4(%rsp),%ecx
  test   %ecx,%ecx
  je     L143
  mov    $0x0,%edx
  movabs $0x4000000000000000,%rsi
L128:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L128
L143:
  movzbl 0x5(%rsp),%ecx
  test   %ecx,%ecx
  je     L297
  mov    $0x0,%edx
  movabs $0x5000000000000000,%rsi
L263:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L263
L297:
  movzbl 0x6(%rsp),%ecx
  test   %ecx,%ecx
  je     L244
  mov    $0x0,%edx
  movabs $0x6000000000000000,%rsi
L9:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L9
L244:
  movzbl 0x7(%rsp),%ecx
  test   %ecx,%ecx
  je     L308
  mov    $0x0,%edx
  movabs $0x7000000000000000,%rsi
L203:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L203
L308:
  movzbl 0x8(%rsp),%ecx
  test   %ecx,%ecx
  je     L225
  mov    $0x0,%edx
  movabs $0x8000000000000000,%rsi
L165:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L165
L225:
  movzbl 0x9(%rsp),%ecx
  test   %ecx,%ecx
  je     L157
  mov    $0x0,%edx
  movabs $0x9000000000000000,%rsi
L102:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L102
L157:
  movzbl 0xa(%rsp),%ecx
  test   %ecx,%ecx
  je     L214
  mov    $0x0,%edx
  movabs $0xa000000000000000,%rsi
L12:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L12
L214:
  movzbl 0xb(%rsp),%ecx
  test   %ecx,%ecx
  je     L255
  mov    $0x0,%edx
  movabs $0xb000000000000000,%rsi
L265:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L265
L255:
  movzbl 0xc(%rsp),%ecx
  test   %ecx,%ecx
  je     L256
  mov    $0x0,%edx
  movabs $0xc000000000000000,%rsi
L302:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L302
L256:
  movzbl 0xd(%rsp),%ecx
  test   %ecx,%ecx
  je     L313
  mov    $0x0,%edx
  movabs $0xd000000000000000,%rsi
L84:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L84
L313:
  movzbl 0xe(%rsp),%ecx
  test   %ecx,%ecx
  je     L237
  mov    $0x0,%edx
  movabs $0xe000000000000000,%rsi
L172:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L172
L237:
  movzbl 0xf(%rsp),%ecx
  test   %ecx,%ecx
  je     L201
  mov    $0x0,%edx
  movabs $0xf000000000000000,%rsi
L70:
  shr    $0x4,%rax
  or     %rsi,%rax
  add    $0x1,%edx
  cmp    %ecx,%edx
  jne    L70
L201:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L293
  add    $0x28,%rsp
  ret
L152:
  mov    $0x0,%eax
  jmp    L26
L293:
  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;
}
```