user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<gettotalJS>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,%r15d
  mov    %edx,0x28(%rsp)
  mov    %ecx,(%rsp)
  mov    %r8,0x10(%rsp)
  mov    %r9d,0x2c(%rsp)
  lea    0x1(%r9),%r14d
  mov    %r14d,0x54(%rsp)
  movslq %r14d,%r12
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,0x30(%rsp)
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,0x20(%rsp)
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,0x38(%rsp)
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,%rbx
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,%rbp
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <calloc@plt>
  mov    %rax,%r12
  mov    %r15d,%esi
  mov    %r14d,%edi
  mov    $0x0,%eax
  call   <fmatrix@plt>
  mov    %eax,0x18(%rsp)
  movslq %eax,%r13
  mov    %r15d,%esi
  mov    %r14d,%edi
  mov    $0x0,%eax
  call   <fmatrix@plt>
  mov    %eax,0x58(%rsp)
  movslq %eax,%rdi
  mov    %rdi,0x40(%rsp)
  mov    %r15d,0x50(%rsp)
  mov    %r15d,%esi
  mov    %r14d,%edi
  mov    $0x0,%eax
  call   <imatrix@plt>
  mov    %eax,%r15d
  movslq %eax,%rdi
  mov    %rdi,0x48(%rsp)
  mov    0x50(%rsp),%esi
  mov    %r14d,%edi
  mov    $0x0,%eax
  call   <fmatrix@plt>
  mov    %eax,0x60(%rsp)
  movslq %eax,%r14
  mov    (%rsp),%edi
  cmpl   $0x0,0x28(%rsp)
  jle    L370
  mov    $0x0,%r10d
  mov    $0x0,%r9d
  mov    %r15d,0x68(%rsp)
  mov    0x40(%rsp),%r11
  mov    %r14,0x70(%rsp)
  mov    0x48(%rsp),%r14
  jmp    L318
L414:
  add    $0x1,%rax
  cmp    %rdi,%rax
  je     L352
L338:
  movzbl (%rsi,%rax,1),%edx
  test   %dl,%dl
  je     L414
  movzbl %dl,%edx
  lea    0x0(,%rdx,4),%rcx
  lea    (%rbx,%rcx,1),%r15
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  movaps %xmm1,%xmm0
  addss  (%r15),%xmm0
  movss  %xmm0,(%r15)
  lea    0x0(%rbp,%rcx,1),%r15
  pxor   %xmm0,%xmm0
  cvtsi2ss %r9d,%xmm0
  movaps %xmm0,%xmm2
  addss  (%r15),%xmm2
  movss  %xmm2,(%r15)
  addl   $0x1,(%r12,%rcx,1)
  movzbl (%r8,%rax,1),%ecx
  shl    $0x2,%rcx
  mov    %rcx,%r15
  add    (%r11,%rdx,8),%r15
  addss  (%r15),%xmm1
  movss  %xmm1,(%r15)
  mov    %rcx,%r15
  add    0x0(%r13,%rdx,8),%r15
  addss  (%r15),%xmm0
  movss  %xmm0,(%r15)
  add    (%r14,%rdx,8),%rcx
  addl   $0x1,(%rcx)
  jmp    L414
L352:
  add    (%rsp),%r10d
L308:
  add    $0x1,%r9d
  cmp    %r9d,0x28(%rsp)
  je     L97
L318:
  mov    $0x0,%eax
  movslq %r10d,%r8
  mov    0x10(%rsp),%rsi
  add    %r8,%rsi
  add    0x8(%rsp),%r8
  cmpl   $0x0,(%rsp)
  jg     L338
  jmp    L308
L97:
  mov    0x68(%rsp),%r15d
  mov    0x70(%rsp),%r14
L370:
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  jle    L291
  movslq %r15d,%rdx
  lea    0x8(%rdx),%r10
  lea    0x1(%rax),%r15d
  mov    0x50(%rsp),%r11d
  lea    -0x1(%r11),%eax
  lea    0x4(,%rax,4),%rsi
  mov    $0x1,%edi
  movslq 0x58(%rsp),%rax
  sub    %rdx,%rax
  mov    %rax,%rcx
  movslq 0x18(%rsp),%rax
  sub    %rdx,%rax
  mov    %rax,0x18(%rsp)
  mov    %r13,0x58(%rsp)
  mov    %r14,0x68(%rsp)
  mov    %rcx,%r14
  jmp    L50
L403:
  add    $0x4,%rax
  cmp    %rsi,%rax
  je     L170
L417:
  mov    (%rcx),%rdx
  mov    (%rdx,%rax,1),%edx
  test   %edx,%edx
  jle    L403
  mov    %rax,%r13
  add    (%r9),%r13
  pxor   %xmm1,%xmm1
  cvtsi2ss %edx,%xmm1
  movss  0x0(%r13),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,0x0(%r13)
  mov    %rax,%rdx
  add    (%r8),%rdx
  mov    (%rcx),%r13
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x0(%r13,%rax,1),%xmm1
  movss  (%rdx),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rdx)
  jmp    L403
L170:
  add    $0x1,%rdi
  add    $0x8,%r10
  cmp    %r15,%rdi
  je     L335
L50:
  pxor   %xmm1,%xmm1
  cvtsi2ssl (%r12,%rdi,4),%xmm1
  movss  (%rbx,%rdi,4),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rbx,%rdi,4)
  movss  0x0(%rbp,%rdi,4),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,0x0(%rbp,%rdi,4)
  test   %r11d,%r11d
  jle    L170
  mov    %r10,%rcx
  lea    (%r14,%r10,1),%r9
  mov    0x18(%rsp),%rax
  lea    (%rax,%r10,1),%r8
  mov    $0x0,%eax
  jmp    L417
L381:
  add    $0x1,%rdx
  cmp    %r8,%rdx
  je     L297
L190:
  movzbl (%rdi,%rdx,1),%eax
  test   %al,%al
  je     L381
  movzbl %al,%eax
  lea    (%r12,%rax,4),%rcx
  pxor   %xmm0,%xmm0
  cvtsi2ss %r11d,%xmm0
  movaps %xmm0,%xmm1
  subss  0x0(%rbp,%rax,4),%xmm1
  pxor   %xmm2,%xmm2
  cvtsi2ss %edx,%xmm2
  movaps %xmm2,%xmm3
  subss  (%rbx,%rax,4),%xmm3
  mulss  %xmm1,%xmm1
  mulss  %xmm3,%xmm3
  addss  %xmm3,%xmm1
  addss  (%rcx),%xmm1
  movss  %xmm1,(%rcx)
  movzbl (%r10,%rdx,1),%ecx
  mov    (%r14,%rax,8),%rsi
  lea    (%rsi,%rcx,4),%rsi
  mov    0x0(%r13,%rax,8),%r9
  subss  (%r9,%rcx,4),%xmm0
  mov    (%r15,%rax,8),%rax
  subss  (%rax,%rcx,4),%xmm2
  movaps %xmm2,%xmm1
  mulss  %xmm0,%xmm0
  mulss  %xmm2,%xmm1
  addss  %xmm1,%xmm0
  addss  (%rsi),%xmm0
  movss  %xmm0,(%rsi)
  jmp    L381
L297:
  mov    0x18(%rsp),%r9d
  add    (%rsp),%r9d
L134:
  add    $0x1,%r11d
  cmp    %r11d,0x28(%rsp)
  je     L240
L159:
  mov    $0x0,%edx
  movslq %r9d,%r10
  mov    0x10(%rsp),%rax
  lea    (%rax,%r10,1),%rdi
  add    0x8(%rsp),%r10
  cmpl   $0x0,(%rsp)
  jle    L134
  mov    %r9d,0x18(%rsp)
  jmp    L190
L240:
  mov    0x58(%rsp),%r12
  cmpl   $0x0,0x2c(%rsp)
  jle    L409
L127:
  mov    0x38(%rsp),%rax
  lea    0x4(%rax),%rcx
  movslq 0x60(%rsp),%rdi
  mov    %rdi,0x70(%rsp)
  lea    0x8(%rdi),%rsi
  mov    0x2c(%rsp),%edi
  lea    -0x1(%rdi),%edi
  mov    %rdi,0x78(%rsp)
  lea    0x8(%rax,%rdi,4),%r8
  mov    0x50(%rsp),%r10d
  lea    -0x1(%r10),%eax
  mov    %rax,0x68(%rsp)
  lea    0x4(,%rax,4),%r9
  jmp    L231
L123:
  mov    %rcx,%rdi
  movss  (%rcx),%xmm0
  mov    (%rsi),%rax
  lea    (%r9,%rax,1),%rdx
L60:
  addss  (%rax),%xmm0
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L60
  movss  %xmm0,(%rdi)
L149:
  add    $0x4,%rcx
  add    $0x8,%rsi
  cmp    %r8,%rcx
  je     L40
L231:
  test   %r10d,%r10d
  jg     L123
  jmp    L149
L40:
  mov    $0x1,%r15d
  pxor   %xmm6,%xmm6
  movss  %xmm6,0x8(%rsp)
  mov    %rbx,0x10(%rsp)
  mov    0x38(%rsp),%rbx
  mov    %rbp,0x18(%rsp)
  mov    %r13,0x58(%rsp)
  mov    0x30(%rsp),%r13
  mov    %r14,0x60(%rsp)
  mov    0x2c(%rsp),%ebp
  mov    0xc0(%rsp),%r14
  jmp    L253
L259:
  movss  0x0(%r13,%r15,4),%xmm0
  subss  %xmm1,%xmm0
  mov    0x20(%rsp),%rax
  movss  %xmm0,(%rax,%r15,4)
  divss  %xmm1,%xmm0
  movss  %xmm0,(%r14,%r15,4)
  pxor   %xmm1,%xmm1
  cvtsi2ssl (%r12,%r15,4),%xmm1
  mulss  %xmm1,%xmm0
  addss  0x8(%rsp),%xmm0
  movss  %xmm0,0x8(%rsp)
L322:
  add    $0x1,%r15
  cmp    %r15d,%ebp
  jl     L146
L253:
  mov    %r15d,%esi
  movss  (%rbx,%r15,4),%xmm1
  pxor   %xmm4,%xmm4
  ucomiss %xmm4,%xmm1
  jp     L259
  jne    L259
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L322
L121:
  mov    %rdx,(%rsp)
L340:
  mov    (%rsi),%rdx
  movss  (%rdx,%rax,1),%xmm0
  mov    (%rcx),%rdx
  movss  %xmm0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rdi
  jne    L340
  mov    (%rsp),%rdx
L22:
  mov    (%rcx),%rax
  movss  (%r8),%xmm0
  movss  %xmm0,(%rax,%r9,1)
  add    $0x8,%rcx
  add    $0x4,%r8
  cmp    %r11,%rcx
  je     L334
L206:
  lea    (%rbx,%rcx,1),%rsi
  mov    $0x0,%eax
  test   %r10d,%r10d
  jg     L121
  jmp    L22
L334:
  mov    %rbp,%rbx
  mov    %r12,%rbp
  mov    %r13,%r12
  mov    %r14,%r13
  mov    %rdx,%r14
L111:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x54(%rsp),%ebx
  mov    %ebx,%esi
  mov    0x40(%rsp),%rdi
  mov    $0x0,%eax
  call   <free_fmatrix@plt>
  mov    %ebx,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <free_fmatrix@plt>
  mov    %ebx,%esi
  mov    0x48(%rsp),%rdi
  mov    $0x0,%eax
  call   <free_imatrix@plt>
  mov    %ebx,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <free_fmatrix@plt>
  movd   %r15d,%xmm0
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L146:
  mov    0x10(%rsp),%rbx
  mov    0x18(%rsp),%rbp
  mov    0x58(%rsp),%r13
  mov    0x60(%rsp),%r14
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x28(%rsp),%xmm1
  movss  0x8(%rsp),%xmm0
  divss  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl (%rsp),%xmm1
  divss  %xmm1,%xmm0
  movd   %xmm0,%r15d
  cmpl   $0x0,0xd0(%rsp)
  jle    L111
  mov    0x50(%rsp),%eax
  movslq %eax,%r9
  shl    $0x2,%r9
  mov    0xc8(%rsp),%rdi
  lea    0x8(%rdi),%rcx
  mov    0x30(%rsp),%rdi
  lea    0x4(%rdi),%r8
  mov    0xc8(%rsp),%rdi
  mov    0x78(%rsp),%rsi
  lea    0x10(%rdi,%rsi,8),%r11
  mov    0x68(%rsp),%rdi
  lea    0x4(,%rdi,4),%rdi
  mov    0x70(%rsp),%r10
  sub    0xc8(%rsp),%r10
  mov    %r14,%rdx
  mov    %r13,%r14
  mov    %r12,%r13
  mov    %rbp,%r12
  mov    %rbx,%rbp
  mov    %r10,%rbx
  mov    %eax,%r10d
  jmp    L206
L291:
  cmpl   $0x0,0x28(%rsp)
  jg     L391
L409:
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x28(%rsp),%xmm1
  pxor   %xmm0,%xmm0
  divss  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl (%rsp),%xmm1
  divss  %xmm1,%xmm0
  movd   %xmm0,%r15d
  jmp    L111
L335:
  mov    0x58(%rsp),%r13
  mov    0x68(%rsp),%r14
  cmpl   $0x0,0x28(%rsp)
  jle    L127
L391:
  mov    $0x0,%r15d
  mov    $0x0,%r11d
  mov    (%rsp),%r8d
  mov    %r12,0x58(%rsp)
  mov    0x30(%rsp),%r12
  mov    %r15d,%r9d
  mov    0x40(%rsp),%r15
  jmp    L159
```

tool_calls: name: unpack_data
arguments: tag: D1
type_infered: string

tool: D1: Sw[%d]=0


assistant: ```c
float gettotalJS(unsigned char *cmap, int N, int ny, int nx, unsigned char *rmap, int TR, float *totalJ, float **mapmatrix, int oldTR) {
  int iy, ix, i, j, *StN, **avgN, l;
  float *St, *Sb, *Sw, *Stmeanx, *Stmeany, **avgy, **avgx, overallJ, **var;
  int debug = 0;
  St = (float *)calloc(TR + 1, sizeof(float));
  Sb = (float *)calloc(TR + 1, sizeof(float));
  Sw = (float *)calloc(TR + 1, sizeof(float));
  Stmeanx = (float *)calloc(TR + 1, sizeof(float));
  Stmeany = (float *)calloc(TR + 1, sizeof(float));
  StN = (int *)calloc(TR + 1, sizeof(int));
  avgy = (float **)fmatrix(TR + 1, N);
  avgx = (float **)fmatrix(TR + 1, N);
  avgN = (int **)imatrix(TR + 1, N);
  var = (float **)fmatrix(TR + 1, N);
  l = 0;
  for (iy = 0; iy < ny; iy++) {
    for (ix = 0; ix < nx; ix++) {
      if (rmap[l] > 0) {
        i = rmap[l];
        j = cmap[l];
        Stmeanx[i] += ix;
        Stmeany[i] += iy;
        StN[i]++;
        avgx[i][j] += ix;
        avgy[i][j] += iy;
        avgN[i][j]++;
      }
      l++;
    }
  }
  for (i = 1; i <= TR; i++) {
    Stmeanx[i] /= StN[i];
    Stmeany[i] /= StN[i];
    for (j = 0; j < N; j++) {
      if (avgN[i][j] > 0) {
        avgx[i][j] /= avgN[i][j];
        avgy[i][j] /= avgN[i][j];
      }
    }
  }
  l = 0;
  for (iy = 0; iy < ny; iy++) {
    for (ix = 0; ix < nx; ix++) {
      if (rmap[l] > 0) {
        i = rmap[l];
        j = cmap[l];
        St[i] += ((iy - Stmeany[i]) * (iy - Stmeany[i])) + ((ix - Stmeanx[i]) * (ix - Stmeanx[i]));
        var[i][j] += ((iy - avgy[i][j]) * (iy - avgy[i][j])) + ((ix - avgx[i][j]) * (ix - avgx[i][j]));
      }
      l++;
    }
  }
  for (i = 1; i <= TR; i++) {
    for (j = 0; j < N; j++)
      Sw[i] += var[i][j];
  }
  overallJ = 0;
  for (i = 1; i <= TR; i++) {
    if (Sw[i] == 0)
      printf("Sw[%d]=0\n", i);
    else {
      Sb[i] = St[i] - Sw[i];
      totalJ[i] = Sb[i] / Sw[i];
      overallJ += StN[i] * totalJ[i];
    }
  }
  overallJ = overallJ / ny / nx;
  if (debug)
    printf("\n%5.3f\n", overallJ);
  if (oldTR > 0) {
    for (i = 1; i <= TR; i++) {
      for (j = 0; j < N; j++)
        mapmatrix[i][j] = var[i][j];
      mapmatrix[i][N] = St[i];
    }
  }
  free(Stmeanx);
  free(Stmeany);
  free(StN);
  free(St);
  free(Sb);
  free(Sw);
  free_fmatrix(avgx, TR + 1);
  free_fmatrix(avgy, TR + 1);
  free_imatrix(avgN, TR + 1);
  free_fmatrix(var, TR + 1);
  return overallJ;
}
```