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

```asm
<ucs2_to_utf8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  movq   $0x0,-0x10(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jns    L12
  mov    $0xffffffff,%eax
  jmp    L249
L12:
  cmpq   $0x0,-0x40(%rbp)
  je     L57
  cmpl   $0x0,-0x44(%rbp)
  jne    L165
L57:
  cmpq   $0x0,-0x38(%rbp)
  je     L18
  mov    -0x38(%rbp),%rax
  movq   $0x0,(%rax)
L18:
  mov    $0x0,%eax
  jmp    L249
L165:
  mov    -0x44(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L187
  mov    $0xffffffff,%eax
  jmp    L249
L187:
  movl   $0x0,-0x30(%rbp)
  jmp    L111
L97:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L432
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L432
  mov    $0xffffffff,%eax
  jmp    L249
L432:
  addl   $0x2,-0x30(%rbp)
L111:
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L97
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  jne    L175
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0xfe,%al
  jne    L175
  mov    -0x40(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x18(%rbp)
  subl   $0x2,-0x44(%rbp)
  jmp    L366
L175:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xfe,%al
  jne    L374
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  jne    L374
  mov    -0x40(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x18(%rbp)
  subl   $0x2,-0x44(%rbp)
  movl   $0x1,-0x24(%rbp)
  jmp    L366
L374:
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L269
L348:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  jbe    L98
  addl   $0x1,-0x20(%rbp)
L98:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  jbe    L237
  addl   $0x1,-0x1c(%rbp)
L237:
  addl   $0x2,-0x30(%rbp)
L269:
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L348
  cmpl   $0x0,-0x20(%rbp)
  jg     L355
  movl   $0x1,-0x24(%rbp)
L355:
  cmpl   $0x0,-0x20(%rbp)
  jle    L366
  cmpl   $0x0,-0x1c(%rbp)
  jle    L366
  mov    $0xffffffff,%eax
  jmp    L249
L366:
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L389
L443:
  cmpl   $0x0,-0x24(%rbp)
  je     L343
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %edx,%eax
  mov    %eax,-0x28(%rbp)
  jmp    L84
L343:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x28(%rbp)
L84:
  cmpl   $0x7f,-0x28(%rbp)
  jg     L379
  addl   $0x1,-0x2c(%rbp)
  jmp    L200
L379:
  cmpl   $0x7ff,-0x28(%rbp)
  jg     L124
  addl   $0x2,-0x2c(%rbp)
  jmp    L200
L124:
  addl   $0x3,-0x2c(%rbp)
L200:
  addl   $0x2,-0x30(%rbp)
L389:
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L443
  cmpq   $0x0,-0x38(%rbp)
  jne    L406
  mov    -0x2c(%rbp),%eax
  jmp    L249
L406:
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L438
L199:
  cmpl   $0x0,-0x24(%rbp)
  je     L4
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %edx,%eax
  mov    %eax,-0x28(%rbp)
  jmp    L320
L4:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x28(%rbp)
L320:
  cmpl   $0x7f,-0x28(%rbp)
  jg     L120
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x28(%rbp),%edx
  mov    %dl,(%rax)
  jmp    L421
L120:
  cmpl   $0x7ff,-0x28(%rbp)
  jg     L117
  mov    -0x28(%rbp),%eax
  sar    $0x6,%eax
  or     $0xffffffc0,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L421
L117:
  mov    -0x28(%rbp),%eax
  sar    $0xc,%eax
  or     $0xffffffe0,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
L421:
  addl   $0x2,-0x30(%rbp)
L438:
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L199
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x38(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x2c(%rbp),%eax
L249:
  leave
  ret
```

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;
}
```