text:
FS.readlink(current_path);
                            current_path = PATH.resolve(PATH.dirname(current_path), link);
                            var lookup = FS.lookupPath(current_path, {recurse_count: opts.recurse_count});
                            current = lookup.node;
                            if (count++ > 40) {
                                throw new FS.ErrnoError(ERRNO_CODES.ELOOP)
                            }
                        }
                    }
                }
                return {path: current_path, node: current}
            }),
            getPath: (function (node) {
                var path;
                while (true) {
                    if (FS.isRoot(node)) {
                        var mount = node.mount.mountpoint;
                        if (!path)return mount;
                        return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path
                    }
                    path = path ? node.name + "/" + path : node.name;
                    node = node.parent
                }
            }),
            hashName: (function (parentid, name) {
                var hash = 0;
                for (var i = 0; i < name.length; i++) {
                    hash = (hash << 5) - hash + name.charCodeAt(i) | 0
                }
                return (parentid + hash >>> 0) % FS.nameTable.length
            }),
            hashAddNode: (function (node) {
                var hash = FS.hashName(node.parent.id, node.name);
                node.name_next = FS.nameTable[hash];
                FS.nameTable[hash] = node
            }),
            hashRemoveNode: (function (node) {
                var hash = FS.hashName(node.parent.id, node.name);
                if (FS.nameTable[hash] === node) {
                    FS.nameTable[hash] = node.name_next
                } else {
                    var current = FS.nameTable[hash];
                    while (current) {
                        if (current.name_next === node) {
                            current.name_next = node.name_next;
                            break
                        }
                        current = current.name_next
                    }
                }
            }),
            lookupNode: (function (parent, name) {
                var err = FS.mayLookup(parent);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                var hash = FS.hashName(parent.id, name);
                for (var node = FS.nameTable[hash]; node; node = node.name_next) {
                    var nodeName = node.name;
                    if (node.parent.id === parent.id && nodeName === name) {
                        return node
                    }
                }
                return FS.lookup(parent, name)
            }),
            createNode: (function (parent, name, mode, rdev) {
                if (!FS.FSNode) {
                    FS.FSNode = (function (parent, name, mode, rdev) {
                        if (!parent) {
                            parent = this
                        }
                        this.parent = parent;
                        this.mount = parent.mount;
                        this.mounted = null;
                        this.id = FS.nextInode++;
                        this.name = name;
                        this.mode = mode;
                        this.node_ops = {};
                        this.stream_ops = {};
                        this.rdev = rdev
                    });
                    FS.FSNode.prototype = {};
                    var readMode = 292 | 73;
                    var writeMode = 146;
                    Object.defineProperties(FS.FSNode.prototype, {
                        read: {
                            get: (function () {
                                return (this.mode & readMode) === readMode
                            }), set: (function (val) {
                                val ? this.mode |= readMode : this.mode &= ~readMode
                            })
                        }, write: {
                            get: (function () {
                                return (this.mode & writeMode) === writeMode
                            }), set: (function (val) {
                                val ? this.mode |= writeMode : this.mode &= ~writeMode
                            })
                        }, isFolder: {
                            get: (function () {
                                return FS.isDir(this.mode)
                            })
                        }, isDevice: {
                            get: (function () {
                                return FS.isChrdev(this.mode)
                            })
                        }
                    })
                }
                var node = new FS.FSNode(parent, name, mode, rdev);
                FS.hashAddNode(node);
                return node
            }),
            destroyNode: (function (node) {
                FS.hashRemoveNode(node)
            }),
            isRoot: (function (node) {
                return node === node.parent
            }),
            isMountpoint: (function (node) {
                return !!node.mounted
            }),
            isFile: (function (mode) {
                return (mode & 61440) === 32768
            }),
            isDir: (function (mode) {
                return (mode & 61440) === 16384
            }),
            isLink: (function (mode) {
                return (mode & 61440) === 40960
            }),
            isChrdev: (function (mode) {
                return (mode & 61440) === 8192
            }),
            isBlkdev: (function (mode) {
                return (mode & 61440) === 24576
            }),
            isFIFO: (function (mode) {
                return (mode & 61440) === 4096
            }),
            isSocket: (function (mode) {
                return (mode & 49152) === 49152
            }),
            flagModes: {
                "r": 0,
                "rs": 1052672,
                "r+": 2,
                "w": 577,
                "wx": 705,
                "xw": 705,
                "w+": 578,
                "wx+": 706,
                "xw+": 706,
                "a": 1089,
                "ax": 1217,
                "xa": 1217,
                "a+": 1090,
                "ax+": 1218,
                "xa+": 1218
            },
            modeStringToFlags: (function (str) {
                var flags = FS.flagModes[str];
                if (typeof flags === "undefined") {
                    throw new Error("Unknown file open mode: " + str)
                }
                return flags
            }),
            flagsToPermissionString: (function (flag) {
                var accmode = flag & 2097155;
                var perms = ["r", "w", "rw"][accmode];
                if (flag & 512) {
                    perms += "w"
                }
                return perms
            }),
            nodePermissions: (function (node, perms) {
                if (FS.ignorePermissions) {
                    return 0
                }
                if (perms.indexOf("r") !== -1 && !(node.mode & 292)) {
                    return ERRNO_CODES.EACCES
                } else if (perms.indexOf("w") !== -1 && !(node.mode & 146)) {
                    return ERRNO_CODES.EACCES
                } else if (perms.indexOf("x") !== -1 && !(node.mode & 73)) {
                    return ERRNO_CODES.EACCES
                }
                return 0
            }),
            mayLookup: (function (dir) {
                return FS.nodePermissions(dir, "x")
            }),
            mayCreate: (function (dir, name) {
                try {
                    var node = FS.lookupNode(dir, name);
                    return ERRNO_CODES.EEXIST
                } catch (e) {
                }
                return FS.nodePermissions(dir, "wx")
            }),
            mayDelete: (function (dir, name, isdir) {
                var node;
                try {
                    node = FS.lookupNode(dir, name)
                } catch (e) {
                    return e.errno
                }
                var err = FS.nodePermissions(dir, "wx");
                if (err) {
                    return err
                }
                if (isdir) {
                    if (!FS.isDir(node.mode)) {
                        return ERRNO_CODES.ENOTDIR
                    }
                    if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
                        return ERRNO_CODES.EBUSY
                    }
                } else {
                    if (FS.isDir(node.mode)) {
                        return ERRNO_CODES.EISDIR
                    }
                }
                return 0
            }),
            mayOpen: (function (node, flags) {
                if (!node) {
                    return ERRNO_CODES.ENOENT
                }
                if (FS.isLink(node.mode)) {
                    return ERRNO_CODES.ELOOP
                } else if (FS.isDir(node.mode)) {
                    if ((flags & 2097155) !== 0 || flags & 512) {
                        return ERRNO_CODES.EISDIR
                    }
                }
                return FS.nodePermissions(node, FS.flagsToPermissionString(flags))
            }),
            MAX_OPEN_FDS: 4096,
            nextfd: (function (fd_start, fd_end) {
                fd_start = fd_start || 0;
                fd_end = fd_end || FS.MAX_OPEN_FDS;
                for (var fd = fd_start; fd <= fd_end; fd++) {
                    if (!FS.streams[fd]) {
                        return fd
                    }
                }
                throw new FS.ErrnoError(ERRNO_CODES.EMFILE)
            }),
            getStream: (function (fd) {
                return FS.streams[fd]
            }),
            createStream: (function (stream, fd_start, fd_end) {
                if (!FS.FSStream) {
                    FS.FSStream = (function () {
                    });
                    FS.FSStream.prototype = {};
                    Object.defineProperties(FS.FSStream.prototype, {
                        object: {
                            get: (function () {
                                return this.node
                            }), set: (function (val) {
                                this.node = val
                            })
                        }, isRead: {
                            get: (function () {
                                return (this.flags & 2097155) !== 1
                            })
                        }, isWrite: {
                            get: (function () {
                                return (this.flags & 2097155) !== 0
                            })
                        }, isAppend: {
                            get: (function () {
                                return this.flags & 1024
                            })
                        }
                    })
                }
                var newStream = new FS.FSStream;
                for (var p in stream) {
                    newStream[p] = stream[p]
                }
                stream = newStream;
                var fd = FS.nextfd(fd_start, fd_end);
                stream.fd = fd;
                FS.streams[fd] = stream;
                return stream
            }),
            closeStream: (function (fd) {
                FS.streams[fd] = null
            }),
            getStreamFromPtr: (function (ptr) {
                return FS.streams[ptr - 1]
            }),
            getPtrForStream: (function (stream) {
                return stream ? stream.fd + 1 : 0
            }),
            chrdev_stream_ops: {
                open: (function (stream) {
                    var device = FS.getDevice(stream.node.rdev);
                    stream.stream_ops = device.stream_ops;
                    if (stream.stream_ops.open) {
                        stream.stream_ops.open(stream)
                    }
                }), llseek: (function () {
                    throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)
                })
            },
            major: (function (dev) {
                return dev >> 8
            }),
            minor: (function (dev) {
                return dev & 255
            }),
            makedev: (function (ma, mi) {
                return ma << 8 | mi
            }),
            registerDevice: (function (dev, ops) {
                FS.devices[dev] = {stream_ops: ops}
            }),
            getDevice: (function (dev) {
                return FS.devices[dev]
            }),
            getMounts: (function (mount) {
                var mounts = [];
                var check = [mount];
                while (check.length) {
                    var m = check.pop();
                    mounts.push(m);
                    check.push.apply(check, m.mounts)
                }
                return mounts
            }),
            syncfs: (function (populate, callback) {
                if (typeof populate === "function") {
                    callback = populate;
                    populate = false
                }
                var mounts = FS.getMounts(FS.root.mount);
                var completed = 0;

                function done(err) {
                    if (err) {
                        if (!done.errored) {
                            done.errored = true;
                            return callback(err)
                        }
                        return
                    }
                    if (++completed >= mounts.length) {
                        callback(null)
                    }
                }

                mounts.forEach((function (mount) {
                    if (!mount.type.syncfs) {
                        return done(null)
                    }
                    mount.type.syncfs(mount, populate, done)
                }))
            }),
            mount: (function (type, opts, mountpoint) {
                var root = mountpoint === "/";
                var pseudo = !mountpoint;
                var node;
                if (root && FS.root) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                } else if (!root && !pseudo) {
                    var lookup = FS.lookupPath(mountpoint, {follow_mount: false});
                    mountpoint = lookup.path;
                    node = lookup.node;
                    if (FS.isMountpoint(node)) {
                        throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                    }
                    if (!FS.isDir(node.mode)) {
                        throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)
                    }
                }
                var mount = {type: type, opts: opts, mountpoint: mountpoint, mounts: []};
                var mountRoot = type.mount(mount);
                mountRoot.mount = mount;
                mount.root = mountRoot;
                if (root) {
                    FS.root = mountRoot
                } else if (node) {
                    node.mounted = mount;
                    if (node.mount) {
                        node.mount.mounts.push(mount)
                    }
                }
                return mountRoot
            }),
            unmount: (function (mountpoint) {
                var lookup = FS.lookupPath(mountpoint, {follow_mount: false});
                if (!FS.isMountpoint(lookup.node)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                var node = lookup.node;
                var mount = node.mounted;
                var mounts = FS.getMounts(mount);
                Object.keys(FS.nameTable).forEach((function (hash) {
                    var current = FS.nameTable[hash];
                    while (current) {
                        var next = current.name_next;
                        if (mounts.indexOf(current.mount) !== -1) {
                            FS.destroyNode(current)
                        }
                        current = next
                    }
                }));
                node.mounted = null;
                var idx = node.mount.mounts.indexOf(mount);
                assert(idx !== -1);
                node.mount.mounts.splice(idx, 1)
            }),
            lookup: (function (parent, name) {
                return parent.node_ops.lookup(parent, name)
            }),
            mknod: (function (path, mode, dev) {
                var lookup = FS.lookupPath(path, {parent: true});
                var parent = lookup.node;
                var name = PATH.basename(path);
                var err = FS.mayCreate(parent, name);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                if (!parent.node_ops.mknod) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                return parent.node_ops.mknod(parent, name, mode, dev)
            }),
            create: (function (path, mode) {
                mode = mode !== undefined ? mode : 438;
                mode &= 4095;
                mode |= 32768;
                return FS.mknod(path, mode, 0)
            }),
            mkdir: (function (path, mode) {
                mode = mode !== undefined ? mode : 511;
                mode &= 511 | 512;
                mode |= 16384;
                return FS.mknod(path, mode, 0)
            }),
            mkdev: (function (path, mode, dev) {
                if (typeof dev === "undefined") {
                    dev = mode;
                    mode = 438
                }
                mode |= 8192;
                return FS.mknod(path, mode, dev)
            }),
            symlink: (function (oldpath, newpath) {
                var lookup = FS.lookupPath(newpath, {parent: true});
                var parent = lookup.node;
                var newname = PATH.basename(newpath);
                var err = FS.mayCreate(parent, newname);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                if (!parent.node_ops.symlink) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                return parent.node_ops.symlink(parent, newname, oldpath)
            }),
            rename: (function (old_path, new_path) {
                var old_dirname = PATH.dirname(old_path);
                var new_dirname = PATH.dirname(new_path);
                var old_name = PATH.basename(old_path);
                var new_name = PATH.basename(new_path);
                var lookup, old_dir, new_dir;
                try {
                    lookup = FS.lookupPath(old_path, {parent: true});
                    old_dir = lookup.node;
                    lookup = FS.lookupPath(new_path, {parent: true});
                    new_dir = lookup.node
                } catch (e) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                }
                if (old_dir.mount !== new_dir.mount) {
                    throw new FS.ErrnoError(ERRNO_CODES.EXDEV)
                }
                var old_node = FS.lookupNode(old_dir, old_name);
                var relative = PATH.relative(old_path, new_dirname);
                if (relative.charAt(0) !== ".") {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                relative = PATH.relative(new_path, old_dirname);
                if (relative.charAt(0) !== ".") {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY)
                }
                var new_node;
                try {
                    new_node = FS.lookupNode(new_dir, new_name)
                } catch (e) {
                }
                if (old_node === new_node) {
                    return
                }
                var isdir = FS.isDir(old_node.mode);
                var err = FS.mayDelete(old_dir, old_name, isdir);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                err = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                if (!old_dir.node_ops.rename) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                }
                if (new_dir !== old_dir) {
                    err = FS.nodePermissions(old_dir, "w");
                    if (err) {
                        throw new FS.ErrnoError(err)
                    }
                }
                try {
                    if (FS.trackingDelegate["willMovePath"]) {
                        FS.trackingDelegate["willMovePath"](old_path, new_path)
                    }
                } catch (e) {
                    console.log("FS.trackingDelegate['willMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message)
                }
                FS.hashRemoveNode(old_node);
                try {
                    old_dir.node_ops.rename(old_node, new_dir, new_name)
                } catch (e) {
                    throw e
                } finally {
                    FS.hashAddNode(old_node)
                }
                try {
                    if (FS.trackingDelegate["onMovePath"])FS.trackingDelegate["onMovePath"](old_path, new_path)
                } catch (e) {
                    console.log("FS.trackingDelegate['onMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message)
                }
            }),
            rmdir: (function (path) {
                var lookup = FS.lookupPath(path, {parent: true});
                var parent = lookup.node;
                var name = PATH.basename(path);
                var node = FS.lookupNode(parent, name);
                var err = FS.mayDelete(parent, name, true);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                if (!parent.node_ops.rmdir) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                if (FS.isMountpoint(node)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                }
                try {
                    if (FS.trackingDelegate["willDeletePath"]) {
                        FS.trackingDelegate["willDeletePath"](path)
                    }
                } catch (e) {
                    console.log("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message)
                }
                parent.node_ops.rmdir(parent, name);
                FS.destroyNode(node);
                try {
                    if (FS.trackingDelegate["onDeletePath"])FS.trackingDelegate["onDeletePath"](path)
                } catch (e) {
                    console.log("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message)
                }
            }),
            readdir: (function (path) {
                var lookup = FS.lookupPath(path, {follow: true});
                var node = lookup.node;
                if (!node.node_ops.readdir) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)
                }
                return node.node_ops.readdir(node)
            }),
            unlink: (function (path) {
                var lookup = FS.lookupPath(path, {parent: true});
                var parent = lookup.node;
                var name = PATH.basename(path);
                var node = FS.lookupNode(parent, name);
                var err = FS.mayDelete(parent, name, false);
                if (err) {
                    if (err === ERRNO_CODES.EISDIR)err = ERRNO_CODES.EPERM;
                    throw new FS.ErrnoError(err)
                }
                if (!parent.node_ops.unlink) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                if (FS.isMountpoint(node)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBUSY)
                }
                try {
                    if (FS.trackingDelegate["willDeletePath"]) {
                        FS.trackingDelegate["willDeletePath"](path)
                    }
                } catch (e) {
                    console.log("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message)
                }
                parent.node_ops.unlink(parent, name);
                FS.destroyNode(node);
                try {
                    if (FS.trackingDelegate["onDeletePath"])FS.trackingDelegate["onDeletePath"](path)
                } catch (e) {
                    console.log("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message)
                }
            }),
            readlink: (function (path) {
                var lookup = FS.lookupPath(path);
                var link = lookup.node;
                if (!link.node_ops.readlink) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                return link.node_ops.readlink(link)
            }),
            stat: (function (path, dontFollow) {
                var lookup = FS.lookupPath(path, {follow: !dontFollow});
                var node = lookup.node;
                if (!node.node_ops.getattr) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                return node.node_ops.getattr(node)
            }),
            lstat: (function (path) {
                return FS.stat(path, true)
            }),
            chmod: (function (path, mode, dontFollow) {
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {follow: !dontFollow});
                    node = lookup.node
                } else {
                    node = path
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                node.node_ops.setattr(node, {mode: mode & 4095 | node.mode & ~4095, timestamp: Date.now()})
            }),
            lchmod: (function (path, mode) {
                FS.chmod(path, mode, true)
            }),
            fchmod: (function (fd, mode) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                FS.chmod(stream.node, mode)
            }),
            chown: (function (path, uid, gid, dontFollow) {
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {follow: !dontFollow});
                    node = lookup.node
                } else {
                    node = path
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                node.node_ops.setattr(node, {timestamp: Date.now()})
            }),
            lchown: (function (path, uid, gid) {
                FS.chown(path, uid, gid, true)
            }),
            fchown: (function (fd, uid, gid) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                FS.chown(stream.node, uid, gid)
            }),
            truncate: (function (path, len) {
                if (len < 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {follow: true});
                    node = lookup.node
                } else {
                    node = path
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(ERRNO_CODES.EPERM)
                }
                if (FS.isDir(node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EISDIR)
                }
                if (!FS.isFile(node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                var err = FS.nodePermissions(node, "w");
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                node.node_ops.setattr(node, {size: len, timestamp: Date.now()})
            }),
            ftruncate: (function (fd, len) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                FS.truncate(stream.node, len)
            }),
            utime: (function (path, atime, mtime) {
                var lookup = FS.lookupPath(path, {follow: true});
                var node = lookup.node;
                node.node_ops.setattr(node, {timestamp: Math.max(atime, mtime)})
            }),
            open: (function (path, flags, mode, fd_start, fd_end) {
                if (path === "") {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOENT)
                }
                flags = typeof flags === "string" ? FS.modeStringToFlags(flags) : flags;
                mode = typeof mode === "undefined" ? 438 : mode;
                if (flags & 64) {
                    mode = mode & 4095 | 32768
                } else {
                    mode = 0
                }
                var node;
                if (typeof path === "object") {
                    node = path
                } else {
                    path = PATH.normalize(path);
                    try {
                        var lookup = FS.lookupPath(path, {follow: !(flags & 131072)});
                        node = lookup.node
                    } catch (e) {
                    }
                }
                if (flags & 64) {
                    if (node) {
                        if (flags & 128) {
                            throw new FS.ErrnoError(ERRNO_CODES.EEXIST)
                        }
                    } else {
                        node = FS.mknod(path, mode, 0)
                    }
                }
                if (!node) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOENT)
                }
                if (FS.isChrdev(node.mode)) {
                    flags &= ~512
                }
                var err = FS.mayOpen(node, flags);
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                if (flags & 512) {
                    FS.truncate(node, 0)
                }
                flags &= ~(128 | 512);
                var stream = FS.createStream({
                    node: node,
                    path: FS.getPath(node),
                    flags: flags,
                    seekable: true,
                    position: 0,
                    stream_ops: node.stream_ops,
                    ungotten: [],
                    error: false
                }, fd_start, fd_end);
                if (stream.stream_ops.open) {
                    stream.stream_ops.open(stream)
                }
                if (Module["logReadFiles"] && !(flags & 1)) {
                    if (!FS.readFiles)FS.readFiles = {};
                    if (!(path in FS.readFiles)) {
                        FS.readFiles[path] = 1;
                        Module["printErr"]("read file: " + path)
                    }
                }
                try {
                    if (FS.trackingDelegate["onOpenFile"]) {
                        var trackingFlags = 0;
                        if ((flags & 2097155) !== 1) {
                            trackingFlags |= FS.tracking.openFlags.READ
                        }
                        if ((flags & 2097155) !== 0) {
                            trackingFlags |= FS.tracking.openFlags.WRITE
                        }
                        FS.trackingDelegate["onOpenFile"](path, trackingFlags)
                    }
                } catch (e) {
                    console.log("FS.trackingDelegate['onOpenFile']('" + path + "', flags) threw an exception: " + e.message)
                }
                return stream
            }),
            close: (function (stream) {
                try {
                    if (stream.stream_ops.close) {
                        stream.stream_ops.close(stream)
                    }
                } catch (e) {
                    throw e
                } finally {
                    FS.closeStream(stream.fd)
                }
            }),
            llseek: (function (stream, offset, whence) {
                if (!stream.seekable || !stream.stream_ops.llseek) {
                    throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)
                }
                return stream.stream_ops.llseek(stream, offset, whence)
            }),
            read: (function (stream, buffer, offset, length, position) {
                if (length < 0 || position < 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                if ((stream.flags & 2097155) === 1) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                if (FS.isDir(stream.node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EISDIR)
                }
                if (!stream.stream_ops.read) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                var seeking = true;
                if (typeof position === "undefined") {
                    position = stream.position;
                    seeking = false
                } else if (!stream.seekable) {
                    throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)
                }
                var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
                if (!seeking)stream.position += bytesRead;
                return bytesRead
            }),
            write: (function (stream, buffer, offset, length, position, canOwn) {
                if (length < 0 || position < 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                if (FS.isDir(stream.node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.EISDIR)
                }
                if (!stream.stream_ops.write) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                if (stream.flags & 1024) {
                    FS.llseek(stream, 0, 2)
                }
                var seeking = true;
                if (typeof position === "undefined") {
                    position = stream.position;
                    seeking = false
                } else if (!stream.seekable) {
                    throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)
                }
                var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
                if (!seeking)stream.position += bytesWritten;
                try {
                    if (stream.path && FS.trackingDelegate["onWriteToFile"])FS.trackingDelegate["onWriteToFile"](stream.path)
                } catch (e) {
                    console.log("FS.trackingDelegate['onWriteToFile']('" + path + "') threw an exception: " + e.message)
                }
                return bytesWritten
            }),
            allocate: (function (stream, offset, length) {
                if (offset < 0 || length <= 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EINVAL)
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(ERRNO_CODES.EBADF)
                }
                if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENODEV)
                }
                if (!stream.stream_ops.allocate) {
                    throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)
                }
                stream.stream_ops.allocate(stream, offset, length)
            }),
            mmap: (function (stream, buffer, offset, length, position, prot, flags) {
                if ((stream.flags & 2097155) === 1) {
                    throw new FS.ErrnoError(ERRNO_CODES.EACCES)
                }
                if (!stream.stream_ops.mmap) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENODEV)
                }
                return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags)
            }),
            ioctl: (function (stream, cmd, arg) {
                if (!stream.stream_ops.ioctl) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)
                }
                return stream.stream_ops.ioctl(stream, cmd, arg)
            }),
            readFile: (function (path, opts) {
                opts = opts || {};
                opts.flags = opts.flags || "r";
                opts.encoding = opts.encoding || "binary";
                if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
                    throw new Error('Invalid encoding type "' + opts.encoding + '"')
                }
                var ret;
                var stream = FS.open(path, opts.flags);
                var stat = FS.stat(path);
                var length = stat.size;
                var buf = new Uint8Array(length);
                FS.read(stream, buf, 0, length, 0);
                if (opts.encoding === "utf8") {
                    ret = "";
                    var utf8 = new Runtime.UTF8Processor;
                    for (var i = 0; i < length; i++) {
                        ret += utf8.processCChar(buf[i])
                    }
                } else if (opts.encoding === "binary") {
                    ret = buf
                }
                FS.close(stream);
                return ret
            }),
            writeFile: (function (path, data, opts) {
                opts = opts || {};
                opts.flags = opts.flags || "w";
                opts.encoding = opts.encoding || "utf8";
                if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
                    throw new Error('Invalid encoding type "' + opts.encoding + '"')
                }
                var stream = FS.open(path, opts.flags, opts.mode);
                if (opts.encoding === "utf8") {
                    var utf8 = new Runtime.UTF8Processor;
                    var buf = new Uint8Array(utf8.processJSString(data));
                    FS.write(stream, buf, 0, buf.length, 0, opts.canOwn)
                } else if (opts.encoding === "binary") {
                    FS.write(stream, data, 0, data.length, 0, opts.canOwn)
                }
                FS.close(stream)
            }),
            cwd: (function () {
                return FS.currentPath
            }),
            chdir: (function (path) {
                var lookup = FS.lookupPath(path, {follow: true});
                if (!FS.isDir(lookup.node.mode)) {
                    throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)
                }
                var err = FS.nodePermissions(lookup.node, "x");
                if (err) {
                    throw new FS.ErrnoError(err)
                }
                FS.currentPath = lookup.path
            }),
            createDefaultDirectories: (function () {
                FS.mkdir("/tmp")
            }),
            createDefaultDevices: (function () {
                FS.mkdir("/dev");
                FS.registerDevice(FS.makedev(1, 3), {
                    read: (function () {
                        return 0
                    }), write: (function () {
                        return 0
                    })
                });
                FS.mkdev("/dev/null", FS.makedev(1, 3));
                TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
                TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
                FS.mkdev("/dev/tty", FS.makedev(5, 0));
                FS.mkdev("/dev/tty1", FS.makedev(6, 0));
                var random_device;
                if (typeof crypto !== "undefined") {
                    var randomBuffer = new Uint8Array(1);
                    random_device = (function () {
                        crypto.getRandomValues(randomBuffer);
                        return randomBuffer[0]
                    })
                } else if (ENVIRONMENT_IS_NODE) {
                    random_device = (function () {
                        return require("crypto").randomBytes(1)[0]
                    })
                } else {
                    random_device = (function () {
                        return Math.floor(Math.random() * 256)
                    })
                }
                FS.createDevice("/dev", "random", random_device);
                FS.createDevice("/dev", "urandom", random_device);
                FS.mkdir("/dev/shm");
                FS.mkdir("/dev/shm/tmp")
            }),
            createStandardStreams: (function () {
                if (Module["stdin"]) {
                    FS.createDevice("/dev", "stdin", Module["stdin"])
                } else {
                    FS.symlink("/dev/tty", "/dev/stdin")
                }
                if (Module["stdout"]) {
                    FS.createDevice("/dev", "stdout", null, Module["stdout"])
                } else {
                    FS.symlink("/dev/tty", "/dev/stdout")
                }
                if (Module["stderr"]) {
                    FS.createDevice("/dev", "stderr", null, Module["stderr"])
                } else {
                    FS.symlink("/dev/tty1", "/dev/stderr")
                }
                var stdin = FS.open("/dev/stdin", "r");
                HEAP32[_stdin >> 2] = FS.getPtrForStream(stdin);
                assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")");
                var stdout = FS.open("/dev/stdout", "w");
                HEAP32[_stdout >> 2] = FS.getPtrForStream(stdout);
                assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")");
                var stderr = FS.open("/dev/stderr", "w");
                HEAP32[_stderr >> 2] = FS.getPtrForStream(stderr);
                assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")")
            }),
            ensureErrnoError: (function () {
                if (FS.ErrnoError)return;
                FS.ErrnoError = function ErrnoError(errno) {
                    this.errno = errno;
                    for (var key in ERRNO_CODES) {
                        if (ERRNO_CODES[key] === errno) {
                            this.code = key;
                            break
                        }
                    }
                    this.message = ERRNO_MESSAGES[errno]
                };
                FS.ErrnoError.prototype = new Error;
                FS.ErrnoError.prototype.constructor = FS.ErrnoError;
                [ERRNO_CODES.ENOENT].forEach((function (code) {
                    FS.genericErrors[code] = new FS.ErrnoError(code);
                    FS.genericErrors[code].stack = "<generic error, no stack>"
                }))
            }),
            staticInit: (function () {
                FS.ensureErrnoError();
                FS.nameTable = new Array(4096);
                FS.mount(MEMFS, {}, "/");
                FS.createDefaultDirectories();
                FS.createDefaultDevices()
            }),
            init: (function (input, output, error) {
                assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");
                FS.init.initialized = true;
                FS.ensureErrnoError();
                Module["stdin"] = input || Module["stdin"];
                Module["stdout"] = output || Module["stdout"];
                Module["stderr"] = error || Module["stderr"];
                FS.createStandardStreams()
            }),
            quit: (function () {
                FS.init.initialized = false;
                for (var i = 0; i < FS.streams.length; i++) {
                    var stream = FS.streams[i];
                    if (!stream) {
                        continue
                    }
                    FS.close(stream)
                }
            }),
            getMode: (function (canRead, canWrite) {
                var mode = 0;
                if (canRead)mode |= 292 | 73;
                if (canWrite)mode |= 146;
                return mode
            }),
            joinPath: (function (parts, forceRelative) {
                var path = PATH.join.apply(null, parts);
                if (forceRelative && path[0] == "/")path = path.substr(1);
                return path
            }),
            absolutePath: (function (relative, base) {
                return PATH.resolve(base, relative)
            }),
            standardizePath: (function (path) {
                return PATH.normalize(path)
            }),
            findObject: (function (path, dontResolveLastLink) {
                var ret = FS.analyzePath(path, dontResolveLastLink);
                if (ret.exists) {
                    return ret.object
                } else {
                    ___setErrNo(ret.error);
                    return null
                }
            }),
            analyzePath: (function (path, dontResolveLastLink) {
                try {
                    var lookup = FS.lookupPath(path, {follow: !dontResolveLastLink});
                    path = lookup.path
                } catch (e) {
                }
                var ret = {
                    isRoot: false,
                    exists: false,
                    error: 0,
                    name: null,
                    path: null,
                    object: null,
                    parentExists: false,
                    parentPath: null,
                    parentObject: null
                };
                try {
                    var lookup = FS.lookupPath(path, {parent: true});
                    ret.parentExists = true;
                    ret.parentPath = lookup.path;
                    ret.parentObject = lookup.node;
                    ret.name = PATH.basename(path);
                    lookup = FS.lookupPath(path, {follow: !dontResolveLastLink});
                    ret.exists = true;
                    ret.path = lookup.path;
                    ret.object = lookup.node;
                    ret.name = lookup.node.name;
                    ret.isRoot = lookup.path === "/"
                } catch (e) {
                    ret.error = e.errno
                }
                return ret
            }),
            createFolder: (function (parent, name, canRead, canWrite) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                var mode = FS.getMode(canRead, canWrite);
                return FS.mkdir(path, mode)
            }),
            createPath: (function (parent, path, canRead, canWrite) {
                parent = typeof parent === "string" ? parent : FS.getPath(parent);
                var parts = path.split("/").reverse();
                while (parts.length) {
                    var part = parts.pop();
                    if (!part)continue;
                    var current = PATH.join2(parent, part);
                    try {
                        FS.mkdir(current)
                    } catch (e) {
                    }
                    parent = current
                }
                return current
            }),
            createFile: (function (parent, name, properties, canRead, canWrite) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                var mode = FS.getMode(canRead, canWrite);
                return FS.create(path, mode)
            }),
            createDataFile: (function (parent, name, data, canRead, canWrite, canOwn) {
                var path = name ? PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name) : parent;
                var mode = FS.getMode(canRead, canWrite);
                var node = FS.create(path, mode);
                if (data) {
                    if (typeof data === "string") {
                        var arr = new Array(data.length);
                        for (var i = 0, len = data.length; i < len; ++i)arr[i] = data.charCodeAt(i);
                        data = arr
                    }
                    FS.chmod(node, mode | 146);
                    var stream = FS.open(node, "w");
                    FS.write(stream, data, 0, data.length, 0, canOwn);
                    FS.close(stream);
                    FS.chmod(node, mode)
                }
                return node
            }),
            createDevice: (function (parent, name, input, output) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                var mode = FS.getMode(!!input, !!output);
                if (!FS.createDevice.major)FS.createDevice.major = 64;
                var dev = FS.makedev(FS.createDevice.major++, 0);
                FS.registerDevice(dev, {
                    open: (function (stream) {
                        stream.seekable = false
                    }), close: (function (stream) {
                        if (output && output.buffer && output.buffer.length) {
                            output(10)
                        }
                    }), read: (function (stream, buffer, offset, length, pos) {
                        var bytesRead = 0;
                        for (var i = 0; i < length; i++) {
                            var result;
                            try {
                                result = input()
                            } catch (e) {
                                throw new FS.ErrnoError(ERRNO_CODES.EIO)
                            }
                            if (result === undefined && bytesRead === 0) {
                                throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)
                            }
                            if (result === null || result === undefined)break;
                            bytesRead++;
                            buffer[offset + i] = result
                        }
                        if (bytesRead) {
                            stream.node.timestamp = Date.now()
                        }
                        return bytesRead
                    }), write: (function (stream, buffer, offset, length, pos) {
                        for (var i = 0; i < length; i++) {
                            try {
                                output(buffer[offset + i])
                            } catch (e) {
                                throw new FS.ErrnoError(ERRNO_CODES.EIO)
                            }
                        }
                        if (length) {
                            stream.node.timestamp = Date.now()
                        }
                        return i
                    })
                });
                return FS.mkdev(path, mode, dev)
            }),
            createLink: (function (parent, name, target, canRead, canWrite) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                return FS.symlink(target, path)
            }),
            forceLoadFile: (function (obj) {
                if (obj.isDevice || obj.isFolder || obj.link || obj.contents)return true;
                var success = true;
                if (typeof XMLHttpRequest !== "undefined") {
                    throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")
                } else if (Module["read"]) {
                    try {
                        obj.contents = intArrayFromString(Module["read"](obj.url), true);
                        obj.usedBytes = obj.contents.length
                    } catch (e) {
                        success = false
                    }
                } else {
                    throw new Error("Cannot load without read() or XMLHttpRequest.")
                }
                if (!success)___setErrNo(ERRNO_CODES.EIO);
                return success
            }),
            createLazyFile: (function (parent, name, url, canRead, canWrite) {
                function LazyUint8Array() {
                    this.lengthKnown = false;
                    this.chunks = []
                }

                LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
                    if (idx > this.length - 1 || idx < 0) {
                        return undefined
                    }
                    var chunkOffset = idx % this.chunkSize;
                    var chunkNum = Math.floor(idx / this.chunkSize);
                    return this.getter(chunkNum)[chunkOffset]
                };
                LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
                    this.getter = getter
                };
                LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
                    var xhr = new XMLHttpRequest;
                    xhr.open("HEAD", url, false);
                    xhr.send(null);
                    if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
                    var datalength = Number(xhr.getResponseHeader("Content-length"));
                    var header;
                    var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
                    var chunkSize = 1024 * 1024;
                    if (!hasByteServing)chunkSize = datalength;
                    var doXHR = (function (from, to) {
                        if (from > to)throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
                        if (to > datalength - 1)throw new Error("only " + datalength + " bytes available! programmer error!");
                        var xhr = new XMLHttpRequest;
                        xhr.open("GET", url, false);
                        if (datalength !== chunkSize)xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
                        if (typeof Uint8Array != "undefined")xhr.responseType = "arraybuffer";
                        if (xhr.overrideMimeType) {
                            xhr.overrideMimeType("text/plain; charset=x-user-defined")
                        }
                        xhr.send(null);
                        if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
                        if (xhr.response !== undefined) {
                            return new Uint8Array(xhr.response || [])
                        } else {
                            return intArrayFromString(xhr.responseText || "", true)
                        }
                    });
                    var lazyArray = this;
                    lazyArray.setDataGetter((function (chunkNum) {
                        var start = chunkNum * chunkSize;
                        var end = (chunkNum + 1) * chunkSize - 1;
                        end = Math.min(end, datalength - 1);
                        if (typeof lazyArray.chunks[chunkNum] === "undefined") {
                            lazyArray.chunks[chunkNum] = doXHR(start, end)
                        }
                        if (typeof lazyArray.chunks[chunkNum] === "undefined")throw new Error("doXHR failed!");
                        return lazyArray.chunks[chunkNum]
                    }));
                    this._length = datalength;
                    this._chunkSize = chunkSize;
                    this.lengthKnown = true
                };
                if (typeof XMLHttpRequest !== "undefined") {
                    if (!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
                    var lazyArray = new LazyUint8Array;
                    Object.defineProperty(lazyArray, "length", {
                        get: (function () {
                            if (!this.lengthKnown) {
                                this.cacheLength()
                            }
                            return this._length
                        })
                    });
                    Object.defineProperty(lazyArray, "chunkSize", {
                        get: (function () {
                            if (!this.lengthKnown) {
                                this.cacheLength()
                            }
                            return this._chunkSize
                        })
                    });
                    var properties = {isDevice: false, contents: lazyArray}
                } else {
                    var properties = {isDevice: false, url: url}
                }
                var node = FS.createFile(parent, name, properties, canRead, canWrite);
                if (properties.contents) {
                    node.contents = properties.contents
                } else if (properties.url) {
                    node.contents = null;
                    node.url = properties.url
                }
                Object.defineProperty(node, "usedBytes", {
                    get: (function () {
                        return this.contents.length
                    })
                });
                var stream_ops = {};
                var keys = Object.keys(node.stream_ops);
                keys.forEach((function (key) {
                    var fn = node.stream_ops[key];
                    stream_ops[key] = function forceLoadLazyFile() {
                        if (!FS.forceLoadFile(node)) {
                            throw new FS.ErrnoError(ERRNO_CODES.EIO)
                        }
                        return fn.apply(null, arguments)
                    }
                }));
                stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
                    if (!FS.forceLoadFile(node)) {
                        throw new FS.ErrnoError(ERRNO_CODES.EIO)
                    }
                    var contents = stream.node.contents;
                    if (position >= contents.length)return 0;
                    var size = Math.min(contents.length - position, length);
                    assert(size >= 0);
                    if (contents.slice) {
                        for (var i = 0; i < size; i++) {
                            buffer[offset + i] = contents[position + i]
                        }
                    } else {
                        for (var i = 0; i < size; i++) {
                            buffer[offset + i] = contents.get(position + i)
                        }
                    }
                    return size
                };
                node.stream_ops = stream_ops;
                return node
            }),
            createPreloadedFile: (function (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn) {
                Browser.init();
                var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent;

                function processData(byteArray) {
                    function finish(byteArray) {
                        if (!dontCreateFile) {
                            FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn)
                        }
                        if (onload)onload();
                        removeRunDependency("cp " + fullname)
                    }

                    var handled = false;
                    Module["preloadPlugins"].forEach((function (plugin) {
                        if (handled)return;
                        if (plugin["canHandle"](fullname)) {
                            plugin["handle"](byteArray, fullname, finish, (function () {
                                if (onerror)onerror();
                                removeRunDependency("cp " + fullname)
                            }));
                            handled = true
                        }
                    }));
                    if (!handled)finish(byteArray)
                }

                addRunDependency("cp " + fullname);
                if (typeof url == "string") {
                    Browser.asyncLoad(url, (function (byteArray) {
                        processData(byteArray)
                    }), onerror)
                } else {
                    processData(url)
                }
            }),
            indexedDB: (function () {
                return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
            }),
            DB_NAME: (function () {
                return "EM_FS_" + window.location.pathname
            }),
            DB_VERSION: 20,
            DB_STORE_NAME: "FILE_DATA",
            saveFilesToDB: (function (paths, onload, onerror) {
                onload = onload || (function () {
                    });
                onerror = onerror || (function () {
                    });
                var indexedDB = FS.indexedDB();
                try {
                    var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION)
                } catch (e) {
                    return onerror(e)
                }
                openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
                    console.log("creating db");
                    var db = openRequest.result;
                    db.createObjectStore(FS.DB_STORE_NAME)
                };
                openRequest.onsuccess = function openRequest_onsuccess() {
                    var db = openRequest.result;
                    var transaction = db.transaction([FS.DB_STORE_NAME], "readwrite");
                    var files = transaction.objectStore(FS.DB_STORE_NAME);
                    var ok = 0, fail = 0, total = paths.length;

                    function finish() {
                        if (fail == 0)onload(); else onerror()
                    }

                    paths.forEach((function (path) {
                        var putRequest = files.put(FS.analyzePath(path).object.contents, path);
                        putRequest.onsuccess = function putRequest_onsuccess() {
                            ok++;
                            if (ok + fail == total)finish()
                        };
                        putRequest.onerror = function putRequest_onerror() {
                            fail++;
                            if (ok + fail == total)finish()
                        }
                    }));
                    transaction.onerror = onerror
                };
                openRequest.onerror = onerror
            }),
            loadFilesFromDB: (function (paths, onload, onerror) {
                onload = onload || (function () {
                    });
                onerror = onerror || (function () {
                    });
                var indexedDB = FS.indexedDB();
                try {
                    var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION)
                } catch (e) {
                    return onerror(e)
                }
                openRequest.onupgradeneeded = onerror;
                openRequest.onsuccess = function openRequest_onsuccess() {
                    var db = openRequest.result;
                    try {
                        var transaction = db.transaction([FS.DB_STORE_NAME], "readonly")
                    } catch (e) {
                        onerror(e);
                        return
                    }
                    var files = transaction.objectStore(FS.DB_STORE_NAME);
                    var ok = 0, fail = 0, total = paths.length;

                    function finish() {
                        if (fail == 0)onload(); else onerror()
                    }

                    paths.forEach((function (path) {
                        var getRequest = files.get(path);
                        getRequest.onsuccess = function getRequest_onsuccess() {
                            if (FS.analyzePath(path).exists) {
                                FS.unlink(path)
                            }
                            FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
                            ok++;
                            if (ok + fail == total)finish()
                        };
                        getRequest.onerror = function getRequest_onerror() {
                            fail++;
                            if (ok + fail == total)finish()
                        }
                    }));
                    transaction.onerror = onerror
                };
                openRequest.onerror = onerror
            })
        };
        var PATH = {
            splitPath: (function (filename) {
                var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
                return splitPathRe.exec(filename).slice(1)
            }), normalizeArray: (function (parts, allowAboveRoot) {
                var up = 0;
                for (var i = parts.length - 1; i >= 0; i--) {
                    var last = parts[i];
                    if (last === ".") {
                        parts.splice(i, 1)
                    } else if (last === "..") {
                        parts.splice(i, 1);
                        up++
                    } else if (up) {
                        parts.splice(i, 1);
                        up--
                    }
                }
                if (allowAboveRoot) {
                    for (; up--; up) {
                        parts.unshift("..")
                    }
                }
                return parts
            }), normalize: (function (path) {
                var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/";
                path = PATH.normalizeArray(path.split("/").filter((function (p) {
                    return !!p
                })), !isAbsolute).join("/");
                if (!path && !isAbsolute) {
                    path = "."
                }
                if (path && trailingSlash) {
                    path += "/"
                }
                return (isAbsolute ? "/" : "") + path
            }), dirname: (function (path) {
                var result = PATH.splitPath(path), root = result[0], dir = result[1];
                if (!root && !dir) {
                    return "."
                }
                if (dir) {
                    dir = dir.substr(0, dir.length - 1)
                }
                return root + dir
            }), basename: (function (path) {
                if (path === "/")return "/";
                var lastSlash = path.lastIndexOf("/");
                if (lastSlash === -1)return path;
                return path.substr(lastSlash + 1)
            }), extname: (function (path) {
                return PATH.splitPath(path)[3]
            }), join: (function () {
                var paths = Array.prototype.slice.call(arguments, 0);
                return PATH.normalize(paths.join("/"))
            }), join2: (function (l, r) {
                return PATH.normalize(l + "/" + r)
            }), resolve: (function () {
                var resolvedPath = "", resolvedAbsolute = false;
                for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
                    var path = i >= 0 ? arguments[i] : FS.cwd();
                    if (typeof path !== "string") {
                        throw new TypeError("Arguments to path.resolve must be strings")
                    } else if (!path) {
                        continue
                    }
                    resolvedPath = path + "/" + resolvedPath;
                    resolvedAbsolute = path.charAt(0) === "/"
                }
                resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter((function (p) {
                    return !!p
                })), !resolvedAbsolute).join("/");
                return (resolvedAbsolute ? "/" : "") + resolvedPath || "."
            }), relative: (function (from, to) {
                from = PATH.resolve(from).substr(1);
                to = PATH.resolve(to).substr(1);
                function trim(arr) {
                    var start = 0;
                    for (; start < arr.length; start++) {
                        if (arr[start] !== "")break
                    }
                    var end = arr.length - 1;
                    for (; end >= 0; end--) {
                        if (arr[end] !== "")break
                    }
                    if (start > end)return [];
                    return arr.slice(start, end - start + 1)
                }

                var fromParts = trim(from.split("/"));
                var toParts = trim(to.split("/"));
                var length = Math.min(fromParts.length, toParts.length);
                var samePartsLength = length;
                for (var i = 0; i < length; i++) {
                    if (fromParts[i] !== toParts[i]) {
                        samePartsLength = i;
                        break
                    }
                }
                var outputParts = [];
                for (var i = samePartsLength; i < fromParts.length; i++) {
                    outputParts.push("..")
                }
                outputParts = outputParts.concat(toParts.slice(samePartsLength));
                return outputParts.join("/")
            })
        };
        var Browser = {
            mainLoop: {
                scheduler: null,
                method: "",
                shouldPause: false,
                paused: false,
                queue: [],
                pause: (function () {
                    Browser.mainLoop.shouldPause = true
                }),
                resume: (function () {
                    if (Browser.mainLoop.paused) {
                        Browser.mainLoop.paused = false;
                        Browser.mainLoop.scheduler()
                    }
                    Browser.mainLoop.shouldPause = false
                }),
                updateStatus: (function () {
                    if (Module["setStatus"]) {
                        var message = Module["statusMessage"] || "Please wait...";
                        var remaining = Browser.mainLoop.remainingBlockers;
                        var expected = Browser.mainLoop.expectedBlockers;
                        if (remaining) {
                            if (remaining < expected) {
                                Module["setStatus"](message + " (" + (expected - remaining) + "/" + expected + ")")
                            } else {
                                Module["setStatus"](message)
                            }
                        } else {
                            Module["setStatus"]("")
                        }
                    }
                }),
                runIter: (function (func) {
                    if (ABORT)return;
                    if (Module["preMainLoop"]) {
                        var preRet = Module["preMainLoop"]();
                        if (preRet === false) {
                            return
                        }
                    }
                    try {
                        func()
                    } catch (e) {
                        if (e instanceof ExitStatus) {
                            return
                        } else {
                            if (e && typeof e === "object" && e.stack)Module.printErr("exception thrown: " + [e, e.stack]);
                            throw e
                        }
                    }
                    if (Module["postMainLoop"])Module["postMainLoop"]()
                })
            },
            isFullScreen: false,
            pointerLock: false,
            moduleContextCreatedCallbacks: [],
            workers: [],
            init: (function () {
                if (!Module["preloadPlugins"])Module["preloadPlugins"] = [];
                if (Browser.initted)return;
                Browser.initted = true;
                try {
                    new Blob;
                    Browser.hasBlobConstructor = true
                } catch (e) {
                    Browser.hasBlobConstructor = false;
                    console.log("warning: no blob constructor, cannot create blobs with mimetypes")
                }
                Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : !Browser.hasBlobConstructor ? console.log("warning: no BlobBuilder") : null;
                Browser.URLObject = typeof window != "undefined" ? window.URL ? window.URL : window.webkitURL : undefined;
                if (!Module.noImageDecoding && typeof Browser.URLObject === "undefined") {
                    console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.");
                    Module.noImageDecoding = true
                }
                var imagePlugin = {};
                imagePlugin["canHandle"] = function imagePlugin_canHandle(name) {
                    return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name)
                };
                imagePlugin["handle"] = function imagePlugin_handle(byteArray, name, onload, onerror) {
                    var b = null;
                    if (Browser.hasBlobConstructor) {
                        try {
                            b = new Blob([byteArray], {type: Browser.getMimetype(name)});
                            if (b.size !== byteArray.length) {
                                b = new Blob([(new Uint8Array(byteArray)).buffer], {type: Browser.getMimetype(name)})
                            }
                        } catch (e) {
                            Runtime.warnOnce("Blob constructor present but fails: " + e + "; falling back to blob builder")
                        }
                    }
                    if (!b) {
                        var bb = new Browser.BlobBuilder;
                        bb.append((new Uint8Array(byteArray)).buffer);
                        b = bb.getBlob()
                    }
                    var url = Browser.URLObject.createObjectURL(b);
                    var img = new Image;
                    img.onload = function img_onload() {
                        assert(img.complete, "Image " + name + " could not be decoded");
                        var canvas = document.createElement("canvas");
                        canvas.width = img.width;
                        canvas.height = img.height;
                        var ctx = canvas.getContext("2d");
                        ctx.drawImage(img, 0, 0);
                        Module["preloadedImages"][name] = canvas;
                        Browser.URLObject.revokeObjectURL(url);
                        if (onload)onload(byteArray)
                    };
                    img.onerror = function img_onerror(event) {
                        console.log("Image " + url + " could not be decoded");
                        if (onerror)onerror()
                    };
                    img.src = url
                };
                Module["preloadPlugins"].push(imagePlugin);
                var audioPlugin = {};
                audioPlugin["canHandle"] = function audioPlugin_canHandle(name) {
                    return !Module.noAudioDecoding && name.substr(-4) in {".ogg": 1, ".wav": 1, ".mp3": 1}
                };
                audioPlugin["handle"] = function audioPlugin_handle(byteArray, name, onload, onerror) {
                    var done = false;

                    function finish(audio) {
                        if (done)return;
                        done = true;
                        Module["preloadedAudios"][name] = audio;
                        if (onload)onload(byteArray)
                    }

                    function fail() {
                        if (done)return;
                        done = true;
                        Module["preloadedAudios"][name] = new Audio;
                        if (onerror)onerror()
                    }

                    if (Browser.hasBlobConstructor) {
                        try {
                            var b = new Blob([byteArray], {type: Browser.getMimetype(name)})
                        } catch (e) {
                            return fail()
                        }
                        var url = Browser.URLObject.createObjectURL(b);
                        var audio = new Audio;
                        audio.addEventListener("canplaythrough", (function () {
                            finish(audio)
                        }), false);
                        audio.onerror = function audio_onerror(event) {
                            if (done)return;
                            console.log("warning: browser could not fully decode audio " + name + ", trying slower base64 approach");
                            function encode64(data) {
                                var BASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
                                var PAD = "=";
                                var ret = "";
                                var leftchar = 0;
                                var leftbits = 0;
                                for (var i = 0; i < data.length; i++) {
                                    leftchar = leftchar << 8 | data[i];
                                    leftbits += 8;
                                    while (leftbits >= 6) {
                                        var curr = leftchar >> leftbits - 6 & 63;
                                        leftbits -= 6;
                                        ret += BASE[curr]
                                    }
                                }
                                if (leftbits == 2) {
                                    ret += BASE[(leftchar & 3) << 4];
                                    ret += PAD + PAD
                                } else if (leftbits == 4) {
                                    ret += BASE[(leftchar & 15) << 2];
                                    ret += PAD
                                }
                                return ret
                            }

                            audio.src = "data:audio/x-" + name.substr(-3) + ";base64," + encode64(byteArray);
                            finish(audio)
                        };
                        audio.src = url;
                        Browser.safeSetTimeout((function () {
                            finish(audio)
                        }), 1e4)
                    } else {
                        return fail()
                    }
                };
                Module["preloadPlugins"].push(audioPlugin);
                var canvas = Module["canvas"];

                function pointerLockChange() {
                    Browser.pointerLock = document["pointerLockElement"] === canvas || document["mozPointerLockElement"] === canvas || document["webkitPointerLockElement"] === canvas || document["msPointerLockElement"] === canvas
                }

                if (canvas) {
                    canvas.requestPointerLock = canvas["requestPointerLock"] || canvas["mozRequestPointerLock"] || canvas["webkitRequestPointerLock"] || canvas["msRequestPointerLock"] || (function () {
                        });
                    canvas.exitPointerLock = document["exitPointerLock"] || document["mozExitPointerLock"] || document["webkitExitPointerLock"] || document["msExitPointerLock"] || (function () {
                        });
                    canvas.exitPointerLock = canvas.exitPointerLock.bind(document);
                    document.addEventListener("pointerlockchange", pointerLockChange, false);
                    document.addEventListener("mozpointerlockchange", pointerLockChange, false);
                    document.addEventListener("webkitpointerlockchange", pointerLockChange, false);
                    document.addEventListener("mspointerlockchange", pointerLockChange, false);
                    if (Module["elementPointerLock"]) {
                        canvas.addEventListener("click", (function (ev) {
                            if (!Browser.pointerLock && canvas.requestPointerLock) {
                                canvas.requestPointerLock();
                                ev.preventDefault()
                            }
                        }), false)
                    }
                }
            }),
            createContext: (function (canvas, useWebGL, setInModule, webGLContextAttributes) {
                if (useWebGL && Module.ctx)return Module.ctx;
                var ctx;
                var errorInfo = "?";

                function onContextCreationError(event) {
                    errorInfo = event.statusMessage || errorInfo
                }

                try {
                    if (useWebGL) {
                        var contextAttributes = {antialias: false, alpha: false};
                        if (webGLContextAttributes) {
                            for (var attribute in webGLContextAttributes) {
                                contextAttributes[attribute] = webGLContextAttributes[attribute]
                            }
                        }
                        canvas.addEventListener("webglcontextcreationerror", onContextCreationError, false);
                        try {
                            ["experimental-webgl", "webgl"].some((function (webglId) {
                                return ctx = canvas.getContext(webglId, contextAttributes)
                            }))
                        } finally {
                            canvas.removeEventListener("webglcontextcreationerror", onContextCreationError, false)
                        }
                    } else {
                        ctx = canvas.getContext("2d")
                    }
                    if (!ctx)throw":("
                } catch (e) {
                    Module.print("Could not create canvas: " + [errorInfo, e]);
                    return null
                }
                if (useWebGL) {
                    canvas.style.backgroundColor = "black"
                }
                if (setInModule) {
                    if (!useWebGL)assert(typeof GLctx === "undefined", "cannot set in module if GLctx is used, but we are a non-GL context that would replace it");
                    Module.ctx = ctx;
                    if (useWebGL)GLctx = ctx;
                    Module.useWebGL = useWebGL;
                    Browser.moduleContextCreatedCallbacks.forEach((function (callback) {
                        callback()
                    }));
                    Browser.init()
                }
                return ctx
            }),
            destroyContext: (function (canvas, useWebGL, setInModule) {
            }),
            fullScreenHandlersInstalled: false,
            lockPointer: undefined,
            resizeCanvas: undefined,
            requestFullScreen: (function (lockPointer, resizeCanvas) {
                Browser.lockPointer = lockPointer;
                Browser.resizeCanvas = resizeCanvas;
                if (typeof Browser.lockPointer === "undefined")Browser.lockPointer = true;
                if (typeof Browser.resizeCanvas === "undefined")Browser.resizeCanvas = false;
                var canvas = Module["canvas"];

                function fullScreenChange() {
                    Browser.isFullScreen = false;
                    var canvasContainer = canvas.parentNode;
                    if ((document["webkitFullScreenElement"] || document["webkitFullscreenElement"] || document["mozFullScreenElement"] || document["mozFullscreenElement"] || document["fullScreenElement"] || document["fullscreenElement"] || document["msFullScreenElement"] || document["msFullscreenElement"] || document["webkitCurrentFullScreenElement"]) === canvasContainer) {
                        canvas.cancelFullScreen = document["cancelFullScreen"] || document["mozCancelFullScreen"] || document["webkitCancelFullScreen"] || document["msExitFullscreen"] || document["exitFullscreen"] || (function () {
                            });
                        canvas.cancelFullScreen = canvas.cancelFullScreen.bind(document);
                        if (Browser.lockPointer)canvas.requestPointerLock();
                        Browser.isFullScreen = true;
                        if (Browser.resizeCanvas)Browser.setFullScreenCanvasSize()
                    } else {
                        canvasContainer.parentNode.insertBefore(canvas, canvasContainer);
                        canvasContainer.parentNode.removeChild(canvasContainer);
                        if (Browser.resizeCanvas)Browser.setWindowedCanvasSize()
                    }
                    if (Module["onFullScreen"])Module["onFullScreen"](Browser.isFullScreen);
                    Browser.updateCanvasDimensions(canvas)
                }

                if (!Browser.fullScreenHandlersInstalled) {
                    Browser.fullScreenHandlersInstalled = true;
                    document.addEventListener("fullscreenchange", fullScreenChange, false);
                    document.addEventListener("mozfullscreenchange", fullScreenChange, false);
                    document.addEventListener("webkitfullscreenchange", fullScreenChange, false);
                    document.addEventListener("MSFullscreenChange", fullScreenChange, false)
                }
                var canvasContainer = document.createElement("div");
                canvas.parentNode.insertBefore(canvasContainer, canvas);
                canvasContainer.appendChild(canvas);
                canvasContainer.requestFullScreen = canvasContainer["requestFullScreen"] || canvasContainer["mozRequestFullScreen"] || canvasContainer["msRequestFullscreen"] || (canvasContainer["webkitRequestFullScreen"] ? (function () {
                        canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"])
                    }) : null);
                canvasContainer.requestFullScreen()
            }),
            nextRAF: 0,
            fakeRequestAnimationFrame: (function (func) {
                var now = Date.now();
                if (Browser.nextRAF === 0) {
                    Browser.nextRAF = now + 1e3 / 60
                } else {
                    while (now + 2 >= Browser.nextRAF) {
                        Browser.nextRAF += 1e3 / 60
                    }
                }
                var delay = Math.max(Browser.nextRAF - now, 0);
                setTimeout(func, delay)
            }),
            requestAnimationFrame: function requestAnimationFrame(func) {
                if (typeof window === "undefined") {
                    Browser.fakeRequestAnimationFrame(func)
                } else {
                    if (!window.requestAnimationFrame) {
                        window.requestAnimationFrame = window["requestAnimationFrame"] || window["mozRequestAnimationFrame"] || window["webkitRequestAnimationFrame"] || window["msRequestAnimationFrame"] || window["oRequestAnimationFrame"] || Browser.fakeRequestAnimationFrame
                    }
                    window.requestAnimationFrame(func)
                }
            },
            safeCallback: (function (func) {
                return (function () {
                    if (!ABORT)return func.apply(null, arguments)
                })
            }),
            safeRequestAnimationFrame: (function (func) {
                return Browser.requestAnimationFrame((function () {
                    if (!ABORT)func()
                }))
            }),
            safeSetTimeout: (function (func, timeout) {
                Module["noExitRuntime"] = true;
                return setTimeout((function () {
                    if (!ABORT)func()
                }), timeout)
            }),
            safeSetInterval: (function (func, timeout) {
                Module["noExitRuntime"] = true;
                return setInterval((function () {
                    if (!ABORT)func()
                }), timeout)
            }),
            getMimetype: (function (name) {
                return {
                    "jpg": "image/jpeg",
                    "jpeg": "image/jpeg",
                    "png": "image/png",
                    "bmp": "image/bmp",
                    "ogg": "audio/ogg",
                    "wav": "audio/wav",
                    "mp3": "audio/mpeg"
                }[name.substr(name.lastIndexOf(".") + 1)]
            }),
            getUserMedia: (function (func) {
                if (!window.getUserMedia) {
                    window.getUserMedia = navigator["getUserMedia"] || navigator["mozGetUserMedia"]
                }
                window.getUserMedia(func)
            }),
            getMovementX: (function (event) {
                return event["movementX"] || event["mozMovementX"] || event["webkitMovementX"] || 0
            }),
            getMovementY: (function (event) {
                return event["movementY"] || event["mozMovementY"] || event["webkitMovementY"] || 0
            }),
            getMouseWheelDelta: (function (event) {
                var delta = 0;
                switch (event.type) {
                    case"DOMMouseScroll":
                        delta = event.detail;
                        break;
                    case"mousewheel":
                        delta = -event.wheelDelta;
                        break;
                    case"wheel":
                        delta = event.deltaY;
                        break;
                    default:
                        throw"unrecognized mouse wheel event: " + event.type
                }
                return Math.max(-1, Math.min(1, delta))
            }),
            mouseX: 0,
            mouseY: 0,
            mouseMovementX: 0,
            mouseMovementY: 0,
            touches: {},
            lastTouches: {},
            calculateMouseEvent: (function (event) {
                if (Browser.pointerLock) {
                    if (event.type != "mousemove" && "mozMovementX" in event) {
                        Browser.mouseMovementX = Browser.mouseMovementY = 0
                    } else {
                        Browser.mouseMovementX = Browser.getMovementX(event);
                        Browser.mouseMovementY = Browser.getMovementY(event)
                    }
                    if (typeof SDL != "undefined") {
                        Browser.mouseX = SDL.mouseX + Browser.mouseMovementX;
                        Browser.mouseY = SDL.mouseY + Browser.mouseMovementY
                    } else {
                        Browser.mouseX += Browser.mouseMovementX;
                        Browser.mouseY += Browser.mouseMovementY
                    }
                } else {
                    var rect = Module["canvas"].getBoundingClientRect();
                    var cw = Module["canvas"].width;
                    var ch = Module["canvas"].height;
                    var scrollX = typeof window.scrollX !== "undefined" ? window.scrollX : window.pageXOffset;
                    var scrollY = typeof window.scrollY !== "undefined" ? window.scrollY : window.pageYOffset;
                    if (event.type === "touchstart" || event.type === "touchend" || event.type === "touchmove") {
                        var touch = event.touch;
                        if (touch === undefined) {
                            return
                        }
                        var adjustedX = touch.pageX - (scrollX + rect.left);
                        var adjustedY = touch.pageY - (scrollY + rect.top);
                        adjustedX = adjustedX * (cw / rect.width);
                        adjustedY = adjustedY * (ch / rect.height);
                        var coords = {x: adjustedX, y: adjustedY};
                        if (event.type === "touchstart") {
                            Browser.lastTouches[touch.identifier] = coords;
                            Browser.touches[touch.identifier] = coords
                        } else if (event.type === "touchend" || event.type === "touchmove") {
                            Browser.lastTouches[touch.identifier] = Browser.touches[touch.identifier];
                            Browser.touches[touch.identifier] = {x: adjustedX, y: adjustedY}
                        }
                        return
                    }
                    var x = event.pageX - (scrollX + rect.left);
                    var y = event.pageY - (scrollY + rect.top);
                    x = x * (cw / rect.width);
                    y = y * (ch / rect.height);
                    Browser.mouseMovementX = x - Browser.mouseX;
                    Browser.mouseMovementY = y - Browser.mouseY;
                    Browser.mouseX = x;
                    Browser.mouseY = y
                }
            }),
            xhrLoad: (function (url, onload, onerror) {
                var xhr = new XMLHttpRequest;
                xhr.open("GET", url, true);
                xhr.responseType = "arraybuffer";
                xhr.onload = function xhr_onload() {
                    if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
                        onload(xhr.response)
                    } else {
                        onerror()
                    }
                };
                xhr.onerror = onerror;
                xhr.send(null)
            }),
            asyncLoad: (function (url, onload, onerror, noRunDep) {
                Browser.xhrLoad(url, (function (arrayBuffer) {
                    assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
                    onload(new Uint8Array(arrayBuffer));
                    if (!noRunDep)removeRunDependency("al " + url)
                }), (function (event) {
                    if (onerror) {
                        onerror()
                    } else {
                        throw'Loading data file "' + url + '" failed.'
                    }
                }));
                if (!noRunDep)addRunDependency("al " + url)
            }),
            resizeListeners: [],
            updateResizeListeners: (function () {
                var canvas = Module["canvas"];
                Browser.resizeListeners.forEach((function (listener) {
                    listener(canvas.width, canvas.height)
                }))
            }),
            setCanvasSize: (function (width, height, noUpdates) {
                var canvas = Module["canvas"];
                Browser.updateCanvasDimensions(canvas, width, height);
                if (!noUpdates)Browser.updateResizeListeners()
            }),
            windowedWidth: 0,
            windowedHeight: 0,
            setFullScreenCanvasSize: (function () {
                if (typeof SDL != "undefined") {
                    var flags = HEAPU32[SDL.screen + Runtime.QUANTUM_SIZE * 0 >> 2];
                    flags = flags | 8388608;
                    HEAP32[SDL.screen + Runtime.QUANTUM_SIZE * 0 >> 2] = flags
                }
                Browser.updateResizeListeners()
            }),
            setWindowedCanvasSize: (function () {
                if (typeof SDL != "undefined") {
                    var flags = HEAPU32[SDL.screen + Runtime.QUANTUM_SIZE * 0 >> 2];
                    flags = flags & ~8388608;
                    HEAP32[SDL.screen + Runtime.QUANTUM_SIZE * 0 >> 2] = flags
                }
                Browser.updateResizeListeners()
            }),
            updateCanvasDimensions: (function (canvas, wNative, hNative) {
                if (wNative && hNative) {
                    canvas.widthNative = wNative;
                    canvas.heightNative = hNative
                } else {
                    wNative = canvas.widthNative;
                    hNative = canvas.heightNative
                }
                var w = wNative;
                var h = hNative;
                if (Module["forcedAspectRatio"] && Module["forcedAspectRatio"] > 0) {
                    if (w / h < Module["forcedAspectRatio"]) {
                        w = Math.round(h * Module["forcedAspectRatio"])
                    } else {
                        h = Math.round(w / Module["forcedAspectRatio"])
                    }
                }
                if ((document["webkitFullScreenElement"] || document["webkitFullscreenElement"] || document["mozFullScreenElement"] || document["mozFullscreenElement"] || document["fullScreenElement"] || document["fullscreenElement"] || document["msFullScreenElement"] || document["msFullscreenElement"] || document["webkitCurrentFullScreenElement"]) === canvas.parentNode && typeof screen != "undefined") {
                    var factor = Math.min(screen.width / w, screen.height / h);
                    w = Math.round(w * factor);
                    h = Math.round(h * factor)
                }
                if (Browser.resizeCanvas) {
                    if (canvas.width != w)canvas.width = w;
                    if (canvas.height != h)canvas.height = h;
                    if (typeof canvas.style != "undefined") {
                        canvas.style.removeProperty("width");
                        canvas.style.removeProperty("height")
                    }
                } else {
                    if (canvas.width != wNative)canvas.width = wNative;
                    if (canvas.height != hNative)canvas.height = hNative;
                    if (typeof canvas.style != "undefined") {
                        if (w != wNative || h != hNative) {
                            canvas.style.setProperty("width", w + "px", "important");
                            canvas.style.setProperty("height", h + "px", "important")
                        } else {
                            canvas.style.removeProperty("width");
                            canvas.style.removeProperty("height")
                        }
                    }
                }
            })
        };

        function ___assert_fail(condition, filename, line, func) {
            ABORT = true;
            throw"Assertion failed: " + Pointer_stringify(condition) + ", at: " + [filename ? Pointer_stringify(filename) : "unknown filename", line, func ? Pointer_stringify(func) : "unknown function"] + " at " + stackTrace()
        }

        function _time(ptr) {
            var ret = Math.floor(Date.now() / 1e3);
            if (ptr) {
                HEAP32[ptr >> 2] = ret
            }
            return ret
        }

        Module["_strlen"] = _strlen;
        ___errno_state = Runtime.staticAlloc(4);
        HEAP32[___errno_state >> 2] = 0;
        Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) {
            Browser.requestFullScreen(lockPointer, resizeCanvas)
        };
        Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) {
            Browser.requestAnimationFrame(func)
        };
        Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) {
            Browser.setCanvasSize(width, height, noUpdates)
        };
        Module["pauseMainLoop"] = function Module_pauseMainLoop() {
            Browser.mainLoop.pause()
        };
        Module["resumeMainLoop"] = function Module_resumeMainLoop() {
            Browser.mainLoop.resume()
        };
        Module["getUserMedia"] = function Module_getUserMedia() {
            Browser.getUserMedia()
        };
        FS.staticInit();
        __ATINIT__.unshift({
            func: (function () {
                if (!Module["noFSInit"] && !FS.init.initialized)FS.init()
            })
        });
        __ATMAIN__.push({
            func: (function () {
                FS.ignorePermissions = false
            })
        });
        __ATEXIT__.push({
            func: (function () {
                FS.quit()
            })
        });
        Module["FS_createFolder"] = FS.createFolder;
        Module["FS_createPath"] = FS.createPath;
        Module["FS_createDataFile"] = FS.createDataFile;
        Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
        Module["FS_createLazyFile"] = FS.createLazyFile;
        Module["FS_createLink"] = FS.createLink;
        Module["FS_createDevice"] = FS.createDevice;
        __ATINIT__.unshift({
            func: (function () {
                TTY.init()
            })
        });
        __ATEXIT__.push({
            func: (function () {
                TTY.shutdown()
            })
        });
        TTY.utf8 = new Runtime.UTF8Processor;
        if (ENVIRONMENT_IS_NODE) {
            var fs = require("fs");
            NODEFS.staticInit()
        }
        STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
        staticSealed = true;
        STACK_MAX = STACK_BASE + 5242880;
        DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX);
        assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");
        var ctlz_i8 = allocate([8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "i8", ALLOC_DYNAMIC);
        var cttz_i8 = allocate([8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0], "i8", ALLOC_DYNAMIC);
        var Math_min = Math.min;

        function invoke_vii(index, a1, a2) {
            try {
                Module["dynCall_vii"](index, a1, a2)
            } catch (e) {
                if (typeof e !== "number" && e !== "longjmp")throw e;
                asm["setThrew"](1, 0)
            }
        }

        function asmPrintInt(x, y) {
            Module.print("int " + x + "," + y)
        }

        function asmPrintFloat(x, y) {
            Module.print("float " + x + "," + y)
        }

        var asm = (function (global, env, buffer) {
// EMSCRIPTEN_START_ASM
            "use asm";
            var a = new global.Int8Array(buffer);
            var b = new global.Int16Array(buffer);
            var c = new global.Int32Array(buffer);
            var d = new global.Uint8Array(buffer);
            var e = new global.Uint16Array(buffer);
            var f = new global.Uint32Array(buffer);
            var g = new global.Float32Array(buffer);
            var h = new global.Float64Array(buffer);
            var i = env.STACKTOP | 0;
            var j = env.STACK_MAX | 0;
            var k = env.tempDoublePtr | 0;
            var l = env.ABORT | 0;
            var m = env.cttz_i8 | 0;
            var n = env.ctlz_i8 | 0;
            var o = 0;
            var p = 0;
            var q = 0;
            var r = 0;
            var s = +env.NaN, t = +env.Infinity;
            var u = 0, v = 0, w = 0, x = 0, y = 0.0, z = 0, A = 0, B = 0, C = 0.0;
            var D = 0;
            var E = 0;
            var F = 0;
            var G = 0;
            var H = 0;
            var I = 0;
            var J = 0;
            var K = 0;
            var L = 0;
            var M = 0;
            var N = global.Math.floor;
            var O = global.Math.abs;
            var P = global.Math.sqrt;
            var Q = global.Math.pow;
            var R = global.Math.cos;
            var S = global.Math.sin;
            var T = global.Math.tan;
            var U = global.Math.acos;
            var V = global.Math.asin;
            var W = global.Math.atan;
            var X = global.Math.atan2;
            var Y = global.Math.exp;
            var Z = global.Math.log;
            var _ = global.Math.ceil;
            var $ = global.Math.imul;
            var aa = env.abort;
            var ba = env.assert;
            var ca = env.asmPrintInt;
            var da = env.asmPrintFloat;
            var ea = env.min;
            var fa = env.jsCall;
            var ga = env.invoke_vii;
            var ha = env._fflush;
            var ia = env._sysconf;
            var ja = env._abort;
            var ka = env.___setErrNo;
            var la = env._sbrk;
            var ma = env._time;
            var na = env._emscripten_memcpy_big;
            var oa = env.___assert_fail;
            var pa = env.___errno_location;
            var qa = 0.0;
// EMSCRIPTEN_START_FUNCS
            function sa(a) {
                a = a | 0;
                var b = 0;
                b = i;
                i = i + a | 0;
                i = i + 7 & -8;
                return b | 0
            }

            function ta() {
                return i | 0
            }

            function ua(a) {
                a = a | 0;
                i = a
            }

            function va(a, b) {
                a = a | 0;
                b = b | 0;
                if ((o | 0) == 0) {
                    o = a;
                    p = b
                }
            }

            function wa(b) {
                b = b | 0;
                a[k >> 0] = a[b >> 0];
                a[k + 1 >> 0] = a[b + 1 >> 0];
                a[k + 2 >> 0] = a[b + 2 >> 0];
                a[k + 3 >> 0] = a[b + 3 >> 0]
            }

            function xa(b) {
                b = b | 0;
                a[k >> 0] = a[b >> 0];
                a[k + 1 >> 0] = a[b + 1 >> 0];
                a[k + 2 >> 0] = a[b + 2 >> 0];
                a[k + 3 >> 0] = a[b + 3 >> 0];
                a[k + 4 >> 0] = a[b + 4 >> 0];
                a[k + 5 >> 0] = a[b + 5 >> 0];
                a[k + 6 >> 0] = a[b + 6 >> 0];
                a[k + 7 >> 0] = a[b + 7 >> 0]
            }

            function ya(a) {
                a = a | 0;
                D = a
            }

            function za() {
                return D | 0
            }

            function Aa(b) {
                b = b | 0;
                return a[(c[b >> 2] | 0) + 5 >> 0] & 2 | 0
            }

            function Ba(a) {
                a = a | 0;
                a = c[a >> 2] | 0;
                return (d[a + 15 >> 0] | 0) << 8 | (d[a + 14 >> 0] | 0) | (d[a + 16 >> 0] | 0) << 16 | (d[a + 17 >> 0] | 0) << 24 | 0
            }

            function Ca(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0, e = 0, f = 0, g = 0, h = 0, j = 0;
                d = i;
                if ((a | 0) == 0) {
                    j = -1;
                    i = d;
                    return j | 0
                }
                ab(a | 0, 0, 360) | 0;
                c[a + 4 >> 2] = 16384;
                c[a + 24 >> 2] = 1024;
                h = Qa(16384) | 0;
                c[a >> 2] = h;
                f = Qa(4096) | 0;
                g = a + 16 | 0;
                c[g >> 2] = f;
                j = Qa(8192) | 0;
                e = a + 20 | 0;
                c[e >> 2] = j;
                do {
                    if ((h | 0) != 0) {
                        if ((f | 0) == 0 | (j | 0) == 0) {
                            Ra(h);
                            f = c[g >> 2] | 0;
                            break
                        }
                        c[a + 336 >> 2] = b;
                        j = 0;
                        i = d;
                        return j | 0
                    }
                } while (0);
                if ((f | 0) != 0) {
                    Ra(f)
                }
                e = c[e >> 2] | 0;
                if ((e | 0) != 0) {
                    Ra(e)
                }
                ab(a | 0, 0, 360) | 0;
                j = -1;
                i = d;
                return j | 0
            }

            function Da(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0, e = 0, f = 0, g = 0, h = 0;
                d = i;
                e = a + 24 | 0;
                f = c[e >> 2] | 0;
                if ((f - b | 0) > (c[a + 28 >> 2] | 0)) {
                    h = 0;
                    i = d;
                    return h | 0
                }
                if ((f | 0) > (2147483647 - b | 0)) {
                    if ((a | 0) == 0) {
                        h = -1;
                        i = d;
                        return h | 0
                    }
                    b = c[a >> 2] | 0;
                    if ((b | 0) != 0) {
                        Ra(b)
                    }
                    b = c[a + 16 >> 2] | 0;
                    if ((b | 0) != 0) {
                        Ra(b)
                    }
                    b = c[a + 20 >> 2] | 0;
                    if ((b | 0) != 0) {
                        Ra(b)
                    }
                    ab(a | 0, 0, 360) | 0;
                    h = -1;
                    i = d;
                    return h | 0
                }
                g = f + b | 0;
                g = (g | 0) < 2147483615 ? g + 32 | 0 : g;
                b = a + 16 | 0;
                f = Ta(c[b >> 2] | 0, g << 2) | 0;
                if ((f | 0) == 0) {
                    e = c[a >> 2] | 0;
                    if ((e | 0) != 0) {
                        Ra(e)
                    }
                    b = c[b >> 2] | 0;
                    if ((b | 0) != 0) {
                        Ra(b)
                    }
                    b = c[a + 20 >> 2] | 0;
                    if ((b | 0) != 0) {
                        Ra(b)
                    }
                    ab(a | 0, 0, 360) | 0;
                    h = -1;
                    i = d;
                    return h | 0
                }
                c[b >> 2] = f;
                f = a + 20 | 0;
                h = Ta(c[f >> 2] | 0, g << 3) | 0;
                if ((h | 0) != 0) {
                    c[f >> 2] = h;
                    c[e >> 2] = g;
                    h = 0;
                    i = d;
                    return h | 0
                }
                e = c[a >> 2] | 0;
                if ((e | 0) != 0) {
                    Ra(e)
                }
                b = c[b >> 2] | 0;
                if ((b | 0) != 0) {
                    Ra(b)
                }
                b = c[f >> 2] | 0;
                if ((b | 0) != 0) {
                    Ra(b)
                }
                ab(a | 0, 0, 360) | 0;
                h = -1;
                i = d;
                return h | 0
            }

            function Ea(a) {
                a = a | 0;
                var b = 0;
                b = i;
                if ((a | 0) == 0) {
                    i = b;
                    return 0
                }
                c[a + 0 >> 2] = 0;
                c[a + 4 >> 2] = 0;
                c[a + 8 >> 2] = 0;
                c[a + 12 >> 2] = 0;
                c[a + 16 >> 2] = 0;
                c[a + 20 >> 2] = 0;
                c[a + 24 >> 2] = 0;
                i = b;
                return 0
            }

            function Fa(a) {
                a = a | 0;
                var b = 0, d = 0;
                b = i;
                if ((a | 0) != 0) {
                    d = c[a >> 2] | 0;
                    if ((d | 0) != 0) {
                        Ra(d)
                    }
                    Ra(a)
                }
                i = b;
                return 0
            }

            function Ga(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0, e = 0, f = 0, g = 0, h = 0, j = 0, k = 0;
                d = i;
                f = a + 4 | 0;
                h = c[f >> 2] | 0;
                if (!((h | 0) > -1)) {
                    k = 0;
                    i = d;
                    return k | 0
                }
                g = a + 12 | 0;
                j = c[g >> 2] | 0;
                e = a + 8 | 0;
                if ((j | 0) != 0) {
                    k = (c[e >> 2] | 0) - j | 0;
                    c[e >> 2] = k;
                    if ((k | 0) > 0) {
                        h = c[a >> 2] | 0;
                        $a(h | 0, h + j | 0, k | 0) | 0;
                        h = c[f >> 2] | 0
                    }
                    c[g >> 2] = 0
                }
                g = c[e >> 2] | 0;
                do {
                    if ((h - g | 0) < (b | 0)) {
                        b = b + 4096 + g | 0;
                        g = c[a >> 2] | 0;
                        if ((g | 0) == 0) {
                            g = Qa(b) | 0
                        } else {
                            g = Ta(g, b) | 0
                        }
                        if ((g | 0) != 0) {
                            c[a >> 2] = g;
                            c[f >> 2] = b;
                            a = g;
                            g = c[e >> 2] | 0;
                            break
                        }
                        if ((a | 0) == 0) {
                            k = 0;
                            i = d;
                            return k | 0
                        }
                        e = c[a >> 2] | 0;
                        if ((e | 0) != 0) {
                            Ra(e)
                        }
                        c[a + 0 >> 2] = 0;
                        c[a + 4 >> 2] = 0;
                        c[a + 8 >> 2] = 0;
                        c[a + 12 >> 2] = 0;
                        c[a + 16 >> 2] = 0;
                        c[a + 20 >> 2] = 0;
                        c[a + 24 >> 2] = 0;
                        k = 0;
                        i = d;
                        return k | 0
                    } else {
                        a = c[a >> 2] | 0
                    }
                } while (0);
                k = a + g | 0;
                i = d;
                return k | 0
            }

            function Ha(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0, e = 0, f = 0, g = 0;
                d = i;
                e = c[a + 4 >> 2] | 0;
                if ((e | 0) > -1 ? (g = a + 8 | 0, f = (c[g >> 2] | 0) + b | 0, (f | 0) <= (e | 0)) : 0) {
                    c[g >> 2] = f;
                    a = 0
                } else {
                    a = -1
                }
                i = d;
                return a | 0
            }

            function Ia(b, e) {
                b = b | 0;
                e = e | 0;
                var f = 0, g = 0, h = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0, s = 0, t = 0, u = 0, v = 0, w = 0, x = 0, y = 0, z = 0;
                f = i;
                i = i + 16 | 0;
                o = f;
                n = c[b >> 2] | 0;
                g = b + 12 | 0;
                l = c[g >> 2] | 0;
                j = n + l | 0;
                k = b + 8 | 0;
                m = (c[k >> 2] | 0) - l | 0;
                if (!((c[b + 4 >> 2] | 0) > -1)) {
                    z = 0;
                    i = f;
                    return z | 0
                }
                h = b + 20 | 0;
                r = c[h >> 2] | 0;
                do {
                    if ((r | 0) == 0) {
                        if ((m | 0) < 27) {
                            z = 0;
                            i = f;
                            return z | 0
                        }
                        if ((Xa(j, 1032, 4) | 0) != 0) {
                            p = b + 24 | 0;
                            break
                        }
                        q = n + (l + 26) | 0;
                        r = a[q >> 0] | 0;
                        p = (r & 255) + 27 | 0;
                        if ((m | 0) < (p | 0)) {
                            z = 0;
                            i = f;
                            return z | 0
                        }
                        if (!(r << 24 >> 24 == 0)) {
                            s = l + 27 | 0;
                            r = b + 24 | 0;
                            u = c[r >> 2] | 0;
                            t = 0;
                            do {
                                u = u + (d[n + (s + t) >> 0] | 0) | 0;
                                c[r >> 2] = u;
                                t = t + 1 | 0
                            } while ((t | 0) < (d[q >> 0] | 0 | 0))
                        }
                        c[h >> 2] = p;
                        r = p;
                        q = 11
                    } else {
                        q = 11
                    }
                } while (0);
                do {
                    if ((q | 0) == 11) {
                        p = b + 24 | 0;
                        if ((r + (c[p >> 2] | 0) | 0) > (m | 0)) {
                            z = 0;
                            i = f;
                            return z | 0
                        }
                        r = n + (l + 22) | 0;
                        s = d[r >> 0] | d[r + 1 >> 0] << 8 | d[r + 2 >> 0] << 16 | d[r + 3 >> 0] << 24;
                        c[o >> 2] = s;
                        a[r >> 0] = 0;
                        a[r + 1 >> 0] = 0;
                        a[r + 2 >> 0] = 0;
                        a[r + 3 >> 0] = 0;
                        x = c[h >> 2] | 0;
                        w = x + l | 0;
                        v = c[p >> 2] | 0;
                        a[r >> 0] = 0;
                        q = n + (l + 23) | 0;
                        a[q >> 0] = 0;
                        u = n + (l + 24) | 0;
                        a[u >> 0] = 0;
                        t = n + (l + 25) | 0;
                        a[t >> 0] = 0;
                        if ((x | 0) > 0) {
                            z = 0;
                            y = 0;
                            do {
                                z = c[8 + (((d[n + (y + l) >> 0] | 0) ^ z >>> 24) << 2) >> 2] ^ z << 8;
                                y = y + 1 | 0
                            } while ((y | 0) != (x | 0))
                        } else {
                            z = 0
                        }
                        if ((v | 0) > 0) {
                            x = 0;
                            do {
                                z = c[8 + (((d[n + (w + x) >> 0] | 0) ^ z >>> 24) << 2) >> 2] ^ z << 8;
                                x = x + 1 | 0
                            } while ((x | 0) != (v | 0))
                        }
                        a[r >> 0] = z;
                        a[q >> 0] = z >>> 8;
                        a[u >> 0] = z >>> 16;
                        a[t >> 0] = z >>> 24;
                        if ((Xa(o, r, 4) | 0) != 0) {
                            a[r >> 0] = s;
                            a[r + 1 >> 0] = s >> 8;
                            a[r + 2 >> 0] = s >> 16;
                            a[r + 3 >> 0] = s >> 24;
                            break
                        }
                        k = c[b >> 2] | 0;
                        j = c[g >> 2] | 0;
                        if ((e | 0) == 0) {
                            e = c[p >> 2] | 0;
                            k = c[h >> 2] | 0
                        } else {
                            c[e >> 2] = k + j;
                            z = c[h >> 2] | 0;
                            c[e + 4 >> 2] = z;
                            c[e + 8 >> 2] = k + (z + j);
                            k = c[p >> 2] | 0;
                            c[e + 12 >> 2] = k;
                            e = k;
                            k = z
                        }
                        c[b + 16 >> 2] = 0;
                        z = e + k | 0;
                        c[g >> 2] = j + z;
                        c[h >> 2] = 0;
                        c[p >> 2] = 0;
                        i = f;
                        return z | 0
                    }
                } while (0);
                c[h >> 2] = 0;
                c[p >> 2] = 0;
                h = Wa(n + (l + 1) | 0, 79, m + -1 | 0) | 0;
                b = c[b >> 2] | 0;
                if ((h | 0) == 0) {
                    h = b + (c[k >> 2] | 0) | 0
                }
                z = h;
                c[g >> 2] = z - b;
                z = j - z | 0;
                i = f;
                return z | 0
            }

            function Ja(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0, e = 0, f = 0;
                d = i;
                a:do {
                    if ((c[a + 4 >> 2] | 0) > -1) {
                        e = a + 16 | 0;
                        do {
                            f = Ia(a, b) | 0;
                            if ((f | 0) > 0) {
                                a = 1;
                                break a
                            }
                            if ((f | 0) == 0) {
                                a = 0;
                                break a
                            }
                        } while ((c[e >> 2] | 0) != 0);
                        c[e >> 2] = 1;
                        a = -1
                    } else {
                        a = 0
                    }
                } while (0);
                i = d;
                return a | 0
            }

            function Ka(b, e) {
                b = b | 0;
                e = e | 0;
                var f = 0, g = 0, h = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0, s = 0, t = 0, u = 0, v = 0, w = 0, x = 0, y = 0, z = 0, A = 0;
                f = i;
                j = c[e >> 2] | 0;
                q = c[e + 8 >> 2] | 0;
                p = c[e + 12 >> 2] | 0;
                u = a[j + 4 >> 0] | 0;
                l = d[j + 5 >> 0] | 0;
                r = l & 1;
                o = l & 2;
                l = l & 4;
                h = bb(d[j + 13 >> 0] | 0 | 0, 0, 8) | 0;
                h = bb(h | (d[j + 12 >> 0] | 0) | 0, D | 0, 8) | 0;
                h = bb(h | (d[j + 11 >> 0] | 0) | 0, D | 0, 8) | 0;
                h = bb(h | (d[j + 10 >> 0] | 0) | 0, D | 0, 8) | 0;
                h = bb(h | (d[j + 9 >> 0] | 0) | 0, D | 0, 8) | 0;
                h = bb(h | (d[j + 8 >> 0] | 0) | 0, D | 0, 8) | 0;
                h = bb(h | (d[j + 7 >> 0] | 0) | 0, D | 0, 8) | 0;
                e = D;
                h = h | (d[j + 6 >> 0] | 0);
                t = (d[j + 15 >> 0] | 0) << 8 | (d[j + 14 >> 0] | 0) | (d[j + 16 >> 0] | 0) << 16 | (d[j + 17 >> 0] | 0) << 24;
                k = (d[j + 19 >> 0] | 0) << 8 | (d[j + 18 >> 0] | 0) | (d[j + 20 >> 0] | 0) << 16 | (d[j + 21 >> 0] | 0) << 24;
                m = d[j + 26 >> 0] | 0;
                if ((b | 0) == 0) {
                    A = -1;
                    i = f;
                    return A | 0
                }
                w = c[b >> 2] | 0;
                if ((w | 0) == 0) {
                    A = -1;
                    i = f;
                    return A | 0
                }
                s = b + 36 | 0;
                n = c[s >> 2] | 0;
                v = b + 12 | 0;
                y = c[v >> 2] | 0;
                if ((y | 0) != 0) {
                    z = b + 8 | 0;
                    A = c[z >> 2] | 0;
                    x = A - y | 0;
                    c[z >> 2] = x;
                    if ((A | 0) != (y | 0)) {
                        $a(w | 0, w + y | 0, x | 0) | 0
                    }
                    c[v >> 2] = 0
                }
                if ((n | 0) != 0) {
                    v = b + 28 | 0;
                    w = c[v >> 2] | 0;
                    if ((w | 0) == (n | 0)) {
                        w = n
                    } else {
                        A = c[b + 16 >> 2] | 0;
                        $a(A | 0, A + (n << 2) | 0, w - n << 2 | 0) | 0;
                        w = c[b + 20 >> 2] | 0;
                        $a(w | 0, w + (n << 3) | 0, (c[v >> 2] | 0) - n << 3 | 0) | 0;
                        w = c[v >> 2] | 0
                    }
                    c[v >> 2] = w - n;
                    A = b + 32 | 0;
                    c[A >> 2] = (c[A >> 2] | 0) - n;
                    c[s >> 2] = 0
                }
                if (u << 24 >> 24 != 0 ? 1 : (t | 0) != (c[b + 336 >> 2] | 0)) {
                    A = -1;
                    i = f;
                    return A | 0
                }
                if ((Da(b, m + 1 | 0) | 0) != 0) {
                    A = -1;
                    i = f;
                    return A | 0
                }
                n = b + 340 | 0;
                v = c[n >> 2] | 0;
                if ((k | 0) != (v | 0)) {
                    y = b + 32 | 0;
                    A = c[y >> 2] | 0;
                    z = b + 28 | 0;
                    w = c[z >> 2] | 0;
                    if ((A | 0) < (w | 0)) {
                        x = c[b + 16 >> 2] | 0;
                        s = b + 8 | 0;
                        u = c[s >> 2] | 0;
                        t = A;
                        do {
                            u = u - (c[x + (t << 2) >> 2] & 255) | 0;
                            t = t + 1 | 0
                        } while ((t | 0) < (w | 0));
                        c[s >> 2] = u
                    }
                    c[z >> 2] = A;
                    if (!((v | 0) == -1)) {
                        x = A + 1 | 0;
                        c[z >> 2] = x;
                        c[(c[b + 16 >> 2] | 0) + (A << 2) >> 2] = 1024;
                        c[y >> 2] = x
                    }
                }
                a:do {
                    if ((r | 0) == 0) {
                        r = 0
                    } else {
                        A = c[b + 28 >> 2] | 0;
                        if ((A | 0) >= 1 ? (c[(c[b + 16 >> 2] | 0) + (A + -1 << 2) >> 2] | 0) != 1024 : 0) {
                            r = 0;
                            break
                        } else {
                            r = 0
                        }
                        while (1) {
                            if ((r | 0) >= (m | 0)) {
                                o = 0;
                                break a
                            }
                            A = a[j + (r + 27) >> 0] | 0;
                            z = A & 255;
                            q = q + z | 0;
                            p = p - z | 0;
                            r = r + 1 | 0;
                            if (!(A << 24 >> 24 == -1)) {
                                o = 0;
                                break
                            }
                        }
                    }
                } while (0);
                if ((p | 0) != 0) {
                    t = b + 4 | 0;
                    v = c[t >> 2] | 0;
                    s = b + 8 | 0;
                    u = c[s >> 2] | 0;
                    do {
                        if ((v - p | 0) > (u | 0)) {
                            t = c[b >> 2] | 0
                        } else {
                            if ((v | 0) > (2147483647 - p | 0)) {
                                g = c[b >> 2] | 0;
                                if ((g | 0) != 0) {
                                    Ra(g)
                                }
                                g = c[b + 16 >> 2] | 0;
                                if ((g | 0) != 0) {
                                    Ra(g)
                                }
                                g = c[b + 20 >> 2] | 0;
                                if ((g | 0) != 0) {
                                    Ra(g)
                                }
                                ab(b | 0, 0, 360) | 0;
                                A = -1;
                                i = f;
                                return A | 0
                            }
                            u = v + p | 0;
                            u = (u | 0) < 2147482623 ? u + 1024 | 0 : u;
                            v = Ta(c[b >> 2] | 0, u) | 0;
                            if ((v | 0) != 0) {
                                c[t >> 2] = u;
                                c[b >> 2] = v;
                                t = v;
                                u = c[s >> 2] | 0;
                                break
                            }
                            g = c[b >> 2] | 0;
                            if ((g | 0) != 0) {
                                Ra(g)
                            }
                            g = c[b + 16 >> 2] | 0;
                            if ((g | 0) != 0) {
                                Ra(g)
                            }
                            g = c[b + 20 >> 2] | 0;
                            if ((g | 0) != 0) {
                                Ra(g)
                            }
                            ab(b | 0, 0, 360) | 0;
                            A = -1;
                            i = f;
                            return A | 0
                        }
                    } while (0);
                    _a(t + u | 0, q | 0, p | 0) | 0;
                    c[s >> 2] = (c[s >> 2] | 0) + p
                }
                if ((r | 0) < (m | 0)) {
                    q = b + 28 | 0;
                    p = b + 32 | 0;
                    s = c[b + 16 >> 2] | 0;
                    t = c[b + 20 >> 2] | 0;
                    w = c[q >> 2] | 0;
                    u = -1;
                    b:while (1) {
                        v = w;
                        while (1) {
                            w = a[j + (r + 27) >> 0] | 0;
                            x = w & 255;
                            y = s + (v << 2) | 0;
                            c[y >> 2] = x;
                            A = t + (v << 3) | 0;
                            c[A >> 2] = -1;
                            c[A + 4 >> 2] = -1;
                            if ((o | 0) != 0) {
                                c[y >> 2] = x | 256
                            }
                            o = v + 1 | 0;
                            c[q >> 2] = o;
                            r = r + 1 | 0;
                            if (!(w << 24 >> 24 == -1)) {
                                break
                            }
                            if ((r | 0) >= (m | 0)) {
                                break b
                            } else {
                                v = o;
                                o = 0
                            }
                        }
                        c[p >> 2] = o;
                        if ((r | 0) < (m | 0)) {
                            w = o;
                            o = 0;
                            u = v
                        } else {
                            u = v;
                            break
                        }
                    }
                    if (!((u | 0) == -1)) {
                        A = (c[b + 20 >> 2] | 0) + (u << 3) | 0;
                        c[A >> 2] = h;
                        c[A + 4 >> 2] = e
                    }
                }
                if ((l | 0) != 0 ? (c[b + 328 >> 2] = 1, g = c[b + 28 >> 2] | 0, (g | 0) > 0) : 0) {
                    A = (c[b + 16 >> 2] | 0) + (g + -1 << 2) | 0;
                    c[A >> 2] = c[A >> 2] | 512
                }
                c[n >> 2] = k + 1;
                A = 0;
                i = f;
                return A | 0
            }

            function La(a, b) {
                a = a | 0;
                b = b | 0;
                var d = 0;
                d = i;
                if ((a | 0) != 0 ? (c[a >> 2] | 0) != 0 : 0) {
                    a = Ma(a, b, 1) | 0
                } else {
                    a = 0
                }
                i = d;
                return a | 0
            }

            function Ma(a, b, d) {
                a = a | 0;
                b = b | 0;
                d = d | 0;
                var e = 0, f = 0, g = 0, h = 0, j = 0, k = 0, l = 0, m = 0, n = 0, o = 0;
                f = i;
                e = a + 36 | 0;
                k = c[e >> 2] | 0;
                if ((c[a + 32 >> 2] | 0) <= (k | 0)) {
                    m = 0;
                    i = f;
                    return m | 0
                }
                j = c[a + 16 >> 2] | 0;
                h = c[j + (k << 2) >> 2] | 0;
                if ((h & 1024 | 0) !=