Implements an in-place heap sort function that takes arguments (N, A), where N is the number of elements in the array A, starting from index 1. The heapsort algorithm is from Numerical Recipes in C, section 9.2, pg 247. The values that are sorted are randomly generated integers. This tests the efficiency of your array bounds checking and null array checking, since a large number of array accesses are made. It also tests your compiler's ability to generate IR and perform dataflow analysis on the heapsort function, which has fairly complicated control flow.
Source: [heapsort.im heapsort.cpp
Output: The first pair of elements that is not in sorted order, or if the sort is correct, the last element in the array.