user: 请从给定的汇编指令推导出C源代码：

```asm
<__wcsncat_chk>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  jmp    L167
  nopl   (%rax)
L35:
  mov    (%rbx),%ecx
  lea    0x4(%rbx),%rdx
  lea    -0x1(%rbp),%rax
  test   %ecx,%ecx
  je     L189
L140:
  mov    %rax,%rbp
  mov    %rdx,%rbx
L167:
  xor    %edi,%edi
  test   %rbp,%rbp
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  je     L35
  xor    %eax,%eax
  call   <__chk_fail@plt>
  mov    (%rbx),%ecx
  lea    0x4(%rbx),%rdx
  lea    -0x1(%rbp),%rax
  test   %ecx,%ecx
  jne    L140
L189:
  sub    $0x4,%rbx
  cmp    $0x3,%r13
  jbe    L230
  mov    %r13,%rax
  mov    %rbp,%r15
  and    $0xfffffffffffffffc,%rax
  sub    %rax,%r15
  jmp    L233
  nopl   0x0(%rax)
L207:
  mov    (%r12),%eax
  mov    %eax,0x4(%rbx)
  test   %eax,%eax
  je     L81
L273:
  xor    %edi,%edi
  cmp    $0x1,%rbp
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  jne    L172
L1:
  mov    0x4(%r12),%eax
  mov    %eax,0x8(%rbx)
  test   %eax,%eax
  je     L81
  xor    %edi,%edi
  cmp    $0x2,%rbp
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  jne    L134
L88:
  mov    0x8(%r12),%eax
  mov    %eax,0xc(%rbx)
  test   %eax,%eax
  je     L81
  xor    %edi,%edi
  cmp    $0x3,%rbp
  lea    -0x4(%rbp),%r14
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  jne    L76
L269:
  mov    0xc(%r12),%eax
  add    $0x10,%r12
  add    $0x10,%rbx
  mov    %eax,(%rbx)
  test   %eax,%eax
  je     L81
  cmp    %r15,%r14
  je     L159
  mov    %r14,%rbp
L233:
  xor    %edi,%edi
  test   %rbp,%rbp
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  je     L207
  xor    %eax,%eax
  call   <__chk_fail@plt>
  mov    (%r12),%eax
  mov    %eax,0x4(%rbx)
  test   %eax,%eax
  jne    L273
L81:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L172:
  xor    %eax,%eax
  call   <__chk_fail@plt>
  jmp    L1
  nopl   0x0(%rax)
L134:
  xor    %eax,%eax
  call   <__chk_fail@plt>
  jmp    L88
  nopl   0x0(%rax)
L76:
  xor    %eax,%eax
  call   <__chk_fail@plt>
  jmp    L269
  nopl   0x0(%rax)
L230:
  test   %r13,%r13
  je     L81
L147:
  mov    %rbp,%r14
  jmp    L178
  nopw   0x0(%rax,%rax,1)
L36:
  mov    (%r12),%eax
  add    $0x4,%r12
  add    $0x4,%rbx
  mov    %eax,(%rbx)
  test   %eax,%eax
  je     L81
  lea    (%r14,%r13,1),%rax
  cmp    %rbp,%rax
  je     L149
L178:
  mov    %r14,%rax
  xor    %edi,%edi
  sub    $0x1,%r14
  test   %rax,%rax
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  je     L36
  xor    %eax,%eax
  call   <__chk_fail@plt>
  jmp    L36
  xchg   %ax,%ax
L149:
  xor    %edi,%edi
  test   %r14,%r14
  sete   %dil
  call   <__glibc_unlikely@plt>
  test   %rax,%rax
  jne    L263
L47:
  movl   $0x0,0x4(%rbx)
  jmp    L81
  nop
L159:
  and    $0x3,%r13d
  je     L149
  mov    %r14,%rbp
  jmp    L147
L263:
  xor    %eax,%eax
  call   <__chk_fail@plt>
  jmp    L47
```

assistant: ```c
wchar_t *__wcsncat_chk(wchar_t *dest, const wchar_t *src, size_t n, size_t destlen) {
  wchar_t c;
  wchar_t *const s = dest;
  do {
    if (__glibc_unlikely(destlen-- == 0))
      __chk_fail();
    c = *dest++;
  } while (c != L'\0');
  ++destlen;
  dest -= 2;
  if (n >= 4) {
    size_t n4 = n >> 2;
    do {
      if (__glibc_unlikely(destlen-- == 0))
        __chk_fail();
      c = *src++;
      *++dest = c;
      if (c == L'\0')
        return s;
      if (__glibc_unlikely(destlen-- == 0))
        __chk_fail();
      c = *src++;
      *++dest = c;
      if (c == L'\0')
        return s;
      if (__glibc_unlikely(destlen-- == 0))
        __chk_fail();
      c = *src++;
      *++dest = c;
      if (c == L'\0')
        return s;
      if (__glibc_unlikely(destlen-- == 0))
        __chk_fail();
      c = *src++;
      *++dest = c;
      if (c == L'\0')
        return s;
    } while (--n4 > 0);
    n &= 3;
  }
  while (n > 0) {
    if (__glibc_unlikely(destlen-- == 0))
      __chk_fail();
    c = *src++;
    *++dest = c;
    if (c == L'\0')
      return s;
    n--;
  }
  if (c != L'\0') {
    if (__glibc_unlikely(destlen-- == 0))
      __chk_fail();
    *++dest = L'\0';
  }
  return s;
}
```