fix AIOOBE in dfa contract processing
(cherry picked from commit 3a0093d)
IDEA-122414 Boolean expression simplification changes behavior of the code
(cherry picked from commit 6b91f55)