user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<RGB24toRGB24>:
  endbr64
  push   %r15
  push   %r14
  movslq %ecx,%r14
  push   %r13
  mov    %r14d,%ecx
  push   %r12
  mov    %r9d,%r12d
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x34(%rsp),%rax
  mov    0x90(%rsp),%r13
  movslq 0xa8(%rsp),%r15
  mov    0xb0(%rsp),%ebp
  mov    0xc0(%rsp),%ebx
  push   %rax
  lea    0x38(%rsp),%rax
  push   %rax
  mov    0xd8(%rsp),%eax
  push   %rax
  push   %rbx
  mov    0xd8(%rsp),%eax
  push   %rax
  push   %rbp
  push   %r15
  mov    0xd8(%rsp),%eax
  push   %rax
  mov    0xd8(%rsp),%eax
  push   %rax
  push   %r13
  mov    0xd8(%rsp),%eax
  push   %rax
  mov    0xd8(%rsp),%eax
  push   %rax
  mov    %r8d,0x70(%rsp)
  mov    %edx,0x68(%rsp)
  mov    %rdi,0x60(%rsp)
  call   <chk_args@plt>
  add    $0x60,%rsp
  test   %eax,%eax
  je     L200
  test   %r15d,%r15d
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%edx
  mov    0x10(%rsp),%r8d
  jns    L12
  mov    0xa0(%rsp),%eax
  sub    $0x1,%eax
  imul   %r15d,%eax
  cltq
  sub    %rax,%r13
L12:
  test   %r14d,%r14d
  jns    L204
  sub    $0x1,%edx
  imul   %r14d,%edx
  movslq %edx,%rax
  sub    %rax,%rdi
L204:
  mov    0x30(%rsp),%eax
  cmp    $0x1,%eax
  je     L76
  cmp    $0x2,%eax
  jne    L200
  cmpl   $0x2,0x34(%rsp)
  jne    L200
  imul   %r14d,%r12d
  lea    0x0(%rbp,%rbp,2),%eax
  mov    0xc8(%rsp),%ecx
  movslq %eax,%rdx
  mov    0xb8(%rsp),%eax
  imul   %r15d,%eax
  cltq
  add    %rdx,%rax
  lea    (%r8,%r8,2),%edx
  add    %rax,%r13
  movslq %edx,%rdx
  movslq %r12d,%rax
  add    %rax,%rdx
  lea    (%rdi,%rdx,1),%rax
  test   %ecx,%ecx
  jle    L146
  lea    (%rbx,%rbx,2),%edx
  lea    (%rdx,%rdx,1),%r12d
  movslq %edx,%rdx
  sub    %rdx,%r15
  lea    (%r14,%r14,1),%edx
  movslq %r12d,%rcx
  movslq %edx,%rdi
  neg    %rcx
  mov    %r15,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  movslq %r14d,%rdi
  xor    %r14d,%r14d
  mov    %rdi,0x18(%rsp)
  mov    %ebp,%edi
  and    $0x3,%edi
  mov    %rcx,(%rsp)
  mov    %edi,0x24(%rsp)
  lea    0x1(%rbx),%edi
  mov    %edi,0x28(%rsp)
  nopl   0x0(%rax,%rax,1)
L208:
  mov    0x24(%rsp),%edx
  test   %edx,%edx
  je     L35
  mov    0x28(%rsp),%edi
  mov    %ebx,%esi
  lea    (%rdi,%rbp,1),%ecx
  test   %ebx,%ebx
  jne    L157
  jmp    L72
  cs nopw 0x0(%rax,%rax,1)
L181:
  test   %esi,%esi
  je     L72
L157:
  movzbl 0x0(%r13),%edx
  add    $0x6,%rax
  add    $0x3,%r13
  mov    %dl,-0x6(%rax)
  mov    %dl,-0x3(%rax)
  movzbl -0x2(%r13),%edx
  mov    %dl,-0x5(%rax)
  mov    %dl,-0x2(%rax)
  movzbl -0x1(%r13),%edx
  mov    %dl,-0x4(%rax)
  mov    %dl,-0x1(%rax)
  mov    %ecx,%edx
  sub    %esi,%edx
  sub    $0x1,%esi
  and    $0x3,%edx
  jne    L181
L94:
  mov    %rax,%r8
  mov    %r13,%rdx
  cmp    $0x3,%esi
  jle    L223
  sub    $0x4,%esi
  mov    %r13,%rdi
  mov    %esi,%r10d
  mov    %esi,0x2c(%rsp)
  shr    $0x2,%r10d
  lea    0x1(%r10),%r9d
  lea    (%r9,%r9,2),%rdx
  lea    (%rax,%rdx,8),%r8
  nopl   0x0(%rax)
L164:
  mov    (%rdi),%ecx
  mov    0x4(%rdi),%edx
  add    $0x18,%rax
  add    $0xc,%rdi
  mov    %ecx,%r11d
  mov    %ecx,%r15d
  movzbl %dh,%esi
  shl    $0x18,%r15d
  and    $0xffffff,%r11d
  or     %r15d,%r11d
  mov    %edx,%r15d
  mov    %r11d,-0x18(%rax)
  mov    %ecx,%r11d
  shl    $0x18,%r15d
  shr    $0x8,%r11d
  shr    $0x10,%ecx
  or     %r15d,%r11d
  and    $0xff00,%ecx
  mov    %edx,%r15d
  mov    %r11d,-0x14(%rax)
  mov    %esi,%r11d
  shl    $0x8,%r15d
  or     %ecx,%r11d
  mov    %edx,%ecx
  and    $0xff000000,%r15d
  shl    $0x10,%ecx
  or     %ecx,%r11d
  mov    %r11d,-0x10(%rax)
  mov    -0x4(%rdi),%ecx
  mov    %ecx,%r11d
  shl    $0x10,%r11d
  and    $0xff0000,%r11d
  or     %r15d,%r11d
  mov    %edx,%r15d
  shr    $0x18,%edx
  shr    $0x10,%r15d
  or     %r15d,%r11d
  mov    %r11d,-0xc(%rax)
  mov    %ecx,%r11d
  shl    $0x8,%r11d
  or     %r11d,%edx
  mov    %edx,-0x8(%rax)
  mov    %ecx,%edx
  xor    %cl,%cl
  shr    $0x18,%edx
  or     %ecx,%edx
  mov    %edx,-0x4(%rax)
  cmp    %r8,%rax
  jne    L164
  mov    0x2c(%rsp),%esi
  lea    (%r9,%r9,2),%rax
  neg    %r10d
  lea    0x0(%r13,%rax,4),%rdx
  lea    (%rsi,%r10,4),%esi
L223:
  test   %esi,%esi
  je     L151
  lea    (%rsi,%rsi,2),%r13
  mov    %r8,%rax
  add    %rdx,%r13
L84:
  movzbl (%rdx),%ecx
  add    $0x3,%rdx
  add    $0x6,%rax
  mov    %cl,-0x6(%rax)
  mov    %cl,-0x3(%rax)
  movzbl -0x2(%rdx),%ecx
  mov    %cl,-0x5(%rax)
  mov    %cl,-0x2(%rax)
  movzbl -0x1(%rdx),%ecx
  mov    %cl,-0x4(%rax)
  mov    %cl,-0x1(%rax)
  cmp    %r13,%rdx
  jne    L84
  lea    (%rsi,%rsi,2),%rax
  lea    (%r8,%rax,2),%rax
L72:
  mov    (%rsp),%rdi
  mov    %r12d,%edx
  add    $0x1,%r14d
  lea    (%rax,%rdi,1),%r15
  mov    0x18(%rsp),%rax
  mov    %r15,%rsi
  lea    (%r15,%rax,1),%rdi
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  add    0x10(%rsp),%r13
  add    %r15,%rax
  cmp    %r14d,0xc8(%rsp)
  jne    L208
L146:
  xor    %eax,%eax
L126:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L134
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L35:
  mov    %ebx,%esi
  jmp    L94
L76:
  cmpl   $0x1,0x34(%rsp)
  mov    $0xffffffff,%eax
  jne    L126
  mov    0xb8(%rsp),%eax
  mov    %r12d,%edx
  lea    0x0(%rbp,%rbp,2),%ebx
  mov    0x88(%rsp),%esi
  imul   %r14d,%edx
  movslq %ebx,%rbx
  imul   %r15d,%eax
  movslq %edx,%rdx
  cltq
  add    %rax,%rbx
  lea    (%r8,%r8,2),%eax
  cltq
  add    %r13,%rbx
  add    %rdx,%rax
  lea    (%rdi,%rax,1),%rbp
  test   %esi,%esi
  jle    L146
  mov    0x80(%rsp),%eax
  xor    %r13d,%r13d
  lea    (%rax,%rax,2),%r12d
  mov    %r12d,%eax
  mov    %r13d,%r12d
  mov    %eax,%r13d
L65:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %r13d,%edx
  add    %r15,%rbx
  call   <memcpy@plt>
  add    %r14,%rbp
  add    $0x1,%r12d
  cmp    %r12d,0x88(%rsp)
  jne    L65
  jmp    L146
L200:
  mov    $0xffffffff,%eax
  jmp    L126
L151:
  mov    %r8,%rax
  mov    %rdx,%r13
  jmp    L72
L134:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int RGB24toRGB24(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 * 3 + src_y * src_pitch;
    d = dest_ptr + dest_x * 3 + dest_y * dest_pitch;
    for (i = 0; i < dest_dy; i++) {
      memcpy(d, s, dest_dx * 3);
      s += src_pitch;
      d += dest_pitch;
    }
    return 0;
  }
  if (scale_x == 2 && scale_y == 2) {
    unsigned char *s, *d;
    register int i;
    s = src_ptr + src_x * 3 + src_y * src_pitch;
    d = dest_ptr + dest_x * 3 + 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 char a;
        a = *s;
        *d = a;
        *(d + 3) = a;
        a = *(s + 1);
        *(d + 1) = a;
        *(d + 1 + 3) = a;
        a = *(s + 2);
        *(d + 2) = a;
        *(d + 2 + 3) = a;
        d += 2 * 3;
        s += 3;
        sx++;
        sdx--;
      }
      while (sdx >= 4) {
        register unsigned int a, b;
        a = *(unsigned int *)s;
        b = *(unsigned int *)(s + 4);
        *(unsigned int *)(d) = (a & 0x00FFFFFF) | (a << 24);
        *(unsigned int *)(d + 4) = (a >> 8) | (b << 24);
        *(unsigned int *)(d + 2 * 4) = ((b & 0xFF00) >> 8) | ((a & 0xFF000000) >> 16) | (b << 16);
        a = *(unsigned int *)(s + 8);
        *(unsigned int *)(d + 3 * 4) = (b >> 16) | ((a & 0xFF) << 16) | ((b & 0xFF0000) << 8);
        *(unsigned int *)(d + 4 * 4) = (b >> 24) | (a << 8);
        *(unsigned int *)(d + 5 * 4) = (a >> 24) | (a & 0xFFFFFF00);
        d += 4 * 2 * 3;
        s += 4 * 3;
        sdx -= 4;
      }
      while (sdx) {
        register unsigned char a;
        a = *s;
        *d = a;
        *(d + 3) = a;
        a = *(s + 1);
        *(d + 1) = a;
        *(d + 1 + 3) = a;
        a = *(s + 2);
        *(d + 2) = a;
        *(d + 2 + 3) = a;
        d += 2 * 3;
        s += 3;
        sdx--;
      }
      s -= src_dx * 3;
      d -= src_dx * 2 * 3;
      memcpy(d + dest_pitch, d, src_dx * 2 * 3);
      s += src_pitch;
      d += dest_pitch * 2;
    }
    return 0;
  }
  return -1;
}
```