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

```asm
<__int32_t_encode_little_endian_array>:
  endbr64
  lea    0x0(,%r8,4),%r9d
  cmp    %edx,%r9d
  jg     L73
  test   %r8d,%r8d
  jle    L36
  mov    %esi,%r10d
  mov    %rcx,%rsi
  movslq %r8d,%rcx
  push   %rbp
  shl    $0x2,%rcx
  movslq %r10d,%rdx
  push   %rbx
  lea    -0x1(%r8),%ebp
  lea    (%rdx,%rcx,1),%r11
  lea    0x0(,%rdx,4),%rbx
  lea    (%rdi,%r11,4),%r11
  lea    (%rdi,%rbx,1),%rax
  cmp    %r11,%rsi
  setae  %r11b
  add    %rsi,%rcx
  cmp    %rcx,%rax
  setae  %cl
  or     %cl,%r11b
  je     L69
  cmp    $0x4,%ebp
  jbe    L69
  mov    %r8d,%r11d
  movdqa D4(%rip),%xmm4
  mov    %rsi,%rcx
  lea    0xc(%rdi,%rbx,1),%rdx
  shr    $0x2,%r11d
  sub    $0x1,%r11d
  shl    $0x4,%r11
  lea    0x10(%rsi,%r11,1),%r11
  xchg   %ax,%ax
L38:
  movdqu (%rcx),%xmm0
  add    $0x10,%rcx
  add    $0x40,%rax
  add    $0x40,%rdx
  movdqa %xmm0,%xmm3
  movdqa %xmm0,%xmm2
  movdqa %xmm0,%xmm1
  psrad  $0x8,%xmm2
  psrad  $0x10,%xmm1
  pand   %xmm4,%xmm3
  pshufd $0x55,%xmm3,%xmm5
  movd   %xmm3,-0x40(%rax)
  pand   %xmm4,%xmm2
  pand   %xmm4,%xmm1
  movd   %xmm5,-0x30(%rax)
  movdqa %xmm3,%xmm5
  psrld  $0x18,%xmm0
  punpckhdq %xmm3,%xmm5
  pshufd $0xff,%xmm3,%xmm3
  movd   %xmm2,-0x3c(%rax)
  movd   %xmm3,-0x10(%rax)
  pshufd $0x55,%xmm2,%xmm3
  movd   %xmm3,-0x2c(%rax)
  movdqa %xmm2,%xmm3
  punpckhdq %xmm2,%xmm3
  pshufd $0xff,%xmm2,%xmm2
  movd   %xmm1,-0x38(%rax)
  movd   %xmm2,-0xc(%rax)
  pshufd $0x55,%xmm1,%xmm2
  movd   %xmm2,-0x28(%rax)
  movdqa %xmm1,%xmm2
  punpckhdq %xmm1,%xmm2
  pshufd $0xff,%xmm1,%xmm1
  movd   %xmm5,-0x20(%rax)
  movd   %xmm1,-0x8(%rax)
  pshufd $0x55,%xmm0,%xmm1
  movd   %xmm3,-0x1c(%rax)
  movd   %xmm2,-0x18(%rax)
  movd   %xmm1,-0x30(%rdx)
  movdqa %xmm0,%xmm1
  punpckhdq %xmm0,%xmm1
  movd   %xmm0,-0x40(%rdx)
  pshufd $0xff,%xmm0,%xmm0
  movd   %xmm1,-0x20(%rdx)
  movd   %xmm0,-0x10(%rdx)
  cmp    %rcx,%r11
  jne    L38
  mov    %r8d,%eax
  and    $0xfffffffc,%eax
  lea    (%r10,%rax,4),%edx
  cmp    %eax,%r8d
  je     L3
  mov    %eax,%ecx
  movslq %edx,%rdx
  lea    0x0(,%rcx,4),%r11
  mov    (%rsi,%rcx,4),%ecx
  movzbl %cl,%ebx
  mov    %ecx,%r10d
  movd   %ebx,%xmm0
  sar    $0x10,%r10d
  movzbl %ch,%ebx
  movd   %ebx,%xmm2
  shr    $0x18,%ecx
  movzbl %r10b,%ebx
  movd   %ecx,%xmm7
  movd   %ebx,%xmm1
  punpckldq %xmm2,%xmm0
  punpckldq %xmm7,%xmm1
  lea    0x1(%rax),%ecx
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,(%rdi,%rdx,4)
  cmp    %ecx,%r8d
  jle    L3
  mov    0x4(%rsi,%r11,1),%ecx
  add    $0x4,%rdx
  add    $0x2,%eax
  lea    0x0(,%rdx,4),%rbx
  movzbl %cl,%r10d
  movzbl %ch,%ebp
  movd   %r10d,%xmm0
  mov    %ecx,%r10d
  shr    $0x18,%ecx
  movd   %ebp,%xmm2
  sar    $0x10,%r10d
  movd   %ecx,%xmm7
  punpckldq %xmm2,%xmm0
  movzbl %r10b,%r10d
  movd   %r10d,%xmm1
  punpckldq %xmm7,%xmm1
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,(%rdi,%rdx,4)
  cmp    %eax,%r8d
  jle    L3
  mov    0x8(%rsi,%r11,1),%eax
  movzbl %al,%esi
  mov    %eax,%edx
  movd   %esi,%xmm0
  sar    $0x10,%edx
  movzbl %ah,%esi
  movd   %esi,%xmm2
  shr    $0x18,%eax
  movzbl %dl,%esi
  movd   %esi,%xmm1
  movd   %eax,%xmm7
  punpckldq %xmm2,%xmm0
  punpckldq %xmm7,%xmm1
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,0x10(%rdi,%rbx,1)
L3:
  mov    %r9d,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L69:
  lea    0x4(%rdx,%rbp,4),%r8
  mov    %rdx,%rax
  sub    %rdx,%rsi
  nopl   0x0(%rax,%rax,1)
L76:
  mov    (%rsi,%rax,1),%edx
  movzbl %dl,%ebx
  mov    %edx,%ecx
  movd   %ebx,%xmm0
  sar    $0x10,%ecx
  movzbl %dh,%ebx
  movd   %ebx,%xmm2
  shr    $0x18,%edx
  movzbl %cl,%ebx
  movd   %ebx,%xmm1
  movd   %edx,%xmm6
  punpckldq %xmm2,%xmm0
  punpckldq %xmm6,%xmm1
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,(%rdi,%rax,4)
  add    $0x4,%rax
  cmp    %rax,%r8
  jne    L76
  mov    %r9d,%eax
  pop    %rbx
  pop    %rbp
  ret
L73:
  mov    $0xffffffff,%r9d
L36:
  mov    %r9d,%eax
  ret
```

tool_calls: name: parse_data
arguments: tag: D4
type_infered: byte[16]

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

assistant: ```c
int __int32_t_encode_little_endian_array(void *_buf, uint32_t offset, uint32_t maxlen, const int32_t *p, uint32_t elements) {
  uint32_t total_size = (4) * elements;
  uint8_t *buf = (uint8_t *)_buf;
  uint32_t pos = offset;
  uint32_t element;
  if (maxlen < total_size)
    return -1;
  const uint32_t *unsigned_p = (uint32_t *)p;
  for (element = 0; element < elements; ++element) {
    uint32_t v = unsigned_p[element];
    buf[pos++] = (v & 0xff);
    buf[pos++] = (v >> 8) & 0xff;
    buf[pos++] = (v >> 16) & 0xff;
    buf[pos++] = (v >> 24) & 0xff;
  }
  return total_size;
}
```