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

```asm
<cluster_statistics>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %esi,%ebx
  mov    %edx,0x34(%rsp)
  mov    %rcx,0x20(%rsp)
  mov    %r8,%r12
  mov    %r9,%r13
  mov    0x80(%rsp),%r14
  imul   %esi,%edx
  mov    %edx,%r15d
  shr    $0x1f,%r15d
  mov    %edx,0x1c(%rsp)
  add    %edx,%r15d
  sar    %r15d
  mov    %r15d,0x10(%rsp)
  lea    0x3(%r15),%ebp
  movslq %ebp,%rbp
  shl    $0x2,%rbp
  mov    %rbp,%rdi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rbp,%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    0x1c(%rsp),%edx
  lea    0x1(%rdx),%edi
  movslq %edi,%rdi
  shl    $0x2,%rdi
  call   <malloc@plt>
  mov    %rax,%r15
  cmpl   $0xfffffffb,0x1c(%rsp)
  jl     L270
  mov    0x10(%rsp),%edi
  lea    0x2(%rdi),%ecx
  mov    $0x0,%eax
  mov    0x8(%rsp),%rsi
L121:
  movl   $0xffffffff,(%rsi,%rax,4)
  movl   $0x0,0x0(%rbp,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %rcx,%rdx
  jne    L121
L270:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L234
  mov    %eax,%ecx
  mov    $0x0,%eax
  mov    $0x0,%edi
  mov    0x8(%rsp),%r8
  mov    0x28(%rsp),%rsi
  jmp    L65
L189:
  movslq (%rdx),%rdx
  addl   $0x1,0x0(%rbp,%rdx,4)
L193:
  add    $0x1,%rax
  cmp    %rcx,%rax
  je     L333
L65:
  movl   $0xffffffff,(%r15,%rax,4)
  mov    (%rsi,%rax,4),%edx
  test   %edx,%edx
  je     L193
  movslq %edx,%rdx
  lea    (%r8,%rdx,4),%rdx
  cmpl   $0x0,(%rdx)
  jns    L189
  mov    %edi,(%rdx)
  add    $0x1,%edi
  jmp    L189
L333:
  movslq 0x1c(%rsp),%rax
  movl   $0xffffffff,(%r15,%rax,4)
  mov    %edi,0x30(%rsp)
  movslq %edi,%rax
  mov    %rax,0x38(%rsp)
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  mov    0x30(%rsp),%edi
  test   %edi,%edi
  jle    L288
  mov    %edi,%edx
  add    %rax,%rdx
L85:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L85
L288:
  mov    0x34(%rsp),%r11d
  test   %r11d,%r11d
  jle    L111
  mov    0x28(%rsp),%r10
  mov    %r10,%rcx
  lea    -0x1(%r11),%edx
  lea    0x4(%r10),%rsi
  lea    (%rsi,%rdx,4),%rdi
  lea    -0x1(%rbx),%eax
  imul   %r11d,%eax
  cltq
  lea    (%r10,%rax,4),%r8
  add    %rdx,%rax
  lea    (%rsi,%rax,4),%rsi
  jmp    L264
L127:
  movslq %edx,%rdx
  mov    0x8(%rsp),%rax
  movslq (%rax,%rdx,4),%rax
  mov    0x10(%rsp),%rbx
  movb   $0x1,(%rbx,%rax,1)
  jmp    L69
L287:
  add    $0x4,%rcx
  cmp    %rdi,%rcx
  je     L111
L264:
  mov    (%rcx),%edx
  test   %edx,%edx
  je     L287
  mov    %r8,%rax
L23:
  cmp    (%rax),%edx
  je     L127
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L23
  jmp    L287
L111:
  test   %ebx,%ebx
  jle    L69
  movslq 0x34(%rsp),%rsi
  shl    $0x2,%rsi
  mov    0x28(%rsp),%r9
  mov    %r9,%rdi
  add    %rsi,%r9
  mov    $0x0,%r8d
  jmp    L122
L40:
  movslq %ecx,%rcx
  mov    0x8(%rsp),%rax
  movslq (%rax,%rcx,4),%rax
  mov    0x10(%rsp),%rbx
  movb   $0x1,(%rbx,%rax,1)
L69:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rsp),%rbx
  shl    $0x2,%rbx
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,(%r12)
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,0x0(%r13)
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,(%r14)
  mov    0x30(%rsp),%eax
  test   %eax,%eax
  jle    L327
  mov    %eax,%edi
  lea    0x0(,%rdi,4),%rcx
  mov    $0x0,%eax
L233:
  mov    (%r12),%rdx
  movl   $0x0,(%rdx,%rax,1)
  mov    0x0(%r13),%rdx
  movl   $0x0,(%rdx,%rax,1)
  mov    (%r14),%rdx
  movl   $0x0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L233
  mov    $0x0,%edx
  mov    0x10(%rsp),%r8
  mov    0x20(%rsp),%r9
  jmp    L249
L75:
  add    $0x1,%r8d
  add    %rsi,%rdi
  cmp    %r8d,%ebx
  jle    L69
L122:
  mov    (%rdi),%ecx
  test   %ecx,%ecx
  je     L75
  mov    %r9,%rax
  mov    $0x0,%edx
L77:
  cmp    -0x4(%rax),%ecx
  je     L40
  add    $0x1,%edx
  add    %rsi,%rax
  cmp    %edx,%ebx
  jg     L77
  jmp    L75
L134:
  movslq (%rax),%rcx
  lea    0x0(,%rcx,4),%rax
  mov    (%r12),%r10
  mov    %esi,(%r10,%rcx,4)
  mov    %rax,%rcx
  add    0x0(%r13),%rcx
  addl   $0x1,(%rcx)
  add    (%r14),%rax
  movsbl (%r8,%rdx,1),%ecx
  add    %ecx,(%rax)
  add    $0x1,%rdx
  cmp    %rdx,%rdi
  je     L327
L249:
  mov    0x0(%rbp,%rdx,4),%esi
  movslq %esi,%rax
  lea    (%r15,%rax,4),%rax
  cmpl   $0x0,(%rax)
  jns    L134
  mov    (%r9),%ecx
  mov    %ecx,(%rax)
  add    $0x1,%ecx
  mov    %ecx,(%r9)
  jmp    L134
L327:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rbx
  movslq (%rbx),%rsi
  shl    $0x2,%rsi
  mov    (%r12),%rdi
  call   <realloc@plt>
  mov    %rax,(%r12)
  movslq (%rbx),%rsi
  shl    $0x2,%rsi
  mov    0x0(%r13),%rdi
  call   <realloc@plt>
  mov    %rax,0x0(%r13)
  movslq (%rbx),%rsi
  shl    $0x2,%rsi
  mov    (%r14),%rdi
  call   <realloc@plt>
  mov    %rax,(%r14)
  cmpq   $0x0,0x88(%rsp)
  je     L300
  cmpq   $0x0,0x90(%rsp)
  je     L300
  mov    0x88(%rsp),%rax
  movl   $0x0,(%rax)
  cmpl   $0x0,(%rbx)
  jle    L260
  mov    $0x0,%eax
  mov    %rbx,%rdi
  mov    0x88(%rsp),%rcx
L72:
  mov    (%r12),%rdx
  mov    0x0(%r13),%rsi
  mov    (%rdx,%rax,4),%edx
  imul   (%rsi,%rax,4),%edx
  add    %edx,(%rcx)
  add    $0x1,%rax
  cmp    %eax,(%rdi)
  jg     L72
L260:
  mov    0x88(%rsp),%rbx
  mov    0x1c(%rsp),%eax
  sub    (%rbx),%eax
  mov    0x90(%rsp),%rbx
  mov    %eax,(%rbx)
L300:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L234:
  movslq 0x1c(%rsp),%rax
  movl   $0xffffffff,(%r15,%rax,4)
  mov    $0x0,%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  movl   $0x0,0x30(%rsp)
  movq   $0x0,0x38(%rsp)
  jmp    L288
```

assistant: ```c
void cluster_statistics(const int *lattice, int rows, int columns, int *cluster_sizes_total_count, int **cluster_sizes, int **cluster_sizes_counts, int **cluster_sizes_percolated, int *filled_count, int *empty_count) {
  int i;
  int j;
  char percolated;
  int lattice_size;
  int cluster_labels_total_count;
  int *cluster_labels_indices;
  int *cluster_labels_sizes;
  char *cluster_labels_percolated;
  int *cluster_sizes_indices;
  lattice_size = rows * columns;
  cluster_labels_total_count = 0;
  cluster_labels_indices = (int *)malloc((lattice_size / 2 + 3) * sizeof(int));
  cluster_labels_sizes = (int *)malloc((lattice_size / 2 + 3) * sizeof(int));
  cluster_sizes_indices = (int *)malloc((lattice_size + 1) * sizeof(int));
  for (i = 0; i < lattice_size / 2 + 3; i++) {
    cluster_labels_indices[i] = -1;
    cluster_labels_sizes[i] = 0;
  }
  for (i = 0; i < lattice_size; i++) {
    cluster_sizes_indices[i] = -1;
    if (lattice[i] == 0) {
      continue;
    }
    if (cluster_labels_indices[lattice[i]] < 0) {
      cluster_labels_indices[lattice[i]] = cluster_labels_total_count;
      cluster_labels_total_count++;
    }
    cluster_labels_sizes[cluster_labels_indices[lattice[i]]] += 1;
  }
  cluster_sizes_indices[lattice_size] = -1;
  cluster_labels_percolated = (char *)malloc(cluster_labels_total_count * sizeof(char));
  for (i = 0; i < cluster_labels_total_count; i++) {
    cluster_labels_percolated[i] = 0;
  }
  percolated = 0;
  for (i = 0; i < columns; i++) {
    if (percolated) {
      break;
    }
    if (lattice[i] == 0) {
      continue;
    }
    for (j = 0; j < columns; j++) {
      if (lattice[i] == lattice[(rows - 1) * columns + j]) {
        cluster_labels_percolated[cluster_labels_indices[lattice[i]]] = 1;
        percolated = 1;
        break;
      }
    }
  }
  for (i = 0; i < rows; i++) {
    if (percolated) {
      break;
    }
    if (lattice[i * columns] == 0) {
      continue;
    }
    for (j = 0; j < rows; j++) {
      if (lattice[i * columns] == lattice[j * columns + columns - 1]) {
        cluster_labels_percolated[cluster_labels_indices[lattice[i * columns]]] = 1;
        percolated = 1;
        break;
      }
    }
  }
  free(cluster_labels_indices);
  *cluster_sizes_total_count = 0;
  *cluster_sizes = (int *)malloc(cluster_labels_total_count * sizeof(int));
  *cluster_sizes_counts = (int *)malloc(cluster_labels_total_count * sizeof(int));
  *cluster_sizes_percolated = (int *)malloc(cluster_labels_total_count * sizeof(int));
  for (i = 0; i < cluster_labels_total_count; i++) {
    (*cluster_sizes)[i] = 0;
    (*cluster_sizes_counts)[i] = 0;
    (*cluster_sizes_percolated)[i] = 0;
  }
  for (i = 0; i < cluster_labels_total_count; i++) {
    if (cluster_sizes_indices[cluster_labels_sizes[i]] < 0) {
      cluster_sizes_indices[cluster_labels_sizes[i]] = *cluster_sizes_total_count;
      (*cluster_sizes_total_count) += 1;
    }
    (*cluster_sizes)[cluster_sizes_indices[cluster_labels_sizes[i]]] = cluster_labels_sizes[i];
    (*cluster_sizes_counts)[cluster_sizes_indices[cluster_labels_sizes[i]]] += 1;
    (*cluster_sizes_percolated)[cluster_sizes_indices[cluster_labels_sizes[i]]] += cluster_labels_percolated[i];
  }
  free(cluster_labels_sizes);
  free(cluster_sizes_indices);
  free(cluster_labels_percolated);
  *cluster_sizes = realloc(*cluster_sizes, (*cluster_sizes_total_count) * sizeof(int));
  *cluster_sizes_counts = realloc(*cluster_sizes_counts, (*cluster_sizes_total_count) * sizeof(int));
  *cluster_sizes_percolated = realloc(*cluster_sizes_percolated, (*cluster_sizes_total_count) * sizeof(int));
  if (filled_count && empty_count) {
    *filled_count = 0;
    for (i = 0; i < *cluster_sizes_total_count; i++) {
      *filled_count += ((*cluster_sizes)[i]) * ((*cluster_sizes_counts)[i]);
    }
    *empty_count = lattice_size - *filled_count;
  }
}
```