user: Demonstrate the C code that generates the assembly output below:

```asm
<svd_sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  movslq %esi,%rdi
  push   %rbp
  mov    %rdi,%r13
  mov    %rcx,%rbp
  push   %rbx
  movslq %edx,%rbx
  imul   %rbx,%rdi
  mov    %rbx,%r15
  sub    $0x38,%rsp
  shl    $0x3,%rdi
  mov    %r8,0x18(%rsp)
  call   <malloc@plt>
  mov    %rbx,%rdi
  imul   %rbx,%rdi
  mov    %rax,0x10(%rsp)
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rbx,(%rsp)
  shl    $0x3,%rbx
  mov    %rbx,%rdi
  mov    %rax,%r14
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    (%rsp),%rax
  lea    0x0(,%rax,4),%rdi
  call   <malloc@plt>
  mov    %r15d,%ecx
  mov    0x8(%rsp),%r11
  mov    0x10(%rsp),%r10
  imul   %r13d,%ecx
  test   %r15d,%r15d
  mov    0x18(%rsp),%r8
  mov    %rax,%r9
  jle    L67
  mov    %r8,%rsi
  mov    %r11,%rdi
  mov    %rbx,%rdx
  mov    %ecx,0x20(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %rax,0x18(%rsp)
  call   <memcpy@plt>
  mov    0x20(%rsp),%ecx
  mov    0x8(%rsp),%r8
  mov    0x10(%rsp),%r10
  mov    0x18(%rsp),%r9
  mov    %rax,%r11
  test   %ecx,%ecx
  jle    L109
  movslq %ecx,%rdx
  mov    %r10,%rdi
  mov    %r12,%rsi
  mov    %r8,0x18(%rsp)
  shl    $0x3,%rdx
  mov    %r9,0x10(%rsp)
  mov    %rax,0x8(%rsp)
  call   <memcpy@plt>
  mov    0x8(%rsp),%r11
  mov    0x10(%rsp),%r9
  mov    %rax,%r10
  mov    %r15d,%eax
  mov    0x18(%rsp),%r8
  imul   %r15d,%eax
  test   %eax,%eax
  je     L81
L41:
  movslq %eax,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  mov    %r11,0x20(%rsp)
  shl    $0x3,%rdx
  test   %eax,%eax
  mov    $0x8,%eax
  mov    %r10,0x18(%rsp)
  cmovle %rax,%rdx
  mov    %r8,0x28(%rsp)
  mov    %r9,0x8(%rsp)
  call   <memcpy@plt>
  mov    0x8(%rsp),%r9
  xor    %eax,%eax
  mov    %r15d,%esi
  mov    0x28(%rsp),%r8
  mov    %r9,%rdx
  mov    %r9,0x10(%rsp)
  mov    %r8,%rdi
  mov    %r8,0x8(%rsp)
  call   <sort1d@plt>
  test   %r15d,%r15d
  mov    0x8(%rsp),%r8
  mov    0x10(%rsp),%r9
  mov    0x18(%rsp),%r10
  mov    0x20(%rsp),%r11
  jle    L39
L144:
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L80:
  movslq (%r9,%rdi,4),%rax
  xor    %edx,%edx
  movsd  (%r11,%rax,8),%xmm0
  lea    0x0(,%rax,8),%rcx
  xor    %eax,%eax
  lea    (%r10,%rcx,1),%rsi
  movsd  %xmm0,(%r8,%rdi,8)
  test   %r13d,%r13d
  jle    L108
  nopl   (%rax)
L45:
  movsd  (%rsi,%rax,1),%xmm0
  add    $0x1,%edx
  movsd  %xmm0,(%r12,%rax,1)
  add    %rbx,%rax
  cmp    %edx,%r13d
  jne    L45
L108:
  add    %r14,%rcx
  xor    %eax,%eax
  xor    %edx,%edx
  nopl   (%rax)
L46:
  movsd  (%rcx,%rax,1),%xmm0
  add    $0x1,%edx
  movsd  %xmm0,0x0(%rbp,%rax,1)
  add    %rbx,%rax
  cmp    %edx,%r15d
  jne    L46
  add    $0x1,%rdi
  add    $0x8,%rbp
  add    $0x8,%r12
  cmp    (%rsp),%rdi
  jne    L80
L39:
  mov    %r10,%rdi
  mov    %r9,0x8(%rsp)
  mov    %r11,(%rsp)
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
L67:
  test   %ecx,%ecx
  jle    L147
  movslq %ecx,%rdx
  mov    %r10,%rdi
  mov    %r12,%rsi
  mov    %r8,0x18(%rsp)
  shl    $0x3,%rdx
  mov    %r11,0x8(%rsp)
  mov    %rax,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x8(%rsp),%r11
  mov    0x10(%rsp),%r9
  mov    %rax,%r10
  mov    %r15d,%eax
  mov    0x18(%rsp),%r8
  imul   %r15d,%eax
  test   %eax,%eax
  jne    L41
L148:
  mov    %r9,%rdx
  mov    %r15d,%esi
  mov    %r8,%rdi
  xor    %eax,%eax
  mov    %r11,0x10(%rsp)
  mov    %r10,0x8(%rsp)
  mov    %r9,(%rsp)
  call   <sort1d@plt>
  mov    (%rsp),%r9
  mov    0x8(%rsp),%r10
  mov    0x10(%rsp),%r11
  jmp    L39
L109:
  mov    %r15d,%eax
  imul   %r15d,%eax
  jmp    L41
L81:
  mov    %r9,%rdx
  mov    %r8,%rdi
  mov    %r15d,%esi
  xor    %eax,%eax
  mov    %r11,0x20(%rsp)
  mov    %r10,0x18(%rsp)
  mov    %r9,0x10(%rsp)
  mov    %r8,0x8(%rsp)
  call   <sort1d@plt>
  mov    0x8(%rsp),%r8
  mov    0x10(%rsp),%r9
  mov    0x18(%rsp),%r10
  mov    0x20(%rsp),%r11
  jmp    L144
L147:
  mov    %r15d,%eax
  imul   %r15d,%eax
  test   %eax,%eax
  jne    L41
  jmp    L148
```

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