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

```asm
<sum_squares>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x58,%rsp
  mov    0x90(%rsp),%rax
  mov    %rcx,0x30(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %rax,0x28(%rsp)
  mov    0x98(%rsp),%rax
  mov    %rax,0x8(%rsp)
  mov    (%rdx),%eax
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    0x0(%r13),%r13d
  mov    %rax,%r12
  test   %r13d,%r13d
  jle    L266
  movslq %r13d,%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  shl    $0x3,%rdx
  call   <memset@plt>
  mov    0x0(%rbp),%ebp
  test   %ebp,%ebp
  jle    L281
  movslq %ebp,%rsi
  mov    %r13d,%eax
  mov    %r14,0x48(%rsp)
  mov    %rbx,%r15
  lea    0x0(,%rsi,8),%rdi
  lea    -0x1(%rax),%rdx
  mov    %rsi,(%rsp)
  shl    $0x4,%rsi
  mov    %rdi,%rcx
  mov    %rsi,%r11
  lea    (%r12,%rax,8),%rax
  mov    %ebp,0x44(%rsp)
  imul   %rdx,%rcx
  lea    (%r12,%rdx,8),%rdx
  xor    %r9d,%r9d
  mov    %rdx,0x10(%rsp)
  mov    %r13d,%edx
  shr    %edx
  mov    %rcx,0x38(%rsp)
  mov    %r13d,%ecx
  lea    -0x1(%rdx),%r8d
  mov    0x38(%rsp),%r14
  and    $0xfffffffe,%ecx
  add    $0x1,%r8
  mov    %ecx,%edx
  mov    %ecx,0x40(%rsp)
  imul   %ebp,%ecx
  shl    $0x4,%r8
  lea    (%r12,%rdx,8),%rsi
  lea    -0x1(%r13),%edx
  add    %r12,%r8
  mov    %rax,%rbp
  mov    %edx,0x24(%rsp)
  mov    %ecx,%r10d
  nopl   0x0(%rax,%rax,1)
L181:
  lea    0x0(,%r9,8),%rdx
  mov    %r9d,%eax
  lea    (%r14,%rdx,1),%rcx
  add    %rbx,%rcx
  cmp    %rcx,%r12
  seta   %cl
  add    %rbx,%rdx
  cmp    %rdx,0x10(%rsp)
  setb   %dl
  or     %cl,%dl
  je     L314
  cmpl   $0x4,0x24(%rsp)
  mov    %r15,%rcx
  mov    %r12,%rdx
  jbe    L314
  nopl   0x0(%rax)
L340:
  movsd  (%rcx),%xmm0
  movupd (%rdx),%xmm5
  add    $0x10,%rdx
  movhpd (%rcx,%rdi,1),%xmm0
  add    %r11,%rcx
  addpd  %xmm5,%xmm0
  movups %xmm0,-0x10(%rdx)
  cmp    %r8,%rdx
  jne    L340
  cmp    0x40(%rsp),%r13d
  je     L343
  add    %r10d,%eax
  movsd  (%rsi),%xmm0
  cltq
  addsd  (%rbx,%rax,8),%xmm0
  movsd  %xmm0,(%rsi)
L343:
  add    $0x1,%r9
  add    $0x8,%r15
  cmp    (%rsp),%r9
  jne    L181
  mov    0x44(%rsp),%ebp
  mov    0x48(%rsp),%r14
  test   %r13d,%r13d
  jle    L208
L281:
  pxor   %xmm1,%xmm1
  cvtsi2sd %ebp,%xmm1
  cmp    $0x1,%r13d
  je     L155
  mov    %r13d,%edx
  movapd %xmm1,%xmm2
  mov    %r12,%rax
  shr    %edx
  unpcklpd %xmm2,%xmm2
  shl    $0x4,%rdx
  add    %r12,%rdx
  nopw   0x0(%rax,%rax,1)
L77:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  divpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L77
  mov    %r13d,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%r13b
  je     L27
L305:
  cltq
  lea    (%r12,%rax,8),%rax
  movsd  (%rax),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L27:
  mov    0x28(%rsp),%rax
  movq   $0x0,(%rax)
  mov    0x30(%rsp),%rax
  mov    (%rax),%r15d
  movslq %ebp,%rax
  mov    %rax,(%rsp)
  test   %ebp,%ebp
  jle    L304
L92:
  mov    (%rsp),%rax
  mov    %r13d,%r10d
  pxor   %xmm3,%xmm3
  mov    0x28(%rsp),%r11
  mov    %rbx,%r9
  and    $0xfffffffe,%r10d
  movapd %xmm3,%xmm4
  xor    %ecx,%ecx
  mov    %rax,%r8
  lea    0x0(,%rax,8),%rdi
  mov    %r13d,%eax
  shr    %eax
  shl    $0x4,%r8
  lea    -0x1(%rax),%esi
  add    $0x1,%rsi
  shl    $0x4,%rsi
  add    %r12,%rsi
  nopl   (%rax)
L312:
  movapd %xmm3,%xmm1
  test   %r13d,%r13d
  jle    L116
  cmp    $0x1,%r13d
  je     L42
  mov    %r12,%rdx
  mov    %r9,%rax
  movapd %xmm3,%xmm1
  nopl   (%rax)
L121:
  movsd  (%rax),%xmm2
  movupd (%rdx),%xmm0
  add    $0x10,%rdx
  movhpd (%rax,%rdi,1),%xmm2
  add    %r8,%rax
  subpd  %xmm2,%xmm0
  mulpd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rdx,%rsi
  jne    L121
  mov    %r10d,%eax
  cmp    %r13d,%r10d
  je     L116
L296:
  movslq %eax,%rdx
  imul   %ebp,%eax
  movsd  (%r12,%rdx,8),%xmm0
  add    %ecx,%eax
  cltq
  subsd  (%rbx,%rax,8),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
L116:
  addsd  %xmm1,%xmm4
  add    $0x1,%ecx
  add    $0x8,%r9
  movsd  %xmm4,(%r11)
  cmp    %ebp,%ecx
  jne    L312
  movslq %r15d,%rcx
  test   %r15d,%r15d
  jle    L200
  mov    0x8(%rsp),%rdi
  lea    0x0(,%rcx,8),%rdx
  xor    %esi,%esi
  mov    %rcx,0x10(%rsp)
  call   <memset@plt>
  cmp    $0x1,%r15d
  mov    0x10(%rsp),%rcx
  pxor   %xmm3,%xmm3
  jne    L200
  mov    (%rsp),%rax
  mov    %r12,0x10(%rsp)
  mov    %r13d,%r15d
  mov    %rbx,%r11
  and    $0xfffffffe,%r15d
  xor    %r8d,%r8d
  mov    %rax,%r10
  shl    $0x3,%rax
  mov    %rax,%r9
  mov    %r13d,%eax
  shl    $0x4,%r10
  shr    %eax
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,(%rsp)
  nopw   0x0(%rax,%rax,1)
L63:
  mov    0x18(%rsp),%rax
  mov    %r8d,%esi
  mov    (%rax,%r8,4),%ecx
  test   %r13d,%r13d
  jle    L49
  cmp    $0x1,%r13d
  je     L248
  mov    (%rsp),%rdi
  movslq %ecx,%r12
  mov    %r11,%rdx
  movapd %xmm3,%xmm1
  lea    (%r14,%r12,8),%rax
  add    %rax,%rdi
  nopl   0x0(%rax)
L274:
  movsd  (%rdx),%xmm0
  movupd (%rax),%xmm6
  add    $0x10,%rax
  movhpd (%rdx,%r9,1),%xmm0
  add    %r10,%rdx
  subpd  %xmm6,%xmm0
  mulpd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rdi
  jne    L274
  mov    %r15d,%eax
  cmp    %r15d,%r13d
  je     L336
L332:
  mov    %ebp,%edx
  imul   %eax,%edx
  add    %ecx,%eax
  cltq
  add    %esi,%edx
  movslq %edx,%rdx
  movsd  (%rbx,%rdx,8),%xmm0
  subsd  (%r14,%rax,8),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
L336:
  mov    0x8(%rsp),%rax
  add    $0x1,%r8
  add    $0x8,%r11
  lea    (%rax,%r12,8),%rax
  addsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
  cmp    %r8d,%ebp
  jg     L63
  mov    0x10(%rsp),%r12
L67:
  add    $0x58,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <free@plt>
  nopl   0x0(%rax)
L314:
  mov    %r15,%rdx
  mov    %r12,%rax
  xchg   %ax,%ax
L11:
  movsd  (%rax),%xmm0
  addsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %rdi,%rdx
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rbp
  jne    L11
  jmp    L343
L266:
  movslq 0x0(%rbp),%rax
  mov    %rax,(%rsp)
  mov    %rax,%rbp
  test   %eax,%eax
  jle    L215
L208:
  mov    0x28(%rsp),%rax
  movq   $0x0,(%rax)
  mov    0x30(%rsp),%rax
  mov    (%rax),%r15d
  jmp    L92
L42:
  movapd %xmm3,%xmm1
  xor    %eax,%eax
  jmp    L296
L49:
  movapd %xmm3,%xmm1
  movslq %ecx,%r12
  jmp    L336
L248:
  movapd %xmm3,%xmm1
  xor    %eax,%eax
  movslq %ecx,%r12
  jmp    L332
L200:
  mov    (%rsp),%rdi
  mov    0x18(%rsp),%r10
  xor    %r9d,%r9d
  lea    0x0(,%rcx,8),%rsi
  mov    0x8(%rsp),%r11
  shl    $0x3,%rdi
  nopl   0x0(%rax)
L220:
  movslq (%r10,%r9,4),%r8
  movapd %xmm3,%xmm1
  test   %r13d,%r13d
  jle    L367
  lea    (%r14,%r8,8),%rcx
  mov    %rbx,%rdx
  movapd %xmm3,%xmm1
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L64:
  movsd  (%rdx),%xmm0
  subsd  (%rcx),%xmm0
  add    $0x1,%eax
  add    %rdi,%rdx
  add    %rsi,%rcx
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %r13d,%eax
  jne    L64
L367:
  lea    (%r11,%r8,8),%rax
  add    $0x1,%r9
  add    $0x8,%rbx
  addsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
  cmp    %r9d,%ebp
  jg     L220
  jmp    L67
L215:
  mov    0x28(%rsp),%rax
  movq   $0x0,(%rax)
  mov    0x30(%rsp),%rax
  mov    (%rax),%r15d
L304:
  test   %r15d,%r15d
  jle    L67
  movslq %r15d,%rdx
  mov    0x8(%rsp),%rdi
  xor    %esi,%esi
  shl    $0x3,%rdx
  call   <memset@plt>
  jmp    L67
L155:
  xor    %eax,%eax
  jmp    L305
```

assistant: ```c
void sum_squares(double *x, int *nr, int *nc, int *k, int *cluster, double *centers, double *totss, double *withiness) {
  int i, j;
  double *global_average = (double *)malloc(*nc * sizeof(double));
  for (j = 0; j < *nc; ++j) {
    global_average[j] = 0.0;
  }
  for (i = 0; i < *nr; ++i) {
    for (j = 0; j < *nc; ++j) {
      global_average[j] += x[j * (*nr) + i];
    }
  }
  for (j = 0; j < *nc; ++j) {
    global_average[j] = global_average[j] / (*nr);
  }
  *totss = 0.0;
  double tmp_ss, temp;
  for (i = 0; i < (*nr); ++i) {
    tmp_ss = 0.0;
    for (j = 0; j < (*nc); ++j) {
      temp = global_average[j] - x[j * (*nr) + i];
      tmp_ss += temp * temp;
    }
    *totss += tmp_ss;
  }
  int t;
  for (t = 0; t < (*k); ++t) {
    withiness[t] = 0.0;
  }
  for (i = 0; i < (*nr); ++i) {
    tmp_ss = 0;
    for (j = 0; j < (*nc); ++j) {
      temp = x[j * (*nr) + i] - centers[j * (*k) + cluster[i]];
      tmp_ss += temp * temp;
    }
    withiness[cluster[i]] += tmp_ss;
  }
  free(global_average);
  return;
}
```