private static void visit(@Nonnull Set<AbstractInsnNode> visited, @Nonnull List<AbstractInsnNode> startingPoints) {
		Queue<AbstractInsnNode> todo = new ArrayDeque<>(startingPoints);
		while (!todo.isEmpty()) {
			AbstractInsnNode insn = todo.remove();
			while (insn != null && visited.add(insn)) {
				handleNext:
				{
					switch (insn.getType()) {
						case AbstractInsnNode.INSN -> {
							if (AsmInsnUtil.isTerminalOrAlwaysTakeFlowControl(insn.getOpcode()))
								break handleNext;
						}
						case AbstractInsnNode.JUMP_INSN -> {
							JumpInsnNode jin = (JumpInsnNode) insn;
							todo.add(jin.label);
							if (AsmInsnUtil.isTerminalOrAlwaysTakeFlowControl(jin.getOpcode()))
								break handleNext;
						}
						case AbstractInsnNode.TABLESWITCH_INSN -> {
							TableSwitchInsnNode tsin = (TableSwitchInsnNode) insn;
							todo.add(tsin.dflt);
							todo.addAll(tsin.labels);
							break handleNext;
						}
						case AbstractInsnNode.LOOKUPSWITCH_INSN -> {
							LookupSwitchInsnNode lsin = (LookupSwitchInsnNode) insn;
							todo.add(lsin.dflt);
							todo.addAll(lsin.labels);
							break handleNext;
						}
					}
					insn = insn.getNext();
				}
			}
		}
	}
A transformer that removes dead code.

@author Matt Coley
recaf-core/src/main/java/software/coley/recaf/services/deobfuscation/transform/generic/DeadCodeRemovingTransformer.java