AST-to-IR lowering is a real, named phase in every compiler: Clang emits LLVM IR in CodeGenModule, rustc lowers HIR to MIR, and V8 translates ASTs to bytecode in Ignition. The temporaries-and-labels bookkeeping you are doing here is exactly what those lowering passes manage at scale.