user: What would the C source look like for the assembly code provided here?

```asm
<svd_sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r12d
  mov    %edx,%r13d
  mov    %rcx,%rbp
  mov    %r8,%r14
  movslq %edx,%r15
  movslq %esi,%rdi
  imul   %r15,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  mov    %r15,%rdi
  imul   %r15,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,(%rsp)
  mov    %r15,0x8(%rsp)
  lea    0x0(,%r15,8),%rdi
  mov    %rdi,0x18(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  mov    0x8(%rsp),%rax
  lea    0x0(,%rax,4),%rdi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %r13d,%r13d
  jle    L139
  mov    %r13d,%edx
  mov    $0x0,%eax
L89:
  movsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,(%r15,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L89
  mov    %r13d,%edx
  imul   %r12d,%edx
  test   %edx,%edx
  jle    L19
L101:
  mov    $0x0,%eax
  mov    0x10(%rsp),%rcx
L106:
  movsd  (%rbx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L106
  mov    %r13d,%edx
  imul   %r13d,%edx
  test   %edx,%edx
  jle    L140
L146:
  mov    $0x0,%eax
  mov    (%rsp),%rcx
L58:
  movsd  0x0(%rbp,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L58
L140:
  mov    0x8(%rsp),%rdx
  mov    %r13d,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <sort1d@plt>
  test   %r13d,%r13d
  jle    L102
  mov    %r13d,%edi
  mov    $0x0,%esi
  mov    0x18(%rsp),%rcx
  mov    0x10(%rsp),%r9
  mov    0x8(%rsp),%r8
L97:
  movslq (%r8,%rsi,4),%rax
  lea    0x0(,%rax,8),%r10
  movsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%r14,%rsi,8)
  test   %r12d,%r12d
  jle    L126
  lea    (%r9,%r10,1),%r11
  mov    $0x0,%eax
  mov    $0x0,%edx
L134:
  movsd  (%r11,%rax,1),%xmm0
  movsd  %xmm0,(%rbx,%rax,1)
  add    $0x1,%edx
  add    %rcx,%rax
  cmp    %edx,%r12d
  jne    L134
L126:
  add    (%rsp),%r10
  mov    $0x0,%eax
  mov    $0x0,%edx
L33:
  movsd  (%r10,%rax,1),%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,1)
  add    $0x1,%edx
  add    %rcx,%rax
  cmp    %edx,%r13d
  jne    L33
  add    $0x1,%rsi
  add    $0x8,%rbp
  add    $0x8,%rbx
  cmp    %rdi,%rsi
  jne    L97
L102:
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L139:
  mov    %r13d,%edx
  imul   %r12d,%edx
  test   %edx,%edx
  jg     L101
  mov    %r13d,%edx
  imul   %r13d,%edx
  test   %edx,%edx
  jg     L146
  mov    0x8(%rsp),%rdx
  mov    %r13d,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <sort1d@plt>
  jmp    L102
L19:
  mov    %r13d,%edx
  imul   %r13d,%edx
  jmp    L146
```

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);
}
```