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

```asm
<pixel_avg_weight_wxh>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    $0x40,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%r12d
  mov    %r9d,0xc(%rsp)
  sub    %r12d,%ebp
  test   %r9d,%r9d
  jle    L28
  movslq %esi,%rax
  movslq %ecx,%rcx
  mov    %rdi,%r15
  mov    %rdx,%rbx
  shl    $0x2,%rax
  mov    %r8d,%r14d
  xor    %r13d,%r13d
  mov    %rax,0x10(%rsp)
  lea    0x0(,%rcx,4),%rax
  mov    %rax,0x18(%rsp)
  nopl   (%rax)
L30:
  mov    (%r15),%edx
  mov    (%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x4(%r15),%edx
  mov    %eax,(%r15)
  mov    0x4(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    %eax,0x4(%r15)
  cmp    $0x2,%r14d
  je     L15
  mov    0x8(%r15),%edx
  mov    0x8(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0xc(%r15),%edx
  mov    %eax,0x8(%r15)
  mov    0xc(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    %eax,0xc(%r15)
  cmp    $0x4,%r14d
  je     L15
  mov    0x10(%r15),%edx
  mov    0x10(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x14(%r15),%edx
  mov    %eax,0x10(%r15)
  mov    0x14(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x18(%r15),%edx
  mov    %eax,0x14(%r15)
  mov    0x18(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x1c(%r15),%edx
  mov    %eax,0x18(%r15)
  mov    0x1c(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    %eax,0x1c(%r15)
  cmp    $0x8,%r14d
  je     L15
  mov    0x20(%r15),%edx
  mov    0x20(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x24(%r15),%edx
  mov    %eax,0x20(%r15)
  mov    0x24(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x28(%r15),%edx
  mov    %eax,0x24(%r15)
  mov    0x28(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x2c(%r15),%edx
  mov    %eax,0x28(%r15)
  mov    0x2c(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x30(%r15),%edx
  mov    %eax,0x2c(%r15)
  mov    0x30(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x34(%r15),%edx
  mov    %eax,0x30(%r15)
  mov    0x34(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x38(%r15),%edx
  mov    %eax,0x34(%r15)
  mov    0x38(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    0x3c(%r15),%edx
  mov    %eax,0x38(%r15)
  mov    0x3c(%rbx),%eax
  imul   %r12d,%edx
  imul   %ebp,%eax
  lea    0x20(%rdx,%rax,1),%edi
  sar    $0x6,%edi
  call   <p264_clip_uint8@plt>
  mov    %eax,0x3c(%r15)
L15:
  add    $0x1,%r13d
  add    0x10(%rsp),%r15
  add    0x18(%rsp),%rbx
  cmp    %r13d,0xc(%rsp)
  jne    L30
L28:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void pixel_avg_weight_wxh(uint8_t *dst, int i_dst, uint8_t *src, int i_src, int width, int height, int i_weight1) {
  int y;
  const int i_weight2 = 64 - i_weight1;
  for (y = 0; y < height; y++, dst += i_dst, src += i_src) {
    dst[0] = p264_clip_uint8((dst[0] * i_weight1 + src[0] * i_weight2 + (1 << 5)) >> 6);
    dst[1] = p264_clip_uint8((dst[1] * i_weight1 + src[1] * i_weight2 + (1 << 5)) >> 6);
    if (width == 2)
      continue;
    dst[2] = p264_clip_uint8((dst[2] * i_weight1 + src[2] * i_weight2 + (1 << 5)) >> 6);
    dst[3] = p264_clip_uint8((dst[3] * i_weight1 + src[3] * i_weight2 + (1 << 5)) >> 6);
    if (width == 4)
      continue;
    dst[4] = p264_clip_uint8((dst[4] * i_weight1 + src[4] * i_weight2 + (1 << 5)) >> 6);
    dst[5] = p264_clip_uint8((dst[5] * i_weight1 + src[5] * i_weight2 + (1 << 5)) >> 6);
    dst[6] = p264_clip_uint8((dst[6] * i_weight1 + src[6] * i_weight2 + (1 << 5)) >> 6);
    dst[7] = p264_clip_uint8((dst[7] * i_weight1 + src[7] * i_weight2 + (1 << 5)) >> 6);
    if (width == 8)
      continue;
    dst[8] = p264_clip_uint8((dst[8] * i_weight1 + src[8] * i_weight2 + (1 << 5)) >> 6);
    dst[9] = p264_clip_uint8((dst[9] * i_weight1 + src[9] * i_weight2 + (1 << 5)) >> 6);
    dst[10] = p264_clip_uint8((dst[10] * i_weight1 + src[10] * i_weight2 + (1 << 5)) >> 6);
    dst[11] = p264_clip_uint8((dst[11] * i_weight1 + src[11] * i_weight2 + (1 << 5)) >> 6);
    dst[12] = p264_clip_uint8((dst[12] * i_weight1 + src[12] * i_weight2 + (1 << 5)) >> 6);
    dst[13] = p264_clip_uint8((dst[13] * i_weight1 + src[13] * i_weight2 + (1 << 5)) >> 6);
    dst[14] = p264_clip_uint8((dst[14] * i_weight1 + src[14] * i_weight2 + (1 << 5)) >> 6);
    dst[15] = p264_clip_uint8((dst[15] * i_weight1 + src[15] * i_weight2 + (1 << 5)) >> 6);
  }
}
```