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

```asm
<heapsort2_d>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %edi,%r9d
  mov    %rsi,%rax
  mov    %rdx,%rdi
  mov    %r9d,%edx
  shr    $0x1f,%edx
  add    %r9d,%edx
  sar    %edx
  sub    $0x1,%edx
  js     L23
  movslq %edx,%r11
  lea    0x1(%rdx,%rdx,1),%ebx
  lea    -0x1(%r9),%r10d
  jmp    L119
L161:
  movslq %ecx,%r8
  movsd  (%rax,%r8,8),%xmm0
  comisd %xmm0,%xmm1
  jae    L117
  movslq %esi,%rdx
  movsd  %xmm0,(%rax,%rdx,8)
  movsd  (%rdi,%r8,8),%xmm0
  movsd  %xmm0,(%rdi,%rdx,8)
  lea    0x1(%rcx,%rcx,1),%edx
  cmp    %edx,%r9d
  jle    L73
  mov    %ecx,%esi
L131:
  mov    %edx,%ecx
  cmp    %edx,%r10d
  jle    L161
  movslq %edx,%r8
  movsd  0x8(%rax,%r8,8),%xmm0
  lea    0x1(%rdx),%ecx
  comisd (%rax,%r8,8),%xmm0
  cmovbe %edx,%ecx
  jmp    L161
L73:
  mov    %ecx,%esi
L117:
  movslq %esi,%rdx
  movsd  %xmm1,(%rax,%rdx,8)
  movsd  %xmm2,(%rdi,%rdx,8)
  sub    $0x1,%r11
  sub    $0x2,%ebx
  test   %r11d,%r11d
  js     L23
L119:
  mov    %r11d,%esi
  movsd  (%rax,%r11,8),%xmm1
  movsd  (%rdi,%r11,8),%xmm2
  mov    %ebx,%edx
  cmp    %ebx,%r9d
  jg     L131
  jmp    L117
L23:
  test   %r9d,%r9d
  jle    L89
  lea    -0x1(%r9),%r10d
  movslq %r10d,%r10
  sub    $0x2,%r9d
  mov    $0x1,%ebx
  mov    $0x0,%r11d
  jmp    L80
L108:
  movslq %ecx,%r8
  movsd  (%rax,%r8,8),%xmm0
  comisd %xmm0,%xmm1
  jae    L177
  movslq %esi,%rdx
  movsd  %xmm0,(%rax,%rdx,8)
  movsd  (%rdi,%r8,8),%xmm0
  movsd  %xmm0,(%rdi,%rdx,8)
  lea    0x1(%rcx,%rcx,1),%edx
  cmp    %ebp,%edx
  jge    L13
  mov    %ecx,%esi
L102:
  mov    %edx,%ecx
  cmp    %edx,%r9d
  jle    L108
  movslq %edx,%r8
  movsd  0x8(%rax,%r8,8),%xmm0
  lea    0x1(%rdx),%ecx
  comisd (%rax,%r8,8),%xmm0
  cmovbe %edx,%ecx
  jmp    L108
L13:
  mov    %ecx,%esi
L177:
  movslq %esi,%rdx
  movsd  %xmm1,(%rax,%rdx,8)
  movsd  %xmm2,(%rdi,%rdx,8)
L75:
  sub    $0x1,%r10
  sub    $0x1,%r9d
L80:
  movsd  (%rax,%r10,8),%xmm1
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rax,%r10,8)
  movsd  (%rdi,%r10,8),%xmm2
  movsd  (%rdi),%xmm0
  movsd  %xmm0,(%rdi,%r10,8)
  mov    %r10d,%ebp
  cmp    $0x1,%r10d
  jle    L109
  mov    %ebx,%edx
  mov    %r11d,%esi
  jmp    L102
L109:
  movsd  %xmm1,(%rax)
  movsd  %xmm2,(%rdi)
  je     L75
L89:
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void heapsort2_d(int n, double key[], double val[]) {
  int i, j, k;
  double key0;
  double val0;
  for (k = n / 2 - 1; k >= 0; k--) {
    i = k;
    key0 = key[i];
    val0 = val[i];
    j = 2 * i + 1;
    while (j <= n - 1) {
      if (j < n - 1 && key[j] < key[j + 1])
        j++;
      if (key0 >= key[j])
        break;
      key[i] = key[j];
      val[i] = val[j];
      i = j;
      j = 2 * i + 1;
    }
    key[i] = key0;
    val[i] = val0;
  }
  while (n > 0) {
    key0 = key[n - 1];
    key[n - 1] = key[0];
    val0 = val[n - 1];
    val[n - 1] = val[0];
    n--;
    i = 0;
    j = 2 * i + 1;
    while (j <= n - 1) {
      if (j < n - 1 && key[j] < key[j + 1])
        j++;
      if (key0 >= key[j])
        break;
      key[i] = key[j];
      val[i] = val[j];
      i = j;
      j = 2 * i + 1;
    }
    key[i] = key0;
    val[i] = val0;
  }
}
```