Implement a better fix for PR15185.

If the return type is a pointer and the call returns an integer, then do the
inttoptr convertions. And vice versa.