user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<nibble_sort_word>:
  endbr64
  mov    %edi,%edx
  and    $0xf,%edi
  imul   $0x11111111,%edi,%eax
  cmp    %edx,%eax
  je     L3
  mov    %edx,%ecx
  mov    $0x1,%esi
  shr    $0x2,%ecx
  mov    %rsi,%rax
  mov    %rsi,%r8
  and    $0x3c,%ecx
  shl    %cl,%rax
  lea    0x0(,%rdi,4),%ecx
  mov    %rsi,%rdi
  shl    %cl,%rdi
  mov    %edx,%ecx
  shr    $0x6,%ecx
  add    %edi,%eax
  mov    %rsi,%rdi
  and    $0x3c,%ecx
  shl    %cl,%rdi
  mov    %edx,%ecx
  shr    $0xa,%ecx
  add    %edi,%eax
  mov    %rsi,%rdi
  and    $0x3c,%ecx
  shl    %cl,%rdi
  mov    %edx,%ecx
  shr    $0xe,%ecx
  add    %edi,%eax
  mov    %rsi,%rdi
  and    $0x3c,%ecx
  shl    %cl,%rdi
  mov    %edx,%ecx
  shr    $0x12,%ecx
  add    %edi,%eax
  mov    %rsi,%rdi
  and    $0x3c,%ecx
  shl    %cl,%rdi
  mov    %edx,%ecx
  shr    $0x16,%ecx
  add    %edi,%eax
  mov    %rsi,%rdi
  and    $0x3c,%ecx
  shl    %cl,%r8
  mov    %edx,%ecx
  sar    $0x1d,%edx
  shr    $0x1c,%ecx
  shl    $0x2,%ecx
  shl    %cl,%rdi
  mov    %edx,%ecx
  and    $0x3c,%ecx
  shl    %cl,%rsi
  lea    (%rax,%rsi,8),%eax
  add    %r8d,%eax
  mov    $0xffffffff,%r8d
  lea    (%rax,%rdi,1),%edx
  mov    %edx,%ecx
  and    $0xf,%ecx
  shl    $0x2,%ecx
  shl    %cl,%r8d
  mov    %edx,%ecx
  shr    $0x2,%ecx
  mov    %r8d,%eax
  and    $0x3c,%ecx
  shl    %cl,%eax
  mov    %edx,%ecx
  mov    %eax,%esi
  shr    $0x6,%ecx
  mov    %eax,%edi
  and    $0x11111111,%eax
  not    %esi
  and    $0x3c,%ecx
  add    %eax,%eax
  and    %r8d,%esi
  shl    %cl,%edi
  mov    %edx,%ecx
  and    $0x11111111,%esi
  shr    $0xa,%ecx
  or     %eax,%esi
  mov    %edi,%eax
  and    $0x3c,%ecx
  not    %eax
  and    %eax,%esi
  mov    %edi,%eax
  and    $0x11111111,%edi
  shl    %cl,%eax
  lea    (%rdi,%rdi,2),%edi
  mov    %eax,%ecx
  or     %esi,%edi
  mov    %eax,%esi
  and    $0x11111111,%eax
  not    %ecx
  shl    $0x2,%eax
  and    %ecx,%edi
  mov    %edx,%ecx
  shr    $0xe,%ecx
  or     %edi,%eax
  and    $0x3c,%ecx
  shl    %cl,%esi
  mov    %esi,%ecx
  mov    %esi,%edi
  and    $0x11111111,%esi
  not    %ecx
  and    %ecx,%eax
  mov    %edx,%ecx
  shr    $0x12,%ecx
  and    $0x3c,%ecx
  shl    %cl,%edi
  lea    (%rsi,%rsi,4),%ecx
  or     %ecx,%eax
  mov    %edi,%ecx
  mov    %edi,%esi
  not    %ecx
  and    %ecx,%eax
  mov    %edx,%ecx
  and    $0x11111111,%edi
  shr    $0x16,%ecx
  lea    (%rdi,%rdi,2),%edi
  and    $0x3c,%ecx
  add    %edi,%edi
  shl    %cl,%esi
  or     %eax,%edi
  mov    %edx,%ecx
  sar    $0x1d,%edx
  mov    %esi,%eax
  shr    $0x1c,%ecx
  and    $0x3c,%edx
  not    %eax
  shl    $0x2,%ecx
  and    %eax,%edi
  mov    %esi,%eax
  and    $0x11111111,%esi
  shl    %cl,%eax
  mov    %esi,%ecx
  lea    0x0(,%rsi,8),%esi
  sub    %ecx,%esi
  mov    %eax,%ecx
  or     %edi,%esi
  not    %ecx
  and    %ecx,%esi
  mov    %edx,%ecx
  mov    %eax,%edx
  and    $0x11111111,%eax
  shl    %cl,%edx
  shl    $0x3,%eax
  or     %esi,%eax
  mov    %edx,%esi
  not    %esi
  and    %esi,%eax
  mov    %edx,%esi
  and    $0x11111111,%edx
  shl    %cl,%esi
  lea    (%rdx,%rdx,8),%edi
  or     %eax,%edi
  mov    %esi,%eax
  mov    %esi,%edx
  and    $0x11111111,%esi
  not    %eax
  shl    %cl,%edx
  and    %eax,%edi
  lea    (%rsi,%rsi,4),%eax
  mov    %edx,%esi
  add    %eax,%eax
  not    %esi
  or     %edi,%eax
  mov    %edx,%edi
  shl    %cl,%edi
  and    %esi,%eax
  and    $0x11111111,%edx
  lea    (%rdx,%rdx,4),%esi
  lea    (%rdx,%rsi,2),%edx
  mov    %edi,%esi
  or     %edx,%eax
  mov    %edi,%edx
  and    $0x11111111,%edi
  shl    %cl,%esi
  not    %edx
  and    %edx,%eax
  lea    (%rdi,%rdi,2),%edx
  shl    $0x2,%edx
  or     %eax,%edx
  mov    %esi,%eax
  not    %eax
  and    %eax,%edx
  mov    %esi,%eax
  and    $0x11111111,%esi
  lea    (%rsi,%rsi,2),%edi
  shl    %cl,%eax
  lea    (%rsi,%rdi,4),%esi
  or     %edx,%esi
  mov    %eax,%edx
  not    %edx
  and    %edx,%esi
  mov    %eax,%edx
  and    $0x11111111,%eax
  shl    %cl,%edx
  mov    %edx,%ecx
  imul   $0xe,%eax,%edx
  mov    %ecx,%eax
  and    $0x11111111,%ecx
  not    %eax
  or     %esi,%edx
  and    %eax,%edx
  mov    %ecx,%eax
  shl    $0x4,%eax
  sub    %ecx,%eax
  or     %edx,%eax
L3:
  ret
```

assistant: ```c
uint64_t nibble_sort_word(uint64_t arg) {
  const uint64_t ones = 0x1111111111111111ULL;
  if (arg == (arg & 0xf) * ones) {
    return arg;
  }
  uint64_t count = 0;
  for (int i = 0; i < 16; i++) {
    count += 1ULL << (4 * (arg & 0xf));
    arg >>= 4;
  }
  uint64_t mask = ~0ULL;
  uint64_t result = 0;
  for (int i = 0; i < 16; i++) {
    int n = count & 0xf;
    count >>= 4;
    result = (result & ~mask) | ((ones & mask) * i);
    mask <<= 4 * n;
  }
  return result;
}
```