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

```asm
<convolve>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %rsi,0x38(%rsp)
  mov    %rdx,0x40(%rsp)
  mov    %rcx,0x48(%rsp)
  mov    %r8,0x20(%rsp)
  test   %rcx,%rcx
  jle    L59
  test   %r8,%r8
  jle    L59
  lea    0x0(,%rcx,8),%rax
  mov    %r9,%rbx
  movq   $0x0,0x10(%rsp)
  mov    %rax,0x18(%rsp)
  movq   $0x0,0x30(%rsp)
  nop
L19:
  mov    0x38(%rsp),%rax
  mov    0x30(%rsp),%rdi
  xor    %r12d,%r12d
  xor    %ebp,%ebp
  lea    (%rax,%rdi,8),%r13
  nopl   0x0(%rax,%rax,1)
L40:
  lea    0x0(,%rbp,8),%rax
  mov    0x10(%rsp),%rdx
  lea    0x2(%rbp),%rcx
  add    (%rbx,%rbp,8),%rdx
  mov    0x8(%rbx,%rax,1),%r15
  test   %r15,%r15
  jle    L62
  mov    0x28(%rsp),%rdi
  lea    (%r15,%rcx,1),%r14
  xor    %r8d,%r8d
  xor    %r9d,%r9d
  xor    %r10d,%r10d
  lea    (%rdi,%rdx,8),%r11
  xor    %edi,%edi
  sub    %rax,%r11
  cs nopw 0x0(%rax,%rax,1)
L30:
  add    $0x1,%rcx
  mov    -0x8(%rbx,%rcx,8),%rax
  mov    -0x18(%r11,%rcx,8),%rdx
  mov    %eax,%esi
  imul   %edx,%esi
  add    %esi,%r10d
  mov    %rdx,%rsi
  sar    $0x8,%rsi
  imul   %eax,%esi
  add    %esi,%r9d
  mov    %rdx,%rsi
  sar    $0x18,%rdx
  sar    $0x10,%rsi
  imul   %eax,%esi
  imul   %edx,%eax
  add    %esi,%r8d
  add    %eax,%edi
  cmp    %r14,%rcx
  jne    L30
  lea    0x2000(%r9),%r14d
  add    $0x2000,%r10d
  lea    0x2(%r15,%rbp,1),%rbp
  add    $0x2000,%r8d
  lea    0x2000(%rdi),%r9d
  sar    $0xe,%r10d
  sar    $0xe,%r14d
  sar    $0xe,%r8d
  sar    $0xe,%r9d
L58:
  mov    %r10d,%edi
  mov    %r9d,0xc(%rsp)
  add    $0x1,%r12
  mov    %r8d,0x8(%rsp)
  call   <clampTo8@plt>
  mov    %r14d,%edi
  mov    %eax,%r15d
  call   <clampTo8@plt>
  mov    0x8(%rsp),%edi
  mov    %eax,%r14d
  call   <clampTo8@plt>
  mov    0xc(%rsp),%edi
  shl    $0x8,%r14d
  shl    $0x10,%eax
  or     %eax,%r14d
  call   <clampTo8@plt>
  or     %r15d,%r14d
  shl    $0x18,%eax
  or     %r14d,%eax
  cltq
  mov    %rax,0x0(%r13)
  add    0x18(%rsp),%r13
  cmp    %r12,0x20(%rsp)
  jne    L40
  addq   $0x1,0x30(%rsp)
  mov    0x40(%rsp),%rcx
  mov    0x30(%rsp),%rax
  add    %rcx,0x10(%rsp)
  cmp    %rax,0x48(%rsp)
  jne    L19
L59:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L62:
  mov    %rcx,%rbp
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  xor    %r14d,%r14d
  xor    %r10d,%r10d
  jmp    L58
```

assistant: ```c
void convolve(uint32_t *src, uint32_t *dest, uint32_t srcW, uint32_t srcH, uint32_t destW, int16_t *filters) {
  int32_t r, g, b, a;
  uint32_t rgba;
  uint32_t filterPtr, filterShift, filterSize;
  uint32_t srcPtr, srcY, destX;
  int32_t filterVal;
  uint32_t srcOffset = 0, destOffset = 0;
  for (srcY = 0; srcY < srcH; srcY++) {
    filterPtr = 0;
    for (destX = 0; destX < destW; destX++) {
      filterShift = filters[filterPtr++];
      srcPtr = srcOffset + filterShift;
      filterSize = filters[filterPtr++];
      r = g = b = a = 0;
      for (; filterSize > 0; filterSize--) {
        filterVal = filters[filterPtr++];
        rgba = src[srcPtr++];
        r += filterVal * ((uint8_t)(rgba));
        g += filterVal * ((uint8_t)((rgba) >> 8));
        b += filterVal * ((uint8_t)((rgba) >> 16));
        a += filterVal * ((uint8_t)((rgba) >> 24));
      };
      dest[destOffset] = ((clampTo8((r + (1 << 13)) >> 14)) | ((clampTo8((g + (1 << 13)) >> 14)) << 8) | ((clampTo8((b + (1 << 13)) >> 14)) << 16) | ((clampTo8((a + (1 << 13)) >> 14)) << 24));
      destOffset += srcH;
    };
    destOffset = srcY + 1;
    srcOffset = (srcY + 1) * srcW;
  };
}
```