user: Demonstrate the C code that generates the assembly output below:

```asm
<mbsnrtowcs>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  sub    $0x458,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %rsi,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x448(%rsp)
  mov    (%rsi),%rax
  mov    %rax,0x38(%rsp)
  test   %rdi,%rdi
  je     L146
  test   %rcx,%rcx
  mov    %rcx,%rbx
  mov    %rdi,%r14
  setne  %dl
L131:
  test   %rax,%rax
  setne  %cl
  and    %dl,%cl
  mov    %cl,0x1f(%rsp)
  je     L85
  movq   $0x0,0x8(%rsp)
  mov    %r13,%rdx
  shr    $0x2,%rdx
  cmp    $0x83,%r13
  ja     L26
  cmp    %rdx,%rbx
  ja     L9
L26:
  lea    0x40(%rsp),%rax
  lea    0x38(%rsp),%r12
  mov    %rax,0x10(%rsp)
  nopw   0x0(%rax,%rax,1)
L175:
  cmp    %rdx,%rbx
  mov    %rbp,%rcx
  mov    %r12,%rsi
  mov    %r14,%rdi
  cmovbe %rbx,%rdx
  sub    %rdx,%r13
  call   <mbsrtowcs@plt>
  mov    %rax,%r15
  cmp    $0xffffffffffffffff,%rax
  je     L52
  cmp    0x10(%rsp),%r14
  je     L40
  lea    (%r14,%rax,4),%r14
  sub    %rax,%rbx
L40:
  mov    0x38(%rsp),%rax
  add    %r15,0x8(%rsp)
  test   %rax,%rax
  je     L204
  test   %rbx,%rbx
  je     L64
  mov    %r13,%rdx
  shr    $0x2,%rdx
  cmp    %rdx,%rbx
  jbe    L175
  cmp    $0x83,%r13
  ja     L175
L9:
  test   %r13,%r13
  je     L204
  cmpb   $0x0,0x1f(%rsp)
  je     L204
  mov    0x8(%rsp),%r15
  mov    0x38(%rsp),%rsi
  add    %r15,%rbx
  jmp    L8
  nop
L224:
  mov    0x38(%rsp),%rsi
  add    $0x1,%r15
  sub    %rax,%r13
  add    $0x4,%r14
  add    %rax,%rsi
  mov    %rsi,0x38(%rsp)
  cmp    %r15,%rbx
  je     L52
  test   %r13,%r13
  je     L52
L8:
  mov    %r13,%rdx
  mov    %rbp,%rcx
  mov    %r14,%rdi
  call   <mbrtowc@plt>
  lea    0x2(%rax),%rdx
  cmp    $0x2,%rdx
  ja     L224
  cmp    $0xffffffffffffffff,%rax
  je     L1
  movl   $0x0,0x0(%rbp)
L52:
  cmpq   $0x0,0x20(%rsp)
  je     L113
  mov    0x38(%rsp),%rax
  mov    0x28(%rsp),%rcx
  mov    %rax,(%rcx)
L113:
  mov    0x448(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L212
  add    $0x458,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L146:
  mov    $0x1,%edx
  lea    0x40(%rsp),%r14
  mov    $0x100,%ebx
  jmp    L131
L85:
  movq   $0x0,0x8(%rsp)
  nopl   (%rax)
L64:
  test   %rax,%rax
  je     L204
  test   %rbx,%rbx
  setne  0x1f(%rsp)
  jmp    L9
L1:
  mov    $0xffffffffffffffff,%r15
  jmp    L52
L204:
  mov    0x8(%rsp),%r15
  jmp    L52
L212:
  call   <__stack_chk_fail@plt>
```

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;
}
```