TruthUtils: Fix logic errors in old_to_new_simulation_scheme.
Fix errors related to operator precedence, and an apparent backwards comparison. Rewrite complex expressions to make more readable and factor out duplication. Fixes clang warnings in passing.