user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mem_count_chr>:
  endbr64
  mov    %rdi,%rcx
  test   %rdx,%rdx
  je     L121
  lea    -0x1(%rdx),%rax
  cmp    $0xe,%rax
  jbe    L59
  movd   %esi,%xmm6
  pxor   %xmm0,%xmm0
  pxor   %xmm5,%xmm5
  mov    %rdi,%rax
  mov    %rdx,%rdi
  pshufd $0x0,%xmm6,%xmm3
  pxor   %xmm6,%xmm6
  and    $0xfffffffffffffff0,%rdi
  add    %rcx,%rdi
L96:
  movdqu (%rax),%xmm1
  movdqa %xmm6,%xmm4
  movdqa %xmm5,%xmm7
  add    $0x10,%rax
  pcmpgtb %xmm1,%xmm4
  movdqa %xmm1,%xmm2
  punpcklbw %xmm4,%xmm2
  punpckhbw %xmm4,%xmm1
  pcmpgtw %xmm2,%xmm7
  movdqa %xmm2,%xmm4
  punpcklwd %xmm7,%xmm4
  punpckhwd %xmm7,%xmm2
  pcmpeqd %xmm3,%xmm4
  pcmpeqd %xmm3,%xmm2
  psubd  %xmm4,%xmm0
  movdqa %xmm5,%xmm4
  pcmpgtw %xmm1,%xmm4
  psubd  %xmm2,%xmm0
  movdqa %xmm1,%xmm2
  punpcklwd %xmm4,%xmm2
  punpckhwd %xmm4,%xmm1
  pcmpeqd %xmm3,%xmm2
  pcmpeqd %xmm3,%xmm1
  psubd  %xmm2,%xmm0
  psubd  %xmm1,%xmm0
  cmp    %rax,%rdi
  jne    L96
  movdqa %xmm0,%xmm1
  mov    %rdx,%r8
  mov    %rdx,%rdi
  psrldq $0x8,%xmm1
  and    $0xfffffffffffffff0,%r8
  and    $0xf,%edi
  paddd  %xmm1,%xmm0
  add    %r8,%rcx
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%eax
  cmp    %r8,%rdx
  je     L42
L72:
  movsbl (%rcx),%edx
  cmp    %esi,%edx
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x1,%rdi
  je     L160
  movsbl 0x1(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x2,%rdi
  je     L160
  movsbl 0x2(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x3,%rdi
  je     L160
  movsbl 0x3(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x4,%rdi
  je     L160
  movsbl 0x4(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x5,%rdi
  je     L160
  movsbl 0x5(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x6,%rdi
  je     L160
  movsbl 0x6(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x7,%rdi
  je     L160
  movsbl 0x7(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x8,%rdi
  je     L160
  movsbl 0x8(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0x9,%rdi
  je     L160
  movsbl 0x9(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xa,%rdi
  je     L160
  movsbl 0xa(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xb,%rdi
  je     L160
  movsbl 0xb(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xc,%rdi
  je     L160
  movsbl 0xc(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xd,%rdi
  je     L160
  movsbl 0xd(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xe,%rdi
  je     L160
  movsbl 0xe(%rcx),%edx
  cmp    %edx,%esi
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L121:
  xor    %eax,%eax
L160:
  ret
L59:
  mov    %rdx,%rdi
  xor    %eax,%eax
  jmp    L72
L42:
  ret
```

assistant: ```c
int mem_count_chr(const void *buffer, int c, size_t length) {
  const char *s = buffer;
  int count;
  for (count = 0; length; length--, s++)
    if (*s == c)
      count++;
  return count;
}
```