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

```asm
<cluster_detections>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x4000(%rsp),%r11
L21:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L21
  sub    $0x70,%rsp
  mov    %rdi,-0x4048(%rbp)
  mov    %rsi,-0x4050(%rbp)
  mov    %rdx,-0x4058(%rbp)
  mov    %rcx,-0x4060(%rbp)
  mov    %r8d,-0x4064(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x4064(%rbp),%edi
  mov    -0x4058(%rbp),%rcx
  mov    -0x4050(%rbp),%rdx
  mov    -0x4048(%rbp),%rsi
  lea    -0x4010(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <find_connected_components@plt>
  mov    %eax,-0x4014(%rbp)
  cmpl   $0x0,-0x4014(%rbp)
  jne    L0
  mov    $0x0,%eax
  jmp    L38
L0:
  movl   $0x0,-0x4034(%rbp)
  movl   $0x1,-0x4030(%rbp)
  jmp    L15
L86:
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x4024(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x4020(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x401c(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x4018(%rbp)
  movl   $0x0,-0x4028(%rbp)
  movl   $0x0,-0x402c(%rbp)
  jmp    L79
L73:
  mov    -0x402c(%rbp),%eax
  cltq
  mov    -0x4010(%rbp,%rax,4),%eax
  cmp    %eax,-0x4030(%rbp)
  jne    L74
  mov    -0x402c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4060(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  movss  -0x4024(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x4024(%rbp)
  mov    -0x402c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4048(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  movss  -0x4020(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x4020(%rbp)
  mov    -0x402c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4050(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  movss  -0x401c(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x401c(%rbp)
  mov    -0x402c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4058(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  movss  -0x4018(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x4018(%rbp)
  addl   $0x1,-0x4028(%rbp)
L74:
  addl   $0x1,-0x402c(%rbp)
L79:
  mov    -0x402c(%rbp),%eax
  cmp    -0x4064(%rbp),%eax
  jl     L73
  mov    -0x4034(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4060(%rbp),%rax
  add    %rdx,%rax
  movss  -0x4024(%rbp),%xmm0
  movss  %xmm0,(%rax)
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x4028(%rbp),%xmm1
  mov    -0x4034(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4048(%rbp),%rax
  add    %rdx,%rax
  movss  -0x4020(%rbp),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x4028(%rbp),%xmm1
  mov    -0x4034(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4050(%rbp),%rax
  add    %rdx,%rax
  movss  -0x401c(%rbp),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x4028(%rbp),%xmm1
  mov    -0x4034(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x4058(%rbp),%rax
  add    %rdx,%rax
  movss  -0x4018(%rbp),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x4034(%rbp)
  addl   $0x1,-0x4030(%rbp)
L15:
  mov    -0x4030(%rbp),%eax
  cmp    -0x4014(%rbp),%eax
  jle    L86
  mov    -0x4034(%rbp),%eax
L38:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L31
  call   <__stack_chk_fail@plt>
L31:
  leave
  ret
```

assistant: ```c
int cluster_detections(float rs[], float cs[], float ss[], float qs[], int n) {
  int idx, ncc, cc;
  int a[4096];
  ncc = find_connected_components(a, rs, cs, ss, n);
  if (!ncc)
    return 0;
  idx = 0;
  for (cc = 1; cc <= ncc; ++cc) {
    int i, k;
    float sumqs = 0.0f, sumrs = 0.0f, sumcs = 0.0f, sumss = 0.0f;
    k = 0;
    for (i = 0; i < n; ++i)
      if (a[i] == cc) {
        sumqs += qs[i];
        sumrs += rs[i];
        sumcs += cs[i];
        sumss += ss[i];
        ++k;
      }
    qs[idx] = sumqs;
    rs[idx] = sumrs / k;
    cs[idx] = sumcs / k;
    ss[idx] = sumss / k;
    ++idx;
  }
  return idx;
}
```