Remove unused local varaiable
Fix branch handling in 'if' and 'while'

The issue was that for 'if' the branch instructions were being added to
the basic block that starts the body, not the one that ends it.
Add BasicBlock isEmpty method