private static int[] decompressTagSlow(byte[] input, int ipIndex, byte[] output, int outputLimit, int outputOffset,
                                           int opIndex)
        throws CorruptionException {
        // read the op code
        int opCode = loadByte(input, ipIndex++);
        int entry = lookupShort(opLookupTable, opCode);
        int trailerBytes = entry >>> 11;
        //
        // Key difference here
        //
        int trailer = 0;
        switch (trailerBytes) {
            case 4:
                trailer = (input[ipIndex + 3] & 0xff) << 24;
            case 3:
                trailer |= (input[ipIndex + 2] & 0xff) << 16;
            case 2:
                trailer |= (input[ipIndex + 1] & 0xff) << 8;
            case 1:
                trailer |= (input[ipIndex] & 0xff);
        }

        // advance the ipIndex past the op codes
        ipIndex += trailerBytes;
        int length = entry & 0xff;

        if ((opCode & 0x3) == SnappyRpcCompressor.LITERAL) {
            int literalLength = length + trailer;
            copyLiteral(input, ipIndex, output, opIndex, literalLength);
            ipIndex += literalLength;
            opIndex += literalLength;
        } else {
            // copyOffset/256 is encoded in bits 8..10.  By just fetching
            // those bits, we get copyOffset (since the bit-field starts at
            // bit 8).
            int copyOffset = entry & 0x700;
            copyOffset += trailer;

            // inline to force hot-spot to keep inline
            {
                int spaceLeft = outputLimit - opIndex;
                int srcIndex = opIndex - copyOffset;

                if (srcIndex < outputOffset) {
                    throw new CorruptionException("Invalid copy offset for opcode starting at " +
                        (ipIndex - trailerBytes - 1));
                }

                if (length <= 16 && copyOffset >= 8 && spaceLeft >= 16) {
                    // Fast path, used for the majority (70-80%) of dynamic invocations.
                    copyLong(output, srcIndex, output, opIndex);
                    copyLong(output, srcIndex + 8, output, opIndex + 8);
                } else if (spaceLeft >= length + MAX_INCREMENT_COPY_OVERFLOW) {
                    incrementalCopyFastPath(output, srcIndex, opIndex, length);
                } else {
                    incrementalCopy(output, srcIndex, output, opIndex, length);
                }
            }
            opIndex += length;
        }
        return new int[] { ipIndex, opIndex };
    }
This is a second copy of the inner loop of decompressTags used when near the end
of the input. The key difference is the reading of the trailer bytes.  The fast
code does a blind read of the next 4 bytes as an int, and this code assembles
the int byte-by-byte to assure that the array is not over run.  The reason this
code path is separate is the if condition to choose between these two seemingly
small differences costs like 10-20% of the throughput.  I'm hoping in future
versions of hot-spot this code can be integrated into the main loop but for now
it is worth the extra maintenance pain to get the extra 10-20%.
codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/snappy/SnappyDecompressor.java