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

```asm
<sorts3d>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  lea    0x0(,%rdx,4),%ebp
  push   %rbx
  mov    %ebp,%edi
  mov    %rsi,%rbx
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  lea    0x60(%rsp),%r15
  call   <smalloc@plt>
  mov    %rbx,0x8(%rsp)
  mov    %r15,%rbx
  mov    %rax,%r12
  lea    0xc8(%rsp),%rax
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L31:
  mov    %ebp,%edi
  add    $0x8,%rbx
  call   <smalloc@plt>
  mov    %rax,-0x8(%rbx)
  cmp    %rbx,%r15
  jne    L31
  mov    0x60(%rsp),%rbp
  mov    0x8(%r14),%rdi
  mov    %r12,%rcx
  mov    %r13d,%esi
  xor    %eax,%eax
  mov    0x8(%rsp),%rbx
  mov    %rbp,%rdx
  call   <mergesort@plt>
  mov    0x68(%rsp),%r8
  mov    0x10(%r14),%rdi
  xor    %eax,%eax
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    %r8,%rdx
  mov    %r8,0x58(%rsp)
  call   <mergesort@plt>
  mov    0x70(%rsp),%r15
  mov    0x20(%r14),%rdi
  xor    %eax,%eax
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    %r15,%rdx
  call   <mergesort@plt>
  mov    0x78(%rsp),%r9
  mov    0x18(%r14),%rdi
  xor    %eax,%eax
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    %r9,%rdx
  mov    %r9,0x50(%rsp)
  call   <mergesort@plt>
  mov    0x50(%r14),%rdi
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    0x80(%rsp),%rax
  mov    %rax,%rdx
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <mergesort@plt>
  mov    0x28(%r14),%rdi
  mov    %r12,%rcx
  xor    %eax,%eax
  mov    0x88(%rsp),%rsi
  mov    %rsi,%rdx
  mov    %rsi,0x10(%rsp)
  mov    %r13d,%esi
  call   <mergesort@plt>
  mov    0x60(%r14),%rdi
  mov    %r12,%rcx
  xor    %eax,%eax
  mov    0x90(%rsp),%rsi
  mov    %rsi,%rdx
  mov    %rsi,0x18(%rsp)
  mov    %r13d,%esi
  call   <mergesort@plt>
  mov    0x30(%r14),%rdi
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    0x98(%rsp),%r11
  xor    %eax,%eax
  mov    %r11,%rdx
  mov    %r11,0x48(%rsp)
  call   <mergesort@plt>
  mov    %r12,%rcx
  mov    %r13d,%esi
  xor    %eax,%eax
  mov    0xa0(%rsp),%r10
  mov    0xa0(%r14),%rdi
  mov    %r10,%rdx
  mov    %r10,0x40(%rsp)
  call   <mergesort@plt>
  mov    0x38(%r14),%rdi
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    0xa8(%rsp),%r9
  xor    %eax,%eax
  mov    %r9,%rdx
  mov    %r9,0x20(%rsp)
  call   <mergesort@plt>
  mov    0x70(%r14),%rdi
  mov    %r12,%rcx
  mov    %r13d,%esi
  mov    0xb0(%rsp),%r10
  xor    %eax,%eax
  mov    %r10,%rdx
  mov    %r10,0x28(%rsp)
  call   <mergesort@plt>
  mov    %r12,%rcx
  mov    %r13d,%esi
  xor    %eax,%eax
  mov    0xb8(%rsp),%r11
  mov    0xa8(%r14),%rdi
  mov    %r11,%rdx
  mov    %r11,0x30(%rsp)
  call   <mergesort@plt>
  mov    %r12,%rcx
  mov    %r13d,%esi
  xor    %eax,%eax
  mov    0xc0(%rsp),%rdx
  mov    0xe0(%r14),%rdi
  mov    %rdx,0x38(%rsp)
  call   <mergesort@plt>
  mov    %r12,%rdi
  call   <sfree@plt>
  mov    0x58(%rsp),%r8
  mov    0x8(%rsp),%rax
  mov    %rbp,0x1b8(%rbx)
  mov    0x10(%rsp),%rdi
  mov    0x18(%rsp),%rsi
  mov    %rbp,0x8(%rbx)
  mov    0x48(%rsp),%r11
  mov    0x40(%rsp),%r10
  mov    %rax,0x50(%rbx)
  mov    0x50(%rsp),%r9
  mov    0x20(%rsp),%rcx
  mov    %rdi,0x28(%rbx)
  mov    %rax,0x170(%rbx)
  mov    $0x1,%eax
  mov    %rdi,0xb8(%rbx)
  mov    $0x1,%edi
  mov    %rsi,0xf0(%rbx)
  mov    %rsi,0x60(%rbx)
  xor    %esi,%esi
  mov    %r11,0x78(%rbx)
  mov    %r11,0x30(%rbx)
  mov    %r10,0xe8(%rbx)
  mov    %r10,0xa0(%rbx)
  mov    %rbp,0x128(%rbx)
  mov    %rbp,0x98(%rbx)
  mov    %r8,0x178(%rbx)
  mov    %r8,0x130(%rbx)
  mov    %r8,0x58(%rbx)
  mov    %r8,0x10(%rbx)
  mov    %r15,0xf8(%rbx)
  mov    %r15,0xb0(%rbx)
  mov    %r15,0x68(%rbx)
  mov    %r15,0x20(%rbx)
  mov    %r9,0x138(%rbx)
  mov    %r9,0x18(%rbx)
  mov    %rcx,0x38(%rbx)
  mov    0x28(%rsp),%r10
  mov    $0x1,%ecx
  mov    0x30(%rsp),%r11
  mov    0x38(%rsp),%rdx
  mov    %r10,0x70(%rbx)
  mov    %r11,0xa8(%rbx)
  mov    %rdx,0xe0(%rbx)
  jmp    L10
  nopl   (%rax)
L35:
  movslq %ecx,%rax
  mov    (%rdx,%rax,8),%rbp
L10:
  mov    %rsi,%rdx
  shl    $0x6,%rax
  add    $0x1,%ecx
  shl    $0x6,%rdx
  add    %rbx,%rax
  mov    %rbp,(%rax,%rsi,8)
  add    %rbx,%rdx
  cmp    $0x8,%ecx
  jne    L35
  lea    0x1(%rdi),%ecx
  cmp    $0x7,%edi
  je     L39
  movslq %edi,%rdx
  movslq %edi,%rsi
  mov    %ecx,%edi
  shl    $0x6,%rdx
  add    %rbx,%rdx
  jmp    L35
  nopl   (%rax)
L39:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void sorts3d(double *vals[8][8], int *indices[8][8], int nvtxs) {
  int *space;
  int nsets = 8;
  int nlists = 13;
  int *temp[13];
  int i, j;
  void mergesort();
  space = smalloc(nvtxs * sizeof(int));
  for (i = 0; i < nlists; i++) {
    temp[i] = smalloc(nvtxs * sizeof(int));
  }
  mergesort(vals[0][1], nvtxs, temp[0], space);
  mergesort(vals[0][2], nvtxs, temp[1], space);
  mergesort(vals[0][4], nvtxs, temp[2], space);
  mergesort(vals[0][3], nvtxs, temp[3], space);
  mergesort(vals[1][2], nvtxs, temp[4], space);
  mergesort(vals[0][5], nvtxs, temp[5], space);
  mergesort(vals[1][4], nvtxs, temp[6], space);
  mergesort(vals[0][6], nvtxs, temp[7], space);
  mergesort(vals[2][4], nvtxs, temp[8], space);
  mergesort(vals[0][7], nvtxs, temp[9], space);
  mergesort(vals[1][6], nvtxs, temp[10], space);
  mergesort(vals[2][5], nvtxs, temp[11], space);
  mergesort(vals[3][4], nvtxs, temp[12], space);
  sfree(space);
  indices[0][1] = indices[2][3] = indices[4][5] = indices[6][7] = temp[0];
  indices[0][2] = indices[1][3] = indices[4][6] = indices[5][7] = temp[1];
  indices[0][4] = indices[1][5] = indices[2][6] = indices[3][7] = temp[2];
  indices[0][3] = indices[4][7] = temp[3];
  indices[1][2] = indices[5][6] = temp[4];
  indices[0][5] = indices[2][7] = temp[5];
  indices[1][4] = indices[3][6] = temp[6];
  indices[0][6] = indices[1][7] = temp[7];
  indices[2][4] = indices[3][5] = temp[8];
  indices[0][7] = temp[9];
  indices[1][6] = temp[10];
  indices[2][5] = temp[11];
  indices[3][4] = temp[12];
  for (i = 0; i < nsets; i++) {
    for (j = i + 1; j < nsets; j++) {
      indices[j][i] = indices[i][j];
    }
  }
}
```