extract consts
move publics to top
simplify Decode