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

```asm
<rgb24_to_yuv420p>:
  endbr64
  push   %r15
  lea    (%r8,%r8,2),%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x30(%rsp)
  mov    %rcx,-0x28(%rsp)
  mov    %r9d,-0x1c(%rsp)
  test   %r9d,%r9d
  jle    L25
  mov    %rdx,%r12
  movslq %eax,%rdx
  neg    %eax
  movslq %r8d,%r13
  cltq
  lea    0x0(,%rdx,4),%rdi
  shl    $0x2,%r13
  lea    0x18(,%rax,4),%r14
  mov    $0x2,%eax
  mov    %rdi,-0x18(%rsp)
  sub    %r8d,%eax
  cltq
  shl    $0x2,%rax
  test   %r8d,%r8d
  jle    L25
  sub    $0x1,%r8d
  add    %rdi,%r14
  add    %r13,%rax
  mov    %rsi,%rbp
  shr    %r8d
  mov    %rax,-0x38(%rsp)
  lea    0x1(%r8),%edx
  movl   $0x0,-0x20(%rsp)
  mov    %rdx,%rcx
  lea    0x0(,%rdx,4),%r15
  imul   %r14,%rcx
  imul   %rax,%rdx
  lea    (%rdi,%rcx,1),%rax
  mov    %rax,-0x10(%rsp)
  lea    0x0(%r13,%rdx,1),%rax
  mov    %rax,-0x8(%rsp)
  xchg   %ax,%ax
L16:
  mov    -0x28(%rsp),%rsi
  mov    -0x18(%rsp),%rdi
  xor    %r10d,%r10d
  mov    -0x30(%rsp),%r9
  add    %rsi,%rdi
  nopl   (%rax)
L24:
  mov    (%rsi),%eax
  mov    0x4(%rsi),%ecx
  mov    0x8(%rsi),%edx
  imul   $0x96,%ecx,%r11d
  imul   $0x4d,%eax,%r8d
  add    %r11d,%r8d
  imul   $0x1d,%edx,%r11d
  lea    0x80(%r8,%r11,1),%r8d
  sar    $0x8,%r8d
  mov    %r8d,(%r9)
  mov    0xc(%rsi),%ebx
  mov    0x10(%rsi),%r8d
  mov    0x14(%rsi),%r11d
  add    %ebx,%eax
  imul   $0x4d,%ebx,%ebx
  add    %r8d,%ecx
  imul   $0x96,%r8d,%r8d
  add    %r11d,%edx
  imul   $0x1d,%r11d,%r11d
  add    %ebx,%r8d
  lea    0x80(%r8,%r11,1),%r8d
  sar    $0x8,%r8d
  mov    %r8d,0x4(%r9)
  mov    (%rdi),%ebx
  mov    0x4(%rdi),%r8d
  mov    0x8(%rdi),%r11d
  add    %ebx,%eax
  imul   $0x4d,%ebx,%ebx
  add    %r8d,%ecx
  imul   $0x96,%r8d,%r8d
  add    %r11d,%edx
  imul   $0x1d,%r11d,%r11d
  add    %ebx,%r8d
  lea    0x80(%r8,%r11,1),%r8d
  sar    $0x8,%r8d
  mov    %r8d,(%r9,%r13,1)
  mov    0xc(%rdi),%ebx
  mov    0x10(%rdi),%r8d
  mov    0x14(%rdi),%r11d
  add    %ebx,%eax
  imul   $0x4d,%ebx,%ebx
  add    %r8d,%ecx
  imul   $0x96,%r8d,%r8d
  add    %r11d,%edx
  imul   $0x1d,%r11d,%r11d
  add    %ebx,%r8d
  lea    0x80(%r8,%r11,1),%r8d
  sar    $0x8,%r8d
  imul   $0xffffffab,%ecx,%r11d
  mov    %r8d,0x4(%r9,%r13,1)
  imul   $0xffffffd5,%eax,%r8d
  add    %r11d,%r8d
  mov    %edx,%r11d
  shl    $0x7,%r11d
  imul   $0xffffff95,%ecx,%ecx
  shl    $0x7,%eax
  add    %r14,%rsi
  imul   $0xffffffeb,%edx,%edx
  lea    0x1ff(%r8,%r11,1),%r8d
  add    -0x38(%rsp),%r9
  add    %r14,%rdi
  sar    $0xa,%r8d
  add    %ecx,%eax
  sub    $0xffffff80,%r8d
  lea    0x1ff(%rax,%rdx,1),%eax
  mov    %r8d,0x0(%rbp,%r10,1)
  sar    $0xa,%eax
  sub    $0xffffff80,%eax
  mov    %eax,(%r12,%r10,1)
  add    $0x4,%r10
  cmp    %r10,%r15
  jne    L24
  addl   $0x2,-0x20(%rsp)
  mov    -0x10(%rsp),%rsi
  add    %r15,%rbp
  add    %r15,%r12
  mov    -0x8(%rsp),%rdi
  add    %rsi,-0x28(%rsp)
  add    %rdi,-0x30(%rsp)
  mov    -0x20(%rsp),%eax
  cmp    %eax,-0x1c(%rsp)
  jg     L16
L25:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr, uint8_t *src, int width, int height) {
  int wrap, wrap3, x, y;
  int r, g, b, r1, g1, b1;
  uint8_t *p;
  wrap = width;
  wrap3 = width * 3;
  p = src;
  for (y = 0; y < height; y += 2) {
    for (x = 0; x < width; x += 2) {
      r = p[0];
      g = p[1];
      b = p[2];
      r1 = r;
      g1 = g;
      b1 = b;
      lum[0] = (((int)((0.29900) * (1L << 8) + 0.5)) * r + ((int)((0.58700) * (1L << 8) + 0.5)) * g + ((int)((0.11400) * (1L << 8) + 0.5)) * b + (1 << (8 - 1))) >> 8;
      r = p[3];
      g = p[4];
      b = p[5];
      r1 += r;
      g1 += g;
      b1 += b;
      lum[1] = (((int)((0.29900) * (1L << 8) + 0.5)) * r + ((int)((0.58700) * (1L << 8) + 0.5)) * g + ((int)((0.11400) * (1L << 8) + 0.5)) * b + (1 << (8 - 1))) >> 8;
      p += wrap3;
      lum += wrap;
      r = p[0];
      g = p[1];
      b = p[2];
      r1 += r;
      g1 += g;
      b1 += b;
      lum[0] = (((int)((0.29900) * (1L << 8) + 0.5)) * r + ((int)((0.58700) * (1L << 8) + 0.5)) * g + ((int)((0.11400) * (1L << 8) + 0.5)) * b + (1 << (8 - 1))) >> 8;
      r = p[3];
      g = p[4];
      b = p[5];
      r1 += r;
      g1 += g;
      b1 += b;
      lum[1] = (((int)((0.29900) * (1L << 8) + 0.5)) * r + ((int)((0.58700) * (1L << 8) + 0.5)) * g + ((int)((0.11400) * (1L << 8) + 0.5)) * b + (1 << (8 - 1))) >> 8;
      cb[0] = 128 + ((-((int)((0.16874) * (1L << 8) + 0.5)) * r1 - ((int)((0.33126) * (1L << 8) + 0.5)) * g1 + ((int)((0.50000) * (1L << 8) + 0.5)) * b1 + 4 * (1 << (8 - 1)) - 1) >> (8 + 2));
      cr[0] = 128 + ((((int)((0.50000) * (1L << 8) + 0.5)) * r1 - ((int)((0.41869) * (1L << 8) + 0.5)) * g1 - ((int)((0.08131) * (1L << 8) + 0.5)) * b1 + 4 * (1 << (8 - 1)) - 1) >> (8 + 2));
      cb++;
      cr++;
      p += -wrap3 + 2 * 3;
      lum += -wrap + 2;
    }
    p += wrap3;
    lum += wrap;
  }
}
```