diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..584a6fcd --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +*.[oa] +*~ +*.so +*.bak +*-orig +*-sav +foo* +goo* +node.log +Makefile +conf.h +config.status +config.cache +debug.html +ofitsy.js +TODO +BUGS +.DS_Store +js/.DS_Store +astroem/.DS_Store +a.out.dSym/ +archive/ +fits/ +hera/ +kes75/ +nan/ +net/ +notes/ +old/ +png/ +rites/ +sfs/ +smartx/ +test/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..bdd1bdce --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +JS9 is distributed under the terms of The MIT License (MIT), reproduced below. + +Copyright (c) 2014 Smithsonian Institution + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..79e0977a --- /dev/null +++ b/Makefile.in @@ -0,0 +1,475 @@ +# +# This file is a Makefile for HOSTIP. If it has the name "Makefile.in" +# then it is a template for a Makefile; to generate the actual Makefile, +# run "./configure", which is a configuration script generated by the +# "autoconf" program (constructs like "@foo@" will get replaced in the +# actual Makefile. +# + +PACKAGE = @PACKAGE_NAME@ +VERSION = @PACKAGE_VERSION@ +DISTNAME = ${PACKAGE}-${VERSION} +DDISTNAME = ${PACKAGE}-data + +DISTDIR = ../export +FTPDIR = ../ftp + +#---------------------------------------------------------------- +# Things you can change to personalize the Makefile for your own +# site (you can make these changes in either Makefile.in or +# Makefile, but changes to Makefile will get lost if you re-run +# the configuration script). +#---------------------------------------------------------------- + +# Default top-level directories in which to install architecture- +# specific files (exec_prefix) and machine-independent files such +# as scripts (prefix). The values specified here may be overridden +# at configure-time with the --exec-prefix and --prefix options +# to the "configure" script. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# The following definition can be set to non-null for special systems +# like AFS with replication. It allows the pathnames used for installation +# to be different than those used for actually reference files at +# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix +# when installing files. +INSTALL_ROOT = + +# Directory in which to install the .a or .so binary for the TPOS library: +LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib + +# Directory in which to install the program wish: +BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin + +# Directory in which to install the include file tpos.h: +INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include + +# Top-level directory for manual entries: +MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man + +# Directory in which to install manual entry for TPOS programs: +MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 + +# Directory in which to install manual entries for TPOS's C library +# procedures: +MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 + +# extra Libs required to link (e.g. socket libraries) +LIBS = @FUNLIB@ @PNGLIB@ @EXTRA_LIBS@ -lm + +INCS = @FUNINC@ @PNGINC@ + +# To change the compiler switches, for example to change from -O +# to -g, change the following line: +CFLAGS = @CFLAGS@ + +# To add ld switches, change the following line: +LDFLAGS = @LDFLAGS@ + +# Some versions of make, like SGI's, use the following variable to +# determine which shell to use for executing commands: +SHELL = /bin/sh + +# There are just too many different versions of "install" around; +# better to use the install-sh script that comes with the distribution, +# which is slower but guaranteed to work. + +INSTALL = @srcdir@/install-sh -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 + +#---------------------------------------------------------------- +# The information below is modified by the configure script when +# Makefile is generated from Makefile.in. You shouldn't normally +# modify any of this stuff by hand. +#---------------------------------------------------------------- + +AC_FLAGS = @DEFS@ +RANLIB = @RANLIB@ + +#---------------------------------------------------------------- +# The information below should be usable as is. The configure +# script won't modify it and you shouldn't need to modify it +# either. +#---------------------------------------------------------------- +RM = rm -f + +CP = cp -p + +CC = @CC@ + +CC_SWITCHES = ${CFLAGS} -I. ${AC_FLAGS} ${INCS} + +DEPEND_SWITCHES = ${CFLAGS} -I. ${AC_FLAGS} + +# type of backend server (or none) +HELPER = @HELPER@ +USEHELPER = @USEHELPER@ + +# where the web files go on your site +WEBDIR = @WEBDIR@ +CGIDIR = @CGIDIR@ +CGIURL = @CGIURL@ +CGIXPATH = @CGIXPATH@ +# this is for SAO install only ... I think! +SAODIR = @SAODIR@ + +WEBDIRS = plugins params js css images + +BEDIRS = node_modules analysis-plugins analysis-wrappers + +WEBFILES = js9.js js9.min.js js9-$(VERSION).js js9-$(VERSION).min.js \ + js9support.js js9support.min.js js9support.css js9plugins.js \ + js9support.txt js9.css fitsy.js fitsy.min.js \ + js9Msg.js js9Helper.js js9Prefs-default.json \ + js9Prefs.json favicon.ico index.html + +SAOFILES = index.html + +CSSFILES = css/jquery.contextMenu.css css/dhtmlwindow.css + +JSFILES = js/jquery.min.js js/jquery.contextMenu.min.js js/jquery.flot.min.js js/jquery.flot.errorbars.min.js js/jquery.flot.selection.min.js js/flot-zoom.min.js js/sprintf.min.js js/dhtmlwindow.min.js js/dhtmlwindow_blurb.js js/fabric.min.js js/pako_inflate.min.js js/astroem.js + +PLUGINFILES = plugins/archive/archive.js \ + plugins/fitsy/binning.js \ + plugins/imexam/imexam.js \ + plugins/imexam/encircled.js \ + plugins/imexam/pixtable.js \ + plugins/imexam/radproj.js \ + plugins/imexam/reghist.js \ + plugins/imexam/regstat.js \ + plugins/imexam/xyproj.js \ + plugins/imexam/3dplot.js + +PREFFILES = js9Prefs.json + +CGIFILES = js9Helper.cgi + +WEBHELP = help + +WEBDATA = fits png kes75 + +SRCS = tpos.c js9helper.c + +PROGS = tpos js9helper + +TESTPROGS = pngdisp + +INCLUDES = js9helper.h + +SCRIPTS = funhist2flot funcnts2flot fits2png + +SCRIPTS2 = js9 + +ARCFILES = js9-$(VERSION).js js9-$(VERSION).min.js js9Msg.js \ + js9.css js9Helper.js js9Prefs-default.json \ + js9basics.html js9panzoom.html js9analysis.html js9multi.html \ + js9create.html js9preload.html js9bitpix.html \ + js9onchange.html js9rgb.html js9cat.html js9plugins.html \ + index.html js9Helper-default.cgi fitsy.js + +MFILES = Makefile Makefile.in conf.h conf.h.in config.guess config.sub \ + configure configure.ac install-sh js9helper.pc.in js9.in \ + saoconfig saoprefs.sed nnode mkhelper mkjs9 \ + js9Helper-default.cgi js9load README + +all: progs-$(USEHELPER) helper + +progs-yes: $(PROGS) + +progs-no: + +testall: $(TESTPROGS) + +All: all testall + +tpos: tpos.o + $(CC) $(LDFLAGS) tpos.o -o tpos $(LIBS) + +js9helper: js9helper.o + $(CC) $(LDFLAGS) js9helper.o -o js9helper $(LIBS) + +pngdisp: pngdisp.o + $(CC) $(LDFLAGS) pngdisp.o -o pngdisp $(LIBS) + +links: FORCE + @(rm -f js9.js js9.min.js; \ + ln -s js9-$(VERSION).js js9.js; \ + ln -s js9-$(VERSION).min.js js9.min.js;) + +prefs: FORCE + @(echo "copying default preferences to js9Prefs.json"; \ + cp -p js9Prefs-default.json js9Prefs.json;) + +saoprefs: FORCE + @(echo "editing js9Prefs for SAO installations ..."; \ + sed -f saoprefs.sed < js9Prefs.json > js9Prefs-sao.json) + +helper: FORCE + @(./mkhelper "$(HELPER)" \ + "$(CGIDIR)" "$(CGIURL)" "$(CGIXPATH)"; \ + if [ x"$(USEHELPER)" = x"yes" ]; then \ + ./mkjs9 "$(WEBDIR)"; \ + fi;) + +nohelper: FORCE + @(./mkhelper none; \ + ./mkjs9 "$(WEBDIR)") + +nodejshelper: FORCE + @(./mkhelper nodejs; \ + ./mkjs9 "$(WEBDIR)") + + +cgihelper: FORCE prefs + @(./mkhelper get "$(CGIDIR)" "$(CGIURL)" "$(CGIXPATH)"; \ + ./mkjs9 "$(WEBDIR)") + +js9: FORCE + @(if [ x"$(USEHELPER)" = x"yes" ]; then \ + ./mkjs9 "$(WEBDIR)"; \ + fi;) + +minify: FORCE + @minify js9-$(VERSION).js + +js9support: FORCE + @(echo "remaking js9support ..."; minify fitsy.js; \ + echo "css files in js9support.css: " > js9support.txt; \ + echo $(CSSFILES) >> js9support.txt; \ + cat $(CSSFILES) > js9support.css; \ + echo "js files in js9support.js: " >> js9support.txt; \ + echo $(JSFILES) >> js9support.txt; \ + cat $(JSFILES) > js9support.min.js; \ + X=`echo "$(JSFILES)" | sed 's/\.min//g'`; \ + cat $$X > js9support.js; \ + echo "plugin files in js9plugins.js: " >> js9support.txt; \ + echo $(PLUGINFILES) >> js9support.txt; \ + cat $(PLUGINFILES) > js9plugins.js;) + + +js9min: FORCE + @(echo "remaking js9.min.js ..."; touch js9-$(VERSION).js; minify js9-$(VERSION).js) + +refresh: js9support js9min + +jslint: FORCE + @(jslint js9.js; jslint fitsy.js) + +archive: FORCE + @jsarchive $(ARCFILES) $(SCRIPTS) $(SRCS) + +tar: FORCE + ($(RM) config.cache; \ + cd ..; \ + tar cf - $(DISTNAME) | gzip -9 -c > $(DISTNAME).tar.gz) + +install: install-binaries install-scripts install-web + +install-binaries: FORCE + @(if [ x$(USEHELPER) = xyes ]; then \ + echo "Installing programs ..."; \ + for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \ + do \ + if [ ! -d $$i ] ; then \ + echo "making directory $$i"; \ + mkdir -p $$i; \ + chmod 755 $$i; \ + else true; \ + fi; \ + done; \ + for i in $(PROGS) ; \ + do \ + if [ -f $$i.exe ] ; then \ + echo "installing $$i.exe" ; \ + $(INSTALL_PROGRAM) $$i.exe $(BIN_INSTALL_DIR)/$$i.exe ; \ + elif [ -f $$i ] ; then \ + echo "installing $$i" ; \ + $(INSTALL_PROGRAM) $$i $(BIN_INSTALL_DIR)/$$i ; \ + fi; \ + done; \ + else \ + echo "nothing to install for 'binaries' (no helper configured)"; \ + fi;) + +install-scripts: $(SCRIPTS) $(SCRIPTS2) + @(if [ x$(USEHELPER) = xyes ]; then \ + echo "Installing scripts ..."; \ + for i in $(BIN_INSTALL_DIR) ; \ + do \ + if [ ! -d $$i ] ; then \ + echo "making directory $$i"; \ + mkdir -p $$i; \ + chmod 755 $$i; \ + else true; \ + fi; \ + done; \ + for i in $(SCRIPTS) $(SCRIPTS2) ; \ + do \ + if [ -f $$i ] ; then \ + echo "installing $$i" ; \ + $(INSTALL_PROGRAM) $$i $(BIN_INSTALL_DIR)/$$i ; \ + fi; \ + done; \ + else \ + echo "nothing to install for 'scripts' (no helper configured)"; \ + fi;) + +install-web: install-webdirs install-webfiles + +install-webdirs: FORCE + @(echo "Installing web directories ..."; \ + for i in $(WEBDIRS) $(WEBHELP); do \ + if [ x$(WEBDIR) != x ]; then \ + mkdir -p $(WEBDIR); \ + if [ -d $$i ] ; then \ + echo "installing web dir: $$i" ; \ + tar cf - $$i | (cd $(WEBDIR); tar xf -); \ + fi; \ + fi; \ + done; \ + if [ x$(USEHELPER) = xyes ]; then \ + echo "Installing backend helper dirs ..."; \ + for i in $(BEDIRS); do \ + if [ -d $$i ] ; then \ + echo "installing backend dir: $$i" ; \ + tar cf - $$i | (cd $(WEBDIR); tar xf -); \ + fi; \ + done; \ + fi;) + +install-webfiles: FORCE + @(echo "Installing web files ..."; \ + if [ x$(WEBDIR) != x ]; then \ + mkdir -p $(WEBDIR); \ + if [ -f $(WEBDIR)/js9Prefs.json ] ; then \ + echo "moving aside old js9Prefs.json" ; \ + mv $(WEBDIR)/js9Prefs.json{,-old}; \ + fi; \ + fi; \ + for i in $(PREFFILES) $(WEBFILES) js9*.html ; do\ + if [ x$(WEBDIR) != x ]; then \ + if [ -d $$i ] ; then \ + echo "installing web directory: $$i" ; \ + elif [ -f $$i ] ; then \ + echo "installing web file: $$i" ; \ + fi; \ + tar cf - $$i | (cd $(WEBDIR); tar xf -); \ + fi; \ + done; \ + if [ -d "$(CGIDIR)" ]; then \ + for i in $(CGIFILES) ; do\ + if [ -f $$i ]; then \ + if [ -d $$i ] ; then \ + echo "installing cgi directory: $$i" ; \ + elif [ -f $$i ] ; then \ + echo "installing cgi file: $$i" ; \ + fi; \ + tar cf - $$i | (cd $(CGIDIR); tar xf -); \ + else \ + echo "skipping cgi install: $$i"; \ + fi; \ + done; \ + else \ + echo "nothing to install in cgi (no helper configured)"; \ + fi;) + +install-webdata: FORCE + @(for i in $(WEBDATA) ; do\ + if [ x$(WEBDIR) != x ]; then \ + mkdir -p $(WEBDIR); \ + if [ -d $$i ] ; then \ + echo "installing $$i" ; \ + tar cf - $$i | (cd $(WEBDIR); tar xf -); \ + fi; \ + fi; \ + done;) + +install-sao: saoprefs + @(if [ -d "$(SAODIR)" ]; then \ + for i in $(SAOFILES) ; \ + do \ + if [ -f $$i ] ; then \ + echo "installing file: $$i" ; \ + $(CP) $$i $(SAODIR)/.; \ + fi; \ + done; \ + fi; \ + echo "installing SAO js9Prefs.json"; \ + $(CP) js9Prefs-sao.json $(WEBDIR)/js9Prefs.json; \ + if [ -d js9debugextras ]; then \ + echo "installing js9debugextras"; \ + tar cf - js9debugextras | (cd $(WEBDIR); tar xf -); \ + fi) + +install-smartx: FORCE + @(echo "install smartx"; cd smartx; make install); + +release: refresh js9support links prefs + (mkdir -p $(DISTDIR)/$(DISTNAME); \ + tar cf - $(WEBFILES) $(WEBDIRS) $(BEDIRS) $(WEBHELP) js9*.html \ + $(SRCS) $(INCLUDES) $(SCRIPTS) $(MFILES) | \ + (cd $(DISTDIR)/$(DISTNAME); tar xf -); \ + cd $(DISTDIR) ; \ + tar cf - $(DISTNAME) | gzip -c > $(DISTNAME).tar.gz; \ + rm -rf $(DISTNAME)) + +release-data: FORCE + tar cf - $(WEBDATA) | gzip -c > $(DISTDIR)/$(DDISTNAME).tar.gz; + +spell: FORCE + @(for f in index.html $(WEBHELP)/*.html; do \ + echo "spellcheck $$f ..."; \ + aspell -c $$f; \ + done) + +clean: FORCE + $(RM) *.a *.so *.dylib *.o *.exe core errs *pure* .nfs* \ + foo* *~ \#* TAGS *.E a.out errors \ + $(PROGS) $(CGIFILES) $(TESTPROGS) \ + gmon.out *.pg *.bak *js9Prefs.json-orig \ + config.info config.log ltest \ + js/*~ params/*~ \ + doc/*~ notes/*~ test/*~ help/*~ help/*.bak \ + analysis-wrappers/*~ analysis-plugins/*~ \ + plugins/*~ plugins/*/*~ \ + astroem/*~ astroem/*.o astroem/zee.js/*.o + $(RM) -rf autom4te.cache a.out.dSYM + +distclean: clean + $(RM) Makefile config.status config.cache config.log \ + $(PREFFILES) + +maintainer-clean:: clean + $(RM) config.status config.cache config.log \ + $(PREFFILES) + +Makefile: Makefile.in + $(SHELL) config.status + +make: Makefile.in + $(SHELL) config.status + +depend: FORCE + makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) + +tpos.o: tpos.c $(INCL) + $(CC) -c $(CC_SWITCHES) tpos.c + +js9helper.o: js9helper.c $(INCL) + $(CC) -c $(CC_SWITCHES) js9helper.c + +pngdisp.o: pngdisp.c $(INCL) + $(CC) -c $(CC_SWITCHES) pngdisp.c + +configure: configure.ac + autoconf + +errcheck: FORCE + @-egrep 'error|warning' foo | egrep -v "^lex.*but not used" + +FORCE: + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/README b/README new file mode 100644 index 00000000..4ff12ff8 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +JS9 is our Web-based implementation of DS9, the de facto standard image display +for astronomy. With JS9, you can: + + - display URL-based FITS images and binary tables + - drag and drop FITS images and binary tables + - change the colormap and scale + - manipulate the contrast/bias with the mouse + - display pixel values and WCS position information + - create and manipulate geometric regions of interest + - add your own extensions using plugins and the public api + - perform local (browser-based) data analysis via plugins + - perform remote (server-side) data analysis via node.js or CGI + - display RGB composite images + - control JS9 from the command line + - print images + +The JS9 Website contains on-line documentation, demos, and downloads: + + http://js9.si.edu + +JS9 can change how we think about image display and analysis, moving +beyond the Desktop into the Web. You can simply drag and drop a FITS +image from your computer onto this JS9 display. All of basic JS9/DS9 +functionality is immediately available: zoom, pan, colormaps, scaling, +regions, WCS, etc. + +You can extend JS9 using the plugin facility in combination with the +JS9 public API. For example, you can perform browser-based analysis on +the displayed image. On the JS9 Website, click the Plugins tab, create +a region, and move it around ... + +In addition, data files loaded from the server support server-side +analysis (using the original data files on the back-end server). +Server-side analysis can be run, for example, in response to region +changes, with the results displayed back in your browser. On the JS9 +Website, click the Analysis tab, choose a task, create a region, and +move it around ... + +For installation instructions, see help/install.html. + +If you have questions, please contact us at: saord@cfa.harvard.edu. + + Eric Mandel diff --git a/acknowledge.html b/acknowledge.html new file mode 100644 index 00000000..58434aa2 --- /dev/null +++ b/acknowledge.html @@ -0,0 +1,10 @@ + +
+ +Development of JS9 at the +Harvard-Smithsonian Center for Astrophysics +is supported by Smithsonian Institution +and the Chandra X-ray Science Center. + + + diff --git a/analysis-plugins/fits2png.json b/analysis-plugins/fits2png.json new file mode 100644 index 00000000..9c1b6fc5 --- /dev/null +++ b/analysis-plugins/fits2png.json @@ -0,0 +1,8 @@ +[ + {"name" : "fits2png", + "title" : "Convert FITS to PNG", + "files" : "*", + "action" : "js9Xeq fits2png -js9 -odir ./png", + "hidden" : true, + "rtype" : "text"} +] \ No newline at end of file diff --git a/analysis-plugins/js9Analysis-fits.json b/analysis-plugins/js9Analysis-fits.json new file mode 100644 index 00000000..1e53d209 --- /dev/null +++ b/analysis-plugins/js9Analysis-fits.json @@ -0,0 +1,13 @@ +[ + {"name" : "fitshead", + "title" : "FITS Header(s)", + "files" : "fits", + "action" : "js9Xeq fitshead $filename", + "rtype" : "text"}, + {"name" : "macros", + "title" : "Display Macros", + "files" : "*", + "action" : "js9Xeq macros $png $id $foo $sregions $bregions", + "hidden" : true, + "rtype" : "text"} +] diff --git a/analysis-plugins/js9Analysis-funtools.json b/analysis-plugins/js9Analysis-funtools.json new file mode 100644 index 00000000..d785ccc8 --- /dev/null +++ b/analysis-plugins/js9Analysis-funtools.json @@ -0,0 +1,23 @@ +[ + {"name" : "counts", + "title" : "Counts in Regions", + "files" : "fits", + "action" : "js9Xeq counts $filename $sregions $bregions", + "rtype" : "text"}, + {"name" : "radialprofile", + "title" : "Radial Profile", + "files" : "fits", + "action" : "js9Xeq radialplot $filename $sregions $bregions", + "rtype" : "plot"}, + {"name" : "energyplot", + "title" : "Energy Spectrum", + "files" : "fits", + "action" : "js9Xeq histplot $filename[$regions] false false pi 0", + "rtype" : "plot"}, + {"name" : "histplot", + "title" : "Histogram Plot", + "files" : "fits", + "purl" : "./params/histplot.html", + "action" : "js9Xeq histplot $filename[$regions] $norm $bwidth $column $bins", + "rtype" : "plot"} +] diff --git a/analysis-wrappers/js9Xeq b/analysis-wrappers/js9Xeq new file mode 100755 index 00000000..d9f42dd2 --- /dev/null +++ b/analysis-wrappers/js9Xeq @@ -0,0 +1,126 @@ +#!/bin/sh +# set -x + +# make sure we have minimum arg count +if [ $# -lt 1 ]; then + echo "$0 [cmd] [args ...]" + exit 1 +fi + +# on entry, the following JS9 environment variables will be available: +# JS9_HOST host ip of client +# JS9_ID id (from js9 div) of client + +# if we are being called via CGI, send stderr to stdout +if [ x"$QUERY_STRING" != x ]; then + exec 2>&1 +fi + +# error handler: send to stderr(which will go to stdout for CGI) +error() { + echo "ERROR: $1" >&2 + exit 1 +} + +# process standard arguments +CMD="$1"; shift; +case $CMD in +counts) + if [ $# -eq 1 ]; then + funcnts "$1" "$2" + else + funcnts "$1" "$2" "$3" + fi + exit 0 + ;; + +fits2png) + fits2png $* + exit 0 + ;; + +fitshead) + funhead -a "$1" + exit 0 + ;; + +hist) + if [ $# -lt 4 ]; then + error "funhist filename norm width [column] [bin] [$#]" + fi + ARGS="" + FILE="$1"; shift + NORM="$1"; shift; + if [ $NORM = "true" ]; then + ARGS="$ARGS -n" + fi + WIDTH=$1; shift; + if [ $WIDTH = "true" ]; then + ARGS="$ARGS -w" + fi + if [ $# -eq 1 ]; then + funhist $ARGS "$FILE" "$1" + else + funhist $ARGS "$FILE" "$1" "$2" + fi + exit 0 + ;; + +radialplot) + if [ $# = 0 ]; then + error "funcnts filename [source] [bkgd] [$#]" + exit 1 + fi + if [ $# -eq 1 ]; then + funcnts -rG "$1" "$2" | funcnts2flot -title "$TITLE" -file "$1" + else + funcnts -rG "$1" "$2" "$3" | funcnts2flot -title "$TITLE" -file "$1" + fi + exit 0 + ;; + +histplot) + if [ $# -lt 4 ]; then + error "funhist filename norm width [column] [bin] [$#]" + exit 1 + fi + ARGS="" + FILE="$1"; shift; + NORM="$1"; shift; + if [ $NORM = "true" ]; then + ARGS="$ARGS -n" + fi + WIDTH=$1; shift + if [ $WIDTH = "true" ]; then + if [ "x$2" = x0 ]; then + error "please don't use a bin width of 0" + fi + ARGS="$ARGS -w" + fi + TITLE="`echo "$FILE" | tr [a-z] [A-Z]` Plot" + if [ $# -eq 1 ]; then + funhist $ARGS "$FILE" "$1" | + funhist2flot -title "$TITLE" -file "$FILE" + else + funhist $ARGS "$FILE" "$1" "$2" | + funhist2flot -title "$TITLE" -file "$FILE" + fi + exit 0 + ;; + +macros) + echo " + png: [$1] + id: [$2] + foo: [$3] (not expanded) + sregions: [$4] + bregions: [$5]" + exit 0 + ;; + +*) + error "unknown function: $CMD" + exit 1 + ;; +esac + diff --git a/astroem/astroem.bc b/astroem/astroem.bc new file mode 100644 index 00000000..db040607 Binary files /dev/null and b/astroem/astroem.bc differ diff --git a/astroem/astroem.js b/astroem/astroem.js new file mode 100644 index 00000000..5cb6b583 --- /dev/null +++ b/astroem/astroem.js @@ -0,0 +1,7937 @@ + +// astroem.js: astronomy utilities compiled to js + +var Astroem = (function() { + + +var Module = { + 'noExitRuntime': true +}; + + +// The Module object: Our interface to the outside world. We import +// and export values on it, and do the work to get that through +// closure compiler if necessary. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(Module) { ..generated code.. } +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to do an eval in order to handle the closure compiler +// case, where this code here is minified but Module was defined +// elsewhere (e.g. case 4 above). We also need to check if Module +// already exists (e.g. case 3 above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module; +if (!Module) Module = (typeof Module !== 'undefined' ? Module : null) || {}; + +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = {}; +for (var key in Module) { + if (Module.hasOwnProperty(key)) { + moduleOverrides[key] = Module[key]; + } +} + +// The environment setup code below is customized to use Module. +// *** Environment setup code *** +var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function'; +var ENVIRONMENT_IS_WEB = typeof window === 'object'; +var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function'; +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // Expose functionality in the same simple way that the shells work + // Note that we pollute the global namespace here, otherwise we break in node + if (!Module['print']) Module['print'] = function print(x) { + process['stdout'].write(x + '\n'); + }; + if (!Module['printErr']) Module['printErr'] = function printErr(x) { + process['stderr'].write(x + '\n'); + }; + + var nodeFS = require('fs'); + var nodePath = require('path'); + + Module['read'] = function read(filename, binary) { + filename = nodePath['normalize'](filename); + var ret = nodeFS['readFileSync'](filename); + // The path is absolute if the normalized version is the same as the resolved. + if (!ret && filename != nodePath['resolve'](filename)) { + filename = path.join(__dirname, '..', 'src', filename); + ret = nodeFS['readFileSync'](filename); + } + if (ret && !binary) ret = ret.toString(); + return ret; + }; + + Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) }; + + Module['load'] = function load(f) { + globalEval(read(f)); + }; + + Module['arguments'] = process['argv'].slice(2); + + module['exports'] = Module; +} +else if (ENVIRONMENT_IS_SHELL) { + if (!Module['print']) Module['print'] = print; + if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm + + if (typeof read != 'undefined') { + Module['read'] = read; + } else { + Module['read'] = function read() { throw 'no read() available (jsc?)' }; + } + + Module['readBinary'] = function readBinary(f) { + return read(f, 'binary'); + }; + + if (typeof scriptArgs != 'undefined') { + Module['arguments'] = scriptArgs; + } else if (typeof arguments != 'undefined') { + Module['arguments'] = arguments; + } + + this['Module'] = Module; + + eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined"); // wipe out the SpiderMonkey shell 'gc' function, which can confuse closure (uses it as a minified name, and it is then initted to a non-falsey value unexpectedly) +} +else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + Module['read'] = function read(url) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(null); + return xhr.responseText; + }; + + if (typeof arguments != 'undefined') { + Module['arguments'] = arguments; + } + + if (typeof console !== 'undefined') { + if (!Module['print']) Module['print'] = function print(x) { + console.log(x); + }; + if (!Module['printErr']) Module['printErr'] = function printErr(x) { + console.log(x); + }; + } else { + // Probably a worker, and without console.log. We can do very little here... + var TRY_USE_DUMP = false; + if (!Module['print']) Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) { + dump(x); + }) : (function(x) { + // self.postMessage(x); // enable this if you want stdout to be sent as messages + })); + } + + if (ENVIRONMENT_IS_WEB) { + window['Module'] = Module; + } else { + Module['load'] = importScripts; + } +} +else { + // Unreachable because SHELL is dependant on the others + throw 'Unknown runtime environment. Where are we?'; +} + +function globalEval(x) { + eval.call(null, x); +} +if (!Module['load'] == 'undefined' && Module['read']) { + Module['load'] = function load(f) { + globalEval(Module['read'](f)); + }; +} +if (!Module['print']) { + Module['print'] = function(){}; +} +if (!Module['printErr']) { + Module['printErr'] = Module['print']; +} +if (!Module['arguments']) { + Module['arguments'] = []; +} +// *** Environment setup code *** + +// Closure helpers +Module.print = Module['print']; +Module.printErr = Module['printErr']; + +// Callbacks +Module['preRun'] = []; +Module['postRun'] = []; + +// Merge back in the overrides +for (var key in moduleOverrides) { + if (moduleOverrides.hasOwnProperty(key)) { + Module[key] = moduleOverrides[key]; + } +} + + + +// === Auto-generated preamble library stuff === + +//======================================== +// Runtime code shared with compiler +//======================================== + +var Runtime = { + stackSave: function () { + return STACKTOP; + }, + stackRestore: function (stackTop) { + STACKTOP = stackTop; + }, + forceAlign: function (target, quantum) { + quantum = quantum || 4; + if (quantum == 1) return target; + if (isNumber(target) && isNumber(quantum)) { + return Math.ceil(target/quantum)*quantum; + } else if (isNumber(quantum) && isPowerOfTwo(quantum)) { + return '(((' +target + ')+' + (quantum-1) + ')&' + -quantum + ')'; + } + return 'Math.ceil((' + target + ')/' + quantum + ')*' + quantum; + }, + isNumberType: function (type) { + return type in Runtime.INT_TYPES || type in Runtime.FLOAT_TYPES; + }, + isPointerType: function isPointerType(type) { + return type[type.length-1] == '*'; +}, + isStructType: function isStructType(type) { + if (isPointerType(type)) return false; + if (isArrayType(type)) return true; + if (/\{ ?[^}]* ?\}>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types + // See comment in isStructPointerType() + return type[0] == '%'; +}, + INT_TYPES: {"i1":0,"i8":0,"i16":0,"i32":0,"i64":0}, + FLOAT_TYPES: {"float":0,"double":0}, + or64: function (x, y) { + var l = (x | 0) | (y | 0); + var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + and64: function (x, y) { + var l = (x | 0) & (y | 0); + var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + xor64: function (x, y) { + var l = (x | 0) ^ (y | 0); + var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + getNativeTypeSize: function (type) { + switch (type) { + case 'i1': case 'i8': return 1; + case 'i16': return 2; + case 'i32': return 4; + case 'i64': return 8; + case 'float': return 4; + case 'double': return 8; + default: { + if (type[type.length-1] === '*') { + return Runtime.QUANTUM_SIZE; // A pointer + } else if (type[0] === 'i') { + var bits = parseInt(type.substr(1)); + assert(bits % 8 === 0); + return bits/8; + } else { + return 0; + } + } + } + }, + getNativeFieldSize: function (type) { + return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE); + }, + dedup: function dedup(items, ident) { + var seen = {}; + if (ident) { + return items.filter(function(item) { + if (seen[item[ident]]) return false; + seen[item[ident]] = true; + return true; + }); + } else { + return items.filter(function(item) { + if (seen[item]) return false; + seen[item] = true; + return true; + }); + } +}, + set: function set() { + var args = typeof arguments[0] === 'object' ? arguments[0] : arguments; + var ret = {}; + for (var i = 0; i < args.length; i++) { + ret[args[i]] = 0; + } + return ret; +}, + STACK_ALIGN: 8, + getAlignSize: function (type, size, vararg) { + // we align i64s and doubles on 64-bit boundaries, unlike x86 + if (!vararg && (type == 'i64' || type == 'double')) return 8; + if (!type) return Math.min(size, 8); // align structures internally to 64 bits + return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE); + }, + calculateStructAlignment: function calculateStructAlignment(type) { + type.flatSize = 0; + type.alignSize = 0; + var diffs = []; + var prev = -1; + var index = 0; + type.flatIndexes = type.fields.map(function(field) { + index++; + var size, alignSize; + if (Runtime.isNumberType(field) || Runtime.isPointerType(field)) { + size = Runtime.getNativeTypeSize(field); // pack char; char; in structs, also char[X]s. + alignSize = Runtime.getAlignSize(field, size); + } else if (Runtime.isStructType(field)) { + if (field[1] === '0') { + // this is [0 x something]. When inside another structure like here, it must be at the end, + // and it adds no size + // XXX this happens in java-nbody for example... assert(index === type.fields.length, 'zero-length in the middle!'); + size = 0; + if (Types.types[field]) { + alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize); + } else { + alignSize = type.alignSize || QUANTUM_SIZE; + } + } else { + size = Types.types[field].flatSize; + alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize); + } + } else if (field[0] == 'b') { + // bN, large number field, like a [N x i8] + size = field.substr(1)|0; + alignSize = 1; + } else if (field[0] === '<') { + // vector type + size = alignSize = Types.types[field].flatSize; // fully aligned + } else if (field[0] === 'i') { + // illegal integer field, that could not be legalized because it is an internal structure field + // it is ok to have such fields, if we just use them as markers of field size and nothing more complex + size = alignSize = parseInt(field.substr(1))/8; + assert(size % 1 === 0, 'cannot handle non-byte-size field ' + field); + } else { + assert(false, 'invalid type for calculateStructAlignment'); + } + if (type.packed) alignSize = 1; + type.alignSize = Math.max(type.alignSize, alignSize); + var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory + type.flatSize = curr + size; + if (prev >= 0) { + diffs.push(curr-prev); + } + prev = curr; + return curr; + }); + if (type.name_ && type.name_[0] === '[') { + // arrays have 2 elements, so we get the proper difference. then we scale here. that way we avoid + // allocating a potentially huge array for [999999 x i8] etc. + type.flatSize = parseInt(type.name_.substr(1))*type.flatSize/2; + } + type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize); + if (diffs.length == 0) { + type.flatFactor = type.flatSize; + } else if (Runtime.dedup(diffs).length == 1) { + type.flatFactor = diffs[0]; + } + type.needsFlattening = (type.flatFactor != 1); + return type.flatIndexes; + }, + generateStructInfo: function (struct, typeName, offset) { + var type, alignment; + if (typeName) { + offset = offset || 0; + type = (typeof Types === 'undefined' ? Runtime.typeInfo : Types.types)[typeName]; + if (!type) return null; + if (type.fields.length != struct.length) { + printErr('Number of named fields must match the type for ' + typeName + ': possibly duplicate struct names. Cannot return structInfo'); + return null; + } + alignment = type.flatIndexes; + } else { + var type = { fields: struct.map(function(item) { return item[0] }) }; + alignment = Runtime.calculateStructAlignment(type); + } + var ret = { + __size__: type.flatSize + }; + if (typeName) { + struct.forEach(function(item, i) { + if (typeof item === 'string') { + ret[item] = alignment[i] + offset; + } else { + // embedded struct + var key; + for (var k in item) key = k; + ret[key] = Runtime.generateStructInfo(item[key], type.fields[i], alignment[i]); + } + }); + } else { + struct.forEach(function(item, i) { + ret[item[1]] = alignment[i]; + }); + } + return ret; + }, + dynCall: function (sig, ptr, args) { + if (args && args.length) { + if (!args.splice) args = Array.prototype.slice.call(args); + args.splice(0, 0, ptr); + return Module['dynCall_' + sig].apply(null, args); + } else { + return Module['dynCall_' + sig].call(null, ptr); + } + }, + functionPointers: [], + addFunction: function (func) { + for (var i = 0; i < Runtime.functionPointers.length; i++) { + if (!Runtime.functionPointers[i]) { + Runtime.functionPointers[i] = func; + return 2*(1 + i); + } + } + throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.'; + }, + removeFunction: function (index) { + Runtime.functionPointers[(index-2)/2] = null; + }, + getAsmConst: function (code, numArgs) { + // code is a constant string on the heap, so we can cache these + if (!Runtime.asmConstCache) Runtime.asmConstCache = {}; + var func = Runtime.asmConstCache[code]; + if (func) return func; + var args = []; + for (var i = 0; i < numArgs; i++) { + args.push(String.fromCharCode(36) + i); // $0, $1 etc + } + var source = Pointer_stringify(code); + if (source[0] === '"') { + // tolerate EM_ASM("..code..") even though EM_ASM(..code..) is correct + if (source.indexOf('"', 1) === source.length-1) { + source = source.substr(1, source.length-2); + } else { + // something invalid happened, e.g. EM_ASM("..code($0)..", input) + abort('invalid EM_ASM input |' + source + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)'); + } + } + try { + var evalled = eval('(function(' + args.join(',') + '){ ' + source + ' })'); // new Function does not allow upvars in node + } catch(e) { + Module.printErr('error in executing inline EM_ASM code: ' + e + ' on: \n\n' + source + '\n\nwith args |' + args + '| (make sure to use the right one out of EM_ASM, EM_ASM_ARGS, etc.)'); + throw e; + } + return Runtime.asmConstCache[code] = evalled; + }, + warnOnce: function (text) { + if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {}; + if (!Runtime.warnOnce.shown[text]) { + Runtime.warnOnce.shown[text] = 1; + Module.printErr(text); + } + }, + funcWrappers: {}, + getFuncWrapper: function (func, sig) { + assert(sig); + if (!Runtime.funcWrappers[func]) { + Runtime.funcWrappers[func] = function dynCall_wrapper() { + return Runtime.dynCall(sig, func, arguments); + }; + } + return Runtime.funcWrappers[func]; + }, + UTF8Processor: function () { + var buffer = []; + var needed = 0; + this.processCChar = function (code) { + code = code & 0xFF; + + if (buffer.length == 0) { + if ((code & 0x80) == 0x00) { // 0xxxxxxx + return String.fromCharCode(code); + } + buffer.push(code); + if ((code & 0xE0) == 0xC0) { // 110xxxxx + needed = 1; + } else if ((code & 0xF0) == 0xE0) { // 1110xxxx + needed = 2; + } else { // 11110xxx + needed = 3; + } + return ''; + } + + if (needed) { + buffer.push(code); + needed--; + if (needed > 0) return ''; + } + + var c1 = buffer[0]; + var c2 = buffer[1]; + var c3 = buffer[2]; + var c4 = buffer[3]; + var ret; + if (buffer.length == 2) { + ret = String.fromCharCode(((c1 & 0x1F) << 6) | (c2 & 0x3F)); + } else if (buffer.length == 3) { + ret = String.fromCharCode(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)); + } else { + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + var codePoint = ((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) | + ((c3 & 0x3F) << 6) | (c4 & 0x3F); + ret = String.fromCharCode( + Math.floor((codePoint - 0x10000) / 0x400) + 0xD800, + (codePoint - 0x10000) % 0x400 + 0xDC00); + } + buffer.length = 0; + return ret; + } + this.processJSString = function processJSString(string) { + /* TODO: use TextEncoder when present, + var encoder = new TextEncoder(); + encoder['encoding'] = "utf-8"; + var utf8Array = encoder['encode'](aMsg.data); + */ + string = unescape(encodeURIComponent(string)); + var ret = []; + for (var i = 0; i < string.length; i++) { + ret.push(string.charCodeAt(i)); + } + return ret; + } + }, + getCompilerSetting: function (name) { + throw 'You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work'; + }, + stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = (((STACKTOP)+7)&-8); return ret; }, + staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = (((STATICTOP)+7)&-8); return ret; }, + dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = (((DYNAMICTOP)+7)&-8); if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();; return ret; }, + alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 8))*(quantum ? quantum : 8); return ret; }, + makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+((low>>>0)))+((+((high>>>0)))*(+4294967296))) : ((+((low>>>0)))+((+((high|0)))*(+4294967296)))); return ret; }, + GLOBAL_BASE: 8, + QUANTUM_SIZE: 4, + __dummy__: 0 +} + + +Module['Runtime'] = Runtime; + + + + + + + + + +//======================================== +// Runtime essentials +//======================================== + +var __THREW__ = 0; // Used in checking for thrown exceptions. + +var ABORT = false; // whether we are quitting the application. no code should run after this. set in exit() and abort() +var EXITSTATUS = 0; + +var undef = 0; +// tempInt is used for 32-bit signed values or smaller. tempBigInt is used +// for 32-bit unsigned values or more than 32 bits. TODO: audit all uses of tempInt +var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD, tempDouble, tempFloat; +var tempI64, tempI64b; +var tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9; + +function assert(condition, text) { + if (!condition) { + abort('Assertion failed: ' + text); + } +} + +var globalScope = this; + +// C calling interface. A convenient way to call C functions (in C files, or +// defined with extern "C"). +// +// Note: LLVM optimizations can inline and remove functions, after which you will not be +// able to call them. Closure can also do so. To avoid that, add your function to +// the exports using something like +// +// -s EXPORTED_FUNCTIONS='["_main", "_myfunc"]' +// +// @param ident The name of the C function (note that C++ functions will be name-mangled - use extern "C") +// @param returnType The return type of the function, one of the JS types 'number', 'string' or 'array' (use 'number' for any C pointer, and +// 'array' for JavaScript arrays and typed arrays; note that arrays are 8-bit). +// @param argTypes An array of the types of arguments for the function (if there are no arguments, this can be ommitted). Types are as in returnType, +// except that 'array' is not possible (there is no way for us to know the length of the array) +// @param args An array of the arguments to the function, as native JS values (as in returnType) +// Note that string arguments will be stored on the stack (the JS string will become a C string on the stack). +// @return The return value, as a native JS value (as in returnType) +function ccall(ident, returnType, argTypes, args) { + return ccallFunc(getCFunc(ident), returnType, argTypes, args); +} +Module["ccall"] = ccall; + +// Returns the C function with a specified identifier (for C++, you need to do manual name mangling) +function getCFunc(ident) { + try { + var func = Module['_' + ident]; // closure exported function + if (!func) func = eval('_' + ident); // explicit lookup + } catch(e) { + } + assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)'); + return func; +} + +// Internal function that does a C call using a function, not an identifier +function ccallFunc(func, returnType, argTypes, args) { + var stack = 0; + function toC(value, type) { + if (type == 'string') { + if (value === null || value === undefined || value === 0) return 0; // null string + value = intArrayFromString(value); + type = 'array'; + } + if (type == 'array') { + if (!stack) stack = Runtime.stackSave(); + var ret = Runtime.stackAlloc(value.length); + writeArrayToMemory(value, ret); + return ret; + } + return value; + } + function fromC(value, type) { + if (type == 'string') { + return Pointer_stringify(value); + } + assert(type != 'array'); + return value; + } + var i = 0; + var cArgs = args ? args.map(function(arg) { + return toC(arg, argTypes[i++]); + }) : []; + var ret = fromC(func.apply(null, cArgs), returnType); + if (stack) Runtime.stackRestore(stack); + return ret; +} + +// Returns a native JS wrapper for a C function. This is similar to ccall, but +// returns a function you can call repeatedly in a normal way. For example: +// +// var my_function = cwrap('my_c_function', 'number', ['number', 'number']); +// alert(my_function(5, 22)); +// alert(my_function(99, 12)); +// +function cwrap(ident, returnType, argTypes) { + var func = getCFunc(ident); + return function() { + return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments)); + } +} +Module["cwrap"] = cwrap; + +// Sets a value in memory in a dynamic way at run-time. Uses the +// type data. This is the same as makeSetValue, except that +// makeSetValue is done at compile-time and generates the needed +// code then, whereas this function picks the right code at +// run-time. +// Note that setValue and getValue only do *aligned* writes and reads! +// Note that ccall uses JS types as for defining types, while setValue and +// getValue need LLVM types ('i8', 'i32') - this is a lower-level operation +function setValue(ptr, value, type, noSafe) { + type = type || 'i8'; + if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + switch(type) { + case 'i1': HEAP8[(ptr)]=value; break; + case 'i8': HEAP8[(ptr)]=value; break; + case 'i16': HEAP16[((ptr)>>1)]=value; break; + case 'i32': HEAP32[((ptr)>>2)]=value; break; + case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math_abs(tempDouble))) >= (+1) ? (tempDouble > (+0) ? ((Math_min((+(Math_floor((tempDouble)/(+4294967296)))), (+4294967295)))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+4294967296))))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break; + case 'float': HEAPF32[((ptr)>>2)]=value; break; + case 'double': HEAPF64[((ptr)>>3)]=value; break; + default: abort('invalid type for setValue: ' + type); + } +} +Module['setValue'] = setValue; + +// Parallel to setValue. +function getValue(ptr, type, noSafe) { + type = type || 'i8'; + if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + switch(type) { + case 'i1': return HEAP8[(ptr)]; + case 'i8': return HEAP8[(ptr)]; + case 'i16': return HEAP16[((ptr)>>1)]; + case 'i32': return HEAP32[((ptr)>>2)]; + case 'i64': return HEAP32[((ptr)>>2)]; + case 'float': return HEAPF32[((ptr)>>2)]; + case 'double': return HEAPF64[((ptr)>>3)]; + default: abort('invalid type for setValue: ' + type); + } + return null; +} +Module['getValue'] = getValue; + +var ALLOC_NORMAL = 0; // Tries to use _malloc() +var ALLOC_STACK = 1; // Lives for the duration of the current function call +var ALLOC_STATIC = 2; // Cannot be freed +var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk +var ALLOC_NONE = 4; // Do not allocate +Module['ALLOC_NORMAL'] = ALLOC_NORMAL; +Module['ALLOC_STACK'] = ALLOC_STACK; +Module['ALLOC_STATIC'] = ALLOC_STATIC; +Module['ALLOC_DYNAMIC'] = ALLOC_DYNAMIC; +Module['ALLOC_NONE'] = ALLOC_NONE; + +// allocate(): This is for internal use. You can use it yourself as well, but the interface +// is a little tricky (see docs right below). The reason is that it is optimized +// for multiple syntaxes to save space in generated code. So you should +// normally not use allocate(), and instead allocate memory using _malloc(), +// initialize it with setValue(), and so forth. +// @slab: An array of data, or a number. If a number, then the size of the block to allocate, +// in *bytes* (note that this is sometimes confusing: the next parameter does not +// affect this!) +// @types: Either an array of types, one for each byte (or 0 if no type at that position), +// or a single type which is used for the entire block. This only matters if there +// is initial data - if @slab is a number, then this does not matter at all and is +// ignored. +// @allocator: How to allocate memory, see ALLOC_* +function allocate(slab, types, allocator, ptr) { + var zeroinit, size; + if (typeof slab === 'number') { + zeroinit = true; + size = slab; + } else { + zeroinit = false; + size = slab.length; + } + + var singleType = typeof types === 'string' ? types : null; + + var ret; + if (allocator == ALLOC_NONE) { + ret = ptr; + } else { + ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length)); + } + + if (zeroinit) { + var ptr = ret, stop; + assert((ret & 3) == 0); + stop = ret + (size & ~3); + for (; ptr < stop; ptr += 4) { + HEAP32[((ptr)>>2)]=0; + } + stop = ret + size; + while (ptr < stop) { + HEAP8[((ptr++)|0)]=0; + } + return ret; + } + + if (singleType === 'i8') { + if (slab.subarray || slab.slice) { + HEAPU8.set(slab, ret); + } else { + HEAPU8.set(new Uint8Array(slab), ret); + } + return ret; + } + + var i = 0, type, typeSize, previousType; + while (i < size) { + var curr = slab[i]; + + if (typeof curr === 'function') { + curr = Runtime.getFunctionIndex(curr); + } + + type = singleType || types[i]; + if (type === 0) { + i++; + continue; + } + + if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later + + setValue(ret+i, curr, type); + + // no need to look up size unless type changes, so cache it + if (previousType !== type) { + typeSize = Runtime.getNativeTypeSize(type); + previousType = type; + } + i += typeSize; + } + + return ret; +} +Module['allocate'] = allocate; + +function Pointer_stringify(ptr, /* optional */ length) { + // TODO: use TextDecoder + // Find the length, and check for UTF while doing so + var hasUtf = false; + var t; + var i = 0; + while (1) { + t = HEAPU8[(((ptr)+(i))|0)]; + if (t >= 128) hasUtf = true; + else if (t == 0 && !length) break; + i++; + if (length && i == length) break; + } + if (!length) length = i; + + var ret = ''; + + if (!hasUtf) { + var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack + var curr; + while (length > 0) { + curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK))); + ret = ret ? ret + curr : curr; + ptr += MAX_CHUNK; + length -= MAX_CHUNK; + } + return ret; + } + + var utf8 = new Runtime.UTF8Processor(); + for (i = 0; i < length; i++) { + t = HEAPU8[(((ptr)+(i))|0)]; + ret += utf8.processCChar(t); + } + return ret; +} +Module['Pointer_stringify'] = Pointer_stringify; + +// Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns +// a copy of that string as a Javascript String object. +function UTF16ToString(ptr) { + var i = 0; + + var str = ''; + while (1) { + var codeUnit = HEAP16[(((ptr)+(i*2))>>1)]; + if (codeUnit == 0) + return str; + ++i; + // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through. + str += String.fromCharCode(codeUnit); + } +} +Module['UTF16ToString'] = UTF16ToString; + +// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', +// null-terminated and encoded in UTF16LE form. The copy will require at most (str.length*2+1)*2 bytes of space in the HEAP. +function stringToUTF16(str, outPtr) { + for(var i = 0; i < str.length; ++i) { + // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP. + var codeUnit = str.charCodeAt(i); // possibly a lead surrogate + HEAP16[(((outPtr)+(i*2))>>1)]=codeUnit; + } + // Null-terminate the pointer to the HEAP. + HEAP16[(((outPtr)+(str.length*2))>>1)]=0; +} +Module['stringToUTF16'] = stringToUTF16; + +// Given a pointer 'ptr' to a null-terminated UTF32LE-encoded string in the emscripten HEAP, returns +// a copy of that string as a Javascript String object. +function UTF32ToString(ptr) { + var i = 0; + + var str = ''; + while (1) { + var utf32 = HEAP32[(((ptr)+(i*4))>>2)]; + if (utf32 == 0) + return str; + ++i; + // Gotcha: fromCharCode constructs a character from a UTF-16 encoded code (pair), not from a Unicode code point! So encode the code point to UTF-16 for constructing. + if (utf32 >= 0x10000) { + var ch = utf32 - 0x10000; + str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF)); + } else { + str += String.fromCharCode(utf32); + } + } +} +Module['UTF32ToString'] = UTF32ToString; + +// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', +// null-terminated and encoded in UTF32LE form. The copy will require at most (str.length+1)*4 bytes of space in the HEAP, +// but can use less, since str.length does not return the number of characters in the string, but the number of UTF-16 code units in the string. +function stringToUTF32(str, outPtr) { + var iChar = 0; + for(var iCodeUnit = 0; iCodeUnit < str.length; ++iCodeUnit) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! We must decode the string to UTF-32 to the heap. + var codeUnit = str.charCodeAt(iCodeUnit); // possibly a lead surrogate + if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) { + var trailSurrogate = str.charCodeAt(++iCodeUnit); + codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF); + } + HEAP32[(((outPtr)+(iChar*4))>>2)]=codeUnit; + ++iChar; + } + // Null-terminate the pointer to the HEAP. + HEAP32[(((outPtr)+(iChar*4))>>2)]=0; +} +Module['stringToUTF32'] = stringToUTF32; + +function demangle(func) { + var i = 3; + // params, etc. + var basicTypes = { + 'v': 'void', + 'b': 'bool', + 'c': 'char', + 's': 'short', + 'i': 'int', + 'l': 'long', + 'f': 'float', + 'd': 'double', + 'w': 'wchar_t', + 'a': 'signed char', + 'h': 'unsigned char', + 't': 'unsigned short', + 'j': 'unsigned int', + 'm': 'unsigned long', + 'x': 'long long', + 'y': 'unsigned long long', + 'z': '...' + }; + var subs = []; + var first = true; + function dump(x) { + //return; + if (x) Module.print(x); + Module.print(func); + var pre = ''; + for (var a = 0; a < i; a++) pre += ' '; + Module.print (pre + '^'); + } + function parseNested() { + i++; + if (func[i] === 'K') i++; // ignore const + var parts = []; + while (func[i] !== 'E') { + if (func[i] === 'S') { // substitution + i++; + var next = func.indexOf('_', i); + var num = func.substring(i, next) || 0; + parts.push(subs[num] || '?'); + i = next+1; + continue; + } + if (func[i] === 'C') { // constructor + parts.push(parts[parts.length-1]); + i += 2; + continue; + } + var size = parseInt(func.substr(i)); + var pre = size.toString().length; + if (!size || !pre) { i--; break; } // counter i++ below us + var curr = func.substr(i + pre, size); + parts.push(curr); + subs.push(curr); + i += pre + size; + } + i++; // skip E + return parts; + } + function parse(rawList, limit, allowVoid) { // main parser + limit = limit || Infinity; + var ret = '', list = []; + function flushList() { + return '(' + list.join(', ') + ')'; + } + var name; + if (func[i] === 'N') { + // namespaced N-E + name = parseNested().join('::'); + limit--; + if (limit === 0) return rawList ? [name] : name; + } else { + // not namespaced + if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' + var size = parseInt(func.substr(i)); + if (size) { + var pre = size.toString().length; + name = func.substr(i + pre, size); + i += pre + size; + } + } + first = false; + if (func[i] === 'I') { + i++; + var iList = parse(true); + var iRet = parse(true, 1, true); + ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; + } else { + ret = name; + } + paramLoop: while (i < func.length && limit-- > 0) { + //dump('paramLoop'); + var c = func[i++]; + if (c in basicTypes) { + list.push(basicTypes[c]); + } else { + switch (c) { + case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer + case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference + case 'L': { // literal + i++; // skip basic type + var end = func.indexOf('E', i); + var size = end - i; + list.push(func.substr(i, size)); + i += size + 2; // size + 'EE' + break; + } + case 'A': { // array + var size = parseInt(func.substr(i)); + i += size.toString().length; + if (func[i] !== '_') throw '?'; + i++; // skip _ + list.push(parse(true, 1, true)[0] + ' [' + size + ']'); + break; + } + case 'E': break paramLoop; + default: ret += '?' + c; break paramLoop; + } + } + } + if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) + if (rawList) { + if (ret) { + list.push(ret + '?'); + } + return list; + } else { + return ret + flushList(); + } + } + try { + // Special-case the entry point, since its name differs from other name mangling. + if (func == 'Object._main' || func == '_main') { + return 'main()'; + } + if (typeof func === 'number') func = Pointer_stringify(func); + if (func[0] !== '_') return func; + if (func[1] !== '_') return func; // C function + if (func[2] !== 'Z') return func; + switch (func[3]) { + case 'n': return 'operator new()'; + case 'd': return 'operator delete()'; + } + return parse(); + } catch(e) { + return func; + } +} + +function demangleAll(text) { + return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') }); +} + +function stackTrace() { + var stack = new Error().stack; + return stack ? demangleAll(stack) : '(no stack trace available)'; // Stack trace is not available at least on IE10 and Safari 6. +} + +// Memory management + +var PAGE_SIZE = 4096; +function alignMemoryPage(x) { + return (x+4095)&-4096; +} + +var HEAP; +var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +var STATIC_BASE = 0, STATICTOP = 0, staticSealed = false; // static area +var STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0; // stack area +var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk + +function enlargeMemory() { + abort('Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.'); +} + +var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880; +var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 67108864; +var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152; + +var totalMemory = 4096; +while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) { + if (totalMemory < 16*1024*1024) { + totalMemory *= 2; + } else { + totalMemory += 16*1024*1024 + } +} +if (totalMemory !== TOTAL_MEMORY) { + Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be more reasonable'); + TOTAL_MEMORY = totalMemory; +} + +// Initialize the runtime's memory +// check for full engine support (use string 'subarray' to avoid closure compiler confusion) +assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']), + 'JS engine does not provide full typed array support'); + +var buffer = new ArrayBuffer(TOTAL_MEMORY); +HEAP8 = new Int8Array(buffer); +HEAP16 = new Int16Array(buffer); +HEAP32 = new Int32Array(buffer); +HEAPU8 = new Uint8Array(buffer); +HEAPU16 = new Uint16Array(buffer); +HEAPU32 = new Uint32Array(buffer); +HEAPF32 = new Float32Array(buffer); +HEAPF64 = new Float64Array(buffer); + +// Endianness check (note: assumes compiler arch was little-endian) +HEAP32[0] = 255; +assert(HEAPU8[0] === 255 && HEAPU8[3] === 0, 'Typed arrays 2 must be run on a little-endian system'); + +Module['HEAP'] = HEAP; +Module['HEAP8'] = HEAP8; +Module['HEAP16'] = HEAP16; +Module['HEAP32'] = HEAP32; +Module['HEAPU8'] = HEAPU8; +Module['HEAPU16'] = HEAPU16; +Module['HEAPU32'] = HEAPU32; +Module['HEAPF32'] = HEAPF32; +Module['HEAPF64'] = HEAPF64; + +function callRuntimeCallbacks(callbacks) { + while(callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == 'function') { + callback(); + continue; + } + var func = callback.func; + if (typeof func === 'number') { + if (callback.arg === undefined) { + Runtime.dynCall('v', func); + } else { + Runtime.dynCall('vi', func, [callback.arg]); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +var __ATPRERUN__ = []; // functions called before the runtime is initialized +var __ATINIT__ = []; // functions called during startup +var __ATMAIN__ = []; // functions called when main() is to be run +var __ATEXIT__ = []; // functions called during shutdown +var __ATPOSTRUN__ = []; // functions called after the runtime has exited + +var runtimeInitialized = false; + +function preRun() { + // compatibility - merge in anything from Module['preRun'] at this time + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function ensureInitRuntime() { + if (runtimeInitialized) return; + runtimeInitialized = true; + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + callRuntimeCallbacks(__ATEXIT__); +} + +function postRun() { + // compatibility - merge in anything from Module['postRun'] at this time + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} +Module['addOnPreRun'] = Module.addOnPreRun = addOnPreRun; + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} +Module['addOnInit'] = Module.addOnInit = addOnInit; + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} +Module['addOnPreMain'] = Module.addOnPreMain = addOnPreMain; + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} +Module['addOnExit'] = Module.addOnExit = addOnExit; + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} +Module['addOnPostRun'] = Module.addOnPostRun = addOnPostRun; + +// Tools + +// This processes a JS string into a C-line array of numbers, 0-terminated. +// For LLVM-originating strings, see parser.js:parseLLVMString function +function intArrayFromString(stringy, dontAddNull, length /* optional */) { + var ret = (new Runtime.UTF8Processor()).processJSString(stringy); + if (length) { + ret.length = length; + } + if (!dontAddNull) { + ret.push(0); + } + return ret; +} +Module['intArrayFromString'] = intArrayFromString; + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 0xFF) { + chr &= 0xFF; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(''); +} +Module['intArrayToString'] = intArrayToString; + +// Write a Javascript array to somewhere in the heap +function writeStringToMemory(string, buffer, dontAddNull) { + var array = intArrayFromString(string, dontAddNull); + var i = 0; + while (i < array.length) { + var chr = array[i]; + HEAP8[(((buffer)+(i))|0)]=chr; + i = i + 1; + } +} +Module['writeStringToMemory'] = writeStringToMemory; + +function writeArrayToMemory(array, buffer) { + for (var i = 0; i < array.length; i++) { + HEAP8[(((buffer)+(i))|0)]=array[i]; + } +} +Module['writeArrayToMemory'] = writeArrayToMemory; + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; i++) { + HEAP8[(((buffer)+(i))|0)]=str.charCodeAt(i); + } + if (!dontAddNull) HEAP8[(((buffer)+(str.length))|0)]=0; +} +Module['writeAsciiToMemory'] = writeAsciiToMemory; + +function unSign(value, bits, ignore) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2*Math.abs(1 << (bits-1)) + value // Need some trickery, since if bits == 32, we are right at the limit of the bits JS uses in bitshifts + : Math.pow(2, bits) + value; +} +function reSign(value, bits, ignore) { + if (value <= 0) { + return value; + } + var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32 + : Math.pow(2, bits-1); + if (value >= half && (bits <= 32 || value > half)) { // for huge values, we can hit the precision limit and always get true here. so don't do that + // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors + // TODO: In i64 mode 1, resign the two parts separately and safely + value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts + } + return value; +} + +// check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 ) +if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(a, b) { + var ah = a >>> 16; + var al = a & 0xffff; + var bh = b >>> 16; + var bl = b & 0xffff; + return (al*bl + ((ah*bl + al*bh) << 16))|0; +}; +Math.imul = Math['imul']; + + +var Math_abs = Math.abs; +var Math_cos = Math.cos; +var Math_sin = Math.sin; +var Math_tan = Math.tan; +var Math_acos = Math.acos; +var Math_asin = Math.asin; +var Math_atan = Math.atan; +var Math_atan2 = Math.atan2; +var Math_exp = Math.exp; +var Math_log = Math.log; +var Math_sqrt = Math.sqrt; +var Math_ceil = Math.ceil; +var Math_floor = Math.floor; +var Math_pow = Math.pow; +var Math_imul = Math.imul; +var Math_fround = Math.fround; +var Math_min = Math.min; + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// PRE_RUN_ADDITIONS (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; +var runDependencyWatcher = null; +var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled + +function addRunDependency(id) { + runDependencies++; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } +} +Module['addRunDependency'] = addRunDependency; +function removeRunDependency(id) { + runDependencies--; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); // can add another dependenciesFulfilled + } + } +} +Module['removeRunDependency'] = removeRunDependency; + +Module["preloadedImages"] = {}; // maps url to image data +Module["preloadedAudios"] = {}; // maps url to audio data + + +var memoryInitializer = null; + +// === Body === + + + + + +STATIC_BASE = 8; + +STATICTOP = STATIC_BASE + Runtime.alignMemory(28211); +/* global initializers */ __ATINIT__.push(); + + +/* memory initializer */ allocate([37,46,51,102,32,37,46,51,102,0,0,0,0,0,0,0,103,97,108,97,99,116,105,99,0,0,0,0,0,0,0,0,101,99,108,105,112,116,105,99,0,0,0,0,0,0,0,0,108,105,110,101,97,114,0,0,100,101,103,114,101,101,115,0,115,101,120,97,103,101,115,105,109,97,108,0,0,0,0,0,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,0,0,0,0,0,37,46,54,102,44,32,37,46,54,102,0,0,0,0,0,0,37,115,44,32,37,115,0,0,112,111,108,121,103,111,110,0,44,32,37,46,54,102,44,32,37,46,54,102,0,0,0,0,44,32,37,115,44,32,37,115,0,0,0,0,0,0,0,0,44,32,37,46,50,102,34,0,44,32,37,46,54,102,39,0,44,32,37,46,54,102,100,0,98,111,120,0,0,0,0,0,101,108,108,105,112,115,101,0,44,32,37,46,51,102,0,0,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,102,32,37,102], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE); +/* memory initializer */ allocate([1,0,0,0,0,0,0,0,87,67,83,73,78,73,84,78,58,32,87,67,83,32,110,97,109,101,32,37,115,32,110,111,116,32,109,97,116,99,104,101,100,32,105,110,32,70,73,84,83,32,104,101,97,100,101,114,10,0,0,0,0,0,0,0,87,67,83,78,65,77,69,0,87,67,83,65,88,69,83,0,78,65,88,73,83,0,0,0,87,67,83,68,73,77,0,0,87,67,83,73,78,73,84,58,32,78,111,32,87,67,83,65,88,69,83,44,32,78,65,88,73,83,44,32,111,114,32,87,67,83,68,73,77,32,107,101,121,119,111,114,100,0,0,0,78,65,88,73,83,49,0,0,73,77,65,71,69,87,0,0,87,67,83,73,78,73,84,58,32,78,111,32,78,65,88,73,83,49,32,111,114,32,73,77,65,71,69,87,32,107,101,121,119,111,114,100,0,0,0,0,78,65,88,73,83,50,0,0,73,77,65,71,69,72,0,0,87,67,83,73,78,73,84,58,32,78,111,32,78,65,88,73,83,50,32,111,114,32,73,77,65,71,69,72,32,107,101,121,119,111,114,100,0,0,0,0,37,100,0,0,0,0,0,0,87,67,83,73,78,73,84,58,32,77,105,115,115,105,110,103,32,107,101,121,119,111,114,100,32,37,115,32,97,115,115,117,109,101,100,32,49,10,0,0,67,84,89,80,69,0,0,0,45,84,65,66,0,0,0,0,73,78,83,84,82,85,77,69,0,0,0,0,0,0,0,0,68,69,84,69,67,84,79,82,0,0,0,0,0,0,0,0,68,67,45,70,76,65,71,0,87,67,83,68,69,80,0,0,87,67,83,73,78,73,84,58,32,100,101,112,101,110,100,101,100,32,111,110,32,87,67,83,32,99,111,117,108,100,32,110,111,116,32,98,101,32,115,101,116,0,0,0,0,0,0,0,86,83,79,85,82,67,69,0,90,83,79,85,82,67,69,0,86,69,76,79,67,73,84,89,0,0,0,0,0,0,0,0,67,84,89,80,69,49,0,0,67,84,89,80,69,50,0,0,76,65,84,0,0,0,0,0,68,69,67,0,0,0,0,0,67,84,89,80,69,51,0,0,67,84,89,80,69,52,0,0,67,85,78,73,84,49,0,0,87,65,84,49,0,0,0,0,117,110,105,116,115,0,0,0,112,105,120,101,108,0,0,0,67,85,78,73,84,50,0,0,87,65,84,50,0,0,0,0,67,82,80,73,88,49,0,0,67,82,80,73,88,50,0,0,67,82,86,65,76,49,0,0,67,82,86,65,76,50,0,0,76,79,78,80,79,76,69,0,76,65,84,80,79,76,69,0,80,82,79,74,82,48,0,0,80,82,79,74,80,37,100,0,80,86,37,100,95,49,0,0,80,86,37,100,95,50,0,0,80,86,37,100,95,51,0,0,80,86,37,100,95,37,100,0,67,68,49,95,49,0,0,0,67,68,49,95,50,0,0,0,67,68,50,95,49,0,0,0,67,68,50,95,50,0,0,0,67,79,49,95,49,0,0,0,80,76,65,84,69,0,0,0,67,79,49,95,37,100,0,0,67,79,50,95,49,0,0,0,67,79,50,95,37,100,0,0,67,68,69,76,84,49,0,0,67,68,69,76,84,50,0,0,83,69,67,80,73,88,0,0,80,73,88,83,67,65,76,69,0,0,0,0,0,0,0,0,80,73,88,83,67,65,76,49,0,0,0,0,0,0,0,0,88,80,73,88,83,73,90,69,0,0,0,0,0,0,0,0,83,69,67,80,73,88,49,0,83,69,67,80,73,88,50,0,89,80,73,88,83,73,90,69,0,0,0,0,0,0,0,0,80,73,88,83,67,65,76,50,0,0,0,0,0,0,0,0,80,67,48,48,49,48,48,49,0,0,0,0,0,0,0,0,80,67,48,48,37,49,100,48,48,37,49,100,0,0,0,0,80,67,49,95,49,0,0,0,80,67,37,49,100,95,37,49,100,0,0,0,0,0,0,0,67,82,79,84,65,50,0,0,67,82,79,84,65,49,0,0,87,67,83,73,78,73,84,58,32,115,101,116,116,105,110,103,32,67,68,69,76,84,32,116,111,32,49,0,0,0,0,0,76,73,78,69,65,82,0,0,80,73,88,69,76,0,0,0,77,74,68,45,79,66,83,0,68,65,84,69,45,79,66,83,0,0,0,0,0,0,0,0,68,65,84,69,0,0,0,0,69,80,79,67,72,0,0,0,85,84,0,0,0,0,0,0,85,84,77,73,68,0,0,0,87,67,83,73,78,73,84,67,58,32,78,111,32,105,109,97,103,101,32,115,99,97,108,101,32,102,111,114,32,87,67,83,32,37,99,0,0,0,0,0,80,76,84,82,65,72,0,0,80,76,84,82,65,77,0,0,80,76,84,82,65,83,0,0,80,76,84,68,69,67,83,78,0,0,0,0,0,0,0,0,80,76,84,68,69,67,68,0,80,76,84,68,69,67,77,0,80,76,84,68,69,67,83,0,69,81,85,73,78,79,88,0,70,75,52,0,0,0,0,0,70,75,53,0,0,0,0,0,37,50,46,48,102,58,37,50,46,48,102,58,37,53,46,51,102,32,37,99,37,50,46,48,102,58,37,50,46,48,102,58,37,53,46,51,102,32,37,115,0,0,0,0,0,0,0,0,80,76,84,83,67,65,76,69,0,0,0,0,0,0,0,0,88,80,73,88,69,76,83,90,0,0,0,0,0,0,0,0,89,80,73,88,69,76,83,90,0,0,0,0,0,0,0,0,67,78,80,73,88,49,0,0,67,78,80,73,88,50,0,0,80,80,79,49,0,0,0,0,80,80,79,37,100,0,0,0,65,77,68,88,49,0,0,0,65,77,68,88,37,100,0,0,65,77,68,89,49,0,0,0,65,77,68,89,37,100,0,0,82,65,0,0,0,0,0,0,82,65,45,45,45,68,83,83,0,0,0,0,0,0,0,0,68,69,67,45,45,68,83,83,0,0,0,0,0,0,0,0,87,67,83,73,78,73,84,58,32,78,111,32,82,65,32,119,105,116,104,32,83,69,67,80,73,88,44,32,110,111,32,87,67,83,0,0,0,0,0,0,87,67,83,73,78,73,84,32,78,111,32,68,69,67,32,119,105,116,104,32,83,69,67,80,73,88,44,32,110,111,32,87,67,83,0,0,0,0,0,0,76,79,78,71,80,79,76,69,0,0,0,0,0,0,0,0,82,65,45,45,45,84,65,78,0,0,0,0,0,0,0,0,68,69,67,45,45,84,65,78,0,0,0,0,0,0,0,0,87,67,83,73,78,73,84,58,32,78,111,32,105,109,97,103,101,32,115,99,97,108,101,0,84,65,78,0,0,0,0,0,42,69,114,114,111,114,42,58,32,105,110,99,111,114,114,101,99,116,32,108,105,110,101,97,114,32,99,111,110,118,101,114,115,105,111,110,32,105,110,32,37,115,0,0,0,0,0,0,87,65,82,78,73,78,71,58,32,83,105,103,110,105,102,105,99,97,110,116,32,105,110,97,99,99,117,114,97,99,121,32,108,105,107,101,108,121,32,116,111,32,111,99,99,117,114,32,105,110,32,112,114,111,106,101,99,116,105,111,110,0,0,0,69,81,85,73,78,79,88,37,99,0,0,0,0,0,0,0,82,65,68,69,67,83,89,83,37,99,0,0,0,0,0,0,82,65,68,69,67,83,89,83,0,0,0,0,0,0,0,0,73,67,82,83,0,0,0,0,71,65,76,0,0,0,0,0,69,67,76,0,0,0,0,0,71,65,76,65,67,84,73,67,0,0,0,0,0,0,0,0,69,67,76,73,80,84,73,67,0,0,0,0,0,0,0,0,83,71,65,76,65,67,84,67,0,0,0,0,0,0,0,0,72,69,76,73,79,69,67,76,0,0,0,0,0,0,0,0,65,76,84,65,90,0,0,0,0,0,0,0,0,0,0,0,68,69,67,0,0,0,0,0,76,79,78,71,0,0,0,0,76,73,78,69,65,82,0,0,80,73,88,69,76,0,0,0,68,69,84,0,0,0,0,0,37,45,52,115,37,52,115,0,78,80,79,76,0,0,0,0,76,65,84,0,0,0,0,0,78,80,79,76,69,0,0,0,83,80,65,45,0,0,0,0,73,77,83,89,83,0,0,0,105,109,115,121,115,0,0,0,37,46,52,102,0,0,0,0,66,49,57,53,48,0,0,0,74,50,48,48,48,0,0,0,37,115,9,37,115,0,0,0,37,115,32,37,115,0,0,0,42,42,42,42,42,42,42,42,42,9,42,42,42,42,42,42,42,42,42,42,0,0,0,0,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,0,0,0,0,0,42,42,42,42,42,42,42,42,42,42,42,42,42,9,42,42,42,42,42,42,42,42,42,42,42,42,42,0,0,0,0,0,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,0,0,0,0,0,0,9,103,97,108,97,99,116,105,99,0,0,0,0,0,0,0,32,103,97,108,97,99,116,105,99,0,0,0,0,0,0,0,9,101,99,108,105,112,116,105,99,0,0,0,0,0,0,0,32,101,99,108,105,112,116,105,99,0,0,0,0,0,0,0,9,108,111,110,103,45,110,112,97,0,0,0,0,0,0,0,32,108,111,110,103,45,110,112,97,0,0,0,0,0,0,0,9,108,111,110,103,45,115,112,97,0,0,0,0,0,0,0,32,108,111,110,103,45,115,112,97,0,0,0,0,0,0,0,42,42,42,42,42,42,42,42,42,42,9,42,42,42,42,42,42,42,42,42,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,0,0,0,0,0,0,0,0,0,0,0,0,87,67,83,95,67,79,77,77,65,78,68,0,0,0,0,0,87,67,83,95,67,79,77,77,65,78,68,37,100,0,0,0,50,48,48,48,0,0,0,0,50,48,48,48,46,48,0,0,73,67,82,83,0,0,0,0,105,99,114,115,0,0,0,0,70,75,53,0,0,0,0,0,102,107,53,0,0,0,0,0,49,57,53,48,0,0,0,0,49,57,53,48,46,48,0,0,70,75,52,0,0,0,0,0,102,107,52,0,0,0,0,0,112,105,120,101,108,0,0,0,44,66,124,35,100,255,239,63,206,4,147,55,81,230,134,63,201,87,119,237,8,231,115,63,8,49,216,60,72,85,196,190,141,82,239,197,175,26,93,190,79,75,150,130,180,74,73,190,206,4,147,55,81,230,134,191,110,20,118,229,124,255,239,63,190,2,89,23,76,127,252,190,141,82,239,197,175,26,93,62,186,92,192,248,87,85,196,190,213,61,80,36,200,25,210,61,192,143,86,244,8,231,115,191,40,252,144,126,141,121,252,190,190,45,6,62,231,255,239,63,79,75,150,130,180,74,73,62,213,61,80,36,200,25,210,61,56,97,156,141,155,85,196,190,37,201,115,125,31,14,66,191,237,156,102,129,118,135,206,63,237,128,235,138,25,225,219,191,138,238,48,88,55,255,239,63,235,42,147,208,76,230,134,63,26,132,28,8,135,230,115,63,12,31,17,83,34,137,206,191,58,234,232,184,26,217,101,191,7,35,246,9,160,24,137,63,235,42,147,208,76,230,134,191,233,248,162,28,80,255,239,63,8,168,211,46,100,125,252,190,137,181,248,20,0,227,219,63,180,173,102,157,241,125,129,191,174,14,128,184,171,87,97,63,26,132,28,8,135,230,115,191,247,97,247,252,180,122,252,190,137,77,92,117,186,255,239,63,125,150,201,34,100,255,239,63,15,157,207,213,158,230,134,191,92,113,244,103,237,229,115,191,26,77,59,180,100,85,196,62,52,175,17,131,3,27,93,190,173,87,210,121,59,74,73,190,20,1,96,210,158,230,134,63,3,186,248,225,124,255,239,63,250,59,9,220,34,127,252,190,52,175,17,131,3,27,93,62,91,229,82,109,116,85,196,62,232,167,8,110,48,27,210,189,73,225,178,117,237,229,115,63,235,19,108,31,83,119,252,190,10,30,195,64,231,255,239,63,173,87,210,121,59,74,73,62,185,158,187,181,171,23,210,189,73,125,255,4,184,85,196,62,37,201,115,125,31,14,66,191,211,48,124,68,76,137,206,191,34,223,165,212,37,227,219,63,45,6,81,239,144,255,239,63,108,197,229,21,219,230,134,191,214,96,142,220,162,229,115,191,180,174,209,114,160,135,206,63,58,234,232,184,26,217,101,191,180,173,102,157,241,125,129,191,108,197,229,21,219,230,134,63,26,73,6,169,169,255,239,63,26,238,175,96,19,128,252,190,134,170,152,74,63,225,219,191,7,35,246,9,160,24,137,63,174,14,128,184,171,87,97,63,214,96,142,220,162,229,115,63,212,213,62,153,86,117,252,190,150,50,62,6,10,0,240,63,0,0,0,0,0,0,0,0,70,75,52,50,71,65,76,58,32,66,49,57,53,48,32,82,65,44,68,101,99,61,32,37,115,10,0,0,0,0,0,0,70,75,52,50,71,65,76,58,32,108,111,110,103,32,61,32,37,46,53,102,32,108,97,116,32,61,32,37,46,53,102,10,0,0,0,0,0,0,0,0,71,65,76,50,70,75,52,58,32,108,111,110,103,32,61,32,37,46,53,102,32,108,97,116,32,61,32,37,46,53,102,10,0,0,0,0,0,0,0,0,71,65,76,50,70,75,52,58,32,66,49,57,53,48,32,82,65,44,68,101,99,61,32,37,115,10,0,0,0,0,0,0,70,75,53,50,71,65,76,58,32,74,50,48,48,48,32,82,65,44,68,101,99,61,32,37,115,10,0,0,0,0,0,0,70,75,53,50,71,65,76,58,32,108,111,110,103,32,61,32,37,46,53,102,32,108,97,116,32,61,32,37,46,53,102,10,0,0,0,0,0,0,0,0,71,65,76,50,70,75,53,58,32,108,111,110,103,32,61,32,37,46,53,102,32,108,97,116,32,61,32,37,46,53,102,10,0,0,0,0,0,0,0,0,71,65,76,50,70,75,53,58,32,74,50,48,48,48,32,82,65,44,68,101,99,61,32,37,115,10,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,54,46,51,102,32,37,99,37,48,50,100,58,37,48,50,100,58,37,48,53,46,50,102,0,0,0,0,0,0,0,0,0,0,0,0,0,69,78,68,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,31,0,0,0,28,0,0,0,31,0,0,0,30,0,0,0,31,0,0,0,30,0,0,0,31,0,0,0,31,0,0,0,30,0,0,0,31,0,0,0,30,0,0,0,31,0,0,0,37,115,95,49,0,0,0,0,37,115,95,37,100,0,0,0,37,115,95,48,49,0,0,0,37,115,95,48,48,49,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,45,48,0,0,0,0,0,0,37,100,0,0,0,0,0,0,37,37,46,37,100,102,0,0,37,48,50,100,58,37,48,50,100,58,37,48,57,46,54,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,56,46,53,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,55,46,52,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,54,46,51,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,53,46,50,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,52,46,49,102,0,0,0,0,0,0,0,0,37,48,50,100,58,37,48,50,100,58,37,48,50,100,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,57,46,54,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,56,46,53,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,55,46,52,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,54,46,51,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,53,46,50,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,52,46,49,102,0,0,0,0,0,0,37,99,37,48,50,100,58,37,48,50,100,58,37,48,50,100,0,0,0,0,0,0,0,0,37,37,37,100,46,37,100,102,0,0,0,0,0,0,0,0,37,37,37,52,100,0,0,0,37,37,37,100,100], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+4352); +/* memory initializer */ allocate([87,65,84,49,0,0,0,0,87,65,84,50,0,0,0,0,108,111,110,103,112,111,108,101,0,0,0,0,0,0,0,0,114,111,0,0,0,0,0,0,108,110,103,99,111,114,0,0,108,97,116,99,111,114,0,0,84,78,88,95,71,83,69,86,65,76,58,32,117,110,107,110,111,119,110,32,115,117,114,102,97,99,101,32,116,121,112,101,10,0,0,0,0,0,0,0,84,78,88,95,71,83,68,69,82,58,32,111,114,100,101,114,32,111,102,32,100,101,114,105,118,97,116,105,118,101,115,32,99,97,110,110,111,116,32,98,101,32,60,32,48,10,0,0,84,78,88,95,71,83,68,69,82,58,32,117,110,107,110,111,119,110,32,115,117,114,102,97,99,101,32,116,121,112,101,32,37,100,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,102,95,103,115,114,101,115,116,111,114,101,58,32,105,108,108,101,103,97,108,32,120,32,111,114,100,101,114,32,37,100,10,0,0,0,0,0,0,0,119,102,95,103,115,114,101,115,116,111,114,101,58,32,105,108,108,101,103,97,108,32,121,32,111,114,100,101,114,32,37,100,10,0,0,0,0,0,0,0,119,102,95,103,115,114,101,115,116,111,114,101,58,32,105,108,108,101,103,97,108,32,120,32,114,97,110,103,101,32,37,102,45,37,102,10,0,0,0,0,119,102,95,103,115,114,101,115,116,111,114,101,58,32,105,108,108,101,103,97,108,32,121,32,114,97,110,103,101,32,37,102,45,37,102,10,0,0,0,0,119,102,95,103,115,114,101,115,116,111,114,101,58,32,117,110,107,110,111,119,110,32,115,117,114,102,97,99,101,32,116,121,112,101,32,37,100,10,0,0,87,65,84,49,0,0,0,0,87,65,84,49,95,48,48,49,61,32,39,119,116,121,112,101,61,122,112,120,32,97,120,116,121,112,101,61,114,97,32,112,114,111,106,112,48,61,48,46,32,112,114,111,106,112,49,61,49,46,32,112,114,111,106,112,50,61,48,46,32,112,114,111,106,112,51,61,51,51,55,46,55,52,32,112,114,111,106,39,87,65,84,50,95,48,48,49,61,32,39,119,116,121,112,101,61,122,112,120,32,97,120,116,121,112,101,61,100,101,99,32,112,114,111,106,112,48,61,48,46,32,112,114,111,106,112,49,61,49,46,32,112,114,111,106,112,50,61,48,46,32,112,114,111,106,112,51,61,51,51,55,46,55,52,32,112,114,111,39,0,0,0,0,0,0,0,0,87,65,84,50,0,0,0,0,108,111,110,103,112,111,108,101,0,0,0,0,0,0,0,0,114,111,0,0,0,0,0,0,112,114,111,106,112,37,100,0,108,110,103,99,111,114,0,0,108,97,116,99,111,114,0,0,10,62,32,37,115,37,115,10,10,0,0,0,0,0,0,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,0,0,112,111,108,121,32,40,49,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,84,104,101,32,100,105,109,101,110,115,105,111,110,97,108,105,116,121,32,111,102,32,116,104,101,32,112,111,108,121,110,111,109,32,40,37,100,41,32,101,120,99,101,101,100,115,32,116,104,101,32,109,97,120,105,109,117,109,10,97,108,108,111,119,101,100,32,111,110,101,32,40,37,100,41,0,0,0,0,0,42,69,114,114,111,114,42,58,32,0,0,0,0,0,0,0,112,111,108,121,45,62,103,114,111,117,112,32,40,112,111,108,121,45,62,110,100,105,109,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,112,111,108,121,45,62,100,101,103,114,101,101,32,40,112,111,108,121,45,62,110,103,114,111,117,112,32,101,108,101,109,101,110,116,115,41,32,33,0,0,42,69,114,114,111,114,42,58,32,112,111,108,121,110,111,109,105,97,108,32,71,82,79,85,80,32,111,117,116,32,111,102,32,114,97,110,103,101,0,0,0,0,0,0,0,0,0,0,84,104,101,32,100,101,103,114,101,101,32,111,102,32,116,104,101,32,112,111,108,121,110,111,109,32,40,37,100,41,32,101,120,99,101,101,100,115,32,116,104,101,32,109,97,120,105,109,117,109,10,97,108,108,111,119,101,100,32,111,110,101,32,40,37,100,41,0,0,0,0,0,112,111,108,121,45,62,98,97,115,105,115,32,40,112,111,108,121,45,62,110,99,111,101,102,102,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,112,111,108,121,45,62,99,111,101,102,102,32,40,112,111,108,121,45,62,110,99,111,101,102,102,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,42,73,110,116,101,114,110,97,108,32,69,114,114,111,114,42,58,32,79,110,101,32,111,102,32,120,32,111,114,32,101,120,116,98,97,115,105,115,32,115,104,111,117,108,100,32,98,101,32,100,105,102,102,101,114,101,110,116,32,102,114,111,109,32,78,85,76,76,10,105,110,32,0,0,0,0,0,0,0,0,112,111,108,121,95,102,117,110,99,40,41,0,0,0,0,0,97,108,112,104,97,32,40,109,97,116,115,105,122,101,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,0,98,101,116,97,32,40,110,99,111,101,102,102,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,0,0,0,118,109,97,116,32,40,110,42,110,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,119,109,97,116,32,40,110,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,112,32,40,110,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,0,0,0,42,69,114,114,111,114,42,58,32,78,111,116,32,101,110,111,117,103,104,32,114,111,119,115,32,102,111,114,32,115,111,108,118,105,110,103,32,116,104,101,32,115,121,115,116,101,109,32,0,0,0,0,0,0,0,0,105,110,32,115,118,100,102,105,116,40,41,0,0,0,0,0,114,118,49,32,40,110,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,0,116,109,112,32,40,110,32,101,108,101,109,101,110,116,115,41,32,33,0,0,0,0,0,0,42,69,114,114,111,114,42,58,32,78,111,32,99,111,110,118,101,114,103,101,110,99,101,32,105,110,32,49,48,48,32,83,86,68,32,105,116,101,114,97,116,105,111,110,115,32,0,0,67,85,66,69,70,65,67,69,0,0,0,0,0,0,0,0,37,46,51,115,0,0,0,0,82,65,45,45,0,0,0,0,82,65,0,0,0,0,0,0,68,69,67,45,45,37,115,0,68,69,67,45,0,0,0,0,82,65,45,45,45,37,115,0,76,79,78,0,0,0,0,0,37,99,76,79,78,0,0,0,37,99,76,65,84,0,0,0,37,115,45,37,115,0,0,0,76,65,84,0,0,0,0,0,76,78,0,0,0,0,0,0,37,99,37,99,76,78,0,0,37,99,37,99,76,84,0,0,76,84,0,0,0,0,0,0,71,76,83,0,0,0,0,0,78,67,80,0,0,0,0,0,26,0,0,0,0,0,0,0,65,90,80,0,83,90,80,0,84,65,78,0,83,84,71,0,83,73,78,0,65,82,67,0,90,80,78,0,90,69,65,0,65,73,82,0,67,89,80,0,67,69,65,0,67,65,82,0,77,69,82,0,67,79,80,0,67,79,69,0,67,79,68,0,67,79,79,0,83,70,76,0,80,65,82,0,77,79,76,0,65,73,84,0,66,79,78,0,80,67,79,0,84,83,67,0,67,83,67,0,81,83,67,0,65,90,80,0,0,0,0,0,83,90,80,0,0,0,0,0,84,65,78,0,0,0,0,0,83,84,71,0,0,0,0,0,83,73,78,0,0,0,0,0,65,82,67,0,0,0,0,0,90,80,78,0,0,0,0,0,90,69,65,0,0,0,0,0,65,73,82,0,0,0,0,0,67,89,80,0,0,0,0,0,67,69,65,0,0,0,0,0,67,65,82,0,0,0,0,0,77,69,82,0,0,0,0,0,83,70,76,0,0,0,0,0,80,65,82,0,0,0,0,0,77,79,76,0,0,0,0,0,65,73,84,0,0,0,0,0,67,79,80,0,0,0,0,0,67,79,69,0,0,0,0,0,67,79,68,0,0,0,0,0,67,79,79,0,0,0,0,0,66,79,78,0,0,0,0,0,80,67,79,0,0,0,0,0,84,83,67,0,0,0,0,0,67,83,67,0,0,0,0,0,81,83,67,0,0,0,0,0,65,95,79,82,68,69,82,0,68,73,83,84,73,78,73,84,58,32,77,105,115,115,105,110,103,32,65,95,79,82,68,69,82,32,107,101,121,119,111,114,100,32,102,111,114,32,83,112,105,116,122,101,114,32,100,105,115,116,111,114,116,105,111,110,0,0,0,0,0,0,0,0,65,95,37,100,95,37,100,0,66,95,79,82,68,69,82,0,68,73,83,84,73,78,73,84,58,32,77,105,115,115,105,110,103,32,66,95,79,82,68,69,82,32,107,101,121,119,111,114,100,32,102,111,114,32,83,112,105,116,122,101,114,32,100,105,115,116,111,114,116,105,111,110,0,0,0,0,0,0,0,0,66,95,37,100,95,37,100,0,65,80,95,79,82,68,69,82,0,0,0,0,0,0,0,0,68,73,83,84,73,78,73,84,58,32,77,105,115,115,105,110,103,32,65,80,95,79,82,68,69,82,32,107,101,121,119,111,114,100,32,102,111,114,32,83,112,105,116,122,101,114,32,100,105,115,116,111,114,116,105,111,110,0,0,0,0,0,0,0,65,80,95,37,100,95,37,100,0,0,0,0,0,0,0,0,66,80,95,79,82,68,69,82,0,0,0,0,0,0,0,0,68,73,83,84,73,78,73,84,58,32,77,105,115,115,105,110,103,32,66,80,95,79,82,68,69,82,32,107,101,121,119,111,114,100,32,102,111,114,32,83,112,105,116,122,101,114,32,100,105,115,116,111,114,116,105,111,110,0,0,0,0,0,0,0,66,80,95,37,100,95,37,100,0,0,0,0,0,0,0,0,45,83,73,80,0,0,0,0,0,0,0,0,0,0,0,0,91,99,100,108,95,122,115,99,97,108,101,93,32,37,100,120,37,100,45,37,100,32,32,99,111,110,116,61,37,103,32,111,112,116,115,122,61,37,100,32,108,101,110,61,37,100,10,0,91,99,100,108,95,122,115,99,97,108,101,93,32,122,109,105,110,61,37,103,32,122,109,97,120,61,37,103,32,108,101,102,116,61,37,103,32,109,101,100,105,97,110,61,37,103,10,0,91,99,100,108,95,122,115,99,97,108,101,93,32,109,105,110,112,105,120,61,37,100,32,110,103,114,111,119,61,37,100,32,110,103,111,111,100,112,105,120,61,37,100,10,0,0,0,0,91,99,100,108,95,122,115,99,97,108,101,93,32,122,115,108,111,112,101,61,37,103,32,99,101,110,116,101,114,95,112,105,120,61,37,100,32,122,49,61,37,103,32,122,50,61,37,103,10,0,0,0,0,0,0,0,91,115,97,109,112,108,101,73,109,97,103,101,93,32,111,112,116,95,110,112,105,120,47,108,105,110,101,61,37,100,32,99,111,108,95,115,116,101,112,61,37,100,32,110,47,108,105,110,101,61,37,100,10,0,0,0,91,115,97,109,112,108,101,73,109,97,103,101,93,32,110,108,95,105,110,95,115,97,109,112,61,37,100,47,37,100,32,111,112,116,95,110,108,47,115,97,109,112,61,37,100,32,108,115,116,101,112,61,37,100,10,0,0,0,0,0,150,48,7,119,44,97,14,238,186,81,9,153,25,196,109,7,143,244,106,112,53,165,99,233,163,149,100,158,50,136,219,14,164,184,220,121,30,233,213,224,136,217,210,151,43,76,182,9,189,124,177,126,7,45,184,231,145,29,191,144,100,16,183,29,242,32,176,106,72,113,185,243,222,65,190,132,125,212,218,26,235,228,221,109,81,181,212,244,199,133,211,131,86,152,108,19,192,168,107,100,122,249,98,253,236,201,101,138,79,92,1,20,217,108,6,99,99,61,15,250,245,13,8,141,200,32,110,59,94,16,105,76,228,65,96,213,114,113,103,162,209,228,3,60,71,212,4,75,253,133,13,210,107,181,10,165,250,168,181,53,108,152,178,66,214,201,187,219,64,249,188,172,227,108,216,50,117,92,223,69,207,13,214,220,89,61,209,171,172,48,217,38,58,0,222,81,128,81,215,200,22,97,208,191,181,244,180,33,35,196,179,86,153,149,186,207,15,165,189,184,158,184,2,40,8,136,5,95,178,217,12,198,36,233,11,177,135,124,111,47,17,76,104,88,171,29,97,193,61,45,102,182,144,65,220,118,6,113,219,1,188,32,210,152,42,16,213,239,137,133,177,113,31,181,182,6,165,228,191,159,51,212,184,232,162,201,7,120,52,249,0,15,142,168,9,150,24,152,14,225,187,13,106,127,45,61,109,8,151,108,100,145,1,92,99,230,244,81,107,107,98,97,108,28,216,48,101,133,78,0,98,242,237,149,6,108,123,165,1,27,193,244,8,130,87,196,15,245,198,217,176,101,80,233,183,18,234,184,190,139,124,136,185,252,223,29,221,98,73,45,218,21,243,124,211,140,101,76,212,251,88,97,178,77,206,81,181,58,116,0,188,163,226,48,187,212,65,165,223,74,215,149,216,61,109,196,209,164,251,244,214,211,106,233,105,67,252,217,110,52,70,136,103,173,208,184,96,218,115,45,4,68,229,29,3,51,95,76,10,170,201,124,13,221,60,113,5,80,170,65,2,39,16,16,11,190,134,32,12,201,37,181,104,87,179,133,111,32,9,212,102,185,159,228,97,206,14,249,222,94,152,201,217,41,34,152,208,176,180,168,215,199,23,61,179,89,129,13,180,46,59,92,189,183,173,108,186,192,32,131,184,237,182,179,191,154,12,226,182,3,154,210,177,116,57,71,213,234,175,119,210,157,21,38,219,4,131,22,220,115,18,11,99,227,132,59,100,148,62,106,109,13,168,90,106,122,11,207,14,228,157,255,9,147,39,174,0,10,177,158,7,125,68,147,15,240,210,163,8,135,104,242,1,30,254,194,6,105,93,87,98,247,203,103,101,128,113,54,108,25,231,6,107,110,118,27,212,254,224,43,211,137,90,122,218,16,204,74,221,103,111,223,185,249,249,239,190,142,67,190,183,23,213,142,176,96,232,163,214,214,126,147,209,161,196,194,216,56,82,242,223,79,241,103,187,209,103,87,188,166,221,6,181,63,75,54,178,72,218,43,13,216,76,27,10,175,246,74,3,54,96,122,4,65,195,239,96,223,85,223,103,168,239,142,110,49,121,190,105,70,140,179,97,203,26,131,102,188,160,210,111,37,54,226,104,82,149,119,12,204,3,71,11,187,185,22,2,34,47,38,5,85,190,59,186,197,40,11,189,178,146,90,180,43,4,106,179,92,167,255,215,194,49,207,208,181,139,158,217,44,29,174,222,91,176,194,100,155,38,242,99,236,156,163,106,117,10,147,109,2,169,6,9,156,63,54,14,235,133,103,7,114,19,87,0,5,130,74,191,149,20,122,184,226,174,43,177,123,56,27,182,12,155,142,210,146,13,190,213,229,183,239,220,124,33,223,219,11,212,210,211,134,66,226,212,241,248,179,221,104,110,131,218,31,205,22,190,129,91,38,185,246,225,119,176,111,119,71,183,24,230,90,8,136,112,106,15,255,202,59,6,102,92,11,1,17,255,158,101,143,105,174,98,248,211,255,107,97,69,207,108,22,120,226,10,160,238,210,13,215,84,131,4,78,194,179,3,57,97,38,103,167,247,22,96,208,77,71,105,73,219,119,110,62,74,106,209,174,220,90,214,217,102,11,223,64,240,59,216,55,83,174,188,169,197,158,187,222,127,207,178,71,233,255,181,48,28,242,189,189,138,194,186,202,48,147,179,83,166,163,180,36,5,54,208,186,147,6,215,205,41,87,222,84,191,103,217,35,46,122,102,179,184,74,97,196,2,27,104,93,148,43,111,42,55,190,11,180,161,142,12,195,27,223,5,90,141,239,2,45,0,0,0,0,65,49,27,25,130,98,54,50,195,83,45,43,4,197,108,100,69,244,119,125,134,167,90,86,199,150,65,79,8,138,217,200,73,187,194,209,138,232,239,250,203,217,244,227,12,79,181,172,77,126,174,181,142,45,131,158,207,28,152,135,81,18,194,74,16,35,217,83,211,112,244,120,146,65,239,97,85,215,174,46,20,230,181,55,215,181,152,28,150,132,131,5,89,152,27,130,24,169,0,155,219,250,45,176,154,203,54,169,93,93,119,230,28,108,108,255,223,63,65,212,158,14,90,205,162,36,132,149,227,21,159,140,32,70,178,167,97,119,169,190,166,225,232,241,231,208,243,232,36,131,222,195,101,178,197,218,170,174,93,93,235,159,70,68,40,204,107,111,105,253,112,118,174,107,49,57,239,90,42,32,44,9,7,11,109,56,28,18,243,54,70,223,178,7,93,198,113,84,112,237,48,101,107,244,247,243,42,187,182,194,49,162,117,145,28,137,52,160,7,144,251,188,159,23,186,141,132,14,121,222,169,37,56,239,178,60,255,121,243,115,190,72,232,106,125,27,197,65,60,42,222,88,5,79,121,240,68,126,98,233,135,45,79,194,198,28,84,219,1,138,21,148,64,187,14,141,131,232,35,166,194,217,56,191,13,197,160,56,76,244,187,33,143,167,150,10,206,150,141,19,9,0,204,92,72,49,215,69,139,98,250,110,202,83,225,119,84,93,187,186,21,108,160,163,214,63,141,136,151,14,150,145,80,152,215,222,17,169,204,199,210,250,225,236,147,203,250,245,92,215,98,114,29,230,121,107,222,181,84,64,159,132,79,89,88,18,14,22,25,35,21,15,218,112,56,36,155,65,35,61,167,107,253,101,230,90,230,124,37,9,203,87,100,56,208,78,163,174,145,1,226,159,138,24,33,204,167,51,96,253,188,42,175,225,36,173,238,208,63,180,45,131,18,159,108,178,9,134,171,36,72,201,234,21,83,208,41,70,126,251,104,119,101,226,246,121,63,47,183,72,36,54,116,27,9,29,53,42,18,4,242,188,83,75,179,141,72,82,112,222,101,121,49,239,126,96,254,243,230,231,191,194,253,254,124,145,208,213,61,160,203,204,250,54,138,131,187,7,145,154,120,84,188,177,57,101,167,168,75,152,131,59,10,169,152,34,201,250,181,9,136,203,174,16,79,93,239,95,14,108,244,70,205,63,217,109,140,14,194,116,67,18,90,243,2,35,65,234,193,112,108,193,128,65,119,216,71,215,54,151,6,230,45,142,197,181,0,165,132,132,27,188,26,138,65,113,91,187,90,104,152,232,119,67,217,217,108,90,30,79,45,21,95,126,54,12,156,45,27,39,221,28,0,62,18,0,152,185,83,49,131,160,144,98,174,139,209,83,181,146,22,197,244,221,87,244,239,196,148,167,194,239,213,150,217,246,233,188,7,174,168,141,28,183,107,222,49,156,42,239,42,133,237,121,107,202,172,72,112,211,111,27,93,248,46,42,70,225,225,54,222,102,160,7,197,127,99,84,232,84,34,101,243,77,229,243,178,2,164,194,169,27,103,145,132,48,38,160,159,41,184,174,197,228,249,159,222,253,58,204,243,214,123,253,232,207,188,107,169,128,253,90,178,153,62,9,159,178,127,56,132,171,176,36,28,44,241,21,7,53,50,70,42,30,115,119,49,7,180,225,112,72,245,208,107,81,54,131,70,122,119,178,93,99,78,215,250,203,15,230,225,210,204,181,204,249,141,132,215,224,74,18,150,175,11,35,141,182,200,112,160,157,137,65,187,132,70,93,35,3,7,108,56,26,196,63,21,49,133,14,14,40,66,152,79,103,3,169,84,126,192,250,121,85,129,203,98,76,31,197,56,129,94,244,35,152,157,167,14,179,220,150,21,170,27,0,84,229,90,49,79,252,153,98,98,215,216,83,121,206,23,79,225,73,86,126,250,80,149,45,215,123,212,28,204,98,19,138,141,45,82,187,150,52,145,232,187,31,208,217,160,6,236,243,126,94,173,194,101,71,110,145,72,108,47,160,83,117,232,54,18,58,169,7,9,35,106,84,36,8,43,101,63,17,228,121,167,150,165,72,188,143,102,27,145,164,39,42,138,189,224,188,203,242,161,141,208,235,98,222,253,192,35,239,230,217,189,225,188,20,252,208,167,13,63,131,138,38,126,178,145,63,185,36,208,112,248,21,203,105,59,70,230,66,122,119,253,91,181,107,101,220,244,90,126,197,55,9,83,238,118,56,72,247,177,174,9,184,240,159,18,161,51,204,63,138,114,253,36,147,0,0,0,0,55,106,194,1,110,212,132,3,89,190,70,2,220,168,9,7,235,194,203,6,178,124,141,4,133,22,79,5,184,81,19,14,143,59,209,15,214,133,151,13,225,239,85,12,100,249,26,9,83,147,216,8,10,45,158,10,61,71,92,11,112,163,38,28,71,201,228,29,30,119,162,31,41,29,96,30,172,11,47,27,155,97,237,26,194,223,171,24,245,181,105,25,200,242,53,18,255,152,247,19,166,38,177,17,145,76,115,16,20,90,60,21,35,48,254,20,122,142,184,22,77,228,122,23,224,70,77,56,215,44,143,57,142,146,201,59,185,248,11,58,60,238,68,63,11,132,134,62,82,58,192,60,101,80,2,61,88,23,94,54,111,125,156,55,54,195,218,53,1,169,24,52,132,191,87,49,179,213,149,48,234,107,211,50,221,1,17,51,144,229,107,36,167,143,169,37,254,49,239,39,201,91,45,38,76,77,98,35,123,39,160,34,34,153,230,32,21,243,36,33,40,180,120,42,31,222,186,43,70,96,252,41,113,10,62,40,244,28,113,45,195,118,179,44,154,200,245,46,173,162,55,47,192,141,154,112,247,231,88,113,174,89,30,115,153,51,220,114,28,37,147,119,43,79,81,118,114,241,23,116,69,155,213,117,120,220,137,126,79,182,75,127,22,8,13,125,33,98,207,124,164,116,128,121,147,30,66,120,202,160,4,122,253,202,198,123,176,46,188,108,135,68,126,109,222,250,56,111,233,144,250,110,108,134,181,107,91,236,119,106,2,82,49,104,53,56,243,105,8,127,175,98,63,21,109,99,102,171,43,97,81,193,233,96,212,215,166,101,227,189,100,100,186,3,34,102,141,105,224,103,32,203,215,72,23,161,21,73,78,31,83,75,121,117,145,74,252,99,222,79,203,9,28,78,146,183,90,76,165,221,152,77,152,154,196,70,175,240,6,71,246,78,64,69,193,36,130,68,68,50,205,65,115,88,15,64,42,230,73,66,29,140,139,67,80,104,241,84,103,2,51,85,62,188,117,87,9,214,183,86,140,192,248,83,187,170,58,82,226,20,124,80,213,126,190,81,232,57,226,90,223,83,32,91,134,237,102,89,177,135,164,88,52,145,235,93,3,251,41,92,90,69,111,94,109,47,173,95,128,27,53,225,183,113,247,224,238,207,177,226,217,165,115,227,92,179,60,230,107,217,254,231,50,103,184,229,5,13,122,228,56,74,38,239,15,32,228,238,86,158,162,236,97,244,96,237,228,226,47,232,211,136,237,233,138,54,171,235,189,92,105,234,240,184,19,253,199,210,209,252,158,108,151,254,169,6,85,255,44,16,26,250,27,122,216,251,66,196,158,249,117,174,92,248,72,233,0,243,127,131,194,242,38,61,132,240,17,87,70,241,148,65,9,244,163,43,203,245,250,149,141,247,205,255,79,246,96,93,120,217,87,55,186,216,14,137,252,218,57,227,62,219,188,245,113,222,139,159,179,223,210,33,245,221,229,75,55,220,216,12,107,215,239,102,169,214,182,216,239,212,129,178,45,213,4,164,98,208,51,206,160,209,106,112,230,211,93,26,36,210,16,254,94,197,39,148,156,196,126,42,218,198,73,64,24,199,204,86,87,194,251,60,149,195,162,130,211,193,149,232,17,192,168,175,77,203,159,197,143,202,198,123,201,200,241,17,11,201,116,7,68,204,67,109,134,205,26,211,192,207,45,185,2,206,64,150,175,145,119,252,109,144,46,66,43,146,25,40,233,147,156,62,166,150,171,84,100,151,242,234,34,149,197,128,224,148,248,199,188,159,207,173,126,158,150,19,56,156,161,121,250,157,36,111,181,152,19,5,119,153,74,187,49,155,125,209,243,154,48,53,137,141,7,95,75,140,94,225,13,142,105,139,207,143,236,157,128,138,219,247,66,139,130,73,4,137,181,35,198,136,136,100,154,131,191,14,88,130,230,176,30,128,209,218,220,129,84,204,147,132,99,166,81,133,58,24,23,135,13,114,213,134,160,208,226,169,151,186,32,168,206,4,102,170,249,110,164,171,124,120,235,174,75,18,41,175,18,172,111,173,37,198,173,172,24,129,241,167,47,235,51,166,118,85,117,164,65,63,183,165,196,41,248,160,243,67,58,161,170,253,124,163,157,151,190,162,208,115,196,181,231,25,6,180,190,167,64,182,137,205,130,183,12,219,205,178,59,177,15,179,98,15,73,177,85,101,139,176,104,34,215,187,95,72,21,186,6,246,83,184,49,156,145,185,180,138,222,188,131,224,28,189,218,94,90,191,237,52,152,190,0,0,0,0,101,103,188,184,139,200,9,170,238,175,181,18,87,151,98,143,50,240,222,55,220,95,107,37,185,56,215,157,239,40,180,197,138,79,8,125,100,224,189,111,1,135,1,215,184,191,214,74,221,216,106,242,51,119,223,224,86,16,99,88,159,87,25,80,250,48,165,232,20,159,16,250,113,248,172,66,200,192,123,223,173,167,199,103,67,8,114,117,38,111,206,205,112,127,173,149,21,24,17,45,251,183,164,63,158,208,24,135,39,232,207,26,66,143,115,162,172,32,198,176,201,71,122,8,62,175,50,160,91,200,142,24,181,103,59,10,208,0,135,178,105,56,80,47,12,95,236,151,226,240,89,133,135,151,229,61,209,135,134,101,180,224,58,221,90,79,143,207,63,40,51,119,134,16,228,234,227,119,88,82,13,216,237,64,104,191,81,248,161,248,43,240,196,159,151,72,42,48,34,90,79,87,158,226,246,111,73,127,147,8,245,199,125,167,64,213,24,192,252,109,78,208,159,53,43,183,35,141,197,24,150,159,160,127,42,39,25,71,253,186,124,32,65,2,146,143,244,16,247,232,72,168,61,88,20,155,88,63,168,35,182,144,29,49,211,247,161,137,106,207,118,20,15,168,202,172,225,7,127,190,132,96,195,6,210,112,160,94,183,23,28,230,89,184,169,244,60,223,21,76,133,231,194,209,224,128,126,105,14,47,203,123,107,72,119,195,162,15,13,203,199,104,177,115,41,199,4,97,76,160,184,217,245,152,111,68,144,255,211,252,126,80,102,238,27,55,218,86,77,39,185,14,40,64,5,182,198,239,176,164,163,136,12,28,26,176,219,129,127,215,103,57,145,120,210,43,244,31,110,147,3,247,38,59,102,144,154,131,136,63,47,145,237,88,147,41,84,96,68,180,49,7,248,12,223,168,77,30,186,207,241,166,236,223,146,254,137,184,46,70,103,23,155,84,2,112,39,236,187,72,240,113,222,47,76,201,48,128,249,219,85,231,69,99,156,160,63,107,249,199,131,211,23,104,54,193,114,15,138,121,203,55,93,228,174,80,225,92,64,255,84,78,37,152,232,246,115,136,139,174,22,239,55,22,248,64,130,4,157,39,62,188,36,31,233,33,65,120,85,153,175,215,224,139,202,176,92,51,59,182,89,237,94,209,229,85,176,126,80,71,213,25,236,255,108,33,59,98,9,70,135,218,231,233,50,200,130,142,142,112,212,158,237,40,177,249,81,144,95,86,228,130,58,49,88,58,131,9,143,167,230,110,51,31,8,193,134,13,109,166,58,181,164,225,64,189,193,134,252,5,47,41,73,23,74,78,245,175,243,118,34,50,150,17,158,138,120,190,43,152,29,217,151,32,75,201,244,120,46,174,72,192,192,1,253,210,165,102,65,106,28,94,150,247,121,57,42,79,151,150,159,93,242,241,35,229,5,25,107,77,96,126,215,245,142,209,98,231,235,182,222,95,82,142,9,194,55,233,181,122,217,70,0,104,188,33,188,208,234,49,223,136,143,86,99,48,97,249,214,34,4,158,106,154,189,166,189,7,216,193,1,191,54,110,180,173,83,9,8,21,154,78,114,29,255,41,206,165,17,134,123,183,116,225,199,15,205,217,16,146,168,190,172,42,70,17,25,56,35,118,165,128,117,102,198,216,16,1,122,96,254,174,207,114,155,201,115,202,34,241,164,87,71,150,24,239,169,57,173,253,204,94,17,69,6,238,77,118,99,137,241,206,141,38,68,220,232,65,248,100,81,121,47,249,52,30,147,65,218,177,38,83,191,214,154,235,233,198,249,179,140,161,69,11,98,14,240,25,7,105,76,161,190,81,155,60,219,54,39,132,53,153,146,150,80,254,46,46,153,185,84,38,252,222,232,158,18,113,93,140,119,22,225,52,206,46,54,169,171,73,138,17,69,230,63,3,32,129,131,187,118,145,224,227,19,246,92,91,253,89,233,73,152,62,85,241,33,6,130,108,68,97,62,212,170,206,139,198,207,169,55,126,56,65,127,214,93,38,195,110,179,137,118,124,214,238,202,196,111,214,29,89,10,177,161,225,228,30,20,243,129,121,168,75,215,105,203,19,178,14,119,171,92,161,194,185,57,198,126,1,128,254,169,156,229,153,21,36,11,54,160,54,110,81,28,142,167,22,102,134,194,113,218,62,44,222,111,44,73,185,211,148,240,129,4,9,149,230,184,177,123,73,13,163,30,46,177,27,72,62,210,67,45,89,110,251,195,246,219,233,166,145,103,81,31,169,176,204,122,206,12,116,148,97,185,102,241,6,5,222,0,0,0,0,119,7,48,150,238,14,97,44,153,9,81,186,7,109,196,25,112,106,244,143,233,99,165,53,158,100,149,163,14,219,136,50,121,220,184,164,224,213,233,30,151,210,217,136,9,182,76,43,126,177,124,189,231,184,45,7,144,191,29,145,29,183,16,100,106,176,32,242,243,185,113,72,132,190,65,222,26,218,212,125,109,221,228,235,244,212,181,81,131,211,133,199,19,108,152,86,100,107,168,192,253,98,249,122,138,101,201,236,20,1,92,79,99,6,108,217,250,15,61,99,141,8,13,245,59,110,32,200,76,105,16,94,213,96,65,228,162,103,113,114,60,3,228,209,75,4,212,71,210,13,133,253,165,10,181,107,53,181,168,250,66,178,152,108,219,187,201,214,172,188,249,64,50,216,108,227,69,223,92,117,220,214,13,207,171,209,61,89,38,217,48,172,81,222,0,58,200,215,81,128,191,208,97,22,33,180,244,181,86,179,196,35,207,186,149,153,184,189,165,15,40,2,184,158,95,5,136,8,198,12,217,178,177,11,233,36,47,111,124,135,88,104,76,17,193,97,29,171,182,102,45,61,118,220,65,144,1,219,113,6,152,210,32,188,239,213,16,42,113,177,133,137,6,182,181,31,159,191,228,165,232,184,212,51,120,7,201,162,15,0,249,52,150,9,168,142,225,14,152,24,127,106,13,187,8,109,61,45,145,100,108,151,230,99,92,1,107,107,81,244,28,108,97,98,133,101,48,216,242,98,0,78,108,6,149,237,27,1,165,123,130,8,244,193,245,15,196,87,101,176,217,198,18,183,233,80,139,190,184,234,252,185,136,124,98,221,29,223,21,218,45,73,140,211,124,243,251,212,76,101,77,178,97,88,58,181,81,206,163,188,0,116,212,187,48,226,74,223,165,65,61,216,149,215,164,209,196,109,211,214,244,251,67,105,233,106,52,110,217,252,173,103,136,70,218,96,184,208,68,4,45,115,51,3,29,229,170,10,76,95,221,13,124,201,80,5,113,60,39,2,65,170,190,11,16,16,201,12,32,134,87,104,181,37,32,111,133,179,185,102,212,9,206,97,228,159,94,222,249,14,41,217,201,152,176,208,152,34,199,215,168,180,89,179,61,23,46,180,13,129,183,189,92,59,192,186,108,173,237,184,131,32,154,191,179,182,3,182,226,12,116,177,210,154,234,213,71,57,157,210,119,175,4,219,38,21,115,220,22,131,227,99,11,18,148,100,59,132,13,109,106,62,122,106,90,168,228,14,207,11,147,9,255,157,10,0,174,39,125,7,158,177,240,15,147,68,135,8,163,210,30,1,242,104,105,6,194,254,247,98,87,93,128,101,103,203,25,108,54,113,110,107,6,231,254,212,27,118,137,211,43,224,16,218,122,90,103,221,74,204,249,185,223,111,142,190,239,249,23,183,190,67,96,176,142,213,214,214,163,232,161,209,147,126,56,216,194,196,79,223,242,82,209,187,103,241,166,188,87,103,63,181,6,221,72,178,54,75,216,13,43,218,175,10,27,76,54,3,74,246,65,4,122,96,223,96,239,195,168,103,223,85,49,110,142,239,70,105,190,121,203,97,179,140,188,102,131,26,37,111,210,160,82,104,226,54,204,12,119,149,187,11,71,3,34,2,22,185,85,5,38,47,197,186,59,190,178,189,11,40,43,180,90,146,92,179,106,4,194,215,255,167,181,208,207,49,44,217,158,139,91,222,174,29,155,100,194,176,236,99,242,38,117,106,163,156,2,109,147,10,156,9,6,169,235,14,54,63,114,7,103,133,5,0,87,19,149,191,74,130,226,184,122,20,123,177,43,174,12,182,27,56,146,210,142,155,229,213,190,13,124,220,239,183,11,219,223,33,134,211,210,212,241,212,226,66,104,221,179,248,31,218,131,110,129,190,22,205,246,185,38,91,111,176,119,225,24,183,71,119,136,8,90,230,255,15,106,112,102,6,59,202,17,1,11,92,143,101,158,255,248,98,174,105,97,107,255,211,22,108,207,69,160,10,226,120,215,13,210,238,78,4,131,84,57,3,179,194,167,103,38,97,208,96,22,247,73,105,71,77,62,110,119,219,174,209,106,74,217,214,90,220,64,223,11,102,55,216,59,240,169,188,174,83,222,187,158,197,71,178,207,127,48,181,255,233,189,189,242,28,202,186,194,138,83,179,147,48,36,180,163,166,186,208,54,5,205,215,6,147,84,222,87,41,35,217,103,191,179,102,122,46,196,97,74,184,93,104,27,2,42,111,43,148,180,11,190,55,195,12,142,161,90,5,223,27,45,2,239,141,0,0,0,0,25,27,49,65,50,54,98,130,43,45,83,195,100,108,197,4,125,119,244,69,86,90,167,134,79,65,150,199,200,217,138,8,209,194,187,73,250,239,232,138,227,244,217,203,172,181,79,12,181,174,126,77,158,131,45,142,135,152,28,207,74,194,18,81,83,217,35,16,120,244,112,211,97,239,65,146,46,174,215,85,55,181,230,20,28,152,181,215,5,131,132,150,130,27,152,89,155,0,169,24,176,45,250,219,169,54,203,154,230,119,93,93,255,108,108,28,212,65,63,223,205,90,14,158,149,132,36,162,140,159,21,227,167,178,70,32,190,169,119,97,241,232,225,166,232,243,208,231,195,222,131,36,218,197,178,101,93,93,174,170,68,70,159,235,111,107,204,40,118,112,253,105,57,49,107,174,32,42,90,239,11,7,9,44,18,28,56,109,223,70,54,243,198,93,7,178,237,112,84,113,244,107,101,48,187,42,243,247,162,49,194,182,137,28,145,117,144,7,160,52,23,159,188,251,14,132,141,186,37,169,222,121,60,178,239,56,115,243,121,255,106,232,72,190,65,197,27,125,88,222,42,60,240,121,79,5,233,98,126,68,194,79,45,135,219,84,28,198,148,21,138,1,141,14,187,64,166,35,232,131,191,56,217,194,56,160,197,13,33,187,244,76,10,150,167,143,19,141,150,206,92,204,0,9,69,215,49,72,110,250,98,139,119,225,83,202,186,187,93,84,163,160,108,21,136,141,63,214,145,150,14,151,222,215,152,80,199,204,169,17,236,225,250,210,245,250,203,147,114,98,215,92,107,121,230,29,64,84,181,222,89,79,132,159,22,14,18,88,15,21,35,25,36,56,112,218,61,35,65,155,101,253,107,167,124,230,90,230,87,203,9,37,78,208,56,100,1,145,174,163,24,138,159,226,51,167,204,33,42,188,253,96,173,36,225,175,180,63,208,238,159,18,131,45,134,9,178,108,201,72,36,171,208,83,21,234,251,126,70,41,226,101,119,104,47,63,121,246,54,36,72,183,29,9,27,116,4,18,42,53,75,83,188,242,82,72,141,179,121,101,222,112,96,126,239,49,231,230,243,254,254,253,194,191,213,208,145,124,204,203,160,61,131,138,54,250,154,145,7,187,177,188,84,120,168,167,101,57,59,131,152,75,34,152,169,10,9,181,250,201,16,174,203,136,95,239,93,79,70,244,108,14,109,217,63,205,116,194,14,140,243,90,18,67,234,65,35,2,193,108,112,193,216,119,65,128,151,54,215,71,142,45,230,6,165,0,181,197,188,27,132,132,113,65,138,26,104,90,187,91,67,119,232,152,90,108,217,217,21,45,79,30,12,54,126,95,39,27,45,156,62,0,28,221,185,152,0,18,160,131,49,83,139,174,98,144,146,181,83,209,221,244,197,22,196,239,244,87,239,194,167,148,246,217,150,213,174,7,188,233,183,28,141,168,156,49,222,107,133,42,239,42,202,107,121,237,211,112,72,172,248,93,27,111,225,70,42,46,102,222,54,225,127,197,7,160,84,232,84,99,77,243,101,34,2,178,243,229,27,169,194,164,48,132,145,103,41,159,160,38,228,197,174,184,253,222,159,249,214,243,204,58,207,232,253,123,128,169,107,188,153,178,90,253,178,159,9,62,171,132,56,127,44,28,36,176,53,7,21,241,30,42,70,50,7,49,119,115,72,112,225,180,81,107,208,245,122,70,131,54,99,93,178,119,203,250,215,78,210,225,230,15,249,204,181,204,224,215,132,141,175,150,18,74,182,141,35,11,157,160,112,200,132,187,65,137,3,35,93,70,26,56,108,7,49,21,63,196,40,14,14,133,103,79,152,66,126,84,169,3,85,121,250,192,76,98,203,129,129,56,197,31,152,35,244,94,179,14,167,157,170,21,150,220,229,84,0,27,252,79,49,90,215,98,98,153,206,121,83,216,73,225,79,23,80,250,126,86,123,215,45,149,98,204,28,212,45,141,138,19,52,150,187,82,31,187,232,145,6,160,217,208,94,126,243,236,71,101,194,173,108,72,145,110,117,83,160,47,58,18,54,232,35,9,7,169,8,36,84,106,17,63,101,43,150,167,121,228,143,188,72,165,164,145,27,102,189,138,42,39,242,203,188,224,235,208,141,161,192,253,222,98,217,230,239,35,20,188,225,189,13,167,208,252,38,138,131,63,63,145,178,126,112,208,36,185,105,203,21,248,66,230,70,59,91,253,119,122,220,101,107,181,197,126,90,244,238,83,9,55,247,72,56,118,184,9,174,177,161,18,159,240,138,63,204,51,147,36,253,114,0,0,0,0,1,194,106,55,3,132,212,110,2,70,190,89,7,9,168,220,6,203,194,235,4,141,124,178,5,79,22,133,14,19,81,184,15,209,59,143,13,151,133,214,12,85,239,225,9,26,249,100,8,216,147,83,10,158,45,10,11,92,71,61,28,38,163,112,29,228,201,71,31,162,119,30,30,96,29,41,27,47,11,172,26,237,97,155,24,171,223,194,25,105,181,245,18,53,242,200,19,247,152,255,17,177,38,166,16,115,76,145,21,60,90,20,20,254,48,35,22,184,142,122,23,122,228,77,56,77,70,224,57,143,44,215,59,201,146,142,58,11,248,185,63,68,238,60,62,134,132,11,60,192,58,82,61,2,80,101,54,94,23,88,55,156,125,111,53,218,195,54,52,24,169,1,49,87,191,132,48,149,213,179,50,211,107,234,51,17,1,221,36,107,229,144,37,169,143,167,39,239,49,254,38,45,91,201,35,98,77,76,34,160,39,123,32,230,153,34,33,36,243,21,42,120,180,40,43,186,222,31,41,252,96,70,40,62,10,113,45,113,28,244,44,179,118,195,46,245,200,154,47,55,162,173,112,154,141,192,113,88,231,247,115,30,89,174,114,220,51,153,119,147,37,28,118,81,79,43,116,23,241,114,117,213,155,69,126,137,220,120,127,75,182,79,125,13,8,22,124,207,98,33,121,128,116,164,120,66,30,147,122,4,160,202,123,198,202,253,108,188,46,176,109,126,68,135,111,56,250,222,110,250,144,233,107,181,134,108,106,119,236,91,104,49,82,2,105,243,56,53,98,175,127,8,99,109,21,63,97,43,171,102,96,233,193,81,101,166,215,212,100,100,189,227,102,34,3,186,103,224,105,141,72,215,203,32,73,21,161,23,75,83,31,78,74,145,117,121,79,222,99,252,78,28,9,203,76,90,183,146,77,152,221,165,70,196,154,152,71,6,240,175,69,64,78,246,68,130,36,193,65,205,50,68,64,15,88,115,66,73,230,42,67,139,140,29,84,241,104,80,85,51,2,103,87,117,188,62,86,183,214,9,83,248,192,140,82,58,170,187,80,124,20,226,81,190,126,213,90,226,57,232,91,32,83,223,89,102,237,134,88,164,135,177,93,235,145,52,92,41,251,3,94,111,69,90,95,173,47,109,225,53,27,128,224,247,113,183,226,177,207,238,227,115,165,217,230,60,179,92,231,254,217,107,229,184,103,50,228,122,13,5,239,38,74,56,238,228,32,15,236,162,158,86,237,96,244,97,232,47,226,228,233,237,136,211,235,171,54,138,234,105,92,189,253,19,184,240,252,209,210,199,254,151,108,158,255,85,6,169,250,26,16,44,251,216,122,27,249,158,196,66,248,92,174,117,243,0,233,72,242,194,131,127,240,132,61,38,241,70,87,17,244,9,65,148,245,203,43,163,247,141,149,250,246,79,255,205,217,120,93,96,216,186,55,87,218,252,137,14,219,62,227,57,222,113,245,188,223,179,159,139,221,245,33,210,220,55,75,229,215,107,12,216,214,169,102,239,212,239,216,182,213,45,178,129,208,98,164,4,209,160,206,51,211,230,112,106,210,36,26,93,197,94,254,16,196,156,148,39,198,218,42,126,199,24,64,73,194,87,86,204,195,149,60,251,193,211,130,162,192,17,232,149,203,77,175,168,202,143,197,159,200,201,123,198,201,11,17,241,204,68,7,116,205,134,109,67,207,192,211,26,206,2,185,45,145,175,150,64,144,109,252,119,146,43,66,46,147,233,40,25,150,166,62,156,151,100,84,171,149,34,234,242,148,224,128,197,159,188,199,248,158,126,173,207,156,56,19,150,157,250,121,161,152,181,111,36,153,119,5,19,155,49,187,74,154,243,209,125,141,137,53,48,140,75,95,7,142,13,225,94,143,207,139,105,138,128,157,236,139,66,247,219,137,4,73,130,136,198,35,181,131,154,100,136,130,88,14,191,128,30,176,230,129,220,218,209,132,147,204,84,133,81,166,99,135,23,24,58,134,213,114,13,169,226,208,160,168,32,186,151,170,102,4,206,171,164,110,249,174,235,120,124,175,41,18,75,173,111,172,18,172,173,198,37,167,241,129,24,166,51,235,47,164,117,85,118,165,183,63,65,160,248,41,196,161,58,67,243,163,124,253,170,162,190,151,157,181,196,115,208,180,6,25,231,182,64,167,190,183,130,205,137,178,205,219,12,179,15,177,59,177,73,15,98,176,139,101,85,187,215,34,104,186,21,72,95,184,83,246,6,185,145,156,49,188,222,138,180,189,28,224,131,191,90,94,218,190,152,52,237,0,0,0,0,184,188,103,101,170,9,200,139,18,181,175,238,143,98,151,87,55,222,240,50,37,107,95,220,157,215,56,185,197,180,40,239,125,8,79,138,111,189,224,100,215,1,135,1,74,214,191,184,242,106,216,221,224,223,119,51,88,99,16,86,80,25,87,159,232,165,48,250,250,16,159,20,66,172,248,113,223,123,192,200,103,199,167,173,117,114,8,67,205,206,111,38,149,173,127,112,45,17,24,21,63,164,183,251,135,24,208,158,26,207,232,39,162,115,143,66,176,198,32,172,8,122,71,201,160,50,175,62,24,142,200,91,10,59,103,181,178,135,0,208,47,80,56,105,151,236,95,12,133,89,240,226,61,229,151,135,101,134,135,209,221,58,224,180,207,143,79,90,119,51,40,63,234,228,16,134,82,88,119,227,64,237,216,13,248,81,191,104,240,43,248,161,72,151,159,196,90,34,48,42,226,158,87,79,127,73,111,246,199,245,8,147,213,64,167,125,109,252,192,24,53,159,208,78,141,35,183,43,159,150,24,197,39,42,127,160,186,253,71,25,2,65,32,124,16,244,143,146,168,72,232,247,155,20,88,61,35,168,63,88,49,29,144,182,137,161,247,211,20,118,207,106,172,202,168,15,190,127,7,225,6,195,96,132,94,160,112,210,230,28,23,183,244,169,184,89,76,21,223,60,209,194,231,133,105,126,128,224,123,203,47,14,195,119,72,107,203,13,15,162,115,177,104,199,97,4,199,41,217,184,160,76,68,111,152,245,252,211,255,144,238,102,80,126,86,218,55,27,14,185,39,77,182,5,64,40,164,176,239,198,28,12,136,163,129,219,176,26,57,103,215,127,43,210,120,145,147,110,31,244,59,38,247,3,131,154,144,102,145,47,63,136,41,147,88,237,180,68,96,84,12,248,7,49,30,77,168,223,166,241,207,186,254,146,223,236,70,46,184,137,84,155,23,103,236,39,112,2,113,240,72,187,201,76,47,222,219,249,128,48,99,69,231,85], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+10336); +/* memory initializer */ allocate([107,63,160,156,211,131,199,249,193,54,104,23,121,138,15,114,228,93,55,203,92,225,80,174,78,84,255,64,246,232,152,37,174,139,136,115,22,55,239,22,4,130,64,248,188,62,39,157,33,233,31,36,153,85,120,65,139,224,215,175,51,92,176,202,237,89,182,59,85,229,209,94,71,80,126,176,255,236,25,213,98,59,33,108,218,135,70,9,200,50,233,231,112,142,142,130,40,237,158,212,144,81,249,177,130,228,86,95,58,88,49,58,167,143,9,131,31,51,110,230,13,134,193,8,181,58,166,109,189,64,225,164,5,252,134,193,23,73,41,47,175,245,78,74,50,34,118,243,138,158,17,150,152,43,190,120,32,151,217,29,120,244,201,75,192,72,174,46,210,253,1,192,106,65,102,165,247,150,94,28,79,42,57,121,93,159,150,151,229,35,241,242,77,107,25,5,245,215,126,96,231,98,209,142,95,222,182,235,194,9,142,82,122,181,233,55,104,0,70,217,208,188,33,188,136,223,49,234,48,99,86,143,34,214,249,97,154,106,158,4,7,189,166,189,191,1,193,216,173,180,110,54,21,8,9,83,29,114,78,154,165,206,41,255,183,123,134,17,15,199,225,116,146,16,217,205,42,172,190,168,56,25,17,70,128,165,118,35,216,198,102,117,96,122,1,16,114,207,174,254,202,115,201,155,87,164,241,34,239,24,150,71,253,173,57,169,69,17,94,204,118,77,238,6,206,241,137,99,220,68,38,141,100,248,65,232,249,47,121,81,65,147,30,52,83,38,177,218,235,154,214,191,179,249,198,233,11,69,161,140,25,240,14,98,161,76,105,7,60,155,81,190,132,39,54,219,150,146,153,53,46,46,254,80,38,84,185,153,158,232,222,252,140,93,113,18,52,225,22,119,169,54,46,206,17,138,73,171,3,63,230,69,187,131,129,32,227,224,145,118,91,92,246,19,73,233,89,253,241,85,62,152,108,130,6,33,212,62,97,68,198,139,206,170,126,55,169,207,214,127,65,56,110,195,38,93,124,118,137,179,196,202,238,214,89,29,214,111,225,161,177,10,243,20,30,228,75,168,121,129,19,203,105,215,171,119,14,178,185,194,161,92,1,126,198,57,156,169,254,128,36,21,153,229,54,160,54,11,142,28,81,110,134,102,22,167,62,218,113,194,44,111,222,44,148,211,185,73,9,4,129,240,177,184,230,149,163,13,73,123,27,177,46,30,67,210,62,72,251,110,89,45,233,219,246,195,81,103,145,166,204,176,169,31,116,12,206,122,102,185,97,148,222,5,6,241,0,0,0,0,0,0,0,0,1,0,0,0,4,0,4,0,8,0,4,0,2,0,0,0,4,0,5,0,16,0,8,0,2,0,0,0,4,0,6,0,32,0,32,0,2,0,0,0,4,0,4,0,16,0,16,0,3,0,0,0,8,0,16,0,32,0,32,0,3,0,0,0,8,0,16,0,128,0,128,0,3,0,0,0,8,0,32,0,128,0,0,1,3,0,0,0,32,0,128,0,2,1,0,4,3,0,0,0,32,0,2,1,2,1,0,16,3,0,0,0,111,117,116,32,111,102,32,109,101,109,111,114,121,0,0,0,58,32,0,0,0,0,0,0,114,101,113,117,101,115,116,101,100,32,108,101,110,103,116,104,32,100,111,101,115,32,110,111,116,32,102,105,116,32,105,110,32,105,110,116,0,0,0,0,111,117,116,32,111,102,32,109,101,109,111,114,121,0,0,0,49,46,50,46,53,0,0,0,117,110,107,110,111,119,110,32,99,111,109,112,114,101,115,115,105,111,110,32,109,101,116,104,111,100,0,0,0,0,0,0,117,110,107,110,111,119,110,32,104,101,97,100,101,114,32,102,108,97,103,115,32,115,101,116,0,0,0,0,0,0,0,0,117,110,101,120,112,101,99,116,101,100,32,101,110,100,32,111,102,32,102,105,108,101,0,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,58,32,105,110,102,108,97,116,101,32,115,116,114,101,97,109,32,99,111,114,114,117,112,116,0,0,99,111,109,112,114,101,115,115,101,100,32,100,97,116,97,32,101,114,114,111,114,0,0,0,105,110,99,111,114,114,101,99,116,32,100,97,116,97,32,99,104,101,99,107,0,0,0,0,105,110,99,111,114,114,101,99,116,32,108,101,110,103,116,104,32,99,104,101,99,107,0,0,114,101,113,117,101,115,116,101,100,32,108,101,110,103,116,104,32,100,111,101,115,32,110,111,116,32,102,105,116,32,105,110,32,105,110,116,0,0,0,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,58,32,100,101,102,108,97,116,101,32,115,116,114,101,97,109,32,99,111,114,114,117,112,116,0,0,111,117,116,32,111,102,32,109,101,109,111,114,121,0,0,0,49,46,50,46,53,0,0,0,105,110,118,97,108,105,100,32,100,105,115,116,97,110,99,101,32,116,111,111,32,102,97,114,32,98,97,99,107,0,0,0,105,110,118,97,108,105,100,32,100,105,115,116,97,110,99,101,32,99,111,100,101,0,0,0,105,110,118,97,108,105,100,32,108,105,116,101,114,97,108,47,108,101,110,103,116,104,32,99,111,100,101,0,0,0,0,0,16,0,17,0,18,0,0,0,8,0,7,0,9,0,6,0,10,0,5,0,11,0,4,0,12,0,3,0,13,0,2,0,14,0,1,0,15,0,0,0,105,110,99,111,114,114,101,99,116,32,104,101,97,100,101,114,32,99,104,101,99,107,0,0,117,110,107,110,111,119,110,32,99,111,109,112,114,101,115,115,105,111,110,32,109,101,116,104,111,100,0,0,0,0,0,0,105,110,118,97,108,105,100,32,119,105,110,100,111,119,32,115,105,122,101,0,0,0,0,0,117,110,107,110,111,119,110,32,104,101,97,100,101,114,32,102,108,97,103,115,32,115,101,116,0,0,0,0,0,0,0,0,104,101,97,100,101,114,32,99,114,99,32,109,105,115,109,97,116,99,104,0,0,0,0,0,105,110,118,97,108,105,100,32,98,108,111,99,107,32,116,121,112,101,0,0,0,0,0,0,105,110,118,97,108,105,100,32,115,116,111,114,101,100,32,98,108,111,99,107,32,108,101,110,103,116,104,115,0,0,0,0,116,111,111,32,109,97,110,121,32,108,101,110,103,116,104,32,111,114,32,100,105,115,116,97,110,99,101,32,115,121,109,98,111,108,115,0,0,0,0,0,105,110,118,97,108,105,100,32,99,111,100,101,32,108,101,110,103,116,104,115,32,115,101,116,0,0,0,0,0,0,0,0,105,110,118,97,108,105,100,32,98,105,116,32,108,101,110,103,116,104,32,114,101,112,101,97,116,0,0,0,0,0,0,0,105,110,118,97,108,105,100,32,99,111,100,101,32,45,45,32,109,105,115,115,105,110,103,32,101,110,100,45,111,102,45,98,108,111,99,107,0,0,0,0,105,110,118,97,108,105,100,32,108,105,116,101,114,97,108,47,108,101,110,103,116,104,115,32,115,101,116,0,0,0,0,0,105,110,118,97,108,105,100,32,100,105,115,116,97,110,99,101,115,32,115,101,116,0,0,0,105,110,118,97,108,105,100,32,108,105,116,101,114,97,108,47,108,101,110,103,116,104,32,99,111,100,101,0,0,0,0,0,105,110,118,97,108,105,100,32,100,105,115,116,97,110,99,101,32,99,111,100,101,0,0,0,105,110,118,97,108,105,100,32,100,105,115,116,97,110,99,101,32,116,111,111,32,102,97,114,32,98,97,99,107,0,0,0,105,110,99,111,114,114,101,99,116,32,100,97,116,97,32,99,104,101,99,107,0,0,0,0,105,110,99,111,114,114,101,99,116,32,108,101,110,103,116,104,32,99,104,101,99,107,0,0,96,7,0,0,0,8,80,0,0,8,16,0,20,8,115,0,18,7,31,0,0,8,112,0,0,8,48,0,0,9,192,0,16,7,10,0,0,8,96,0,0,8,32,0,0,9,160,0,0,8,0,0,0,8,128,0,0,8,64,0,0,9,224,0,16,7,6,0,0,8,88,0,0,8,24,0,0,9,144,0,19,7,59,0,0,8,120,0,0,8,56,0,0,9,208,0,17,7,17,0,0,8,104,0,0,8,40,0,0,9,176,0,0,8,8,0,0,8,136,0,0,8,72,0,0,9,240,0,16,7,4,0,0,8,84,0,0,8,20,0,21,8,227,0,19,7,43,0,0,8,116,0,0,8,52,0,0,9,200,0,17,7,13,0,0,8,100,0,0,8,36,0,0,9,168,0,0,8,4,0,0,8,132,0,0,8,68,0,0,9,232,0,16,7,8,0,0,8,92,0,0,8,28,0,0,9,152,0,20,7,83,0,0,8,124,0,0,8,60,0,0,9,216,0,18,7,23,0,0,8,108,0,0,8,44,0,0,9,184,0,0,8,12,0,0,8,140,0,0,8,76,0,0,9,248,0,16,7,3,0,0,8,82,0,0,8,18,0,21,8,163,0,19,7,35,0,0,8,114,0,0,8,50,0,0,9,196,0,17,7,11,0,0,8,98,0,0,8,34,0,0,9,164,0,0,8,2,0,0,8,130,0,0,8,66,0,0,9,228,0,16,7,7,0,0,8,90,0,0,8,26,0,0,9,148,0,20,7,67,0,0,8,122,0,0,8,58,0,0,9,212,0,18,7,19,0,0,8,106,0,0,8,42,0,0,9,180,0,0,8,10,0,0,8,138,0,0,8,74,0,0,9,244,0,16,7,5,0,0,8,86,0,0,8,22,0,64,8,0,0,19,7,51,0,0,8,118,0,0,8,54,0,0,9,204,0,17,7,15,0,0,8,102,0,0,8,38,0,0,9,172,0,0,8,6,0,0,8,134,0,0,8,70,0,0,9,236,0,16,7,9,0,0,8,94,0,0,8,30,0,0,9,156,0,20,7,99,0,0,8,126,0,0,8,62,0,0,9,220,0,18,7,27,0,0,8,110,0,0,8,46,0,0,9,188,0,0,8,14,0,0,8,142,0,0,8,78,0,0,9,252,0,96,7,0,0,0,8,81,0,0,8,17,0,21,8,131,0,18,7,31,0,0,8,113,0,0,8,49,0,0,9,194,0,16,7,10,0,0,8,97,0,0,8,33,0,0,9,162,0,0,8,1,0,0,8,129,0,0,8,65,0,0,9,226,0,16,7,6,0,0,8,89,0,0,8,25,0,0,9,146,0,19,7,59,0,0,8,121,0,0,8,57,0,0,9,210,0,17,7,17,0,0,8,105,0,0,8,41,0,0,9,178,0,0,8,9,0,0,8,137,0,0,8,73,0,0,9,242,0,16,7,4,0,0,8,85,0,0,8,21,0,16,8,2,1,19,7,43,0,0,8,117,0,0,8,53,0,0,9,202,0,17,7,13,0,0,8,101,0,0,8,37,0,0,9,170,0,0,8,5,0,0,8,133,0,0,8,69,0,0,9,234,0,16,7,8,0,0,8,93,0,0,8,29,0,0,9,154,0,20,7,83,0,0,8,125,0,0,8,61,0,0,9,218,0,18,7,23,0,0,8,109,0,0,8,45,0,0,9,186,0,0,8,13,0,0,8,141,0,0,8,77,0,0,9,250,0,16,7,3,0,0,8,83,0,0,8,19,0,21,8,195,0,19,7,35,0,0,8,115,0,0,8,51,0,0,9,198,0,17,7,11,0,0,8,99,0,0,8,35,0,0,9,166,0,0,8,3,0,0,8,131,0,0,8,67,0,0,9,230,0,16,7,7,0,0,8,91,0,0,8,27,0,0,9,150,0,20,7,67,0,0,8,123,0,0,8,59,0,0,9,214,0,18,7,19,0,0,8,107,0,0,8,43,0,0,9,182,0,0,8,11,0,0,8,139,0,0,8,75,0,0,9,246,0,16,7,5,0,0,8,87,0,0,8,23,0,64,8,0,0,19,7,51,0,0,8,119,0,0,8,55,0,0,9,206,0,17,7,15,0,0,8,103,0,0,8,39,0,0,9,174,0,0,8,7,0,0,8,135,0,0,8,71,0,0,9,238,0,16,7,9,0,0,8,95,0,0,8,31,0,0,9,158,0,20,7,99,0,0,8,127,0,0,8,63,0,0,9,222,0,18,7,27,0,0,8,111,0,0,8,47,0,0,9,190,0,0,8,15,0,0,8,143,0,0,8,79,0,0,9,254,0,96,7,0,0,0,8,80,0,0,8,16,0,20,8,115,0,18,7,31,0,0,8,112,0,0,8,48,0,0,9,193,0,16,7,10,0,0,8,96,0,0,8,32,0,0,9,161,0,0,8,0,0,0,8,128,0,0,8,64,0,0,9,225,0,16,7,6,0,0,8,88,0,0,8,24,0,0,9,145,0,19,7,59,0,0,8,120,0,0,8,56,0,0,9,209,0,17,7,17,0,0,8,104,0,0,8,40,0,0,9,177,0,0,8,8,0,0,8,136,0,0,8,72,0,0,9,241,0,16,7,4,0,0,8,84,0,0,8,20,0,21,8,227,0,19,7,43,0,0,8,116,0,0,8,52,0,0,9,201,0,17,7,13,0,0,8,100,0,0,8,36,0,0,9,169,0,0,8,4,0,0,8,132,0,0,8,68,0,0,9,233,0,16,7,8,0,0,8,92,0,0,8,28,0,0,9,153,0,20,7,83,0,0,8,124,0,0,8,60,0,0,9,217,0,18,7,23,0,0,8,108,0,0,8,44,0,0,9,185,0,0,8,12,0,0,8,140,0,0,8,76,0,0,9,249,0,16,7,3,0,0,8,82,0,0,8,18,0,21,8,163,0,19,7,35,0,0,8,114,0,0,8,50,0,0,9,197,0,17,7,11,0,0,8,98,0,0,8,34,0,0,9,165,0,0,8,2,0,0,8,130,0,0,8,66,0,0,9,229,0,16,7,7,0,0,8,90,0,0,8,26,0,0,9,149,0,20,7,67,0,0,8,122,0,0,8,58,0,0,9,213,0,18,7,19,0,0,8,106,0,0,8,42,0,0,9,181,0,0,8,10,0,0,8,138,0,0,8,74,0,0,9,245,0,16,7,5,0,0,8,86,0,0,8,22,0,64,8,0,0,19,7,51,0,0,8,118,0,0,8,54,0,0,9,205,0,17,7,15,0,0,8,102,0,0,8,38,0,0,9,173,0,0,8,6,0,0,8,134,0,0,8,70,0,0,9,237,0,16,7,9,0,0,8,94,0,0,8,30,0,0,9,157,0,20,7,99,0,0,8,126,0,0,8,62,0,0,9,221,0,18,7,27,0,0,8,110,0,0,8,46,0,0,9,189,0,0,8,14,0,0,8,142,0,0,8,78,0,0,9,253,0,96,7,0,0,0,8,81,0,0,8,17,0,21,8,131,0,18,7,31,0,0,8,113,0,0,8,49,0,0,9,195,0,16,7,10,0,0,8,97,0,0,8,33,0,0,9,163,0,0,8,1,0,0,8,129,0,0,8,65,0,0,9,227,0,16,7,6,0,0,8,89,0,0,8,25,0,0,9,147,0,19,7,59,0,0,8,121,0,0,8,57,0,0,9,211,0,17,7,17,0,0,8,105,0,0,8,41,0,0,9,179,0,0,8,9,0,0,8,137,0,0,8,73,0,0,9,243,0,16,7,4,0,0,8,85,0,0,8,21,0,16,8,2,1,19,7,43,0,0,8,117,0,0,8,53,0,0,9,203,0,17,7,13,0,0,8,101,0,0,8,37,0,0,9,171,0,0,8,5,0,0,8,133,0,0,8,69,0,0,9,235,0,16,7,8,0,0,8,93,0,0,8,29,0,0,9,155,0,20,7,83,0,0,8,125,0,0,8,61,0,0,9,219,0,18,7,23,0,0,8,109,0,0,8,45,0,0,9,187,0,0,8,13,0,0,8,141,0,0,8,77,0,0,9,251,0,16,7,3,0,0,8,83,0,0,8,19,0,21,8,195,0,19,7,35,0,0,8,115,0,0,8,51,0,0,9,199,0,17,7,11,0,0,8,99,0,0,8,35,0,0,9,167,0,0,8,3,0,0,8,131,0,0,8,67,0,0,9,231,0,16,7,7,0,0,8,91,0,0,8,27,0,0,9,151,0,20,7,67,0,0,8,123,0,0,8,59,0,0,9,215,0,18,7,19,0,0,8,107,0,0,8,43,0,0,9,183,0,0,8,11,0,0,8,139,0,0,8,75,0,0,9,247,0,16,7,5,0,0,8,87,0,0,8,23,0,64,8,0,0,19,7,51,0,0,8,119,0,0,8,55,0,0,9,207,0,17,7,15,0,0,8,103,0,0,8,39,0,0,9,175,0,0,8,7,0,0,8,135,0,0,8,71,0,0,9,239,0,16,7,9,0,0,8,95,0,0,8,31,0,0,9,159,0,20,7,99,0,0,8,127,0,0,8,63,0,0,9,223,0,18,7,27,0,0,8,111,0,0,8,47,0,0,9,191,0,0,8,15,0,0,8,143,0,0,8,79,0,0,9,255,0,16,5,1,0,23,5,1,1,19,5,17,0,27,5,1,16,17,5,5,0,25,5,1,4,21,5,65,0,29,5,1,64,16,5,3,0,24,5,1,2,20,5,33,0,28,5,1,32,18,5,9,0,26,5,1,8,22,5,129,0,64,5,0,0,16,5,2,0,23,5,129,1,19,5,25,0,27,5,1,24,17,5,7,0,25,5,1,6,21,5,97,0,29,5,1,96,16,5,4,0,24,5,1,3,20,5,49,0,28,5,1,48,18,5,13,0,26,5,1,12,22,5,193,0,64,5,0,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,13,0,15,0,17,0,19,0,23,0,27,0,31,0,35,0,43,0,51,0,59,0,67,0,83,0,99,0,115,0,131,0,163,0,195,0,227,0,2,1,0,0,0,0,0,0,16,0,16,0,16,0,16,0,16,0,16,0,16,0,16,0,17,0,17,0,17,0,17,0,18,0,18,0,18,0,18,0,19,0,19,0,19,0,19,0,20,0,20,0,20,0,20,0,21,0,21,0,21,0,21,0,16,0,73,0,195,0,0,0,1,0,2,0,3,0,4,0,5,0,7,0,9,0,13,0,17,0,25,0,33,0,49,0,65,0,97,0,129,0,193,0,1,1,129,1,1,2,1,3,1,4,1,6,1,8,1,12,1,16,1,24,1,32,1,48,1,64,1,96,0,0,0,0,16,0,16,0,16,0,16,0,17,0,17,0,18,0,18,0,19,0,19,0,20,0,20,0,21,0,21,0,22,0,22,0,23,0,23,0,24,0,24,0,25,0,25,0,26,0,26,0,27,0,27,0,28,0,28,0,29,0,29,0,64,0,64,0,0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,0,100,0,0,248,104,0,0,1,1,0,0,30,1,0,0,15,0,0,0,0,0,0,0,128,104,0,0,232,105,0,0,0,0,0,0,30,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,240,106,0,0,0,0,0,0,19,0,0,0,7,0,0,0,0,0,0,0,12,0,8,0,140,0,8,0,76,0,8,0,204,0,8,0,44,0,8,0,172,0,8,0,108,0,8,0,236,0,8,0,28,0,8,0,156,0,8,0,92,0,8,0,220,0,8,0,60,0,8,0,188,0,8,0,124,0,8,0,252,0,8,0,2,0,8,0,130,0,8,0,66,0,8,0,194,0,8,0,34,0,8,0,162,0,8,0,98,0,8,0,226,0,8,0,18,0,8,0,146,0,8,0,82,0,8,0,210,0,8,0,50,0,8,0,178,0,8,0,114,0,8,0,242,0,8,0,10,0,8,0,138,0,8,0,74,0,8,0,202,0,8,0,42,0,8,0,170,0,8,0,106,0,8,0,234,0,8,0,26,0,8,0,154,0,8,0,90,0,8,0,218,0,8,0,58,0,8,0,186,0,8,0,122,0,8,0,250,0,8,0,6,0,8,0,134,0,8,0,70,0,8,0,198,0,8,0,38,0,8,0,166,0,8,0,102,0,8,0,230,0,8,0,22,0,8,0,150,0,8,0,86,0,8,0,214,0,8,0,54,0,8,0,182,0,8,0,118,0,8,0,246,0,8,0,14,0,8,0,142,0,8,0,78,0,8,0,206,0,8,0,46,0,8,0,174,0,8,0,110,0,8,0,238,0,8,0,30,0,8,0,158,0,8,0,94,0,8,0,222,0,8,0,62,0,8,0,190,0,8,0,126,0,8,0,254,0,8,0,1,0,8,0,129,0,8,0,65,0,8,0,193,0,8,0,33,0,8,0,161,0,8,0,97,0,8,0,225,0,8,0,17,0,8,0,145,0,8,0,81,0,8,0,209,0,8,0,49,0,8,0,177,0,8,0,113,0,8,0,241,0,8,0,9,0,8,0,137,0,8,0,73,0,8,0,201,0,8,0,41,0,8,0,169,0,8,0,105,0,8,0,233,0,8,0,25,0,8,0,153,0,8,0,89,0,8,0,217,0,8,0,57,0,8,0,185,0,8,0,121,0,8,0,249,0,8,0,5,0,8,0,133,0,8,0,69,0,8,0,197,0,8,0,37,0,8,0,165,0,8,0,101,0,8,0,229,0,8,0,21,0,8,0,149,0,8,0,85,0,8,0,213,0,8,0,53,0,8,0,181,0,8,0,117,0,8,0,245,0,8,0,13,0,8,0,141,0,8,0,77,0,8,0,205,0,8,0,45,0,8,0,173,0,8,0,109,0,8,0,237,0,8,0,29,0,8,0,157,0,8,0,93,0,8,0,221,0,8,0,61,0,8,0,189,0,8,0,125,0,8,0,253,0,8,0,19,0,9,0,19,1,9,0,147,0,9,0,147,1,9,0,83,0,9,0,83,1,9,0,211,0,9,0,211,1,9,0,51,0,9,0,51,1,9,0,179,0,9,0,179,1,9,0,115,0,9,0,115,1,9,0,243,0,9,0,243,1,9,0,11,0,9,0,11,1,9,0,139,0,9,0,139,1,9,0,75,0,9,0,75,1,9,0,203,0,9,0,203,1,9,0,43,0,9,0,43,1,9,0,171,0,9,0,171,1,9,0,107,0,9,0,107,1,9,0,235,0,9,0,235,1,9,0,27,0,9,0,27,1,9,0,155,0,9,0,155,1,9,0,91,0,9,0,91,1,9,0,219,0,9,0,219,1,9,0,59,0,9,0,59,1,9,0,187,0,9,0,187,1,9,0,123,0,9,0,123,1,9,0,251,0,9,0,251,1,9,0,7,0,9,0,7,1,9,0,135,0,9,0,135,1,9,0,71,0,9,0,71,1,9,0,199,0,9,0,199,1,9,0,39,0,9,0,39,1,9,0,167,0,9,0,167,1,9,0,103,0,9,0,103,1,9,0,231,0,9,0,231,1,9,0,23,0,9,0,23,1,9,0,151,0,9,0,151,1,9,0,87,0,9,0,87,1,9,0,215,0,9,0,215,1,9,0,55,0,9,0,55,1,9,0,183,0,9,0,183,1,9,0,119,0,9,0,119,1,9,0,247,0,9,0,247,1,9,0,15,0,9,0,15,1,9,0,143,0,9,0,143,1,9,0,79,0,9,0,79,1,9,0,207,0,9,0,207,1,9,0,47,0,9,0,47,1,9,0,175,0,9,0,175,1,9,0,111,0,9,0,111,1,9,0,239,0,9,0,239,1,9,0,31,0,9,0,31,1,9,0,159,0,9,0,159,1,9,0,95,0,9,0,95,1,9,0,223,0,9,0,223,1,9,0,63,0,9,0,63,1,9,0,191,0,9,0,191,1,9,0,127,0,9,0,127,1,9,0,255,0,9,0,255,1,9,0,0,0,7,0,64,0,7,0,32,0,7,0,96,0,7,0,16,0,7,0,80,0,7,0,48,0,7,0,112,0,7,0,8,0,7,0,72,0,7,0,40,0,7,0,104,0,7,0,24,0,7,0,88,0,7,0,56,0,7,0,120,0,7,0,4,0,7,0,68,0,7,0,36,0,7,0,100,0,7,0,20,0,7,0,84,0,7,0,52,0,7,0,116,0,7,0,3,0,8,0,131,0,8,0,67,0,8,0,195,0,8,0,35,0,8,0,163,0,8,0,99,0,8,0,227,0,8,0,0,0,5,0,16,0,5,0,8,0,5,0,24,0,5,0,4,0,5,0,20,0,5,0,12,0,5,0,28,0,5,0,2,0,5,0,18,0,5,0,10,0,5,0,26,0,5,0,6,0,5,0,22,0,5,0,14,0,5,0,30,0,5,0,1,0,5,0,17,0,5,0,9,0,5,0,25,0,5,0,5,0,5,0,21,0,5,0,13,0,5,0,29,0,5,0,3,0,5,0,19,0,5,0,11,0,5,0,27,0,5,0,7,0,5,0,23,0,5,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,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,64,0,0,0,80,0,0,0,96,0,0,0,112,0,0,0,128,0,0,0,160,0,0,0,192,0,0,0,224,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,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,8,0,0,0,9,0,0,0,9,0,0,0,10,0,0,0,10,0,0,0,11,0,0,0,11,0,0,0,12,0,0,0,12,0,0,0,13,0,0,0,13,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,12,0,0,0,16,0,0,0,24,0,0,0,32,0,0,0,48,0,0,0,64,0,0,0,96,0,0,0,128,0,0,0,192,0,0,0,0,1,0,0,128,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,12,0,0,0,16,0,0,0,24,0,0,0,32,0,0,0,48,0,0,0,64,0,0,0,96,0,0,16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,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,2,0,0,0,3,0,0,0,7,0,0,0,0,0,0,0,110,101,101,100,32,100,105,99,116,105,111,110,97,114,121,0,115,116,114,101,97,109,32,101,110,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,102,105,108,101,32,101,114,114,111,114,0,0,0,0,0,0,115,116,114,101,97,109,32,101,114,114,111,114,0,0,0,0,100,97,116,97,32,101,114,114,111,114,0,0,0,0,0,0,105,110,115,117,102,102,105,99,105,101,110,116,32,109,101,109,111,114,121,0,0,0,0,0,98,117,102,102,101,114,32,101,114,114,111,114,0,0,0,0,105,110,99,111,109,112,97,116,105,98,108,101,32,118,101,114,115,105,111,110,0,0,0,0,64,107,0,0,80,107,0,0,96,107,0,0,104,107,0,0,120,107,0,0,136,107,0,0,152,107,0,0,176,107,0,0,192,107,0,0,96,107,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,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,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,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,105,110,102,105,110,105,116,121,0,0,0,0,0,0,0,0,110,97,110,0,0,0,0,0,95,112,137,0,255,9,47,15,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+20576); + + + + +var tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8); + +assert(tempDoublePtr % 8 == 0); + +function copyTempFloat(ptr) { // functions, because inlining this code increases code size too much + + HEAP8[tempDoublePtr] = HEAP8[ptr]; + + HEAP8[tempDoublePtr+1] = HEAP8[ptr+1]; + + HEAP8[tempDoublePtr+2] = HEAP8[ptr+2]; + + HEAP8[tempDoublePtr+3] = HEAP8[ptr+3]; + +} + +function copyTempDouble(ptr) { + + HEAP8[tempDoublePtr] = HEAP8[ptr]; + + HEAP8[tempDoublePtr+1] = HEAP8[ptr+1]; + + HEAP8[tempDoublePtr+2] = HEAP8[ptr+2]; + + HEAP8[tempDoublePtr+3] = HEAP8[ptr+3]; + + HEAP8[tempDoublePtr+4] = HEAP8[ptr+4]; + + HEAP8[tempDoublePtr+5] = HEAP8[ptr+5]; + + HEAP8[tempDoublePtr+6] = HEAP8[ptr+6]; + + HEAP8[tempDoublePtr+7] = HEAP8[ptr+7]; + +} + + + + + var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86}; + + var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"}; + + + var ___errno_state=0;function ___setErrNo(value) { + // For convenient setting and returning of errno. + HEAP32[((___errno_state)>>2)]=value; + return value; + } + + var PATH={splitPath:function (filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + },normalizeArray:function (parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + 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 the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + return parts; + },normalize:function (path) { + var isAbsolute = path.charAt(0) === '/', + trailingSlash = path.substr(-1) === '/'; + // Normalize the path + 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) { + // No dirname whatsoever + return '.'; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + },basename:function (path) { + // EMSCRIPTEN return '/'' for '/', not an empty string + 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(); + // Skip empty and invalid entries + 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) === '/'; + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + 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 TTY={ttys:[],init:function () { + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // currently, FS.init does not distinguish if process.stdin is a file or TTY + // // device, it always assumes it's a TTY device. because of this, we're forcing + // // process.stdin to UTF8 encoding to at least make stdin reading compatible + // // with text files until FS.init can be refactored. + // process['stdin']['setEncoding']('utf8'); + // } + },shutdown:function () { + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)? + // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation + // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists? + // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle + // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call + // process['stdin']['pause'](); + // } + },register:function (dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + },stream_ops:{open:function (stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(ERRNO_CODES.ENODEV); + } + stream.tty = tty; + stream.seekable = false; + },close:function (stream) { + // flush any pending line data + if (stream.tty.output.length) { + stream.tty.ops.put_char(stream.tty, 10); + } + },read:function (stream, buffer, offset, length, pos /* ignored */) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(ERRNO_CODES.ENXIO); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } 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) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(ERRNO_CODES.ENXIO); + } + for (var i = 0; i < length; i++) { + try { + stream.tty.ops.put_char(stream.tty, buffer[offset+i]); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }},default_tty_ops:{get_char:function (tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + result = process['stdin']['read'](); + if (!result) { + if (process['stdin']['_readableState'] && process['stdin']['_readableState']['ended']) { + return null; // EOF + } + return undefined; // no data available + } + } else if (typeof window != 'undefined' && + typeof window.prompt == 'function') { + // Browser. + result = window.prompt('Input: '); // returns null on cancel + if (result !== null) { + result += '\n'; + } + } else if (typeof readline == 'function') { + // Command line. + result = readline(); + if (result !== null) { + result += '\n'; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + },put_char:function (tty, val) { + if (val === null || val === 10) { + Module['print'](tty.output.join('')); + tty.output = []; + } else { + tty.output.push(TTY.utf8.processCChar(val)); + } + }},default_tty1_ops:{put_char:function (tty, val) { + if (val === null || val === 10) { + Module['printErr'](tty.output.join('')); + tty.output = []; + } else { + tty.output.push(TTY.utf8.processCChar(val)); + } + }}}; + + var MEMFS={ops_table:null,CONTENT_OWNING:1,CONTENT_FLEXIBLE:2,CONTENT_FIXED:3,mount:function (mount) { + return MEMFS.createNode(null, '/', 16384 | 511 /* 0777 */, 0); + },createNode:function (parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.contents = []; + node.contentMode = MEMFS.CONTENT_FLEXIBLE; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + } + return node; + },ensureFlexible:function (node) { + if (node.contentMode !== MEMFS.CONTENT_FLEXIBLE) { + var contents = node.contents; + node.contents = Array.prototype.slice.call(contents); + node.contentMode = MEMFS.CONTENT_FLEXIBLE; + } + },node_ops:{getattr:function (node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.contents.length; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + },setattr:function (node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.ensureFlexible(node); + var contents = node.contents; + if (attr.size < contents.length) contents.length = attr.size; + else while (attr.size > contents.length) contents.push(0); + } + },lookup:function (parent, name) { + throw FS.genericErrors[ERRNO_CODES.ENOENT]; + },mknod:function (parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + },rename:function (old_node, new_dir, new_name) { + // if we're overwriting a directory at new_name, make sure it's empty. + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + } + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + } + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + old_node.parent = new_dir; + },unlink:function (parent, name) { + delete parent.contents[name]; + },rmdir:function (parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + delete parent.contents[name]; + },readdir:function (node) { + var entries = ['.', '..'] + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + },symlink:function (parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0); + node.link = oldpath; + return node; + },readlink:function (node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + return node.link; + }},stream_ops:{read:function (stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) + return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else + { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } + return size; + },write:function (stream, buffer, offset, length, position, canOwn) { + var node = stream.node; + node.timestamp = Date.now(); + var contents = node.contents; + if (length && contents.length === 0 && position === 0 && buffer.subarray) { + // just replace it with the new data + if (canOwn && offset === 0) { + node.contents = buffer; // this could be a subarray of Emscripten HEAP, or allocated from some other source. + node.contentMode = (buffer.buffer === HEAP8.buffer) ? MEMFS.CONTENT_OWNING : MEMFS.CONTENT_FIXED; + } else { + node.contents = new Uint8Array(buffer.subarray(offset, offset+length)); + node.contentMode = MEMFS.CONTENT_FIXED; + } + return length; + } + MEMFS.ensureFlexible(node); + var contents = node.contents; + while (contents.length < position) contents.push(0); + for (var i = 0; i < length; i++) { + contents[position + i] = buffer[offset + i]; + } + return length; + },llseek:function (stream, offset, whence) { + var position = offset; + if (whence === 1) { // SEEK_CUR. + position += stream.position; + } else if (whence === 2) { // SEEK_END. + if (FS.isFile(stream.node.mode)) { + position += stream.node.contents.length; + } + } + if (position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + stream.ungotten = []; + stream.position = position; + return position; + },allocate:function (stream, offset, length) { + MEMFS.ensureFlexible(stream.node); + var contents = stream.node.contents; + var limit = offset + length; + while (limit > contents.length) contents.push(0); + },mmap:function (stream, buffer, offset, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.ENODEV); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if ( !(flags & 2) && + (contents.buffer === buffer || contents.buffer === buffer.buffer) ) { + // We can't emulate MAP_SHARED when the file is not backed by the buffer + // we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = _malloc(length); + if (!ptr) { + throw new FS.ErrnoError(ERRNO_CODES.ENOMEM); + } + buffer.set(contents, ptr); + } + return { ptr: ptr, allocated: allocated }; + }}}; + + var IDBFS={dbs:{},indexedDB:function () { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + },DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function (mount) { + // reuse all of the core MEMFS functionality + return MEMFS.mount.apply(null, arguments); + },syncfs:function (mount, populate, callback) { + IDBFS.getLocalSet(mount, function(err, local) { + if (err) return callback(err); + + IDBFS.getRemoteSet(mount, function(err, remote) { + if (err) return callback(err); + + var src = populate ? remote : local; + var dst = populate ? local : remote; + + IDBFS.reconcile(src, dst, callback); + }); + }); + },getDB:function (name, callback) { + // check the cache first + var db = IDBFS.dbs[name]; + if (db) { + return callback(null, db); + } + + var req; + try { + req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION); + } catch (e) { + return callback(e); + } + req.onupgradeneeded = function(e) { + var db = e.target.result; + var transaction = e.target.transaction; + + var fileStore; + + if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) { + fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME); + } else { + fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME); + } + + fileStore.createIndex('timestamp', 'timestamp', { unique: false }); + }; + req.onsuccess = function() { + db = req.result; + + // add to the cache + IDBFS.dbs[name] = db; + callback(null, db); + }; + req.onerror = function() { + callback(this.error); + }; + },getLocalSet:function (mount, callback) { + var entries = {}; + + function isRealDir(p) { + return p !== '.' && p !== '..'; + }; + function toAbsolute(root) { + return function(p) { + return PATH.join2(root, p); + } + }; + + var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint)); + + while (check.length) { + var path = check.pop(); + var stat; + + try { + stat = FS.stat(path); + } catch (e) { + return callback(e); + } + + if (FS.isDir(stat.mode)) { + check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path))); + } + + entries[path] = { timestamp: stat.mtime }; + } + + return callback(null, { type: 'local', entries: entries }); + },getRemoteSet:function (mount, callback) { + var entries = {}; + + IDBFS.getDB(mount.mountpoint, function(err, db) { + if (err) return callback(err); + + var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly'); + transaction.onerror = function() { callback(this.error); }; + + var store = transaction.objectStore(IDBFS.DB_STORE_NAME); + var index = store.index('timestamp'); + + index.openKeyCursor().onsuccess = function(event) { + var cursor = event.target.result; + + if (!cursor) { + return callback(null, { type: 'remote', db: db, entries: entries }); + } + + entries[cursor.primaryKey] = { timestamp: cursor.key }; + + cursor.continue(); + }; + }); + },loadLocalEntry:function (path, callback) { + var stat, node; + + try { + var lookup = FS.lookupPath(path); + node = lookup.node; + stat = FS.stat(path); + } catch (e) { + return callback(e); + } + + if (FS.isDir(stat.mode)) { + return callback(null, { timestamp: stat.mtime, mode: stat.mode }); + } else if (FS.isFile(stat.mode)) { + return callback(null, { timestamp: stat.mtime, mode: stat.mode, contents: node.contents }); + } else { + return callback(new Error('node type not supported')); + } + },storeLocalEntry:function (path, entry, callback) { + try { + if (FS.isDir(entry.mode)) { + FS.mkdir(path, entry.mode); + } else if (FS.isFile(entry.mode)) { + FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true }); + } else { + return callback(new Error('node type not supported')); + } + + FS.utime(path, entry.timestamp, entry.timestamp); + } catch (e) { + return callback(e); + } + + callback(null); + },removeLocalEntry:function (path, callback) { + try { + var lookup = FS.lookupPath(path); + var stat = FS.stat(path); + + if (FS.isDir(stat.mode)) { + FS.rmdir(path); + } else if (FS.isFile(stat.mode)) { + FS.unlink(path); + } + } catch (e) { + return callback(e); + } + + callback(null); + },loadRemoteEntry:function (store, path, callback) { + var req = store.get(path); + req.onsuccess = function(event) { callback(null, event.target.result); }; + req.onerror = function() { callback(this.error); }; + },storeRemoteEntry:function (store, path, entry, callback) { + var req = store.put(entry, path); + req.onsuccess = function() { callback(null); }; + req.onerror = function() { callback(this.error); }; + },removeRemoteEntry:function (store, path, callback) { + var req = store.delete(path); + req.onsuccess = function() { callback(null); }; + req.onerror = function() { callback(this.error); }; + },reconcile:function (src, dst, callback) { + var total = 0; + + var create = []; + Object.keys(src.entries).forEach(function (key) { + var e = src.entries[key]; + var e2 = dst.entries[key]; + if (!e2 || e.timestamp > e2.timestamp) { + create.push(key); + total++; + } + }); + + var remove = []; + Object.keys(dst.entries).forEach(function (key) { + var e = dst.entries[key]; + var e2 = src.entries[key]; + if (!e2) { + remove.push(key); + total++; + } + }); + + if (!total) { + return callback(null); + } + + var errored = false; + var completed = 0; + var db = src.type === 'remote' ? src.db : dst.db; + var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite'); + var store = transaction.objectStore(IDBFS.DB_STORE_NAME); + + function done(err) { + if (err) { + if (!done.errored) { + done.errored = true; + return callback(err); + } + return; + } + if (++completed >= total) { + return callback(null); + } + }; + + transaction.onerror = function() { done(this.error); }; + + // sort paths in ascending order so directory entries are created + // before the files inside them + create.sort().forEach(function (path) { + if (dst.type === 'local') { + IDBFS.loadRemoteEntry(store, path, function (err, entry) { + if (err) return done(err); + IDBFS.storeLocalEntry(path, entry, done); + }); + } else { + IDBFS.loadLocalEntry(path, function (err, entry) { + if (err) return done(err); + IDBFS.storeRemoteEntry(store, path, entry, done); + }); + } + }); + + // sort paths in descending order so files are deleted before their + // parent directories + remove.sort().reverse().forEach(function(path) { + if (dst.type === 'local') { + IDBFS.removeLocalEntry(path, done); + } else { + IDBFS.removeRemoteEntry(store, path, done); + } + }); + }}; + + var NODEFS={isWindows:false,staticInit:function () { + NODEFS.isWindows = !!process.platform.match(/^win/); + },mount:function (mount) { + assert(ENVIRONMENT_IS_NODE); + return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0); + },createNode:function (parent, name, mode, dev) { + if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var node = FS.createNode(parent, name, mode); + node.node_ops = NODEFS.node_ops; + node.stream_ops = NODEFS.stream_ops; + return node; + },getMode:function (path) { + var stat; + try { + stat = fs.lstatSync(path); + if (NODEFS.isWindows) { + // On Windows, directories return permission bits 'rw-rw-rw-', even though they have 'rwxrwxrwx', so + // propagate write bits to execute bits. + stat.mode = stat.mode | ((stat.mode & 146) >> 1); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + return stat.mode; + },realPath:function (node) { + var parts = []; + while (node.parent !== node) { + parts.push(node.name); + node = node.parent; + } + parts.push(node.mount.opts.root); + parts.reverse(); + return PATH.join.apply(null, parts); + },flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function (flags) { + if (flags in NODEFS.flagsToPermissionStringMap) { + return NODEFS.flagsToPermissionStringMap[flags]; + } else { + return flags; + } + },node_ops:{getattr:function (node) { + var path = NODEFS.realPath(node); + var stat; + try { + stat = fs.lstatSync(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake them with default blksize of 4096. + // See http://support.microsoft.com/kb/140365 + if (NODEFS.isWindows && !stat.blksize) { + stat.blksize = 4096; + } + if (NODEFS.isWindows && !stat.blocks) { + stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0; + } + return { + dev: stat.dev, + ino: stat.ino, + mode: stat.mode, + nlink: stat.nlink, + uid: stat.uid, + gid: stat.gid, + rdev: stat.rdev, + size: stat.size, + atime: stat.atime, + mtime: stat.mtime, + ctime: stat.ctime, + blksize: stat.blksize, + blocks: stat.blocks + }; + },setattr:function (node, attr) { + var path = NODEFS.realPath(node); + try { + if (attr.mode !== undefined) { + fs.chmodSync(path, attr.mode); + // update the common node structure mode as well + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + var date = new Date(attr.timestamp); + fs.utimesSync(path, date, date); + } + if (attr.size !== undefined) { + fs.truncateSync(path, attr.size); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },lookup:function (parent, name) { + var path = PATH.join2(NODEFS.realPath(parent), name); + var mode = NODEFS.getMode(path); + return NODEFS.createNode(parent, name, mode); + },mknod:function (parent, name, mode, dev) { + var node = NODEFS.createNode(parent, name, mode, dev); + // create the backing node for this in the fs root as well + var path = NODEFS.realPath(node); + try { + if (FS.isDir(node.mode)) { + fs.mkdirSync(path, node.mode); + } else { + fs.writeFileSync(path, '', { mode: node.mode }); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + return node; + },rename:function (oldNode, newDir, newName) { + var oldPath = NODEFS.realPath(oldNode); + var newPath = PATH.join2(NODEFS.realPath(newDir), newName); + try { + fs.renameSync(oldPath, newPath); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },unlink:function (parent, name) { + var path = PATH.join2(NODEFS.realPath(parent), name); + try { + fs.unlinkSync(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },rmdir:function (parent, name) { + var path = PATH.join2(NODEFS.realPath(parent), name); + try { + fs.rmdirSync(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },readdir:function (node) { + var path = NODEFS.realPath(node); + try { + return fs.readdirSync(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },symlink:function (parent, newName, oldPath) { + var newPath = PATH.join2(NODEFS.realPath(parent), newName); + try { + fs.symlinkSync(oldPath, newPath); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },readlink:function (node) { + var path = NODEFS.realPath(node); + try { + return fs.readlinkSync(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }},stream_ops:{open:function (stream) { + var path = NODEFS.realPath(stream.node); + try { + if (FS.isFile(stream.node.mode)) { + stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags)); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },close:function (stream) { + try { + if (FS.isFile(stream.node.mode) && stream.nfd) { + fs.closeSync(stream.nfd); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + },read:function (stream, buffer, offset, length, position) { + // FIXME this is terrible. + var nbuffer = new Buffer(length); + var res; + try { + res = fs.readSync(stream.nfd, nbuffer, 0, length, position); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + if (res > 0) { + for (var i = 0; i < res; i++) { + buffer[offset + i] = nbuffer[i]; + } + } + return res; + },write:function (stream, buffer, offset, length, position) { + // FIXME this is terrible. + var nbuffer = new Buffer(buffer.subarray(offset, offset + length)); + var res; + try { + res = fs.writeSync(stream.nfd, nbuffer, 0, length, position); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + return res; + },llseek:function (stream, offset, whence) { + var position = offset; + if (whence === 1) { // SEEK_CUR. + position += stream.position; + } else if (whence === 2) { // SEEK_END. + if (FS.isFile(stream.node.mode)) { + try { + var stat = fs.fstatSync(stream.nfd); + position += stat.size; + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + } + } + + if (position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + + stream.position = position; + return position; + }}}; + + var _stdin=allocate(1, "i32*", ALLOC_STATIC); + + var _stdout=allocate(1, "i32*", ALLOC_STATIC); + + var _stderr=allocate(1, "i32*", ALLOC_STATIC); + + function _fflush(stream) { + // int fflush(FILE *stream); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/fflush.html + // we don't currently perform any user-space buffering of data + }var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},handleFSError:function (e) { + if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace(); + return ___setErrNo(e.errno); + },lookupPath:function (path, opts) { + path = PATH.resolve(FS.cwd(), path); + opts = opts || {}; + + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + + if (opts.recurse_count > 8) { // max recursive lookup of 8 + throw new FS.ErrnoError(ERRNO_CODES.ELOOP); + } + + // split the path + var parts = PATH.normalizeArray(path.split('/').filter(function(p) { + return !!p; + }), false); + + // start at the root + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length-1); + if (islast && opts.parent) { + // stop resolving + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = 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) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + 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; + } + } + // if we failed to find it in the cache, call into the VFS + 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; // root node sets parent to itself + } + 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 = {}; + + // compatibility + var readMode = 292 | 73; + var writeMode = 146; + + // NOTE we must use Object.defineProperties instead of individual calls to + // Object.defineProperty in order to make closure compiler happy + 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; + } + // return 0 if any user, group or owner bits are set. + 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 || // opening for write + (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 = {}; + // compatibility + 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); } + } + }); + } + // clone it, so we can return an instance of FSStream + 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); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + 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) & 0xff); + },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); + } + }; + + // sync all mounts + 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; // use the absolute 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: [] + }; + + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + + // add the new mount to the current mount's children + 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); + } + + // destroy the nodes for this mount, and all its child mounts + 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; + } + }); + + // no longer a mountpoint + node.mounted = null; + + // remove this mount from the child mounts + 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 /* 0666 */; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + },mkdir:function (path, mode) { + mode = mode !== undefined ? mode : 511 /* 0777 */; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + },mkdev:function (path, mode, dev) { + if (typeof(dev) === 'undefined') { + dev = mode; + mode = 438 /* 0666 */; + } + 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); + // parents must exist + 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); + } + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(ERRNO_CODES.EXDEV); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + // new path should not be an ancestor of the old path + relative = PATH.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + // not fatal + } + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var err = FS.mayDelete(old_dir, old_name, isdir); + if (err) { + throw new FS.ErrnoError(err); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + 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 we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + err = FS.nodePermissions(old_dir, 'w'); + if (err) { + throw new FS.ErrnoError(err); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + },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); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + },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) { + // POSIX says unlink should set EPERM, not EISDIR + 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); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + },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() + // we ignore the uid / gid for 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) { + flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode === 'undefined' ? 438 /* 0666 */ : 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) { + // ignore + } + } + // perhaps we need to create the node + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(ERRNO_CODES.EEXIST); + } + } else { + // node doesn't exist, try to create it + node = FS.mknod(path, mode, 0); + } + } + if (!node) { + throw new FS.ErrnoError(ERRNO_CODES.ENOENT); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // check permissions + var err = FS.mayOpen(node, flags); + if (err) { + throw new FS.ErrnoError(err); + } + // do truncation if necessary + if ((flags & 512)) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512); + + // register the stream with the filesystem + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), // we want the absolute path to the node + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }, fd_start, fd_end); + // call the new stream's open function + 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); + } + } + 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); + } + var seeking = true; + if (typeof position === 'undefined') { + position = stream.position; + seeking = false; + } else if (!stream.seekable) { + throw new FS.ErrnoError(ERRNO_CODES.ESPIPE); + } + if (stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + 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) { + // TODO if PROT is PROT_WRITE, make sure we have write access + 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 () { + // create /dev + FS.mkdir('/dev'); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: function() { return 0; }, + write: function() { return 0; } + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using Module['printErr'] + // so we register a second tty just for it. + 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)); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + },createStandardStreams:function () { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + 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'); + } + + // open default streams for the stdin, stdout and stderr devices + 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; + // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info) + [ERRNO_CODES.ENOENT].forEach(function(code) { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = '>>0){d=z}else{E=0;break}}}else{E=0}}else{E=o}}while(0);F=Dg(o|0)|0;n=Dg(l|0)|0;f:do{if((n|0)!=0){if((F|0)!=0?(w=a[l]|0,d=n+ -1|0,p=a[l+d|0]|0,j=F+1-n|0,m=o+j|0,(j|0)>0):0){j=(n|0)==1;A=(n|0)<3;y=o;while(1){g:do{if((a[y]|0)==w<<24>>24){if(j){G=y;break f}if((a[y+d|0]|0)==p<<24>>24){if(A){G=y;break f}else{H=1}while(1){b=H+1|0;if((a[y+H|0]|0)!=(a[l+H|0]|0)){break g}if((b|0)<(n|0)){H=b}else{G=y;break f}}}}}while(0);b=y+1|0;if(b>>>0 >>0>851){t=1;i=l;return t|0}else{w=0;x=g;y=1;z=24504+ -514|0;A=256;B=24568+ -514|0}}else{g=1< >>0>591){t=1;i=l;return t|0}else{w=o;x=g;y=0;z=24632;A=-1;B=24696}}g=x+ -1|0;o=p&255;d=p;n=0;u=0;r=v;v=-1;C=c[h>>2]|0;D=0;E=x;b:while(1){x=1< >1]=H;if((P|0)>14){M=c[p>>2]|0;c[p>>2]=M+1;a[(c[q>>2]|0)+M|0]=H;H=(e[o>>1]|0)>>>8&255;M=c[p>>2]|0;c[p>>2]=M+1;a[(c[q>>2]|0)+M|0]=H;H=c[m>>2]|0;b[o>>1]=L>>>(16-H|0);c[m>>2]=H+ -14;break}else{c[m>>2]=P+2;break}}if((C|0)<11){H=e[l>>1]|0;L=c[m>>2]|0;M=e[n>>1]|0;K=e[o>>1]|0|M<>>0)}s=Dg(g|0)|0;f:do{if((s|0)!=0?(f=q+(s+1)|0,(s|0)>0):0){e=g;while(1){if((a[e]|0)==46){break}b=e+1|0;if(b>>>0q?l:q}else{r=o}if(r<0.0){if(r<-1.0e-13){k=2}else{s=0.0;break}i=g;return k|0}if(r>3.141592653589793){if(r>3.141592653589893){k=2;i=g;return k|0}else{s=3.141592653589793}}else{s=r}}else if((j|0)==1){s=(m- +h[d+32>>3])/+h[d+40>>3]}else{o=+h[d+32>>3];q=+h[d+112>>3];l=+h[d+120>>3];if(m
180.0){z=y+-360.0}else{z=y}y=z*.017453292519943295;A=o;B=(v*v+y*y)*.5;C=0.0;D=m;E=0.0}else{A=o;B=x;C=0.0;D=m;E=0.0}break};case 3:{if(x<1.0e-8){y=d*3.141592653589793/180.0;v=+qa(+b,360.0);if(v<0.0){F=v+360.0}else{F=v}v=(180.0-F)*3.141592653589793/180.0;A=o;B=(y*y+v*v)*.5;C=4.0;D=r;E=0.0}else{A=o;B=x;C=4.0;D=r;E=0.0}break};case 0:{if(x<1.0e-8){r=(90.0-d)*3.141592653589793/180.0;A=q;B=r*r*.5;C=0.0;D=m;E=2.0}else{A=q;B=x;C=0.0;D=m;E=2.0}break};case 2:{if(x<1.0e-8){r=d*3.141592653589793/180.0;v=+qa(+b,360.0);if(v<-180.0){G=v+360.0}else{G=v}v=(90.0-G)*3.141592653589793/180.0;A=o;B=(r*r+v*v)*.5;C=2.0;D=q;E=0.0}else{A=o;B=x;C=2.0;D=q;E=0.0}break};case 4:{if(x<1.0e-8){q=d*3.141592653589793/180.0;v=+qa(+b,360.0);if(v>180.0){H=v+-360.0}else{H=v}v=H*((H+90.0)*3.141592653589793/180.0);A=o;B=(q*q+v*v)*.5;C=6.0;D=n;E=0.0}else{A=o;B=x;C=6.0;D=n;E=0.0}break};case 5:{if(x<1.0e-8){o=(d+90.0)*3.141592653589793/180.0;A=n;B=o*o*.5;C=0.0;D=m;E=-2.0}else{A=n;B=x;C=0.0;D=m;E=-2.0}break};default:{A=0.0;B=x;C=0.0;D=0.0;E=0.0}}do{if(!(D==0.0&A==0.0)){x=+P(+A);if(x<=-D){m=A/D;n=m*m+1.0;o=-+Q(+(B/(1.0-1.0/+Q(+(n+1.0)))));d=+We(m);I=o;J=o/15.0*(d- +Ve(m/+Q(+(n+n))));break}if(D>=x){x=A/D;n=x*x+1.0;m=+Q(+(B/(1.0-1.0/+Q(+(n+1.0)))));d=+We(x);I=m;J=m/15.0*(d- +Ve(x/+Q(+(n+n))));break}n=+P(+D);if(n<-A){x=D/A;d=x*x+1.0;m=-+Q(+(B/(1.0-1.0/+Q(+(d+1.0)))));o=+We(x);I=m/15.0*(o- +Ve(x/+Q(+(d+d))));J=m;break}if(A>n){n=D/A;m=n*n+1.0;d=+Q(+(B/(1.0-1.0/+Q(+(m+1.0)))));x=+We(n);I=d/15.0*(x- +Ve(n/+Q(+(m+m))));J=d}else{I=0.0;J=0.0}}else{I=0.0;J=0.0}}while(0);B=+P(+I);do{if(B>1.0){if(B>1.000000000001){p=2;i=j;return p|0}else{K=I<0.0?-1.0:1.0;break}}else{K=I}}while(0);I=+P(+J);do{if(I>1.0){if(I>1.000000000001){p=2;i=j;return p|0}else{L=J<0.0?-1.0:1.0;break}}else{L=J}}while(0);l=e+112|0;h[f>>3]=(C+K)*+h[l>>3];h[g>>3]=(E+L)*+h[l>>3];p=0;i=j;return p|0}function Oe(b,d,e,f,g){b=+b;d=+d;e=e|0;f=f|0;g=g|0;var j=0,k=0,l=0.0,m=0,n=0.0,o=0.0,p=0.0,q=0,r=0.0,s=0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0,A=0.0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0.0,L=0.0,M=0.0,N=0.0,O=0.0,R=0.0,S=0.0,T=0.0,U=0.0,V=0.0,W=0.0,X=0.0;j=i;k=e+4|0;if((c[k>>2]|0)==703){l=+h[e+120>>3]}else{a[e]=4412241;a[e+1|0]=17235;a[e+2|0]=67;a[e+3|0]=0;c[k>>2]=703;k=e+8|0;m=e+24|0;c[k+0>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;n=+h[m>>3];if(n==0.0){h[m>>3]=57.29577951308232;h[e+112>>3]=45.0;h[e+120>>3]=.022222222222222223;o=.022222222222222223}else{p=n*3.141592653589793*.25;h[e+112>>3]=p;n=1.0/p;h[e+120>>3]=n;o=n}c[e+1888>>2]=35;c[e+1892>>2]=36;l=o}o=l*b;b=l*d;d=+P(+o);if(!(d<=1.0)){if(d>7.0){q=2;i=j;return q|0}if(+P(+b)>1.0){q=2;i=j;return q|0}}else{if(+P(+b)>3.0){q=2;i=j;return q|0}}if(o<-1.0){r=o+8.0}else{r=o}do{if(!(r>5.0)){if(r>3.0){s=3;t=r+-4.0;u=b;break}if(r>1.0){s=2;t=r+-2.0;u=b;break}if(b>1.0){s=0;t=r;u=b+-2.0;break}if(b<-1.0){s=5;t=r;u=b+2.0}else{s=1;t=r;u=b}}else{s=4;t=r+-6.0;u=b}}while(0);e=+P(+t)>+P(+u);if(e){if(t==0.0){v=0.0;w=1.0;x=0.0;y=1.0;z=30}else{b=u*15.0/t;r=+Se(b);o=r/(+Re(b)+-.7071067811865475);b=o*o+1.0;A=t*t*(1.0-1.0/+Q(+(b+1.0)));B=o;C=b;z=28}}else{if(u==0.0){v=0.0;w=1.0;x=0.0;y=1.0;z=30}else{b=t*15.0/u;o=+Se(b);r=o/(+Re(b)+-.7071067811865475);b=r*r+1.0;A=u*u*(1.0-1.0/+Q(+(b+1.0)));B=r;C=b;z=28}}if((z|0)==28){b=1.0-A;if(b<-1.0){if(b<-1.000000000001){q=2;i=j;return q|0}else{D=B;E=-1.0;F=0.0}}else{v=B;w=b;x=A;y=C;z=30}}if((z|0)==30){D=v;E=w;F=+Q(+(x*(2.0-x)/y))}a:do{switch(s|0){case 2:{if(e){if(t>0.0){G=-F}else{G=F}H=G;I=E;J=-(D*G);break a}else{if(u<0.0){K=-F}else{K=F}H=-(D*K);I=E;J=K;break a}break};case 3:{y=-E;if(e){if(t>0.0){L=-F}else{L=F}H=y;I=L;J=-(D*L);break a}else{if(u<0.0){M=-F}else{M=F}H=y;I=-(D*M);J=M;break a}break};case 1:{if(e){if(t<0.0){N=-F}else{N=F}H=E;I=N;J=D*N;break a}else{if(u<0.0){O=-F}else{O=F}H=E;I=D*O;J=O;break a}break};case 5:{y=-E;if(e){if(t<0.0){R=-F}else{R=F}H=D*R;I=R;J=y;break a}else{if(u<0.0){S=-F}else{S=F}H=S;I=D*S;J=y;break a}break};case 4:{y=-E;if(e){if(t<0.0){T=-F}else{T=F}H=T;I=y;J=D*T;break a}else{if(u<0.0){U=-F}else{U=F}H=D*U;I=y;J=U;break a}break};case 0:{if(e){if(t<0.0){V=-F}else{V=F}H=-(D*V);I=V;J=E;break a}else{if(u>0.0){W=-F}else{W=F}H=W;I=-(D*W);J=E;break a}break};default:{H=0.0;I=0.0;J=0.0}}}while(0);if(H==0.0&I==0.0){X=0.0}else{X=+Xe(I,H)}h[f>>3]=X;h[g>>3]=+Ve(J);q=0;i=j;return q|0}function Pe(a,b,c,d,e){a=+a;b=+b;c=c|0;d=d|0;e=e|0;var f=0,g=0.0,j=0.0,k=0.0,l=0.0,m=0,n=0,o=0.0,p=0.0,q=0.0,r=0.0,s=0.0;f=i;g=+Re(b);j=+Se(b);k=a- +h[c>>3];a=+Re(k);l=+Se(k);m=c+32|0;n=c+24|0;o=j*+h[m>>3]-a*g*+h[n>>3];if(+P(+o)<1.0e-5){p=+Re(+h[c+8>>3]+b);q=(1.0-a)*g*+h[n>>3]-p}else{q=o}o=g*l;if(q!=0.0|o!=-0.0){r=+Xe(-o,q)}else{r=k+-180.0}l=r+ +h[c+16>>3];h[d>>3]=l;if(!(l>180.0)){if(l<-180.0){h[d>>3]=l+360.0}}else{h[d>>3]=l+-360.0}if(+qa(+k,180.0)==0.0){k=a*+h[c+8>>3]+b;if(k>90.0){s=180.0-k}else{s=k}h[e>>3]=s;if(!(s<-90.0)){i=f;return 0}h[e>>3]=-180.0-s;i=f;return 0}s=j*+h[n>>3]+a*g*+h[m>>3];if(!(+P(+s)>.99)){h[e>>3]=+Ve(s);i=f;return 0}g=+Ue(+Q(+(o*o+q*q)));if(s<0.0){h[e>>3]=-g;i=f;return 0}else{h[e>>3]=g;i=f;return 0}return 0}function Qe(a,b,c,d,e){a=+a;b=+b;c=c|0;d=d|0;e=e|0;var f=0,g=0.0,j=0.0,k=0.0,l=0.0,m=0,n=0,o=0.0,p=0.0,q=0.0,r=0.0,s=0.0,t=0.0;f=i;g=+Re(b);j=+Se(b);k=a- +h[c+16>>3];a=+Re(k);l=+Se(k);m=c+32|0;n=c+24|0;o=j*+h[m>>3]-a*g*+h[n>>3];if(+P(+o)<1.0e-5){p=+Re(+h[c+8>>3]+b);q=(1.0-a)*g*+h[n>>3]-p}else{q=o}o=g*l;if(q!=0.0|o!=-0.0){r=+Xe(-o,q)}else{r=k+180.0}l=r+ +h[c>>3];h[d>>3]=l;if(!(+h[c>>3]>=0.0)){if(l>0.0){r=l+-360.0;h[d>>3]=r;s=r}else{s=l}}else{if(l<0.0){r=l+360.0;h[d>>3]=r;s=r}else{s=l}}if(!(s>360.0)){if(s<-360.0){h[d>>3]=s+360.0}}else{h[d>>3]=s+-360.0}if(+qa(+k,180.0)==0.0){k=a*+h[c+8>>3]+b;if(k>90.0){t=180.0-k}else{t=k}h[e>>3]=t;if(!(t<-90.0)){i=f;return 0}h[e>>3]=-180.0-t;i=f;return 0}t=j*+h[n>>3]+a*g*+h[m>>3];if(!(+P(+t)>.99)){h[e>>3]=+Ve(t);i=f;return 0}g=+Ue(+Q(+(o*o+q*q)));if(t<0.0){h[e>>3]=-g;i=f;return 0}else{h[e>>3]=g;i=f;return 0}return 0}function Re(a){a=+a;var b=0,c=0.0,d=0.0,e=0.0;b=i;c=+qa(+a,360.0);d=+P(+c);if(!(c==0.0)){if(!(d==90.0)){if(!(d==180.0)){if(d==270.0){e=0.0}else{e=+S(+(a*.017453292519943295))}}else{e=-1.0}}else{e=0.0}}else{e=1.0}i=b;return+e}function Se(a){a=+a;var b=0,c=0.0,d=0.0;b=i;c=+qa(+(a+-90.0),360.0);if(!(c==0.0)){if(!(c==90.0)){if(!(c==180.0)){if(c==270.0){d=0.0}else{d=+T(+(a*.017453292519943295))}}else{d=-1.0}}else{d=0.0}}else{d=1.0}i=b;return+d}function Te(a){a=+a;var b=0,c=0.0,d=0.0;b=i;c=+qa(+a,360.0);if(!(c==0.0)?!(+P(+c)==180.0):0){if(!(c==45.0|c==225.0)){if(c==-135.0|c==-315.0){d=-1.0}else{d=+U(+(a*.017453292519943295))}}else{d=1.0}}else{d=0.0}i=b;return+d}function Ue(a){a=+a;var b=0,c=0.0,d=0;b=i;if(!(a>=1.0)){if(!(a==0.0)){if(a<=-1.0&a+1.0>-1.0e-10){c=180.0}else{d=5}}else{c=90.0}}else{if(a+-1.0<1.0e-10){c=0.0}else{d=5}}if((d|0)==5){c=+V(+a)*57.29577951308232}i=b;return+c}function Ve(a){a=+a;var b=0,c=0.0,d=0;b=i;if(!(a<=-1.0)){if(!(a==0.0)){if(a>=1.0&a+-1.0<1.0e-10){c=90.0}else{d=5}}else{c=0.0}}else{if(a+1.0>-1.0e-10){c=-90.0}else{d=5}}if((d|0)==5){c=+W(+a)*57.29577951308232}i=b;return+c}function We(a){a=+a;var b=0,c=0.0;b=i;if(!(a==-1.0)){if(!(a==0.0)){if(a==1.0){c=45.0}else{c=+X(+a)*57.29577951308232}}else{c=0.0}}else{c=-45.0}i=b;return+c}function Xe(a,b){a=+a;b=+b;var c=0,d=0.0,e=0;c=i;if(a==0.0){if(!(b>=0.0)){if(b<0.0){d=180.0}else{e=7}}else{d=0.0}}else{if(b==0.0){if(!(a>0.0)){if(a<0.0){d=-90.0}else{e=7}}else{d=90.0}}else{e=7}}if((e|0)==7){d=+Y(+a,+b)*57.29577951308232}i=c;return+d}function Ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;i=i+32|0;e=d;f=d+8|0;if((c[a+5968>>2]|0)!=1){i=d;return}g=a+3324|0;if((c[g>>2]|0)==2){c[g>>2]=3;c[a+5976>>2]=0;c[a+6784>>2]=0;c[a+7592>>2]=0;c[a+8400>>2]=0;i=d;return}g=a+5976|0;if((Ec(b,12288,g)|0)!=0){h=c[g>>2]|0;g=(h|0)<0;if(!g){j=(h<<3)+8|0;k=0;while(1){Eg(a+(k*80|0)+5984|0,0,j|0)|0;if((k|0)==(h|0)){break}else{k=k+1|0}}if(!g){g=h+1|0;k=0;j=g;while(1){if((h-k|0)>=0){l=0;do{c[e>>2]=k;c[e+4>>2]=l;Na(f|0,12360,e|0)|0;Lc(b,f,a+(k*80|0)+(l<<3)+5984|0)|0;l=l+1|0}while((l|0)!=(j|0))}k=k+1|0;if((k|0)==(g|0)){break}else{j=j+ -1|0}}}}}else{_b(12296)}j=a+6784|0;if((Ec(b,12368,j)|0)!=0){g=c[j>>2]|0;j=(g|0)<0;if(!j){k=(g<<3)+8|0;h=0;while(1){Eg(a+(h*80|0)+6792|0,0,k|0)|0;if((h|0)==(g|0)){break}else{h=h+1|0}}if(!j){j=g+1|0;h=0;k=j;while(1){if((g-h|0)>=0){l=0;do{c[e>>2]=h;c[e+4>>2]=l;Na(f|0,12440,e|0)|0;Lc(b,f,a+(h*80|0)+(l<<3)+6792|0)|0;l=l+1|0}while((l|0)!=(k|0))}h=h+1|0;if((h|0)==(j|0)){break}else{k=k+ -1|0}}}}}else{_b(12376)}k=a+7592|0;if((Ec(b,12448,k)|0)!=0){j=c[k>>2]|0;k=(j|0)<0;if(!k){h=(j<<3)+8|0;g=0;while(1){Eg(a+(g*80|0)+7600|0,0,h|0)|0;if((g|0)==(j|0)){break}else{g=g+1|0}}if(!k){k=j+1|0;g=0;h=k;while(1){if((j-g|0)>=0){l=0;do{c[e>>2]=g;c[e+4>>2]=l;Na(f|0,12528,e|0)|0;Lc(b,f,a+(g*80|0)+(l<<3)+7600|0)|0;l=l+1|0}while((l|0)!=(h|0))}g=g+1|0;if((g|0)==(k|0)){break}else{h=h+ -1|0}}}}}else{_b(12464)}h=a+8400|0;if((Ec(b,12544,h)|0)==0){_b(12560);i=d;return}k=c[h>>2]|0;h=(k|0)<0;if(h){i=d;return}g=(k<<3)+8|0;j=0;while(1){Eg(a+(j*80|0)+8408|0,0,g|0)|0;if((j|0)==(k|0)){break}else{j=j+1|0}}if(h){i=d;return}h=k+1|0;j=0;g=h;while(1){if((k-j|0)>=0){l=0;do{c[e>>2]=j;c[e+4>>2]=l;Na(f|0,12624,e|0)|0;Lc(b,f,a+(j*80|0)+(l<<3)+8408|0)|0;l=l+1|0}while((l|0)!=(g|0))}j=j+1|0;if((j|0)==(h|0)){break}else{g=g+ -1|0}}i=d;return}function Ze(a,b,d,e,f){a=a|0;b=+b;d=+d;e=e|0;f=f|0;var g=0,j=0,k=0.0,l=0,m=0,n=0.0,o=0.0,p=0,q=0,r=0.0,s=0,t=0,u=0.0,v=0.0,w=0.0,x=0,y=0.0,z=0.0;g=i;i=i+80|0;j=g;if((c[a+5968>>2]|0)!=1){h[e>>3]=b;k=d;h[f>>3]=k;i=g;return}l=c[a+7592>>2]|0;m=c[a+8400>>2]|0;n=b- +h[a+16>>3];o=d- +h[a+24>>3];if((l|0)>=0){p=0;while(1){q=l-p|0;r=+h[a+(q*80|0)+(p<<3)+7600>>3];s=j+(p<<3)|0;h[s>>3]=r;if((p|0)>0){t=p;u=r;do{t=t+ -1|0;u=o*u+ +h[a+(q*80|0)+(t<<3)+7600>>3]}while((t|0)>0);h[s>>3]=u}if((p|0)==(l|0)){break}else{p=p+1|0}}r=+h[j>>3];if((l|0)>0){p=l+1|0;t=l;v=r;while(1){w=n*v+ +h[j+(p-t<<3)>>3];l=t+ -1|0;if((l|0)>0){t=l;v=w}else{x=j;y=w;break}}}else{x=j;y=r}}else{x=j;y=0.0}h[e>>3]=y;if((m|0)>=0){t=0;while(1){p=m-t|0;y=+h[a+(p*80|0)+(t<<3)+8408>>3];l=j+(t<<3)|0;h[l>>3]=y;if((t|0)>0){q=t;r=y;do{q=q+ -1|0;r=o*r+ +h[a+(p*80|0)+(q<<3)+8408>>3]}while((q|0)>0);h[l>>3]=r}if((t|0)==(m|0)){break}else{t=t+1|0}}o=+h[x>>3];if((m|0)>0){t=m+1|0;a=m;u=o;while(1){y=n*u+ +h[j+(t-a<<3)>>3];m=a+ -1|0;if((m|0)>0){a=m;u=y}else{z=y;break}}}else{z=o}}else{z=+h[x>>3]}h[f>>3]=z;h[e>>3]=+h[e>>3]+b;k=+h[f>>3]+d;h[f>>3]=k;i=g;return}function _e(a,b,d,e,f){a=a|0;b=+b;d=+d;e=e|0;f=f|0;var g=0,j=0,k=0.0,l=0,m=0,n=0.0,o=0.0,p=0,q=0,r=0.0,s=0,t=0,u=0.0,v=0.0,w=0.0,x=0,y=0.0,z=0.0;g=i;i=i+80|0;j=g;if((c[a+5968>>2]|0)!=1){h[e>>3]=b;k=d;h[f>>3]=k;i=g;return}l=c[a+5976>>2]|0;m=c[a+6784>>2]|0;n=b- +h[a+16>>3];o=d- +h[a+24>>3];if((l|0)>=0){p=0;while(1){q=l-p|0;r=+h[a+(q*80|0)+(p<<3)+5984>>3];s=j+(p<<3)|0;h[s>>3]=r;if((p|0)>0){t=p;u=r;do{t=t+ -1|0;u=o*u+ +h[a+(q*80|0)+(t<<3)+5984>>3]}while((t|0)>0);h[s>>3]=u}if((p|0)==(l|0)){break}else{p=p+1|0}}r=+h[j>>3];if((l|0)>0){p=l+1|0;t=l;v=r;while(1){w=n*v+ +h[j+(p-t<<3)>>3];l=t+ -1|0;if((l|0)>0){t=l;v=w}else{x=j;y=w;break}}}else{x=j;y=r}}else{x=j;y=0.0}h[e>>3]=y;if((m|0)>=0){t=0;while(1){p=m-t|0;y=+h[a+(p*80|0)+(t<<3)+6792>>3];l=j+(t<<3)|0;h[l>>3]=y;if((t|0)>0){q=t;r=y;do{q=q+ -1|0;r=o*r+ +h[a+(p*80|0)+(q<<3)+6792>>3]}while((q|0)>0);h[l>>3]=r}if((t|0)==(m|0)){break}else{t=t+1|0}}o=+h[x>>3];if((m|0)>0){t=m+1|0;a=m;u=o;while(1){y=n*u+ +h[j+(t-a<<3)>>3];m=a+ -1|0;if((m|0)>0){a=m;u=y}else{z=y;break}}}else{z=o}}else{z=+h[x>>3]}h[f>>3]=z;h[e>>3]=+h[e>>3]+b;k=+h[f>>3]+d;h[f>>3]=k;i=g;return}function $e(a,b){a=a|0;b=b|0;var d=0,e=0;d=i;if((Dg(b|0)|0)<9){c[a+5968>>2]=0;i=d;return}e=a+5968|0;if((Ag(b+8|0,12640,4)|0)==0){c[e>>2]=1;i=d;return}else{c[e>>2]=0;i=d;return}}function af(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0.0,k=0.0,l=0,m=0,n=0,o=0.0,p=0.0,q=0.0,r=0.0,s=0.0;e=i;i=i+16|0;f=e;c[3162]=0;g=(d|0)==0;h=b;while(1){if((a[h]|0)==32){h=h+1|0}else{break}}b=g?f:d;j=+wg(h,b);d=c[b>>2]|0;if(($f(h,46)|0)!=0){c[3162]=46}f=a[d]|0;g=f<<24>>24;switch(f<<24>>24){case 32:case 58:case 100:case 104:case 109:{break};default:{k=j;i=e;return+k}}l=d;if((l-h|0)>=5){k=j;i=e;return+k}m=d+1|0;n=a[m]|0;if(!(((n<<24>>24)+ -48|0)>>>0<10)){if(!(n<<24>>24==32)){k=j;i=e;return+k}if(!(((a[d+2|0]|0)+ -48|0)>>>0<10)){k=j;i=e;return+k}}c[3162]=g;c[b>>2]=m;if((a[h]|0)==45){o=-j;p=-1.0}else{o=j;p=1.0}j=+wg(m,b);do{if(!(f<<24>>24==109)){m=c[b>>2]|0;h=a[m]|0;if(h<<24>>24==32|h<<24>>24==58|h<<24>>24==109?(m-l|0)<4:0){h=m+1|0;g=a[h]|0;if(!(((g<<24>>24)+ -48|0)>>>0<10)){if(!(g<<24>>24==32)){q=o;r=j;s=0.0;break}if(!(((a[m+2|0]|0)+ -48|0)>>>0<10)){q=o;r=j;s=0.0;break}}c[b>>2]=h;q=o;r=j;s=+wg(h,b)}else{q=o;r=j;s=0.0}}else{q=0.0;r=o;s=j}}while(0);k=p*(q+r/60.0+s/3600.0);i=e;return+k}function bf(a,b,d,e,f,j,l,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;l=+l;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0.0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0;o=i;i=i+48|0;p=o;q=o+36|0;r=o+32|0;s=l;c[r>>2]=0;if((c[58]|0)!=0){c[p>>2]=b;c[p+4>>2]=d;c[p+8>>2]=e;t=p+12|0;h[k>>3]=s;c[t>>2]=c[k>>2];c[t+4>>2]=c[k+4>>2];c[p+20>>2]=m;c[p+24>>2]=n;Ma(12656,p|0)|0}t=cf(a,e,r,b,d,m,n)|0;n=c[r>>2]|0;Zf(n,t,4,4);l=+g[n>>2];u=+g[n+(t+ -1<<2)>>2];r=t+1|0;if((r|0)<2){v=1}else{v=(r|0)/2|0}r=v+ -1|0;m=n+(r<<2)|0;w=+g[m>>2];if(((t|0)%2|0|0)!=1&(v|0)<(t|0)){x=(w+ +g[n+(v<<2)>>2])*.5}else{x=w}w=+(t|0);d=~~(w*.5);b=(d|0)<5?5:d;d=~~(w*.01+.5);e=(d|0)<1?1:d;d=df(n,t,o+40|0,q,2.5,e,5)|0;if((d|0)<(b|0)){g[f>>2]=l;y=u}else{w=+g[q>>2];if(s>0.0){z=w/s;g[q>>2]=z;A=z}else{A=w}w=x- +(r|0)*A;g[f>>2]=l>w?l:w;w=x+ +(t-v|0)*A;y=u
>>0){r=l;s=m}else{c[e>>2]=l-q;c[g>>2]=q;if((m|0)>-1){t=(c[k>>2]|0)+m|0}else{t=0}Sf(a,t,f,0);c[h>>2]=c[g>>2];m=c[a>>2]|0;q=m+28|0;l=c[q>>2]|0;u=c[l+20>>2]|0;v=m+16|0;w=c[v>>2]|0;x=u>>>0>w>>>0?w:u;if((x|0)!=0?(u=m+12|0,Kg(c[u>>2]|0,c[l+16>>2]|0,x|0)|0,c[u>>2]=(c[u>>2]|0)+x,u=(c[q>>2]|0)+16|0,c[u>>2]=(c[u>>2]|0)+x,u=m+20|0,c[u>>2]=(c[u>>2]|0)+x,c[v>>2]=(c[v>>2]|0)-x,v=c[q>>2]|0,q=v+20|0,u=c[q>>2]|0,c[q>>2]=u-x,(u|0)==(x|0)):0){c[v+16>>2]=c[v+8>>2]}if((c[(c[a>>2]|0)+16>>2]|0)==0){n=0;o=28;break}r=c[g>>2]|0;s=c[h>>2]|0}v=r-s|0;if(v>>>0<((c[j>>2]|0)+ -262|0)>>>0){continue}if((s|0)>-1){y=(c[k>>2]|0)+s|0}else{y=0}Sf(a,y,v,0);c[h>>2]=c[g>>2];v=c[a>>2]|0;x=v+28|0;u=c[x>>2]|0;q=c[u+20>>2]|0;m=v+16|0;l=c[m>>2]|0;w=q>>>0>l>>>0?l:q;if((w|0)!=0?(q=v+12|0,Kg(c[q>>2]|0,c[u+16>>2]|0,w|0)|0,c[q>>2]=(c[q>>2]|0)+w,q=(c[x>>2]|0)+16|0,c[q>>2]=(c[q>>2]|0)+w,q=v+20|0,c[q>>2]=(c[q>>2]|0)+w,c[m>>2]=(c[m>>2]|0)-w,m=c[x>>2]|0,x=m+20|0,q=c[x>>2]|0,c[x>>2]=q-w,(q|0)==(w|0)):0){c[m+16>>2]=c[m+8>>2]}if((c[(c[a>>2]|0)+16>>2]|0)==0){n=0;o=28;break}}if((o|0)==20){y=c[h>>2]|0;if((y|0)>-1){z=(c[k>>2]|0)+y|0}else{z=0}k=(b|0)==4;Sf(a,z,(c[g>>2]|0)-y|0,k&1);c[h>>2]=c[g>>2];g=c[a>>2]|0;h=g+28|0;y=c[h>>2]|0;z=c[y+20>>2]|0;b=g+16|0;s=c[b>>2]|0;j=z>>>0>s>>>0?s:z;if((j|0)!=0?(z=g+12|0,Kg(c[z>>2]|0,c[y+16>>2]|0,j|0)|0,c[z>>2]=(c[z>>2]|0)+j,z=(c[h>>2]|0)+16|0,c[z>>2]=(c[z>>2]|0)+j,z=g+20|0,c[z>>2]=(c[z>>2]|0)+j,c[b>>2]=(c[b>>2]|0)-j,b=c[h>>2]|0,h=b+20|0,z=c[h>>2]|0,c[h>>2]=z-j,(z|0)==(j|0)):0){c[b+16>>2]=c[b+8>>2]}if((c[(c[a>>2]|0)+16>>2]|0)==0){n=k?2:0;i=d;return n|0}else{n=k?3:1;i=d;return n|0}}else if((o|0)==28){i=d;return n|0}return 0}function of(e,f){e=e|0;f=f|0;var 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,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=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;g=i;h=e+116|0;j=(f|0)==0;k=e+72|0;l=e+88|0;m=e+108|0;n=e+56|0;o=e+84|0;p=e+68|0;q=e+52|0;r=e+64|0;s=e+44|0;t=e+96|0;u=e+112|0;v=e+5792|0;w=e+5796|0;x=e+5784|0;y=e+5788|0;z=e+128|0;A=e+92|0;while(1){if((c[h>>2]|0)>>>0<262){mf(e);B=c[h>>2]|0;if(B>>>0<262&j){C=0;D=34;break}if((B|0)==0){D=26;break}if(!(B>>>0>2)){D=9}else{D=6}}else{D=6}if((D|0)==6){D=0;B=c[m>>2]|0;E=((d[(c[n>>2]|0)+(B+2)|0]|0)^c[k>>2]<
>>0){l=C;z=A}else{B=A;break}}z=B-v|0;l=z+258|0;if((l|0)>(d|0)){c[m>>2]=x;if((l|0)>=(s|0)){D=l;E=20;break}F=l;G=a[h+(l+j)|0]|0;H=a[h+(w+z)|0]|0}else{F=d;G=g;H=b}}else{F=d;G=g;H=b}z=e[n+((x&p)<<1)>>1]|0;if(!(z>>>0>o>>>0)){D=F;E=20;break}l=y+ -1|0;if((l|0)==0){D=F;E=20;break}else{x=z;d=F;y=l;g=G;b=H}}if((E|0)==20){i=f;return(D>>>0>r>>>0?r:D)|0}return 0}function rf(a){a=a|0;var b=0,d=0;b=i;do{if((a|0)!=0){if((c[a>>2]|0)==7247){d=Af(a)|0;break}else{d=Ff(a)|0;break}}else{d=-2}}while(0);i=b;return d|0}function sf(a,b){a=a|0;b=b|0;var c=0,d=0;c=i;d=tf(a,-1,b)|0;i=c;return d|0}function tf(b,d,e){b=b|0;d=d|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;f=i;i=i+16|0;g=f;h=gg(140)|0;if((h|0)==0){j=0;i=f;return j|0}c[h+16>>2]=0;c[h+20>>2]=8192;k=h+80|0;c[k>>2]=0;c[h>>2]=0;l=h+60|0;c[l>>2]=-1;m=h+64|0;c[m>>2]=0;n=a[e]|0;if(!(n<<24>>24==0)){o=e;e=n;n=0;a:while(1){p=e<<24>>24;b:do{if((e+ -48<<24>>24&255)<10){c[l>>2]=p+ -48;q=n}else{switch(p|0){case 70:{c[m>>2]=4;q=n;break b;break};case 43:{r=9;break a;break};case 82:{c[m>>2]=3;q=n;break b;break};case 102:{c[m>>2]=1;q=n;break b;break};case 104:{c[m>>2]=2;q=n;break b;break};case 119:{c[h>>2]=31153;q=31153;break b;break};case 97:{c[h>>2]=1;q=1;break b;break};case 114:{c[h>>2]=7247;q=7247;break b;break};default:{q=n;break b}}}}while(0);o=o+1|0;e=a[o]|0;if(e<<24>>24==0){break}else{n=q}}if((r|0)==9){hg(h);j=0;i=f;return j|0}if((q|0)!=0){q=gg((Dg(b|0)|0)+1|0)|0;r=h+8|0;c[r>>2]=q;if((q|0)==0){hg(h);j=0;i=f;return j|0}Lg(q|0,b|0)|0;if((d|0)==-1){q=c[h>>2]|0;if((q|0)==7247){s=32768}else{s=(q|0)==31153?33345:33857}c[g>>2]=438;q=Aa(b|0,s|0,g|0)|0;c[h+4>>2]=q;if((q|0)==-1){hg(c[r>>2]|0);hg(h);j=0;i=f;return j|0}else{t=q}}else{c[h+4>>2]=d;t=d}d=c[h>>2]|0;if((d|0)==1){c[h>>2]=31153}else if((d|0)==7247?(d=ra(t|0,0,1)|0,c[h+44>>2]=(d|0)==-1?0:d,(c[h>>2]|0)==7247):0){c[h+36>>2]=0;c[h+40>>2]=0;c[h+52>>2]=0;c[h+56>>2]=1}c[h+72>>2]=0;d=c[k>>2]|0;t=h+76|0;if((d|0)!=0){if(!((c[t>>2]|0)==-4)){hg(d)}c[k>>2]=0}c[t>>2]=0;c[h+12>>2]=0;c[h+88>>2]=0;j=h;i=f;return j|0}}hg(h);j=0;i=f;return j|0}function uf(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,p=0,q=0,r=0,s=0;e=i;if((a|0)==0){f=-1;i=e;return f|0}g=c[a>>2]|0;if(!((g|0)==31153|(g|0)==7247)){f=-1;i=e;return f|0}h=a+76|0;if((c[h>>2]|0)!=0|d>>>0>1){f=-1;i=e;return f|0}if((d|0)!=0){d=a+72|0;if((c[d>>2]|0)==0){j=b;k=d}else{j=(c[a+68>>2]|0)+b|0;k=d}}else{j=b-(c[a+12>>2]|0)|0;k=a+72|0}c[k>>2]=0;b=(g|0)==7247;if((b?(c[a+52>>2]|0)==1:0)?(d=a+12|0,((c[d>>2]|0)+j|0)>=(c[a+48>>2]|0)):0){l=a+36|0;if((ra(c[a+4>>2]|0,j-(c[l>>2]|0)|0,1)|0)==-1){f=-1;i=e;return f|0}c[l>>2]=0;c[a+40>>2]=0;c[k>>2]=0;l=a+80|0;m=c[l>>2]|0;if((m|0)!=0){if(!((c[h>>2]|0)==-4)){hg(m)}c[l>>2]=0}c[h>>2]=0;c[a+88>>2]=0;l=(c[d>>2]|0)+j|0;c[d>>2]=l;f=l;i=e;return f|0}if((j|0)<0){if(!b){f=-1;i=e;return f|0}b=a+12|0;l=(c[b>>2]|0)+j|0;if((l|0)<0){f=-1;i=e;return f|0}if((ra(c[a+4>>2]|0,c[a+44>>2]|0,0)|0)==-1){f=-1;i=e;return f|0}d=c[a>>2]|0;if((d|0)==7247){c[a+36>>2]=0;c[a+40>>2]=0;c[a+52>>2]=0;c[a+56>>2]=1}c[k>>2]=0;m=a+80|0;n=c[m>>2]|0;if((n|0)==0){o=d}else{if((c[h>>2]|0)==-4){p=d}else{hg(n);p=c[a>>2]|0}c[m>>2]=0;o=p}c[h>>2]=0;c[b>>2]=0;c[a+88>>2]=0;q=l;r=o}else{q=j;r=g}if((r|0)==7247){r=a+36|0;g=c[r>>2]|0;j=(g|0)<0|(g|0)>(q|0)?q:g;c[r>>2]=g-j;g=a+32|0;c[g>>2]=(c[g>>2]|0)+j;g=a+12|0;c[g>>2]=j+(c[g>>2]|0);s=q-j|0}else{s=q}if((s|0)!=0){c[k>>2]=1;c[a+68>>2]=s}f=(c[a+12>>2]|0)+s|0;i=e;return f|0}function vf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;g=b+80|0;h=c[g>>2]|0;j=b+76|0;if((h|0)!=0){if(!((c[j>>2]|0)==-4)){hg(h)}c[g>>2]=0}c[j>>2]=d;if((e|0)==0){i=f;return}if((d|0)==-4){c[g>>2]=e;i=f;return}d=c[b+8>>2]|0;b=Dg(d|0)|0;h=gg(b+3+(Dg(e|0)|0)|0)|0;c[g>>2]=h;if((h|0)==0){c[j>>2]=-4;c[g>>2]=21280;i=f;return}else{Lg(h|0,d|0)|0;d=c[g>>2]|0;h=d+(Dg(d|0)|0)|0;a[h+0|0]=a[21296|0]|0;a[h+1|0]=a[21297|0]|0;a[h+2|0]=a[21298|0]|0;Fg(c[g>>2]|0,e|0)|0;i=f;return}}function wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=i;e=uf(a,b,c)|0;i=d;return e|0}function xf(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,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;e=i;if((a|0)==0){f=-1;i=e;return f|0}if((c[a>>2]|0)!=7247){f=-1;i=e;return f|0}if((c[a+76>>2]|0)!=0){f=-1;i=e;return f|0}if((d|0)<0){vf(a,-5,21304);f=-1;i=e;return f|0}if((d|0)==0){f=0;i=e;return f|0}g=a+72|0;a:do{if((c[g>>2]|0)!=0){c[g>>2]=0;h=c[a+68>>2]|0;j=a+36|0;k=a+40|0;l=a+88|0;m=a+32|0;n=a+12|0;if((h|0)!=0){o=a+52|0;p=a+28|0;q=a+16|0;r=a+4|0;s=a+100|0;t=a+96|0;u=h;b:while(1){c:while(1){v=c[j>>2]|0;while(1){if((v|0)!=0){break c}if((c[k>>2]|0)!=0?(c[l>>2]|0)==0:0){w=j;x=k;y=m;z=l;A=n;break a}h=c[o>>2]|0;if((h|0)!=0){B=h;break}if((zf(a)|0)==-1){f=-1;C=59;break b}h=c[j>>2]|0;if((h|0)==0){C=21;break}else{v=h}}if((C|0)==21){C=0;B=c[o>>2]|0}if((B|0)==2){c[s>>2]=c[q>>2]<<1;c[t>>2]=c[p>>2];if((yf(a)|0)==-1){f=-1;C=59;break b}else{continue}}else if((B|0)!=1){continue}h=c[p>>2]|0;D=c[q>>2]<<1;c[j>>2]=0;E=0;do{F=Za(c[r>>2]|0,h+E|0,D-E|0)|0;if((F|0)<1){C=26;break}E=(c[j>>2]|0)+F|0;c[j>>2]=E}while(E>>>0
>>0);if((C|0)==44){C=0;if((N|0)<0){C=46;break d}c[x>>2]=1}c[y>>2]=c[F>>2];K=r;L=b;M=d}else{s=q>>>0>b>>>0?b:q;Kg(r|0,c[y>>2]|0,s|0)|0;c[y>>2]=(c[y>>2]|0)+s;c[w>>2]=(c[w>>2]|0)-s;I=s;C=57}}while(0);if((C|0)==57){C=0;c[A>>2]=(c[A>>2]|0)+I;K=r+I|0;L=b-I|0;M=I+d|0}if((L|0)==0){f=M;C=59;break}else{r=K;b=L;d=M}}if((C|0)==46){vf(a,-1,db(c[(Sa()|0)>>2]|0)|0);f=-1;i=e;return f|0}else if((C|0)==54){vf(a,-1,db(c[(Sa()|0)>>2]|0)|0);f=-1;i=e;return f|0}else if((C|0)==59){i=e;return f|0}return 0}function yf(a){a=a|0;var b=0,d=0,e=0,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;b=i;i=i+16|0;d=b+4|0;e=b;f=a+84|0;g=a+100|0;h=c[g>>2]|0;j=a+88|0;k=a+76|0;l=a+40|0;m=a+24|0;n=a+16|0;o=a+4|0;p=a+84|0;while(1){if((c[j>>2]|0)==0){if((c[k>>2]|0)!=0){q=-1;r=27;break}if((c[l>>2]|0)!=0){r=12;break}s=c[m>>2]|0;t=c[n>>2]|0;c[j>>2]=0;u=0;while(1){v=Za(c[o>>2]|0,s+u|0,t-u|0)|0;if((v|0)<1){r=8;break}w=(c[j>>2]|0)+v|0;c[j>>2]=w;if(w>>>0>>0){w=j}else{B=j;break}}do{if((s|0)==40){if((A|0)<0){vf(b,-1,db(c[(Sa()|0)>>2]|0)|0);break a}else{c[y>>2]=1;B=c[o>>2]|0;break}}}while(0);y=c[l>>2]|0;c[b+84>>2]=y;if((B|0)!=0){C=B;D=y;s=44}}}else{C=u;D=z;s=44}}while(0);if((s|0)==44?(z=C+ -1|0,c[o>>2]=z,C=D+1|0,c[f>>2]=C,(a[D]|0)==8):0){b:do{if((z|0)==0){if((c[b+76>>2]|0)==0?(D=b+40|0,(c[D>>2]|0)==0):0){u=b+24|0;B=c[u>>2]|0;A=c[g>>2]|0;c[o>>2]=0;y=b+4|0;w=0;while(1){E=Za(c[y>>2]|0,B+w|0,A-w|0)|0;if((E|0)<1){s=52;break}q=(c[o>>2]|0)+E|0;c[o>>2]=q;if(q>>>0>>0){w=q}else{F=q;break}}do{if((s|0)==52){if((E|0)<0){vf(b,-1,db(c[(Sa()|0)>>2]|0)|0);break b}else{c[D>>2]=1;F=c[o>>2]|0;break}}}while(0);D=c[u>>2]|0;c[b+84>>2]=D;if((F|0)!=0){G=F;H=D;s=56}}}else{G=z;H=C;s=56}}while(0);if((s|0)==56?(C=G+ -1|0,c[o>>2]=C,G=H+1|0,c[f>>2]=G,z=d[H]|0,(z&224|0)==0):0){c:do{if((C|0)==0){H=b+76|0;if((c[H>>2]|0)==0){F=b+40|0;if((c[F>>2]|0)==0){E=b+24|0;D=c[E>>2]|0;w=c[g>>2]|0;c[o>>2]=0;A=b+4|0;B=0;while(1){I=Za(c[A>>2]|0,D+B|0,w-B|0)|0;if((I|0)<1){s=64;break}y=(c[o>>2]|0)+I|0;c[o>>2]=y;if(y>>>0
>>0){K=J}else{V=J;break}}do{if((s|0)==88){if((U|0)<0){vf(b,-1,db(c[(Sa()|0)>>2]|0)|0);W=c[o>>2]|0;s=93;break e}else{c[R>>2]=1;V=c[o>>2]|0;break}}}while(0);c[b+84>>2]=c[N>>2];if((V|0)!=0){T=V;s=92}else{X=S;s=95}}else{X=S;s=95}}else{s=94}}}while(0);if((s|0)==92){S=T+ -1|0;c[o>>2]=S;c[f>>2]=(c[f>>2]|0)+1;W=S;s=93}if((s|0)==93){if((W|0)==0){s=94}else{Y=W;s=104}}if((s|0)==94){X=b+76|0;s=95}f:do{if((s|0)==95){if((c[X>>2]|0)==0){W=b+40|0;if((c[W>>2]|0)==0){S=b+24|0;T=c[S>>2]|0;V=c[g>>2]|0;c[o>>2]=0;U=b+4|0;R=0;while(1){Z=Za(c[U>>2]|0,T+R|0,V-R|0)|0;if((Z|0)<1){s=100;break}K=(c[o>>2]|0)+Z|0;c[o>>2]=K;if(K>>>0
>>Y;ea=ia;fa=(ha&(1<>>0){H=Ga;I=Ha;J=Ia;j=Ja}else{Ta=Ga;Ua=Ha;Va=Ia;Wa=Ja;break}}do{if((U|0)==22){c[e+24>>2]=21672;c[h>>2]=29;Ta=Ea;Ua=Da;Va=Ca;Wa=j}else if((U|0)==52){c[e+24>>2]=21704;c[h>>2]=29;Ta=pa;Ua=oa;Va=la;Wa=j}else if((U|0)==55){if((R&32|0)==0){c[e+24>>2]=21728;c[h>>2]=29;Ta=S;Ua=T;Va=M;Wa=j;break}else{c[h>>2]=11;Ta=S;Ua=T;Va=M;Wa=j;break}}}while(0);j=Ta>>>3;M=Va+(0-j)|0;T=Ta-(j<<3)|0;Ta=(1<
>>0){Ya=q-Wa|0;Za=Ya+257|0;c[o>>2]=Za;c[u>>2]=Ta;c[v>>2]=T;i=g;return}else{Ya=q-Wa|0;Za=Ya+257|0;c[o>>2]=Za;c[u>>2]=Ta;c[v>>2]=T;i=g;return}}function Hf(a){a=a|0;var b=0,d=0,e=0;b=i;if((a|0)==0){d=-2;i=b;return d|0}e=c[a+28>>2]|0;if((e|0)==0){d=-2;i=b;return d|0}c[e+28>>2]=0;c[a+20>>2]=0;c[a+8>>2]=0;c[a+24>>2]=0;c[a+48>>2]=1;c[e>>2]=0;c[e+4>>2]=0;c[e+12>>2]=0;c[e+20>>2]=32768;c[e+32>>2]=0;c[e+40>>2]=0;c[e+44>>2]=0;c[e+48>>2]=0;c[e+56>>2]=0;c[e+60>>2]=0;a=e+1328|0;c[e+108>>2]=a;c[e+80>>2]=a;c[e+76>>2]=a;c[e+7104>>2]=1;c[e+7108>>2]=-1;d=0;i=b;return d|0}function If(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;if((a|0)==0){e=-2;i=d;return e|0}f=a+28|0;g=c[f>>2]|0;if((g|0)==0){e=-2;i=d;return e|0}if((b|0)<0){h=0-b|0;j=0}else{h=(b|0)<48?b&15:b;j=(b>>4)+1|0}if((h|0)!=0&(h+ -8|0)>>>0>7){e=-2;i=d;return e|0}b=g+52|0;k=c[b>>2]|0;l=g+36|0;if((k|0)!=0?(c[l>>2]|0)!=(h|0):0){mb[c[a+36>>2]&1](c[a+40>>2]|0,k);c[b>>2]=0}c[g+8>>2]=j;c[l>>2]=h;h=c[f>>2]|0;if((h|0)==0){e=-2;i=d;return e|0}c[h+28>>2]=0;c[a+20>>2]=0;c[a+8>>2]=0;c[a+24>>2]=0;c[a+48>>2]=1;c[h>>2]=0;c[h+4>>2]=0;c[h+12>>2]=0;c[h+20>>2]=32768;c[h+32>>2]=0;c[h+40>>2]=0;c[h+44>>2]=0;c[h+48>>2]=0;c[h+56>>2]=0;c[h+60>>2]=0;a=h+1328|0;c[h+108>>2]=a;c[h+80>>2]=a;c[h+76>>2]=a;c[h+7104>>2]=1;c[h+7108>>2]=-1;e=0;i=d;return e|0}function Jf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;g=i;if((e|0)==0){h=-6;i=g;return h|0}if(!((a[e]|0)==49&(f|0)==56)){h=-6;i=g;return h|0}if((b|0)==0){h=-2;i=g;return h|0}c[b+24>>2]=0;f=b+32|0;e=c[f>>2]|0;if((e|0)==0){c[f>>2]=1;c[b+40>>2]=0;j=1}else{j=e}e=b+36|0;if((c[e>>2]|0)==0){c[e>>2]=1}f=b+40|0;k=kb[j&1](c[f>>2]|0,1,7116)|0;if((k|0)==0){h=-4;i=g;return h|0}j=b+28|0;c[j>>2]=k;c[k+52>>2]=0;l=If(b,d)|0;if((l|0)==0){h=0;i=g;return h|0}mb[c[e>>2]&1](c[f>>2]|0,k);c[j>>2]=0;h=l;i=g;return h|0}function Kf(f,g){f=f|0;g=g|0;var 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,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=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,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0,qb=0,rb=0,sb=0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0,Rb=0,Sb=0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0,yc=0,zc=0,Ac=0,Bc=0,Cc=0,Dc=0,Ec=0,Fc=0,Gc=0,Hc=0,Ic=0,Jc=0,Kc=0,Lc=0,Mc=0,Nc=0,Oc=0,Pc=0,Qc=0,Rc=0,Sc=0,Tc=0,Uc=0,Vc=0,Wc=0,Xc=0,Yc=0,Zc=0,_c=0,$c=0,ad=0,bd=0,cd=0,dd=0,ed=0,fd=0,gd=0,hd=0,id=0,jd=0,kd=0,ld=0,md=0,nd=0,od=0,pd=0,qd=0,rd=0,sd=0,td=0,ud=0,vd=0,wd=0,xd=0,yd=0,zd=0,Ad=0,Bd=0,Cd=0,Dd=0,Ed=0,Fd=0,Gd=0,Hd=0,Id=0,Jd=0,Kd=0,Ld=0,Md=0,Nd=0,Od=0,Pd=0,Qd=0,Rd=0,Sd=0,Td=0,Ud=0,Vd=0,Wd=0,Xd=0,Yd=0,Zd=0,_d=0,$d=0,ae=0,be=0,ce=0,de=0,ee=0,fe=0,ge=0,he=0,ie=0,je=0,ke=0,le=0,me=0,ne=0,oe=0,pe=0,qe=0,re=0,se=0,te=0,ue=0,ve=0,we=0,xe=0,ye=0,ze=0,Ae=0,Be=0,Ce=0,De=0,Ee=0,Fe=0,Ge=0,He=0,Ie=0,Je=0,Ke=0,Le=0,Me=0,Ne=0,Oe=0,Pe=0,Qe=0,Re=0,Se=0,Te=0,Ue=0,Ve=0,We=0,Xe=0,Ye=0,Ze=0,_e=0,$e=0,af=0,bf=0,cf=0,df=0,ef=0,hf=0,jf=0,kf=0,lf=0,mf=0,nf=0,of=0,pf=0,qf=0,rf=0,sf=0,tf=0,uf=0,vf=0,wf=0,xf=0,yf=0,zf=0,Af=0,Bf=0,Cf=0,Df=0,Ef=0,Ff=0,Hf=0,If=0,Jf=0,Kf=0,Mf=0,Of=0,Pf=0,Qf=0,Rf=0,Sf=0,Tf=0,Uf=0,Vf=0,Wf=0,Xf=0,Yf=0,Zf=0,_f=0,$f=0,ag=0,bg=0,cg=0,dg=0,eg=0,fg=0,gg=0,hg=0,ig=0,jg=0,kg=0,lg=0,mg=0,ng=0,og=0,pg=0,qg=0,rg=0,sg=0,tg=0,ug=0,vg=0,wg=0,xg=0,yg=0,zg=0,Ag=0,Bg=0,Cg=0,Dg=0,Eg=0,Fg=0,Gg=0,Hg=0,Ig=0,Jg=0;h=i;i=i+16|0;j=h;if((f|0)==0){k=-2;i=h;return k|0}l=c[f+28>>2]|0;if((l|0)==0){k=-2;i=h;return k|0}m=f+12|0;n=c[m>>2]|0;if((n|0)==0){k=-2;i=h;return k|0}o=c[f>>2]|0;if((o|0)==0?(c[f+4>>2]|0)!=0:0){k=-2;i=h;return k|0}p=c[l>>2]|0;if((p|0)==11){c[l>>2]=12;q=12;r=c[f>>2]|0;s=c[m>>2]|0}else{q=p;r=o;s=n}n=f+16|0;o=c[n>>2]|0;p=f+4|0;t=c[p>>2]|0;u=l+56|0;v=l+60|0;w=l+8|0;x=l+24|0;y=j+1|0;z=l+16|0;A=l+32|0;B=f+24|0;C=l+36|0;D=l+20|0;E=f+48|0;F=l+64|0;G=l+12|0;H=(g+ -5|0)>>>0<2;I=l+4|0;J=l+76|0;K=l+84|0;L=l+80|0;M=l+88|0;N=(g|0)==6;O=l+7108|0;P=l+72|0;Q=l+7112|0;R=l+68|0;S=l+44|0;T=l+7104|0;U=l+48|0;V=l+52|0;W=l+40|0;X=f+20|0;Y=l+28|0;Z=l+96|0;_=l+100|0;$=l+92|0;aa=l+104|0;ba=l+1328|0;ca=l+108|0;da=l+112|0;ea=l+752|0;fa=l+624|0;ga=j+2|0;ha=j+3|0;ia=q;q=c[v>>2]|0;ja=t;ka=c[u>>2]|0;la=o;ma=r;r=o;o=s;s=0;a:while(1){b:do{switch(ia|0){case 28:{na=q;oa=ja;pa=ka;qa=la;ra=ma;sa=1;ta=285;break a;break};case 16:{if(q>>>0<14){ua=q;va=ja;wa=ka;xa=ma;while(1){if((va|0)==0){ya=ua;za=0;Aa=wa;Ba=la;Ca=xa;Da=r;Ea=s;break a}Ga=va+ -1|0;Ha=xa+1|0;Ia=(d[xa]<
>>0){p=u}else{v=u;break}}}else{v=1}}while(0);p=r>>>0
>>0){I=S;K=F;O=1<
>>0){I=W;K=V;O=P<<1}else{U=V;break}}}else{U=F}}while(0);F=(1<>>0>851|w&F>>>0>591){t=1;s=56;break}a[(c[h>>2]|0)+(T<<2)|0]=U;a[(c[h>>2]|0)+(T<<2)+1|0]=o;x=c[h>>2]|0;b[x+(T<<2)+2>>1]=(G-x|0)>>>2;d=U;n=H;u=Q;r=S;v=T;C=G;D=R;E=F}if((s|0)==56){i=l;return t|0}d:do{if((Q|0)!=0){s=n;R=J;D=Q;T=q;S=C;while(1){if((s|0)!=0){if((D&g|0)==(v|0)){X=s;Y=R;Z=T;_=S}else{X=0;Y=o;Z=p;_=c[h>>2]|0}}else{X=0;Y=R;Z=T;_=S}r=D>>>X;a[_+(r<<2)|0]=64;a[_+(r<<2)+1|0]=Y;b[_+(r<<2)+2>>1]=0;r=1<
>2]=d|3;o=q+d|0;c[q+(d|4)>>2]=n|1;c[q+f>>2]=n;f=c[27664>>2]|0;if((f|0)!=0){r=c[27676>>2]|0;e=f>>>3;f=e<<1;g=27696+(f<<2)|0;m=c[6914]|0;j=1<>>0<(c[27672>>2]|0)>>>0){_a()}s=q+16|0;if((c[s>>2]|0)==(r|0)){c[s>>2]=w}else{c[q+20>>2]=w}if((w|0)==0){break}}if(w>>>0<(c[27672>>2]|0)>>>0){_a()}c[w+24>>2]=q;s=c[r+16>>2]|0;do{if((s|0)!=0){if(s>>>0<(c[27672>>2]|0)>>>0){_a()}else{c[w+16>>2]=s;c[s+24>>2]=w;break}}}while(0);s=c[r+20>>2]|0;if((s|0)!=0){if(s>>>0<(c[27672>>2]|0)>>>0){_a()}else{c[w+20>>2]=s;c[s+24>>2]=w;break}}}}while(0);if(f>>>0<16){q=f+d|0;c[r+4>>2]=q|3;s=r+(q+4)|0;c[s>>2]=c[s>>2]|1}else{c[r+4>>2]=d|3;c[r+(d|4)>>2]=f|1;c[r+(f+d)>>2]=f;s=c[27664>>2]|0;if((s|0)!=0){q=c[27676>>2]|0;j=s>>>3;s=j<<1;g=27696+(s<<2)|0;o=c[6914]|0;m=1<>>0<(c[27672>>2]|0)>>>0){_a()}s=f+16|0;if((c[s>>2]|0)==(N|0)){c[s>>2]=O}else{c[f+20>>2]=O}if((O|0)==0){break}}if(O>>>0<(c[27672>>2]|0)>>>0){_a()}c[O+24>>2]=f;s=c[N+16>>2]|0;do{if((s|0)!=0){if(s>>>0<(c[27672>>2]|0)>>>0){_a()}else{c[O+16>>2]=s;c[s+24>>2]=O;break}}}while(0);s=c[N+20>>2]|0;if((s|0)!=0){if(s>>>0<(c[27672>>2]|0)>>>0){_a()}else{c[O+20>>2]=s;c[s+24>>2]=O;break}}}}while(0);b:do{if(!(M>>>0<16)){c[N+4>>2]=q|3;c[N+(q|4)>>2]=M|1;c[N+(M+q)>>2]=M;f=M>>>3;if(M>>>0<256){s=f<<1;k=27696+(s<<2)|0;r=c[6914]|0;h=1<>>16&4;r=h<>>0){_a()}if(m>>>0>>0){_a()}else{c[m+12>>2]=e;c[r>>2]=e;c[N+(q+8)>>2]=m;c[N+(q+12)>>2]=W;c[N+(q+24)>>2]=0;break}}else{m=M+q|0;c[N+4>>2]=m|3;r=N+(m+4)|0;c[r>>2]=c[r>>2]|1}}while(0);p=N+8|0;i=b;return p|0}else{B=q}}else{B=q}}else{B=-1}}}while(0);N=c[27664>>2]|0;if(!(B>>>0>N>>>0)){M=N-B|0;W=c[27676>>2]|0;if(M>>>0>15){c[27676>>2]=W+B;c[27664>>2]=M;c[W+(B+4)>>2]=M|1;c[W+N>>2]=M;c[W+4>>2]=B|3}else{c[27664>>2]=0;c[27676>>2]=0;c[W+4>>2]=N|3;M=W+(N+4)|0;c[M>>2]=c[M>>2]|1}p=W+8|0;i=b;return p|0}W=c[27668>>2]|0;if(B>>>0