func (d *Decoder) loadBinInt() error {
	var b [4]byte
	_, err := io.ReadFull(d.r, b[:])
	if err != nil {
		return err
	}
	v := binary.LittleEndian.Uint32(b[:])
	d.push(int64(v))
	return nil
}
Push a four-byte signed int
package ogórek
import (
	"bufio"
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"math"
	"math/big"
	"reflect"
	"strconv"
)
const (
	opMark           byte = '('  
	opStop                = '.'  
	opPop                 = '0'  
	opPopMark             = '1'  
	opDup                 = '2'  
	opFloat               = 'F'  
	opInt                 = 'I'  
	opBinint              = 'J'  
	opBinint1             = 'K'  
	opLong                = 'L'  
	opBinint2             = 'M'  
	opNone                = 'N'  
	opPersid              = 'P'  
	opBinpersid           = 'Q'  
	opReduce              = 'R'  
	opString              = 'S'  
	opBinstring           = 'T'  
	opShortBinstring      = 'U'  
	opUnicode             = 'V'  
	opBinunicode          = 'X'  
	opAppend              = 'a'  
	opBuild               = 'b'  
	opGlobal              = 'c'  
	opDict                = 'd'  
	opEmptyDict           = '}'  
	opAppends             = 'e'  
	opGet                 = 'g'  
	opBinget              = 'h'  
	opInst                = 'i'  
	opLongBinget          = 'j'  
	opList                = 'l'  
	opEmptyList           = ']'  
	opObj                 = 'o'  
	opPut                 = 'p'  
	opBinput              = 'q'  
	opLongBinput          = 'r'  
	opSetitem             = 's'  
	opTuple               = 't'  
	opEmptyTuple          = ')'  
	opSetitems            = 'u'  
	opBinfloat            = 'G'  
	opTrue  = "I01\n"  
	opFalse = "I00\n"  
	opProto    = '\x80'  
	opNewobj   = '\x81'  
	opExt1     = '\x82'  
	opExt2     = '\x83'  
	opExt4     = '\x84'  
	opTuple1   = '\x85'  
	opTuple2   = '\x86'  
	opTuple3   = '\x87'  
	opNewtrue  = '\x88'  
	opNewfalse = '\x89'  
	opLong1    = '\x8a'  
	opLong4    = '\x8b'  
	opShortBinUnicode = '\x8c'  
	opMemoize         = '\x94'  
	opFrame           = '\x95'  
)
var errNotImplemented = errors.New("unimplemented opcode")
var ErrInvalidPickleVersion = errors.New("invalid pickle version")
var errNoMarker = errors.New("no marker in stack")
var errStackUnderflow = errors.New("pickle: stack underflow")
type OpcodeError struct {
	Key byte
	Pos int
}
func (e OpcodeError) Error() string {
	return fmt.Sprintf("Unknown opcode %d (%c) at position %d: %q", e.Key, e.Key, e.Pos, e.Key)
}
type mark struct{}
type None struct{}
type Tuple []interface{}
type Decoder struct {
	r     *bufio.Reader
	stack []interface{}
	memo  map[string]interface{}
	buf bytes.Buffer
	line  []byte
}
func NewDecoder(r io.Reader) *Decoder {
	reader := bufio.NewReader(r)
	return &Decoder{r: reader, stack: make([]interface{}, 0), memo: make(map[string]interface{})}
}
func (d *Decoder) Decode() (interface{}, error) {
	insn := 0
loop:
	for {
		key, err := d.r.ReadByte()
		if err != nil {
			if err == io.EOF && insn != 0 {
				err = io.ErrUnexpectedEOF
			}
			return nil, err
		}
		insn++
		switch key {
		case opMark:
			d.mark()
		case opStop:
			break loop
		case opPop:
			_, err = d.pop()
		case opPopMark:
			d.popMark()
		case opDup:
			err = d.dup()
		case opFloat:
			err = d.loadFloat()
		case opInt:
			err = d.loadInt()
		case opBinint:
			err = d.loadBinInt()
		case opBinint1:
			err = d.loadBinInt1()
		case opLong:
			err = d.loadLong()
		case opBinint2:
			err = d.loadBinInt2()
		case opNone:
			err = d.loadNone()
		case opPersid:
			err = d.loadPersid()
		case opBinpersid:
			err = d.loadBinPersid()
		case opReduce:
			err = d.reduce()
		case opString:
			err = d.loadString()
		case opBinstring:
			err = d.loadBinString()
		case opShortBinstring:
			err = d.loadShortBinString()
		case opUnicode:
			err = d.loadUnicode()
		case opBinunicode:
			err = d.loadBinUnicode()
		case opAppend:
			err = d.loadAppend()
		case opBuild:
			err = d.build()
		case opGlobal:
			err = d.global()
		case opDict:
			err = d.loadDict()
		case opEmptyDict:
			err = d.loadEmptyDict()
		case opAppends:
			err = d.loadAppends()
		case opGet:
			err = d.get()
		case opBinget:
			err = d.binGet()
		case opInst:
			err = d.inst()
		case opLong1:
			err = d.loadLong1()
		case opNewfalse:
			err = d.loadBool(false)
		case opNewtrue:
			err = d.loadBool(true)
		case opLongBinget:
			err = d.longBinGet()
		case opList:
			err = d.loadList()
		case opEmptyList:
			d.push([]interface{}{})
		case opObj:
			err = d.obj()
		case opPut:
			err = d.loadPut()
		case opBinput:
			err = d.binPut()
		case opLongBinput:
			err = d.longBinPut()
		case opSetitem:
			err = d.loadSetItem()
		case opTuple:
			err = d.loadTuple()
		case opTuple1:
			err = d.loadTuple1()
		case opTuple2:
			err = d.loadTuple2()
		case opTuple3:
			err = d.loadTuple3()
		case opEmptyTuple:
			d.push(Tuple{})
		case opSetitems:
			err = d.loadSetItems()
		case opBinfloat:
			err = d.binFloat()
		case opFrame:
			err = d.loadFrame()
		case opShortBinUnicode:
			err = d.loadShortBinUnicode()
		case opMemoize:
			err = d.loadMemoize()
		case opProto:
			v, err := d.r.ReadByte()
			if err == nil && v != 2 {
				err = ErrInvalidPickleVersion
			}
		default:
			return nil, OpcodeError{key, insn}
		}
		if err != nil {
			if err == errNotImplemented {
				return nil, OpcodeError{key, insn}
			}
			if err == io.EOF {
				err = io.ErrUnexpectedEOF
			}
			return nil, err
		}
	}
	return d.pop()
}
func (d *Decoder) readLine() ([]byte, error) {
	var (
		data     []byte
		isPrefix = true
		err      error
	)
	d.line = d.line[:0]
	for isPrefix {
		data, isPrefix, err = d.r.ReadLine()
		if err != nil {
			return d.line, err
		}
		d.line = append(d.line, data...)
	}
	return d.line, nil
}
func (d *Decoder) mark() {
	d.push(mark{})
}
func (d *Decoder) marker() (int, error) {
	m := mark{}
	for k := len(d.stack) - 1; k >= 0; k-- {
		if d.stack[k] == m {
			return k, nil
		}
	}
	return 0, errNoMarker
}
func (d *Decoder) push(v interface{}) {
	d.stack = append(d.stack, v)
}
func (d *Decoder) pop() (interface{}, error) {
	ln := len(d.stack) - 1
	if ln < 0 {
		return nil, errStackUnderflow
	}
	v := d.stack[ln]
	d.stack = d.stack[:ln]
	return v, nil
}
func (d *Decoder) xpop() interface{} {
	v, err := d.pop()
	if err != nil {
		panic(err)
	}
	return v
}
func (d *Decoder) popMark() error {
	return errNotImplemented
}
func (d *Decoder) dup() error {
	if len(d.stack) < 1 {
		return errStackUnderflow
	}
	d.stack = append(d.stack, d.stack[len(d.stack)-1])
	return nil
}
func (d *Decoder) loadFloat() error {
	line, err := d.readLine()
	if err != nil {
		return err
	}
	v, err := strconv.ParseFloat(string(line), 64)
	if err != nil {
		return err
	}
	d.push(interface{}(v))
	return nil
}
func (d *Decoder) loadInt() error {
	line, err := d.readLine()
	if err != nil {
		return err
	}
	var val interface{}
	switch string(line) {
	case opFalse[1:3]:
		val = false
	case opTrue[1:3]:
		val = true
	default:
		i, err := strconv.ParseInt(string(line), 10, 64)
		if err != nil {
			return err
		}
		val = i
	}
	d.push(val)
	return nil
}