Fixed bugs and unused variables in decode and sim.c