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

```asm
<copyImage16To32>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %ecx,-0x68(%rbp)
  mov    %r8d,-0x6c(%rbp)
  mov    %r9d,-0x70(%rbp)
  mov    -0x64(%rbp),%eax
  shl    $0x4,%eax
  add    $0x1f,%eax
  sar    $0x5,%eax
  shl    $0x2,%eax
  cltq
  mov    %rax,-0x30(%rbp)
  mov    -0x70(%rbp),%eax
  cltq
  imul   -0x30(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x6c(%rbp),%eax
  shl    $0x4,%eax
  sar    $0x5,%eax
  shl    $0x2,%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x70(%rbp),%eax
  cltq
  imul   -0x30(%rbp),%rax
  mov    %rax,%rdx
  mov    0x10(%rbp),%eax
  shl    $0x4,%eax
  add    $0x1f,%eax
  sar    $0x5,%eax
  shl    $0x2,%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x64(%rbp),%eax
  shl    $0x5,%eax
  add    $0x1f,%eax
  sar    $0x5,%eax
  shl    $0x2,%eax
  cltq
  mov    %rax,-0x28(%rbp)
  movq   $0x0,-0x38(%rbp)
  mov    -0x70(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
  jmp    L9
L26:
  mov    -0x58(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%r12
  mov    -0x58(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%r14
  mov    -0x60(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%r13
  jmp    L34
L20:
  lea    0x2(%r12),%rax
  movzwl (%rax),%eax
  movzwl %ax,%ebx
  mov    %ebx,%eax
  shr    $0xa,%eax
  shl    $0x3,%eax
  movzbl %al,%edx
  mov    %ebx,%eax
  shr    $0x5,%eax
  shl    $0xb,%eax
  movzwl %ax,%eax
  or     %eax,%edx
  mov    %ebx,%eax
  shl    $0x13,%eax
  and    $0xf80000,%eax
  or     %edx,%eax
  mov    %eax,0x0(%r13)
  movzwl (%r12),%eax
  movzwl %ax,%ebx
  mov    %ebx,%eax
  shr    $0xa,%eax
  shl    $0x3,%eax
  movzbl %al,%edx
  mov    %ebx,%eax
  shr    $0x5,%eax
  shl    $0xb,%eax
  movzwl %ax,%eax
  mov    %edx,%ecx
  or     %eax,%ecx
  mov    %ebx,%eax
  shl    $0x13,%eax
  and    $0xf80000,%eax
  mov    %eax,%edx
  lea    0x4(%r13),%rax
  or     %ecx,%edx
  mov    %edx,(%rax)
  add    $0x4,%r12
  add    $0x8,%r13
L34:
  cmp    %r14,%r12
  jb     L20
  mov    -0x30(%rbp),%rax
  add    %rax,-0x48(%rbp)
  mov    -0x30(%rbp),%rax
  add    %rax,-0x40(%rbp)
  mov    -0x28(%rbp),%rax
  add    %rax,-0x38(%rbp)
  addl   $0x1,-0x4c(%rbp)
L9:
  mov    -0x4c(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L26
  nop
  nop
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %rbp
  ret
```

assistant: ```c
void copyImage16To32(short *fromImageData, int *toImageData, int width, int height, int affectedL, int affectedT, int affectedR, int affectedB) {
  long scanLine16, firstWord16, lastWord16;
  long scanLine32, firstWord32;
  int line;
  register unsigned int col;
  scanLine16 = ((((width) * (16) + 31) >> 5) << 2);
  firstWord16 = scanLine16 * affectedT + ((((affectedL) * (16)) >> 5) << 2);
  lastWord16 = scanLine16 * affectedT + ((((affectedR) * (16) + 31) >> 5) << 2);
  scanLine32 = ((((width) * (32) + 31) >> 5) << 2);
  firstWord32 = 0;
  for (line = affectedT; line < affectedB; line++) {
    register unsigned short *from = (unsigned short *)((long)fromImageData + firstWord16);
    register unsigned short *limit = (unsigned short *)((long)fromImageData + lastWord16);
    register unsigned int *to = (unsigned int *)((long)toImageData + firstWord32);
    while (from < limit) {
      to[0] = (col = (from[1]), (((col >> 10) & 0x1f) << 3) | (((col >> 5) & 0x1f) << 11) | ((col & 0x1f) << 19));
      to[1] = (col = (from[0]), (((col >> 10) & 0x1f) << 3) | (((col >> 5) & 0x1f) << 11) | ((col & 0x1f) << 19));
      from += 2;
      to += 2;
    }
    firstWord16 += scanLine16;
    lastWord16 += scanLine16;
    firstWord32 += scanLine32;
  }
}
```