public static AssemblyPatternBlock fromPattern(DisjointPattern pat, int minLen,
			boolean context) {
		PatternBlock block = pat.getBlock(context);
		if (block == null || block.alwaysTrue()) {
			return new AssemblyPatternBlock(0, minLen);
		}
		if (block.alwaysFalse()) {
			return null;
		}
		int offset = block.getOffset();
		int nzlen = Math.max(block.getLength(), minLen) - offset;

		int[] vec = block.getMaskVector();
		ByteBuffer buf = ByteBuffer.allocate(vec.length * 4);
		int datlen = Math.min(nzlen, buf.capacity());

		for (int i = 0; i < vec.length; i++) {
			buf.putInt(i * 4, vec[i]);
		}
		byte[] mask = new byte[nzlen];
		for (int i = 0; i < datlen; i++) {
			mask[i] = buf.get(i);
		}

		vec = block.getValueVector();
		for (int i = 0; i < vec.length; i++) {
			buf.putInt(i * 4, vec[i]);
		}
		byte[] vals = new byte[nzlen];
		for (int i = 0; i < datlen; i++) {
			vals[i] = buf.get(i);
		}
		return new AssemblyPatternBlock(offset, mask, vals);
	}
Convert a block from a disjoint pattern into an assembly pattern block

@param pat the pattern to convert
@param minLen the minimum byte length of the block
@param context true to select the context block, false to select the instruction block
@return the converted pattern block
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyPatternBlock.java