user: What would the C source look like for the assembly code provided here:

```asm
<sift>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8d,-0x3c(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x30(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  setg   %al
  movzbl %al,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L8
L25:
  mov    -0x10(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jge    L15
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  call   *%rax
  test   %eax,%eax
  jne    L15
  addl   $0x1,-0x10(%rbp)
L15:
  mov    -0x10(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%rax
  mov    -0x38(%rbp),%rdx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   *%rdx
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L8
  mov    -0x10(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x14(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edx
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  setg   %al
  movzbl %al,%eax
  mov    %eax,-0xc(%rbp)
L8:
  cmpl   $0x0,-0xc(%rbp)
  je     L25
  mov    -0x14(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void sift(unsigned char *heap, int elementsize, int (*elementorder)(void *, void *), int first, int last) {
  int i = first, j = 2 * first + 1, q = j > last;
  void *x = malloc(elementsize);
  memcpy(x, &heap[i * elementsize], elementsize);
  while (!q) {
    if (j < last && !elementorder(&heap[j * elementsize], &heap[(j + 1) * elementsize]))
      j++;
    q = elementorder(x, &heap[j * elementsize]);
    if (!q) {
      memcpy(&heap[i * elementsize], &heap[j * elementsize], elementsize);
      i = j;
      j = 2 * i + 1;
      q = j > last;
    }
  }
  memcpy(&heap[i * elementsize], x, elementsize);
  free(x);
}
```