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

```asm
<rgb2yuy2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,-0x40(%rbp)
  mov    %rsi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L10
L7:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%r13d
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%r12d
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%ebx
  imul   $0x2646,%r13d,%edx
  imul   $0x4b23,%r12d,%eax
  add    %eax,%edx
  imul   $0xe98,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  mov    %eax,%esi
  imul   $0xffffed50,%r13d,%edx
  imul   $0xffffdb23,%r12d,%eax
  add    %eax,%edx
  imul   $0x378d,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  lea    0x80(%rax),%ecx
  imul   $0x4efa,%r13d,%edx
  imul   $0xffffbdd3,%r12d,%eax
  add    %eax,%edx
  imul   $0xfffff333,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  lea    0x80(%rax),%r14d
  mov    $0x0,%eax
  test   %esi,%esi
  cmovns %esi,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  test   %ecx,%ecx
  cmovns %ecx,%eax
  mov    %eax,%ecx
  mov    $0x0,%eax
  test   %r14d,%r14d
  cmovs  %eax,%r14d
  mov    $0xff,%eax
  cmp    %eax,%edi
  cmovle %edi,%eax
  mov    %eax,%r8d
  mov    $0xff,%eax
  cmp    %eax,%ecx
  cmovle %ecx,%eax
  mov    %eax,%esi
  mov    $0xff,%eax
  cmp    %eax,%r14d
  cmovg  %eax,%r14d
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%r13d
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x4(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%r12d
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x5(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%ebx
  imul   $0x2646,%r13d,%edx
  imul   $0x4b23,%r12d,%eax
  add    %eax,%edx
  imul   $0xe98,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  mov    %eax,%r15d
  imul   $0xffffed50,%r13d,%edx
  imul   $0xffffdb23,%r12d,%eax
  add    %eax,%edx
  imul   $0x378d,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  lea    0x80(%rax),%edi
  imul   $0x4efa,%r13d,%edx
  imul   $0xffffbdd3,%r12d,%eax
  add    %eax,%edx
  imul   $0xfffff333,%ebx,%eax
  add    %edx,%eax
  sar    $0xf,%eax
  lea    0x80(%rax),%ebx
  mov    $0x0,%eax
  test   %r15d,%r15d
  cmovs  %eax,%r15d
  mov    $0x0,%eax
  test   %edi,%edi
  cmovns %edi,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  test   %ebx,%ebx
  cmovs  %eax,%ebx
  mov    $0xff,%eax
  cmp    %eax,%r15d
  cmovg  %eax,%r15d
  mov    $0xff,%eax
  cmp    %eax,%edi
  cmovle %edi,%eax
  mov    %eax,%ecx
  mov    $0xff,%eax
  cmp    %eax,%ebx
  cmovg  %eax,%ebx
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %r8d,%edx
  mov    %dl,(%rax)
  mov    %esi,%eax
  add    %ecx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %r15d,%edx
  mov    %dl,(%rax)
  lea    (%r14,%rbx,1),%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x3(%rax),%rcx
  mov    -0x48(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  addl   $0x6,-0x30(%rbp)
  addl   $0x4,-0x2c(%rbp)
L10:
  mov    -0x4c(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x30(%rbp)
  jl     L7
  nop
  nop
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
void rgb2yuy2(char *RGB, char *YUV, int NumPixels) {
  int i, j;
  register int y0, y1, u0, u1, v0, v1;
  register int r, g, b;
  for (i = 0, j = 0; i < (NumPixels + (NumPixels << 1)); i += 6, j += 4) {
    r = (unsigned char)RGB[i + 0];
    g = (unsigned char)RGB[i + 1];
    b = (unsigned char)RGB[i + 2];
    y0 = (9798 * r + 19235 * g + 3736 * b) >> 15;
    u0 = ((-4784 * r - 9437 * g + 14221 * b) >> 15) + 128;
    v0 = ((20218 * r - 16941 * g - 3277 * b) >> 15) + 128;
    y0 = y0 < 0 ? 0 : y0;
    u0 = u0 < 0 ? 0 : u0;
    v0 = v0 < 0 ? 0 : v0;
    y0 = y0 > 255 ? 255 : y0;
    u0 = u0 > 255 ? 255 : u0;
    v0 = v0 > 255 ? 255 : v0;
    r = (unsigned char)RGB[i + 3];
    g = (unsigned char)RGB[i + 4];
    b = (unsigned char)RGB[i + 5];
    y1 = (9798 * r + 19235 * g + 3736 * b) >> 15;
    u1 = ((-4784 * r - 9437 * g + 14221 * b) >> 15) + 128;
    v1 = ((20218 * r - 16941 * g - 3277 * b) >> 15) + 128;
    y1 = y1 < 0 ? 0 : y1;
    u1 = u1 < 0 ? 0 : u1;
    v1 = v1 < 0 ? 0 : v1;
    y1 = y1 > 255 ? 255 : y1;
    u1 = u1 > 255 ? 255 : u1;
    v1 = v1 > 255 ? 255 : v1;
    YUV[j + 0] = y0;
    YUV[j + 1] = (u0 + u1) >> 1;
    YUV[j + 2] = y1;
    YUV[j + 3] = (v0 + v1) >> 1;
  }
}
```