user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<heapsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movq   $0x1,-0x20(%rbp)
  jmp    L24
L11:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L70:
  mov    -0x18(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jge    L48
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x10(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
L48:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L70
  addq   $0x1,-0x20(%rbp)
L24:
  mov    -0x20(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jl     L11
  mov    -0x30(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  jmp    L98
L35:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
  movq   $0x0,-0x10(%rbp)
L72:
  mov    -0x10(%rbp),%rax
  add    %rax,%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jge    L74
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x18(%rbp)
  jge    L74
  addq   $0x1,-0x18(%rbp)
L74:
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jge    L87
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jge    L87
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x10(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
L87:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jl     L72
  subq   $0x1,-0x20(%rbp)
L98:
  cmpq   $0x0,-0x20(%rbp)
  jns    L35
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void heapsort(long long int a[], long long int n) {
  long long int i, j, k;
  long long int temp;
  for (i = 1; i < n; i++) {
    j = i;
    do {
      k = (j - 1) / 2;
      if (a[k] < a[j]) {
        temp = a[k];
        a[k] = a[j];
        a[j] = temp;
      }
      j = k;
    } while (j != 0);
  }
  for (i = (n - 1); i >= 0; i--) {
    temp = a[0];
    a[0] = a[i];
    a[i] = temp;
    k = 0;
    do {
      j = (2 * k) + 1;
      if ((a[j] < a[j + 1]) && (j < (i - 1))) {
        j++;
      }
      if ((a[k] < a[j]) && (j < i)) {
        temp = a[k];
        a[k] = a[j];
        a[j] = temp;
      }
      k = j;
    } while (k < i);
  }
}
```