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
  mov    %ecx,-0x38(%rsp)
  test   %edx,%edx
  jle    L79
  mov    %rdi,%r12
  mov    %rsi,%r14
  mov    %edx,%r9d
  mov    $0x2,%eax
  cmp    %eax,%ecx
  cmovle %ecx,%eax
  lea    -0x1(%rax),%edx
  lea    -0x1(%rcx),%ebp
  mov    %edx,%eax
  imul   %r9d,%eax
  cltq
  add    %rsi,%rax
  mov    %rax,-0x60(%rsp)
  mov    $0x3,%eax
  cmp    %eax,%ecx
  cmovle %ecx,%eax
  sub    $0x1,%eax
  imul   %r9d,%eax
  cltq
  add    %rsi,%rax
  mov    %rax,-0x58(%rsp)
  mov    $0x4,%eax
  cmp    %eax,%ecx
  cmovle %ecx,%eax
  sub    $0x1,%eax
  imul   %r9d,%eax
  cltq
  add    %rsi,%rax
  mov    %rax,-0x50(%rsp)
  mov    %r9d,%eax
  imul   %ebp,%eax
  cltq
  add    %rsi,%rax
  mov    %rax,-0x40(%rsp)
  mov    %r9d,%eax
  add    %rsi,%rax
  mov    %rax,-0x18(%rsp)
  shr    %edx
  lea    0x2(%rdx,%rdx,1),%edx
  test   %ecx,%ecx
  mov    $0x2,%eax
  cmovg  %edx,%eax
  mov    %eax,-0x44(%rsp)
  lea    (%r9,%r9,1),%eax
  cltq
  mov    %rax,-0x68(%rsp)
  lea    -0x3(%rcx),%eax
  mov    %eax,-0x1c(%rsp)
  lea    0x0(,%r9,4),%eax
  mov    %eax,-0x10(%rsp)
  add    %r9d,%eax
  mov    %eax,-0xc(%rsp)
  lea    (%r9,%r9,1),%eax
  mov    %eax,-0x34(%rsp)
  add    %r9d,%eax
  mov    %eax,-0x8(%rsp)
  lea    -0x4(%rcx),%eax
  mov    %eax,-0x4(%rsp)
  jmp    L11
L33:
  movzbl (%r14),%edx
  shl    $0x6,%edx
  mov    -0x60(%rsp),%rax
  movzbl (%rax),%eax
  imul   $0x4e,%eax,%eax
  add    %eax,%edx
  mov    -0x58(%rsp),%rax
  movzbl (%rax),%eax
  imul   $0xffffffef,%eax,%eax
  add    %edx,%eax
  mov    -0x50(%rsp),%rbx
  movzbl (%rbx),%edx
  lea    (%rdx,%rdx,2),%edx
  lea    0x40(%rax,%rdx,1),%eax
  sar    $0x7,%eax
  mov    $0xff,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  test   %eax,%eax
  mov    $0x0,%edx
  cmovs  %edx,%eax
  mov    %al,(%r12)
  mov    -0x44(%rsp),%eax
L48:
  mov    -0x1c(%rsp),%esi
  cmp    %eax,%esi
  jle    L5
  lea    -0x2(%rax),%r10d
  imul   %r9d,%r10d
  movslq %r10d,%r15
  lea    (%r14,%r15,1),%rdx
  mov    -0xc(%rsp),%edi
  lea    (%rdi,%r10,1),%r13d
  movslq %r13d,%r13
  lea    (%r9,%r10,1),%ecx
  movslq %ecx,%rdi
  lea    0x2(%rax),%ebx
  mov    %ebx,-0x30(%rsp)
  mov    -0x10(%rsp),%ebx
  add    %r10d,%ebx
  movslq %ebx,%rbx
  mov    -0x34(%rsp),%ecx
  lea    (%rcx,%r10,1),%r11d
  movslq %r11d,%r11
  add    -0x8(%rsp),%r10d
  movslq %r10d,%r10
  mov    %eax,%r8d
  mov    %eax,-0x2c(%rsp)
  mov    %ebp,-0x20(%rsp)
  mov    %esi,%ebp
  mov    %r14,-0x28(%rsp)
  mov    %r15,%r14
L38:
  mov    %r8d,%eax
  add    $0x2,%r8d
  sar    %eax
  imul   %r9d,%eax
  cltq
  mov    %rdx,%rcx
  sub    %r14,%rcx
  movzbl (%rcx,%rdi,1),%ecx
  mov    %rdx,%rsi
  sub    %r14,%rsi
  movzbl (%rsi,%rbx,1),%esi
  add    %esi,%ecx
  imul   $0xffffffef,%ecx,%ecx
  mov    %rdx,%rsi
  sub    %r14,%rsi
  movzbl (%rsi,%r13,1),%esi
  movzbl (%rdx),%r15d
  add    %r15d,%esi
  lea    (%rsi,%rsi,2),%esi
  add    %esi,%ecx
  mov    %rdx,%rsi
  sub    %r14,%rsi
  movzbl (%rsi,%r11,1),%esi
  mov    %rdx,%r15
  sub    %r14,%r15
  movzbl (%r15,%r10,1),%r15d
  add    %r15d,%esi
  imul   $0x4e,%esi,%esi
  lea    0x40(%rcx,%rsi,1),%ecx
  sar    $0x7,%ecx
  mov    $0xff,%esi
  cmp    %esi,%ecx
  cmovg  %esi,%ecx
  test   %ecx,%ecx
  mov    $0x0,%esi
  cmovs  %esi,%ecx
  mov    %cl,(%r12,%rax,1)
  add    -0x68(%rsp),%rdx
  cmp    %ebp,%r8d
  jl     L38
  mov    -0x2c(%rsp),%eax
  mov    -0x20(%rsp),%ebp
  mov    -0x28(%rsp),%r14
  mov    -0x4(%rsp),%edx
  sub    %eax,%edx
  and    $0xfffffffe,%edx
  mov    -0x30(%rsp),%eax
  add    %edx,%eax
L5:
  mov    -0x38(%rsp),%r8d
  cmp    %eax,%r8d
  jle    L76
  lea    -0x2(%rax),%r10d
  imul   %r9d,%r10d
  movslq %r10d,%rbx
  lea    (%r14,%rbx,1),%rdi
  lea    (%r9,%r10,1),%r11d
  movslq %r11d,%r11
  add    -0x34(%rsp),%r10d
  movslq %r10d,%r10
  mov    -0x40(%rsp),%rsi
L40:
  movzbl (%rdi),%edx
  movzbl (%rsi),%ecx
  add    %ecx,%edx
  lea    (%rdx,%rdx,2),%ecx
  mov    %rdi,%rdx
  sub    %rbx,%rdx
  movzbl (%rdx,%r11,1),%r15d
  lea    0x1(%rax),%edx
  lea    0x2(%rax),%r13d
  cmp    %edx,%ebp
  mov    %r13d,%edx
  cmovle %ebp,%edx
  imul   %r9d,%edx
  movslq %edx,%rdx
  movzbl (%r14,%rdx,1),%r13d
  add    %r15d,%r13d
  imul   $0xffffffef,%r13d,%r13d
  add    %ecx,%r13d
  mov    %rdi,%rdx
  sub    %rbx,%rdx
  movzbl (%rdx,%r10,1),%r15d
  lea    0x1(%rax),%edx
  cmp    %eax,%ebp
  cmovle %ebp,%edx
  mov    %eax,%ecx
  sar    %ecx
  imul   %r9d,%ecx
  movslq %ecx,%rcx
  imul   %r9d,%edx
  movslq %edx,%rdx
  movzbl (%r14,%rdx,1),%edx
  add    %r15d,%edx
  imul   $0x4e,%edx,%edx
  lea    0x40(%r13,%rdx,1),%edx
  sar    $0x7,%edx
  mov    $0xff,%r13d
  cmp    %r13d,%edx
  cmovg  %r13d,%edx
  test   %edx,%edx
  mov    $0x0,%r13d
  cmovs  %r13d,%edx
  mov    %dl,(%r12,%rcx,1)
  add    $0x2,%eax
  add    -0x68(%rsp),%rdi
  cmp    %eax,%r8d
  jg     L40
L76:
  add    $0x1,%r14
  add    $0x1,%r12
  addq   $0x1,-0x60(%rsp)
  addq   $0x1,-0x58(%rsp)
  addq   $0x1,-0x50(%rsp)
  addq   $0x1,-0x40(%rsp)
  cmp    -0x18(%rsp),%r14
  je     L79
L11:
  mov    $0x0,%eax
  cmpl   $0x0,-0x38(%rsp)
  jg     L33
  jmp    L48
L79:
  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++;
  }
}
```