Rewritten analyzer in C, works well (but code is dirty)