[CLN] Merge inference into lib.pyx
Continue trimming down _libs/src.

src/inference is a minor hassle, particularly because ATM there are imports/cimports in both it and lib.  Its existence also complicates setup.py a bit.

Evidently parse_helper.h depended on the order in which it was included (I assume this is a code smell in C, but who knows).  Fixed this.

This is almost cut/paste.  The changes are:
 - Arrange (and de-duplicate) imports at the top of lib
 - whitespace fixups
 - change `for i from 0 <= i < n:` to `for i in range(n):` in a few places
 - a couple of comments about potential optimizations in the next pass
