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

```asm
<_swaps_buffer>:
  endbr64
  mov    %rsi,%rax
  mov    %rdi,%r9
  mov    %edx,%esi
  cmp    %rax,%rdi
  je     L44
  lea    0x2(%rdi),%r8
  test   %esi,%esi
  je     L40
  lea    0x1f(%r9),%rdx
  lea    -0x1(%rsi),%edi
  sub    %rax,%rdx
  cmp    $0x3e,%rdx
  jbe    L17
  cmp    $0xe,%edi
  jbe    L17
  mov    %esi,%edi
  movdqa D0(%rip),%xmm3
  xor    %edx,%edx
  shr    $0x4,%edi
  shl    $0x5,%rdi
  nopl   0x0(%rax)
L168:
  movdqu (%rax,%rdx,1),%xmm1
  movdqu 0x10(%rax,%rdx,1),%xmm0
  movdqu 0x10(%rax,%rdx,1),%xmm2
  pand   %xmm3,%xmm0
  pand   %xmm3,%xmm1
  packuswb %xmm0,%xmm1
  movdqu (%rax,%rdx,1),%xmm0
  psrlw  $0x8,%xmm2
  psrlw  $0x8,%xmm0
  packuswb %xmm2,%xmm0
  movdqa %xmm0,%xmm2
  punpckhbw %xmm1,%xmm0
  punpcklbw %xmm1,%xmm2
  movups %xmm0,0x10(%r9,%rdx,1)
  movups %xmm2,(%r9,%rdx,1)
  add    $0x20,%rdx
  cmp    %rdi,%rdx
  jne    L168
  mov    %esi,%edi
  and    $0xfffffff0,%edi
  mov    %edi,%edx
  add    %rdx,%rdx
  lea    (%r8,%rdx,1),%rcx
  add    %rdx,%rax
  mov    %esi,%edx
  sub    %edi,%edx
  cmp    %edi,%esi
  je     L40
  movzbl (%rax),%esi
  mov    %sil,-0x1(%rcx)
  movzbl 0x1(%rax),%esi
  mov    %sil,-0x2(%rcx)
  cmp    $0x1,%edx
  je     L40
  movzbl 0x2(%rax),%esi
  mov    %sil,0x1(%rcx)
  movzbl 0x3(%rax),%esi
  mov    %sil,(%rcx)
  cmp    $0x2,%edx
  je     L40
  movzbl 0x4(%rax),%esi
  mov    %sil,0x3(%rcx)
  movzbl 0x5(%rax),%esi
  mov    %sil,0x2(%rcx)
  cmp    $0x3,%edx
  je     L40
  movzbl 0x6(%rax),%esi
  mov    %sil,0x5(%rcx)
  movzbl 0x7(%rax),%esi
  mov    %sil,0x4(%rcx)
  cmp    $0x4,%edx
  je     L40
  movzbl 0x8(%rax),%esi
  mov    %sil,0x7(%rcx)
  movzbl 0x9(%rax),%esi
  mov    %sil,0x6(%rcx)
  cmp    $0x5,%edx
  je     L40
  movzbl 0xa(%rax),%esi
  mov    %sil,0x9(%rcx)
  movzbl 0xb(%rax),%esi
  mov    %sil,0x8(%rcx)
  cmp    $0x6,%edx
  je     L40
  movzbl 0xc(%rax),%esi
  mov    %sil,0xb(%rcx)
  movzbl 0xd(%rax),%esi
  mov    %sil,0xa(%rcx)
  cmp    $0x7,%edx
  je     L40
  movzbl 0xe(%rax),%esi
  mov    %sil,0xd(%rcx)
  movzbl 0xf(%rax),%esi
  mov    %sil,0xc(%rcx)
  cmp    $0x8,%edx
  je     L40
  movzbl 0x10(%rax),%esi
  mov    %sil,0xf(%rcx)
  movzbl 0x11(%rax),%esi
  mov    %sil,0xe(%rcx)
  cmp    $0x9,%edx
  je     L40
  movzbl 0x12(%rax),%esi
  mov    %sil,0x11(%rcx)
  movzbl 0x13(%rax),%esi
  mov    %sil,0x10(%rcx)
  cmp    $0xa,%edx
  je     L40
  movzbl 0x14(%rax),%esi
  mov    %sil,0x13(%rcx)
  movzbl 0x15(%rax),%esi
  mov    %sil,0x12(%rcx)
  cmp    $0xb,%edx
  je     L40
  movzbl 0x16(%rax),%esi
  mov    %sil,0x15(%rcx)
  movzbl 0x17(%rax),%esi
  mov    %sil,0x14(%rcx)
  cmp    $0xc,%edx
  je     L40
  movzbl 0x18(%rax),%esi
  mov    %sil,0x17(%rcx)
  movzbl 0x19(%rax),%esi
  mov    %sil,0x16(%rcx)
  cmp    $0xd,%edx
  je     L40
  movzbl 0x1a(%rax),%esi
  mov    %sil,0x19(%rcx)
  movzbl 0x1b(%rax),%esi
  mov    %sil,0x18(%rcx)
  cmp    $0xe,%edx
  je     L40
  movzbl 0x1c(%rax),%edx
  mov    %dl,0x1b(%rcx)
  movzbl 0x1d(%rax),%eax
  mov    %al,0x1a(%rcx)
  ret
  nopl   0x0(%rax)
L44:
  test   %esi,%esi
  je     L40
  push   %rbx
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L0:
  xor    %ebx,%ebx
  mov    0x1(%rax,%rdx,2),%bl
  mov    (%rax,%rdx,2),%bh
  mov    %bx,(%r9,%rdx,2)
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L0
  pop    %rbx
  ret
  nopl   0x0(%rax)
L17:
  lea    0x2(%rax,%rdi,2),%rcx
  nopl   (%rax)
L198:
  movzbl (%rax),%edx
  add    $0x2,%rax
  add    $0x2,%r8
  mov    %dl,-0x3(%r8)
  movzbl -0x1(%rax),%edx
  mov    %dl,-0x4(%r8)
  cmp    %rax,%rcx
  jne    L198
  ret
  nopl   (%rax)
L40:
  ret
```

tool_calls: name: parse_data
arguments: label: D0
datatype: byte[16]

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

assistant: ```c
void _swaps_buffer(short *s2, short *s1, int n) {
  register char *p, *q;
  short r[2];
  register short *s;
  p = (char *)s2;
  q = (char *)s1;
  if (p != q) {
    p += sizeof(short);
    for (n++; --n; p += 2 * sizeof(short)) {
      *--p = *q++;
      *--p = *q++;
    }
  } else {
    for (s = s2, n++; --n; *s++ = r[0]) {
      p = (char *)&r[1];
      *--p = *q++;
      *--p = *q++;
    }
  }
}
```