user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<arikkei_utf8_ucs2_strcpy>:
  endbr64
  mov    %rdi,%rdx
  mov    %rsi,%r8
  movzbl (%rdi),%eax
  test   %al,%al
  je     L149
  mov    $0x1,%esi
  jmp    L19
L95:
  mov    %ecx,%ecx
  movzbl %al,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x1,%rdx
L53:
  movzbl (%rdx),%eax
  lea    0x1(%rsi),%ecx
  test   %al,%al
  je     L35
  mov    %ecx,%esi
L19:
  lea    -0x1(%rsi),%ecx
  test   %al,%al
  jns    L95
  movzbl %al,%edi
  mov    %eax,%r9d
  and    $0xffffffe0,%r9d
  cmp    $0xc0,%r9b
  je     L108
  mov    %eax,%r9d
  and    $0xfffffff0,%r9d
  cmp    $0xe0,%r9b
  je     L57
  mov    %eax,%edi
  and    $0xfffffff8,%edi
  cmp    $0xf0,%dil
  je     L145
  mov    %eax,%edi
  and    $0xfffffffc,%edi
  cmp    $0xf8,%dil
  je     L135
  and    $0xfffffffe,%eax
  cmp    $0xfc,%al
  jne    L67
  mov    %ecx,%ecx
  movzbl 0x3(%rdx),%edi
  shl    $0xc,%edi
  movzbl 0x5(%rdx),%eax
  and    $0x3f,%eax
  or     %edi,%eax
  movzbl 0x4(%rdx),%edi
  shl    $0x6,%edi
  and    $0xfc0,%di
  or     %edi,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x6,%rdx
  jmp    L53
L108:
  mov    %ecx,%ecx
  shl    $0x6,%edi
  and    $0x7c0,%di
  movzbl 0x1(%rdx),%eax
  and    $0x3f,%eax
  or     %eax,%edi
  mov    %di,(%r8,%rcx,2)
  add    $0x2,%rdx
  jmp    L53
L57:
  mov    %ecx,%ecx
  movzbl 0x2(%rdx),%eax
  and    $0x3f,%eax
  shl    $0xc,%edi
  or     %edi,%eax
  movzbl 0x1(%rdx),%edi
  shl    $0x6,%edi
  and    $0xfc0,%di
  or     %edi,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x3,%rdx
  jmp    L53
L145:
  mov    %ecx,%ecx
  movzbl 0x1(%rdx),%edi
  shl    $0xc,%edi
  movzbl 0x3(%rdx),%eax
  and    $0x3f,%eax
  or     %edi,%eax
  movzbl 0x2(%rdx),%edi
  shl    $0x6,%edi
  and    $0xfc0,%di
  or     %edi,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x4,%rdx
  jmp    L53
L135:
  mov    %ecx,%ecx
  movzbl 0x2(%rdx),%edi
  shl    $0xc,%edi
  movzbl 0x4(%rdx),%eax
  and    $0x3f,%eax
  or     %edi,%eax
  movzbl 0x3(%rdx),%edi
  shl    $0x6,%edi
  and    $0xfc0,%di
  or     %edi,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x5,%rdx
  jmp    L53
L149:
  mov    $0x0,%esi
  jmp    L35
L67:
  mov    %ecx,%esi
L35:
  mov    %esi,%eax
  movw   $0x0,(%r8,%rax,2)
  mov    %esi,%eax
  ret
```

assistant: ```c
unsigned int arikkei_utf8_ucs2_strcpy(const unsigned char *s, unsigned short *d) {
  unsigned int dp;
  dp = 0;
  while (*s) {
    if ((*s & 0x80) == 0x0) {
      d[dp++] = s[0];
      s += 1;
    } else if ((*s & 0xe0) == 0xc0) {
      d[dp++] = ((s[0] & 0x1f) << 6) | (s[1] & 0x3f);
      s += 2;
    } else if ((*s & 0xf0) == 0xe0) {
      d[dp++] = ((s[0] & 0x0f) << 12) | ((s[1] & 0x3f) << 6) | (s[2] & 0x3f);
      s += 3;
    } else if ((*s & 0xf8) == 0xf0) {
      d[dp++] = ((s[0] & 0x07) << 18) | ((s[1] & 0x3f) << 12) | ((s[2] & 0x3f) << 6) | (s[3] & 0x3f);
      s += 4;
    } else if ((*s & 0xfc) == 0xf8) {
      d[dp++] = ((s[0] & 0x03) << 24) | ((s[1] & 0x3f) << 18) | ((s[2] & 0x3f) << 12) | ((s[3] & 0x3f) << 6) | (s[4] & 0x3f);
      s += 5;
    } else if ((*s & 0xfe) == 0xfc) {
      d[dp++] = ((s[0] & 0x01) << 30) | ((s[1] & 0x3f) << 24) | ((s[2] & 0x3f) << 18) | ((s[3] & 0x3f) << 12) | ((s[4] & 0x3f) << 6) | (s[5] & 0x3f);
      s += 6;
    } else {
      break;
    }
  }
  d[dp] = 0;
  return dp;
}
```