public int drainStack(int store, int load, StackSize size) {
        int difference = current.get(current.size() - 1).getSize() - size.getSize();
        if (current.size() == 1 && difference == 0) {
            return 0;
        } else {
            super.visitVarInsn(store, freeIndex);
            if (difference == 1) {
                super.visitInsn(Opcodes.POP);
            } else if (difference != 0) {
                throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
            }
            doDrain(current.subList(0, current.size() - 1));
            super.visitVarInsn(load, freeIndex);
            return freeIndex + size.getSize();
        }
    }
public int drainStack ( int store , int load , StackSize size ) { int difference = current . get ( current . size ( ) - 1 ) . getSize ( ) - size . getSize ( ) ; if ( current . size ( ) == 1 && difference == 0 ) { return 0 ; } else { super . visitVarInsn ( store , freeIndex ) ; if ( difference == 1 ) { super . visitInsn ( Opcodes . POP ) ; } else if ( difference != 0 ) { throw new IllegalStateException ( "Unexpected remainder on the operand stack: " + difference ) ; } doDrain ( current . subList ( 0 , current . size ( ) - 1 ) ) ; super . visitVarInsn ( load , freeIndex ) ; return freeIndex + size . getSize ( ) ; } }
Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored
in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed
back onto the operand stack.

@param store The opcode used for storing the top value.
@param load  The opcode used for loading the top value.
@param size  The size of the value on top of the operand stack.
@return The minimal size of the local variable array that is required to perform the operation.