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

```asm
<wcsnrtombs>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  mov    (%rsi),%rax
  mov    %rax,0x28(%rsp)
  test   %rdi,%rdi
  je     L209
  test   %rcx,%rcx
  mov    %rcx,%r12
  mov    %rdi,%r15
  setne  %dl
L185:
  test   %rax,%rax
  setne  %r14b
  xor    %ebx,%ebx
  and    %dl,%r14b
  mov    %r14b,0xf(%rsp)
  je     L212
  cmp    $0x20,%r13
  ja     L193
  cmp    %r12,%r13
  jb     L162
L193:
  lea    0x30(%rsp),%rax
  lea    0x28(%rsp),%rbp
  mov    %rax,(%rsp)
L62:
  cmp    %r12,%r13
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  cmovbe %r13,%rdx
  xor    %ecx,%ecx
  sub    %rdx,%r13
  call   <wcsrtombs@plt>
  mov    %rax,%r14
  cmp    $0xffffffffffffffff,%rax
  je     L49
  cmp    (%rsp),%r15
  je     L29
  add    %rax,%r15
  sub    %rax,%r12
L29:
  mov    0x28(%rsp),%rax
  add    %r14,%rbx
  test   %rax,%rax
  je     L63
  test   %r12,%r12
  je     L212
  cmp    $0x20,%r13
  ja     L62
  cmp    %r13,%r12
  jbe    L62
L162:
  test   %r13,%r13
  je     L63
  cmpb   $0x0,0xf(%rsp)
  je     L63
  mov    0x28(%rsp),%rcx
  mov    %rbx,%r14
  add    %rbx,%r13
  jmp    L222
  nopl   0x0(%rax)
L154:
  mov    0x28(%rsp),%rbx
  add    $0x1,%r14
  add    %rax,%r15
  sub    %rax,%r12
  lea    0x4(%rbx),%rcx
  mov    %rcx,0x28(%rsp)
  cmp    %r14,%r13
  je     L49
  test   %r12,%r12
  je     L49
L222:
  mov    (%rcx),%esi
  xor    %edx,%edx
  mov    %r15,%rdi
  call   <wcrtomb@plt>
  lea    0x1(%rax),%rdx
  cmp    $0x1,%rdx
  ja     L154
  test   %rax,%rax
  jne    L61
  movq   $0x0,0x28(%rsp)
L49:
  cmpq   $0x0,0x10(%rsp)
  je     L102
  mov    0x28(%rsp),%rax
  mov    0x18(%rsp),%rbx
  mov    %rax,(%rbx)
L102:
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L94
  add    $0x148,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L209:
  mov    $0x1,%edx
  lea    0x30(%rsp),%r15
  mov    $0x100,%r12d
  jmp    L185
  nopl   (%rax)
L212:
  test   %rax,%rax
  je     L63
  test   %r12,%r12
  setne  0xf(%rsp)
  jmp    L162
  nopw   0x0(%rax,%rax,1)
L61:
  mov    $0xffffffffffffffff,%r14
  jmp    L49
L63:
  mov    %rbx,%r14
  jmp    L49
L94:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
size_t wcsnrtombs(char *dst, const wchar_t **wcs, size_t wn, size_t n, mbstate_t *st) {
  size_t l, cnt = 0, n2;
  char *s, buf[256];
  const wchar_t *ws = *wcs;
  if (!dst)
    s = buf, n = sizeof buf;
  else
    s = dst;
  while (ws && n && ((n2 = wn) >= n || n2 > 32)) {
    if (n2 >= n)
      n2 = n;
    wn -= n2;
    l = wcsrtombs(s, &ws, n2, 0);
    if (!(l + 1)) {
      cnt = l;
      n = 0;
      break;
    }
    if (s != buf) {
      s += l;
      n -= l;
    }
    cnt += l;
  }
  if (ws)
    while (n && wn) {
      l = wcrtomb(s, *ws, 0);
      if ((l + 1) <= 1) {
        if (!l)
          ws = 0;
        else
          cnt = l;
        break;
      }
      ws++;
      wn--;
      s += l;
      n -= l;
      cnt++;
    }
  if (dst)
    *wcs = ws;
  return cnt;
}
```