user: What is the c source code of the assembly code below:

```asm
<__strnlen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  jne    L195
  mov    $0x0,%eax
  jmp    L255
L195:
  mov    -0x38(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  setb   %al
  movzbl %al,%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <__builtin_expect@plt>
  test   %rax,%rax
  je     L142
  movq   $0xffffffffffffffff,-0x38(%rbp)
L142:
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L189
L235:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L75
  mov    -0x40(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jbe    L76
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x40(%rbp)
L76:
  mov    -0x40(%rbp),%rax
  sub    -0x48(%rbp),%rax
  jmp    L255
L75:
  addq   $0x1,-0x40(%rbp)
L189:
  mov    -0x40(%rbp),%rax
  and    $0x7,%eax
  test   %rax,%rax
  jne    L235
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  movq   $0x7efefeff,-0x28(%rbp)
  mov    $0x80808080,%eax
  mov    %rax,-0x20(%rbp)
  movq   $0x1010101,-0x18(%rbp)
  movabs $0x7efefefefefefeff,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  shl    $0x20,%rax
  or     %rax,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  shl    $0x20,%rax
  or     %rax,-0x18(%rbp)
  jmp    L58
L66:
  mov    -0x30(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  sub    -0x18(%rbp),%rax
  and    -0x20(%rbp),%rax
  test   %rax,%rax
  je     L130
  mov    -0x30(%rbp),%rax
  sub    $0x8,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L119
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L109
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L114
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L238
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L43
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L37
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L111
  mov    -0x8(%rbp),%rax
  add    $0x7,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x7,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L253
L130:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x40(%rbp)
L58:
  mov    -0x30(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jb     L66
  jmp    L116
L119:
  nop
  jmp    L116
L109:
  nop
  jmp    L116
L114:
  nop
  jmp    L116
L238:
  nop
  jmp    L116
L43:
  nop
  jmp    L116
L37:
  nop
  jmp    L116
L111:
  nop
  jmp    L116
L253:
  nop
L116:
  mov    -0x40(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jbe    L160
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x40(%rbp)
L160:
  mov    -0x40(%rbp),%rax
  sub    -0x48(%rbp),%rax
L255:
  leave
  ret
```

assistant: ```c
size_t __strnlen(const char *str, size_t maxlen) {
  const char *char_ptr, *end_ptr = str + maxlen;
  const unsigned long int *longword_ptr;
  unsigned long int longword, magic_bits, himagic, lomagic;
  if (maxlen == 0)
    return 0;
  if (__builtin_expect(end_ptr < str, 0))
    end_ptr = (const char *)~0UL;
  for (char_ptr = str; ((unsigned long int)char_ptr & (sizeof(longword) - 1)) != 0; ++char_ptr)
    if (*char_ptr == '\0') {
      if (char_ptr > end_ptr)
        char_ptr = end_ptr;
      return char_ptr - str;
    }
  longword_ptr = (unsigned long int *)char_ptr;
  magic_bits = 0x7efefeffL;
  himagic = 0x80808080L;
  lomagic = 0x01010101L;
  if (sizeof(longword) > 4) {
    magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
    himagic = ((himagic << 16) << 16) | himagic;
    lomagic = ((lomagic << 16) << 16) | lomagic;
  }
  if (sizeof(longword) > 8)
    abort();
  while (longword_ptr < (unsigned long int *)end_ptr) {
    longword = *longword_ptr++;
    if ((longword - lomagic) & himagic) {
      const char *cp = (const char *)(longword_ptr - 1);
      char_ptr = cp;
      if (cp[0] == 0)
        break;
      char_ptr = cp + 1;
      if (cp[1] == 0)
        break;
      char_ptr = cp + 2;
      if (cp[2] == 0)
        break;
      char_ptr = cp + 3;
      if (cp[3] == 0)
        break;
      if (sizeof(longword) > 4) {
        char_ptr = cp + 4;
        if (cp[4] == 0)
          break;
        char_ptr = cp + 5;
        if (cp[5] == 0)
          break;
        char_ptr = cp + 6;
        if (cp[6] == 0)
          break;
        char_ptr = cp + 7;
        if (cp[7] == 0)
          break;
      }
    }
    char_ptr = end_ptr;
  }
  if (char_ptr > end_ptr)
    char_ptr = end_ptr;
  return char_ptr - str;
}
```