user: 请将以下的汇编代码转换成C语言代码：

```asm
<somassign>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %edi,-0x84(%rbp)
  mov    %esi,-0x88(%rbp)
  mov    %rdx,-0x90(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0xa0(%rbp)
  mov    %r9d,-0xa4(%rbp)
  mov    0x28(%rbp),%eax
  mov    %al,-0xa8(%rbp)
  cmpl   $0x0,-0xa4(%rbp)
  jne    L257
  mov    -0x88(%rbp),%eax
  jmp    L163
L257:
  mov    -0x84(%rbp),%eax
L163:
  mov    %eax,-0x54(%rbp)
  movsbl -0xa8(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <setmetric@plt>
  cltq
  mov    %rax,-0x40(%rbp)
  cmpl   $0x0,-0xa4(%rbp)
  jne    L310
  mov    0x18(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x7c(%rbp)
  jmp    L82
L161:
  mov    -0x88(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x20(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  movl   $0x0,-0x78(%rbp)
  jmp    L102
L194:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x78(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  addl   $0x1,-0x78(%rbp)
L102:
  mov    -0x78(%rbp),%eax
  cmp    -0x88(%rbp),%eax
  jl     L194
  addl   $0x1,-0x7c(%rbp)
L82:
  mov    -0x7c(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L161
  movl   $0x0,-0x7c(%rbp)
  jmp    L155
L284:
  movl   $0x0,-0x74(%rbp)
  movl   $0x0,-0x70(%rbp)
  mov    -0x74(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xa0(%rbp),%r9
  mov    -0x20(%rbp),%r8
  mov    -0x98(%rbp),%rcx
  mov    -0x90(%rbp),%rsi
  mov    -0x54(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0xa4(%rbp),%edi
  push   %rdi
  mov    -0x70(%rbp),%edi
  push   %rdi
  mov    -0x7c(%rbp),%edi
  push   %rdi
  mov    -0x40(%rbp),%r10
  mov    %eax,%edi
  call   *%r10
  add    $0x20,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x50(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L179
L168:
  movl   $0x0,-0x68(%rbp)
  jmp    L123
L262:
  mov    -0x6c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xa0(%rbp),%r9
  mov    -0x20(%rbp),%r8
  mov    -0x98(%rbp),%rcx
  mov    -0x90(%rbp),%rsi
  mov    -0x54(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0xa4(%rbp),%edi
  push   %rdi
  mov    -0x68(%rbp),%edi
  push   %rdi
  mov    -0x7c(%rbp),%edi
  push   %rdi
  mov    -0x40(%rbp),%r10
  mov    %eax,%edi
  call   *%r10
  add    $0x20,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x18(%rbp)
  movsd  -0x50(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L165
  mov    -0x6c(%rbp),%eax
  mov    %eax,-0x74(%rbp)
  mov    -0x68(%rbp),%eax
  mov    %eax,-0x70(%rbp)
  movsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x50(%rbp)
L165:
  addl   $0x1,-0x68(%rbp)
L123:
  mov    -0x68(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L262
  addl   $0x1,-0x6c(%rbp)
L179:
  mov    -0x6c(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L168
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x74(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x70(%rbp),%eax
  mov    %eax,0x4(%rdx)
  addl   $0x1,-0x7c(%rbp)
L155:
  mov    -0x7c(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jl     L284
  movl   $0x0,-0x7c(%rbp)
  jmp    L204
L215:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x7c(%rbp)
L204:
  mov    -0x7c(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L215
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L55
L310:
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x84(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x64(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x7c(%rbp)
  jmp    L42
L288:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  movl   $0x1,(%rax)
  addl   $0x1,-0x7c(%rbp)
L42:
  mov    -0x7c(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jl     L288
  movl   $0x0,-0x7c(%rbp)
  jmp    L268
L282:
  movl   $0x0,-0x78(%rbp)
  jmp    L12
L70:
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x60(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rsi
  mov    -0x38(%rbp),%rax
  add    %rsi,%rax
  add    %rcx,%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x78(%rbp)
L12:
  mov    -0x78(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L70
  mov    -0xa0(%rbp),%r9
  mov    -0x30(%rbp),%r8
  mov    -0x98(%rbp),%rcx
  mov    -0x38(%rbp),%rdx
  mov    -0x90(%rbp),%rsi
  mov    -0x54(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0xa4(%rbp),%edi
  push   %rdi
  push   $0x0
  mov    -0x7c(%rbp),%edi
  push   %rdi
  mov    -0x40(%rbp),%r10
  mov    %eax,%edi
  call   *%r10
  add    $0x20,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x48(%rbp)
  movl   $0x0,-0x5c(%rbp)
  jmp    L249
L266:
  movl   $0x0,-0x58(%rbp)
  jmp    L127
L62:
  movl   $0x0,-0x78(%rbp)
  jmp    L245
L106:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x78(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rsi
  mov    -0x38(%rbp),%rax
  add    %rsi,%rax
  add    %rcx,%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x78(%rbp)
L245:
  mov    -0x78(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L106
  mov    -0xa0(%rbp),%r9
  mov    -0x30(%rbp),%r8
  mov    -0x98(%rbp),%rcx
  mov    -0x38(%rbp),%rdx
  mov    -0x90(%rbp),%rsi
  mov    -0x54(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0xa4(%rbp),%edi
  push   %rdi
  push   $0x0
  mov    -0x7c(%rbp),%edi
  push   %rdi
  mov    -0x40(%rbp),%r10
  mov    %eax,%edi
  call   *%r10
  add    $0x20,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x28(%rbp)
  movsd  -0x48(%rbp),%xmm0
  comisd -0x28(%rbp),%xmm0
  jbe    L139
  mov    -0x5c(%rbp),%eax
  mov    %eax,-0x64(%rbp)
  mov    -0x58(%rbp),%eax
  mov    %eax,-0x60(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,-0x48(%rbp)
L139:
  addl   $0x1,-0x58(%rbp)
L127:
  mov    -0x58(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L62
  addl   $0x1,-0x5c(%rbp)
L249:
  mov    -0x5c(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L266
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x64(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x60(%rbp),%eax
  mov    %eax,0x4(%rdx)
  addl   $0x1,-0x7c(%rbp)
L268:
  mov    -0x7c(%rbp),%eax
  cmp    -0x88(%rbp),%eax
  jl     L282
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movl   $0x0,-0x7c(%rbp)
  jmp    L24
L212:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x7c(%rbp)
L24:
  mov    -0x7c(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jl     L212
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
L55:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void somassign(int nrows, int ncolumns, double **data, int **mask, const double weights[], int transpose, int nxgrid, int nygrid, double ***celldata, char dist, int clusterid[][2]) {
  const int ndata = (transpose == 0) ? ncolumns : nrows;
  int i, j;
  double (*metric)(int, double **, double **, int **, int **, const double[], int, int, int) = setmetric(dist);
  if (transpose == 0) {
    int **dummymask = malloc(nygrid * sizeof(int *));
    for (i = 0; i < nygrid; i++) {
      dummymask[i] = malloc(ncolumns * sizeof(int));
      for (j = 0; j < ncolumns; j++)
        dummymask[i][j] = 1;
    }
    for (i = 0; i < nrows; i++) {
      int ixbest = 0;
      int iybest = 0;
      double closest = metric(ndata, data, celldata[ixbest], mask, dummymask, weights, i, iybest, transpose);
      int ix, iy;
      for (ix = 0; ix < nxgrid; ix++) {
        for (iy = 0; iy < nygrid; iy++) {
          double distance = metric(ndata, data, celldata[ix], mask, dummymask, weights, i, iy, transpose);
          if (distance < closest) {
            ixbest = ix;
            iybest = iy;
            closest = distance;
          }
        }
      }
      clusterid[i][0] = ixbest;
      clusterid[i][1] = iybest;
    }
    for (i = 0; i < nygrid; i++)
      free(dummymask[i]);
    free(dummymask);
  } else {
    double **celldatavector = malloc(ndata * sizeof(double *));
    int **dummymask = malloc(nrows * sizeof(int *));
    int ixbest = 0;
    int iybest = 0;
    for (i = 0; i < nrows; i++) {
      dummymask[i] = malloc(sizeof(int));
      dummymask[i][0] = 1;
    }
    for (i = 0; i < ncolumns; i++) {
      double closest;
      int ix, iy;
      for (j = 0; j < ndata; j++)
        celldatavector[j] = &(celldata[ixbest][iybest][j]);
      closest = metric(ndata, data, celldatavector, mask, dummymask, weights, i, 0, transpose);
      for (ix = 0; ix < nxgrid; ix++) {
        for (iy = 0; iy < nygrid; iy++) {
          double distance;
          for (j = 0; j < ndata; j++)
            celldatavector[j] = &(celldata[ix][iy][j]);
          distance = metric(ndata, data, celldatavector, mask, dummymask, weights, i, 0, transpose);
          if (distance < closest) {
            ixbest = ix;
            iybest = iy;
            closest = distance;
          }
        }
      }
      clusterid[i][0] = ixbest;
      clusterid[i][1] = iybest;
    }
    free(celldatavector);
    for (i = 0; i < nrows; i++)
      free(dummymask[i]);
    free(dummymask);
  }
  return;
}
```