user: 请将以下的汇编代码转换成C语言代码：

```asm
<utf16_literal_to_utf8>:
  endbr64
  mov    %rsi,%rax
  push   %r14
  sub    %rdi,%rax
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  cmp    $0x5,%rax
  jg     L150
L7:
  xor    %r8d,%r8d
  mov    %rbx,0x0(%r13)
  pop    %rbx
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L150:
  lea    0x2(%rdi),%rdi
  mov    %rsi,%rbp
  mov    %rdx,%r14
  call   <parse_hex4@plt>
  mov    %eax,%r12d
  lea    -0xdc00(%rax),%eax
  cmp    $0x3ff,%eax
  jbe    L7
  test   %r12d,%r12d
  je     L7
  lea    -0xd800(%r12),%eax
  cmp    $0x3ff,%eax
  ja     L47
  lea    0x6(%rbx),%rax
  sub    %rax,%rbp
  cmp    $0x5,%rbp
  jle    L7
  cmpb   $0x5c,0x6(%rbx)
  jne    L7
  cmpb   $0x75,0x7(%rbx)
  jne    L7
  lea    0x8(%rbx),%rdi
  call   <parse_hex4@plt>
  lea    -0xdc00(%rax),%edx
  cmp    $0x3ff,%edx
  ja     L7
  mov    %r12d,%edx
  and    $0x3ff,%eax
  mov    $0xc,%r8d
  shl    $0xa,%edx
  and    $0xffc00,%edx
  or     %eax,%edx
  add    $0x10000,%edx
L136:
  mov    $0x4,%r9d
  mov    $0x3,%eax
  mov    $0xfffffff0,%edi
  jmp    L80
  nopl   0x0(%rax)
L47:
  mov    %r12d,%edx
  cmp    $0x7f,%r12d
  ja     L86
  mov    (%r14),%rax
  mov    $0x1,%r9d
  mov    $0x6,%r8d
  mov    %r12b,(%rax)
L64:
  add    %r9,(%r14)
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L86:
  cmp    $0x7ff,%rdx
  ja     L26
  mov    $0x2,%r9d
  mov    $0x6,%r8d
  mov    $0x1,%eax
  mov    $0xffffffc0,%edi
  nop
L80:
  mov    %edx,%ecx
  mov    (%r14),%rsi
  shr    $0x6,%rdx
  and    $0x3f,%ecx
  or     $0xffffff80,%ecx
  mov    %cl,(%rsi,%rax,1)
  sub    $0x1,%rax
  jne    L80
  mov    (%r14),%rcx
  mov    %edi,%eax
  or     %edx,%eax
  mov    %al,(%rcx)
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L26:
  cmp    $0xffff,%rdx
  ja     L154
  mov    $0x3,%r9d
  mov    $0x6,%r8d
  mov    $0x2,%eax
  mov    $0xffffffe0,%edi
  jmp    L80
  nopl   0x0(%rax)
L154:
  cmp    $0x10ffff,%rdx
  ja     L7
  mov    $0x6,%r8d
  jmp    L136
```

assistant: ```c
unsigned char utf16_literal_to_utf8(const unsigned char *const input_pointer, const unsigned char *const input_end, unsigned char **output_pointer, const unsigned char **error_pointer) {
  long unsigned int codepoint = 0;
  unsigned int first_code = 0;
  const unsigned char *first_sequence = input_pointer;
  unsigned char utf8_length = 0;
  unsigned char utf8_position = 0;
  unsigned char sequence_length = 0;
  unsigned char first_byte_mark = 0;
  if ((input_end - first_sequence) < 6) {
    *error_pointer = first_sequence;
    goto fail;
  }
  first_code = parse_hex4(first_sequence + 2);
  if (((first_code >= 0xDC00) && (first_code <= 0xDFFF)) || (first_code == 0)) {
    *error_pointer = first_sequence;
    goto fail;
  }
  if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) {
    const unsigned char *second_sequence = first_sequence + 6;
    unsigned int second_code = 0;
    sequence_length = 12;
    if ((input_end - second_sequence) < 6) {
      *error_pointer = first_sequence;
      goto fail;
    }
    if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) {
      *error_pointer = first_sequence;
      goto fail;
    }
    second_code = parse_hex4(second_sequence + 2);
    if ((second_code < 0xDC00) || (second_code > 0xDFFF)) {
      *error_pointer = first_sequence;
      goto fail;
    }
    codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF));
  } else {
    sequence_length = 6;
    codepoint = first_code;
  }
  if (codepoint < 0x80) {
    utf8_length = 1;
  } else if (codepoint < 0x800) {
    utf8_length = 2;
    first_byte_mark = 0xC0;
  } else if (codepoint < 0x10000) {
    utf8_length = 3;
    first_byte_mark = 0xE0;
  } else if (codepoint <= 0x10FFFF) {
    utf8_length = 4;
    first_byte_mark = 0xF0;
  } else {
    *error_pointer = first_sequence;
    goto fail;
  }
  for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) {
    (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF);
    codepoint >>= 6;
  }
  if (utf8_length > 1) {
    (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF);
  } else {
    (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F);
  }
  *output_pointer += utf8_length;
  return sequence_length;
fail:
  return 0;
}
```