user: What would the C source look like for the assembly code provided here?

```asm
<RGB32toBGR32>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %r9d,%r12d
  push   %rbp
  push   %rbx
  mov    %r8d,%ebx
  sub    $0x78,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x64(%rsp),%rax
  mov    0xc0(%rsp),%r10
  movslq 0xd8(%rsp),%r14
  mov    0xf0(%rsp),%ebp
  push   %rax
  lea    0x68(%rsp),%rax
  push   %rax
  mov    0x108(%rsp),%eax
  push   %rax
  push   %rbp
  mov    0x108(%rsp),%eax
  push   %rax
  mov    0x108(%rsp),%eax
  push   %rax
  push   %r14
  mov    0x108(%rsp),%eax
  push   %rax
  mov    0x108(%rsp),%eax
  push   %rax
  push   %r10
  mov    0x108(%rsp),%eax
  mov    %r10,0x58(%rsp)
  push   %rax
  mov    0x108(%rsp),%eax
  push   %rax
  mov    %rdi,0x60(%rsp)
  call   <chk_args@plt>
  add    $0x60,%rsp
  test   %eax,%eax
  je     L51
  test   %r14d,%r14d
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%r10
  jns    L65
  mov    0xd0(%rsp),%eax
  sub    $0x1,%eax
  imul   %r14d,%eax
  cltq
  sub    %rax,%r10
L65:
  test   %r13d,%r13d
  jns    L199
  lea    -0x1(%r15),%edx
  imul   %r13d,%edx
  movslq %edx,%rax
  sub    %rax,%rdi
L199:
  mov    0x60(%rsp),%eax
  cmp    $0x1,%eax
  je     L313
  cmp    $0x2,%eax
  jne    L51
  cmpl   $0x2,0x64(%rsp)
  jne    L51
  mov    0xe8(%rsp),%r15d
  mov    0xe0(%rsp),%eax
  imul   %r13d,%r12d
  imul   %r14d,%r15d
  shl    $0x2,%eax
  cltq
  movslq %r15d,%rdx
  lea    (%rax,%rdx,1),%r15
  lea    0x0(,%rbx,4),%eax
  movslq %r12d,%rdx
  cltq
  add    %r10,%r15
  add    %rdx,%rax
  mov    0xf8(%rsp),%edx
  add    %rdi,%rax
  test   %edx,%edx
  jle    L317
  lea    0x0(,%rbp,8),%r12d
  lea    -0x1(%rbp),%edi
  movdqa D44(%rip),%xmm5
  movdqa D39(%rip),%xmm4
  movslq %r12d,%rdx
  mov    %edi,0x40(%rsp)
  movdqa D102(%rip),%xmm3
  neg    %rdx
  mov    %rdx,(%rsp)
  lea    0x0(,%rbp,4),%edx
  movslq %edx,%rdx
  sub    %rdx,%r14
  mov    %ebp,%edx
  mov    %r14,0x10(%rsp)
  lea    0x0(%r13,%r13,1),%r14d
  movslq %r14d,%rbx
  xor    %r14d,%r14d
  mov    %rbx,0x8(%rsp)
  movslq %r13d,%rbx
  mov    %r14d,%r13d
  mov    %rbx,0x18(%rsp)
  lea    0x0(,%rdx,4),%rbx
  mov    %rbx,0x30(%rsp)
  lea    0x0(,%rdx,8),%rbx
  mov    %ebp,%edx
  mov    %rbx,0x38(%rsp)
  mov    %ebp,%ebx
  shr    $0x2,%edx
  and    $0xfffffffc,%ebx
  lea    -0x1(%rdx),%ecx
  mov    %ebx,%edx
  mov    %ebx,0x44(%rsp)
  add    $0x1,%rcx
  lea    0x0(,%rdx,4),%rbx
  shl    $0x4,%rcx
  mov    %rbx,0x48(%rsp)
  lea    0x0(,%rdx,8),%rbx
  mov    %rcx,%r14
  mov    %rbx,0x50(%rsp)
  mov    %edi,%ebx
  lea    0x1(%rbx),%rdx
  mov    %rbx,0x58(%rsp)
  lea    0x0(,%rdx,8),%rbx
  mov    %rbx,0x28(%rsp)
  lea    0x0(,%rdx,4),%rbx
  mov    %rbx,0x20(%rsp)
  mov    %ebp,%ebx
  xchg   %ax,%ax
L75:
  test   %ebx,%ebx
  je     L41
  mov    0x30(%rsp),%rcx
  lea    (%r15,%rcx,1),%rdx
  mov    0x38(%rsp),%rcx
  cmp    %rdx,%rax
  lea    (%rax,%rcx,1),%rsi
  setae  %dl
  cmp    %rsi,%r15
  setae  %sil
  or     %sil,%dl
  je     L311
  cmp    $0x1,%ebx
  je     L311
  cmpl   $0x2,0x40(%rsp)
  jbe    L305
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L136:
  movdqu (%r15,%rdx,1),%xmm1
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pand   %xmm3,%xmm1
  pslld  $0x10,%xmm0
  psrld  $0x10,%xmm2
  pand   %xmm5,%xmm0
  pand   %xmm4,%xmm2
  por    %xmm2,%xmm0
  por    %xmm1,%xmm0
  pshufd $0x50,%xmm0,%xmm1
  pshufd $0xfa,%xmm0,%xmm0
  movups %xmm1,(%rax,%rdx,2)
  movups %xmm0,0x10(%rax,%rdx,2)
  add    $0x10,%rdx
  cmp    %r14,%rdx
  jne    L136
  mov    0x48(%rsp),%rcx
  mov    0x44(%rsp),%edi
  lea    (%r15,%rcx,1),%rsi
  mov    0x50(%rsp),%rcx
  lea    (%rax,%rcx,1),%rdx
  cmp    %edi,%ebx
  je     L291
  mov    %ebx,%r10d
  sub    %edi,%r10d
  cmp    $0x1,%r10d
  je     L38
L104:
  movq   (%r15,%rdi,4),%xmm1
  lea    (%rax,%rdi,8),%r11
  mov    %r10d,%edi
  movq   D44(%rip),%xmm6
  and    $0xfffffffe,%edi
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pslld  $0x10,%xmm0
  psrld  $0x10,%xmm2
  pand   %xmm6,%xmm0
  movq   D39(%rip),%xmm6
  pand   %xmm6,%xmm2
  por    %xmm2,%xmm0
  movq   D102(%rip),%xmm2
  pand   %xmm2,%xmm1
  por    %xmm1,%xmm0
  pshufd $0xe0,%xmm0,%xmm1
  pshufd $0xe5,%xmm0,%xmm0
  movq   %xmm1,(%r11)
  movq   %xmm0,0x8(%r11)
  mov    %edi,%r11d
  lea    (%rsi,%r11,4),%rsi
  lea    (%rdx,%r11,8),%rdx
  cmp    %edi,%r10d
  je     L291
L38:
  mov    (%rsi),%edi
  mov    %edi,%esi
  mov    %edi,%r10d
  and    $0xff00,%edi
  shl    $0x10,%esi
  shr    $0x10,%r10d
  and    $0xff0000,%esi
  movzbl %r10b,%r10d
  or     %r10d,%esi
  or     %edi,%esi
  movd   %esi,%xmm7
  pshufd $0xe0,%xmm7,%xmm0
  movq   %xmm0,(%rdx)
L291:
  add    0x28(%rsp),%rax
  add    0x20(%rsp),%r15
L41:
  mov    (%rsp),%rcx
  mov    %r12d,%edx
  add    $0x1,%r13d
  lea    (%rax,%rcx,1),%rbp
  mov    0x18(%rsp),%rax
  mov    %rbp,%rsi
  lea    0x0(%rbp,%rax,1),%rdi
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  add    0x10(%rsp),%r15
  movdqa D44(%rip),%xmm5
  movdqa D39(%rip),%xmm4
  add    %rbp,%rax
  cmp    %r13d,0xf8(%rsp)
  movdqa D102(%rip),%xmm3
  jne    L75
L317:
  xor    %eax,%eax
L55:
  mov    0x68(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L127
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L311:
  mov    0x58(%rsp),%rdi
  xor    %esi,%esi
  nopw   0x0(%rax,%rax,1)
L16:
  mov    (%r15,%rsi,4),%ecx
  mov    %ecx,%edx
  mov    %ecx,%r8d
  and    $0xff00,%ecx
  shl    $0x10,%edx
  shr    $0x10,%r8d
  and    $0xff0000,%edx
  movzbl %r8b,%r8d
  or     %r8d,%edx
  or     %ecx,%edx
  movd   %edx,%xmm6
  mov    %rsi,%rdx
  pshufd $0xe0,%xmm6,%xmm0
  movq   %xmm0,(%rax,%rsi,8)
  add    $0x1,%rsi
  cmp    %rdx,%rdi
  jne    L16
  jmp    L291
L305:
  mov    %ebx,%r10d
  mov    %rax,%rdx
  mov    %r15,%rsi
  xor    %edi,%edi
  jmp    L104
L313:
  cmpl   $0x1,0x64(%rsp)
  mov    $0xffffffff,%eax
  jne    L55
  mov    0xe8(%rsp),%edx
  mov    0xe0(%rsp),%eax
  mov    %r12d,%ecx
  imul   %r13d,%ecx
  imul   %r14d,%edx
  shl    $0x2,%eax
  cltq
  movslq %ecx,%rcx
  movslq %edx,%rdx
  add    %rdx,%rax
  lea    0x0(,%rbx,4),%edx
  movslq %edx,%rdx
  add    %r10,%rax
  add    %rcx,%rdx
  mov    0xb8(%rsp),%ecx
  add    %rdi,%rdx
  test   %ecx,%ecx
  jle    L317
  mov    0xb0(%rsp),%ebx
  mov    %r14d,%edi
  mov    %r13d,%esi
  lea    0x0(,%rbx,4),%ecx
  sub    %ecx,%edi
  sub    %ecx,%esi
  movslq %edi,%rdi
  movslq %esi,%rsi
  test   %ebx,%ebx
  je     L317
  mov    %ebx,%ecx
  mov    %ebx,%r12d
  lea    -0x1(%rbx),%r9d
  mov    %ebx,%r15d
  shr    $0x2,%ecx
  and    $0xfffffffc,%r12d
  mov    %r9d,(%rsp)
  xor    %r10d,%r10d
  lea    -0x1(%rcx),%r8d
  sub    %r12d,%r15d
  mov    %r9d,%ecx
  mov    %r12d,%ebp
  shl    $0x2,%rcx
  mov    %r15d,0x8(%rsp)
  add    $0x1,%r8
  movq   D44(%rip),%xmm8
  movdqa D44(%rip),%xmm5
  shl    $0x4,%r8
  shl    $0x2,%rbp
  movq   D39(%rip),%xmm7
  movq   D102(%rip),%xmm6
  movdqa D39(%rip),%xmm4
  lea    0x4(%rdi,%rcx,1),%r14
  lea    0x4(%rsi,%rcx,1),%r13
  movdqa D102(%rip),%xmm3
  mov    0xb0(%rsp),%r15d
L247:
  lea    0x4(%rax),%rsi
  mov    %rdx,%rcx
  sub    %rsi,%rcx
  cmp    $0x8,%rcx
  jbe    L293
  cmp    $0x1,%r15d
  je     L293
  cmpl   $0x2,(%rsp)
  jbe    L198
  xor    %ecx,%ecx
  nopl   0x0(%rax)
L220:
  movdqu (%rax,%rcx,1),%xmm1
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pand   %xmm3,%xmm1
  pslld  $0x10,%xmm0
  psrld  $0x10,%xmm2
  pand   %xmm5,%xmm0
  pand   %xmm4,%xmm2
  por    %xmm2,%xmm0
  por    %xmm1,%xmm0
  movups %xmm0,(%rdx,%rcx,1)
  add    $0x10,%rcx
  cmp    %rcx,%r8
  jne    L220
  lea    (%rax,%rbp,1),%rsi
  lea    (%rdx,%rbp,1),%rcx
  cmp    %r12d,%r15d
  je     L255
  mov    0x8(%rsp),%edi
  mov    %edi,%r11d
  cmp    $0x1,%edi
  je     L74
  mov    %r12d,%edi
L82:
  movq   (%rax,%rdi,4),%xmm1
  mov    %r11d,%r9d
  and    $0xfffffffe,%r9d
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm2
  pand   %xmm6,%xmm1
  pslld  $0x10,%xmm0
  psrld  $0x10,%xmm2
  pand   %xmm8,%xmm0
  pand   %xmm7,%xmm2
  por    %xmm2,%xmm0
  por    %xmm1,%xmm0
  movq   %xmm0,(%rdx,%rdi,4)
  mov    %r9d,%edi
  shl    $0x2,%rdi
  add    %rdi,%rsi
  add    %rdi,%rcx
  cmp    %r9d,%r11d
  je     L255
L74:
  mov    (%rsi),%edi
  mov    %edi,%r9d
  mov    %edi,%esi
  and    $0xff00,%edi
  shl    $0x10,%r9d
  shr    $0x10,%esi
  and    $0xff0000,%r9d
  movzbl %sil,%esi
  or     %r9d,%esi
  or     %edi,%esi
  mov    %esi,(%rcx)
L255:
  add    %r14,%rax
  add    %r13,%rdx
  add    $0x1,%r10d
  cmp    %r10d,0xb8(%rsp)
  jne    L247
  jmp    L317
L293:
  xor    %edi,%edi
  nopl   0x0(%rax,%rax,1)
L325:
  mov    (%rax,%rdi,4),%esi
  mov    %esi,%ecx
  mov    %esi,%r9d
  and    $0xff00,%esi
  shr    $0x10,%ecx
  shl    $0x10,%r9d
  movzbl %cl,%ecx
  and    $0xff0000,%r9d
  or     %r9d,%ecx
  or     %esi,%ecx
  mov    %ecx,(%rdx,%rdi,4)
  add    $0x1,%rdi
  cmp    %rdi,%rbx
  jne    L325
  jmp    L255
L51:
  mov    $0xffffffff,%eax
  jmp    L55
L198:
  mov    %r15d,%r11d
  mov    %rdx,%rcx
  mov    %rax,%rsi
  xor    %edi,%edi
  jmp    L82
L127:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D44
type: byte[16]
name: disassemble_data
arguments: data_tag: D39
type: byte[16]
name: disassemble_data
arguments: data_tag: D102
type: byte[16]

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

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

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

assistant: ```c
int RGB32toBGR32(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 * 4 + src_y * src_pitch;
    d = dest_ptr + dest_x * 4 + dest_y * dest_pitch;
    for (i = 0; i < dest_dy; i++) {
      register int ddx = dest_dx;
      while (ddx) {
        register unsigned int a;
        a = *(unsigned int *)s;
        *(unsigned int *)d = ((a & 0x000000ff) << 16) | ((a & 0x0000ff00) << 0) | ((a & 0x00ff0000) >> 16);
        s += 4;
        d += 4;
        ddx--;
      }
      s += src_pitch - dest_dx * 4;
      d += dest_pitch - dest_dx * 4;
    }
    return 0;
  }
  if (scale_x == 2 && scale_y == 2) {
    unsigned char *s, *d;
    register int i;
    s = src_ptr + src_x * 4 + src_y * src_pitch;
    d = dest_ptr + dest_x * 4 + dest_y * dest_pitch;
    for (i = 0; i < src_dy; i++) {
      register int sdx = src_dx;
      while (sdx) {
        register unsigned int a, c;
        a = *(unsigned int *)s;
        c = ((a & 0x000000ff) << 16) | ((a & 0x0000ff00) << 0) | ((a & 0x00ff0000) >> 16);
        *(unsigned int *)d = c;
        *(unsigned int *)(d + 4) = c;
        d += 2 * 4;
        s += 4;
        sdx--;
      }
      s -= src_dx * 4;
      d -= src_dx * 2 * 4;
      memcpy(d + dest_pitch, d, src_dx * 2 * 4);
      s += src_pitch;
      d += dest_pitch * 2;
    }
    return 0;
  }
  return -1;
}
```