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

```asm
<ayuv2yuyv_ref>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  shr    $0x1f,%ebp
  add    %edx,%ebp
  sar    %ebp
  sub    $0x8,%rsp
  cmp    $0x1,%edx
  jle    L87
  mov    %ebp,%ecx
  mov    %rdi,%r12
  mov    %rsi,%r13
  lea    (%rsi,%rcx,8),%rax
  lea    (%rdi,%rcx,4),%rcx
  cmp    %rax,%rdi
  setae  %al
  cmp    %rcx,%rsi
  setae  %cl
  or     %cl,%al
  je     L9
  cmp    $0x21,%edx
  jle    L9
  lea    -0x1(%rbp),%eax
  mov    %rsi,%rdx
  movdqa D8(%rip),%xmm4
  mov    %rdi,%rcx
  mov    %eax,%esi
  shr    $0x4,%esi
  sub    $0x1,%esi
  shl    $0x7,%rsi
  lea    0x80(%r13,%rsi,1),%rsi
  nopw   0x0(%rax,%rax,1)
L134:
  movdqu (%rdx),%xmm1
  movdqu 0x10(%rdx),%xmm5
  sub    $0xffffffffffffff80,%rdx
  add    $0x40,%rcx
  movdqu -0x40(%rdx),%xmm0
  movdqu -0x60(%rdx),%xmm10
  movdqu -0x30(%rdx),%xmm2
  movdqa %xmm1,%xmm7
  movdqu -0x20(%rdx),%xmm9
  shufps $0x88,%xmm5,%xmm7
  movdqa %xmm0,%xmm3
  movdqu -0x50(%rdx),%xmm5
  movdqa %xmm10,%xmm6
  shufps $0x88,%xmm2,%xmm3
  movdqu -0x10(%rdx),%xmm2
  movdqu -0x50(%rdx),%xmm14
  shufps $0x88,%xmm5,%xmm6
  movdqa %xmm9,%xmm5
  movdqa %xmm6,%xmm11
  movdqu -0x70(%rdx),%xmm13
  shufps $0x88,%xmm2,%xmm5
  movdqa %xmm7,%xmm2
  movdqa %xmm5,%xmm12
  shufps $0xdd,%xmm14,%xmm10
  psrad  $0x10,%xmm11
  psrad  $0x10,%xmm2
  shufps $0xdd,%xmm13,%xmm1
  movdqu -0x30(%rdx),%xmm15
  movdqa %xmm2,%xmm8
  punpcklwd %xmm11,%xmm2
  movdqu -0x10(%rdx),%xmm13
  punpckhwd %xmm11,%xmm8
  movdqa %xmm2,%xmm11
  shufps $0xdd,%xmm15,%xmm0
  punpckhwd %xmm8,%xmm11
  punpcklwd %xmm8,%xmm2
  movdqa %xmm3,%xmm8
  shufps $0xdd,%xmm13,%xmm9
  psrad  $0x10,%xmm12
  psrad  $0x10,%xmm8
  punpcklwd %xmm11,%xmm2
  movdqa %xmm8,%xmm11
  punpcklwd %xmm12,%xmm8
  pand   %xmm4,%xmm2
  punpckhwd %xmm12,%xmm11
  movdqa %xmm8,%xmm12
  punpckhwd %xmm11,%xmm12
  punpcklwd %xmm11,%xmm8
  punpcklwd %xmm12,%xmm8
  pand   %xmm4,%xmm8
  packuswb %xmm8,%xmm2
  movdqa %xmm10,%xmm8
  movdqa %xmm1,%xmm10
  punpcklwd %xmm8,%xmm1
  punpckhwd %xmm8,%xmm10
  movdqa %xmm1,%xmm8
  punpcklwd %xmm10,%xmm1
  punpckhwd %xmm10,%xmm8
  punpcklwd %xmm8,%xmm1
  movdqa %xmm0,%xmm8
  punpcklwd %xmm9,%xmm0
  punpckhwd %xmm9,%xmm8
  psraw  $0x8,%xmm1
  movdqa %xmm0,%xmm9
  punpckhwd %xmm8,%xmm9
  punpcklwd %xmm8,%xmm0
  pand   %xmm4,%xmm1
  punpcklwd %xmm9,%xmm0
  movdqa %xmm7,%xmm8
  psraw  $0x8,%xmm0
  punpckhwd %xmm6,%xmm8
  pand   %xmm4,%xmm0
  packuswb %xmm0,%xmm1
  movdqa %xmm7,%xmm0
  punpcklwd %xmm6,%xmm0
  movdqa %xmm0,%xmm6
  punpcklwd %xmm8,%xmm0
  punpckhwd %xmm8,%xmm6
  punpcklwd %xmm6,%xmm0
  movdqa %xmm3,%xmm6
  punpcklwd %xmm5,%xmm3
  punpckhwd %xmm5,%xmm6
  movdqa %xmm3,%xmm5
  pand   %xmm4,%xmm0
  punpckhwd %xmm6,%xmm5
  punpcklwd %xmm6,%xmm3
  punpcklwd %xmm5,%xmm3
  movdqa %xmm1,%xmm5
  pand   %xmm4,%xmm3
  packuswb %xmm3,%xmm0
  movdqa %xmm2,%xmm3
  punpcklbw %xmm2,%xmm3
  punpcklbw %xmm0,%xmm5
  punpckhbw %xmm0,%xmm1
  movdqa %xmm3,%xmm0
  punpckhbw %xmm2,%xmm2
  punpckhbw %xmm5,%xmm3
  punpcklbw %xmm5,%xmm0
  movups %xmm3,-0x30(%rcx)
  movups %xmm0,-0x40(%rcx)
  movdqa %xmm2,%xmm0
  punpckhbw %xmm1,%xmm2
  punpcklbw %xmm1,%xmm0
  movups %xmm2,-0x10(%rcx)
  movups %xmm0,-0x20(%rcx)
  cmp    %rdx,%rsi
  jne    L134
  and    $0xfffffff0,%eax
  cltq
L11:
  movswl 0x2(%r13,%rax,8),%edx
  mov    %dl,(%r12,%rax,4)
  mov    0x4(%r13,%rax,8),%edx
  movzbl %dh,%ebx
  mov    %bl,0x1(%r12,%rax,4)
  movswl 0x2(%r13,%rax,8),%edx
  mov    %dl,0x2(%r12,%rax,4)
  mov    0x0(%r13,%rax,8),%edx
  mov    %dl,0x3(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L11
L114:
  xor    %ebx,%ebx
  jmp    L83
  nopl   0x0(%rax,%rax,1)
L69:
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <abort@plt>
  cmp    %ebx,%ebp
  jle    L87
L83:
  mov    0x0(%r13,%rbx,8),%edx
  movsbl (%r12,%rbx,4),%eax
  mov    %edx,%ecx
  sar    $0x10,%ecx
  cmp    %ecx,%eax
  jne    L69
  mov    0x4(%r13,%rbx,8),%ecx
  movsbl 0x1(%r12,%rbx,4),%esi
  sar    $0x8,%ecx
  cmp    %ecx,%esi
  jne    L69
  movsbl 0x2(%r12,%rbx,4),%ecx
  cmp    %ecx,%eax
  jne    L69
  movsbl 0x3(%r12,%rbx,4),%eax
  cmp    %eax,%edx
  jne    L69
  add    $0x1,%rbx
  cmp    %ebx,%ebp
  jg     L83
L87:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L9:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L93:
  movswl 0x2(%r13,%rax,8),%edx
  mov    %dl,(%r12,%rax,4)
  mov    0x4(%r13,%rax,8),%edx
  movzbl %dh,%ecx
  mov    %cl,0x1(%r12,%rax,4)
  movswl 0x2(%r13,%rax,8),%edx
  mov    %dl,0x2(%r12,%rax,4)
  mov    0x0(%r13,%rax,8),%edx
  mov    %dl,0x3(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L93
  jmp    L114
```

tool_calls: name: disassemble_data
arguments: tag: D8
type_infered: byte[16]

tool: {"D8": [0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00]}

assistant: ```c
__attribute__((no)) void ayuv2yuyv_ref(int *d, int *src, int n) {
  char *dest = (char *)d;
  int i;
  for (i = 0; i < n / 2; i++) {
    dest[i * 4 + 0] = (src[i * 2 + 0]) >> 16;
    dest[i * 4 + 1] = (src[i * 2 + 1]) >> 8;
    dest[i * 4 + 2] = (src[i * 2 + 0]) >> 16;
    dest[i * 4 + 3] = (src[i * 2 + 0]) >> 0;
  }
  for (i = 0; i < n / 2; i++) {
    if (dest[i * 4 + 0] != (src[i * 2 + 0]) >> 16 || dest[i * 4 + 1] != (src[i * 2 + 1]) >> 8 || dest[i * 4 + 2] != (src[i * 2 + 0]) >> 16 || dest[i * 4 + 3] != (src[i * 2 + 0]) >> 0)
      abort();
  }
}
```