Add codegen for branches