user: Converte this assembly snippet into its equivalent C code:

```asm
<y4m_422jpeg_420jpeg_helper>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %ecx,-0x60(%rsp)
  test   %edx,%edx
  jle    L3
  mov    %rsi,%r10
  xor    %esi,%esi
  test   %ecx,%ecx
  mov    %edx,%eax
  setg   %sil
  lea    -0x1(%rcx),%r9d
  mov    %rdi,%r11
  mov    %edx,%edi
  mov    $0x2,%edx
  add    %esi,%esi
  lea    -0x3(%rcx),%r8d
  mov    %ecx,%ebx
  imul   %r9d,%eax
  cmp    %edx,%ecx
  mov    %esi,-0x1c(%rsp)
  lea    (%rdi,%rdi,1),%ebp
  cmovle %ecx,%edx
  mov    %r8d,-0x5c(%rsp)
  movslq %ebp,%rbp
  sub    $0x1,%edx
  cltq
  imul   %edi,%edx
  lea    (%r10,%rax,1),%r14
  movslq %edx,%rdx
  lea    (%r10,%rdx,1),%rcx
  mov    $0x3,%edx
  cmp    %edx,%ebx
  mov    %rcx,-0x70(%rsp)
  cmovle %ebx,%edx
  sub    $0x1,%edx
  imul   %edi,%edx
  movslq %edx,%rdx
  lea    (%r10,%rdx,1),%rcx
  mov    $0x4,%edx
  cmp    %edx,%ebx
  mov    %rcx,-0x78(%rsp)
  cmovle %ebx,%edx
  sub    $0x1,%edx
  imul   %edi,%edx
  movslq %edx,%rdx
  lea    (%r10,%rdx,1),%r15
  movslq %edi,%rdx
  lea    (%r10,%rdx,1),%rcx
  lea    -0x2(%rsi),%edx
  imul   %edi,%edx
  mov    %rcx,-0x28(%rsp)
  movslq %edx,%rcx
  lea    0x2(%rsi),%edx
  mov    %rcx,-0x58(%rsp)
  sub    %rax,%rcx
  lea    0x3(%rsi),%eax
  imul   %edi,%eax
  mov    %rcx,-0x18(%rsp)
  cltq
  mov    %rax,0x10(%rsp)
  lea    -0x1(%rsi),%eax
  imul   %edi,%eax
  cltq
  mov    %rax,0x8(%rsp)
  mov    %edi,%eax
  imul   %edx,%eax
  cltq
  mov    %rax,(%rsp)
  mov    %esi,%eax
  imul   %edi,%eax
  cltq
  mov    %rax,-0x8(%rsp)
  lea    0x1(%rsi),%eax
  imul   %edi,%eax
  cltq
  mov    %rax,-0x10(%rsp)
  lea    -0x4(%rbx),%eax
  sub    %esi,%eax
  and    $0xfffffffe,%eax
  add    %edx,%eax
  cmp    %r8d,%esi
  cmovge %esi,%eax
  mov    %eax,%esi
  mov    %eax,-0x20(%rsp)
  lea    -0x2(%rax),%eax
  imul   %edi,%eax
  cltq
  mov    %rax,-0x68(%rsp)
  lea    -0x1(%rsi),%eax
  imul   %edi,%eax
  cltq
  mov    %rax,0x18(%rsp)
  mov    %esi,%eax
  imul   %edi,%eax
  cltq
  mov    %rax,-0x50(%rsp)
  nopl   0x0(%rax,%rax,1)
L23:
  mov    -0x60(%rsp),%eax
  test   %eax,%eax
  jle    L46
  mov    -0x70(%rsp),%rax
  movzbl (%r10),%edx
  movzbl (%rax),%eax
  shl    $0x6,%edx
  imul   $0x4e,%eax,%eax
  add    %eax,%edx
  mov    -0x78(%rsp),%rax
  movzbl (%rax),%eax
  imul   $0xffffffef,%eax,%eax
  add    %edx,%eax
  movzbl (%r15),%edx
  lea    (%rdx,%rdx,2),%edx
  lea    0x40(%rax,%rdx,1),%eax
  mov    $0xff,%edx
  sar    $0x7,%eax
  cmp    %edx,%eax
  cmovg  %edx,%eax
  xor    %edx,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  mov    %al,(%r11)
L46:
  mov    -0x1c(%rsp),%esi
  mov    -0x5c(%rsp),%eax
  cmp    %eax,%esi
  jge    L39
  mov    -0x18(%rsp),%rax
  mov    %r9d,-0x48(%rsp)
  mov    -0x10(%rsp),%rbx
  mov    -0x8(%rsp),%r12
  mov    %r10,-0x30(%rsp)
  mov    %r15,-0x40(%rsp)
  lea    (%rax,%r14,1),%r8
  mov    (%rsp),%r13
  mov    %r14,-0x38(%rsp)
  mov    0x10(%rsp),%r15
  mov    0x8(%rsp),%r14
  nopl   0x0(%rax,%rax,1)
L10:
  mov    %r8,%rcx
  sub    -0x58(%rsp),%rcx
  movzbl (%r8),%edx
  mov    %esi,%eax
  movzbl (%rcx,%r15,1),%r9d
  movzbl (%rcx,%r13,1),%r10d
  sar    %eax
  add    $0x2,%esi
  imul   %edi,%eax
  add    %r9d,%edx
  lea    (%rdx,%rdx,2),%r9d
  movzbl (%rcx,%r14,1),%edx
  cltq
  add    %r10d,%edx
  imul   $0xffffffef,%edx,%edx
  add    %r9d,%edx
  movzbl (%rcx,%r12,1),%r9d
  movzbl (%rcx,%rbx,1),%ecx
  add    %ecx,%r9d
  mov    $0xff,%ecx
  imul   $0x4e,%r9d,%r9d
  lea    0x40(%rdx,%r9,1),%edx
  sar    $0x7,%edx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  xor    %ecx,%ecx
  test   %edx,%edx
  cmovs  %ecx,%edx
  add    %rbp,%r8
  mov    %dl,(%r11,%rax,1)
  cmp    -0x5c(%rsp),%esi
  jl     L10
  mov    -0x48(%rsp),%r9d
  mov    -0x40(%rsp),%r15
  mov    -0x38(%rsp),%r14
  mov    -0x30(%rsp),%r10
L39:
  mov    -0x68(%rsp),%rax
  lea    (%r10,%rax,1),%r8
  mov    -0x20(%rsp),%eax
  mov    %eax,%esi
  cmp    %eax,-0x60(%rsp)
  jle    L4
  mov    %r15,-0x48(%rsp)
  mov    0x18(%rsp),%r15
  nopl   0x0(%rax)
L16:
  movzbl (%r8),%eax
  movzbl (%r14),%edx
  mov    %r8,%rbx
  mov    %r9d,%ecx
  sub    -0x68(%rsp),%rbx
  add    %edx,%eax
  lea    0x1(%rsi),%edx
  movzbl (%rbx,%r15,1),%r13d
  lea    (%rax,%rax,2),%r12d
  mov    %esi,%eax
  add    $0x2,%esi
  cmp    %edx,%r9d
  cmovg  %esi,%ecx
  imul   %edi,%ecx
  movslq %ecx,%rcx
  movzbl (%r10,%rcx,1),%ecx
  add    %r13d,%ecx
  imul   $0xffffffef,%ecx,%ecx
  add    %r12d,%ecx
  cmp    %eax,%r9d
  mov    -0x50(%rsp),%r12
  cmovle %r9d,%edx
  sar    %eax
  movzbl (%rbx,%r12,1),%ebx
  imul   %edi,%eax
  imul   %edi,%edx
  cltq
  movslq %edx,%rdx
  movzbl (%r10,%rdx,1),%edx
  add    %ebx,%edx
  imul   $0x4e,%edx,%edx
  lea    0x40(%rcx,%rdx,1),%edx
  mov    $0xff,%ecx
  sar    $0x7,%edx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  xor    %ecx,%ecx
  test   %edx,%edx
  cmovs  %ecx,%edx
  add    %rbp,%r8
  mov    %dl,(%r11,%rax,1)
  cmp    %esi,-0x60(%rsp)
  jg     L16
  mov    -0x48(%rsp),%r15
L4:
  add    $0x1,%r10
  add    $0x1,%r11
  add    $0x1,%r14
  add    $0x1,%r15
  addq   $0x1,-0x70(%rsp)
  addq   $0x1,-0x78(%rsp)
  cmp    -0x28(%rsp),%r10
  jne    L23
L3:
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void y4m_422jpeg_420jpeg_helper(unsigned char *_dst, const unsigned char *_src, int _c_w, int _c_h) {
  int y;
  int x;
  for (x = 0; x < _c_w; x++) {
    for (y = 0; y < ((_c_h) > (2) ? (2) : (_c_h)); y += 2) {
      _dst[(y >> 1) * _c_w] = (((0) < ((((64 * _src[0] + 78 * _src[((1) > (_c_h - 1) ? (_c_h - 1) : (1)) * _c_w] - 17 * _src[((2) > (_c_h - 1) ? (_c_h - 1) : (2)) * _c_w] + 3 * _src[((3) > (_c_h - 1) ? (_c_h - 1) : (3)) * _c_w] + 64) >> 7) > (255) ? (255) : ((64 * _src[0] + 78 * _src[((1) > (_c_h - 1) ? (_c_h - 1) : (1)) * _c_w] - 17 * _src[((2) > (_c_h - 1) ? (_c_h - 1) : (2)) * _c_w] + 3 * _src[((3) > (_c_h - 1) ? (_c_h - 1) : (3)) * _c_w] + 64) >> 7))) ? ((((64 * _src[0] + 78 * _src[((1) > (_c_h - 1) ? (_c_h - 1) : (1)) * _c_w] - 17 * _src[((2) > (_c_h - 1) ? (_c_h - 1) : (2)) * _c_w] + 3 * _src[((3) > (_c_h - 1) ? (_c_h - 1) : (3)) * _c_w] + 64) >> 7) > (255) ? (255) : ((64 * _src[0] + 78 * _src[((1) > (_c_h - 1) ? (_c_h - 1) : (1)) * _c_w] - 17 * _src[((2) > (_c_h - 1) ? (_c_h - 1) : (2)) * _c_w] + 3 * _src[((3) > (_c_h - 1) ? (_c_h - 1) : (3)) * _c_w] + 64) >> 7))) : (0)));
    }
    for (; y < _c_h - 3; y += 2) {
      _dst[(y >> 1) * _c_w] = (((0) < ((((3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w]) + 78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >> 7) > (255) ? (255) : ((3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w]) + 78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >> 7))) ? ((((3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w]) + 78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >> 7) > (255) ? (255) : ((3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w]) + 78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >> 7))) : (0)));
    }
    for (; y < _c_h; y += 2) {
      _dst[(y >> 1) * _c_w] = (((0) < ((((3 * (_src[(y - 2) * _c_w] + _src[(_c_h - 1) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[((y + 2) > (_c_h - 1) ? (_c_h - 1) : (y + 2)) * _c_w]) + 78 * (_src[y * _c_w] + _src[((y + 1) > (_c_h - 1) ? (_c_h - 1) : (y + 1)) * _c_w]) + 64) >> 7) > (255) ? (255) : ((3 * (_src[(y - 2) * _c_w] + _src[(_c_h - 1) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[((y + 2) > (_c_h - 1) ? (_c_h - 1) : (y + 2)) * _c_w]) + 78 * (_src[y * _c_w] + _src[((y + 1) > (_c_h - 1) ? (_c_h - 1) : (y + 1)) * _c_w]) + 64) >> 7))) ? ((((3 * (_src[(y - 2) * _c_w] + _src[(_c_h - 1) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[((y + 2) > (_c_h - 1) ? (_c_h - 1) : (y + 2)) * _c_w]) + 78 * (_src[y * _c_w] + _src[((y + 1) > (_c_h - 1) ? (_c_h - 1) : (y + 1)) * _c_w]) + 64) >> 7) > (255) ? (255) : ((3 * (_src[(y - 2) * _c_w] + _src[(_c_h - 1) * _c_w]) - 17 * (_src[(y - 1) * _c_w] + _src[((y + 2) > (_c_h - 1) ? (_c_h - 1) : (y + 2)) * _c_w]) + 78 * (_src[y * _c_w] + _src[((y + 1) > (_c_h - 1) ? (_c_h - 1) : (y + 1)) * _c_w]) + 64) >> 7))) : (0)));
    }
    _src++;
    _dst++;
  }
}
```