the source code is annotated. be forewarned, it is full of bats and rusty nails and goblins and things.
var inflate =your_input
create an inflate stream. each inflate stream carries a 32k memory overhead (for the window).
create a new inflate stream that recycles the output window (and JIT warmup) from the previous inflate stream.