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

```asm
<__imlib_RotateSample>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x18(%rsp)
  mov    %r9d,(%rsp)
  mov    0x68(%rsp),%r15d
  mov    0x78(%rsp),%r12d
  cmpl   $0x0,0x60(%rsp)
  jle    L2
  mov    %rdi,%r13
  mov    %edx,%r14d
  mov    %ecx,%ebx
  mov    %r8d,%ebp
  test   %r15d,%r15d
  jle    L2
  push   %r8
  push   %rcx
  push   %r15
  mov    0x78(%rsp),%eax
  push   %rax
  mov    0xb8(%rsp),%r9d
  mov    0xb0(%rsp),%r8d
  mov    0xa8(%rsp),%ecx
  mov    0xa0(%rsp),%edx
  mov    %r12d,%esi
  mov    0x90(%rsp),%edi
  call   <__check_inside_coords@plt>
  add    $0x20,%rsp
  test   %rax,%rax
  jne    L24
  shl    $0xc,%ebx
  shl    $0xc,%ebp
  mov    0x80(%rsp),%eax
  imul   0x60(%rsp),%eax
  mov    0x90(%rsp),%edi
  sub    %eax,%edi
  mov    %edi,0x8(%rsp)
  mov    0x88(%rsp),%eax
  imul   0x60(%rsp),%eax
  mov    0x98(%rsp),%edi
  sub    %eax,%edi
  mov    %edi,0xc(%rsp)
  mov    (%rsp),%eax
  sub    0x60(%rsp),%eax
  cltq
  mov    0x60(%rsp),%edi
  lea    -0x1(%rdi),%edx
  test   %edi,%edi
  mov    $0x0,%ecx
  cmovle %ecx,%edx
  mov    %edx,%r11d
  imul   0x80(%rsp),%r11d
  imul   0x88(%rsp),%edx
  mov    %edx,%r10d
  mov    %edi,%edx
  shl    $0x2,%rdx
  test   %edi,%edi
  mov    $0x4,%ecx
  cmovle %rcx,%rdx
  mov    $0x0,%r9d
  lea    (%rdx,%rax,4),%rax
  mov    %rax,0x10(%rsp)
  mov    %r11d,(%rsp)
  mov    %r10d,0x4(%rsp)
  mov    0x18(%rsp),%r11
  mov    0x70(%rsp),%r10d
  jmp    L53
L24:
  mov    0x98(%rsp),%eax
  push   %rax
  mov    0x98(%rsp),%eax
  push   %rax
  mov    0x98(%rsp),%eax
  push   %rax
  mov    0x98(%rsp),%eax
  push   %rax
  push   %r12
  mov    0x98(%rsp),%eax
  push   %rax
  mov    %r15d,%r9d
  mov    0x90(%rsp),%r8d
  mov    0x30(%rsp),%ecx
  mov    %r14d,%edx
  mov    0x48(%rsp),%rsi
  mov    %r13,%rdi
  call   <__imlib_RotateSampleInside@plt>
  add    $0x30,%rsp
L2:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    %ecx,%eax
  sar    $0xc,%eax
  imul   %r14d,%eax
  mov    %edx,%r8d
  sar    $0xc,%r8d
  add    %r8d,%eax
  cltq
  mov    0x0(%r13,%rax,4),%eax
L77:
  mov    %eax,(%rsi)
  add    0x80(%rsp),%edx
  add    0x88(%rsp),%ecx
  add    $0x4,%rsi
  sub    $0x1,%edi
  js     L37
L59:
  cmp    %edx,%ebx
  jbe    L28
  cmp    %ecx,%ebp
  ja     L88
L28:
  mov    %r9d,%eax
  jmp    L77
L37:
  add    0x80(%rsp),%r10d
  add    (%rsp),%r10d
  add    0x88(%rsp),%r12d
  add    0x4(%rsp),%r12d
  sub    $0x1,%r15d
  test   %r15d,%r15d
  jle    L2
  add    0x8(%rsp),%r10d
  add    0xc(%rsp),%r12d
  add    0x10(%rsp),%r11
L53:
  mov    0x60(%rsp),%eax
  lea    -0x1(%rax),%edi
  mov    %r12d,%ecx
  mov    %r10d,%edx
  mov    %r11,%rsi
  jmp    L59
```

assistant: ```c
void __imlib_RotateSample(unsigned int *src, unsigned int *dest, int sow, int sw, int sh, int dow, int dw, int dh, int x, int y, int dxh, int dyh, int dxv, int dyv) {
  int i;
  if ((dw < 1) || (dh < 1))
    return;
  if (__check_inside_coords(x, y, dxh, dyh, dxv, dyv, dw, dh, sw, sh)) {
    __imlib_RotateSampleInside(src, dest, sow, dow, dw, dh, x, y, dxh, dyh, dxv, dyv);
    return;
  }
  sw <<= 12;
  sh <<= 12;
  while (1) {
    i = dw - 1;
    do {
      if (((unsigned)x < sw) && ((unsigned)y < sh))
        *dest = src[(x >> 12) + ((y >> 12) * sow)];
      else
        *dest = 0;
      x += dxh;
      y += dyh;
      dest++;
    } while (--i >= 0);
    if (--dh <= 0)
      break;
    x += dxv - dw * dxh;
    y += dyv - dw * dyh;
    dest += (dow - dw);
  }
}
```