move var decl to top of fn for stricter C compiler on win32