initial port of minifyLocals