C standard

We're using C, so declarations have to be before statements. I couldn't
compile without fixing these.