user: Please show me the C implementation that matches the assembly code listed below:

```asm
<utf32_to_utf8>:
  endbr64
  mov    %esi,%eax
  test   $0xffffff80,%eax
  jne    L57
  mov    %esi,(%rdi)
  mov    $0x1,%r8d
L72:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L57:
  test   $0xfffff800,%eax
  je     L30
  test   $0xffff0000,%eax
  je     L59
  test   $0xffe00000,%eax
  je     L14
  test   $0xfc000000,%eax
  je     L33
  xor    %r8d,%r8d
  test   %esi,%esi
  js     L72
  mov    %esi,%edx
  sar    $0x1e,%eax
  mov    $0x6,%r8d
  and    $0x3f,%edx
  or     $0xfc,%al
  or     $0x80,%dl
  mov    %eax,(%rdi)
  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)
  jmp    L72
  nopl   0x0(%rax,%rax,1)
L30:
  mov    %esi,%edx
  sar    $0x6,%eax
  mov    $0x2,%r8d
  and    $0x3f,%edx
  or     $0xc0,%al
  or     $0x80,%dl
  mov    %eax,(%rdi)
  mov    %r8d,%eax
  mov    %edx,0x4(%rdi)
  ret
  nopl   0x0(%rax)
L14:
  mov    %esi,%edx
  sar    $0x12,%eax
  mov    $0x4,%r8d
  and    $0x3f,%edx
  or     $0xf0,%al
  or     $0x80,%dl
  mov    %eax,(%rdi)
  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)
  jmp    L72
  nopl   0x0(%rax)
L59:
  mov    %esi,%edx
  sar    $0xc,%eax
  mov    $0x3,%r8d
  and    $0x3f,%edx
  or     $0xe0,%al
  or     $0x80,%dl
  mov    %eax,(%rdi)
  mov    %r8d,%eax
  mov    %edx,0x8(%rdi)
  mov    %esi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rdi)
  ret
  nopw   0x0(%rax,%rax,1)
L33:
  mov    %esi,%edx
  shr    $0x18,%eax
  mov    $0x5,%r8d
  and    $0x3f,%edx
  or     $0xf8,%al
  or     $0x80,%dl
  mov    %eax,(%rdi)
  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)
  jmp    L72
```

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