code: private static void splitMsgForGender(
        MsgNode msg,
        ExprRootNode genderExpr,
        @Nullable String baseSelectVarName,
        IdGenerator nodeIdGen) {
  
      List<StandaloneNode> origChildren = ImmutableList.copyOf(msg.getChildren());
      msg.clearChildren();
  
      MsgSelectCaseNode femaleCase =
          new MsgSelectCaseNode(nodeIdGen.genId(), msg.getSourceLocation(), "female");
      femaleCase.addChildren(SoyTreeUtils.cloneListWithNewIds(origChildren, nodeIdGen));
      MsgSelectCaseNode maleCase =
          new MsgSelectCaseNode(nodeIdGen.genId(), msg.getSourceLocation(), "male");
      maleCase.addChildren(SoyTreeUtils.cloneListWithNewIds(origChildren, nodeIdGen));
      MsgSelectDefaultNode defaultCase =
          new MsgSelectDefaultNode(nodeIdGen.genId(), msg.getSourceLocation());
      defaultCase.addChildren(SoyTreeUtils.cloneListWithNewIds(origChildren, nodeIdGen));
  
      MsgSelectNode selectNode =
          new MsgSelectNode(
              nodeIdGen.genId(), msg.getSourceLocation(), genderExpr, baseSelectVarName);
      selectNode.addChild(femaleCase);
      selectNode.addChild(maleCase);
      selectNode.addChild(defaultCase);
  
      msg.addChild(selectNode);
    }
docs: Helper to split a msg for gender, by adding a 'select' node and cloning the msg's contents into
  all 3 cases of the 'select' node ('female'/'male'/default).
  
  @param msg The message to split.
  @param genderExpr The expression for the gender value.
  @param baseSelectVarName The base select var name to use, or null if it should be generated
  from the gender expression.
  @param nodeIdGen The id generator for the current tree