Generates code with correct conditional branching. Bug in addition