docs: Statement detachForRender(final Expression render) {
      checkArgument(render.resultType().equals(RENDER_RESULT_TYPE));
      final Label reattachPoint = new Label();
      final SaveRestoreState saveRestoreState = variables.saveRestoreState();
  
      Statement restore = saveRestoreState.restore();
      int state = addState(reattachPoint, restore);
      final Statement saveState =
          stateField.putInstanceField(thisExpr, BytecodeUtils.constant(state));
      return new Statement() {
        @Override
        protected void doGen(CodeBuilder adapter) {
          adapter.mark(reattachPoint);
          // Legend: RR = RenderResult, Z = boolean
          render.gen(adapter); // Stack: RR
          adapter.dup(); // Stack: RR, RR
          MethodRef.RENDER_RESULT_IS_DONE.invokeUnchecked(adapter); // Stack: RR, Z
          // if isDone goto Done
          Label end = new Label();
          adapter.ifZCmp(Opcodes.IFNE, end); // Stack: RR
          saveRestoreState.save().gen(adapter);
          saveState.gen(adapter);
          adapter.returnValue();
          adapter.mark(end);
          adapter.pop(); // Stack:
        }
      };
    }