It's going to be hard for us to pinpoint your seg fault with just this function. A seg fault is tricky, because it presents itself when an invalid memory access happens, but the cause of that invalid access might be elsewhere (e.g. some other function that corrupts the value in a pointer, a buffer overrun in malloc'ed memory, etc). It would help us if you provided the smallest, compilable program that produces the error, along with the input you gave the program that causes the problem. That would mean, in this case, an input file (or input to type in), a small main function that reads that input and stores it in an array of sorts, and your compare function. Then a quick compile, and we can throw it into a debugger, and find the problem very quickly. Note, you should learn to use a debugger if you haven't yet. You have reached the point in programming where it will be almost necessary, and it's about the most useful tool for a programmer.

In the mean time, a few smaller problems I see:

Code:
using namespace std;
For one, you're using/posting C++ in a C forum. Pick a language and stick to it. If you want to use C, get rid of this line. If you want to use C++, then there are better ways to implement a generic insertion sort in C++.

Second, the register keyword is no longer recommended. The compiler has a much better idea of what will produce the fastest code, so just remove that word, and enable optimizations in your compiler, and let it do the work.

Third, don't cast malloc. Read this: FAQ > Casting malloc - Cprogramming.com.

Your algorithm appears to be fine at first glance, but it's hard to tell without being able to run it. Again, give us a quick framework for inputting data and testing this, and I can say with more certainty whether your algorithm is good.