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

```asm
<conv_0rgb1555_rgb565>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %r8d,%ebp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x58,%rsp
  mov    %rdi,0x18(%rsp)
  mov    $0xffc0,%edi
  mov    %edx,0x24(%rsp)
  mov    %ecx,0x40(%rsp)
  call   <_mm_set1_epi16@plt>
  mov    $0x1f,%edi
  mov    %eax,0x10(%rsp)
  call   <_mm_set1_epi16@plt>
  mov    $0x20,%edi
  mov    %eax,0x14(%rsp)
  call   <_mm_set1_epi16@plt>
  mov    %eax,0x44(%rsp)
  test   %r15d,%r15d
  jle    L131
  sar    %ebp
  sar    %ebx
  movl   $0x0,0x20(%rsp)
  movslq %ebp,%rax
  shl    $0x2,%rax
  mov    %rax,0x30(%rsp)
  movslq %ebx,%rax
  shl    $0x2,%rax
  mov    %rax,0x38(%rsp)
  lea    -0x8(%r14),%eax
  shr    $0x3,%eax
  add    $0x1,%eax
  mov    %eax,0x4c(%rsp)
  shl    $0x3,%eax
  mov    %eax,0x48(%rsp)
  nopw   0x0(%rax,%rax,1)
L124:
  xor    %eax,%eax
  cmpl   $0x7,0x24(%rsp)
  jle    L84
  mov    0x4c(%rsp),%eax
  mov    0x18(%rsp),%rbx
  mov    %r12,0x28(%rsp)
  mov    0x44(%rsp),%r15d
  shl    $0x5,%rax
  add    %r12,%rax
  mov    %rax,0x8(%rsp)
  nopl   0x0(%rax)
L17:
  mov    %r12,%rdi
  add    $0x20,%r12
  call   <_mm_loadu_si128@plt>
  mov    $0x1,%esi
  mov    %eax,%edi
  mov    %eax,%r14d
  call   <_mm_slli_epi16@plt>
  mov    0x10(%rsp),%esi
  mov    %eax,%edi
  call   <_mm_and_si128@plt>
  mov    0x14(%rsp),%esi
  mov    %r14d,%edi
  mov    %eax,%ebp
  call   <_mm_and_si128@plt>
  mov    $0x4,%esi
  mov    %r14d,%edi
  mov    %eax,%r13d
  call   <_mm_srli_epi16@plt>
  mov    %r15d,%esi
  mov    %eax,%edi
  call   <_mm_and_si128@plt>
  mov    %r13d,%edi
  mov    %eax,%esi
  call   <_mm_or_si128@plt>
  mov    %ebp,%edi
  mov    %eax,%esi
  call   <_mm_or_si128@plt>
  mov    %rbx,%rdi
  add    $0x20,%rbx
  mov    %eax,%esi
  call   <_mm_storeu_si128@plt>
  cmp    0x8(%rsp),%r12
  jne    L17
  mov    0x28(%rsp),%r12
  mov    0x48(%rsp),%eax
L84:
  mov    0x24(%rsp),%ebx
  cmp    %eax,%ebx
  jle    L174
  mov    %ebx,%ecx
  movslq %eax,%r8
  mov    0x18(%rsp),%rbx
  lea    0x0(,%r8,4),%rdx
  sub    %eax,%ecx
  lea    (%rbx,%rdx,1),%r9
  lea    0x4(%r12,%rdx,1),%rsi
  mov    %r9,%rdi
  sub    %rsi,%rdi
  cmp    $0x8,%rdi
  jbe    L14
  cmp    $0x1,%ecx
  je     L14
  lea    -0x1(%rcx),%esi
  cmp    $0x2,%esi
  jbe    L165
  add    %r12,%rdx
  mov    %ecx,%esi
  movdqu (%rdx),%xmm1
  shr    $0x2,%esi
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pand   D89(%rip),%xmm1
  pslld  $0x1,%xmm0
  psrad  $0x4,%xmm2
  pand   D26(%rip),%xmm0
  pand   D71(%rip),%xmm2
  por    %xmm2,%xmm0
  por    %xmm1,%xmm0
  movups %xmm0,(%r9)
  cmp    $0x1,%esi
  je     L168
  movdqu 0x10(%rdx),%xmm1
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pand   D89(%rip),%xmm1
  pslld  $0x1,%xmm0
  psrad  $0x4,%xmm2
  pand   D26(%rip),%xmm0
  pand   D71(%rip),%xmm2
  por    %xmm2,%xmm0
  por    %xmm1,%xmm0
  movups %xmm0,0x10(%r9)
L168:
  mov    %ecx,%edx
  and    $0xfffffffc,%edx
  add    %edx,%eax
  cmp    %edx,%ecx
  je     L174
  sub    %edx,%ecx
  cmp    $0x1,%ecx
  je     L38
L18:
  add    %r8,%rdx
  mov    0x18(%rsp),%rbx
  movq   D26(%rip),%xmm4
  movq   D71(%rip),%xmm3
  movq   (%r12,%rdx,4),%xmm1
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pslld  $0x1,%xmm0
  psrad  $0x4,%xmm2
  pand   %xmm3,%xmm2
  pand   %xmm4,%xmm0
  por    %xmm2,%xmm0
  movq   D89(%rip),%xmm2
  pand   %xmm2,%xmm1
  por    %xmm1,%xmm0
  movq   %xmm0,(%rbx,%rdx,4)
  mov    %ecx,%edx
  and    $0xfffffffe,%edx
  add    %edx,%eax
  cmp    %edx,%ecx
  je     L174
L38:
  movslq %eax,%rsi
  mov    0x18(%rsp),%rbx
  mov    (%r12,%rsi,4),%edx
  mov    %edx,%ecx
  lea    (%rdx,%rdx,1),%eax
  and    $0x1f,%edx
  sar    $0x4,%ecx
  and    $0xffc0,%eax
  and    $0x20,%ecx
  or     %ecx,%eax
  or     %edx,%eax
  mov    %eax,(%rbx,%rsi,4)
L174:
  addl   $0x1,0x20(%rsp)
  mov    0x30(%rsp),%rdx
  mov    0x20(%rsp),%eax
  add    %rdx,0x18(%rsp)
  add    0x38(%rsp),%r12
  cmp    %eax,0x40(%rsp)
  jne    L124
L131:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L14:
  mov    (%r12,%r8,4),%edi
  mov    0x24(%rsp),%ebx
  mov    %edi,%r8d
  lea    (%rdi,%rdi,1),%ecx
  and    $0x1f,%edi
  sar    $0x4,%r8d
  and    $0xffc0,%ecx
  and    $0x20,%r8d
  or     %r8d,%ecx
  or     %edi,%ecx
  mov    %ecx,(%r9)
  lea    0x1(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    (%rsi),%esi
  mov    0x18(%rsp),%r10
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0x4(%r10,%rdx,1)
  lea    0x2(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    0x8(%r12,%rdx,1),%esi
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0x8(%r10,%rdx,1)
  lea    0x3(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    0xc(%r12,%rdx,1),%esi
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0xc(%r10,%rdx,1)
  lea    0x4(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    0x10(%r12,%rdx,1),%esi
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0x10(%r10,%rdx,1)
  lea    0x5(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    0x14(%r12,%rdx,1),%esi
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0x14(%r10,%rdx,1)
  lea    0x6(%rax),%ecx
  cmp    %ecx,%ebx
  jle    L174
  mov    0x18(%r12,%rdx,1),%esi
  add    $0x7,%eax
  mov    %esi,%edi
  lea    (%rsi,%rsi,1),%ecx
  and    $0x1f,%esi
  sar    $0x4,%edi
  and    $0xffc0,%ecx
  and    $0x20,%edi
  or     %edi,%ecx
  or     %esi,%ecx
  mov    %ecx,0x18(%r10,%rdx,1)
  cmp    %eax,%ebx
  jle    L174
  mov    0x1c(%r12,%rdx,1),%ecx
  mov    %ecx,%eax
  lea    (%rcx,%rcx,1),%esi
  and    $0x1f,%ecx
  sar    $0x4,%eax
  and    $0xffc0,%esi
  and    $0x20,%eax
  or     %esi,%eax
  or     %ecx,%eax
  mov    %eax,0x1c(%r10,%rdx,1)
  jmp    L174
L165:
  xor    %edx,%edx
  jmp    L18
```

tool_calls: name: unpack_data
arguments: data_tag: D89
data_type: byte[16]
name: unpack_data
arguments: data_tag: D26
data_type: byte[16]
name: unpack_data
arguments: data_tag: D71
data_type: byte[16]

tool: {"D89": [0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00]}

tool: {"D26": [0xc0,0xff,0x00,0x00,0xc0,0xff,0x00,0x00,0xc0,0xff,0x00,0x00,0xc0,0xff,0x00,0x00]}

tool: {"D71": [0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00]}

assistant: ```c
void conv_0rgb1555_rgb565(void *output_, const void *input_, int width, int height, int out_stride, int in_stride) {
  const uint16_t *input = (const uint16_t *)input_;
  uint16_t *output = (uint16_t *)output_;
  int max_width = width - 7;
  const __m128i hi_mask = _mm_set1_epi16((int16_t)((0x1f << 11) | (0x1f << 6)));
  const __m128i lo_mask = _mm_set1_epi16(0x1f);
  const __m128i glow_mask = _mm_set1_epi16(1 << 5);
  for (int h = 0; h < height; h++, output += out_stride >> 1, input += in_stride >> 1) {
    int w;
    for (w = 0; w < max_width; w += 8) {
      const __m128i in = _mm_loadu_si128((const __m128i *)(input + w));
      __m128i rg = _mm_and_si128(_mm_slli_epi16(in, 1), hi_mask);
      __m128i b = _mm_and_si128(in, lo_mask);
      __m128i glow = _mm_and_si128(_mm_srli_epi16(in, 4), glow_mask);
      _mm_storeu_si128((__m128i *)(output + w), _mm_or_si128(rg, _mm_or_si128(b, glow)));
    }
    for (; w < width; w++) {
      uint16_t col = input[w];
      uint16_t rg = (col << 1) & ((0x1f << 11) | (0x1f << 6));
      uint16_t b = col & 0x1f;
      uint16_t glow = (col >> 4) & (1 << 5);
      output[w] = rg | b | glow;
    }
  }
}
```