Replaces a boolean return with equivalent if-then-else statements, if possible.