inplementation of timsort for integers in C