user: 请将以下的汇编代码转换成C语言代码:

```asm
<sorts3d>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%rbx
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  lea    0x0(,%rdx,4),%r14d
  mov    %r14d,%edi
  call   <smalloc@plt>
  mov    %rax,(%rsp)
  lea    0x50(%rsp),%rbp
  lea    0xb8(%rsp),%r15
L16:
  mov    %r14d,%edi
  call   <smalloc@plt>
  mov    %rax,0x0(%rbp)
  add    $0x8,%rbp
  cmp    %rbp,%r15
  jne    L16
  mov    0x50(%rsp),%rbp
  mov    0x8(%r13),%rdi
  mov    (%rsp),%r14
  mov    %r14,%rcx
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x58(%rsp),%r15
  mov    0x10(%r13),%rdi
  mov    %r14,(%rsp)
  mov    %r14,%rcx
  mov    %r15,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x60(%rsp),%r14
  mov    0x20(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x68(%rsp),%rax
  mov    0x18(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x70(%rsp),%rsi
  mov    0x50(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %rsi,0x10(%rsp)
  mov    %rsi,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x78(%rsp),%r9
  mov    0x28(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r9,0x18(%rsp)
  mov    %r9,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x80(%rsp),%r10
  mov    0x60(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r10,0x20(%rsp)
  mov    %r10,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x88(%rsp),%r11
  mov    0x30(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r11,0x28(%rsp)
  mov    %r11,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x90(%rsp),%r8
  mov    0xa0(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r8,0x30(%rsp)
  mov    %r8,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0x98(%rsp),%rdi
  mov    %rdi,%rax
  mov    0x38(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %rax,0x38(%rsp)
  mov    %rax,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0xa0(%rsp),%rdi
  mov    %rdi,%rsi
  mov    0x70(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %rsi,0x40(%rsp)
  mov    %rsi,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0xa8(%rsp),%rdi
  mov    %rdi,%r9
  mov    0xa8(%r13),%rdi
  mov    (%rsp),%rcx
  mov    %r9,0x48(%rsp)
  mov    %r9,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    0xb0(%rsp),%rdi
  mov    %rdi,%r10
  mov    0xe0(%r13),%rdi
  mov    (%rsp),%r13
  mov    %r13,%rcx
  mov    %r10,(%rsp)
  mov    %r10,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <mergesort@plt>
  mov    %r13,%rdi
  call   <sfree@plt>
  mov    %rbp,0x1b8(%rbx)
  mov    %rbp,0x128(%rbx)
  mov    %rbp,0x98(%rbx)
  mov    %rbp,0x8(%rbx)
  mov    %r15,0x178(%rbx)
  mov    %r15,0x130(%rbx)
  mov    %r15,0x58(%rbx)
  mov    %r15,0x10(%rbx)
  mov    %r14,0xf8(%rbx)
  mov    %r14,0xb0(%rbx)
  mov    %r14,0x68(%rbx)
  mov    %r14,0x20(%rbx)
  mov    0x8(%rsp),%rax
  mov    %rax,0x138(%rbx)
  mov    %rax,0x18(%rbx)
  mov    0x10(%rsp),%rsi
  mov    %rsi,0x170(%rbx)
  mov    %rsi,0x50(%rbx)
  mov    0x18(%rsp),%r9
  mov    %r9,0xb8(%rbx)
  mov    %r9,0x28(%rbx)
  mov    0x20(%rsp),%r10
  mov    %r10,0xf0(%rbx)
  mov    %r10,0x60(%rbx)
  mov    0x28(%rsp),%r11
  mov    %r11,0x78(%rbx)
  mov    %r11,0x30(%rbx)
  mov    0x30(%rsp),%r8
  mov    %r8,0xe8(%rbx)
  mov    %r8,0xa0(%rbx)
  mov    0x38(%rsp),%rax
  mov    %rax,0x38(%rbx)
  mov    0x40(%rsp),%rsi
  mov    %rsi,0x70(%rbx)
  mov    0x48(%rsp),%r9
  mov    %r9,0xa8(%rbx)
  mov    (%rsp),%r10
  mov    %r10,0xe0(%rbx)
  mov    $0x0,%edi
  mov    $0x1,%r8d
  mov    $0x1,%edx
  jmp    L3
L22:
  mov    %r8d,%edi
  mov    %edx,%r8d
L3:
  movslq %edi,%rsi
  mov    %rsi,%rcx
  shl    $0x6,%rcx
  add    %rbx,%rcx
  movslq %edx,%rax
  mov    (%rcx,%rax,8),%rcx
  shl    $0x6,%rax
  add    %rbx,%rax
  mov    %rcx,(%rax,%rsi,8)
  add    $0x1,%edx
  cmp    $0x7,%edx
  jle    L3
  lea    0x1(%r8),%edx
  cmp    $0x7,%edx
  jle    L22
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L43:
  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];
    }
  }
}
```