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

```asm
<long2wcsn>:
  endbr64
  mov    %rsi,%r8
  xor    %eax,%eax
  test   %rdx,%rdx
  je     L133
  test   %rdi,%rdi
  je     L184
  lea    (%rsi,%rdx,4),%r9
  js     L44
  xor    %r11d,%r11d
  mov    %rsi,%rcx
  cmp    %r9,%rsi
  jae    L217
L111:
  movabs $0xcccccccccccccccd,%r10
  mov    %r8,%rcx
  nopl   0x0(%rax)
L132:
  mov    %rdi,%rax
  add    $0x4,%rcx
  mul    %r10
  mov    %rdi,%rax
  shr    $0x3,%rdx
  lea    (%rdx,%rdx,4),%rsi
  add    %rsi,%rsi
  sub    %rsi,%rax
  add    $0x30,%eax
  mov    %eax,-0x4(%rcx)
  mov    %rdi,%rax
  mov    %rdx,%rdi
  cmp    $0x9,%rax
  jle    L94
  cmp    %r9,%rcx
  jb     L132
L94:
  test   %r11d,%r11d
  je     L217
L172:
  movl   $0x2d,(%rcx)
  mov    %rcx,%rsi
  add    $0x4,%rcx
L141:
  cmp    %rsi,%r8
  jae    L20
  mov    %rsi,%rdx
  mov    %r8,%rax
  sub    %r8,%rdx
  sub    $0x1,%rdx
  mov    %rdx,%r10
  shr    $0x3,%r10
  mov    %r10,%rdi
  lea    0x1(%r10),%r9
  neg    %rdi
  lea    (%rsi,%rdi,4),%r11
  lea    (%r8,%r9,4),%rdi
  cmp    %rdi,%r11
  lea    0x4(%rsi),%r11
  setae  %dil
  cmp    %r11,%r8
  setae  %r11b
  or     %r11b,%dil
  je     L113
  cmp    $0x7,%rdx
  jbe    L113
  cmp    $0x17,%rdx
  jbe    L149
  mov    %r9,%rdi
  lea    -0xc(%rsi),%rdx
  shr    $0x2,%rdi
  shl    $0x4,%rdi
  add    %r8,%rdi
L148:
  movdqu (%rdx),%xmm2
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  sub    $0x10,%rdx
  pshufd $0x1b,%xmm2,%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm1,-0x10(%rax)
  movups %xmm0,0x10(%rdx)
  cmp    %rax,%rdi
  jne    L148
  mov    %r9,%rdi
  mov    %rsi,%rax
  and    $0xfffffffffffffffc,%rdi
  lea    0x0(,%rdi,4),%r11
  lea    (%r8,%r11,1),%rdx
  sub    %r11,%rax
  cmp    %rdi,%r9
  je     L20
L15:
  sub    %rdi,%r9
  cmp    %rdi,%r10
  je     L10
  lea    (%r8,%rdi,4),%r10
  not    %rdi
  lea    (%rsi,%rdi,4),%rsi
  movq   (%r10),%xmm0
  movq   (%rsi),%xmm1
  pshufd $0xe1,%xmm0,%xmm0
  pshufd $0xe1,%xmm1,%xmm1
  movq   %xmm1,(%r10)
  movq   %xmm0,(%rsi)
  mov    %r9,%rsi
  and    $0xfffffffffffffffe,%rsi
  lea    0x0(,%rsi,4),%rdi
  add    %rdi,%rdx
  sub    %rdi,%rax
  cmp    %rsi,%r9
  je     L20
L10:
  mov    (%rdx),%esi
  mov    (%rax),%edi
  mov    %edi,(%rdx)
  mov    %esi,(%rax)
L20:
  mov    %rcx,%rax
  movl   $0x0,(%rcx)
  sub    %r8,%rax
  sar    $0x2,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L133:
  ret
  nopl   0x0(%rax)
L184:
  mov    D9(%rip),%rax
  mov    %rax,(%rsi)
  mov    $0x1,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L217:
  lea    -0x4(%rcx),%rsi
  jmp    L141
  nopl   0x0(%rax)
L44:
  sub    $0x4,%r9
  neg    %rdi
  cmp    %r9,%rsi
  jae    L128
  mov    $0x1,%r11d
  jmp    L111
  nopw   0x0(%rax,%rax,1)
L113:
  mov    %r8,%rax
  nopl   0x0(%rax,%rax,1)
L1:
  mov    (%rax),%edx
  mov    (%rsi),%edi
  add    $0x4,%rax
  sub    $0x4,%rsi
  mov    %edi,-0x4(%rax)
  mov    %edx,0x4(%rsi)
  cmp    %rax,%rsi
  ja     L1
  jmp    L20
L149:
  mov    %rsi,%rax
  mov    %r8,%rdx
  xor    %edi,%edi
  jmp    L15
L128:
  mov    %rsi,%rcx
  jmp    L172
```

tool_calls: name: unpack_data
arguments: label: D9
data_type: byte[8]

tool: {"D9": [0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
size_t long2wcsn(long value, wchar_t *ptr, size_t max_count) {
  wchar_t *p;
  wchar_t *t;
  wchar_t *q1, *q2;
  int with_minus = 0;
  if (!(max_count > 0)) {
    return 0;
  }
  p = ptr;
  t = p + max_count;
  if (value == 0) {
    *(p++) = L'0';
    *p = L'\0';
    return 1;
  }
  if (value < 0) {
    with_minus = 1;
    value = -value;
    t = t - 1;
  }
  while (value > 0 && p < t) {
    *(p++) = (value % 10) + L'0';
    value = value / 10;
  }
  if (with_minus) {
    *(p++) = '-';
  }
  for (q1 = ptr, q2 = p - 1; q1 < q2; q1++, q2--) {
    wchar_t a;
    a = *q1;
    *q1 = *q2;
    *q2 = a;
  }
  *p = L'\0';
  return p - ptr;
}
```