user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<svd_sort>:
  endbr64
  push   %r15
  movslq %edx,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %r15,%r12
  push   %rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x48,%rsp
  mov    %rdi,0x28(%rsp)
  movslq %esi,%rdi
  mov    %edi,0x10(%rsp)
  imul   %r15,%rdi
  mov    %r8,0x20(%rsp)
  mov    %r15d,0x1c(%rsp)
  shl    $0x3,%rdi
  mov    %r15,0x8(%rsp)
  call   <malloc@plt>
  mov    %r15,%rdi
  imul   %r15,%rdi
  shl    $0x3,%r15
  mov    %rax,%r14
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %r15,%rdi
  mov    %rax,%rbp
  call   <malloc@plt>
  lea    0x0(,%r12,4),%rdi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    0x1c(%rsp),%r9d
  mov    0x10(%rsp),%r10d
  mov    0x20(%rsp),%r8
  mov    0x28(%rsp),%r11
  mov    %rax,%r12
  mov    %r9d,%ecx
  imul   %r10d,%ecx
  test   %r9d,%r9d
  jle    L108
  mov    %r8,%rsi
  mov    %r15,%rdx
  mov    %r13,%rdi
  mov    %r9d,0x30(%rsp)
  mov    %r10d,0x28(%rsp)
  mov    %r11,0x20(%rsp)
  mov    %ecx,0x1c(%rsp)
  mov    %r8,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x1c(%rsp),%ecx
  mov    0x10(%rsp),%r8
  mov    0x20(%rsp),%r11
  mov    0x28(%rsp),%r10d
  test   %ecx,%ecx
  mov    0x30(%rsp),%r9d
  jle    L155
  movslq %ecx,%rdx
  mov    %r11,%rsi
  mov    %r14,%rdi
  mov    %r8,0x30(%rsp)
  shl    $0x3,%rdx
  mov    %r9d,0x28(%rsp)
  mov    %r10d,0x20(%rsp)
  mov    %ecx,0x1c(%rsp)
  mov    %r11,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x28(%rsp),%r9d
  mov    0x10(%rsp),%r11
  mov    0x1c(%rsp),%ecx
  mov    0x20(%rsp),%r10d
  mov    %r9d,%eax
  mov    0x30(%rsp),%r8
  imul   %r9d,%eax
  test   %eax,%eax
  je     L42
L22:
  movslq %eax,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %r10d,0x30(%rsp)
  shl    $0x3,%rdx
  test   %eax,%eax
  mov    $0x8,%eax
  mov    %r11,0x28(%rsp)
  cmovle %rax,%rdx
  mov    %ecx,0x20(%rsp)
  mov    %r8,0x38(%rsp)
  mov    %r9d,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x10(%rsp),%r9d
  xor    %eax,%eax
  mov    %r12,%rdx
  mov    0x38(%rsp),%r8
  mov    %r9d,%esi
  mov    %r9d,0x1c(%rsp)
  mov    %r8,%rdi
  mov    %r8,0x10(%rsp)
  call   <sort1d@plt>
  mov    0x1c(%rsp),%r9d
  mov    0x10(%rsp),%r8
  mov    0x20(%rsp),%ecx
  mov    0x28(%rsp),%r11
  test   %r9d,%r9d
  mov    0x30(%rsp),%r10d
  jle    L5
L127:
  cmp    $0x1,%r9d
  jne    L113
  movslq (%r12),%r15
  movsd  0x0(%r13,%r15,8),%xmm0
  lea    0x0(,%r15,8),%rsi
  movsd  %xmm0,(%r8)
  test   %ecx,%ecx
  jle    L93
  movslq %ecx,%rdx
  add    %r14,%rsi
  mov    %r11,%rdi
  shl    $0x3,%rdx
  call   <memcpy@plt>
L93:
  movsd  0x0(%rbp,%r15,8),%xmm0
  movsd  %xmm0,(%rbx)
L5:
  mov    %r14,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  add    $0x48,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
L113:
  xor    %edi,%edi
  nopl   0x0(%rax,%rax,1)
L37:
  movslq (%r12,%rdi,4),%rax
  xor    %edx,%edx
  movsd  0x0(%r13,%rax,8),%xmm0
  lea    0x0(,%rax,8),%rcx
  xor    %eax,%eax
  lea    (%r14,%rcx,1),%rsi
  movsd  %xmm0,(%r8,%rdi,8)
  test   %r10d,%r10d
  jle    L60
  cs nopw 0x0(%rax,%rax,1)
L145:
  movsd  (%rsi,%rax,1),%xmm0
  add    $0x1,%edx
  movsd  %xmm0,(%r11,%rax,1)
  add    %r15,%rax
  cmp    %edx,%r10d
  jne    L145
L60:
  add    %rbp,%rcx
  xor    %eax,%eax
  xor    %edx,%edx
  nopl   (%rax)
L56:
  movsd  (%rcx,%rax,1),%xmm0
  add    $0x1,%edx
  movsd  %xmm0,(%rbx,%rax,1)
  add    %r15,%rax
  cmp    %edx,%r9d
  jne    L56
  add    $0x1,%rdi
  add    $0x8,%rbx
  add    $0x8,%r11
  cmp    %rdi,0x8(%rsp)
  jne    L37
  jmp    L5
L108:
  test   %ecx,%ecx
  jle    L36
  movslq %ecx,%rdx
  mov    %r11,%rsi
  mov    %r14,%rdi
  mov    %r8,0x30(%rsp)
  shl    $0x3,%rdx
  mov    %r9d,0x28(%rsp)
  mov    %r10d,0x20(%rsp)
  mov    %ecx,0x1c(%rsp)
  mov    %r11,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x28(%rsp),%r9d
  mov    0x10(%rsp),%r11
  mov    0x1c(%rsp),%ecx
  mov    0x20(%rsp),%r10d
  mov    %r9d,%eax
  mov    0x30(%rsp),%r8
  imul   %r9d,%eax
  test   %eax,%eax
  jne    L22
  jmp    L131
  nopl   0x0(%rax,%rax,1)
L42:
  mov    %r9d,%esi
  mov    %r8,%rdi
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    %r10d,0x30(%rsp)
  mov    %r11,0x28(%rsp)
  mov    %ecx,0x20(%rsp)
  mov    %r9d,0x1c(%rsp)
  mov    %r8,0x10(%rsp)
  call   <sort1d@plt>
  mov    0x10(%rsp),%r8
  mov    0x1c(%rsp),%r9d
  mov    0x20(%rsp),%ecx
  mov    0x28(%rsp),%r11
  mov    0x30(%rsp),%r10d
  jmp    L127
L155:
  mov    %r9d,%eax
  imul   %r9d,%eax
  jmp    L22
L36:
  mov    %r9d,%eax
  imul   %r9d,%eax
  test   %eax,%eax
  jne    L22
L131:
  mov    %r12,%rdx
  mov    %r9d,%esi
  mov    %r8,%rdi
  xor    %eax,%eax
  call   <sort1d@plt>
  jmp    L5
```

assistant: ```c
void svd_sort(double *U, int M, int N, double *V, double *q) {
  int i, j;
  double *UT, *VT, *qq;
  int *pos;
  UT = (double *)malloc(sizeof(double) * N * M);
  VT = (double *)malloc(sizeof(double) * N * N);
  qq = (double *)malloc(sizeof(double) * N);
  pos = (int *)malloc(sizeof(int) * N);
  for (i = 0; i < N; ++i) {
    qq[i] = q[i];
  }
  for (i = 0; i < M * N; ++i) {
    UT[i] = U[i];
  }
  for (i = 0; i < N * N; ++i) {
    VT[i] = V[i];
  }
  sort1d(q, N, pos);
  for (i = 0; i < N; ++i) {
    q[i] = qq[pos[i]];
    for (j = 0; j < M; ++j) {
      U[j * N + i] = UT[j * N + pos[i]];
    }
    for (j = 0; j < N; ++j) {
      V[j * N + i] = VT[j * N + pos[i]];
    }
  }
  free(UT);
  free(VT);
  free(qq);
  free(pos);
}
```