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

```asm
<mbsnrtowcs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x470,%rsp
  mov    %rdi,-0x448(%rbp)
  mov    %rsi,-0x450(%rbp)
  mov    %rdx,-0x458(%rbp)
  mov    %rcx,-0x460(%rbp)
  mov    %r8,-0x468(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x430(%rbp)
  mov    -0x450(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x438(%rbp)
  cmpq   $0x0,-0x448(%rbp)
  jne    L72
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x420(%rbp)
  movq   $0x100,-0x460(%rbp)
  jmp    L175
L72:
  mov    -0x448(%rbp),%rax
  mov    %rax,-0x420(%rbp)
  jmp    L175
L95:
  mov    -0x428(%rbp),%rax
  cmp    -0x460(%rbp),%rax
  jb     L1
  mov    -0x460(%rbp),%rax
  mov    %rax,-0x428(%rbp)
L1:
  mov    -0x428(%rbp),%rax
  sub    %rax,-0x458(%rbp)
  mov    -0x468(%rbp),%rcx
  mov    -0x428(%rbp),%rdx
  lea    -0x438(%rbp),%rsi
  mov    -0x420(%rbp),%rax
  mov    %rax,%rdi
  call   <mbsrtowcs@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0xffffffffffffffff,-0x418(%rbp)
  jne    L85
  mov    -0x418(%rbp),%rax
  mov    %rax,-0x430(%rbp)
  movq   $0x0,-0x460(%rbp)
  jmp    L194
L85:
  lea    -0x410(%rbp),%rax
  cmp    %rax,-0x420(%rbp)
  je     L207
  mov    -0x418(%rbp),%rax
  shl    $0x2,%rax
  add    %rax,-0x420(%rbp)
  mov    -0x418(%rbp),%rax
  sub    %rax,-0x460(%rbp)
L207:
  mov    -0x418(%rbp),%rax
  add    %rax,-0x430(%rbp)
L175:
  mov    -0x438(%rbp),%rax
  test   %rax,%rax
  je     L194
  cmpq   $0x0,-0x460(%rbp)
  je     L194
  mov    -0x458(%rbp),%rax
  shr    $0x2,%rax
  mov    %rax,-0x428(%rbp)
  mov    -0x428(%rbp),%rax
  cmp    -0x460(%rbp),%rax
  jae    L95
  cmpq   $0x20,-0x428(%rbp)
  ja     L95
L194:
  mov    -0x438(%rbp),%rax
  test   %rax,%rax
  je     L76
  jmp    L185
L125:
  mov    -0x438(%rbp),%rsi
  mov    -0x468(%rbp),%rcx
  mov    -0x458(%rbp),%rdx
  mov    -0x420(%rbp),%rax
  mov    %rax,%rdi
  call   <mbrtowc@plt>
  mov    %rax,-0x418(%rbp)
  mov    -0x418(%rbp),%rax
  add    $0x2,%rax
  cmp    $0x2,%rax
  ja     L198
  cmpq   $0xffffffffffffffff,-0x418(%rbp)
  jne    L11
  mov    -0x418(%rbp),%rax
  mov    %rax,-0x430(%rbp)
  jmp    L76
L11:
  mov    -0x468(%rbp),%rax
  movl   $0x0,(%rax)
  jmp    L76
L198:
  mov    -0x438(%rbp),%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x438(%rbp)
  mov    -0x418(%rbp),%rax
  sub    %rax,-0x458(%rbp)
  addq   $0x4,-0x420(%rbp)
  subq   $0x1,-0x460(%rbp)
  addq   $0x1,-0x430(%rbp)
L185:
  cmpq   $0x0,-0x460(%rbp)
  je     L76
  cmpq   $0x0,-0x458(%rbp)
  jne    L125
L76:
  cmpq   $0x0,-0x448(%rbp)
  je     L158
  mov    -0x438(%rbp),%rdx
  mov    -0x450(%rbp),%rax
  mov    %rdx,(%rax)
L158:
  mov    -0x430(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L103
  call   <__stack_chk_fail@plt>
L103:
  leave
  ret
```

assistant: ```c
size_t mbsnrtowcs(wchar_t *wcs, const char **src, size_t n, size_t wn, mbstate_t *st) {
  size_t l, cnt = 0, n2;
  wchar_t *ws, wbuf[256];
  const char *s = *src;
  if (!wcs)
    ws = wbuf, wn = sizeof wbuf / sizeof *wbuf;
  else
    ws = wcs;
  while (s && wn && ((n2 = n / 4) >= wn || n2 > 32)) {
    if (n2 >= wn)
      n2 = wn;
    n -= n2;
    l = mbsrtowcs(ws, &s, n2, st);
    if (!(l + 1)) {
      cnt = l;
      wn = 0;
      break;
    }
    if (ws != wbuf) {
      ws += l;
      wn -= l;
    }
    cnt += l;
  }
  if (s)
    while (wn && n) {
      l = mbrtowc(ws, s, n, st);
      if (l + 2 <= 2) {
        if (!(l + 1)) {
          cnt = l;
          break;
        }
        *(unsigned *)st = 0;
        break;
      }
      s += l;
      n -= l;
      ws++;
      wn--;
      cnt++;
    }
  if (wcs)
    *src = s;
  return cnt;
}
```