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

```asm
<utf32_to_utf8>:
  endbr64
  mov    %esi,%eax
  test   $0xffffff80,%eax
  jne    L27
  and    $0x7f,%eax
  mov    %eax,(%rdi)
  mov    $0x1,%edx
L42:
  mov    %edx,%eax
  ret
L27:
  test   $0xfffff800,%eax
  je     L104
  test   $0xffff0000,%eax
  je     L84
  test   $0xffe00000,%eax
  je     L22
  test   $0xfc000000,%eax
  je     L59
  mov    $0x0,%edx
  test   %esi,%esi
  js     L42
  mov    %esi,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x14(%rdi)
  mov    %esi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x10(%rdi)
  mov    %esi,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0xc(%rdi)
  mov    %esi,%edx
  sar    $0x12,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rdi)
  mov    %esi,%edx
  sar    $0x18,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  sar    $0x1e,%eax
  or     $0xfc,%al
  mov    %eax,(%rdi)
  mov    $0x6,%edx
  jmp    L42
L104:
  mov    %esi,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  sar    $0x6,%eax
  or     $0xc0,%al
  mov    %eax,(%rdi)
  mov    $0x2,%edx
  jmp    L42
L84:
  mov    %esi,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rdi)
  mov    %esi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  sar    $0xc,%eax
  or     $0xe0,%al
  mov    %eax,(%rdi)
  mov    $0x3,%edx
  jmp    L42
L22:
  mov    %esi,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0xc(%rdi)
  mov    %esi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rdi)
  mov    %esi,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  sar    $0x12,%eax
  or     $0xf0,%al
  mov    %eax,(%rdi)
  mov    $0x4,%edx
  jmp    L42
L59:
  mov    %esi,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x10(%rdi)
  mov    %esi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0xc(%rdi)
  mov    %esi,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rdi)
  mov    %esi,%edx
  sar    $0x12,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  shr    $0x18,%eax
  or     $0xf8,%al
  mov    %eax,(%rdi)
  mov    $0x5,%edx
  jmp    L42
```

assistant: ```c
uint32_t utf32_to_utf8(uint8_t utf8[6], uint32_t utf32) {
  uint32_t utf8_len = 0;
  if ((utf32 & (~0x0000007F)) == 0) {
    utf8[0] = 0x0000007F & utf32;
    utf8_len = 1;
  } else if ((utf32 & (~0x000007FF)) == 0) {
    utf8[1] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[0] = (0x0000003F & utf32) | 0xC0;
    utf8_len = 2;
  } else if ((utf32 & (~0x0000FFFF)) == 0) {
    utf8[2] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[1] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[0] = (0x0000003F & utf32) | 0xE0;
    utf8_len = 3;
  } else if ((utf32 & (~0x001FFFFF)) == 0) {
    utf8[3] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[2] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[1] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[0] = (0x0000003F & utf32) | 0xF0;
    utf8_len = 4;
  } else if ((utf32 & (~0x03FFFFFF)) == 0) {
    utf8[4] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[3] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[2] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[1] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[0] = (0x0000003F & utf32) | 0xF8;
    utf8_len = 5;
  } else if ((utf32 & (~0x7FFFFFFF)) == 0) {
    utf8[5] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[4] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[3] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[2] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[1] = (0x0000003F & utf32) | 0x80;
    utf32 >>= 6;
    utf8[0] = (0x0000003F & utf32) | 0xFC;
    utf8_len = 6;
  }
  return utf8_len;
}
```