private static DecodedInstruction decodeRegisterList(
      InstructionCodec format, int opcodeUnit, CodeInput in) throws EOFException {
    int opcode = byte0(opcodeUnit);
    int e = nibble2(opcodeUnit);
    int registerCount = nibble3(opcodeUnit);
    int index = in.read();
    int abcd = in.read();
    int a = nibble0(abcd);
    int b = nibble1(abcd);
    int c = nibble2(abcd);
    int d = nibble3(abcd);
    IndexType indexType = OpcodeInfo.getIndexType(opcode);

    // TODO: Having to switch like this is less than ideal.
    switch (registerCount) {
      case 0:
        return new ZeroRegisterDecodedInstruction(format, opcode, index, indexType, 0, 0L);
      case 1:
        return new OneRegisterDecodedInstruction(format, opcode, index, indexType, 0, 0L, a);
      case 2:
        return new TwoRegisterDecodedInstruction(format, opcode, index, indexType, 0, 0L, a, b);
      case 3:
        return new ThreeRegisterDecodedInstruction(
            format, opcode, index, indexType, 0, 0L, a, b, c);
      case 4:
        return new FourRegisterDecodedInstruction(
            format, opcode, index, indexType, 0, 0L, a, b, c, d);
      case 5:
        return new FiveRegisterDecodedInstruction(
            format, opcode, index, indexType, 0, 0L, a, b, c, d, e);
      default: // fall out
    }

    throw new DexException("bogus registerCount: " + Hex.uNibble(registerCount));
  }
Helper method that decodes any of the register-list formats.
android/android_framework/dex-maker/src/main/java/com/android/dx/io/instructions/InstructionCodec.java