@Override
	public void encode(Encoder encoder) throws IOException {
		encoder.openElement(ELEM_PCODE);
		if (type == CALLMECHANISM_TYPE && subType >= 0) {
			encoder.writeString(ATTRIB_INJECT, (subType == 0) ? "uponentry" : "uponreturn");
		}
		if (paramShift != 0) {
			encoder.writeSignedInteger(ATTRIB_PARAMSHIFT, paramShift);
		}
		if (pcodeTemplate == null) {
			encoder.writeBool(ATTRIB_DYNAMIC, true);
		}
		if (incidentalCopy) {
			encoder.writeBool(ATTRIB_INCIDENTALCOPY, incidentalCopy);
		}
		for (InjectParameter param : inputlist) {
			encoder.openElement(ELEM_INPUT);
			encoder.writeString(ATTRIB_NAME, param.getName());
			encoder.writeSignedInteger(ATTRIB_SIZE, param.getSize());
			encoder.closeElement(ELEM_INPUT);
		}
		for (InjectParameter param : output) {
			encoder.openElement(ELEM_OUTPUT);
			encoder.writeString(ATTRIB_NAME, param.getName());
			encoder.writeSignedInteger(ATTRIB_SIZE, param.getSize());
			encoder.closeElement(ELEM_OUTPUT);
		}
		if (pcodeTemplate != null) {
			// Decompiler will not read the <body> tag
			encoder.openElement(ELEM_BODY);
			encoder.writeString(ATTRIB_CONTENT, " local tmp:1 = 0; ");
			encoder.closeElement(ELEM_BODY);
		}
		encoder.closeElement(ELEM_PCODE);
	}
All input and output parameters must have a unique index.
Order them so that inputs come first, then outputs
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InjectPayloadSleigh.java