private static AddressSetView getInitializedMemory(Program program,
			boolean exectuableMemoryOnly) {
		if (program == null) {
			return null;
		}
		Memory memory = program.getMemory();

		// If EXTERNAL block is initialized - it needs to be removed from initialized set below
		MemoryBlock externalBlock = memory.getBlock(MemoryBlock.EXTERNAL_BLOCK_NAME);
		if (externalBlock != null && !externalBlock.isInitialized()) {
			externalBlock = null;
		}

		AddressSet set;
		if (!exectuableMemoryOnly) {
			if (externalBlock == null) {
				return memory.getLoadedAndInitializedAddressSet();
			}
			set = new AddressSet(memory.getLoadedAndInitializedAddressSet());
		}
		else {
			set = new AddressSet();
			for (MemoryBlock block : memory.getBlocks()) {
				if (block.isInitialized() && block.isExecute()) {
					set.add(block.getStart(), block.getEnd());
				}
			}
		}
		if (externalBlock != null) {
			set.delete(externalBlock.getStart(), externalBlock.getEnd());
		}
		return set;
	}
@param program the program to check
@return true if program RESTRICT_DISASSEMBLY_TO_EXECUTE_MEMORY_PROPERTY has been enabled
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/disassemble/Disassembler.java