user: 这段汇编代码用C语言表示是什么样的:

```asm
<ucs2_to_utf8>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %edx,%edx
  js     L238
  mov    %rdi,%r13
  mov    %rsi,%rbx
  mov    %edx,%ebp
  test   %rsi,%rsi
  je     L208
  test   %edx,%edx
  je     L208
  mov    %edx,%r12d
  and    $0x1,%r12d
  jne    L245
  mov    $0x0,%eax
  jmp    L84
L208:
  mov    $0x0,%r12d
  test   %r13,%r13
  je     L378
  movq   $0x0,0x0(%r13)
  jmp    L378
L49:
  add    $0x2,%rax
  cmp    %eax,%ebp
  jle    L15
L84:
  cmpb   $0x0,(%rbx,%rax,1)
  jne    L49
  cmpb   $0x0,0x1(%rbx,%rax,1)
  jne    L49
  mov    $0xffffffff,%r12d
  jmp    L378
L15:
  movzbl (%rbx),%eax
  cmp    $0xff,%al
  je     L355
  cmp    $0xfe,%al
  je     L207
  mov    %r12d,%ecx
  mov    %r12d,%edx
  mov    $0x0,%eax
L327:
  cmpb   $0x20,(%rbx,%rax,1)
  sbb    $0xffffffff,%edx
  cmpb   $0x20,0x1(%rbx,%rax,1)
  sbb    $0xffffffff,%ecx
  add    $0x2,%rax
  cmp    %eax,%ebp
  jg     L327
  test   %edx,%edx
  setle  %r14b
  movzbl %r14b,%r14d
  jle    L16
  test   %ecx,%ecx
  jg     L265
L16:
  mov    $0x0,%edx
  jmp    L72
L355:
  cmpb   $0xfe,0x1(%rbx)
  je     L356
  mov    %r12d,%ecx
  mov    %r12d,%edx
  mov    $0x0,%eax
  jmp    L327
L356:
  add    $0x2,%rbx
  sub    $0x2,%ebp
  mov    %r12d,%r14d
L5:
  test   %ebp,%ebp
  jg     L16
  test   %r13,%r13
  je     L378
  mov    $0x1,%edi
  call   <xmalloc@plt>
  mov    %rax,%rcx
  mov    %rax,%rsi
L163:
  movb   $0x0,(%rcx)
  mov    %rsi,0x0(%r13)
L378:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L207:
  cmpb   $0xff,0x1(%rbx)
  je     L79
  mov    %r12d,%ecx
  mov    %r12d,%edx
  mov    $0x0,%eax
  jmp    L327
L79:
  add    $0x2,%rbx
  sub    $0x2,%ebp
  mov    $0x1,%r14d
  jmp    L5
L181:
  movzbl 0x1(%rbx,%rdx,1),%eax
  shl    $0x8,%eax
  movzbl (%rbx,%rdx,1),%ecx
  or     %ecx,%eax
  jmp    L121
L226:
  mov    %r12d,%ecx
  cmp    $0x7ff,%eax
  setg   %r12b
  movzbl %r12b,%r12d
  lea    0x2(%r12,%rcx,1),%r12d
L279:
  add    $0x2,%rdx
  cmp    %edx,%ebp
  jle    L87
L72:
  test   %r14d,%r14d
  je     L181
  movzbl (%rbx,%rdx,1),%eax
  shl    $0x8,%eax
  movzbl 0x1(%rbx,%rdx,1),%ecx
  or     %ecx,%eax
L121:
  cmp    $0x7f,%eax
  jg     L226
  add    $0x1,%r12d
  jmp    L279
L187:
  movzbl 0x1(%rbx,%rdx,1),%eax
  shl    $0x8,%eax
  movzbl (%rbx,%rdx,1),%edi
  or     %edi,%eax
  jmp    L243
L221:
  cmp    $0x7ff,%eax
  jg     L249
  mov    %eax,%edi
  sar    $0x6,%edi
  or     $0xffffffc0,%edi
  mov    %dil,(%rcx)
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x1(%rcx)
  lea    0x2(%rcx),%rcx
L317:
  add    $0x2,%rdx
  cmp    %edx,%ebp
  jle    L163
L389:
  test   %r14d,%r14d
  je     L187
  movzbl (%rbx,%rdx,1),%eax
  shl    $0x8,%eax
  movzbl 0x1(%rbx,%rdx,1),%edi
  or     %edi,%eax
L243:
  cmp    $0x7f,%eax
  jg     L221
  mov    %al,(%rcx)
  lea    0x1(%rcx),%rcx
  jmp    L317
L249:
  mov    %eax,%edi
  sar    $0xc,%edi
  or     $0xffffffe0,%edi
  mov    %dil,(%rcx)
  mov    %eax,%edi
  sar    $0x6,%edi
  and    $0x3f,%edi
  or     $0xffffff80,%edi
  mov    %dil,0x1(%rcx)
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x2(%rcx)
  lea    0x3(%rcx),%rcx
  jmp    L317
L238:
  mov    $0xffffffff,%r12d
  jmp    L378
L245:
  mov    $0xffffffff,%r12d
  jmp    L378
L265:
  mov    $0xffffffff,%r12d
  jmp    L378
L87:
  test   %r13,%r13
  je     L378
  lea    0x1(%r12),%edi
  call   <xmalloc@plt>
  mov    %rax,%rsi
  mov    %rax,%rcx
  mov    $0x0,%edx
  jmp    L389
```

assistant: ```c
int ucs2_to_utf8(unsigned char **pu8str, const unsigned char *u16str, int u16len) {
  int i, out_count, c;
  int is_be = 0;
  const unsigned char *u16p = u16str;
  unsigned char *u8o = 0, *u8p = 0;
  if (u16len < 0)
    return -1;
  if (!u16str || !u16len) {
    if (pu8str)
      *pu8str = 0;
    return 0;
  }
  if ((u16len & 1))
    return -1;
  for (i = 0; i < u16len; i += 2) {
    if (!u16str[i] && !u16str[i + 1])
      return -1;
  }
  if (u16str[0] == 0xff && u16str[1] == 0xfe) {
    u16p = u16str + 2;
    u16len -= 2;
  } else if (u16str[0] == 0xfe && u16str[1] == 0xff) {
    u16p = u16str + 2;
    u16len -= 2;
    is_be = 1;
  } else {
    int count0 = 0;
    int count1 = 0;
    for (i = 0; i < u16len; i += 2) {
      if (u16str[i] >= ' ')
        ++count0;
      if (u16str[i + 1] >= ' ')
        ++count1;
    }
    if (count0 <= 0) {
      is_be = 1;
    }
    if (count0 > 0 && count1 > 0) {
      return -1;
    }
  }
  out_count = 0;
  for (i = 0; i < u16len; i += 2) {
    if (is_be) {
      c = (u16p[i] << 8) | u16p[i + 1];
    } else {
      c = (u16p[i + 1] << 8) | u16p[i];
    }
    if (c <= 0x7f) {
      out_count += 1;
    } else if (c <= 0x7ff) {
      out_count += 2;
    } else {
      out_count += 3;
    }
  }
  if (!pu8str)
    return out_count;
  u8o = (unsigned char *)xmalloc(out_count + 1);
  u8p = u8o;
  for (i = 0; i < u16len; i += 2) {
    if (is_be) {
      c = (u16p[i] << 8) | u16p[i + 1];
    } else {
      c = (u16p[i + 1] << 8) | u16p[i];
    }
    if (c <= 0x7f) {
      *u8p++ = c;
    } else if (c <= 0x7ff) {
      *u8p++ = (c >> 6) | 0xc0;
      *u8p++ = (c & 0x3f) | 0x80;
    } else {
      *u8p++ = (c >> 12) | 0xe0;
      *u8p++ = ((c >> 6) & 0x3f) | 0x80;
      *u8p++ = (c & 0x3f) | 0x80;
    }
  }
  *u8p = 0;
  *pu8str = u8o;
  return out_count;
}
```