# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


from base import *
from bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os
    return read_int()

def read_str():
    n = read_int()
    return env(Deserialize).file.read(n).decode('UTF-8')

def read_node(t, path):
    if isinstance(t, TData):
        state = env(Deserialize)

        assert type(t.data) is DataType, "Bad TData containing %r" % (t.data,)
        apps = app_map(t.data, t.appTypes)

        ctors = t.data.ctors
        if len(ctors) > 1:
            form = ctors[read_int()]
        else:
            form = ctors[0]
        assert isinstance(form, Ctor), "Unexpected form %s" % (form,)
        ctor = extrinsic(TrueRepresentation, form)

        # Bleh.
        val = ctor(*[None for f in form.fields])
        if not t.data.opts.valueType:
            state.index += 1
            state.ownMap[state.index] = val
            add_extrinsic(Location, val, Pos(state.module, state.index))

        for field in form.fields:
            fnm = extrinsic(Name, field)

# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


# Path: deserialize.py
from base import *
from bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os

    return read_int()

def read_str():
    n = read_int()
    return env(Deserialize).file.read(n).decode('UTF-8')

def read_node(t, path):
    if isinstance(t, TData):
        state = env(Deserialize)

        assert type(t.data) is DataType, "Bad TData containing %r" % (t.data,)
        apps = app_map(t.data, t.appTypes)

        ctors = t.data.ctors
        if len(ctors) > 1:
            form = ctors[read_int()]
        else:
            form = ctors[0]
        assert isinstance(form, Ctor), "Unexpected form %s" % (form,)
        ctor = extrinsic(TrueRepresentation, form)

        # Bleh.
        val = ctor(*[None for f in form.fields])
        if not t.data.opts.valueType:
            state.index += 1
            state.ownMap[state.index] = val
            add_extrinsic(Location, val, Pos(state.module, state.index))

        for field in form.fields:
            fnm = extrinsic(Name, field)

            ft = subst(apps, field.type)