//==============================================================================// Optimizer tool. This is meant to be run after the emscripten compiler has// finished generating code. These optimizations are done on the generated// code to further improve it. Some of the modifications also work in// conjunction with closure compiler.//==============================================================================// *** Environment setup code ***vararguments_=[];varENVIRONMENT_IS_NODE=typeofprocess==='object';varENVIRONMENT_IS_WEB=typeofwindow==='object';varENVIRONMENT_IS_WORKER=typeofimportScripts==='function';varENVIRONMENT_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 nodeprint=function(x){process['stdout'].write(x+'\n');};printErr=function(x){process['stderr'].write(x+'\n');};varnodeFS=require('fs');varnodePath=require('path');read=function(filename){filename=nodePath['normalize'](filename);varret=nodeFS['readFileSync'](filename).toString();// 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).toString();}returnret;};load=function(f){globalEval(read(f));};arguments_=process['argv'].slice(2);}elseif(ENVIRONMENT_IS_SHELL){// Polyfill over SpiderMonkey/V8 differencesif(!this['read']){this['read']=function(f){snarf(f)};}if(typeofscriptArgs!='undefined'){arguments_=scriptArgs;}elseif(typeofarguments!='undefined'){arguments_=arguments;}}elseif(ENVIRONMENT_IS_WEB){this['print']=printErr=function(x){console.log(