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

```asm
<yuv400pto422>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x8,-0x1c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L101
L143:
  movl   $0x0,-0x24(%rbp)
  jmp    L61
L165:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xff,%eax
  jg     L41
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L62
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  jmp    L110
L62:
  mov    $0x0,%edx
  jmp    L110
L41:
  mov    $0xffffffff,%edx
L110:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x80,(%rax)
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xff,%eax
  jg     L114
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L38
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  jmp    L180
L38:
  mov    $0x0,%edx
  jmp    L180
L114:
  mov    $0xffffffff,%edx
L180:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x80,(%rax)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xff,%eax
  jg     L135
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L171
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  jmp    L107
L171:
  mov    $0x0,%edx
  jmp    L107
L135:
  mov    $0xffffffff,%edx
L107:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x80,(%rax)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xff,%eax
  jg     L113
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L18
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  jmp    L169
L18:
  mov    $0x0,%edx
  jmp    L169
L113:
  mov    $0xffffffff,%edx
L169:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x80,(%rax)
  addl   $0x2,-0x20(%rbp)
  addl   $0x2,-0x1c(%rbp)
  addl   $0x1,-0x24(%rbp)
L61:
  cmpl   $0x3,-0x24(%rbp)
  jle    L165
  addq   $0x40,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x8,-0x1c(%rbp)
  mov    -0x44(%rbp),%eax
  sub    $0x8,%eax
  add    %eax,%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x44(%rbp),%eax
  sub    $0x8,%eax
  add    %eax,%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x28(%rbp)
L101:
  cmpl   $0x3,-0x28(%rbp)
  jle    L143
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void yuv400pto422(int *out, unsigned char *pic, int width) {
  int j, k;
  unsigned char *pic0, *pic1;
  int *outy;
  int outy1 = 0;
  int outy2 = 8;
  pic0 = pic;
  pic1 = pic + width;
  outy = out;
  for (j = 0; j < 4; j++) {
    for (k = 0; k < 4; k++) {
      *pic0++ = (unsigned char)(((outy[outy1]) > 0xFF) ? 0xff : (((outy[outy1]) < 0) ? 0 : (outy[outy1])));
      *pic0++ = 128;
      *pic0++ = (unsigned char)(((outy[outy1 + 1]) > 0xFF) ? 0xff : (((outy[outy1 + 1]) < 0) ? 0 : (outy[outy1 + 1])));
      *pic0++ = 128;
      *pic1++ = (unsigned char)(((outy[outy2]) > 0xFF) ? 0xff : (((outy[outy2]) < 0) ? 0 : (outy[outy2])));
      *pic1++ = 128;
      *pic1++ = (unsigned char)(((outy[outy2 + 1]) > 0xFF) ? 0xff : (((outy[outy2 + 1]) < 0) ? 0 : (outy[outy2 + 1])));
      *pic1++ = 128;
      outy1 += 2;
      outy2 += 2;
    }
    outy += 16;
    outy1 = 0;
    outy2 = 8;
    pic0 += 2 * (width - 8);
    pic1 += 2 * (width - 8);
  }
}
```