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

```asm
<hpsort_double_doublematrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r8
  mov    %rdx,%r9
  mov    %rcx,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  lea    0xf(,%rsi,8),%rax
  mov    %rax,%rdi
  and    $0xfffffffffffffff0,%rdi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L310:
  cmp    %rcx,%rsp
  je     L276
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L310
L276:
  mov    %rdi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L33
  orq    $0x0,-0x8(%rsp,%rax,1)
L33:
  mov    %rsp,%r10
  mov    %r8,%r11
  shr    %r11
  add    $0x1,%r11
  test   %r8,%r8
  jne    L275
  mov    %rbx,%rsp
  jmp    L96
L68:
  sub    $0x1,%r11
  lea    0x0(,%r11,8),%r12
  movsd  -0x8(%r9,%r12,1),%xmm1
  test   %rsi,%rsi
  je     L174
  mov    -0x8(%rdx,%r12,1),%rcx
  mov    $0x0,%eax
L196:
  movsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%r10,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L196
  cmp    %r11,%r8
  jae    L20
  lea    -0x8(%r12),%rdi
  movsd  %xmm1,-0x8(%r9,%r12,1)
  jmp    L50
L307:
  movsd  %xmm1,(%r9)
  test   %rsi,%rsi
  je     L154
  mov    $0x0,%eax
L107:
  mov    (%rdx),%rcx
  movsd  (%r10,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L107
L154:
  mov    %rbx,%rsp
L96:
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L184
  lea    -0x18(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
L298:
  lea    0x0(,%rcx,8),%rax
  lea    -0x8(%rax),%r12
  movsd  -0x8(%r9,%rax,1),%xmm0
  comisd %xmm1,%xmm0
  ja     L143
  lea    0x1(%r8),%rcx
L90:
  cmp    %r8,%rcx
  ja     L118
L286:
  cmp    %r8,%rcx
  jae    L298
  movsd  (%r9,%rcx,8),%xmm0
  comisd -0x8(%r9,%rcx,8),%xmm0
  jbe    L298
  add    $0x1,%rcx
  jmp    L298
L143:
  lea    0x0(,%rdi,8),%rax
  lea    -0x8(%rax),%r13
  movsd  %xmm0,-0x8(%r9,%rax,1)
  test   %rsi,%rsi
  je     L93
  mov    $0x0,%eax
L289:
  mov    (%rdx,%r12,1),%rdi
  movsd  (%rdi,%rax,8),%xmm0
  mov    (%rdx,%r13,1),%rdi
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L289
L93:
  mov    %rcx,%rdi
  add    %rcx,%rcx
  jmp    L90
L241:
  mov    %r11,%rdi
L118:
  lea    0x0(,%rdi,8),%rax
  lea    -0x8(%rax),%rdi
  movsd  %xmm1,-0x8(%r9,%rax,1)
  test   %rsi,%rsi
  je     L275
L50:
  mov    $0x0,%eax
L297:
  mov    (%rdx,%rdi,1),%rcx
  movsd  (%r10,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  ja     L297
L275:
  cmp    $0x1,%r11
  ja     L68
  lea    -0x8(,%r8,8),%r12
  lea    (%r9,%r12,1),%r13
  movsd  0x0(%r13),%xmm1
  test   %rsi,%rsi
  je     L268
  add    %rdx,%r12
  mov    (%r12),%rdi
  mov    $0x0,%eax
L267:
  movsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,(%r10,%rax,8)
  mov    %rax,%rcx
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L267
  movsd  (%r9),%xmm0
  movsd  %xmm0,0x0(%r13)
  mov    $0x0,%eax
L238:
  mov    (%rdx),%rdi
  movsd  (%rdi,%rax,8),%xmm0
  mov    (%r12),%rdi
  movsd  %xmm0,(%rdi,%rax,8)
  mov    %rax,%rdi
  add    $0x1,%rax
  cmp    %rdi,%rcx
  jne    L238
L168:
  sub    $0x1,%r8
  cmp    $0x1,%r8
  je     L307
  cmp    %r8,%r11
  ja     L241
L20:
  mov    %r11,%rcx
  mov    %r11,%rdi
  jmp    L286
L174:
  cmp    %r11,%r8
  jae    L20
  movsd  %xmm1,-0x8(%r9,%r12,1)
  jmp    L275
L268:
  movsd  (%r9),%xmm0
  movsd  %xmm0,0x0(%r13)
  jmp    L168
L184:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void hpsort_double_doublematrix(unsigned long n, unsigned long nmat, double ra[], double **ra2) {
  unsigned long i, ir, j, l;
  unsigned long iaux;
  double rra;
  double rra2[nmat];
  if (n < 1)
    return;
  l = (n >> 1) + 1;
  ir = n;
  for (;;) {
    if (l > 1) {
      rra = ra[--l - 1];
      for (iaux = 0; iaux < nmat; iaux++) {
        rra2[iaux] = ra2[l - 1][iaux];
      }
    } else {
      rra = ra[ir - 1];
      for (iaux = 0; iaux < nmat; iaux++) {
        rra2[iaux] = ra2[ir - 1][iaux];
      }
      ra[ir - 1] = ra[0];
      for (iaux = 0; iaux < nmat; iaux++) {
        ra2[ir - 1][iaux] = ra2[0][iaux];
      }
      if (--ir == 1) {
        ra[0] = rra;
        for (iaux = 0; iaux < nmat; iaux++) {
          ra2[0][iaux] = rra2[iaux];
        }
        break;
      }
    }
    i = l;
    j = l;
    while (j <= ir) {
      if (j < ir && ra[j - 1] < ra[j])
        j++;
      if (rra < ra[j - 1]) {
        ra[i - 1] = ra[j - 1];
        for (iaux = 0; iaux < nmat; iaux++) {
          ra2[i - 1][iaux] = ra2[j - 1][iaux];
        }
        i = j;
        j <<= 1;
      } else
        j = ir + 1;
    }
    ra[i - 1] = rra;
    for (iaux = 0; iaux < nmat; iaux++) {
      ra2[i - 1][iaux] = rra2[iaux];
    }
  }
}
```