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

```asm
<EstimateKmeans>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x8a0,%rsp
  mov    %rdi,-0x1868(%rbp)
  mov    %rsi,-0x1870(%rbp)
  mov    %rdx,-0x1878(%rbp)
  mov    %ecx,-0x187c(%rbp)
  mov    %r8,-0x1888(%rbp)
  mov    %r9d,-0x1880(%rbp)
  movsd  %xmm0,-0x1898(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x1890(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x1890(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x1890(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  imul   %eax,%edx
  mov    -0x1890(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  cltq
  mov    %rax,-0x1820(%rbp)
  movl   $0x0,-0x1854(%rbp)
  jmp    L166
L50:
  mov    -0x1854(%rbp),%eax
  cltq
  movq   $0x0,-0x1810(%rbp,%rax,8)
  addl   $0x1,-0x1854(%rbp)
L166:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L50
  movl   $0x0,-0x1854(%rbp)
  jmp    L35
L228:
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1868(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D136(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x1898(%rbp),%xmm1
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1868(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  D136(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  divsd  -0x1898(%rbp),%xmm0
  pxor   %xmm2,%xmm2
  comisd %xmm2,%xmm0
  jb     L519
  movsd  D2(%rip),%xmm0
  jmp    L178
L519:
  movsd  D90(%rip),%xmm0
L178:
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rax
  mov    %eax,-0x1848(%rbp)
  cmpl   $0x0,-0x1848(%rbp)
  jle    L526
  cmpl   $0x0,0x18(%rbp)
  jle    L44
  mov    -0x1854(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1878(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,0x20(%rbp)
  jg     L74
L44:
  cmpl   $0x0,-0x1848(%rbp)
  jns    L380
  movl   $0x0,-0x1848(%rbp)
L380:
  cmpl   $0xff,-0x1848(%rbp)
  jle    L517
  movl   $0xff,-0x1848(%rbp)
L517:
  mov    -0x1848(%rbp),%eax
  cltq
  mov    -0x1810(%rbp,%rax,8),%rax
  lea    0x1(%rax),%rdx
  mov    -0x1848(%rbp),%eax
  cltq
  mov    %rdx,-0x1810(%rbp,%rax,8)
  jmp    L422
L526:
  nop
  jmp    L422
L74:
  nop
L422:
  addl   $0x1,-0x1854(%rbp)
L35:
  mov    -0x1854(%rbp),%eax
  cltq
  cmp    %rax,-0x1820(%rbp)
  jg     L228
  mov    -0x1810(%rbp),%rax
  mov    %rax,-0x810(%rbp)
  movl   $0x1,-0x1854(%rbp)
  jmp    L497
L538:
  mov    -0x1854(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x810(%rbp,%rax,8),%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  mov    -0x1810(%rbp,%rax,8),%rax
  add    %rax,%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  mov    %rdx,-0x810(%rbp,%rax,8)
  addl   $0x1,-0x1854(%rbp)
L497:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L538
  movl   $0x0,-0x1854(%rbp)
  jmp    L218
L495:
  mov    -0x1854(%rbp),%eax
  cltq
  mov    -0x810(%rbp,%rax,8),%rax
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  movsd  D87(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  pxor   %xmm2,%xmm2
  cvtsi2sd %rax,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  mov    -0x1854(%rbp),%eax
  cltq
  mov    -0x810(%rbp,%rax,8),%rax
  pxor   %xmm2,%xmm2
  cvtsi2sd %rax,%xmm2
  movsd  D87(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  mov    -0x18(%rbp),%rax
  pxor   %xmm2,%xmm2
  cvtsi2sd %rax,%xmm2
  divsd  %xmm2,%xmm0
  pxor   %xmm2,%xmm2
  comisd %xmm2,%xmm0
  jb     L190
  movsd  D2(%rip),%xmm0
  jmp    L293
L190:
  movsd  D90(%rip),%xmm0
L293:
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  mov    %rdx,-0x810(%rbp,%rax,8)
  addl   $0x1,-0x1854(%rbp)
L218:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L495
  movl   $0x0,-0x1854(%rbp)
  jmp    L36
L302:
  mov    -0x1854(%rbp),%eax
  cltq
  mov    -0x810(%rbp,%rax,8),%rax
  cmp    $0xa,%rax
  jle    L120
  mov    -0x1854(%rbp),%eax
  cltq
  mov    -0x810(%rbp,%rax,8),%rax
  cmp    $0x3dd,%rax
  jle    L461
L120:
  mov    -0x1854(%rbp),%eax
  cltq
  movq   $0x0,-0x1810(%rbp,%rax,8)
L461:
  addl   $0x1,-0x1854(%rbp)
L36:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L302
  movsd  D54(%rip),%xmm0
  movsd  %xmm0,-0x1840(%rbp)
  movl   $0x0,-0x1844(%rbp)
  jmp    L165
L129:
  movl   $0x0,-0x1854(%rbp)
  jmp    L259
L12:
  movsd  D172(%rip),%xmm0
  movsd  %xmm0,-0x1838(%rbp)
  movl   $0x0,-0x1850(%rbp)
  jmp    L38
L230:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1854(%rbp),%xmm0
  mov    -0x1850(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x1818(%rbp)
  movsd  -0x1818(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,-0x1818(%rbp)
  movsd  -0x1838(%rbp),%xmm0
  comisd -0x1818(%rbp),%xmm0
  jbe    L90
  mov    -0x1850(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  mov    %rdx,-0x1010(%rbp,%rax,8)
  movsd  -0x1818(%rbp),%xmm0
  movsd  %xmm0,-0x1838(%rbp)
L90:
  addl   $0x1,-0x1850(%rbp)
L38:
  mov    -0x1850(%rbp),%eax
  cmp    -0x187c(%rbp),%eax
  jl     L230
  addl   $0x1,-0x1854(%rbp)
L259:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L12
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x1840(%rbp)
  movl   $0x0,-0x1854(%rbp)
  jmp    L212
L315:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x1830(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x1828(%rbp)
  movl   $0x0,-0x1850(%rbp)
  jmp    L21
L1:
  mov    -0x1850(%rbp),%eax
  cltq
  mov    -0x1010(%rbp,%rax,8),%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  cmp    %rax,%rdx
  jne    L471
  mov    -0x1850(%rbp),%eax
  cltq
  mov    -0x1810(%rbp,%rax,8),%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  movsd  -0x1830(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x1830(%rbp)
  mov    -0x1850(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1850(%rbp),%eax
  cltq
  mov    -0x1810(%rbp,%rax,8),%rax
  imul   %rdx,%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  movsd  -0x1828(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x1828(%rbp)
L471:
  addl   $0x1,-0x1850(%rbp)
L21:
  cmpl   $0xff,-0x1850(%rbp)
  jle    L1
  movsd  -0x1830(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L52
  movsd  -0x1828(%rbp),%xmm0
  divsd  -0x1830(%rbp),%xmm0
  movsd  %xmm0,-0x1828(%rbp)
  movsd  -0x1828(%rbp),%xmm0
  jmp    L413
L52:
  pxor   %xmm0,%xmm0
L413:
  movsd  %xmm0,-0x1828(%rbp)
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x1828(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x1818(%rbp)
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x1828(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  movsd  -0x1818(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,-0x1818(%rbp)
  movsd  -0x1840(%rbp),%xmm0
  addsd  -0x1818(%rbp),%xmm0
  movsd  %xmm0,-0x1840(%rbp)
  addl   $0x1,-0x1854(%rbp)
L212:
  mov    -0x1854(%rbp),%eax
  cmp    -0x187c(%rbp),%eax
  jl     L315
  addl   $0x1,-0x1844(%rbp)
L165:
  movsd  -0x1840(%rbp),%xmm0
  movsd  D4(%rip),%xmm1
  comisd %xmm1,%xmm0
  jbe    L408
  mov    -0x1844(%rbp),%eax
  cmp    -0x1880(%rbp),%eax
  jl     L129
L408:
  movl   $0x0,-0x1854(%rbp)
  jmp    L51
L514:
  movsd  D54(%rip),%xmm0
  movsd  %xmm0,-0x1838(%rbp)
  movl   $0x0,-0x184c(%rbp)
  movl   $0x0,-0x1850(%rbp)
  jmp    L436
L188:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1854(%rbp),%xmm0
  mov    -0x1850(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movq   D132(%rip),%xmm1
  andpd  %xmm0,%xmm1
  movsd  -0x1838(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L186
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1854(%rbp),%xmm0
  mov    -0x1850(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movq   D132(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x1838(%rbp)
  mov    -0x1850(%rbp),%eax
  mov    %eax,-0x184c(%rbp)
L186:
  addl   $0x1,-0x1850(%rbp)
L436:
  mov    -0x1850(%rbp),%eax
  cmp    -0x187c(%rbp),%eax
  jl     L188
  mov    -0x184c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1854(%rbp),%eax
  cltq
  mov    %rdx,-0x1010(%rbp,%rax,8)
  addl   $0x1,-0x1854(%rbp)
L51:
  cmpl   $0xff,-0x1854(%rbp)
  jle    L514
  movq   $0x0,-0x1010(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x1840(%rbp)
  movl   $0x0,-0x1854(%rbp)
  jmp    L130
L153:
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1868(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D136(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x1898(%rbp),%xmm1
  mov    -0x1854(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1868(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  D136(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  divsd  -0x1898(%rbp),%xmm0
  pxor   %xmm2,%xmm2
  comisd %xmm2,%xmm0
  jb     L11
  movsd  D2(%rip),%xmm0
  jmp    L116
L11:
  movsd  D90(%rip),%xmm0
L116:
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rax
  mov    %eax,-0x1848(%rbp)
  cmpl   $0x0,-0x1848(%rbp)
  jle    L151
  cmpl   $0x0,-0x1848(%rbp)
  jns    L509
  movl   $0x0,-0x1848(%rbp)
L509:
  cmpl   $0xff,-0x1848(%rbp)
  jle    L256
  movl   $0xff,-0x1848(%rbp)
L256:
  mov    -0x1848(%rbp),%eax
  cltq
  mov    -0x1010(%rbp,%rax,8),%rax
  mov    %eax,%ecx
  mov    -0x1854(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1870(%rbp),%rax
  add    %rdx,%rax
  lea    0x1(%rcx),%edx
  mov    %dl,(%rax)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1848(%rbp),%xmm0
  mov    -0x1848(%rbp),%eax
  cltq
  mov    -0x1010(%rbp,%rax,8),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1848(%rbp),%xmm0
  mov    -0x1848(%rbp),%eax
  cltq
  mov    -0x1010(%rbp,%rax,8),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x1888(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x1840(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x1840(%rbp)
  cmpl   $0x0,0x18(%rbp)
  jle    L226
  mov    -0x1854(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1878(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,0x18(%rbp)
  jle    L226
  mov    -0x1854(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1870(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L226
L151:
  mov    -0x1854(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1870(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L226:
  addl   $0x1,-0x1854(%rbp)
L130:
  mov    -0x1854(%rbp),%eax
  cltq
  cmp    %rax,-0x1820(%rbp)
  jg     L153
  movsd  -0x1840(%rbp),%xmm0
  movq   %xmm0,%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L232
  call   <__stack_chk_fail@plt>
L232:
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D136
type_infered: f64
name: disassemble_data
arguments: data_label: D2
type_infered: f64
name: disassemble_data
arguments: data_label: D90
type_infered: f32[2]
name: disassemble_data
arguments: data_label: D87
type_infered: f64
name: disassemble_data
arguments: data_label: D54
type_infered: f64
name: disassemble_data
arguments: data_label: D172
type_infered: f32[2]
name: disassemble_data
arguments: data_label: D4
type_infered: f64
name: disassemble_data
arguments: data_label: D132
type_infered: qword

tool: D136: 255

tool: D2: 0.5

tool: {"D90": [0.0,-1.75]}

tool: D87: 1000

tool: D54: 1000000000000000.0

tool: {"D172": [0.0,7.5]}

tool: D4: 1

tool: D132: 9223372036854775807

assistant: ```c
double EstimateKmeans(double *src, unsigned char *label, unsigned char *mask, int n_classes, double *mean, int ni, int *dims, int thresh_mask, int thresh_kmeans, double max_src) {
  int i, j, j0, v;
  int count;
  long histo[256], lut[256], cumsum[256], vol;
  double diff, dmin, dx, xnorm, sum;
  vol = dims[0] * dims[1] * dims[2];
  for (i = 0; i < 256; i++)
    histo[i] = 0;
  for (i = 0; i < vol; i++) {
    v = (int)((long)((255.0 * src[i] / max_src) + (((255.0 * src[i] / max_src) >= 0) ? 0.5 : (-0.5))));
    if (v < 1)
      continue;
    if ((thresh_mask > 0) && ((int)mask[i] < thresh_kmeans))
      continue;
    if (v < 0)
      v = 0;
    if (v > 255)
      v = 255;
    histo[v]++;
  }
  cumsum[0] = histo[0];
  for (i = 1; i < 256; i++)
    cumsum[i] = cumsum[i - 1] + histo[i];
  for (i = 0; i < 256; i++)
    cumsum[i] = (long)((long)((1000.0 * (double)cumsum[i] / (double)cumsum[255]) + (((1000.0 * (double)cumsum[i] / (double)cumsum[255]) >= 0) ? 0.5 : (-0.5))));
  for (i = 0; i < 256; i++)
    if ((cumsum[i] <= 10) || (cumsum[i] >= 990))
      histo[i] = 0;
  diff = 1e15;
  count = 0;
  while (diff > 1.0 && count < ni) {
    for (i = 0; i < 256; i++) {
      dmin = 256.0 * 256.0;
      for (j = 0; j < n_classes; j++) {
        dx = (double)i - mean[j];
        dx *= dx;
        if (dx < dmin) {
          lut[i] = j;
          dmin = dx;
        }
      }
    }
    diff = 0;
    for (i = 0; i < n_classes; i++) {
      xnorm = 0.0;
      sum = 0.0;
      for (j = 0; j < 256; j++)
        if (lut[j] == i) {
          xnorm += histo[j];
          sum += j * histo[j];
        }
      sum = xnorm > 0 ? sum /= xnorm : 0.0;
      dx = sum - mean[i];
      mean[i] = sum;
      dx *= dx;
      diff += dx;
    }
    count++;
  }
  for (i = 0; i < 256; i++) {
    dmin = 1e15;
    j0 = 0;
    for (j = 0; j < n_classes; j++) {
      if (fabs((double)i - mean[j]) < dmin) {
        dmin = fabs((double)i - mean[j]);
        j0 = j;
      }
    }
    lut[i] = j0;
  }
  lut[0] = 0;
  diff = 0;
  for (i = 0; i < vol; i++) {
    v = (int)((long)((255.0 * src[i] / max_src) + (((255.0 * src[i] / max_src) >= 0) ? 0.5 : (-0.5))));
    if (v >= 1) {
      if (v < 0)
        v = 0;
      if (v > 255)
        v = 255;
      label[i] = (unsigned char)(lut[v] + 1);
      diff += (((double)v - mean[lut[v]]) * ((double)v - mean[lut[v]]));
      if ((thresh_mask > 0) && ((int)mask[i] < thresh_mask))
        label[i] = 0;
    } else
      label[i] = 0;
  }
  return (diff);
}
```