user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<sum_squares>:
  endbr64
  push   %r15
  mov    %r9,%r15
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    (%rdx),%eax
  mov    0x68(%rsp),%r8
  mov    0x60(%rsp),%r14
  mov    %rdi,0x8(%rsp)
  lea    0x0(,%rax,8),%edi
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  call   <malloc@plt>
  mov    (%rbx),%ebx
  mov    0x18(%rsp),%r8
  mov    %rax,%r12
  test   %ebx,%ebx
  jle    L42
  movslq %ebx,%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %r8,0x18(%rsp)
  shl    $0x3,%rdx
  call   <memset@plt>
  mov    0x18(%rsp),%r8
L42:
  mov    0x0(%rbp),%r9d
  test   %r9d,%r9d
  jle    L34
  lea    -0x1(%rbx),%eax
  movslq %r9d,%rbp
  mov    0x8(%rsp),%r10
  xor    %edi,%edi
  lea    0x0(,%rbp,8),%rsi
  mov    %rax,%r11
  lea    0x8(%r12,%rax,8),%rcx
  nopl   0x0(%rax,%rax,1)
L11:
  mov    %r10,%rdx
  mov    %r12,%rax
  test   %ebx,%ebx
  jle    L19
  nopw   0x0(%rax,%rax,1)
L100:
  movsd  (%rax),%xmm0
  addsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %rsi,%rdx
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rcx
  jne    L100
L19:
  add    $0x1,%edi
  add    $0x8,%r10
  cmp    %r9d,%edi
  jne    L11
  test   %ebx,%ebx
  jle    L152
L116:
  pxor   %xmm1,%xmm1
  mov    %ebx,%edx
  mov    %r12,%rax
  cvtsi2sd %r9d,%xmm1
  lea    (%r12,%rdx,8),%rdx
  nop
L109:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rdx
  jne    L109
  mov    0x10(%rsp),%rax
  movq   $0x0,(%r14)
  mov    (%rax),%ecx
  test   %r9d,%r9d
  jle    L144
  movslq %r9d,%rbp
  lea    -0x1(%rbx),%r11d
L53:
  pxor   %xmm3,%xmm3
  mov    0x8(%rsp),%r10
  lea    0x8(%r12,%r11,8),%rsi
  lea    0x0(,%rbp,8),%rdi
  movapd %xmm3,%xmm2
  xor    %r11d,%r11d
  nopl   0x0(%rax)
L180:
  mov    %r10,%rdx
  mov    %r12,%rax
  movapd %xmm3,%xmm1
  test   %ebx,%ebx
  jle    L10
  cs nopw 0x0(%rax,%rax,1)
L121:
  movsd  (%rax),%xmm0
  subsd  (%rdx),%xmm0
  add    $0x8,%rax
  add    %rdi,%rdx
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rsi
  jne    L121
L10:
  addsd  %xmm1,%xmm2
  add    $0x1,%r11d
  add    $0x8,%r10
  movsd  %xmm2,(%r14)
  cmp    %r9d,%r11d
  jne    L180
  movslq %ecx,%r14
  test   %ecx,%ecx
  jle    L163
  movslq %ecx,%r14
  mov    %r8,%rdi
  xor    %esi,%esi
  mov    %r9d,0x10(%rsp)
  lea    0x0(,%r14,8),%rdx
  call   <memset@plt>
  mov    0x10(%rsp),%r9d
  pxor   %xmm3,%xmm3
  mov    %rax,%r8
L163:
  mov    0x8(%rsp),%r10
  shl    $0x3,%rbp
  lea    0x0(,%r14,8),%rsi
  xor    %r11d,%r11d
  nopl   0x0(%rax,%rax,1)
L138:
  movslq 0x0(%r13,%r11,4),%rdi
  movapd %xmm3,%xmm1
  test   %ebx,%ebx
  jle    L120
  lea    (%r15,%rdi,8),%rcx
  mov    %r10,%rdx
  movapd %xmm3,%xmm1
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L164:
  movsd  (%rdx),%xmm0
  subsd  (%rcx),%xmm0
  add    $0x1,%eax
  add    %rbp,%rdx
  add    %rsi,%rcx
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %ebx,%eax
  jne    L164
L120:
  lea    (%r8,%rdi,8),%rax
  add    $0x1,%r11
  add    $0x8,%r10
  addsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
  cmp    %r11d,%r9d
  jg     L138
L135:
  add    $0x28,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <free@plt>
L34:
  test   %ebx,%ebx
  jg     L116
  mov    0x10(%rsp),%rax
  movq   $0x0,(%r14)
  mov    (%rax),%ecx
L144:
  test   %ecx,%ecx
  jle    L135
  movslq %ecx,%rdx
  xor    %esi,%esi
  mov    %r8,%rdi
  shl    $0x3,%rdx
  call   <memset@plt>
  jmp    L135
L152:
  mov    0x10(%rsp),%rax
  movq   $0x0,(%r14)
  mov    (%rax),%ecx
  jmp    L53
```

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;
}
```