user: Translate the below assembly code into C programming language:

```asm
<__memchr>:
  endbr64
  mov    %rdi,%rax
  mov    %esi,%r10d
  mov    %esi,%ecx
  test   %rdx,%rdx
  jne    L128
  jmp    L166
  cs nopw 0x0(%rax,%rax,1)
L44:
  cmp    %cl,(%rax)
  je     L27
  add    $0x1,%rax
  sub    $0x1,%rdx
  je     L166
L128:
  test   $0x7,%al
  jne    L44
  movzbl %r10b,%edi
  mov    %edi,%esi
  shl    $0x8,%esi
  or     %edi,%esi
  movslq %esi,%rsi
  mov    %rsi,%r11
  shl    $0x10,%r11
  or     %rsi,%r11
  mov    D8(%rip),%rsi
  mov    (%rsi),%r9d
  sar    %r9d
  and    $0xfefefeff,%r9d
  cmp    $0x7,%rdx
  ja     L174
  jmp    L209
  nopl   0x0(%rax)
L192:
  mov    %rsi,%rdx
L174:
  mov    %rax,%r8
  lea    0x8(%rax),%rax
  mov    (%r8),%rdi
  xor    %r11,%rdi
  lea    (%r9,%rdi,1),%rsi
  xor    %rdi,%rsi
  or     %r9,%rsi
  cmp    $0xffffffffffffffff,%rsi
  je     L316
  cmp    %cl,-0x8(%rax)
  je     L194
  cmp    %cl,-0x7(%rax)
  je     L56
  cmp    %cl,-0x6(%rax)
  je     L305
  cmp    %cl,-0x5(%rax)
  je     L317
  cmp    %cl,-0x4(%rax)
  je     L216
  cmp    %cl,-0x3(%rax)
  je     L283
  cmp    %cl,-0x2(%rax)
  je     L40
  cmp    %cl,-0x1(%rax)
  je     L359
L316:
  lea    -0x8(%rdx),%rsi
  cmp    $0x7,%rsi
  ja     L192
  sub    $0x9,%rdx
  test   %rsi,%rsi
  je     L166
L129:
  cmp    (%rax),%r10b
  je     L27
  lea    0x1(%rax),%r8
  test   %rdx,%rdx
  je     L166
  cmp    0x1(%rax),%r10b
  je     L194
  lea    0x2(%rax),%r8
  cmp    $0x1,%rdx
  je     L166
  cmp    0x2(%rax),%r10b
  je     L194
  lea    0x3(%rax),%r8
  cmp    $0x2,%rdx
  je     L166
  cmp    0x3(%rax),%r10b
  je     L194
  lea    0x4(%rax),%r8
  cmp    $0x3,%rdx
  je     L166
  cmp    0x4(%rax),%r10b
  je     L194
  lea    0x5(%rax),%r8
  cmp    $0x4,%rdx
  je     L166
  cmp    0x5(%rax),%r10b
  je     L194
  lea    0x6(%rax),%r8
  cmp    $0x5,%rdx
  je     L166
  cmp    %r10b,0x6(%rax)
  mov    $0x0,%eax
  cmovne %rax,%r8
L194:
  mov    %r8,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L166:
  xor    %r8d,%r8d
  mov    %r8,%rax
  ret
  nop
L27:
  mov    %rax,%r8
  mov    %r8,%rax
  ret
L56:
  add    $0x1,%r8
  jmp    L194
L305:
  add    $0x2,%r8
  jmp    L194
L317:
  add    $0x3,%r8
  jmp    L194
L216:
  add    $0x4,%r8
  jmp    L194
L283:
  add    $0x5,%r8
  jmp    L194
L40:
  add    $0x6,%r8
  jmp    L194
L359:
  add    $0x7,%r8
  jmp    L194
L209:
  sub    $0x1,%rdx
  jmp    L129
```

assistant: ```c
void *__memchr(void const *s, int c_in, size_t n) {
  const unsigned char *char_ptr;
  const unsigned long int *longword_ptr;
  unsigned long int longword, magic_bits, charmask;
  unsigned char c;
  int i;
  c = (unsigned char)c_in;
  for (char_ptr = (const unsigned char *)s; n > 0 && (size_t)char_ptr % sizeof longword != 0; --n, ++char_ptr)
    if (*char_ptr == c)
      return (void *)char_ptr;
  longword_ptr = (const unsigned long int *)char_ptr;
  magic_bits = 0xfefefefe;
  charmask = c | (c << 8);
  charmask |= charmask << 16;
  magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1);
  while (n >= sizeof longword) {
    longword = *longword_ptr++ ^ charmask;
    if ((((longword + magic_bits) ^ ~longword) & ~magic_bits) != 0) {
      const unsigned char *cp = (const unsigned char *)(longword_ptr - 1);
      if (cp[0] == c)
        return (void *)cp;
      if (cp[1] == c)
        return (void *)&cp[1];
      if (cp[2] == c)
        return (void *)&cp[2];
      if (cp[3] == c)
        return (void *)&cp[3];
      if (4 < sizeof longword && cp[4] == c)
        return (void *)&cp[4];
      if (5 < sizeof longword && cp[5] == c)
        return (void *)&cp[5];
      if (6 < sizeof longword && cp[6] == c)
        return (void *)&cp[6];
      if (7 < sizeof longword && cp[7] == c)
        return (void *)&cp[7];
      if (8 < sizeof longword)
        for (i = 8; i < sizeof longword; i++)
          if (cp[i] == c)
            return (void *)&cp[i];
    }
    n -= sizeof longword;
  }
  char_ptr = (const unsigned char *)longword_ptr;
  while (n-- > 0) {
    if (*char_ptr == c)
      return (void *)char_ptr;
    else
      ++char_ptr;
  }
  return 0;
}
```