[PATCH 1/4] Clean up in sim.c.