Turns a simple AST into TAC and optimizes it a bit