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

```asm
<somassign>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %edi,%r14d
  mov    %esi,0x40(%rsp)
  mov    %rdx,0x8(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %r9d,0x2c(%rsp)
  mov    0xc0(%rsp),%r15
  mov    0xc8(%rsp),%eax
  test   %r9d,%r9d
  je     L253
  movsbl %al,%edi
  mov    $0x0,%eax
  call   <setmetric@plt>
  cltq
  mov    %rax,0x38(%rsp)
  movslq %r14d,%rbx
  shl    $0x3,%rbx
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  test   %r14d,%r14d
  jle    L143
  mov    0x30(%rsp),%rsi
  mov    %rsi,%rbx
  mov    %r14d,%eax
  lea    (%rsi,%rax,8),%r12
L68:
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  movl   $0x1,(%rax)
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L68
  cmpl   $0x0,0x40(%rsp)
  jle    L165
L12:
  lea    -0x1(%r14),%eax
  lea    0x8(,%rax,8),%r13
  movq   $0x0,0x68(%rsp)
  movl   $0x0,0x5c(%rsp)
  movl   $0x0,0x58(%rsp)
  mov    0xb0(%rsp),%eax
  mov    %rax,0x60(%rsp)
  mov    %r14d,%r12d
  jmp    L323
L325:
  add    $0x1,%ebx
  cmp    %ebx,%r12d
  je     L52
L406:
  sub    $0x8,%rsp
  push   $0x0
  push   %rbx
  push   %r14
  mov    0x38(%rsp),%r9
  mov    %r15,%r8
  mov    0x30(%rsp),%rcx
  mov    0x0(%rbp),%rdx
  mov    0x28(%rsp),%rsi
  mov    0x60(%rsp),%edi
  call   *%r13
  add    $0x20,%rsp
  movsd  0x20(%rsp),%xmm1
  comisd %xmm0,%xmm1
  jbe    L325
  movsd  %xmm0,0x20(%rsp)
  mov    %ebx,0x38(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x30(%rsp)
  jmp    L325
L52:
  addl   $0x1,0x44(%rsp)
  mov    0x44(%rsp),%eax
  add    $0x8,%rbp
  cmp    %eax,0xb0(%rsp)
  je     L231
L399:
  mov    0x2c(%rsp),%ebx
  mov    0x44(%rsp),%eax
  mov    %eax,0x28(%rsp)
  test   %r12d,%r12d
  jg     L406
  jmp    L52
L155:
  mov    0x2c(%rsp),%eax
  mov    %eax,0x38(%rsp)
  mov    %eax,0x30(%rsp)
L231:
  mov    0xd0(%rsp),%rsi
  mov    0x50(%rsp),%rax
  mov    0x30(%rsp),%edi
  mov    %edi,(%rsi,%rax,8)
  mov    0x38(%rsp),%edi
  mov    %edi,0x4(%rsi,%rax,8)
  add    $0x1,%rax
  mov    %rax,0x50(%rsp)
  cmp    %eax,0x58(%rsp)
  jle    L350
L290:
  mov    0x50(%rsp),%rax
  mov    %eax,%r14d
  sub    $0x8,%rsp
  push   $0x0
  push   $0x0
  push   %rax
  mov    0x38(%rsp),%r9
  mov    %r15,%r8
  mov    0x30(%rsp),%rcx
  mov    0xe0(%rsp),%rax
  mov    (%rax),%rdx
  mov    0x28(%rsp),%rsi
  mov    0x60(%rsp),%edi
  call   *%r13
  movsd  %xmm0,0x40(%rsp)
  add    $0x20,%rsp
  cmpl   $0x0,0xb0(%rsp)
  jle    L155
  mov    0xc0(%rsp),%rbp
  mov    0x2c(%rsp),%eax
  mov    %eax,0x44(%rsp)
  mov    %eax,0x38(%rsp)
  mov    %eax,0x30(%rsp)
  jmp    L399
L350:
  cmpl   $0x0,0xb8(%rsp)
  jle    L189
L62:
  mov    $0x0,%ebx
  mov    0x48(%rsp),%rbp
L411:
  mov    0x0(%rbp,%rbx,8),%rdi
  call   <free@plt>
  add    $0x1,%rbx
  cmp    %ebx,0xb8(%rsp)
  jg     L411
L189:
  mov    0x48(%rsp),%rdi
  call   <free@plt>
L248:
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L86:
  add    $0x1,%rbx
  cmp    0x48(%rsp),%rbx
  je     L324
L280:
  mov    %ebx,0x28(%rsp)
  test   %r12d,%r12d
  jle    L146
  mov    (%r15,%r14,8),%rax
  lea    (%rax,%rbx,8),%rcx
  mov    $0x0,%eax
L292:
  mov    %rax,%rdx
  add    (%rcx),%rdx
  mov    %rdx,0x0(%rbp,%rax,1)
  add    $0x8,%rax
  cmp    %r13,%rax
  jne    L292
L146:
  sub    $0x8,%rsp
  mov    0x34(%rsp),%eax
  push   %rax
  push   $0x0
  mov    0x5c(%rsp),%eax
  push   %rax
  mov    0x38(%rsp),%r9
  mov    0x50(%rsp),%r8
  mov    0x30(%rsp),%rcx
  mov    %rbp,%rdx
  mov    0x28(%rsp),%rsi
  mov    %r12d,%edi
  mov    0x58(%rsp),%rax
  call   *%rax
  add    $0x20,%rsp
  movsd  0x20(%rsp),%xmm2
  comisd %xmm0,%xmm2
  jbe    L86
  movsd  %xmm0,0x20(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x5c(%rsp)
  mov    0x50(%rsp),%eax
  mov    %eax,0x58(%rsp)
  jmp    L86
L324:
  add    $0x1,%r14
  cmp    %r14,0x60(%rsp)
  je     L114
L132:
  mov    %r14d,0x50(%rsp)
  cmpl   $0x0,0xb8(%rsp)
  jle    L324
  mov    $0x0,%ebx
  jmp    L280
L114:
  mov    0xd0(%rsp),%rsi
  mov    0x68(%rsp),%rax
  mov    0x58(%rsp),%edi
  mov    %edi,(%rsi,%rax,8)
  mov    0x5c(%rsp),%edi
  mov    %edi,0x4(%rsi,%rax,8)
  add    $0x1,%rax
  mov    %rax,0x68(%rsp)
  cmp    %eax,0x40(%rsp)
  jle    L333
L323:
  mov    0x68(%rsp),%eax
  mov    %eax,0x44(%rsp)
  test   %r12d,%r12d
  jle    L410
  movslq 0x58(%rsp),%rdx
  movslq 0x5c(%rsp),%rax
  mov    (%r15,%rdx,8),%rdx
  lea    (%rdx,%rax,8),%rcx
  mov    $0x0,%eax
L73:
  mov    %rax,%rdx
  add    (%rcx),%rdx
  mov    %rdx,0x0(%rbp,%rax,1)
  add    $0x8,%rax
  cmp    %rax,%r13
  jne    L73
L410:
  sub    $0x8,%rsp
  mov    0x34(%rsp),%eax
  push   %rax
  push   $0x0
  mov    0x5c(%rsp),%eax
  push   %rax
  mov    0x38(%rsp),%r9
  mov    0x50(%rsp),%r8
  mov    0x30(%rsp),%rcx
  mov    %rbp,%rdx
  mov    0x28(%rsp),%rsi
  mov    %r12d,%edi
  mov    0x58(%rsp),%rax
  call   *%rax
  movsd  %xmm0,0x40(%rsp)
  add    $0x20,%rsp
  cmpl   $0x0,0xb0(%rsp)
  jle    L114
  mov    $0x0,%r14d
  mov    0xb8(%rsp),%eax
  mov    %rax,0x48(%rsp)
  jmp    L132
L333:
  mov    %r12d,%r14d
  mov    %rbp,%rdi
  call   <free@plt>
  test   %r12d,%r12d
  jle    L261
L429:
  mov    $0x0,%ebx
  mov    0x30(%rsp),%rbp
L348:
  mov    0x0(%rbp,%rbx,8),%rdi
  call   <free@plt>
  add    $0x1,%rbx
  cmp    %ebx,%r14d
  jg     L348
L261:
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  jmp    L248
L258:
  test   %r14d,%r14d
  jg     L171
  jmp    L189
L165:
  mov    %rbp,%rdi
  call   <free@plt>
  jmp    L429
L143:
  cmpl   $0x0,0x40(%rsp)
  jg     L12
  mov    %rbp,%rdi
  call   <free@plt>
  jmp    L261
L253:
  movsbl %al,%edi
  mov    $0x0,%eax
  call   <setmetric@plt>
  movslq %eax,%r13
  movslq 0xb8(%rsp),%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,0x48(%rsp)
  cmpl   $0x0,0xb8(%rsp)
  jle    L258
  mov    0x40(%rsp),%esi
  movslq %esi,%rax
  shl    $0x2,%rax
  mov    %rax,0x20(%rsp)
  mov    0x48(%rsp),%rdi
  mov    %rdi,%rbp
  mov    0xb8(%rsp),%eax
  lea    (%rdi,%rax,8),%r12
  lea    -0x1(%rsi),%eax
  lea    0x4(,%rax,4),%rbx
L332:
  mov    0x20(%rsp),%rdi
  call   <malloc@plt>
  mov    %rbp,%rcx
  mov    %rax,0x0(%rbp)
  cmpl   $0x0,0x40(%rsp)
  jle    L365
  mov    $0x0,%eax
L116:
  mov    (%rcx),%rdx
  movl   $0x1,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rbx,%rax
  jne    L116
L365:
  add    $0x8,%rbp
  cmp    %rbp,%r12
  jne    L332
  test   %r14d,%r14d
  jle    L62
L171:
  movq   $0x0,0x50(%rsp)
  mov    %r14d,0x58(%rsp)
  mov    0xb8(%rsp),%r12d
  mov    %r15,0xc0(%rsp)
  mov    0x48(%rsp),%r15
  jmp    L290
```

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