Ok then. So maybe a short description of what histeq does is in place?
You need a function to map input values between -32k and +32k to the same output range. First you have to find the PDF by counting the occurances of each value, and then dividing by the total number of samples. Then a function to turn this into a uniform distribution use this as your mapping function: T(x) = (sum(pdf(i), i=-32 to x) - 0.5 ) * 64k
Then to turn a uniform pdf into a normal there is a fixed function, lets call it N. Compose these two functions, (N o T) and apply it to your data.
Edit: crappy autoformatting turned my variable into ® ...

Oh, and by the way... why not try your idea in matlab before coding in in C or something? It's much faster way of testing, and if it turns out it doesn't work, much less work down the drain. And if it does work you have a good prototype before you start writing c code.
Edit2: Just found that N is normally called Box-Muller transform. Google it.