toplevel: do verification and optimization