@Override
	public long coalescePatches(Language language, List<Step> steps) {
		long threadKey = -1;
		int toRemove = 0;
		Map<AddressSpace, SemisparseByteArray> patches = new TreeMap<>();
		for (int i = steps.size() - 1; i >= 0; i--) {
			Step step = steps.get(i);
			long stk = step.getThreadKey();
			if (threadKey == -1) {
				threadKey = stk;
			}
			else if (stk != -1 && stk != threadKey) {
				break;
			}
			if (!(step instanceof PatchStep)) {
				break;
			}
			PatchStep ps = (PatchStep) step;
			Map<AddressSpace, SemisparseByteArray> subs = ps.getPatches(language);
			if (subs == null) {
				break;
			}
			mergePatches(subs, patches);
			patches = subs;
			toRemove++;
		}
		List<String> sleighPatches = generateSleigh(language, patches);
		assert sleighPatches.size() <= toRemove;
		for (String sleighPatch : sleighPatches) {
			PatchStep ps = (PatchStep) steps.get(steps.size() - toRemove);
			ps.setSleigh(sleighPatch);
			toRemove--;
		}
		return toRemove;
	}
Generate multiple lines of Sleigh, all to set a single variable

@param language the target language
@param address the (start) address of the variable
@param data the bytes to write to the variable
@return the lines of Sleigh code
Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/PatchStep.java