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

```asm
<_RGB8_to_YUV420>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x3c(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x18(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L10
L50:
  movl   $0x0,-0x2c(%rbp)
  jmp    L14
L56:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  addq   $0xc,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  imul   $0x42,%eax,%ecx
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  shl    $0x7,%edx
  add    %edx,%eax
  add    %eax,%ecx
  mov    -0x14(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  lea    0x0(,%rax,4),%edx
  add    %edx,%eax
  add    %ecx,%eax
  sub    $0xffffff80,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  lea    0x10(%rcx),%edx
  mov    %edx,(%rax)
  mov    -0x2c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L59
  mov    -0x28(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L59
  mov    -0xc(%rbp),%eax
  imul   $0xffffffda,%eax,%edx
  mov    -0x10(%rbp),%eax
  imul   $0xffffffb6,%eax,%eax
  add    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   $0x70,%eax,%eax
  add    %edx,%eax
  sub    $0xffffff80,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  lea    0x80(%rcx),%edx
  mov    %edx,(%rax)
  mov    -0xc(%rbp),%eax
  imul   $0x70,%eax,%edx
  mov    -0x10(%rbp),%eax
  imul   $0xffffffa2,%eax,%eax
  add    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   $0xffffffee,%eax,%eax
  add    %edx,%eax
  sub    $0xffffff80,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  lea    0x80(%rcx),%edx
  mov    %edx,(%rax)
L59:
  addl   $0x1,-0x2c(%rbp)
L14:
  mov    -0x2c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L56
  addl   $0x1,-0x28(%rbp)
L10:
  mov    -0x28(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L50
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void _RGB8_to_YUV420(const uint8_t *rgb, int width, int height, uint8_t *yuv) {
  const uint8_t *rgb_current = rgb;
  int x, y, yi = 0;
  const int num_pixels = width * height;
  int ui = num_pixels;
  int vi = num_pixels + num_pixels / 4;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      const uint32_t b = rgb_current[0];
      const uint32_t g = rgb_current[1];
      const uint32_t r = rgb_current[2];
      rgb_current += 3;
      yuv[yi++] = (uint8_t)((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
      if ((x % 2) == 0 && (y % 2) == 0) {
        yuv[ui++] = (uint8_t)((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
        yuv[vi++] = (uint8_t)((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
      }
    }
  }
}
```