Move declarations to the top to avoid potential uninitialized use.

I didn't catch the warnings among the build spew before. Also, made
"--preopt" use stderr for its complaints about arguments.

Change-Id: I8d470ccc40c4cdc9131beb0991060358039e2727
diff --git a/dexopt/OptMain.c b/dexopt/OptMain.c
index 276db82..ca7031e 100644
--- a/dexopt/OptMain.c
+++ b/dexopt/OptMain.c
@@ -322,8 +322,17 @@
  */
 static int preopt(int argc, char* const argv[])
 {
+    int zipFd = -1;
+    int outFd = -1;
+    int result = -1;
+
     if (argc != 5) {
-        LOGE("Wrong number of args for --preopt (found %d)\n", argc);
+        /*
+         * Use stderr here, since this variant is meant to be called on
+         * the host side.
+         */
+        fprintf(stderr, "Wrong number of args for --preopt (found %d)\n",
+                argc);
         goto bail;
     }
 
@@ -331,10 +340,6 @@
     const char* outName = argv[3];
     const char* dexoptFlags = argv[4];
 
-    int zipFd = -1;
-    int outFd = -1;
-    int result = -1;
-
     zipFd = open(zipName, O_RDONLY);
     if (zipFd < 0) {
         perror(argv[0]);