package binary

import (
	
	
	
	
	

	
	
)

func decodeValueTypes( *bytes.Reader,  uint32) ([]wasm.ValueType, error) {
	if  == 0 {
		return nil, nil
	}

	 := make([]wasm.ValueType, )
	,  := io.ReadFull(, )
	if  != nil {
		return nil, 
	}

	for ,  := range  {
		switch  {
		case wasm.ValueTypeI32, wasm.ValueTypeF32, wasm.ValueTypeI64, wasm.ValueTypeF64,
			wasm.ValueTypeExternref, wasm.ValueTypeFuncref, wasm.ValueTypeV128:
		default:
			return nil, fmt.Errorf("invalid value type: %d", )
		}
	}
	return , nil
}

// decodeUTF8 decodes a size prefixed string from the reader, returning it and the count of bytes read.
// contextFormat and contextArgs apply an error format when present
func decodeUTF8( *bytes.Reader,  string,  ...interface{}) (string, uint32, error) {
	, ,  := leb128.DecodeUint32()
	if  != nil {
		return "", 0, fmt.Errorf("failed to read %s size: %w", fmt.Sprintf(, ...), )
	}

	if  == 0 {
		return "", uint32(), nil
	}

	 := make([]byte, )
	if _,  = io.ReadFull(, );  != nil {
		return "", 0, fmt.Errorf("failed to read %s: %w", fmt.Sprintf(, ...), )
	}

	if !utf8.Valid() {
		return "", 0, fmt.Errorf("%s is not valid UTF-8", fmt.Sprintf(, ...))
	}

	 := unsafe.String(&[0], int())
	return ,  + uint32(), nil
}