user: Converte this assembly snippet into its equivalent C code:

```asm
<memset_c>:
  endbr64
  cmp    $0x3,%edx
  jbe    L37
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edx,%ebp
  add    %rdi,%rbp
  shl    $0x18,%esi
  mov    %esi,%eax
  shr    $0x8,%eax
  or     %esi,%eax
  mov    %eax,%ebx
  shr    $0x10,%ebx
  or     %eax,%ebx
  test   $0x1,%dil
  je     L187
  mov    %bl,(%rdi)
  lea    0x1(%rdi),%rdi
L187:
  test   $0x2,%dil
  je     L94
  mov    %bx,(%rdi)
  add    $0x2,%rdi
L94:
  mov    %rbp,%rax
  sub    %rdi,%rax
  mov    %eax,%r12d
  cmp    $0x3,%eax
  jbe    L22
  test   $0x4,%dil
  je     L22
  mov    %ebx,(%rdi)
  lea    -0x4(%rax),%r12d
  lea    0x4(%rdi),%rdi
L22:
  cmp    $0x1f,%r12d
  jbe    L105
  test   $0x8,%dil
  jne    L99
L68:
  test   $0x10,%dil
  jne    L239
L0:
  sub    %rdi,%rbp
  mov    %ebp,%r12d
  sub    $0x20,%r12d
  js     L87
  mov    %r12d,%r13d
L26:
  mov    %ebx,%r8d
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned4@plt>
  mov    %rax,%rdi
  mov    %ebx,%r8d
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned4@plt>
  mov    %rax,%rdi
  sub    $0x20,%r13d
  jns    L26
  and    $0xffffffe0,%r12d
  neg    %r12d
  lea    -0x21(%rbp),%eax
  cmp    $0xffffffff,%eax
  mov    $0x0,%eax
  cmovge %r12d,%eax
  lea    -0x40(%rax,%rbp,1),%r12d
L87:
  test   $0x10,%r12b
  jne    L133
L179:
  and    $0xf,%r12d
  mov    %r12d,%r13d
  sub    $0x8,%r13d
  js     L202
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned2@plt>
  mov    %rax,%rdi
  jmp    L10
L37:
  mov    %rdi,%rax
  test   %edx,%edx
  je     L92
  mov    %sil,(%rdi)
  cmp    $0x1,%edx
  jbe    L39
  mov    %sil,0x1(%rdi)
L39:
  mov    %rdi,%rax
  cmp    $0x3,%edx
  jne    L92
  mov    %sil,0x2(%rdi)
  ret
L99:
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned2@plt>
  mov    %rax,%rdi
  jmp    L68
L239:
  mov    %ebx,%r8d
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned4@plt>
  mov    %rax,%rdi
  jmp    L0
L133:
  mov    %ebx,%r8d
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned4@plt>
  mov    %rax,%rdi
  jmp    L179
L105:
  mov    %r12d,%r13d
  sub    $0x8,%r13d
  js     L202
  mov    %r13d,%ebp
L108:
  mov    %ebx,%edx
  mov    %ebx,%esi
  call   <WriteUnsigned2@plt>
  mov    %rax,%rdi
  sub    $0x8,%ebp
  jns    L108
L10:
  mov    %r13d,%eax
  and    $0xfffffff8,%eax
  neg    %eax
  sub    $0x9,%r12d
  cmp    $0xffffffff,%r12d
  mov    $0x0,%edx
  cmovl  %edx,%eax
  lea    -0x8(%r13,%rax,1),%r13d
L202:
  test   $0x4,%r13b
  je     L81
  mov    %ebx,(%rdi)
  lea    0x4(%rdi),%rdi
L81:
  test   $0x2,%r13b
  je     L69
  mov    %bx,(%rdi)
  add    $0x2,%rdi
L69:
  mov    $0x0,%eax
  test   $0x1,%r13b
  je     L132
  mov    %bl,(%rdi)
L132:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L92:
  ret
```

assistant: ```c
char *memset_c(char *restrict ptr, unsigned char fillC, unsigned len) {
  if (len <= 3) {
    if (len >= 1)
      ptr[0] = fillC;
    if (len > 1)
      ptr[1] = fillC;
    if (len == 3)
      ptr[2] = fillC;
    return ptr;
  }
  unsigned fill = (unsigned)fillC;
  char *end = ptr + len;
  {
    unsigned shift = fill << 24;
    shift = shift | (shift >> 8);
    fill = shift | (shift >> 16);
  }
  if ((unsigned)ptr & 1)
    *ptr++ = fill;
  if ((unsigned)ptr & 2) {
    *(unsigned short *)ptr = fill;
    ptr += 2;
  }
  unsigned remain = end - ptr;
  unsigned *restrict wordptr = (unsigned *restrict)ptr;
  if (remain >= 4 && ((unsigned)wordptr & 4)) {
    *wordptr++ = fill;
    remain -= 4;
  }
  if (remain >= 32) {
    if ((unsigned)wordptr & 8)
      wordptr = WriteUnsigned2(wordptr, fill, fill);
    if ((unsigned)wordptr & 16)
      wordptr = WriteUnsigned4(wordptr, fill, fill, fill, fill);
    remain = end - (char *)wordptr;
    remain -= 32;
    while ((int)remain >= 0) {
      wordptr = WriteUnsigned4(wordptr, fill, fill, fill, fill);
      wordptr = WriteUnsigned4(wordptr, fill, fill, fill, fill);
      remain -= 32;
    }
    if ((unsigned)remain & 16)
      wordptr = WriteUnsigned4(wordptr, fill, fill, fill, fill);
    remain &= 0xFU;
  }
  remain -= 8;
  while ((int)remain >= 0) {
    wordptr = WriteUnsigned2(wordptr, fill, fill);
    remain -= 8;
  }
  if (remain & 4)
    *wordptr++ = fill;
  ptr = (char *restrict)wordptr;
  if (remain & 2) {
    *(unsigned short *)ptr = fill;
    ptr += 2;
  }
  if (remain & 1)
    *ptr++ = fill;
  return 0;
}
```