Demand-Driven Static Analysis of Heap-Manipulating Programs