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

```asm
<imReduceHalfBox4Normal>:
  endbr64
  push   %r14
  movslq %edx,%r14
  add    %ecx,%edx
  pxor   %xmm0,%xmm0
  push   %r13
  movslq %ecx,%r13
  pxor   %xmm2,%xmm2
  push   %r12
  movslq %edx,%r12
  sub    $0x20,%rsp
  movzbl (%rsi),%edx
  movzbl (%rsi,%r14,1),%eax
  movss  D18(%rip),%xmm1
  movss  D28(%rip),%xmm3
  add    %edx,%eax
  movzbl (%rsi,%r13,1),%edx
  add    %edx,%eax
  movzbl (%rsi,%r12,1),%edx
  add    %edx,%eax
  movzbl 0x1(%rsi),%edx
  cvtsi2ss %eax,%xmm0
  movzbl 0x1(%rsi,%r14,1),%eax
  add    %edx,%eax
  movzbl 0x1(%rsi,%r13,1),%edx
  mulss  %xmm1,%xmm0
  add    %edx,%eax
  movzbl 0x1(%rsi,%r12,1),%edx
  add    %edx,%eax
  movzbl 0x2(%rsi),%edx
  cvtsi2ss %eax,%xmm2
  movzbl 0x2(%rsi,%r14,1),%eax
  subss  %xmm3,%xmm0
  add    %edx,%eax
  movzbl 0x2(%rsi,%r13,1),%edx
  mulss  %xmm1,%xmm2
  add    %edx,%eax
  movzbl 0x2(%rsi,%r12,1),%edx
  movaps %xmm0,%xmm5
  addss  %xmm0,%xmm5
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  subss  %xmm3,%xmm2
  movaps %xmm5,%xmm4
  mulss  %xmm5,%xmm4
  mulss  %xmm0,%xmm1
  addss  %xmm2,%xmm2
  movaps %xmm2,%xmm0
  subss  %xmm3,%xmm1
  mulss  %xmm2,%xmm0
  addss  %xmm1,%xmm1
  addss  %xmm0,%xmm4
  movaps %xmm1,%xmm0
  mulss  %xmm1,%xmm0
  addss  %xmm0,%xmm4
  pxor   %xmm0,%xmm0
  ucomiss %xmm4,%xmm0
  ja     L6
  sqrtss %xmm4,%xmm4
L1:
  movaps %xmm3,%xmm6
  divss  %xmm4,%xmm6
  movss  D11(%rip),%xmm4
  mulss  %xmm6,%xmm5
  mulss  %xmm6,%xmm2
  mulss  %xmm6,%xmm1
  movaps %xmm5,%xmm0
  addss  %xmm3,%xmm0
  addss  %xmm3,%xmm2
  addss  %xmm3,%xmm1
  mulss  %xmm4,%xmm0
  mulss  %xmm4,%xmm2
  mulss  %xmm4,%xmm1
  addss  %xmm3,%xmm0
  addss  %xmm3,%xmm2
  addss  %xmm3,%xmm1
  cvttss2si %xmm0,%eax
  mov    %al,(%rdi)
  cvttss2si %xmm2,%eax
  mov    %al,0x1(%rdi)
  cvttss2si %xmm1,%eax
  mov    %al,0x2(%rdi)
  movzbl 0x3(%rsi,%r14,1),%eax
  movzbl 0x3(%rsi),%edx
  add    %edx,%eax
  movzbl 0x3(%rsi,%r13,1),%edx
  add    %edx,%eax
  movzbl 0x3(%rsi,%r12,1),%edx
  lea    0x2(%rax,%rdx,1),%eax
  sar    $0x2,%eax
  mov    %al,0x3(%rdi)
  add    $0x20,%rsp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L6:
  movaps %xmm4,%xmm0
  mov    %rsi,0x18(%rsp)
  mov    %rdi,0x10(%rsp)
  movss  %xmm1,0xc(%rsp)
  movss  %xmm2,0x8(%rsp)
  movss  %xmm5,0x4(%rsp)
  call   <sqrtf@plt>
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  movss  0xc(%rsp),%xmm1
  movss  0x8(%rsp),%xmm2
  movaps %xmm0,%xmm4
  movss  D28(%rip),%xmm3
  movss  0x4(%rsp),%xmm5
  jmp    L1
```

tool_calls: name: retrieve_data
arguments: data_label: D18
datatype: byte[4]
name: retrieve_data
arguments: data_label: D28
datatype: byte[4]
name: retrieve_data
arguments: data_label: D11
datatype: byte[4]

tool: {"D18": [0x81,0x80,0x80,0x3a]}

tool: {"D28": [0x00,0x00,0x00,0x3f]}

tool: {"D11": [0x00,0x00,0x7f,0x43]}

assistant: ```c
__attribute__((always_)) void imReduceHalfBox4Normal(unsigned char *dst, unsigned char *src, int bytesperpixel, int bytesperline, float *dithersum) {
  float v0, v1, v2, suminv;
  v0 = (1.0f / 1020.0f) * (float)((int)src[0] + (int)src[bytesperpixel + 0] + (int)src[bytesperline + 0] + (int)src[bytesperpixel + bytesperline + 0]);
  v1 = (1.0f / 1020.0f) * (float)((int)src[1] + (int)src[bytesperpixel + 1] + (int)src[bytesperline + 1] + (int)src[bytesperpixel + bytesperline + 1]);
  v2 = (1.0f / 1020.0f) * (float)((int)src[2] + (int)src[bytesperpixel + 2] + (int)src[bytesperline + 2] + (int)src[bytesperpixel + bytesperline + 2]);
  v0 = 2.0f * (v0 - 0.5f);
  v1 = 2.0f * (v1 - 0.5f);
  v2 = 2.0f * (v2 - 0.5f);
  suminv = 0.5f / sqrtf((v0 * v0) + (v1 * v1) + (v2 * v2));
  v0 = 0.5f + (v0 * suminv);
  v1 = 0.5f + (v1 * suminv);
  v2 = 0.5f + (v2 * suminv);
  dst[0] = (unsigned char)((int)((255.0f * v0) + 0.5f));
  dst[1] = (unsigned char)((int)((255.0f * v1) + 0.5f));
  dst[2] = (unsigned char)((int)((255.0f * v2) + 0.5f));
  dst[3] = (unsigned char)(((int)src[3] + (int)src[bytesperpixel + 3] + (int)src[bytesperline + 3] + (int)src[bytesperpixel + bytesperline + 3] + 2) >> 2);
  return;
}
```