user: Please show me the C implementation that matches the assembly code listed below:

```asm
<RGB555toRGB565>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %r9d,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  mov    %r8d,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x24(%rsp),%rax
  mov    0x80(%rsp),%r10
  movslq 0x98(%rsp),%r14
  mov    0xb0(%rsp),%ebp
  push   %rax
  lea    0x28(%rsp),%rax
  push   %rax
  mov    0xc8(%rsp),%eax
  push   %rax
  push   %rbp
  mov    0xc8(%rsp),%eax
  push   %rax
  mov    0xc8(%rsp),%eax
  push   %rax
  push   %r14
  mov    0xc8(%rsp),%eax
  push   %rax
  mov    0xc8(%rsp),%eax
  push   %rax
  push   %r10
  mov    0xc8(%rsp),%eax
  mov    %r10,0x58(%rsp)
  push   %rax
  mov    0xc8(%rsp),%eax
  push   %rax
  mov    %rdi,0x60(%rsp)
  call   <chk_args@plt>
  add    $0x60,%rsp
  test   %eax,%eax
  je     L395
  test   %r14d,%r14d
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%r10
  jns    L495
  mov    0x90(%rsp),%eax
  sub    $0x1,%eax
  imul   %r14d,%eax
  cltq
  sub    %rax,%r10
L495:
  test   %r12d,%r12d
  jns    L489
  lea    -0x1(%r15),%edx
  imul   %r12d,%edx
  movslq %edx,%rax
  sub    %rax,%rdi
L489:
  mov    0x20(%rsp),%eax
  cmp    $0x1,%eax
  je     L191
  cmp    $0x2,%eax
  jne    L395
  cmpl   $0x2,0x24(%rsp)
  jne    L395
  mov    0xa8(%rsp),%r15d
  mov    0xa0(%rsp),%eax
  imul   %r12d,%r13d
  mov    0xb8(%rsp),%esi
  imul   %r14d,%r15d
  lea    (%rax,%rax,1),%edx
  movslq %edx,%rdx
  movslq %r15d,%rax
  lea    (%rdx,%rax,1),%r15
  lea    (%rbx,%rbx,1),%eax
  movslq %r13d,%rdx
  cltq
  add    %r10,%r15
  add    %rdx,%rax
  add    %rdi,%rax
  test   %esi,%esi
  jle    L602
  mov    0xa0(%rsp),%ebx
  movdqa D116(%rip),%xmm6
  movdqa D3(%rip),%xmm5
  movdqa D64(%rip),%xmm4
  and    $0x3,%ebx
  movdqa D145(%rip),%xmm3
  mov    %ebx,0x14(%rsp)
  lea    0x0(,%rbp,4),%ebx
  movslq %ebx,%rdx
  neg    %rdx
  mov    %rdx,(%rsp)
  lea    0x0(%rbp,%rbp,1),%edx
  movslq %edx,%rdx
  sub    %rdx,%r14
  lea    (%r12,%r12,1),%edx
  movslq %edx,%rdx
  mov    %rdx,0x8(%rsp)
  movslq %r12d,%rdx
  xor    %r12d,%r12d
  mov    %rdx,0x18(%rsp)
  nopw   0x0(%rax,%rax,1)
L375:
  mov    0x14(%rsp),%ecx
  mov    %ebp,%edx
  test   %ecx,%ecx
  je     L467
  lea    0x1(%rbp),%esi
  add    0xa0(%rsp),%esi
  test   %ebp,%ebp
  jne    L533
  jmp    L238
  nopl   (%rax)
L442:
  test   %edx,%edx
  je     L238
L533:
  movzwl (%r15),%edi
  add    $0x4,%rax
  add    $0x2,%r15
  lea    (%rdi,%rdi,1),%ecx
  and    $0x1f,%edi
  and    $0xffffffc0,%ecx
  or     %edi,%ecx
  mov    %cx,-0x4(%rax)
  mov    %cx,-0x2(%rax)
  mov    %esi,%ecx
  sub    %edx,%ecx
  sub    $0x1,%edx
  and    $0x3,%ecx
  jne    L442
L467:
  cmp    $0x3,%edx
  jle    L71
  sub    $0x4,%edx
  mov    %edx,%r10d
  shr    $0x2,%r10d
  lea    0x1(%r10),%ecx
  lea    (%r15,%rcx,8),%rsi
  mov    %rcx,%r9
  cmp    %rsi,%rax
  setae  %sil
  shl    $0x4,%rcx
  add    %rax,%rcx
  cmp    %rcx,%r15
  setae  %cl
  or     %sil,%cl
  je     L19
  cmp    $0x3,%edx
  jbe    L19
  cmp    $0xb,%edx
  jbe    L296
  mov    %r9d,%edi
  mov    %r15,%rsi
  mov    %rax,%rcx
  shr    $0x2,%edi
  sub    $0x1,%edi
  shl    $0x5,%rdi
  lea    0x20(%r15,%rdi,1),%rdi
L214:
  movdqu (%rsi),%xmm2
  movdqu 0x10(%rsi),%xmm7
  add    $0x20,%rsi
  add    $0x40,%rcx
  movdqa %xmm2,%xmm1
  shufps $0xdd,%xmm7,%xmm2
  shufps $0x88,%xmm7,%xmm1
  movdqa %xmm1,%xmm0
  pand   %xmm5,%xmm1
  pslld  $0x1,%xmm0
  pand   %xmm6,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  movdqa %xmm0,%xmm7
  pslld  $0x10,%xmm7
  pand   %xmm4,%xmm1
  por    %xmm7,%xmm1
  movdqa %xmm0,%xmm7
  pand   %xmm3,%xmm7
  psrld  $0x10,%xmm0
  por    %xmm0,%xmm7
  movdqa %xmm2,%xmm0
  pand   %xmm5,%xmm2
  pslld  $0x1,%xmm0
  pand   %xmm6,%xmm0
  por    %xmm2,%xmm0
  movdqa %xmm0,%xmm9
  movdqa %xmm0,%xmm2
  movdqa %xmm0,%xmm8
  pslld  $0x10,%xmm2
  pand   %xmm4,%xmm9
  pand   %xmm3,%xmm8
  por    %xmm2,%xmm9
  psrld  $0x10,%xmm0
  movdqa %xmm1,%xmm2
  por    %xmm0,%xmm8
  punpckldq %xmm9,%xmm2
  punpckhdq %xmm9,%xmm1
  movdqa %xmm7,%xmm9
  punpckhdq %xmm8,%xmm7
  movdqa %xmm1,%xmm0
  punpckldq %xmm8,%xmm9
  movdqa %xmm7,%xmm1
  movdqa %xmm2,%xmm7
  punpckhdq %xmm9,%xmm2
  punpckldq %xmm9,%xmm7
  movups %xmm2,-0x30(%rcx)
  movdqa %xmm0,%xmm2
  punpckhdq %xmm1,%xmm0
  punpckldq %xmm1,%xmm2
  movups %xmm7,-0x40(%rcx)
  movups %xmm2,-0x20(%rcx)
  movups %xmm0,-0x10(%rcx)
  cmp    %rsi,%rdi
  jne    L214
  mov    %r9d,%ecx
  and    $0xfffffffc,%ecx
  mov    %ecx,%esi
  lea    (%r15,%rsi,8),%r8
  shl    $0x4,%rsi
  add    %rax,%rsi
  cmp    %ecx,%r9d
  je     L404
L453:
  mov    %r9d,%r11d
  sub    %ecx,%r11d
  cmp    %ecx,%r10d
  je     L309
  movq   D116(%rip),%xmm11
  lea    (%r15,%rcx,8),%rdi
  movq   D3(%rip),%xmm10
  shl    $0x4,%rcx
  movq   (%rdi),%xmm9
  movq   0x8(%rdi),%xmm0
  mov    %r11d,%edi
  add    %rax,%rcx
  movq   D64(%rip),%xmm8
  and    $0xfffffffe,%edi
  movq   D145(%rip),%xmm7
  movdqa %xmm9,%xmm1
  punpckldq %xmm0,%xmm9
  punpckldq %xmm0,%xmm1
  pshufd $0xe,%xmm9,%xmm9
  movdqa %xmm1,%xmm0
  pand   %xmm10,%xmm1
  pslld  $0x1,%xmm0
  pand   %xmm11,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  movdqa %xmm0,%xmm2
  pand   %xmm8,%xmm1
  pslld  $0x10,%xmm2
  por    %xmm2,%xmm1
  movdqa %xmm0,%xmm2
  pand   %xmm7,%xmm2
  psrld  $0x10,%xmm0
  por    %xmm0,%xmm2
  movdqa %xmm9,%xmm0
  pand   %xmm10,%xmm9
  pslld  $0x1,%xmm0
  pand   %xmm11,%xmm0
  por    %xmm9,%xmm0
  movdqa %xmm0,%xmm9
  pand   %xmm0,%xmm8
  pand   %xmm0,%xmm7
  pslld  $0x10,%xmm9
  psrld  $0x10,%xmm0
  por    %xmm9,%xmm8
  movdqa %xmm1,%xmm9
  por    %xmm0,%xmm7
  punpckldq %xmm8,%xmm1
  punpckldq %xmm8,%xmm9
  pshufd $0xe,%xmm1,%xmm1
  movdqa %xmm1,%xmm0
  movdqa %xmm2,%xmm1
  punpckldq %xmm7,%xmm2
  punpckldq %xmm7,%xmm1
  pshufd $0xe,%xmm2,%xmm2
  movdqa %xmm9,%xmm7
  punpckldq %xmm1,%xmm7
  punpckldq %xmm1,%xmm9
  movdqa %xmm0,%xmm1
  punpckldq %xmm2,%xmm0
  pshufd $0xe,%xmm9,%xmm9
  punpckldq %xmm2,%xmm1
  movq   %xmm7,(%rcx)
  pshufd $0xe,%xmm0,%xmm0
  movq   %xmm9,0x8(%rcx)
  movq   %xmm1,0x10(%rcx)
  movq   %xmm0,0x18(%rcx)
  mov    %edi,%ecx
  lea    (%r8,%rcx,8),%r8
  shl    $0x4,%rcx
  add    %rcx,%rsi
  cmp    %edi,%r11d
  je     L404
L309:
  mov    (%r8),%edi
  lea    (%rdi,%rdi,1),%ecx
  and    $0x1f001f,%edi
  and    $0xffc0ffc0,%ecx
  or     %edi,%ecx
  mov    %ecx,%r11d
  movzwl %cx,%edi
  shl    $0x10,%r11d
  or     %r11d,%edi
  mov    %edi,(%rsi)
  mov    %ecx,%edi
  shr    $0x10,%ecx
  xor    %di,%di
  or     %ecx,%edi
  mov    %edi,0x4(%rsi)
  mov    0x4(%r8),%edi
  lea    (%rdi,%rdi,1),%ecx
  and    $0x1f001f,%edi
  and    $0xffc0ffc0,%ecx
  or     %edi,%ecx
  mov    %ecx,%r8d
  movzwl %cx,%edi
  shl    $0x10,%r8d
  or     %r8d,%edi
  mov    %edi,0x8(%rsi)
  mov    %ecx,%edi
  shr    $0x10,%ecx
  xor    %di,%di
  or     %ecx,%edi
  mov    %edi,0xc(%rsi)
L404:
  mov    %r9d,%r9d
  neg    %r10d
  mov    %r9,%rcx
  lea    (%r15,%r9,8),%r15
  lea    (%rdx,%r10,4),%edx
  shl    $0x4,%rcx
  add    %rcx,%rax
L71:
  test   %edx,%edx
  je     L238
  mov    %edx,%esi
  lea    -0x1(%rdx),%ecx
  lea    (%r15,%rsi,2),%rdi
  lea    (%rax,%rsi,4),%rsi
  cmp    %rdi,%rax
  setae  %dil
  cmp    %rsi,%r15
  setae  %sil
  or     %dil,%sil
  je     L619
  cmp    $0x2,%ecx
  jbe    L619
  movq   (%r15),%xmm1
  mov    %edx,%r9d
  mov    %edx,%r8d
  movq   D116(%rip),%xmm2
  and    $0xfffffffc,%r9d
  movdqa %xmm1,%xmm0
  mov    %r9d,%esi
  sub    %r9d,%r8d
  psllw  $0x1,%xmm0
  lea    (%r15,%rsi,2),%rdi
  lea    (%rax,%rsi,4),%rsi
  pand   %xmm2,%xmm0
  movq   D3(%rip),%xmm2
  pand   %xmm2,%xmm1
  por    %xmm0,%xmm1
  pshuflw $0x50,%xmm1,%xmm0
  pshuflw $0xfa,%xmm1,%xmm1
  movq   %xmm0,(%rax)
  movq   %xmm1,0x8(%rax)
  cmp    %r9d,%edx
  je     L497
  movzwl (%rdi),%r9d
  lea    (%r9,%r9,1),%edx
  and    $0x1f,%r9d
  and    $0xffffffc0,%edx
  or     %r9d,%edx
  mov    %dx,(%rsi)
  mov    %dx,0x2(%rsi)
  cmp    $0x1,%r8d
  je     L497
  movzwl 0x2(%rdi),%r9d
  lea    (%r9,%r9,1),%edx
  and    $0x1f,%r9d
  and    $0xffffffc0,%edx
  or     %r9d,%edx
  mov    %dx,0x4(%rsi)
  mov    %dx,0x6(%rsi)
  cmp    $0x2,%r8d
  je     L497
  movzwl 0x4(%rdi),%edi
  lea    (%rdi,%rdi,1),%edx
  and    $0x1f,%edi
  and    $0xffffffc0,%edx
  or     %edi,%edx
  mov    %dx,0x8(%rsi)
  mov    %dx,0xa(%rsi)
L497:
  add    $0x1,%rcx
  lea    (%rax,%rcx,4),%rax
  lea    (%r15,%rcx,2),%r15
L238:
  mov    (%rsp),%rdx
  add    %r14,%r15
  add    $0x1,%r12d
  lea    (%rax,%rdx,1),%r13
  mov    0x18(%rsp),%rax
  mov    %ebx,%edx
  mov    %r13,%rsi
  lea    0x0(%r13,%rax,1),%rdi
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  movdqa D116(%rip),%xmm6
  movdqa D3(%rip),%xmm5
  movdqa D64(%rip),%xmm4
  add    %r13,%rax
  cmp    %r12d,0xb8(%rsp)
  movdqa D145(%rip),%xmm3
  jne    L375
L602:
  xor    %eax,%eax
L592:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L422
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L619:
  movzwl (%r15),%edi
  lea    (%rdi,%rdi,1),%esi
  and    $0x1f,%edi
  and    $0xffffffc0,%esi
  or     %edi,%esi
  mov    %si,(%rax)
  mov    %si,0x2(%rax)
  test   %ecx,%ecx
  je     L497
  movzwl 0x2(%r15),%edi
  lea    (%rdi,%rdi,1),%esi
  and    $0x1f,%edi
  and    $0xffffffc0,%esi
  or     %edi,%esi
  mov    %si,0x4(%rax)
  mov    %si,0x6(%rax)
  cmp    $0x2,%edx
  je     L497
  movzwl 0x4(%r15),%edi
  lea    (%rdi,%rdi,1),%esi
  and    $0x1f,%edi
  and    $0xffffffc0,%esi
  or     %edi,%esi
  mov    %si,0x8(%rax)
  mov    %si,0xa(%rax)
  cmp    $0x3,%edx
  je     L497
  movzwl 0x6(%r15),%esi
  lea    (%rsi,%rsi,1),%edx
  and    $0x1f,%esi
  and    $0xffffffc0,%edx
  or     %esi,%edx
  mov    %dx,0xc(%rax)
  mov    %dx,0xe(%rax)
  jmp    L497
  nopl   (%rax)
L19:
  mov    %r9d,%ecx
  mov    %rax,%rsi
  mov    %r15,%rdi
  lea    (%r15,%rcx,8),%r11
  nopl   (%rax)
L606:
  mov    (%rdi),%r8d
  add    $0x8,%rdi
  add    $0x10,%rsi
  lea    (%r8,%r8,1),%ecx
  and    $0x1f001f,%r8d
  and    $0xffc0ffc0,%ecx
  or     %r8d,%ecx
  mov    %ecx,%r13d
  movzwl %cx,%r8d
  shl    $0x10,%r13d
  or     %r13d,%r8d
  mov    %r8d,-0x10(%rsi)
  mov    %ecx,%r8d
  shr    $0x10,%ecx
  xor    %r8w,%r8w
  or     %r8d,%ecx
  mov    %ecx,-0xc(%rsi)
  mov    -0x4(%rdi),%r8d
  lea    (%r8,%r8,1),%ecx
  and    $0x1f001f,%r8d
  and    $0xffc0ffc0,%ecx
  or     %r8d,%ecx
  mov    %ecx,%r13d
  movzwl %cx,%r8d
  shl    $0x10,%r13d
  or     %r13d,%r8d
  mov    %r8d,-0x8(%rsi)
  mov    %ecx,%r8d
  shr    $0x10,%ecx
  xor    %r8w,%r8w
  or     %r8d,%ecx
  mov    %ecx,-0x4(%rsi)
  cmp    %r11,%rdi
  jne    L606
  jmp    L404
L191:
  cmpl   $0x1,0x24(%rsp)
  mov    $0xffffffff,%eax
  jne    L592
  mov    0xa0(%rsp),%eax
  mov    %r13d,%edx
  mov    0x78(%rsp),%r8d
  imul   %r12d,%edx
  lea    (%rax,%rax,1),%esi
  mov    0xa8(%rsp),%eax
  movslq %esi,%rsi
  imul   %r14d,%eax
  movslq %edx,%rdx
  cltq
  add    %rax,%rsi
  lea    (%rbx,%rbx,1),%eax
  cltq
  add    %r10,%rsi
  add    %rdx,%rax
  add    %rax,%rdi
  test   %r8d,%r8d
  jle    L602
  mov    0x70(%rsp),%eax
  mov    %r12d,%r11d
  mov    %r14d,%r10d
  mov    0x78(%rsp),%r12d
  mov    0xa0(%rsp),%r9d
  mov    0xa0(%rsp),%ebx
  xor    %r8d,%r8d
  add    %eax,%eax
  movdqa D116(%rip),%xmm3
  movq   D116(%rip),%xmm5
  sub    %eax,%r10d
  sub    %eax,%r11d
  mov    0x70(%rsp),%eax
  movq   D3(%rip),%xmm4
  movdqa D3(%rip),%xmm2
  and    $0x3,%r9d
  movslq %r10d,%r10
  movslq %r11d,%r11
  movq   D116(%rip),%xmm7
  lea    0x1(%rax,%rbx,1),%ebx
  mov    %eax,%ebp
  movq   D3(%rip),%xmm6
L585:
  mov    %ebp,%ecx
  test   %r9d,%r9d
  je     L561
  test   %ebp,%ebp
  jne    L70
  jmp    L551
  nopl   (%rax)
L49:
  test   %ecx,%ecx
  je     L551
L70:
  movzwl (%rsi),%edx
  add    $0x2,%rdi
  add    $0x2,%rsi
  lea    (%rdx,%rdx,1),%eax
  and    $0x1f,%edx
  and    $0xffffffc0,%eax
  or     %edx,%eax
  mov    %ax,-0x2(%rdi)
  mov    %ebx,%eax
  sub    %ecx,%eax
  sub    $0x1,%ecx
  test   $0x3,%al
  jne    L49
L561:
  cmp    $0x3,%ecx
  jle    L312
  mov    %rdi,%rax
  sub    $0x4,%ecx
  sub    %rsi,%rax
  sub    $0x4,%rax
  cmp    $0x8,%rax
  jbe    L610
  mov    %ecx,%r13d
  shr    $0x2,%r13d
  add    $0x1,%r13d
  cmp    $0x3,%ecx
  jbe    L4
  mov    %r13d,%edx
  xor    %eax,%eax
  shr    %edx
  shl    $0x4,%rdx
  nopl   0x0(%rax)
L336:
  movdqu (%rsi,%rax,1),%xmm1
  movdqa %xmm1,%xmm0
  pand   %xmm2,%xmm1
  pslld  $0x1,%xmm0
  pand   %xmm3,%xmm0
  por    %xmm1,%xmm0
  movups %xmm0,(%rdi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L336
  mov    %r13d,%eax
  and    $0xfffffffe,%eax
  and    $0x80000001,%r13d
  je     L200
L217:
  movq   (%rsi,%rax,8),%xmm1
  movdqa %xmm1,%xmm0
  pand   %xmm4,%xmm1
  pslld  $0x1,%xmm0
  pand   %xmm5,%xmm0
  por    %xmm1,%xmm0
  movq   %xmm0,(%rdi,%rax,8)
L200:
  mov    %ecx,%edx
  shr    $0x2,%edx
  lea    0x1(%rdx),%eax
  neg    %edx
  shl    $0x3,%rax
  lea    (%rcx,%rdx,4),%ecx
  add    %rax,%rdi
  add    %rax,%rsi
L312:
  test   %ecx,%ecx
  je     L551
  lea    0x2(%rsi),%r13
  mov    %rdi,%rax
  lea    -0x1(%rcx),%edx
  sub    %r13,%rax
  cmp    $0x4,%rax
  jbe    L13
  cmp    $0x2,%edx
  jbe    L13
  movq   (%rsi),%xmm1
  mov    %ecx,%r13d
  mov    %ecx,%r15d
  and    $0xfffffffc,%r13d
  movdqa %xmm1,%xmm0
  mov    %r13d,%eax
  pand   %xmm6,%xmm1
  sub    %r13d,%r15d
  psllw  $0x1,%xmm0
  add    %rax,%rax
  pand   %xmm7,%xmm0
  lea    (%rsi,%rax,1),%r14
  add    %rdi,%rax
  por    %xmm1,%xmm0
  movq   %xmm0,(%rdi)
  cmp    %ecx,%r13d
  je     L287
  movzwl (%r14),%r13d
  lea    0x0(%r13,%r13,1),%ecx
  and    $0x1f,%r13d
  and    $0xffffffc0,%ecx
  or     %r13d,%ecx
  mov    %cx,(%rax)
  cmp    $0x1,%r15d
  je     L287
  movzwl 0x2(%r14),%r13d
  lea    0x0(%r13,%r13,1),%ecx
  and    $0x1f,%r13d
  and    $0xffffffc0,%ecx
  or     %r13d,%ecx
  mov    %cx,0x2(%rax)
  cmp    $0x2,%r15d
  je     L287
  movzwl 0x4(%r14),%r13d
  lea    0x0(%r13,%r13,1),%ecx
  and    $0x1f,%r13d
  and    $0xffffffc0,%ecx
  or     %r13d,%ecx
  mov    %cx,0x4(%rax)
L287:
  lea    0x2(%rdx,%rdx,1),%rax
  add    %rax,%rdi
  add    %rax,%rsi
L551:
  add    $0x1,%r8d
  add    %r10,%rsi
  add    %r11,%rdi
  cmp    %r8d,%r12d
  jne    L585
  jmp    L602
L296:
  mov    %rax,%rsi
  mov    %r15,%r8
  xor    %ecx,%ecx
  jmp    L453
L13:
  movzwl (%rsi),%r13d
  lea    0x0(%r13,%r13,1),%eax
  and    $0x1f,%r13d
  and    $0xffffffc0,%eax
  or     %r13d,%eax
  mov    %ax,(%rdi)
  test   %edx,%edx
  je     L287
  movzwl 0x2(%rsi),%r13d
  lea    0x0(%r13,%r13,1),%eax
  and    $0x1f,%r13d
  and    $0xffffffc0,%eax
  or     %r13d,%eax
  mov    %ax,0x2(%rdi)
  cmp    $0x2,%ecx
  je     L287
  movzwl 0x4(%rsi),%r13d
  lea    0x0(%r13,%r13,1),%eax
  and    $0x1f,%r13d
  and    $0xffffffc0,%eax
  or     %r13d,%eax
  mov    %ax,0x4(%rdi)
  cmp    $0x3,%ecx
  je     L287
  movzwl 0x6(%rsi),%ecx
  lea    (%rcx,%rcx,1),%eax
  and    $0x1f,%ecx
  and    $0xffffffc0,%eax
  or     %ecx,%eax
  mov    %ax,0x6(%rdi)
  jmp    L287
L395:
  mov    $0xffffffff,%eax
  jmp    L592
L610:
  mov    %ecx,%eax
  mov    %rsi,%rdx
  shr    $0x2,%eax
  add    $0x1,%eax
  lea    (%rdi,%rax,8),%r13
  mov    %rdi,%rax
  xchg   %ax,%ax
L466:
  movq   (%rdx),%xmm1
  add    $0x8,%rax
  add    $0x8,%rdx
  movdqa %xmm1,%xmm0
  pand   %xmm4,%xmm1
  pslld  $0x1,%xmm0
  pand   %xmm5,%xmm0
  por    %xmm1,%xmm0
  movq   %xmm0,-0x8(%rax)
  cmp    %r13,%rax
  jne    L466
  jmp    L200
L4:
  xor    %eax,%eax
  jmp    L217
L422:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D116
type_infered: byte[16]
name: parse_data
arguments: label: D3
type_infered: byte[16]
name: parse_data
arguments: label: D64
type_infered: byte[16]
name: parse_data
arguments: label: D145
type_infered: byte[16]

tool: {"D116": [0xc0,0xff,0xc0,0xff,0xc0,0xff,0xc0,0xff,0xc0,0xff,0xc0,0xff,0xc0,0xff,0xc0,0xff]}

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

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

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

assistant: ```c
int RGB555toRGB565(unsigned char *dest_ptr, int dest_width, int dest_height, int dest_pitch, int dest_x, int dest_y, int dest_dx, int dest_dy, unsigned char *src_ptr, int src_width, int src_height, int src_pitch, int src_x, int src_y, int src_dx, int src_dy) {
  int scale_x, scale_y;
  if (!chk_args(dest_ptr, dest_width, dest_height, dest_pitch, dest_x, dest_y, dest_dx, dest_dy, src_ptr, src_width, src_height, src_pitch, src_x, src_y, src_dx, src_dy, &scale_x, &scale_y))
    return -1;
  if (src_pitch < 0)
    src_ptr -= (src_height - 1) * src_pitch;
  if (dest_pitch < 0)
    dest_ptr -= (dest_height - 1) * dest_pitch;
  if (scale_x == 1 && scale_y == 1) {
    unsigned char *s, *d;
    register int i;
    s = src_ptr + src_x * 2 + src_y * src_pitch;
    d = dest_ptr + dest_x * 2 + dest_y * dest_pitch;
    for (i = 0; i < dest_dy; i++) {
      register int sx = src_x, ddx = dest_dx;
      while ((sx & 3) && ddx) {
        register unsigned short c = *(unsigned short *)s;
        *(unsigned short *)d = (c & 0x1F) | ((c & 0x7FE0) << 1);
        d += 2;
        s += 2;
        sx++;
        ddx--;
      }
      while (ddx >= 4) {
        register unsigned int a, b;
        a = *(unsigned int *)s;
        b = *(unsigned int *)(s + 4);
        *(unsigned int *)d = (a & 0x1F001F) | ((a & 0x7FE07FE0) << 1);
        *(unsigned int *)(d + 4) = (b & 0x1F001F) | ((b & 0x7FE07FE0) << 1);
        d += 2 * 4;
        s += 2 * 4;
        ddx -= 4;
      }
      while (ddx) {
        register unsigned short c = *(unsigned short *)s;
        *(unsigned short *)d = (c & 0x1F) | ((c & 0x7FE0) << 1);
        d += 2;
        s += 2;
        ddx--;
      }
      s += src_pitch - dest_dx * 2;
      d += dest_pitch - dest_dx * 2;
    }
    return 0;
  }
  if (scale_x == 2 && scale_y == 2) {
    unsigned char *s, *d;
    register int i;
    s = src_ptr + src_x * 2 + src_y * src_pitch;
    d = dest_ptr + dest_x * 2 + dest_y * dest_pitch;
    for (i = 0; i < src_dy; i++) {
      register int sx = src_x, sdx = src_dx;
      while ((sx & 3) && sdx) {
        register unsigned short a, b;
        a = *(unsigned short *)s;
        b = (a & 0x1F) | ((a & 0x7FE0) << 1);
        *(unsigned short *)d = b;
        *(unsigned short *)(d + 2) = b;
        d += 2 * 2;
        s += 2;
        sx++;
        sdx--;
      }
      while (sdx >= 4) {
        register unsigned int a, b;
        a = *(unsigned int *)s;
        b = (a & 0x1F001F) | ((a & 0x7FE07FE0) << 1);
        *(unsigned int *)d = (b & 0xFFFF) | (b << 16);
        *(unsigned int *)(d + 2 * 2) = (b & 0xFFFF0000) | (b >> 16);
        a = *(unsigned int *)(s + 2 * 2);
        b = (a & 0x1F001F) | ((a & 0x7FE07FE0) << 1);
        *(unsigned int *)(d + 2 * 2 * 2) = (b & 0xFFFF) | (b << 16);
        *(unsigned int *)(d + 3 * 2 * 2) = (b & 0xFFFF0000) | (b >> 16);
        d += 2 * 4 * 2;
        s += 4 * 2;
        sdx -= 4;
      }
      while (sdx) {
        register unsigned short a, b;
        a = *(unsigned short *)s;
        b = (a & 0x1F) | ((a & 0x7FE0) << 1);
        *(unsigned short *)d = b;
        *(unsigned short *)(d + 2) = b;
        d += 2 * 2;
        s += 2;
        sdx--;
      }
      s -= src_dx * 2;
      d -= src_dx * 2 * 2;
      memcpy(d + dest_pitch, d, src_dx * 2 * 2);
      s += src_pitch;
      d += dest_pitch * 2;
    }
    return 0;
  }
  return -1;
}
```