user: Translate the below assembly code into C programming language:

```asm
<tr_heapsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L52
  subl   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L52
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
L52:
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L35
L45:
  mov    -0x8(%rbp),%ecx
  mov    -0xc(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <tr_fixdown@plt>
  subl   $0x1,-0xc(%rbp)
L35:
  cmpl   $0x0,-0xc(%rbp)
  jns    L45
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L15
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <tr_fixdown@plt>
L15:
  mov    -0x8(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L65
L24:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xc(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <tr_fixdown@plt>
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
  subl   $0x1,-0xc(%rbp)
L65:
  cmpl   $0x0,-0xc(%rbp)
  jg     L24
  nop
  nop
  leave
  ret
```

assistant: ```c
void tr_heapsort(const int *ISAd, int *SA, int size) {
  int i, m;
  int t;
  m = size;
  if ((size % 2) == 0) {
    m--;
    if (ISAd[SA[m / 2]] < ISAd[SA[m]]) {
      do {
        t = (SA[m]);
        (SA[m]) = (SA[m / 2]);
        (SA[m / 2]) = t;
      } while (0);
    }
  }
  for (i = m / 2 - 1; 0 <= i; --i) {
    tr_fixdown(ISAd, SA, i, m);
  }
  if ((size % 2) == 0) {
    do {
      t = (SA[0]);
      (SA[0]) = (SA[m]);
      (SA[m]) = t;
    } while (0);
    tr_fixdown(ISAd, SA, 0, m);
  }
  for (i = m - 1; 0 < i; --i) {
    t = SA[0], SA[0] = SA[i];
    tr_fixdown(ISAd, SA, 0, i);
    SA[i] = t;
  }
}
```