user: Translate the below assembly code into C programming language:

```asm
<utf16_to_utf8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    $0x1,%rax
  shr    %rax
  add    $0x1,%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <malloc_multiply@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L97
  mov    $0x0,%eax
  jmp    L56
L97:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L61
L50:
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jne    L44
  mov    -0x10(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  jmp    L56
L44:
  cmpl   $0x7f,-0x1c(%rbp)
  jg     L63
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    %edx,(%rax)
  jmp    L60
L63:
  cmpl   $0x7ff,-0x1c(%rbp)
  jg     L66
  mov    -0x1c(%rbp),%eax
  sar    $0x6,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xc0,%cl
  mov    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  and    $0x3f,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0x80,%cl
  mov    %ecx,%edx
  mov    %edx,(%rax)
  jmp    L60
L66:
  mov    -0x1c(%rbp),%eax
  sar    $0xc,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0xe0,%cl
  mov    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0x80,%cl
  mov    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  and    $0x3f,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  or     $0x80,%cl
  mov    %ecx,%edx
  mov    %edx,(%rax)
L60:
  addq   $0x8,-0x18(%rbp)
L61:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x18(%rbp)
  jb     L50
  mov    -0x10(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L56:
  leave
  ret
```

assistant: ```c
char *utf16_to_utf8(const void *s, size_t length) {
  char *r;
  const uint8_t *f;
  uint8_t *t;
  r = ((char *)malloc_multiply(sizeof(char), ((length * 3 + 1) / 2 + 1)));
  if (!r)
    return NULL;
  t = (uint8_t *)r;
  for (f = s; f < (const uint8_t *)s + length; f += 2) {
    uint16_t c;
    c = (f[1] << 8) | f[0];
    if (c == 0) {
      *t = 0;
      return r;
    } else if (c < 0x80) {
      *(t++) = (uint8_t)c;
    } else if (c < 0x800) {
      *(t++) = (uint8_t)(0xc0 | (c >> 6));
      *(t++) = (uint8_t)(0x80 | (c & 0x3f));
    } else {
      *(t++) = (uint8_t)(0xe0 | (c >> 12));
      *(t++) = (uint8_t)(0x80 | ((c >> 6) & 0x3f));
      *(t++) = (uint8_t)(0x80 | (c & 0x3f));
    }
  }
  *t = 0;
  return r;
}
```