user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  lea    D67(%rip),%r12
  lea    D44(%rip),%rbp
  lea    D27(%rip),%rbx
  lea    D55(%rip),%r13
  jmp    L42
L127:
  mov    %r13,%rdi
  call   <printf@plt>
  lea    0x8(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  lea    D16(%rip),%rdi
  call   <printf@plt>
  cmpl   $0x0,0x8(%rsp)
  jle    L121
  lea    0x10(%rsp),%r15
  mov    $0x0,%r14d
L107:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  add    $0x1,%r14d
  add    $0x4,%r15
  cmp    %r14d,0x8(%rsp)
  jg     L107
  jmp    L121
L56:
  cmp    $0x4,%eax
  jne    L28
  lea    D96(%rip),%rdi
  call   <printf@plt>
  jmp    L139
L34:
  mov    0x8(%rsp),%eax
  lea    -0x1(%rax),%edx
  lea    0x10(%rsp),%r14
  mov    $0x0,%esi
  mov    %r14,%rdi
  call   <mergeSort@plt>
  lea    D53(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%esi
  mov    %r14,%rdi
  call   <printArray@plt>
L139:
  mov    $0x0,%eax
  call   <getch@plt>
  cmpl   $0x4,0xc(%rsp)
  je     L68
L42:
  mov    %r12,%rdi
  call   <system@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x2,%eax
  jbe    L127
L121:
  mov    0xc(%rsp),%eax
  cmp    $0x3,%eax
  je     L48
  jg     L56
  cmp    $0x1,%eax
  je     L34
  cmp    $0x2,%eax
  jne    L28
  mov    0x8(%rsp),%eax
  lea    -0x1(%rax),%edx
  lea    0x10(%rsp),%r14
  mov    $0x0,%esi
  mov    %r14,%rdi
  call   <quickSort@plt>
  lea    D53(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%esi
  mov    %r14,%rdi
  call   <printArray@plt>
  jmp    L139
L48:
  mov    0x8(%rsp),%eax
  lea    -0x1(%rax),%esi
  lea    0x10(%rsp),%r14
  mov    %r14,%rdi
  call   <heapSort@plt>
  lea    D53(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%esi
  mov    %r14,%rdi
  call   <printArray@plt>
  jmp    L139
L28:
  lea    D90(%rip),%rdi
  call   <printf@plt>
  jmp    L139
L68:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  mov    $0x0,%eax
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D67
datatype: string
name: read_data
arguments: tag: D44
datatype: string
name: read_data
arguments: tag: D27
datatype: string
name: read_data
arguments: tag: D55
datatype: string
name: read_data
arguments: tag: D16
datatype: string
name: read_data
arguments: tag: D96
datatype: string
name: read_data
arguments: tag: D53
datatype: string
name: read_data
arguments: tag: D90
datatype: string

tool: D67: cls

tool: D44: ===To implement various Sorting Algorithms===
1. MergeSort
2. QuickSort
3. HeapSort
4. Exit
Enter your choice: 

tool: D27: %d

tool: D55: Enter Size of array: 

tool: D16: Enter Array elements: 

tool: D96: Thank you for using


tool: D53: Sorted array is: 

tool: D90: Invalid Choice please try again


assistant: ```c
int main() {
  int arr[50];
  int n, i;
  int choice;
  do {
    system("cls");
    printf("===To implement various Sorting Algorithms===\n"
           "1. MergeSort\n"
           "2. QuickSort\n"
           "3. HeapSort\n"
           "4. Exit\n"
           "Enter your choice: ");
    scanf("%d", &choice);
    if (choice < 4 && choice > 0) {
      printf("Enter Size of array: ");
      scanf("%d", &n);
      printf("Enter Array elements: ");
      for (i = 0; i < n; i++)
        scanf("%d", &arr[i]);
    }
    switch (choice) {
    case 1:
      mergeSort(arr, 0, n - 1);
      printf("Sorted array is: ");
      printArray(arr, n);
      break;
    case 2:
      quickSort(arr, 0, n - 1);
      printf("Sorted array is: ");
      printArray(arr, n);
      break;
    case 3:
      heapSort(arr, n - 1);
      printf("Sorted array is: ");
      printArray(arr, n);
      break;
    case 4:
      printf("Thank you for using\n");
      break;
    default:
      printf("Invalid Choice please try again\n");
      break;
    }
    getch();
  } while (choice != 4);
  return 0;
}
```