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

```asm
<calc_group_dist>:
  endbr64
  push   %r15
  lea    0x1(%rsi),%r15d
  push   %r14
  mov    %edi,%r14d
  lea    0x0(,%r15,8),%edi
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x48,%rsp
  mov    %rcx,0x20(%rsp)
  mov    %r8,0x18(%rsp)
  call   <ckalloc@plt>
  mov    %rax,0x10(%rsp)
  test   %ebx,%ebx
  jle    L47
  lea    -0x1(%rbx),%edi
  shl    $0x2,%r15d
  mov    %rax,%r12
  mov    %edi,0x28(%rsp)
  mov    %ebx,%edi
  mov    %rdi,0x30(%rsp)
  lea    (%rax,%rdi,8),%rbp
  nopl   0x0(%rax,%rax,1)
L51:
  mov    %r15d,%edi
  add    $0x8,%r12
  call   <ckalloc@plt>
  mov    %rax,-0x8(%r12)
  cmp    %rbp,%r12
  jne    L51
  mov    %ebx,%eax
  mov    %ebx,%r9d
  mov    0x18(%rsp),%rsi
  mov    %r14d,0x3c(%rsp)
  and    $0xfffffffc,%r9d
  shr    $0x2,%eax
  mov    0x28(%rsp),%r14d
  pxor   %xmm0,%xmm0
  lea    -0x1(%rax),%ecx
  lea    0x2(%r9),%eax
  mov    %r13,0x28(%rsp)
  mov    %r9d,%r11d
  mov    %eax,0x38(%rsp)
  lea    0x1(%r9),%r15d
  add    $0x1,%rcx
  shl    $0x2,%r11
  movaps D8(%rip),%xmm1
  mov    0x30(%rsp),%r13
  mov    %r15d,0xc(%rsp)
  lea    0x0(,%rax,4),%r12
  mov    0x10(%rsp),%rax
  movss  D8(%rip),%xmm2
  shl    $0x4,%rcx
  shl    $0x2,%r15
  mov    %rax,%rdi
  sub    %rax,%rsi
  nopl   0x0(%rax,%rax,1)
L14:
  mov    (%rsi,%rdi,1),%rax
  mov    (%rdi),%rdx
  lea    0x4(%rax),%r10
  mov    %rdx,%r8
  sub    %r10,%r8
  cmp    $0x8,%r8
  jbe    L61
  xor    %r8d,%r8d
  cmp    $0x3,%r14d
  jbe    L61
  nopl   0x0(%rax,%rax,1)
L79:
  movups %xmm1,(%rax,%r8,1)
  movups %xmm0,(%rdx,%r8,1)
  add    $0x10,%r8
  cmp    %r8,%rcx
  jne    L79
  cmp    %r9d,%ebx
  je     L37
  movss  %xmm2,(%rax,%r11,1)
  movl   $0x0,(%rdx,%r11,1)
  cmp    %ebx,0xc(%rsp)
  jge    L37
  movss  %xmm2,(%rax,%r15,1)
  movl   $0x0,(%rdx,%r15,1)
  cmp    0x38(%rsp),%ebx
  jle    L37
  movss  %xmm2,(%rax,%r12,1)
  movl   $0x0,(%rdx,%r12,1)
L37:
  add    $0x8,%rdi
  cmp    %rbp,%rdi
  jne    L14
  mov    0x3c(%rsp),%r14d
  mov    0x28(%rsp),%r13
  test   %r14d,%r14d
  jle    L115
L159:
  mov    0x20(%rsp),%rdi
  mov    0x18(%rsp),%r9
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L16:
  movslq 0x0(%r13,%r8,4),%rax
  mov    (%rdi,%r8,8),%rcx
  mov    -0x8(%r9,%rax,8),%rsi
  xor    %eax,%eax
L44:
  movslq 0x0(%r13,%rax,4),%rdx
  movsd  (%rcx,%rax,8),%xmm0
  pxor   %xmm1,%xmm1
  lea    -0x4(%rsi,%rdx,4),%rdx
  cvtss2sd (%rdx),%xmm1
  comisd %xmm0,%xmm1
  jbe    L109
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rdx)
L109:
  add    $0x1,%rax
  cmp    %eax,%r14d
  jg     L44
  add    $0x1,%r8
  cmp    %r8d,%r14d
  jg     L16
  test   %ebx,%ebx
  jle    L97
L115:
  mov    0x10(%rsp),%rbp
  xor    %r12d,%r12d
  nopl   0x0(%rax,%rax,1)
L77:
  mov    0x0(%rbp),%rdi
  add    $0x1,%r12d
  add    $0x8,%rbp
  call   <ckfree@plt>
  mov    %rax,-0x8(%rbp)
  cmp    %r12d,%ebx
  jg     L77
L97:
  mov    0x10(%rsp),%rdi
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <ckfree@plt>
  nopw   0x0(%rax,%rax,1)
L61:
  xor    %r8d,%r8d
  nopl   0x0(%rax,%rax,1)
L35:
  movss  %xmm2,(%rax,%r8,4)
  movl   $0x0,(%rdx,%r8,4)
  add    $0x1,%r8
  cmp    %r8,%r13
  jne    L35
  jmp    L37
L47:
  test   %r14d,%r14d
  jg     L159
  jmp    L97
```

tool_calls: name: read_data
arguments: label: D8
type_infered: f32[4]

tool: {"D8": [1000.0,1000.0,1000.0,1000.0]}

assistant: ```c
void calc_group_dist(int nseqs, int naligned_groups, int *aligned_group, double **tmat, float **group_dist) {
  int i, j;
  int **n;
  n = (int **)ckalloc((naligned_groups + 1) * sizeof(int *));
  for (i = 0; i < naligned_groups; i++)
    n[i] = (int *)ckalloc((naligned_groups + 1) * sizeof(int));
  for (i = 0; i < naligned_groups; i++)
    for (j = 0; j < naligned_groups; j++) {
      group_dist[i][j] = 1000.0;
      n[i][j] = 0;
    }
  for (i = 0; i < nseqs; i++)
    for (j = 0; j < nseqs; j++) {
      if (group_dist[aligned_group[i] - 1][aligned_group[j] - 1] > tmat[i][j])
        group_dist[aligned_group[i] - 1][aligned_group[j] - 1] = tmat[i][j];
    }
  for (i = 0; i < naligned_groups; i++)
    n[i] = ckfree((void *)n[i]);
  n = ckfree(n);
}
```