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

```asm
<utf8_wctomb>:
  endbr64
  mov    %esi,%eax
  test   %rdi,%rdi
  je     L11
  cmp    $0x7f,%esi
  jbe    L14
  cmp    $0x7ff,%esi
  jbe    L69
  cmp    $0xffff,%esi
  jbe    L10
  cmp    $0x1fffff,%esi
  jbe    L21
  cmp    $0x3ffffff,%esi
  jbe    L66
  test   %esi,%esi
  js     L49
  mov    %esi,%ecx
  and    $0x3f,%eax
  shr    $0x1e,%ecx
  or     $0xffffff80,%eax
  or     $0xfffffffc,%ecx
  mov    %al,0x5(%rdi)
  mov    $0x6,%eax
  mov    %cl,(%rdi)
  mov    %esi,%ecx
  shr    $0x18,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x1(%rdi)
  mov    %esi,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x2(%rdi)
  mov    %esi,%ecx
  shr    $0xc,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x3(%rdi)
  mov    %esi,%ecx
  shr    $0x6,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x4(%rdi)
  ret
  nopl   0x0(%rax)
L14:
  mov    %sil,(%rdi)
  mov    $0x1,%eax
  ret
  nopl   0x0(%rax)
L69:
  mov    %esi,%ecx
  and    $0x3f,%eax
  shr    $0x6,%ecx
  or     $0xffffff80,%eax
  or     $0xffffffc0,%ecx
  mov    %al,0x1(%rdi)
  mov    $0x2,%eax
  mov    %cl,(%rdi)
  ret
  nopl   0x0(%rax)
L11:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L10:
  mov    %esi,%ecx
  and    $0x3f,%eax
  shr    $0xc,%ecx
  or     $0xffffff80,%eax
  or     $0xffffffe0,%ecx
  mov    %al,0x2(%rdi)
  mov    $0x3,%eax
  mov    %cl,(%rdi)
  mov    %esi,%ecx
  shr    $0x6,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x1(%rdi)
  ret
  nopw   0x0(%rax,%rax,1)
L21:
  mov    %esi,%ecx
  and    $0x3f,%eax
  shr    $0x12,%ecx
  or     $0xffffff80,%eax
  or     $0xfffffff0,%ecx
  mov    %al,0x3(%rdi)
  mov    $0x4,%eax
  mov    %cl,(%rdi)
  mov    %esi,%ecx
  shr    $0xc,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x1(%rdi)
  mov    %esi,%ecx
  shr    $0x6,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x2(%rdi)
  ret
  nopl   (%rax)
L66:
  mov    %esi,%ecx
  and    $0x3f,%eax
  shr    $0x18,%ecx
  or     $0xffffff80,%eax
  or     $0xfffffff8,%ecx
  mov    %al,0x4(%rdi)
  mov    $0x5,%eax
  mov    %cl,(%rdi)
  mov    %esi,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x1(%rdi)
  mov    %esi,%ecx
  shr    $0xc,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x2(%rdi)
  mov    %esi,%ecx
  shr    $0x6,%ecx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,0x3(%rdi)
  ret
L49:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int utf8_wctomb(char *s, int wc1) {
  unsigned int wc = wc1;
  if (!s)
    return 0;
  if (wc < (1 << 7)) {
    *s++ = wc;
    return 1;
  } else if (wc < (1 << 11)) {
    *s++ = 0xc0 | (wc >> 6);
    *s++ = 0x80 | (wc & 0x3f);
    return 2;
  } else if (wc < (1 << 16)) {
    *s++ = 0xe0 | (wc >> 12);
    *s++ = 0x80 | ((wc >> 6) & 0x3f);
    *s++ = 0x80 | (wc & 0x3f);
    return 3;
  } else if (wc < (1 << 21)) {
    *s++ = 0xf0 | (wc >> 18);
    *s++ = 0x80 | ((wc >> 12) & 0x3f);
    *s++ = 0x80 | ((wc >> 6) & 0x3f);
    *s++ = 0x80 | (wc & 0x3f);
    return 4;
  } else if (wc < (1 << 26)) {
    *s++ = 0xf8 | (wc >> 24);
    *s++ = 0x80 | ((wc >> 18) & 0x3f);
    *s++ = 0x80 | ((wc >> 12) & 0x3f);
    *s++ = 0x80 | ((wc >> 6) & 0x3f);
    *s++ = 0x80 | (wc & 0x3f);
    return 5;
  } else if (wc < (1 << 31)) {
    *s++ = 0xfc | (wc >> 30);
    *s++ = 0x80 | ((wc >> 24) & 0x3f);
    *s++ = 0x80 | ((wc >> 18) & 0x3f);
    *s++ = 0x80 | ((wc >> 12) & 0x3f);
    *s++ = 0x80 | ((wc >> 6) & 0x3f);
    *s++ = 0x80 | (wc & 0x3f);
    return 6;
  } else
    return -1;
}
```