move SAM parsing to C extension, new interface