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

```asm
<cluster_statistics>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    %esi,0x10(%rsp)
  imul   %edx,%esi
  mov    %r9,0x8(%rsp)
  mov    %r8,(%rsp)
  mov    %esi,%edx
  mov    %esi,%r14d
  shr    $0x1f,%edx
  add    %esi,%edx
  sar    %edx
  lea    0x3(%rdx),%ebp
  mov    %edx,0x20(%rsp)
  movslq %ebp,%rbp
  shl    $0x2,%rbp
  mov    %rbp,%rdi
  call   <malloc@plt>
  mov    %rbp,%rdi
  mov    %rax,0x18(%rsp)
  call   <malloc@plt>
  lea    0x1(%r14),%edi
  movslq %edi,%rdi
  mov    %rax,%rbp
  shl    $0x2,%rdi
  call   <malloc@plt>
  cmp    $0xfffffffb,%r14d
  mov    0x18(%rsp),%r9
  mov    0x20(%rsp),%edx
  mov    %rax,%r12
  jl     L20
  lea    0x2(%rdx),%eax
  mov    %r9,%rdi
  mov    $0xff,%esi
  mov    %r9,0x18(%rsp)
  lea    0x4(,%rax,4),%rdx
  mov    %rdx,0x20(%rsp)
  call   <memset@plt>
  mov    0x20(%rsp),%rdx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    0x18(%rsp),%r9
L20:
  movslq %r14d,%rdi
  xor    %eax,%eax
  xor    %r10d,%r10d
  lea    (%r12,%rdi,4),%r8
  test   %r14d,%r14d
  jle    L412
  nopw   0x0(%rax,%rax,1)
L126:
  mov    (%rbx,%rax,4),%edx
  movl   $0xffffffff,(%r12,%rax,4)
  test   %edx,%edx
  je     L22
  movslq %edx,%rcx
  lea    (%r9,%rcx,4),%rsi
  movslq (%rsi),%rdx
  test   %edx,%edx
  jns    L370
  mov    %r10d,(%rsi)
  movslq (%r9,%rcx,4),%rdx
  add    $0x1,%r10d
L370:
  addl   $0x1,0x0(%rbp,%rdx,4)
L22:
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L126
  movl   $0xffffffff,(%r8)
  movslq %r10d,%rdx
  mov    %rdx,%rdi
  mov    %r9,0x28(%rsp)
  mov    %r10d,0x20(%rsp)
  mov    %rdx,0x18(%rsp)
  call   <malloc@plt>
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%r10d
  mov    %rax,%r8
  mov    0x28(%rsp),%r9
  lea    0x0(,%rdx,4),%rax
  test   %r10d,%r10d
  mov    %rax,0x18(%rsp)
  je     L197
  mov    %r8,%rdi
  xor    %esi,%esi
  call   <memset@plt>
  mov    0x28(%rsp),%r9
  mov    0x20(%rsp),%r10d
  mov    %rax,%r8
L197:
  test   %r15d,%r15d
  jle    L98
  mov    0x10(%rsp),%eax
  lea    -0x1(%r15),%edx
  sub    $0x1,%eax
  imul   %r15d,%eax
  cltq
  lea    (%rbx,%rax,4),%rdi
  add    %rdx,%rax
  lea    0x4(%rbx,%rax,4),%rsi
  xor    %eax,%eax
L179:
  cltq
L57:
  movslq (%rbx,%rax,4),%rdx
  mov    %eax,%ecx
  test   %edx,%edx
  jne    L154
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L57
L98:
  mov    0x10(%rsp),%ecx
  test   %ecx,%ecx
  jle    L338
  cmp    $0x1,%r15d
  jne    L454
  lea    -0x1(%r14),%eax
  xor    %edx,%edx
  lea    0x4(%rbx,%rax,4),%rsi
L268:
  movslq %edx,%rdx
L141:
  movslq (%rbx,%rdx,4),%rax
  mov    %edx,%ecx
  test   %eax,%eax
  jne    L428
  add    $0x1,%rdx
  cmp    %edx,%r14d
  jg     L141
  cs nopw 0x0(%rax,%rax,1)
L338:
  mov    %r9,%rdi
  mov    %r8,0x20(%rsp)
  mov    %r10d,0x10(%rsp)
  call   <free@plt>
  mov    0x18(%rsp),%rbx
  movl   $0x0,0x0(%r13)
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    (%rsp),%rcx
  mov    %rbx,%rdi
  mov    %rax,(%rcx)
  call   <malloc@plt>
  mov    0x8(%rsp),%rcx
  mov    %rbx,%rdi
  mov    %rax,(%rcx)
  call   <malloc@plt>
  mov    0x10(%rsp),%r10d
  mov    0x20(%rsp),%r8
  mov    %rax,%rbx
  mov    0x70(%rsp),%rax
  test   %r10d,%r10d
  mov    %rbx,(%rax)
  je     L457
  mov    (%rsp),%rax
  movslq %r10d,%r9
  lea    0x0(,%r9,4),%rdx
  mov    (%rax),%rcx
  mov    0x8(%rsp),%rax
  mov    (%rax),%r15
  lea    (%rbx,%rdx,1),%rax
  lea    (%rcx,%rdx,1),%rdi
  cmp    %rax,%r15
  lea    (%r15,%rdx,1),%r10
  setae  %sil
  cmp    %r10,%rbx
  setae  %r11b
  or     %r11d,%esi
  cmp    %rax,%rcx
  setae  %al
  cmp    %rdi,%rbx
  setae  %r11b
  or     %r11d,%eax
  test   %al,%sil
  je     L397
  cmp    %r10,%rcx
  setae  %al
  cmp    %rdi,%r15
  setae  %sil
  or     %sil,%al
  je     L397
  mov    %rcx,%rdi
  xor    %esi,%esi
  mov    %r9,0x28(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %rdx,0x10(%rsp)
  call   <memset@plt>
  mov    0x10(%rsp),%rdx
  xor    %esi,%esi
  mov    %r15,%rdi
  call   <memset@plt>
  mov    0x10(%rsp),%rdx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    0x18(%rsp),%rcx
  mov    0x20(%rsp),%r8
  mov    0x28(%rsp),%r9
L437:
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L233:
  movslq 0x0(%rbp,%rdx,4),%rax
  lea    (%r12,%rax,4),%rsi
  mov    %rax,%rdi
  movslq (%rsi),%rax
  test   %eax,%eax
  jns    L62
  movslq 0x0(%r13),%rax
  lea    0x1(%rax),%r10d
  mov    %eax,(%rsi)
  mov    %r10d,0x0(%r13)
L62:
  mov    %edi,(%rcx,%rax,4)
  movslq (%rsi),%rax
  addl   $0x1,(%r15,%rax,4)
  movslq (%rsi),%rax
  movsbl (%r8,%rdx,1),%esi
  add    $0x1,%rdx
  add    %esi,(%rbx,%rax,4)
  cmp    %rdx,%r9
  jne    L233
L457:
  mov    %rbp,%rdi
  mov    %r8,0x10(%rsp)
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    (%rsp),%rbx
  movslq 0x0(%r13),%rsi
  mov    (%rbx),%rdi
  shl    $0x2,%rsi
  call   <realloc@plt>
  movslq 0x0(%r13),%rsi
  mov    %rax,(%rbx)
  mov    0x8(%rsp),%rbx
  shl    $0x2,%rsi
  mov    (%rbx),%rdi
  call   <realloc@plt>
  movslq 0x0(%r13),%rsi
  mov    %rax,(%rbx)
  mov    0x70(%rsp),%rax
  shl    $0x2,%rsi
  mov    (%rax),%rdi
  call   <realloc@plt>
  mov    0x70(%rsp),%rcx
  cmpq   $0x0,0x78(%rsp)
  mov    %rax,(%rcx)
  je     L284
  cmpq   $0x0,0x80(%rsp)
  je     L284
  mov    0x78(%rsp),%rax
  movl   $0x0,(%rax)
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jle    L324
  mov    %rax,%r8
  mov    (%rsp),%rax
  xor    %ecx,%ecx
  mov    (%rax),%rdi
  mov    0x8(%rsp),%rax
  mov    (%rax),%rsi
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L279:
  mov    (%rdi,%rax,4),%edx
  imul   (%rsi,%rax,4),%edx
  add    $0x1,%rax
  add    %edx,%ecx
  mov    %ecx,(%r8)
  cmp    %eax,0x0(%r13)
  jg     L279
  sub    %ecx,%r14d
L324:
  mov    0x80(%rsp),%rax
  mov    %r14d,(%rax)
L284:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L154:
  mov    %rdi,%rax
  jmp    L137
  nopl   (%rax)
L192:
  add    $0x4,%rax
  cmp    %rax,%rsi
  je     L361
L137:
  cmp    (%rax),%edx
  jne    L192
  movslq (%r9,%rdx,4),%rax
  movb   $0x1,(%r8,%rax,1)
  jmp    L338
  nopl   0x0(%rax,%rax,1)
L428:
  mov    %rbx,%rdx
  jmp    L153
  nopl   (%rax)
L5:
  add    $0x4,%rdx
  cmp    %rdx,%rsi
  je     L242
L153:
  cmp    %eax,(%rdx)
  jne    L5
L125:
  movslq (%r9,%rax,4),%rax
  movb   $0x1,(%r8,%rax,1)
  jmp    L338
  nopl   0x0(%rax,%rax,1)
L361:
  lea    0x1(%rcx),%eax
  cmp    %eax,%r15d
  jg     L179
  jmp    L98
  nopl   0x0(%rax)
L242:
  lea    0x1(%rcx),%edx
  cmp    %edx,%r14d
  jg     L268
  jmp    L338
  nopl   0x0(%rax)
L454:
  movslq %r15d,%rdi
  mov    0x10(%rsp),%r11d
  mov    %r15d,0x10(%rsp)
  xor    %edx,%edx
  shl    $0x2,%rdi
  lea    (%rbx,%rdi,1),%rax
  mov    %rax,0x20(%rsp)
L444:
  mov    0x10(%rsp),%eax
  mov    %edx,%r15d
  imul   %edx,%eax
  cltq
  lea    (%rbx,%rax,4),%rax
  mov    (%rax),%esi
  test   %esi,%esi
  jne    L88
L152:
  add    $0x1,%r15d
  add    %rdi,%rax
  cmp    %r15d,%r11d
  jle    L338
  mov    (%rax),%esi
  test   %esi,%esi
  je     L152
L88:
  mov    0x20(%rsp),%rdx
  xor    %ecx,%ecx
  jmp    L261
  nopl   0x0(%rax)
L133:
  lea    0x1(%rcx),%eax
  add    %rdi,%rdx
  cmp    %eax,%r11d
  je     L73
  mov    %eax,%ecx
L261:
  movslq -0x4(%rdx),%rax
  cmp    %eax,%esi
  jne    L133
  jmp    L125
L73:
  lea    0x1(%r15),%edx
  cmp    %ecx,%r15d
  jl     L444
  jmp    L338
L412:
  movl   $0xffffffff,(%r8)
  xor    %edi,%edi
  mov    %r9,0x28(%rsp)
  mov    %r10d,0x20(%rsp)
  call   <malloc@plt>
  mov    0x20(%rsp),%r10d
  mov    0x28(%rsp),%r9
  movq   $0x0,0x18(%rsp)
  mov    %rax,%r8
  jmp    L197
L397:
  xor    %eax,%eax
  nopl   (%rax)
L280:
  movl   $0x0,(%rcx,%rax,4)
  movl   $0x0,(%r15,%rax,4)
  movl   $0x0,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %r9,%rax
  jne    L280
  jmp    L437
```

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