convert asserts into if tests and check for phis at merge