user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  lea    D48(%rip),%rdi
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  lea    D98(%rip),%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  lea    D32(%rip),%rdi
  call   <printf@plt>
  cmpl   $0x0,0xc(%rsp)
  jle    L2
  mov    %r12,%rbp
  mov    $0x0,%ebx
  lea    D98(%rip),%r13
L10:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %ebx,0xc(%rsp)
  jg     L10
L2:
  lea    D80(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    %r12,%rdi
  call   <printIntArray@plt>
  lea    0x10(%rsp),%rbx
  mov    0xc(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cloneIntArray@plt>
  lea    D51(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArray@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <IntArraySelSort@plt>
  lea    D49(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArray@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0xc(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cloneIntArray@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <IntArrayInsSort@plt>
  lea    D17(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArray@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0xc(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cloneIntArray@plt>
  mov    0xc(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    $0x0,%esi
  mov    0x10(%rsp),%rdi
  call   <intArrayMergeSort@plt>
  lea    D74(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArray@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0xc(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cloneIntArray@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    0xc(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    $0x0,%esi
  mov    0x10(%rsp),%rdi
  call   <intArrayQuickSort@plt>
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArray@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0xc(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cloneIntArray@plt>
  mov    0xc(%rsp),%esi
  mov    %rbx,%rdi
  call   <intArrayHeapSort@plt>
  lea    D106(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  mov    0x10(%rsp),%rdi
  call   <printIntArrayReverse@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L7:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D48
datatype: string
name: parse_data
arguments: data_tag: D98
datatype: string
name: parse_data
arguments: data_tag: D32
datatype: string
name: parse_data
arguments: data_tag: D80
datatype: string
name: parse_data
arguments: data_tag: D51
datatype: string
name: parse_data
arguments: data_tag: D49
datatype: string
name: parse_data
arguments: data_tag: D17
datatype: string
name: parse_data
arguments: data_tag: D74
datatype: string
name: parse_data
arguments: data_tag: D2
datatype: string
name: parse_data
arguments: data_tag: D106
datatype: string

tool: D48: How many elements do you want store in the array? 

tool: D98: %d

tool: D32: Insert elements:


tool: D80: This is your array:


tool: D51: This is the temporary array that we're going to order:


tool: D49: This is the array ordered with selection sort:


tool: D17: This is the array ordered with insertion sort:


tool: D74: This is the array ordered with mergesort:


tool: D2: This is the array ordered with quicksort:


tool: D106: This is the array ordered with heapsort:


assistant: ```c
int main() {
  int *a = NULL, *temp = NULL, n, i;
  printf("How many elements do you want store in the array? ");
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  printf("Insert elements:\n");
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  printf("This is your array:\n");
  printIntArray(a, n);
  cloneIntArray(&temp, a, n);
  printf("This is the temporary array that we're going to order:\n");
  printIntArray(temp, n);
  IntArraySelSort(temp, n);
  printf("This is the array ordered with selection sort:\n");
  printIntArray(temp, n);
  free(temp);
  cloneIntArray(&temp, a, n);
  IntArrayInsSort(temp, n);
  printf("This is the array ordered with insertion sort:\n");
  printIntArray(temp, n);
  free(temp);
  cloneIntArray(&temp, a, n);
  intArrayMergeSort(temp, 0, n - 1);
  printf("This is the array ordered with mergesort:\n");
  printIntArray(temp, n);
  free(temp);
  cloneIntArray(&temp, a, n);
  srand(time(NULL));
  intArrayQuickSort(temp, 0, n - 1);
  printf("This is the array ordered with quicksort:\n");
  printIntArray(temp, n);
  free(temp);
  cloneIntArray(&temp, a, n);
  intArrayHeapSort(&temp, n);
  printf("This is the array ordered with heapsort:\n");
  printIntArrayReverse(temp, n);
  free(temp);
  return 0;
}
```