user: 请从给定的汇编指令推导出C源代码:

```asm
<XConvertUcsToUtf8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  cmpl   $0x7f,-0x4(%rbp)
  ja     L44
  mov    -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %dl,(%rax)
  mov    $0x1,%eax
  jmp    L93
L44:
  cmpl   $0x7ff,-0x4(%rbp)
  ja     L2
  mov    -0x4(%rbp),%eax
  shr    $0x6,%eax
  or     $0xffffffc0,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    $0x2,%eax
  jmp    L93
L2:
  cmpl   $0xffff,-0x4(%rbp)
  ja     L49
  mov    -0x4(%rbp),%eax
  shr    $0xc,%eax
  or     $0xffffffe0,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0x6,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  mov    $0x3,%eax
  jmp    L93
L49:
  cmpl   $0x1fffff,-0x4(%rbp)
  ja     L16
  mov    -0x4(%rbp),%eax
  shr    $0x12,%eax
  or     $0xfffffff0,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0xc,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0x6,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  mov    $0x4,%eax
  jmp    L93
L16:
  cmpl   $0xffffff,-0x4(%rbp)
  ja     L82
  mov    -0x4(%rbp),%eax
  shr    $0x18,%eax
  or     $0xfffffff8,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0x12,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0xc,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  shr    $0x6,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    %dl,(%rax)
  mov    $0x5,%eax
  jmp    L93
L82:
  mov    -0x10(%rbp),%rax
  movb   $0x3f,(%rax)
  mov    $0xffffffff,%eax
L93:
  pop    %rbp
  ret
```

assistant: ```c
int XConvertUcsToUtf8(unsigned int ucs, char *buf) {
  if (ucs < 0x000080) {
    buf[0] = ucs;
    return 1;
  } else if (ucs < 0x000800) {
    buf[0] = 0xC0 | (ucs >> 6);
    buf[1] = 0x80 | (ucs & 0x3F);
    return 2;
  } else if (ucs < 0x010000) {
    buf[0] = 0xE0 | (ucs >> 12);
    buf[1] = 0x80 | ((ucs >> 6) & 0x3F);
    buf[2] = 0x80 | (ucs & 0x3F);
    return 3;
  } else if (ucs < 0x00200000) {
    buf[0] = 0xF0 | (ucs >> 18);
    buf[1] = 0x80 | ((ucs >> 12) & 0x3F);
    buf[2] = 0x80 | ((ucs >> 6) & 0x3F);
    buf[3] = 0x80 | (ucs & 0x3F);
    return 4;
  } else if (ucs < 0x01000000) {
    buf[0] = 0xF8 | (ucs >> 24);
    buf[1] = 0x80 | ((ucs >> 18) & 0x3F);
    buf[2] = 0x80 | ((ucs >> 12) & 0x3F);
    buf[3] = 0x80 | ((ucs >> 6) & 0x3F);
    buf[4] = 0x80 | (ucs & 0x3F);
    return 5;
  }
  buf[0] = '?';
  return -1;
}
```