user: 请从给定的汇编指令推导出C源代码：

```asm
<sort_faces>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x28(%rbp)
  mov    -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x20(%rbp)
  mov    -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x18(%rbp)
  mov    -0x4c(%rbp),%eax
  add    %eax,%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x10(%rbp)
  mov    -0x4c(%rbp),%eax
  add    %eax,%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L17
L14:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    0x4(%rax),%eax
  mov    %eax,0x4(%rdx)
  addl   $0x1,-0x2c(%rbp)
L17:
  mov    -0x2c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L14
  mov    -0x20(%rbp),%r8
  mov    -0x8(%rbp),%rdi
  mov    -0x10(%rbp),%rcx
  mov    -0x4c(%rbp),%edx
  mov    -0x28(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  push   -0x18(%rbp)
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <global_msort@plt>
  add    $0x10,%rsp
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  nop
  leave
  ret
```

assistant: ```c
void sort_faces(int pm[], int fpoint[][2], int ttype[], int nfaces) {
  int *pm_tmp = check_malloc(nfaces * sizeof(int));
  int *tp = check_malloc(nfaces * sizeof(int));
  int *tp_tmp = check_malloc(nfaces * sizeof(int));
  int(*fp)[2] = check_malloc(2 * nfaces * sizeof(int));
  int(*fp_tmp)[2] = check_malloc(2 * nfaces * sizeof(int));
  int face;
  for (face = 0; face < nfaces; face++) {
    tp[face] = ttype[face];
    fp[face][0] = fpoint[face][0];
    fp[face][1] = fpoint[face][1];
  }
  global_msort(pm, pm_tmp, nfaces, fp, fp_tmp, tp, tp_tmp);
  check_free(pm_tmp);
  check_free(tp);
  check_free(tp_tmp);
  check_free(fp);
  check_free(fp_tmp);
}
```