user: What is the c source code of the assembly code below?

```asm
<kmeans_clustering>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %esi,%r13d
  mov    %edx,0x14(%rsp)
  movss  %xmm0,0x2c(%rsp)
  mov    %r8,0x20(%rsp)
  cmp    %edx,%ecx
  cmovg  %edx,%ecx
  mov    %ecx,%r12d
  movslq %ecx,%r14
  lea    0x0(,%r14,8),%r15
  mov    %r15,%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %r12d,%eax
  imul   %r13d,%eax
  movslq %eax,%rbx
  lea    0x0(,%rbx,4),%rdi
  call   <malloc@plt>
  mov    %rax,0x0(%rbp)
  cmp    $0x1,%r12d
  jle    L267
  movslq %r13d,%rcx
  shl    $0x2,%rcx
  mov    %rbp,%rax
  lea    -0x1(%r12),%edx
  lea    0x0(%rbp,%rdx,8),%rsi
L104:
  mov    %rcx,%rdx
  add    (%rax),%rdx
  mov    %rdx,0x8(%rax)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L104
L267:
  movslq 0x14(%rsp),%rdi
  shl    $0x2,%rdi
  call   <malloc@plt>
  mov    %rax,%r8
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  jle    L289
  mov    %eax,%edx
  mov    $0x0,%eax
L118:
  mov    %eax,(%r8,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L118
  test   %r12d,%r12d
  jle    L177
L44:
  mov    0x14(%rsp),%eax
  lea    -0x1(%rax),%r10d
  movslq %r10d,%r10
  mov    %rbp,%rcx
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%rdi
  mov    $0x1,%r9d
  mov    0x18(%rsp),%r11
  jmp    L237
L94:
  movslq -0x4(%r8,%r9,4),%rax
  lea    (%r11,%rax,8),%rsi
  mov    $0x0,%eax
L136:
  mov    (%rsi),%rdx
  movss  (%rdx,%rax,1),%xmm0
  mov    (%rcx),%rdx
  movss  %xmm0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L136
L105:
  mov    -0x4(%r8,%r9,4),%eax
  mov    (%r8,%r10,4),%edx
  mov    %edx,-0x4(%r8,%r9,4)
  mov    %eax,(%r8,%r10,4)
  cmp    %r9d,%r12d
  setg   %dl
  mov    %r10d,%eax
  not    %eax
  shr    $0x1f,%eax
  sub    $0x1,%r10
  add    $0x1,%r9
  add    $0x8,%rcx
  test   %al,%dl
  je     L181
L237:
  test   %r13d,%r13d
  jg     L94
  jmp    L105
L181:
  cmpl   $0x0,0x14(%rsp)
  jle    L87
  movb   $0x1,0x2b(%rsp)
L8:
  mov    $0x0,%eax
  mov    0x14(%rsp),%edx
  mov    0x20(%rsp),%rcx
L174:
  movl   $0xffffffff,(%rcx,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L174
L149:
  mov    $0x4,%esi
  mov    %r14,%rdi
  call   <calloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %r15,%rdi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    $0x4,%esi
  mov    %rbx,%rdi
  call   <calloc@plt>
  mov    %rax,(%r15)
  cmp    $0x1,%r12d
  jle    L265
  movslq %r13d,%rcx
  shl    $0x2,%rcx
  mov    %r15,%rax
  lea    -0x1(%r12),%edx
  lea    (%r15,%rdx,8),%rsi
L109:
  mov    %rcx,%rdx
  add    (%rax),%rdx
  mov    %rdx,0x8(%rax)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L109
L265:
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%rbx
  mov    $0x0,%r14d
  jmp    L266
L87:
  movb   $0x1,0x2b(%rsp)
  jmp    L149
L18:
  mov    0x0(%rbp,%r8,8),%rdi
  mov    (%rcx),%r9
  pxor   %xmm1,%xmm1
  cvtsi2ss %edx,%xmm1
  movss  (%r9,%rax,1),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rdi,%rax,1)
L41:
  mov    (%rcx),%rdx
  movl   $0x0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rbx
  je     L151
L227:
  mov    (%rsi),%edx
  test   %edx,%edx
  jg     L18
  jmp    L41
L151:
  movl   $0x0,(%rsi)
  add    $0x1,%r8
  add    $0x4,%rsi
  add    $0x8,%rcx
  cmp    %r8d,%r12d
  jle    L26
L22:
  mov    $0x0,%eax
  test   %r13d,%r13d
  jg     L227
  jmp    L151
L26:
  add    $0x1,%r14d
  comiss 0x2c(%rsp),%xmm2
  jbe    L242
  cmp    $0x1f5,%r14d
  je     L242
L266:
  push   %r15
  push   0x10(%rsp)
  mov    %rbp,%r9
  mov    0x30(%rsp),%r8
  mov    %r12d,%ecx
  mov    0x24(%rsp),%edx
  mov    %r13d,%esi
  mov    0x28(%rsp),%rdi
  mov    $0x0,%eax
  call   <kmeansCuda@plt>
  pxor   %xmm2,%xmm2
  cvtsi2ss %eax,%xmm2
  add    $0x10,%rsp
  cmpb   $0x0,0x2b(%rsp)
  je     L26
  mov    0x8(%rsp),%rsi
  mov    %r15,%rcx
  mov    $0x0,%r8d
  jmp    L22
L177:
  movb   $0x0,0x2b(%rsp)
  jmp    L8
L289:
  test   %r12d,%r12d
  setg   0x2b(%rsp)
  movzbl 0x2b(%rsp),%eax
  cmpl   $0x0,0x14(%rsp)
  jne    L149
  test   %al,%al
  jne    L44
  jmp    L149
L242:
  mov    %r14d,%esi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    (%r15),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D9
datatype: string

tool: D9: iterated %d times


assistant: ```c
float **kmeans_clustering(float **feature, int nfeatures, int npoints, int nclusters, float threshold, int *membership) {
  int i, j, n = 0;
  int loop = 0, temp;
  int *new_centers_len;
  float delta;
  float **clusters;
  float **new_centers;
  int *initial;
  int initial_points;
  int c = 0;
  if (nclusters > npoints)
    nclusters = npoints;
  clusters = (float **)malloc(nclusters * sizeof(float *));
  clusters[0] = (float *)malloc(nclusters * nfeatures * sizeof(float));
  for (i = 1; i < nclusters; i++)
    clusters[i] = clusters[i - 1] + nfeatures;
  initial = (int *)malloc(npoints * sizeof(int));
  for (i = 0; i < npoints; i++) {
    initial[i] = i;
  }
  initial_points = npoints;
  for (i = 0; i < nclusters && initial_points >= 0; i++) {
    for (j = 0; j < nfeatures; j++)
      clusters[i][j] = feature[initial[n]][j];
    temp = initial[n];
    initial[n] = initial[initial_points - 1];
    initial[initial_points - 1] = temp;
    initial_points--;
    n++;
  }
  for (i = 0; i < npoints; i++)
    membership[i] = -1;
  new_centers_len = (int *)calloc(nclusters, sizeof(int));
  new_centers = (float **)malloc(nclusters * sizeof(float *));
  new_centers[0] = (float *)calloc(nclusters * nfeatures, sizeof(float));
  for (i = 1; i < nclusters; i++)
    new_centers[i] = new_centers[i - 1] + nfeatures;
  do {
    delta = 0.0;
    delta = (float)kmeansCuda(feature, nfeatures, npoints, nclusters, membership, clusters, new_centers_len, new_centers);
    for (i = 0; i < nclusters; i++) {
      for (j = 0; j < nfeatures; j++) {
        if (new_centers_len[i] > 0)
          clusters[i][j] = new_centers[i][j] / new_centers_len[i];
        new_centers[i][j] = 0.0;
      }
      new_centers_len[i] = 0;
    }
    c++;
  } while ((delta > threshold) && (loop++ < 500));
  printf("iterated %d times\n", c);
  free(new_centers[0]);
  free(new_centers);
  free(new_centers_len);
  return clusters;
}
```