libtextsecure.js 1.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649
  1. ;(function() {
  2. /*
  3. * vim: ts=4:sw=4:expandtab
  4. */
  5. ;(function() {
  6. 'use strict';
  7. var registeredFunctions = {};
  8. var Type = {
  9. ENCRYPT_MESSAGE: 1,
  10. INIT_SESSION: 2,
  11. TRANSMIT_MESSAGE: 3,
  12. REBUILD_MESSAGE: 4,
  13. RETRY_SEND_MESSAGE_PROTO: 5
  14. };
  15. window.textsecure = window.textsecure || {};
  16. window.textsecure.replay = {
  17. Type: Type,
  18. registerFunction: function(func, functionCode) {
  19. registeredFunctions[functionCode] = func;
  20. }
  21. };
  22. function ReplayableError(options) {
  23. options = options || {};
  24. this.name = options.name || 'ReplayableError';
  25. this.functionCode = options.functionCode;
  26. this.args = options.args;
  27. }
  28. ReplayableError.prototype = new Error();
  29. ReplayableError.prototype.constructor = ReplayableError;
  30. ReplayableError.prototype.replay = function() {
  31. return registeredFunctions[this.functionCode].apply(window, this.args);
  32. };
  33. function IncomingIdentityKeyError(number, message, key) {
  34. ReplayableError.call(this, {
  35. functionCode : Type.INIT_SESSION,
  36. args : [number, message]
  37. });
  38. this.number = number.split('.')[0];
  39. this.name = 'IncomingIdentityKeyError';
  40. this.message = "The identity of " + this.number + " has changed.";
  41. this.identityKey = key;
  42. }
  43. IncomingIdentityKeyError.prototype = new ReplayableError();
  44. IncomingIdentityKeyError.prototype.constructor = IncomingIdentityKeyError;
  45. function OutgoingIdentityKeyError(number, message, timestamp, identityKey) {
  46. ReplayableError.call(this, {
  47. functionCode : Type.ENCRYPT_MESSAGE,
  48. args : [number, message, timestamp]
  49. });
  50. this.number = number.split('.')[0];
  51. this.name = 'OutgoingIdentityKeyError';
  52. this.message = "The identity of " + this.number + " has changed.";
  53. this.identityKey = identityKey;
  54. }
  55. OutgoingIdentityKeyError.prototype = new ReplayableError();
  56. OutgoingIdentityKeyError.prototype.constructor = OutgoingIdentityKeyError;
  57. function OutgoingMessageError(number, message, timestamp, httpError) {
  58. ReplayableError.call(this, {
  59. functionCode : Type.ENCRYPT_MESSAGE,
  60. args : [number, message, timestamp]
  61. });
  62. this.name = 'OutgoingMessageError';
  63. if (httpError) {
  64. this.code = httpError.code;
  65. this.message = httpError.message;
  66. this.stack = httpError.stack;
  67. }
  68. }
  69. OutgoingMessageError.prototype = new ReplayableError();
  70. OutgoingMessageError.prototype.constructor = OutgoingMessageError;
  71. function SendMessageNetworkError(number, jsonData, httpError, timestamp) {
  72. ReplayableError.call(this, {
  73. functionCode : Type.TRANSMIT_MESSAGE,
  74. args : [number, jsonData, timestamp]
  75. });
  76. this.name = 'SendMessageNetworkError';
  77. this.number = number;
  78. this.code = httpError.code;
  79. this.message = httpError.message;
  80. this.stack = httpError.stack;
  81. }
  82. SendMessageNetworkError.prototype = new ReplayableError();
  83. SendMessageNetworkError.prototype.constructor = SendMessageNetworkError;
  84. function SignedPreKeyRotationError(numbers, message, timestamp) {
  85. ReplayableError.call(this, {
  86. functionCode : Type.RETRY_SEND_MESSAGE_PROTO,
  87. args : [numbers, message, timestamp]
  88. });
  89. this.name = 'SignedPreKeyRotationError';
  90. this.message = "Too many signed prekey rotation failures";
  91. }
  92. SignedPreKeyRotationError.prototype = new ReplayableError();
  93. SignedPreKeyRotationError.prototype.constructor = SignedPreKeyRotationError;
  94. function MessageError(message, httpError) {
  95. ReplayableError.call(this, {
  96. functionCode : Type.REBUILD_MESSAGE,
  97. args : [message]
  98. });
  99. this.name = 'MessageError';
  100. this.code = httpError.code;
  101. this.message = httpError.message;
  102. this.stack = httpError.stack;
  103. }
  104. MessageError.prototype = new ReplayableError();
  105. MessageError.prototype.constructor = MessageError;
  106. function UnregisteredUserError(number, httpError) {
  107. this.name = 'UnregisteredUserError';
  108. this.number = number;
  109. this.code = httpError.code;
  110. this.message = httpError.message;
  111. this.stack = httpError.stack;
  112. }
  113. UnregisteredUserError.prototype = new Error();
  114. UnregisteredUserError.prototype.constructor = UnregisteredUserError;
  115. window.textsecure.UnregisteredUserError = UnregisteredUserError;
  116. window.textsecure.SendMessageNetworkError = SendMessageNetworkError;
  117. window.textsecure.IncomingIdentityKeyError = IncomingIdentityKeyError;
  118. window.textsecure.OutgoingIdentityKeyError = OutgoingIdentityKeyError;
  119. window.textsecure.ReplayableError = ReplayableError;
  120. window.textsecure.OutgoingMessageError = OutgoingMessageError;
  121. window.textsecure.MessageError = MessageError;
  122. window.textsecure.SignedPreKeyRotationError = SignedPreKeyRotationError;
  123. })();
  124. ;(function(){
  125. var Internal = {};
  126. window.libsignal = {};
  127. // The Module object: Our interface to the outside world. We import
  128. // and export values on it, and do the work to get that through
  129. // closure compiler if necessary. There are various ways Module can be used:
  130. // 1. Not defined. We create it here
  131. // 2. A function parameter, function(Module) { ..generated code.. }
  132. // 3. pre-run appended it, var Module = {}; ..generated code..
  133. // 4. External script tag defines var Module.
  134. // We need to do an eval in order to handle the closure compiler
  135. // case, where this code here is minified but Module was defined
  136. // elsewhere (e.g. case 4 above). We also need to check if Module
  137. // already exists (e.g. case 3 above).
  138. // Note that if you want to run closure, and also to use Module
  139. // after the generated code, you will need to define var Module = {};
  140. // before the code. Then that object will be used in the code, and you
  141. // can continue to use Module afterwards as well.
  142. var Module;
  143. if (!Module) Module = (typeof Module !== 'undefined' ? Module : null) || {};
  144. // Sometimes an existing Module object exists with properties
  145. // meant to overwrite the default module functionality. Here
  146. // we collect those properties and reapply _after_ we configure
  147. // the current environment's defaults to avoid having to be so
  148. // defensive during initialization.
  149. var moduleOverrides = {};
  150. for (var key in Module) {
  151. if (Module.hasOwnProperty(key)) {
  152. moduleOverrides[key] = Module[key];
  153. }
  154. }
  155. // The environment setup code below is customized to use Module.
  156. // *** Environment setup code ***
  157. var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
  158. var ENVIRONMENT_IS_WEB = typeof window === 'object';
  159. var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
  160. var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
  161. if (ENVIRONMENT_IS_NODE) {
  162. // Expose functionality in the same simple way that the shells work
  163. // Note that we pollute the global namespace here, otherwise we break in node
  164. if (!Module['print']) Module['print'] = function print(x) {
  165. process['stdout'].write(x + '\n');
  166. };
  167. if (!Module['printErr']) Module['printErr'] = function printErr(x) {
  168. process['stderr'].write(x + '\n');
  169. };
  170. var nodeFS = require('fs');
  171. var nodePath = require('path');
  172. Module['read'] = function read(filename, binary) {
  173. filename = nodePath['normalize'](filename);
  174. var ret = nodeFS['readFileSync'](filename);
  175. // The path is absolute if the normalized version is the same as the resolved.
  176. if (!ret && filename != nodePath['resolve'](filename)) {
  177. filename = path.join(__dirname, '..', 'src', filename);
  178. ret = nodeFS['readFileSync'](filename);
  179. }
  180. if (ret && !binary) ret = ret.toString();
  181. return ret;
  182. };
  183. Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) };
  184. Module['load'] = function load(f) {
  185. globalEval(read(f));
  186. };
  187. if (process['argv'].length > 1) {
  188. Module['thisProgram'] = process['argv'][1].replace(/\\/g, '/');
  189. } else {
  190. Module['thisProgram'] = 'unknown-program';
  191. }
  192. Module['arguments'] = process['argv'].slice(2);
  193. if (typeof module !== 'undefined') {
  194. module['exports'] = Module;
  195. }
  196. process['on']('uncaughtException', function(ex) {
  197. // suppress ExitStatus exceptions from showing an error
  198. if (!(ex instanceof ExitStatus)) {
  199. throw ex;
  200. }
  201. });
  202. }
  203. else if (ENVIRONMENT_IS_SHELL) {
  204. if (!Module['print']) Module['print'] = print;
  205. if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm
  206. if (typeof read != 'undefined') {
  207. Module['read'] = read;
  208. } else {
  209. Module['read'] = function read() { throw 'no read() available (jsc?)' };
  210. }
  211. Module['readBinary'] = function readBinary(f) {
  212. if (typeof readbuffer === 'function') {
  213. return new Uint8Array(readbuffer(f));
  214. }
  215. var data = read(f, 'binary');
  216. assert(typeof data === 'object');
  217. return data;
  218. };
  219. if (typeof scriptArgs != 'undefined') {
  220. Module['arguments'] = scriptArgs;
  221. } else if (typeof arguments != 'undefined') {
  222. Module['arguments'] = arguments;
  223. }
  224. this['Module'] = Module;
  225. }
  226. else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  227. Module['read'] = function read(url) {
  228. var xhr = new XMLHttpRequest();
  229. xhr.open('GET', url, false);
  230. xhr.send(null);
  231. return xhr.responseText;
  232. };
  233. if (typeof arguments != 'undefined') {
  234. Module['arguments'] = arguments;
  235. }
  236. if (typeof console !== 'undefined') {
  237. if (!Module['print']) Module['print'] = function print(x) {
  238. console.log(x);
  239. };
  240. if (!Module['printErr']) Module['printErr'] = function printErr(x) {
  241. console.log(x);
  242. };
  243. } else {
  244. // Probably a worker, and without console.log. We can do very little here...
  245. var TRY_USE_DUMP = false;
  246. if (!Module['print']) Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) {
  247. dump(x);
  248. }) : (function(x) {
  249. // self.postMessage(x); // enable this if you want stdout to be sent as messages
  250. }));
  251. }
  252. if (ENVIRONMENT_IS_WEB) {
  253. window['Module'] = Module;
  254. } else {
  255. Module['load'] = importScripts;
  256. }
  257. }
  258. else {
  259. // Unreachable because SHELL is dependant on the others
  260. throw 'Unknown runtime environment. Where are we?';
  261. }
  262. function globalEval(x) {
  263. eval.call(null, x);
  264. }
  265. if (!Module['load'] && Module['read']) {
  266. Module['load'] = function load(f) {
  267. globalEval(Module['read'](f));
  268. };
  269. }
  270. if (!Module['print']) {
  271. Module['print'] = function(){};
  272. }
  273. if (!Module['printErr']) {
  274. Module['printErr'] = Module['print'];
  275. }
  276. if (!Module['arguments']) {
  277. Module['arguments'] = [];
  278. }
  279. if (!Module['thisProgram']) {
  280. Module['thisProgram'] = './this.program';
  281. }
  282. // *** Environment setup code ***
  283. // Closure helpers
  284. Module.print = Module['print'];
  285. Module.printErr = Module['printErr'];
  286. // Callbacks
  287. Module['preRun'] = [];
  288. Module['postRun'] = [];
  289. // Merge back in the overrides
  290. for (var key in moduleOverrides) {
  291. if (moduleOverrides.hasOwnProperty(key)) {
  292. Module[key] = moduleOverrides[key];
  293. }
  294. }
  295. // === Preamble library stuff ===
  296. // Documentation for the public APIs defined in this file must be updated in:
  297. // site/source/docs/api_reference/preamble.js.rst
  298. // A prebuilt local version of the documentation is available at:
  299. // site/build/text/docs/api_reference/preamble.js.txt
  300. // You can also build docs locally as HTML or other formats in site/
  301. // An online HTML version (which may be of a different version of Emscripten)
  302. // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
  303. //========================================
  304. // Runtime code shared with compiler
  305. //========================================
  306. var Runtime = {
  307. setTempRet0: function (value) {
  308. tempRet0 = value;
  309. },
  310. getTempRet0: function () {
  311. return tempRet0;
  312. },
  313. stackSave: function () {
  314. return STACKTOP;
  315. },
  316. stackRestore: function (stackTop) {
  317. STACKTOP = stackTop;
  318. },
  319. getNativeTypeSize: function (type) {
  320. switch (type) {
  321. case 'i1': case 'i8': return 1;
  322. case 'i16': return 2;
  323. case 'i32': return 4;
  324. case 'i64': return 8;
  325. case 'float': return 4;
  326. case 'double': return 8;
  327. default: {
  328. if (type[type.length-1] === '*') {
  329. return Runtime.QUANTUM_SIZE; // A pointer
  330. } else if (type[0] === 'i') {
  331. var bits = parseInt(type.substr(1));
  332. assert(bits % 8 === 0);
  333. return bits/8;
  334. } else {
  335. return 0;
  336. }
  337. }
  338. }
  339. },
  340. getNativeFieldSize: function (type) {
  341. return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
  342. },
  343. STACK_ALIGN: 16,
  344. getAlignSize: function (type, size, vararg) {
  345. // we align i64s and doubles on 64-bit boundaries, unlike x86
  346. if (!vararg && (type == 'i64' || type == 'double')) return 8;
  347. if (!type) return Math.min(size, 8); // align structures internally to 64 bits
  348. return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
  349. },
  350. dynCall: function (sig, ptr, args) {
  351. if (args && args.length) {
  352. if (!args.splice) args = Array.prototype.slice.call(args);
  353. args.splice(0, 0, ptr);
  354. return Module['dynCall_' + sig].apply(null, args);
  355. } else {
  356. return Module['dynCall_' + sig].call(null, ptr);
  357. }
  358. },
  359. functionPointers: [],
  360. addFunction: function (func) {
  361. for (var i = 0; i < Runtime.functionPointers.length; i++) {
  362. if (!Runtime.functionPointers[i]) {
  363. Runtime.functionPointers[i] = func;
  364. return 2*(1 + i);
  365. }
  366. }
  367. throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
  368. },
  369. removeFunction: function (index) {
  370. Runtime.functionPointers[(index-2)/2] = null;
  371. },
  372. getAsmConst: function (code, numArgs) {
  373. // code is a constant string on the heap, so we can cache these
  374. if (!Runtime.asmConstCache) Runtime.asmConstCache = {};
  375. var func = Runtime.asmConstCache[code];
  376. if (func) return func;
  377. var args = [];
  378. for (var i = 0; i < numArgs; i++) {
  379. args.push(String.fromCharCode(36) + i); // $0, $1 etc
  380. }
  381. var source = Pointer_stringify(code);
  382. if (source[0] === '"') {
  383. // tolerate EM_ASM("..code..") even though EM_ASM(..code..) is correct
  384. if (source.indexOf('"', 1) === source.length-1) {
  385. source = source.substr(1, source.length-2);
  386. } else {
  387. // something invalid happened, e.g. EM_ASM("..code($0)..", input)
  388. abort('invalid EM_ASM input |' + source + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)');
  389. }
  390. }
  391. try {
  392. // Module is the only 'upvar', which we provide directly. We also provide FS for legacy support.
  393. var evalled = eval('(function(Module, FS) { return function(' + args.join(',') + '){ ' + source + ' } })')(Module, typeof FS !== 'undefined' ? FS : null);
  394. } catch(e) {
  395. 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.)');
  396. throw e;
  397. }
  398. return Runtime.asmConstCache[code] = evalled;
  399. },
  400. warnOnce: function (text) {
  401. if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {};
  402. if (!Runtime.warnOnce.shown[text]) {
  403. Runtime.warnOnce.shown[text] = 1;
  404. Module.printErr(text);
  405. }
  406. },
  407. funcWrappers: {},
  408. getFuncWrapper: function (func, sig) {
  409. assert(sig);
  410. if (!Runtime.funcWrappers[sig]) {
  411. Runtime.funcWrappers[sig] = {};
  412. }
  413. var sigCache = Runtime.funcWrappers[sig];
  414. if (!sigCache[func]) {
  415. sigCache[func] = function dynCall_wrapper() {
  416. return Runtime.dynCall(sig, func, arguments);
  417. };
  418. }
  419. return sigCache[func];
  420. },
  421. UTF8Processor: function () {
  422. var buffer = [];
  423. var needed = 0;
  424. this.processCChar = function (code) {
  425. code = code & 0xFF;
  426. if (buffer.length == 0) {
  427. if ((code & 0x80) == 0x00) { // 0xxxxxxx
  428. return String.fromCharCode(code);
  429. }
  430. buffer.push(code);
  431. if ((code & 0xE0) == 0xC0) { // 110xxxxx
  432. needed = 1;
  433. } else if ((code & 0xF0) == 0xE0) { // 1110xxxx
  434. needed = 2;
  435. } else { // 11110xxx
  436. needed = 3;
  437. }
  438. return '';
  439. }
  440. if (needed) {
  441. buffer.push(code);
  442. needed--;
  443. if (needed > 0) return '';
  444. }
  445. var c1 = buffer[0];
  446. var c2 = buffer[1];
  447. var c3 = buffer[2];
  448. var c4 = buffer[3];
  449. var ret;
  450. if (buffer.length == 2) {
  451. ret = String.fromCharCode(((c1 & 0x1F) << 6) | (c2 & 0x3F));
  452. } else if (buffer.length == 3) {
  453. ret = String.fromCharCode(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
  454. } else {
  455. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  456. var codePoint = ((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
  457. ((c3 & 0x3F) << 6) | (c4 & 0x3F);
  458. ret = String.fromCharCode(
  459. (((codePoint - 0x10000) / 0x400)|0) + 0xD800,
  460. (codePoint - 0x10000) % 0x400 + 0xDC00);
  461. }
  462. buffer.length = 0;
  463. return ret;
  464. }
  465. this.processJSString = function processJSString(string) {
  466. /* TODO: use TextEncoder when present,
  467. var encoder = new TextEncoder();
  468. encoder['encoding'] = "utf-8";
  469. var utf8Array = encoder['encode'](aMsg.data);
  470. */
  471. string = unescape(encodeURIComponent(string));
  472. var ret = [];
  473. for (var i = 0; i < string.length; i++) {
  474. ret.push(string.charCodeAt(i));
  475. }
  476. return ret;
  477. }
  478. },
  479. getCompilerSetting: function (name) {
  480. throw 'You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work';
  481. },
  482. stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = (((STACKTOP)+15)&-16); return ret; },
  483. staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = (((STATICTOP)+15)&-16); return ret; },
  484. dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = (((DYNAMICTOP)+15)&-16); if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();; return ret; },
  485. alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 16))*(quantum ? quantum : 16); return ret; },
  486. makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+((low>>>0)))+((+((high>>>0)))*4294967296.0)) : ((+((low>>>0)))+((+((high|0)))*4294967296.0))); return ret; },
  487. GLOBAL_BASE: 8,
  488. QUANTUM_SIZE: 4,
  489. __dummy__: 0
  490. }
  491. Module['Runtime'] = Runtime;
  492. //========================================
  493. // Runtime essentials
  494. //========================================
  495. var __THREW__ = 0; // Used in checking for thrown exceptions.
  496. var ABORT = false; // whether we are quitting the application. no code should run after this. set in exit() and abort()
  497. var EXITSTATUS = 0;
  498. var undef = 0;
  499. // tempInt is used for 32-bit signed values or smaller. tempBigInt is used
  500. // for 32-bit unsigned values or more than 32 bits. TODO: audit all uses of tempInt
  501. var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD, tempDouble, tempFloat;
  502. var tempI64, tempI64b;
  503. var tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9;
  504. function assert(condition, text) {
  505. if (!condition) {
  506. abort('Assertion failed: ' + text);
  507. }
  508. }
  509. var globalScope = this;
  510. // Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
  511. function getCFunc(ident) {
  512. var func = Module['_' + ident]; // closure exported function
  513. if (!func) {
  514. try {
  515. func = eval('_' + ident); // explicit lookup
  516. } catch(e) {}
  517. }
  518. assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)');
  519. return func;
  520. }
  521. var cwrap, ccall;
  522. (function(){
  523. var JSfuncs = {
  524. // Helpers for cwrap -- it can't refer to Runtime directly because it might
  525. // be renamed by closure, instead it calls JSfuncs['stackSave'].body to find
  526. // out what the minified function name is.
  527. 'stackSave': function() {
  528. Runtime.stackSave()
  529. },
  530. 'stackRestore': function() {
  531. Runtime.stackRestore()
  532. },
  533. // type conversion from js to c
  534. 'arrayToC' : function(arr) {
  535. var ret = Runtime.stackAlloc(arr.length);
  536. writeArrayToMemory(arr, ret);
  537. return ret;
  538. },
  539. 'stringToC' : function(str) {
  540. var ret = 0;
  541. if (str !== null && str !== undefined && str !== 0) { // null string
  542. // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
  543. ret = Runtime.stackAlloc((str.length << 2) + 1);
  544. writeStringToMemory(str, ret);
  545. }
  546. return ret;
  547. }
  548. };
  549. // For fast lookup of conversion functions
  550. var toC = {'string' : JSfuncs['stringToC'], 'array' : JSfuncs['arrayToC']};
  551. // C calling interface.
  552. ccall = function ccallFunc(ident, returnType, argTypes, args) {
  553. var func = getCFunc(ident);
  554. var cArgs = [];
  555. var stack = 0;
  556. if (args) {
  557. for (var i = 0; i < args.length; i++) {
  558. var converter = toC[argTypes[i]];
  559. if (converter) {
  560. if (stack === 0) stack = Runtime.stackSave();
  561. cArgs[i] = converter(args[i]);
  562. } else {
  563. cArgs[i] = args[i];
  564. }
  565. }
  566. }
  567. var ret = func.apply(null, cArgs);
  568. if (returnType === 'string') ret = Pointer_stringify(ret);
  569. if (stack !== 0) Runtime.stackRestore(stack);
  570. return ret;
  571. }
  572. var sourceRegex = /^function\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
  573. function parseJSFunc(jsfunc) {
  574. // Match the body and the return value of a javascript function source
  575. var parsed = jsfunc.toString().match(sourceRegex).slice(1);
  576. return {arguments : parsed[0], body : parsed[1], returnValue: parsed[2]}
  577. }
  578. var JSsource = {};
  579. for (var fun in JSfuncs) {
  580. if (JSfuncs.hasOwnProperty(fun)) {
  581. // Elements of toCsource are arrays of three items:
  582. // the code, and the return value
  583. JSsource[fun] = parseJSFunc(JSfuncs[fun]);
  584. }
  585. }
  586. cwrap = function cwrap(ident, returnType, argTypes) {
  587. argTypes = argTypes || [];
  588. var cfunc = getCFunc(ident);
  589. // When the function takes numbers and returns a number, we can just return
  590. // the original function
  591. var numericArgs = argTypes.every(function(type){ return type === 'number'});
  592. var numericRet = (returnType !== 'string');
  593. if ( numericRet && numericArgs) {
  594. return cfunc;
  595. }
  596. // Creation of the arguments list (["$1","$2",...,"$nargs"])
  597. var argNames = argTypes.map(function(x,i){return '$'+i});
  598. var funcstr = "(function(" + argNames.join(',') + ") {";
  599. var nargs = argTypes.length;
  600. if (!numericArgs) {
  601. // Generate the code needed to convert the arguments from javascript
  602. // values to pointers
  603. funcstr += 'var stack = ' + JSsource['stackSave'].body + ';';
  604. for (var i = 0; i < nargs; i++) {
  605. var arg = argNames[i], type = argTypes[i];
  606. if (type === 'number') continue;
  607. var convertCode = JSsource[type + 'ToC']; // [code, return]
  608. funcstr += 'var ' + convertCode.arguments + ' = ' + arg + ';';
  609. funcstr += convertCode.body + ';';
  610. funcstr += arg + '=' + convertCode.returnValue + ';';
  611. }
  612. }
  613. // When the code is compressed, the name of cfunc is not literally 'cfunc' anymore
  614. var cfuncname = parseJSFunc(function(){return cfunc}).returnValue;
  615. // Call the function
  616. funcstr += 'var ret = ' + cfuncname + '(' + argNames.join(',') + ');';
  617. if (!numericRet) { // Return type can only by 'string' or 'number'
  618. // Convert the result to a string
  619. var strgfy = parseJSFunc(function(){return Pointer_stringify}).returnValue;
  620. funcstr += 'ret = ' + strgfy + '(ret);';
  621. }
  622. if (!numericArgs) {
  623. // If we had a stack, restore it
  624. funcstr += JSsource['stackRestore'].body.replace('()', '(stack)') + ';';
  625. }
  626. funcstr += 'return ret})';
  627. return eval(funcstr);
  628. };
  629. })();
  630. Module["cwrap"] = cwrap;
  631. Module["ccall"] = ccall;
  632. function setValue(ptr, value, type, noSafe) {
  633. type = type || 'i8';
  634. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  635. switch(type) {
  636. case 'i1': HEAP8[((ptr)>>0)]=value; break;
  637. case 'i8': HEAP8[((ptr)>>0)]=value; break;
  638. case 'i16': HEAP16[((ptr)>>1)]=value; break;
  639. case 'i32': HEAP32[((ptr)>>2)]=value; break;
  640. case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math_abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? ((Math_min((+(Math_floor((tempDouble)/4294967296.0))), 4294967295.0))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break;
  641. case 'float': HEAPF32[((ptr)>>2)]=value; break;
  642. case 'double': HEAPF64[((ptr)>>3)]=value; break;
  643. default: abort('invalid type for setValue: ' + type);
  644. }
  645. }
  646. Module['setValue'] = setValue;
  647. function getValue(ptr, type, noSafe) {
  648. type = type || 'i8';
  649. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  650. switch(type) {
  651. case 'i1': return HEAP8[((ptr)>>0)];
  652. case 'i8': return HEAP8[((ptr)>>0)];
  653. case 'i16': return HEAP16[((ptr)>>1)];
  654. case 'i32': return HEAP32[((ptr)>>2)];
  655. case 'i64': return HEAP32[((ptr)>>2)];
  656. case 'float': return HEAPF32[((ptr)>>2)];
  657. case 'double': return HEAPF64[((ptr)>>3)];
  658. default: abort('invalid type for setValue: ' + type);
  659. }
  660. return null;
  661. }
  662. Module['getValue'] = getValue;
  663. var ALLOC_NORMAL = 0; // Tries to use _malloc()
  664. var ALLOC_STACK = 1; // Lives for the duration of the current function call
  665. var ALLOC_STATIC = 2; // Cannot be freed
  666. var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk
  667. var ALLOC_NONE = 4; // Do not allocate
  668. Module['ALLOC_NORMAL'] = ALLOC_NORMAL;
  669. Module['ALLOC_STACK'] = ALLOC_STACK;
  670. Module['ALLOC_STATIC'] = ALLOC_STATIC;
  671. Module['ALLOC_DYNAMIC'] = ALLOC_DYNAMIC;
  672. Module['ALLOC_NONE'] = ALLOC_NONE;
  673. // allocate(): This is for internal use. You can use it yourself as well, but the interface
  674. // is a little tricky (see docs right below). The reason is that it is optimized
  675. // for multiple syntaxes to save space in generated code. So you should
  676. // normally not use allocate(), and instead allocate memory using _malloc(),
  677. // initialize it with setValue(), and so forth.
  678. // @slab: An array of data, or a number. If a number, then the size of the block to allocate,
  679. // in *bytes* (note that this is sometimes confusing: the next parameter does not
  680. // affect this!)
  681. // @types: Either an array of types, one for each byte (or 0 if no type at that position),
  682. // or a single type which is used for the entire block. This only matters if there
  683. // is initial data - if @slab is a number, then this does not matter at all and is
  684. // ignored.
  685. // @allocator: How to allocate memory, see ALLOC_*
  686. function allocate(slab, types, allocator, ptr) {
  687. var zeroinit, size;
  688. if (typeof slab === 'number') {
  689. zeroinit = true;
  690. size = slab;
  691. } else {
  692. zeroinit = false;
  693. size = slab.length;
  694. }
  695. var singleType = typeof types === 'string' ? types : null;
  696. var ret;
  697. if (allocator == ALLOC_NONE) {
  698. ret = ptr;
  699. } else {
  700. ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
  701. }
  702. if (zeroinit) {
  703. var ptr = ret, stop;
  704. assert((ret & 3) == 0);
  705. stop = ret + (size & ~3);
  706. for (; ptr < stop; ptr += 4) {
  707. HEAP32[((ptr)>>2)]=0;
  708. }
  709. stop = ret + size;
  710. while (ptr < stop) {
  711. HEAP8[((ptr++)>>0)]=0;
  712. }
  713. return ret;
  714. }
  715. if (singleType === 'i8') {
  716. if (slab.subarray || slab.slice) {
  717. HEAPU8.set(slab, ret);
  718. } else {
  719. HEAPU8.set(new Uint8Array(slab), ret);
  720. }
  721. return ret;
  722. }
  723. var i = 0, type, typeSize, previousType;
  724. while (i < size) {
  725. var curr = slab[i];
  726. if (typeof curr === 'function') {
  727. curr = Runtime.getFunctionIndex(curr);
  728. }
  729. type = singleType || types[i];
  730. if (type === 0) {
  731. i++;
  732. continue;
  733. }
  734. if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later
  735. setValue(ret+i, curr, type);
  736. // no need to look up size unless type changes, so cache it
  737. if (previousType !== type) {
  738. typeSize = Runtime.getNativeTypeSize(type);
  739. previousType = type;
  740. }
  741. i += typeSize;
  742. }
  743. return ret;
  744. }
  745. Module['allocate'] = allocate;
  746. function Pointer_stringify(ptr, /* optional */ length) {
  747. if (length === 0 || !ptr) return '';
  748. // TODO: use TextDecoder
  749. // Find the length, and check for UTF while doing so
  750. var hasUtf = false;
  751. var t;
  752. var i = 0;
  753. while (1) {
  754. t = HEAPU8[(((ptr)+(i))>>0)];
  755. if (t >= 128) hasUtf = true;
  756. else if (t == 0 && !length) break;
  757. i++;
  758. if (length && i == length) break;
  759. }
  760. if (!length) length = i;
  761. var ret = '';
  762. if (!hasUtf) {
  763. var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack
  764. var curr;
  765. while (length > 0) {
  766. curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
  767. ret = ret ? ret + curr : curr;
  768. ptr += MAX_CHUNK;
  769. length -= MAX_CHUNK;
  770. }
  771. return ret;
  772. }
  773. var utf8 = new Runtime.UTF8Processor();
  774. for (i = 0; i < length; i++) {
  775. t = HEAPU8[(((ptr)+(i))>>0)];
  776. ret += utf8.processCChar(t);
  777. }
  778. return ret;
  779. }
  780. Module['Pointer_stringify'] = Pointer_stringify;
  781. function UTF16ToString(ptr) {
  782. var i = 0;
  783. var str = '';
  784. while (1) {
  785. var codeUnit = HEAP16[(((ptr)+(i*2))>>1)];
  786. if (codeUnit == 0)
  787. return str;
  788. ++i;
  789. // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through.
  790. str += String.fromCharCode(codeUnit);
  791. }
  792. }
  793. Module['UTF16ToString'] = UTF16ToString;
  794. function stringToUTF16(str, outPtr) {
  795. for(var i = 0; i < str.length; ++i) {
  796. // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP.
  797. var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
  798. HEAP16[(((outPtr)+(i*2))>>1)]=codeUnit;
  799. }
  800. // Null-terminate the pointer to the HEAP.
  801. HEAP16[(((outPtr)+(str.length*2))>>1)]=0;
  802. }
  803. Module['stringToUTF16'] = stringToUTF16;
  804. function UTF32ToString(ptr) {
  805. var i = 0;
  806. var str = '';
  807. while (1) {
  808. var utf32 = HEAP32[(((ptr)+(i*4))>>2)];
  809. if (utf32 == 0)
  810. return str;
  811. ++i;
  812. // 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.
  813. if (utf32 >= 0x10000) {
  814. var ch = utf32 - 0x10000;
  815. str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
  816. } else {
  817. str += String.fromCharCode(utf32);
  818. }
  819. }
  820. }
  821. Module['UTF32ToString'] = UTF32ToString;
  822. function stringToUTF32(str, outPtr) {
  823. var iChar = 0;
  824. for(var iCodeUnit = 0; iCodeUnit < str.length; ++iCodeUnit) {
  825. // 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.
  826. var codeUnit = str.charCodeAt(iCodeUnit); // possibly a lead surrogate
  827. if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) {
  828. var trailSurrogate = str.charCodeAt(++iCodeUnit);
  829. codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF);
  830. }
  831. HEAP32[(((outPtr)+(iChar*4))>>2)]=codeUnit;
  832. ++iChar;
  833. }
  834. // Null-terminate the pointer to the HEAP.
  835. HEAP32[(((outPtr)+(iChar*4))>>2)]=0;
  836. }
  837. Module['stringToUTF32'] = stringToUTF32;
  838. function demangle(func) {
  839. var hasLibcxxabi = !!Module['___cxa_demangle'];
  840. if (hasLibcxxabi) {
  841. try {
  842. var buf = _malloc(func.length);
  843. writeStringToMemory(func.substr(1), buf);
  844. var status = _malloc(4);
  845. var ret = Module['___cxa_demangle'](buf, 0, 0, status);
  846. if (getValue(status, 'i32') === 0 && ret) {
  847. return Pointer_stringify(ret);
  848. }
  849. // otherwise, libcxxabi failed, we can try ours which may return a partial result
  850. } catch(e) {
  851. // failure when using libcxxabi, we can try ours which may return a partial result
  852. } finally {
  853. if (buf) _free(buf);
  854. if (status) _free(status);
  855. if (ret) _free(ret);
  856. }
  857. }
  858. var i = 3;
  859. // params, etc.
  860. var basicTypes = {
  861. 'v': 'void',
  862. 'b': 'bool',
  863. 'c': 'char',
  864. 's': 'short',
  865. 'i': 'int',
  866. 'l': 'long',
  867. 'f': 'float',
  868. 'd': 'double',
  869. 'w': 'wchar_t',
  870. 'a': 'signed char',
  871. 'h': 'unsigned char',
  872. 't': 'unsigned short',
  873. 'j': 'unsigned int',
  874. 'm': 'unsigned long',
  875. 'x': 'long long',
  876. 'y': 'unsigned long long',
  877. 'z': '...'
  878. };
  879. var subs = [];
  880. var first = true;
  881. function dump(x) {
  882. //return;
  883. if (x) Module.print(x);
  884. Module.print(func);
  885. var pre = '';
  886. for (var a = 0; a < i; a++) pre += ' ';
  887. Module.print (pre + '^');
  888. }
  889. function parseNested() {
  890. i++;
  891. if (func[i] === 'K') i++; // ignore const
  892. var parts = [];
  893. while (func[i] !== 'E') {
  894. if (func[i] === 'S') { // substitution
  895. i++;
  896. var next = func.indexOf('_', i);
  897. var num = func.substring(i, next) || 0;
  898. parts.push(subs[num] || '?');
  899. i = next+1;
  900. continue;
  901. }
  902. if (func[i] === 'C') { // constructor
  903. parts.push(parts[parts.length-1]);
  904. i += 2;
  905. continue;
  906. }
  907. var size = parseInt(func.substr(i));
  908. var pre = size.toString().length;
  909. if (!size || !pre) { i--; break; } // counter i++ below us
  910. var curr = func.substr(i + pre, size);
  911. parts.push(curr);
  912. subs.push(curr);
  913. i += pre + size;
  914. }
  915. i++; // skip E
  916. return parts;
  917. }
  918. function parse(rawList, limit, allowVoid) { // main parser
  919. limit = limit || Infinity;
  920. var ret = '', list = [];
  921. function flushList() {
  922. return '(' + list.join(', ') + ')';
  923. }
  924. var name;
  925. if (func[i] === 'N') {
  926. // namespaced N-E
  927. name = parseNested().join('::');
  928. limit--;
  929. if (limit === 0) return rawList ? [name] : name;
  930. } else {
  931. // not namespaced
  932. if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L'
  933. var size = parseInt(func.substr(i));
  934. if (size) {
  935. var pre = size.toString().length;
  936. name = func.substr(i + pre, size);
  937. i += pre + size;
  938. }
  939. }
  940. first = false;
  941. if (func[i] === 'I') {
  942. i++;
  943. var iList = parse(true);
  944. var iRet = parse(true, 1, true);
  945. ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>';
  946. } else {
  947. ret = name;
  948. }
  949. paramLoop: while (i < func.length && limit-- > 0) {
  950. //dump('paramLoop');
  951. var c = func[i++];
  952. if (c in basicTypes) {
  953. list.push(basicTypes[c]);
  954. } else {
  955. switch (c) {
  956. case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer
  957. case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference
  958. case 'L': { // literal
  959. i++; // skip basic type
  960. var end = func.indexOf('E', i);
  961. var size = end - i;
  962. list.push(func.substr(i, size));
  963. i += size + 2; // size + 'EE'
  964. break;
  965. }
  966. case 'A': { // array
  967. var size = parseInt(func.substr(i));
  968. i += size.toString().length;
  969. if (func[i] !== '_') throw '?';
  970. i++; // skip _
  971. list.push(parse(true, 1, true)[0] + ' [' + size + ']');
  972. break;
  973. }
  974. case 'E': break paramLoop;
  975. default: ret += '?' + c; break paramLoop;
  976. }
  977. }
  978. }
  979. if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void)
  980. if (rawList) {
  981. if (ret) {
  982. list.push(ret + '?');
  983. }
  984. return list;
  985. } else {
  986. return ret + flushList();
  987. }
  988. }
  989. var parsed = func;
  990. try {
  991. // Special-case the entry point, since its name differs from other name mangling.
  992. if (func == 'Object._main' || func == '_main') {
  993. return 'main()';
  994. }
  995. if (typeof func === 'number') func = Pointer_stringify(func);
  996. if (func[0] !== '_') return func;
  997. if (func[1] !== '_') return func; // C function
  998. if (func[2] !== 'Z') return func;
  999. switch (func[3]) {
  1000. case 'n': return 'operator new()';
  1001. case 'd': return 'operator delete()';
  1002. }
  1003. parsed = parse();
  1004. } catch(e) {
  1005. parsed += '?';
  1006. }
  1007. if (parsed.indexOf('?') >= 0 && !hasLibcxxabi) {
  1008. Runtime.warnOnce('warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling');
  1009. }
  1010. return parsed;
  1011. }
  1012. function demangleAll(text) {
  1013. return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') });
  1014. }
  1015. function jsStackTrace() {
  1016. var err = new Error();
  1017. if (!err.stack) {
  1018. // IE10+ special cases: It does have callstack info, but it is only populated if an Error object is thrown,
  1019. // so try that as a special-case.
  1020. try {
  1021. throw new Error(0);
  1022. } catch(e) {
  1023. err = e;
  1024. }
  1025. if (!err.stack) {
  1026. return '(no stack trace available)';
  1027. }
  1028. }
  1029. return err.stack.toString();
  1030. }
  1031. function stackTrace() {
  1032. return demangleAll(jsStackTrace());
  1033. }
  1034. Module['stackTrace'] = stackTrace;
  1035. // Memory management
  1036. var PAGE_SIZE = 4096;
  1037. function alignMemoryPage(x) {
  1038. return (x+4095)&-4096;
  1039. }
  1040. var HEAP;
  1041. var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  1042. var STATIC_BASE = 0, STATICTOP = 0, staticSealed = false; // static area
  1043. var STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0; // stack area
  1044. var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk
  1045. function enlargeMemory() {
  1046. 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.');
  1047. }
  1048. var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880;
  1049. var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216;
  1050. var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152;
  1051. var totalMemory = 64*1024;
  1052. while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) {
  1053. if (totalMemory < 16*1024*1024) {
  1054. totalMemory *= 2;
  1055. } else {
  1056. totalMemory += 16*1024*1024
  1057. }
  1058. }
  1059. if (totalMemory !== TOTAL_MEMORY) {
  1060. Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be compliant with the asm.js spec');
  1061. TOTAL_MEMORY = totalMemory;
  1062. }
  1063. // Initialize the runtime's memory
  1064. // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
  1065. assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
  1066. 'JS engine does not provide full typed array support');
  1067. var buffer = new ArrayBuffer(TOTAL_MEMORY);
  1068. HEAP8 = new Int8Array(buffer);
  1069. HEAP16 = new Int16Array(buffer);
  1070. HEAP32 = new Int32Array(buffer);
  1071. HEAPU8 = new Uint8Array(buffer);
  1072. HEAPU16 = new Uint16Array(buffer);
  1073. HEAPU32 = new Uint32Array(buffer);
  1074. HEAPF32 = new Float32Array(buffer);
  1075. HEAPF64 = new Float64Array(buffer);
  1076. // Endianness check (note: assumes compiler arch was little-endian)
  1077. HEAP32[0] = 255;
  1078. assert(HEAPU8[0] === 255 && HEAPU8[3] === 0, 'Typed arrays 2 must be run on a little-endian system');
  1079. Module['HEAP'] = HEAP;
  1080. Module['buffer'] = buffer;
  1081. Module['HEAP8'] = HEAP8;
  1082. Module['HEAP16'] = HEAP16;
  1083. Module['HEAP32'] = HEAP32;
  1084. Module['HEAPU8'] = HEAPU8;
  1085. Module['HEAPU16'] = HEAPU16;
  1086. Module['HEAPU32'] = HEAPU32;
  1087. Module['HEAPF32'] = HEAPF32;
  1088. Module['HEAPF64'] = HEAPF64;
  1089. function callRuntimeCallbacks(callbacks) {
  1090. while(callbacks.length > 0) {
  1091. var callback = callbacks.shift();
  1092. if (typeof callback == 'function') {
  1093. callback();
  1094. continue;
  1095. }
  1096. var func = callback.func;
  1097. if (typeof func === 'number') {
  1098. if (callback.arg === undefined) {
  1099. Runtime.dynCall('v', func);
  1100. } else {
  1101. Runtime.dynCall('vi', func, [callback.arg]);
  1102. }
  1103. } else {
  1104. func(callback.arg === undefined ? null : callback.arg);
  1105. }
  1106. }
  1107. }
  1108. var __ATPRERUN__ = []; // functions called before the runtime is initialized
  1109. var __ATINIT__ = []; // functions called during startup
  1110. var __ATMAIN__ = []; // functions called when main() is to be run
  1111. var __ATEXIT__ = []; // functions called during shutdown
  1112. var __ATPOSTRUN__ = []; // functions called after the runtime has exited
  1113. var runtimeInitialized = false;
  1114. var runtimeExited = false;
  1115. function preRun() {
  1116. // compatibility - merge in anything from Module['preRun'] at this time
  1117. if (Module['preRun']) {
  1118. if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
  1119. while (Module['preRun'].length) {
  1120. addOnPreRun(Module['preRun'].shift());
  1121. }
  1122. }
  1123. callRuntimeCallbacks(__ATPRERUN__);
  1124. }
  1125. function ensureInitRuntime() {
  1126. if (runtimeInitialized) return;
  1127. runtimeInitialized = true;
  1128. callRuntimeCallbacks(__ATINIT__);
  1129. }
  1130. function preMain() {
  1131. callRuntimeCallbacks(__ATMAIN__);
  1132. }
  1133. function exitRuntime() {
  1134. callRuntimeCallbacks(__ATEXIT__);
  1135. runtimeExited = true;
  1136. }
  1137. function postRun() {
  1138. // compatibility - merge in anything from Module['postRun'] at this time
  1139. if (Module['postRun']) {
  1140. if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
  1141. while (Module['postRun'].length) {
  1142. addOnPostRun(Module['postRun'].shift());
  1143. }
  1144. }
  1145. callRuntimeCallbacks(__ATPOSTRUN__);
  1146. }
  1147. function addOnPreRun(cb) {
  1148. __ATPRERUN__.unshift(cb);
  1149. }
  1150. Module['addOnPreRun'] = Module.addOnPreRun = addOnPreRun;
  1151. function addOnInit(cb) {
  1152. __ATINIT__.unshift(cb);
  1153. }
  1154. Module['addOnInit'] = Module.addOnInit = addOnInit;
  1155. function addOnPreMain(cb) {
  1156. __ATMAIN__.unshift(cb);
  1157. }
  1158. Module['addOnPreMain'] = Module.addOnPreMain = addOnPreMain;
  1159. function addOnExit(cb) {
  1160. __ATEXIT__.unshift(cb);
  1161. }
  1162. Module['addOnExit'] = Module.addOnExit = addOnExit;
  1163. function addOnPostRun(cb) {
  1164. __ATPOSTRUN__.unshift(cb);
  1165. }
  1166. Module['addOnPostRun'] = Module.addOnPostRun = addOnPostRun;
  1167. // Tools
  1168. function intArrayFromString(stringy, dontAddNull, length /* optional */) {
  1169. var ret = (new Runtime.UTF8Processor()).processJSString(stringy);
  1170. if (length) {
  1171. ret.length = length;
  1172. }
  1173. if (!dontAddNull) {
  1174. ret.push(0);
  1175. }
  1176. return ret;
  1177. }
  1178. Module['intArrayFromString'] = intArrayFromString;
  1179. function intArrayToString(array) {
  1180. var ret = [];
  1181. for (var i = 0; i < array.length; i++) {
  1182. var chr = array[i];
  1183. if (chr > 0xFF) {
  1184. chr &= 0xFF;
  1185. }
  1186. ret.push(String.fromCharCode(chr));
  1187. }
  1188. return ret.join('');
  1189. }
  1190. Module['intArrayToString'] = intArrayToString;
  1191. function writeStringToMemory(string, buffer, dontAddNull) {
  1192. var array = intArrayFromString(string, dontAddNull);
  1193. var i = 0;
  1194. while (i < array.length) {
  1195. var chr = array[i];
  1196. HEAP8[(((buffer)+(i))>>0)]=chr;
  1197. i = i + 1;
  1198. }
  1199. }
  1200. Module['writeStringToMemory'] = writeStringToMemory;
  1201. function writeArrayToMemory(array, buffer) {
  1202. for (var i = 0; i < array.length; i++) {
  1203. HEAP8[(((buffer)+(i))>>0)]=array[i];
  1204. }
  1205. }
  1206. Module['writeArrayToMemory'] = writeArrayToMemory;
  1207. function writeAsciiToMemory(str, buffer, dontAddNull) {
  1208. for (var i = 0; i < str.length; i++) {
  1209. HEAP8[(((buffer)+(i))>>0)]=str.charCodeAt(i);
  1210. }
  1211. if (!dontAddNull) HEAP8[(((buffer)+(str.length))>>0)]=0;
  1212. }
  1213. Module['writeAsciiToMemory'] = writeAsciiToMemory;
  1214. function unSign(value, bits, ignore) {
  1215. if (value >= 0) {
  1216. return value;
  1217. }
  1218. 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
  1219. : Math.pow(2, bits) + value;
  1220. }
  1221. function reSign(value, bits, ignore) {
  1222. if (value <= 0) {
  1223. return value;
  1224. }
  1225. var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32
  1226. : Math.pow(2, bits-1);
  1227. 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
  1228. // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors
  1229. // TODO: In i64 mode 1, resign the two parts separately and safely
  1230. value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
  1231. }
  1232. return value;
  1233. }
  1234. // check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 )
  1235. if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(a, b) {
  1236. var ah = a >>> 16;
  1237. var al = a & 0xffff;
  1238. var bh = b >>> 16;
  1239. var bl = b & 0xffff;
  1240. return (al*bl + ((ah*bl + al*bh) << 16))|0;
  1241. };
  1242. Math.imul = Math['imul'];
  1243. var Math_abs = Math.abs;
  1244. var Math_cos = Math.cos;
  1245. var Math_sin = Math.sin;
  1246. var Math_tan = Math.tan;
  1247. var Math_acos = Math.acos;
  1248. var Math_asin = Math.asin;
  1249. var Math_atan = Math.atan;
  1250. var Math_atan2 = Math.atan2;
  1251. var Math_exp = Math.exp;
  1252. var Math_log = Math.log;
  1253. var Math_sqrt = Math.sqrt;
  1254. var Math_ceil = Math.ceil;
  1255. var Math_floor = Math.floor;
  1256. var Math_pow = Math.pow;
  1257. var Math_imul = Math.imul;
  1258. var Math_fround = Math.fround;
  1259. var Math_min = Math.min;
  1260. // A counter of dependencies for calling run(). If we need to
  1261. // do asynchronous work before running, increment this and
  1262. // decrement it. Incrementing must happen in a place like
  1263. // PRE_RUN_ADDITIONS (used by emcc to add file preloading).
  1264. // Note that you can add dependencies in preRun, even though
  1265. // it happens right before run - run will be postponed until
  1266. // the dependencies are met.
  1267. var runDependencies = 0;
  1268. var runDependencyWatcher = null;
  1269. var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
  1270. function addRunDependency(id) {
  1271. runDependencies++;
  1272. if (Module['monitorRunDependencies']) {
  1273. Module['monitorRunDependencies'](runDependencies);
  1274. }
  1275. }
  1276. Module['addRunDependency'] = addRunDependency;
  1277. function removeRunDependency(id) {
  1278. runDependencies--;
  1279. if (Module['monitorRunDependencies']) {
  1280. Module['monitorRunDependencies'](runDependencies);
  1281. }
  1282. if (runDependencies == 0) {
  1283. if (runDependencyWatcher !== null) {
  1284. clearInterval(runDependencyWatcher);
  1285. runDependencyWatcher = null;
  1286. }
  1287. if (dependenciesFulfilled) {
  1288. var callback = dependenciesFulfilled;
  1289. dependenciesFulfilled = null;
  1290. callback(); // can add another dependenciesFulfilled
  1291. }
  1292. }
  1293. }
  1294. Module['removeRunDependency'] = removeRunDependency;
  1295. Module["preloadedImages"] = {}; // maps url to image data
  1296. Module["preloadedAudios"] = {}; // maps url to audio data
  1297. var memoryInitializer = null;
  1298. // === Body ===
  1299. STATIC_BASE = 8;
  1300. STATICTOP = STATIC_BASE + 33040;
  1301. /* global initializers */ __ATINIT__.push();
  1302. /* memory initializer */ allocate([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,59,140,1,189,241,36,255,248,37,195,1,96,220,55,0,183,76,62,255,195,66,61,0,50,76,164,1,225,164,76,255,76,61,163,255,117,62,31,0,81,145,64,255,118,65,14,0,162,115,214,255,6,138,46,0,124,230,244,255,10,138,143,0,52,26,194,0,184,244,76,0,129,143,41,1,190,244,19,255,123,170,122,255,98,129,68,0,121,213,147,0,86,101,30,255,161,103,155,0,140,89,67,255,239,229,190,1,67,11,181,0,198,240,137,254,238,69,188,255,67,151,238,0,19,42,108,255,229,85,113,1,50,68,135,255,17,106,9,0,50,103,1,255,80,1,168,1,35,152,30,255,16,168,185,1,56,89,232,255,101,210,252,0,41,250,71,0,204,170,79,255,14,46,239,255,80,77,239,0,189,214,75,255,17,141,249,0,38,80,76,255,190,85,117,0,86,228,170,0,156,216,208,1,195,207,164,255,150,66,76,255,175,225,16,255,141,80,98,1,76,219,242,0,198,162,114,0,46,218,152,0,155,43,241,254,155,160,104,255,51,187,165,0,2,17,175,0,66,84,160,1,247,58,30,0,35,65,53,254,69,236,191,0,45,134,245,1,163,123,221,0,32,110,20,255,52,23,165,0,186,214,71,0,233,176,96,0,242,239,54,1,57,89,138,0,83,0,84,255,136,160,100,0,92,142,120,254,104,124,190,0,181,177,62,255,250,41,85,0,152,130,42,1,96,252,246,0,151,151,63,254,239,133,62,0,32,56,156,0,45,167,189,255,142,133,179,1,131,86,211,0,187,179,150,254,250,170,14,255,210,163,78,0,37,52,151,0,99,77,26,0,238,156,213,255,213,192,209,1,73,46,84,0,20,65,41,1,54,206,79,0,201,131,146,254,170,111,24,255,177,33,50,254,171,38,203,255,78,247,116,0,209,221,153,0,133,128,178,1,58,44,25,0,201,39,59,1,189,19,252,0,49,229,210,1,117,187,117,0,181,179,184,1,0,114,219,0,48,94,147,0,245,41,56,0,125,13,204,254,244,173,119,0,44,221,32,254,84,234,20,0,249,160,198,1,236,126,234,255,47,99,168,254,170,226,153,255,102,179,216,0,226,141,122,255,122,66,153,254,182,245,134,0,227,228,25,1,214,57,235,255,216,173,56,255,181,231,210,0,119,128,157,255,129,95,136,255,110,126,51,0,2,169,183,255,7,130,98,254,69,176,94,255,116,4,227,1,217,242,145,255,202,173,31,1,105,1,39,255,46,175,69,0,228,47,58,255,215,224,69,254,207,56,69,255,16,254,139,255,23,207,212,255,202,20,126,255,95,213,96,255,9,176,33,0,200,5,207,255,241,42,128,254,35,33,192,255,248,229,196,1,129,17,120,0,251,103,151,255,7,52,112,255,140,56,66,255,40,226,245,255,217,70,37,254,172,214,9,255,72,67,134,1,146,192,214,255,44,38,112,0,68,184,75,255,206,90,251,0,149,235,141,0,181,170,58,0,116,244,239,0,92,157,2,0,102,173,98,0,233,137,96,1,127,49,203,0,5,155,148,0,23,148,9,255,211,122,12,0,34,134,26,255,219,204,136,0,134,8,41,255,224,83,43,254,85,25,247,0,109,127,0,254,169,136,48,0,238,119,219,255,231,173,213,0,206,18,254,254,8,186,7,255,126,9,7,1,111,42,72,0,111,52,236,254,96,63,141,0,147,191,127,254,205,78,192,255,14,106,237,1,187,219,76,0,175,243,187,254,105,89,173,0,85,25,89,1,162,243,148,0,2,118,209,254,33,158,9,0,139,163,46,255,93,70,40,0,108,42,142,254,111,252,142,255,155,223,144,0,51,229,167,255,73,252,155,255,94,116,12,255,152,160,218,255,156,238,37,255,179,234,207,255,197,0,179,255,154,164,141,0,225,196,104,0,10,35,25,254,209,212,242,255,97,253,222,254,184,101,229,0,222,18,127,1,164,136,135,255,30,207,140,254,146,97,243,0,129,192,26,254,201,84,33,255,111,10,78,255,147,81,178,255,4,4,24,0,161,238,215,255,6,141,33,0,53,215,14,255,41,181,208,255,231,139,157,0,179,203,221,255,255,185,113,0,189,226,172,255,113,66,214,255,202,62,45,255,102,64,8,255,78,174,16,254,133,117,68,255,182,120,89,255,133,114,211,0,189,110,21,255,15,10,106,0,41,192,1,0,152,232,121,255,188,60,160,255,153,113,206,255,0,183,226,254,180,13,72,255,176,160,14,254,211,201,134,255,158,24,143,0,127,105,53,0,96,12,189,0,167,215,251,255,159,76,128,254,106,101,225,255,30,252,4,0,146,12,174,0,89,241,178,254,10,229,166,255,123,221,42,254,30,20,212,0,82,128,3,0,48,209,243,0,119,121,64,255,50,227,156,255,0,110,197,1,103,27,144,0,133,59,140,1,189,241,36,255,248,37,195,1,96,220,55,0,183,76,62,255,195,66,61,0,50,76,164,1,225,164,76,255,76,61,163,255,117,62,31,0,81,145,64,255,118,65,14,0,162,115,214,255,6,138,46,0,124,230,244,255,10,138,143,0,52,26,194,0,184,244,76,0,129,143,41,1,190,244,19,255,123,170,122,255,98,129,68,0,121,213,147,0,86,101,30,255,161,103,155,0,140,89,67,255,239,229,190,1,67,11,181,0,198,240,137,254,238,69,188,255,234,113,60,255,37,255,57,255,69,178,182,254,128,208,179,0,118,26,125,254,3,7,214,255,241,50,77,255,85,203,197,255,211,135,250,255,25,48,100,255,187,213,180,254,17,88,105,0,83,209,158,1,5,115,98,0,4,174,60,254,171,55,110,255,217,181,17,255,20,188,170,0,146,156,102,254,87,214,174,255,114,122,155,1,233,44,170,0,127,8,239,1,214,236,234,0,175,5,219,0,49,106,61,255,6,66,208,255,2,106,110,255,81,234,19,255,215,107,192,255,67,151,238,0,19,42,108,255,229,85,113,1,50,68,135,255,17,106,9,0,50,103,1,255,80,1,168,1,35,152,30,255,16,168,185,1,56,89,232,255,101,210,252,0,41,250,71,0,204,170,79,255,14,46,239,255,80,77,239,0,189,214,75,255,17,141,249,0,38,80,76,255,190,85,117,0,86,228,170,0,156,216,208,1,195,207,164,255,150,66,76,255,175,225,16,255,141,80,98,1,76,219,242,0,198,162,114,0,46,218,152,0,155,43,241,254,155,160,104,255,178,9,252,254,100,110,212,0,14,5,167,0,233,239,163,255,28,151,157,1,101,146,10,255,254,158,70,254,71,249,228,0,88,30,50,0,68,58,160,255,191,24,104,1,129,66,129,255,192,50,85,255,8,179,138,255,38,250,201,0,115,80,160,0,131,230,113,0,125,88,147,0,90,68,199,0,253,76,158,0,28,255,118,0,113,250,254,0,66,75,46,0,230,218,43,0,229,120,186,1,148,68,43,0,136,124,238,1,187,107,197,255,84,53,246,255,51,116,254,255,51,187,165,0,2,17,175,0,66,84,160,1,247,58,30,0,35,65,53,254,69,236,191,0,45,134,245,1,163,123,221,0,32,110,20,255,52,23,165,0,186,214,71,0,233,176,96,0,242,239,54,1,57,89,138,0,83,0,84,255,136,160,100,0,92,142,120,254,104,124,190,0,181,177,62,255,250,41,85,0,152,130,42,1,96,252,246,0,151,151,63,254,239,133,62,0,32,56,156,0,45,167,189,255,142,133,179,1,131,86,211,0,187,179,150,254,250,170,14,255,68,113,21,255,222,186,59,255,66,7,241,1,69,6,72,0,86,156,108,254,55,167,89,0,109,52,219,254,13,176,23,255,196,44,106,255,239,149,71,255,164,140,125,255,159,173,1,0,51,41,231,0,145,62,33,0,138,111,93,1,185,83,69,0,144,115,46,0,97,151,16,255,24,228,26,0,49,217,226,0,113,75,234,254,193,153,12,255,182,48,96,255,14,13,26,0,128,195,249,254,69,193,59,0,132,37,81,254,125,106,60,0,214,240,169,1,164,227,66,0,210,163,78,0,37,52,151,0,99,77,26,0,238,156,213,255,213,192,209,1,73,46,84,0,20,65,41,1,54,206,79,0,201,131,146,254,170,111,24,255,177,33,50,254,171,38,203,255,78,247,116,0,209,221,153,0,133,128,178,1,58,44,25,0,201,39,59,1,189,19,252,0,49,229,210,1,117,187,117,0,181,179,184,1,0,114,219,0,48,94,147,0,245,41,56,0,125,13,204,254,244,173,119,0,44,221,32,254,84,234,20,0,249,160,198,1,236,126,234,255,143,62,221,0,129,89,214,255,55,139,5,254,68,20,191,255,14,204,178,1,35,195,217,0,47,51,206,1,38,246,165,0,206,27,6,254,158,87,36,0,217,52,146,255,125,123,215,255,85,60,31,255,171,13,7,0,218,245,88,254,252,35,60,0,55,214,160,255,133,101,56,0,224,32,19,254,147,64,234,0,26,145,162,1,114,118,125,0,248,252,250,0,101,94,196,255,198,141,226,254,51,42,182,0,135,12,9,254,109,172,210,255,197,236,194,1,241,65,154,0,48,156,47,255,153,67,55,255,218,165,34,254,74,180,179,0,218,66,71,1,88,122,99,0,212,181,219,255,92,42,231,255,239,0,154,0,245,77,183,255,94,81,170,1,18,213,216,0,171,93,71,0,52,94,248,0,18,151,161,254,197,209,66,255,174,244,15,254,162,48,183,0,49,61,240,254,182,93,195,0,199,228,6,1,200,5,17,255,137,45,237,255,108,148,4,0,90,79,237,255,39,63,77,255,53,82,207,1,142,22,118,255,101,232,18,1,92,26,67,0,5,200,88,255,33,168,138,255,149,225,72,0,2,209,27,255,44,245,168,1,220,237,17,255,30,211,105,254,141,238,221,0,128,80,245,254,111,254,14,0,222,95,190,1,223,9,241,0,146,76,212,255,108,205,104,255,63,117,153,0,144,69,48,0,35,228,111,0,192,33,193,255,112,214,190,254,115,152,151,0,23,102,88,0,51,74,248,0,226,199,143,254,204,162,101,255,208,97,189,1,245,104,18,0,230,246,30,255,23,148,69,0,110,88,52,254,226,181,89,255,208,47,90,254,114,161,80,255,33,116,248,0,179,152,87,255,69,144,177,1,88,238,26,255,58,32,113,1,1,77,69,0,59,121,52,255,152,238,83,0,52,8,193,0,231,39,233,255,199,34,138,0,222,68,173,0,91,57,242,254,220,210,127,255,192,7,246,254,151,35,187,0,195,236,165,0,111,93,206,0,212,247,133,1,154,133,209,255,155,231,10,0,64,78,38,0,122,249,100,1,30,19,97,255,62,91,249,1,248,133,77,0,197,63,168,254,116,10,82,0,184,236,113,254,212,203,194,255,61,100,252,254,36,5,202,255,119,91,153,255,129,79,29,0,103,103,171,254,237,215,111,255,216,53,69,0,239,240,23,0,194,149,221,255,38,225,222,0,232,255,180,254,118,82,133,255,57,209,177,1,139,232,133,0,158,176,46,254,194,115,46,0,88,247,229,1,28,103,191,0,221,222,175,254,149,235,44,0,151,228,25,254,218,105,103,0,142,85,210,0,149,129,190,255,213,65,94,254,117,134,224,255,82,198,117,0,157,221,220,0,163,101,36,0,197,114,37,0,104,172,166,254,11,182,0,0,81,72,188,255,97,188,16,255,69,6,10,0,199,147,145,255,8,9,115,1,65,214,175,255,217,173,209,0,80,127,166,0,247,229,4,254,167,183,124,255,90,28,204,254,175,59,240,255,11,41,248,1,108,40,51,255,144,177,195,254,150,250,126,0,138,91,65,1,120,60,222,255,245,193,239,0,29,214,189,255,128,2,25,0,80,154,162,0,77,220,107,1,234,205,74,255,54,166,103,255,116,72,9,0,228,94,47,255,30,200,25,255,35,214,89,255,61,176,140,255,83,226,163,255,75,130,172,0,128,38,17,0,95,137,152,255,215,124,159,1,79,93,0,0,148,82,157,254,195,130,251,255,40,202,76,255,251,126,224,0,157,99,62,254,207,7,225,255,96,68,195,0,140,186,157,255,131,19,231,255,42,128,254,0,52,219,61,254,102,203,72,0,141,7,11,255,186,164,213,0,31,122,119,0,133,242,145,0,208,252,232,255,91,213,182,255,143,4,250,254,249,215,74,0,165,30,111,1,171,9,223,0,229,123,34,1,92,130,26,255,77,155,45,1,195,139,28,255,59,224,78,0,136,17,247,0,108,121,32,0,79,250,189,255,96,227,252,254,38,241,62,0,62,174,125,255,155,111,93,255,10,230,206,1,97,197,40,255,0,49,57,254,65,250,13,0,18,251,150,255,220,109,210,255,5,174,166,254,44,129,189,0,235,35,147,255,37,247,141,255,72,141,4,255,103,107,255,0,247,90,4,0,53,44,42,0,2,30,240,0,4,59,63,0,88,78,36,0,113,167,180,0,190,71,193,255,199,158,164,255,58,8,172,0,77,33,12,0,65,63,3,0,153,77,33,255,172,254,102,1,228,221,4,255,87,30,254,1,146,41,86,255,138,204,239,254,108,141,17,255,187,242,135,0,210,208,127,0,68,45,14,254,73,96,62,0,81,60,24,255,170,6,36,255,3,249,26,0,35,213,109,0,22,129,54,255,21,35,225,255,234,61,56,255,58,217,6,0,143,124,88,0,236,126,66,0,209,38,183,255,34,238,6,255,174,145,102,0,95,22,211,0,196,15,153,254,46,84,232,255,117,34,146,1,231,250,74,255,27,134,100,1,92,187,195,255,170,198,112,0,120,28,42,0,209,70,67,0,29,81,31,0,29,168,100,1,169,173,160,0,107,35,117,0,62,96,59,255,81,12,69,1,135,239,190,255,220,252,18,0,163,220,58,255,137,137,188,255,83,102,109,0,96,6,76,0,234,222,210,255,185,174,205,1,60,158,213,255,13,241,214,0,172,129,140,0,93,104,242,0,192,156,251,0,43,117,30,0,225,81,158,0,127,232,218,0,226,28,203,0,233,27,151,255,117,43,5,255,242,14,47,255,33,20,6,0,137,251,44,254,27,31,245,255,183,214,125,254,40,121,149,0,186,158,213,255,89,8,227,0,69,88,0,254,203,135,225,0,201,174,203,0,147,71,184,0,18,121,41,254,94,5,78,0,224,214,240,254,36,5,180,0,251,135,231,1,163,138,212,0,210,249,116,254,88,129,187,0,19,8,49,254,62,14,144,255,159,76,211,0,214,51,82,0,109,117,228,254,103,223,203,255,75,252,15,1,154,71,220,255,23,13,91,1,141,168,96,255,181,182,133,0,250,51,55,0,234,234,212,254,175,63,158,0,39,240,52,1,158,189,36,255,213,40,85,1,32,180,247,255,19,102,26,1,84,24,97,255,69,21,222,0,148,139,122,255,220,213,235,1,232,203,255,0,121,57,147,0,227,7,154,0,53,22,147,1,72,1,225,0,82,134,48,254,83,60,157,255,145,72,169,0,34,103,239,0,198,233,47,0,116,19,4,255,184,106,9,255,183,129,83,0,36,176,230,1,34,103,72,0,219,162,134,0,245,42,158,0,32,149,96,254,165,44,144,0,202,239,72,254,215,150,5,0,42,66,36,1,132,215,175,0,86,174,86,255,26,197,156,255,49,232,135,254,103,182,82,0,253,128,176,1,153,178,122,0,245,250,10,0,236,24,178,0,137,106,132,0,40,29,41,0,50,30,152,255,124,105,38,0,230,191,75,0,143,43,170,0,44,131,20,255,44,13,23,255,237,255,155,1,159,109,100,255,112,181,24,255,104,220,108,0,55,211,131,0,99,12,213,255,152,151,145,255,238,5,159,0,97,155,8,0,33,108,81,0,1,3,103,0,62,109,34,255,250,155,180,0,32,71,195,255,38,70,145,1,159,95,245,0,69,229,101,1,136,28,240,0,79,224,25,0,78,110,121,255,248,168,124,0,187,128,247,0,2,147,235,254,79,11,132,0,70,58,12,1,181,8,163,255,79,137,133,255,37,170,11,255,141,243,85,255,176,231,215,255,204,150,164,255,239,215,39,255,46,87,156,254,8,163,88,255,172,34,232,0,66,44,102,255,27,54,41,254,236,99,87,255,41,123,169,1,52,114,43,0,117,134,40,0,155,134,26,0,231,207,91,254,35,132,38,255,19,102,125,254,36,227,133,255,118,3,113,255,29,13,124,0,152,96,74,1,88,146,206,255,167,191,220,254,162,18,88,255,182,100,23,0,31,117,52,0,81,46,106,1,12,2,7,0,69,80,201,1,209,246,172,0,12,48,141,1,224,211,88,0,116,226,159,0,122,98,130,0,65,236,234,1,225,226,9,255,207,226,123,1,89,214,59,0,112,135,88,1,90,244,203,255,49,11,38,1,129,108,186,0,89,112,15,1,101,46,204,255,127,204,45,254,79,255,221,255,51,73,18,255,127,42,101,255,241,21,202,0,160,227,7,0,105,50,236,0,79,52,197,255,104,202,208,1,180,15,16,0,101,197,78,255,98,77,203,0,41,185,241,1,35,193,124,0,35,155,23,255,207,53,192,0,11,125,163,1,249,158,185,255,4,131,48,0,21,93,111,255,61,121,231,1,69,200,36,255,185,48,185,255,111,238,21,255,39,50,25,255,99,215,163,255,87,212,30,255,164,147,5,255,128,6,35,1,108,223,110,255,194,76,178,0,74,101,180,0,243,47,48,0,174,25,43,255,82,173,253,1,54,114,192,255,40,55,91,0,215,108,176,255,11,56,7,0,224,233,76,0,209,98,202,254,242,25,125,0,44,193,93,254,203,8,177,0,135,176,19,0,112,71,213,255,206,59,176,1,4,67,26,0,14,143,213,254,42,55,208,255,60,67,120,0,193,21,163,0,99,164,115,0,10,20,118,0,156,212,222,254,160,7,217,255,114,245,76,1,117,59,123,0,176,194,86,254,213,15,176,0,78,206,207,254,213,129,59,0,233,251,22,1,96,55,152,255,236,255,15,255,197,89,84,255,93,149,133,0,174,160,113,0,234,99,169,255,152,116,88,0,144,164,83,255,95,29,198,255,34,47,15,255,99,120,134,255,5,236,193,0,249,247,126,255,147,187,30,0,50,230,117,255,108,217,219,255,163,81,166,255,72,25,169,254,155,121,79,255,28,155,89,254,7,126,17,0,147,65,33,1,47,234,253,0,26,51,18,0,105,83,199,255,163,196,230,0,113,248,164,0,226,254,218,0,189,209,203,255,164,247,222,254,255,35,165,0,4,188,243,1,127,179,71,0,37,237,254,255,100,186,240,0,5,57,71,254,103,72,73,255,244,18,81,254,229,210,132,255,238,6,180,255,11,229,174,255,227,221,192,1,17,49,28,0,163,215,196,254,9,118,4,255,51,240,71,0,113,129,109,255,76,240,231,0,188,177,127,0,125,71,44,1,26,175,243,0,94,169,25,254,27,230,29,0,15,139,119,1,168,170,186,255,172,197,76,255,252,75,188,0,137,124,196,0,72,22,96,255,45,151,249,1,220,145,100,0,64,192,159,255,120,239,226,0,129,178,146,0,0,192,125,0,235,138,234,0,183,157,146,0,83,199,192,255,184,172,72,255,73,225,128,0,77,6,250,255,186,65,67,0,104,246,207,0,188,32,138,255,218,24,242,0,67,138,81,254,237,129,121,255,20,207,150,1,41,199,16,255,6,20,128,0,159,118,5,0,181,16,143,255,220,38,15,0,23,64,147,254,73,26,13,0,87,228,57,1,204,124,128,0,43,24,223,0,219,99,199,0,22,75,20,255,19,27,126,0,157,62,215,0,110,29,230,0,179,167,255,1,54,252,190,0,221,204,182,254,179,158,65,255,81,157,3,0,194,218,159,0,170,223,0,0,224,11,32,255,38,197,98,0,168,164,37,0,23,88,7,1,164,186,110,0,96,36,134,0,234,242,229,0,250,121,19,0,242,254,112,255,3,47,94,1,9,239,6,255,81,134,153,254,214,253,168,255,67,124,224,0,245,95,74,0,28,30,44,254,1,109,220,255,178,89,89,0,252,36,76,0,24,198,46,255,76,77,111,0,134,234,136,255,39,94,29,0,185,72,234,255,70,68,135,255,231,102,7,254,77,231,140,0,167,47,58,1,148,97,118,255,16,27,225,1,166,206,143,255,110,178,214,255,180,131,162,0,143,141,225,1,13,218,78,255,114,153,33,1,98,104,204,0,175,114,117,1,167,206,75,0,202,196,83,1,58,64,67,0,138,47,111,1,196,247,128,255,137,224,224,254,158,112,207,0,154,100,255,1,134,37,107,0,198,128,79,255,127,209,155,255,163,254,185,254,60,14,243,0,31,219,112,254,29,217,65,0,200,13,116,254,123,60,196,255,224,59,184,254,242,89,196,0,123,16,75,254,149,16,206,0,69,254,48,1,231,116,223,255,209,160,65,1,200,80,98,0,37,194,184,254,148,63,34,0,139,240,65,255,217,144,132,255,56,38,45,254,199,120,210,0,108,177,166,255,160,222,4,0,220,126,119,254,165,107,160,255,82,220,248,1,241,175,136,0,144,141,23,255,169,138,84,0,160,137,78,255,226,118,80,255,52,27,132,255,63,96,139,255,152,250,39,0,188,155,15,0,232,51,150,254,40,15,232,255,240,229,9,255,137,175,27,255,75,73,97,1,218,212,11,0,135,5,162,1,107,185,213,0,2,249,107,255,40,242,70,0,219,200,25,0,25,157,13,0,67,82,80,255,196,249,23,255,145,20,149,0,50,72,146,0,94,76,148,1,24,251,65,0,31,192,23,0,184,212,201,255,123,233,162,1,247,173,72,0,162,87,219,254,126,134,89,0,159,11,12,254,166,105,29,0,73,27,228,1,113,120,183,255,66,163,109,1,212,143,11,255,159,231,168,1,255,128,90,0,57,14,58,254,89,52,10,255,253,8,163,1,0,145,210,255,10,129,85,1,46,181,27,0,103,136,160,254,126,188,209,255,34,35,111,0,215,219,24,255,212,11,214,254,101,5,118,0,232,197,133,255,223,167,109,255,237,80,86,255,70,139,94,0,158,193,191,1,155,15,51,255,15,190,115,0,78,135,207,255,249,10,27,1,181,125,233,0,95,172,13,254,170,213,161,255,39,236,138,255,95,93,87,255,190,128,95,0,125,15,206,0,166,150,159,0,227,15,158,255,206,158,120,255,42,141,128,0,101,178,120,1,156,109,131,0,218,14,44,254,247,168,206,255,212,112,28,0,112,17,228,255,90,16,37,1,197,222,108,0,254,207,83,255,9,90,243,255,243,244,172,0,26,88,115,255,205,116,122,0,191,230,193,0,180,100,11,1,217,37,96,255,154,78,156,0,235,234,31,255,206,178,178,255,149,192,251,0,182,250,135,0,246,22,105,0,124,193,109,255,2,210,149,255,169,17,170,0,0,96,110,255,117,9,8,1,50,123,40,255,193,189,99,0,34,227,160,0,48,80,70,254,211,51,236,0,45,122,245,254,44,174,8,0,173,37,233,255,158,65,171,0,122,69,215,255,90,80,2,255,131,106,96,254,227,114,135,0,205,49,119,254,176,62,64,255,82,51,17,255,241,20,243,255,130,13,8,254,128,217,243,255,162,27,1,254,90,118,241,0,246,198,246,255,55,16,118,255,200,159,157,0,163,17,1,0,140,107,121,0,85,161,118,255,38,0,149,0,156,47,238,0,9,166,166,1,75,98,181,255,50,74,25,0,66,15,47,0,139,225,159,0,76,3,142,255,14,238,184,0,11,207,53,255,183,192,186,1,171,32,174,255,191,76,221,1,247,170,219,0,25,172,50,254,217,9,233,0,203,126,68,255,183,92,48,0,127,167,183,1,65,49,254,0,16,63,127,1,254,21,170,255,59,224,127,254,22,48,63,255,27,78,130,254,40,195,29,0,250,132,112,254,35,203,144,0,104,169,168,0,207,253,30,255,104,40,38,254,94,228,88,0,206,16,128,255,212,55,122,255,223,22,234,0,223,197,127,0,253,181,181,1,145,102,118,0,236,153,36,255,212,217,72,255,20,38,24,254,138,62,62,0,152,140,4,0,230,220,99,255,1,21,212,255,148,201,231,0,244,123,9,254,0,171,210,0,51,58,37,255,1,255,14,255,244,183,145,254,0,242,166,0,22,74,132,0,121,216,41,0,95,195,114,254,133,24,151,255,156,226,231,255,247,5,77,255,246,148,115,254,225,92,81,255,222,80,246,254,170,123,89,255,74,199,141,0,29,20,8,255,138,136,70,255,93,75,92,0,221,147,49,254,52,126,226,0,229,124,23,0,46,9,181,0,205,64,52,1,131,254,28,0,151,158,212,0,131,64,78,0,206,25,171,0,0,230,139,0,191,253,110,254,103,247,167,0,64,40,40,1,42,165,241,255,59,75,228,254,124,243,189,255,196,92,178,255,130,140,86,255,141,89,56,1,147,198,5,255,203,248,158,254,144,162,141,0,11,172,226,0,130,42,21,255,1,167,143,255,144,36,36,255,48,88,164,254,168,170,220,0,98,71,214,0,91,208,79,0,159,76,201,1,166,42,214,255,69,255,0,255,6,128,125,255,190,1,140,0,146,83,218,255,215,238,72,1,122,127,53,0,189,116,165,255,84,8,66,255,214,3,208,255,213,110,133,0,195,168,44,1,158,231,69,0,162,64,200,254,91,58,104,0,182,58,187,254,249,228,136,0,203,134,76,254,99,221,233,0,75,254,214,254,80,69,154,0,64,152,248,254,236,136,202,255,157,105,153,254,149,175,20,0,22,35,19,255,124,121,233,0,186,250,198,254,132,229,139,0,137,80,174,255,165,125,68,0,144,202,148,254,235,239,248,0,135,184,118,0,101,94,17,255,122,72,70,254,69,130,146,0,127,222,248,1,69,127,118,255,30,82,215,254,188,74,19,255,229,167,194,254,117,25,66,255,65,234,56,254,213,22,156,0,151,59,93,254,45,28,27,255,186,126,164,255,32,6,239,0,127,114,99,1,219,52,2,255,99,96,166,254,62,190,126,255,108,222,168,1,75,226,174,0,230,226,199,0,60,117,218,255,252,248,20,1,214,188,204,0,31,194,134,254,123,69,192,255,169,173,36,254,55,98,91,0,223,42,102,254,137,1,102,0,157,90,25,0,239,122,64,255,252,6,233,0,7,54,20,255,82,116,174,0,135,37,54,255,15,186,125,0,227,112,175,255,100,180,225,255,42,237,244,255,244,173,226,254,248,18,33,0,171,99,150,255,74,235,50,255,117,82,32,254,106,168,237,0,207,109,208,1,228,9,186,0,135,60,169,254,179,92,143,0,244,170,104,255,235,45,124,255,70,99,186,0,117,137,183,0,224,31,215,0,40,9,100,0,26,16,95,1,68,217,87,0,8,151,20,255,26,100,58,255,176,165,203,1,52,118,70,0,7,32,254,254,244,254,245,255,167,144,194,255,125,113,23,255,176,121,181,0,136,84,209,0,138,6,30,255,89,48,28,0,33,155,14,255,25,240,154,0,141,205,109,1,70,115,62,255,20,40,107,254,138,154,199,255,94,223,226,255,157,171,38,0,163,177,25,254,45,118,3,255,14,222,23,1,209,190,81,255,118,123,232,1,13,213,101,255,123,55,123,254,27,246,165,0,50,99,76,255,140,214,32,255,97,65,67,255,24,12,28,0,174,86,78,1,64,247,96,0,160,135,67,0,66,55,243,255,147,204,96,255,26,6,33,255,98,51,83,1,153,213,208,255,2,184,54,255,25,218,11,0,49,67,246,254,18,149,72,255,13,25,72,0,42,79,214,0,42,4,38,1,27,139,144,255,149,187,23,0,18,164,132,0,245,84,184,254,120,198,104,255,126,218,96,0,56,117,234,255,13,29,214,254,68,47,10,255,167,154,132,254,152,38,198,0,66,178,89,255,200,46,171,255,13,99,83,255,210,187,253,255,170,45,42,1,138,209,124,0,214,162,141,0,12,230,156,0,102,36,112,254,3,147,67,0,52,215,123,255,233,171,54,255,98,137,62,0,247,218,39,255,231,218,236,0,247,191,127,0,195,146,84,0,165,176,92,255,19,212,94,255,17,74,227,0,88,40,153,1,198,147,1,255,206,67,245,254,240,3,218,255,61,141,213,255,97,183,106,0,195,232,235,254,95,86,154,0,209,48,205,254,118,209,241,255,240,120,223,1,213,29,159,0,163,127,147,255,13,218,93,0,85,24,68,254,70,20,80,255,189,5,140,1,82,97,254,255,99,99,191,255,132,84,133,255,107,218,116,255,112,122,46,0,105,17,32,0,194,160,63,255,68,222,39,1,216,253,92,0,177,105,205,255,149,201,195,0,42,225,11,255,40,162,115,0,9,7,81,0,165,218,219,0,180,22,0,254,29,146,252,255,146,207,225,1,180,135,96,0,31,163,112,0,177,11,219,255,133,12,193,254,43,78,50,0,65,113,121,1,59,217,6,255,110,94,24,1,112,172,111,0,7,15,96,0,36,85,123,0,71,150,21,255,208,73,188,0,192,11,167,1,213,245,34,0,9,230,92,0,162,142,39,255,215,90,27,0,98,97,89,0,94,79,211,0,90,157,240,0,95,220,126,1,102,176,226,0,36,30,224,254,35,31,127,0,231,232,115,1,85,83,130,0,210,73,245,255,47,143,114,255,68,65,197,0,59,72,62,255,183,133,173,254,93,121,118,255,59,177,81,255,234,69,173,255,205,128,177,0,220,244,51,0,26,244,209,1,73,222,77,255,163,8,96,254,150,149,211,0,158,254,203,1,54,127,139,0,161,224,59,0,4,109,22,255,222,42,45,255,208,146,102,255,236,142,187,0,50,205,245,255,10,74,89,254,48,79,142,0,222,76,130,255,30,166,63,0,236,12,13,255,49,184,244,0,187,113,102,0,218,101,253,0,153,57,182,254,32,150,42,0,25,198,146,1,237,241,56,0,140,68,5,0,91,164,172,255,78,145,186,254,67,52,205,0,219,207,129,1,109,115,17,0,54,143,58,1,21,248,120,255,179,255,30,0,193,236,66,255,1,255,7,255,253,192,48,255,19,69,217,1,3,214,0,255,64,101,146,1,223,125,35,255,235,73,179,255,249,167,226,0,225,175,10,1,97,162,58,0,106,112,171,1,84,172,5,255,133,140,178,255,134,245,142,0,97,90,125,255,186,203,185,255,223,77,23,255,192,92,106,0,15,198,115,255,217,152,248,0,171,178,120,255,228,134,53,0,176,54,193,1,250,251,53,0,213,10,100,1,34,199,106,0,151,31,244,254,172,224,87,255,14,237,23,255,253,85,26,255,127,39,116,255,172,104,100,0,251,14,70,255,212,208,138,255,253,211,250,0,176,49,165,0,15,76,123,255,37,218,160,255,92,135,16,1,10,126,114,255,70,5,224,255,247,249,141,0,68,20,60,1,241,210,189,255,195,217,187,1,151,3,113,0,151,92,174,0,231,62,178,255,219,183,225,0,23,23,33,255,205,181,80,0,57,184,248,255,67,180,1,255,90,123,93,255,39,0,162,255,96,248,52,255,84,66,140,0,34,127,228,255,194,138,7,1,166,110,188,0,21,17,155,1,154,190,198,255,214,80,59,255,18,7,143,0,72,29,226,1,199,217,249,0,232,161,71,1,149,190,201,0,217,175,95,254,113,147,67,255,138,143,199,255,127,204,1,0,29,182,83,1,206,230,155,255,186,204,60,0,10,125,85,255,232,96,25,255,255,89,247,255,213,254,175,1,232,193,81,0,28,43,156,254,12,69,8,0,147,24,248,0,18,198,49,0,134,60,35,0,118,246,18,255,49,88,254,254,228,21,186,255,182,65,112,1,219,22,1,255,22,126,52,255,189,53,49,255,112,25,143,0,38,127,55,255,226,101,163,254,208,133,61,255,137,69,174,1,190,118,145,255,60,98,219,255,217,13,245,255,250,136,10,0,84,254,226,0,201,31,125,1,240,51,251,255,31,131,130,255,2,138,50,255,215,215,177,1,223,12,238,255,252,149,56,255,124,91,68,255,72,126,170,254,119,255,100,0,130,135,232,255,14,79,178,0,250,131,197,0,138,198,208,0,121,216,139,254,119,18,36,255,29,193,122,0,16,42,45,255,213,240,235,1,230,190,169,255,198,35,228,254,110,173,72,0,214,221,241,255,56,148,135,0,192,117,78,254,141,93,207,255,143,65,149,0,21,18,98,255,95,44,244,1,106,191,77,0,254,85,8,254,214,110,176,255,73,173,19,254,160,196,199,255,237,90,144,0,193,172,113,255,200,155,136,254,228,90,221,0,137,49,74,1,164,221,215,255,209,189,5,255,105,236,55,255,42,31,129,1,193,255,236,0,46,217,60,0,138,88,187,255,226,82,236,255,81,69,151,255,142,190,16,1,13,134,8,0,127,122,48,255,81,64,156,0,171,243,139,0,237,35,246,0,122,143,193,254,212,122,146,0,95,41,255,1,87,132,77,0,4,212,31,0,17,31,78,0,39,45,173,254,24,142,217,255,95,9,6,255,227,83,6,0,98,59,130,254,62,30,33,0,8,115,211,1,162,97,128,255,7,184,23,254,116,28,168,255,248,138,151,255,98,244,240,0,186,118,130,0,114,248,235,255,105,173,200,1,160,124,71,255,94,36,164,1,175,65,146,255,238,241,170,254,202,198,197,0,228,71,138,254,45,246,109,255,194,52,158,0,133,187,176,0,83,252,154,254,89,189,221,255,170,73,252,0,148,58,125,0,36,68,51,254,42,69,177,255,168,76,86,255,38,100,204,255,38,53,35,0,175,19,97,0,225,238,253,255,81,81,135,0,210,27,255,254,235,73,107,0,8,207,115,0,82,127,136,0,84,99,21,254,207,19,136,0,100,164,101,0,80,208,77,255,132,207,237,255,15,3,15,255,33,166,110,0,156,95,85,255,37,185,111,1,150,106,35,255,166,151,76,0,114,87,135,255,159,194,64,0,12,122,31,255,232,7,101,254,173,119,98,0,154,71,220,254,191,57,53,255,168,232,160,255,224,32,99,255,218,156,165,0,151,153,163,0,217,13,148,1,197,113,89,0,149,28,161,254,207,23,30,0,105,132,227,255,54,230,94,255,133,173,204,255,92,183,157,255,88,144,252,254,102,33,90,0,159,97,3,0,181,218,155,255,240,114,119,0,106,214,53,255,165,190,115,1,152,91,225,255,88,106,44,255,208,61,113,0,151,52,124,0,191,27,156,255,110,54,236,1,14,30,166,255,39,127,207,1,229,199,28,0,188,228,188,254,100,157,235,0,246,218,183,1,107,22,193,255,206,160,95,0,76,239,147,0,207,161,117,0,51,166,2,255,52,117,10,254,73,56,227,255,152,193,225,0,132,94,136,255,101,191,209,0,32,107,229,255,198,43,180,1,100,210,118,0,114,67,153,255,23,88,26,255,89,154,92,1,220,120,140,255,144,114,207,255,252,115,250,255,34,206,72,0,138,133,127,255,8,178,124,1,87,75,97,0,15,229,92,254,240,67,131,255,118,123,227,254,146,120,104,255,145,213,255,1,129,187,70,255,219,119,54,0,1,19,173,0,45,150,148,1,248,83,72,0,203,233,169,1,142,107,56,0,247,249,38,1,45,242,80,255,30,233,103,0,96,82,70,0,23,201,111,0,81,39,30,255,161,183,78,255,194,234,33,255,68,227,140,254,216,206,116,0,70,27,235,255,104,144,79,0,164,230,93,254,214,135,156,0,154,187,242,254,188,20,131,255,36,109,174,0,159,112,241,0,5,110,149,1,36,165,218,0,166,29,19,1,178,46,73,0,93,43,32,254,248,189,237,0,102,155,141,0,201,93,195,255,241,139,253,255,15,111,98,255,108,65,163,254,155,79,190,255,73,174,193,254,246,40,48,255,107,88,11,254,202,97,85,255,253,204,18,255,113,242,66,0,110,160,194,254,208,18,186,0,81,21,60,0,188,104,167,255,124,166,97,254,210,133,142,0,56,242,137,254,41,111,130,0,111,151,58,1,111,213,141,255,183,172,241,255,38,6,196,255,185,7,123,255,46,11,246,0,245,105,119,1,15,2,161,255,8,206,45,255,18,202,74,255,83,124,115,1,212,141,157,0,83,8,209,254,139,15,232,255,172,54,173,254,50,247,132,0,214,189,213,0,144,184,105,0,223,254,248,0,255,147,240,255,23,188,72,0,7,51,54,0,188,25,180,254,220,180,0,255,83,160,20,0,163,189,243,255,58,209,194,255,87,73,60,0,106,24,49,0,245,249,220,0,22,173,167,0,118,11,195,255,19,126,237,0,110,159,37,255,59,82,47,0,180,187,86,0,188,148,208,1,100,37,133,255,7,112,193,0,129,188,156,255,84,106,129,255,133,225,202,0,14,236,111,255,40,20,101,0,172,172,49,254,51,54,74,255,251,185,184,255,93,155,224,255,180,249,224,1,230,178,146,0,72,57,54,254,178,62,184,0,119,205,72,0,185,239,253,255,61,15,218,0,196,67,56,255,234,32,171,1,46,219,228,0,208,108,234,255,20,63,232,255,165,53,199,1,133,228,5,255,52,205,107,0,74,238,140,255,150,156,219,254,239,172,178,255,251,189,223,254,32,142,211,255,218,15,138,1,241,196,80,0,28,36,98,254,22,234,199,0,61,237,220,255,246,57,37,0,142,17,142,255,157,62,26,0,43,238,95,254,3,217,6,255,213,25,240,1,39,220,174,255,154,205,48,254,19,13,192,255,244,34,54,254,140,16,155,0,240,181,5,254,155,193,60,0,166,128,4,255,36,145,56,255,150,240,219,0,120,51,145,0,82,153,42,1,140,236,146,0,107,92,248,1,189,10,3,0,63,136,242,0,211,39,24,0,19,202,161,1,173,27,186,255,210,204,239,254,41,209,162,255,182,254,159,255,172,116,52,0,195,103,222,254,205,69,59,0,53,22,41,1,218,48,194,0,80,210,242,0,210,188,207,0,187,161,161,254,216,17,1,0,136,225,113,0,250,184,63,0,223,30,98,254,77,168,162,0,59,53,175,0,19,201,10,255,139,224,194,0,147,193,154,255,212,189,12,254,1,200,174,255,50,133,113,1,94,179,90,0,173,182,135,0,94,177,113,0,43,89,215,255,136,252,106,255,123,134,83,254,5,245,66,255,82,49,39,1,220,2,224,0,97,129,177,0,77,59,89,0,61,29,155,1,203,171,220,255,92,78,139,0,145,33,181,255,169,24,141,1,55,150,179,0,139,60,80,255,218,39,97,0,2,147,107,255,60,248,72,0,173,230,47,1,6,83,182,255,16,105,162,254,137,212,81,255,180,184,134,1,39,222,164,255,221,105,251,1,239,112,125,0,63,7,97,0,63,104,227,255,148,58,12,0,90,60,224,255,84,212,252,0,79,215,168,0,248,221,199,1,115,121,1,0,36,172,120,0,32,162,187,255,57,107,49,255,147,42,21,0,106,198,43,1,57,74,87,0,126,203,81,255,129,135,195,0,140,31,177,0,221,139,194,0,3,222,215,0,131,68,231,0,177,86,178,254,124,151,180,0,184,124,38,1,70,163,17,0,249,251,181,1,42,55,227,0,226,161,44,0,23,236,110,0,51,149,142,1,93,5,236,0,218,183,106,254,67,24,77,0,40,245,209,255,222,121,153,0,165,57,30,0,83,125,60,0,70,38,82,1,229,6,188,0,109,222,157,255,55,118,63,255,205,151,186,0,227,33,149,255,254,176,246,1,227,177,227,0,34,106,163,254,176,43,79,0,106,95,78,1,185,241,122,255,185,14,61,0,36,1,202,0,13,178,162,255,247,11,132,0,161,230,92,1,65,1,185,255,212,50,165,1,141,146,64,255,158,242,218,0,21,164,125,0,213,139,122,1,67,71,87,0,203,158,178,1,151,92,43,0,152,111,5,255,39,3,239,255,217,255,250,255,176,63,71,255,74,245,77,1,250,174,18,255,34,49,227,255,246,46,251,255,154,35,48,1,125,157,61,255,106,36,78,255,97,236,153,0,136,187,120,255,113,134,171,255,19,213,217,254,216,94,209,255,252,5,61,0,94,3,202,0,3,26,183,255,64,191,43,255,30,23,21,0,129,141,77,255,102,120,7,1,194,76,140,0,188,175,52,255,17,81,148,0,232,86,55,1,225,48,172,0,134,42,42,255,238,50,47,0,169,18,254,0,20,147,87,255,14,195,239,255,69,247,23,0,238,229,128,255,177,49,112,0,168,98,251,255,121,71,248,0,243,8,145,254,246,227,153,255,219,169,177,254,251,139,165,255,12,163,185,255,164,40,171,255,153,159,27,254,243,109,91,255,222,24,112,1,18,214,231,0,107,157,181,254,195,147,0,255,194,99,104,255,89,140,190,255,177,66,126,254,106,185,66,0,49,218,31,0,252,174,158,0,188,79,230,1,238,41,224,0,212,234,8,1,136,11,181,0,166,117,83,255,68,195,94,0,46,132,201,0,240,152,88,0,164,57,69,254,160,224,42,255,59,215,67,255,119,195,141,255,36,180,121,254,207,47,8,255,174,210,223,0,101,197,68,255,255,82,141,1,250,137,233,0,97,86,133,1,16,80,69,0,132,131,159,0,116,93,100,0,45,141,139,0,152,172,157,255,90,43,91,0,71,153,46,0,39,16,112,255,217,136,97,255,220,198,25,254,177,53,49,0,222,88,134,255,128,15,60,0,207,192,169,255,192,116,209,255,106,78,211,1,200,213,183,255,7,12,122,254,222,203,60,255,33,110,199,254,251,106,117,0,228,225,4,1,120,58,7,255,221,193,84,254,112,133,27,0,189,200,201,255,139,135,150,0,234,55,176,255,61,50,65,0,152,108,169,255,220,85,1,255,112,135,227,0,162,26,186,0,207,96,185,254,244,136,107,0,93,153,50,1,198,97,151,0,110,11,86,255,143,117,174,255,115,212,200,0,5,202,183,0,237,164,10,254,185,239,62,0,236,120,18,254,98,123,99,255,168,201,194,254,46,234,214,0,191,133,49,255,99,169,119,0,190,187,35,1,115,21,45,255,249,131,72,0,112,6,123,255,214,49,181,254,166,233,34,0,92,197,102,254,253,228,205,255,3,59,201,1,42,98,46,0,219,37,35,255,169,195,38,0,94,124,193,1,156,43,223,0,95,72,133,254,120,206,191,0,122,197,239,255,177,187,79,255,254,46,2,1,250,167,190,0,84,129,19,0,203,113,166,255,249,31,189,254,72,157,202,255,208,71,73,255,207,24,72,0,10,16,18,1,210,81,76,255,88,208,192,255,126,243,107,255,238,141,120,255,199,121,234,255,137,12,59,255,36,220,123,255,148,179,60,254,240,12,29,0,66,0,97,1,36,30,38,255,115,1,93,255,96,103,231,255,197,158,59,1,192,164,240,0,202,202,57,255,24,174,48,0,89,77,155,1,42,76,215,0,244,151,233,0,23,48,81,0,239,127,52,254,227,130,37,255,248,116,93,1,124,132,118,0,173,254,192,1,6,235,83,255,110,175,231,1,251,28,182,0,129,249,93,254,84,184,128,0,76,181,62,0,175,128,186,0,100,53,136,254,109,29,226,0,221,233,58,1,20,99,74,0,0,22,160,0,134,13,21,0,9,52,55,255,17,89,140,0,175,34,59,0,84,165,119,255,224,226,234,255,7,72,166,255,123,115,255,1,18,214,246,0,250,7,71,1,217,220,185,0,212,35,76,255,38,125,175,0,189,97,210,0,114,238,44,255,41,188,169,254,45,186,154,0,81,92,22,0,132,160,193,0,121,208,98,255,13,81,44,255,203,156,82,0,71,58,21,255,208,114,191,254,50,38,147,0,154,216,195,0,101,25,18,0,60,250,215,255,233,132,235,255,103,175,142,1,16,14,92,0,141,31,110,254,238,241,45,255,153,217,239,1,97,168,47,255,249,85,16,1,28,175,62,255,57,254,54,0,222,231,126,0,166,45,117,254,18,189,96,255,228,76,50,0,200,244,94,0,198,152,120,1,68,34,69,255,12,65,160,254,101,19,90,0,167,197,120,255,68,54,185,255,41,218,188,0,113,168,48,0,88,105,189,1,26,82,32,255,185,93,164,1,228,240,237,255,66,182,53,0,171,197,92,255,107,9,233,1,199,120,144,255,78,49,10,255,109,170,105,255,90,4,31,255,28,244,113,255,74,58,11,0,62,220,246,255,121,154,200,254,144,210,178,255,126,57,129,1,43,250,14,255,101,111,28,1,47,86,241,255,61,70,150,255,53,73,5,255,30,26,158,0,209,26,86,0,138,237,74,0,164,95,188,0,142,60,29,254,162,116,248,255,187,175,160,0,151,18,16,0,209,111,65,254,203,134,39,255,88,108,49,255,131,26,71,255,221,27,215,254,104,105,93,255,31,236,31,254,135,0,211,255,143,127,110,1,212,73,229,0,233,67,167,254,195,1,208,255,132,17,221,255,51,217,90,0,67,235,50,255,223,210,143,0,179,53,130,1,233,106,198,0,217,173,220,255,112,229,24,255,175,154,93,254,71,203,246,255,48,66,133,255,3,136,230,255,23,221,113,254,235,111,213,0,170,120,95,254,251,221,2,0,45,130,158,254,105,94,217,255,242,52,180,254,213,68,45,255,104,38,28,0,244,158,76,0,161,200,96,255,207,53,13,255,187,67,148,0,170,54,248,0,119,162,178,255,83,20,11,0,42,42,192,1,146,159,163,255,183,232,111,0,77,229,21,255,71,53,143,0,27,76,34,0,246,136,47,255,219,39,182,255,92,224,201,1,19,142,14,255,69,182,241,255,163,118,245,0,9,109,106,1,170,181,247,255,78,47,238,255,84,210,176,255,213,107,139,0,39,38,11,0,72,21,150,0,72,130,69,0,205,77,155,254,142,133,21], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE);
  1303. /* memory initializer */ allocate([71,111,172,254,226,42,59,255,179,0,215,1,33,128,241,0,234,252,13,1,184,79,8,0,110,30,73,255,246,141,189,0,170,207,218,1,74,154,69,255,138,246,49,255,155,32,100,0,125,74,105,255,90,85,61,255,35,229,177,255,62,125,193,255,153,86,188,1,73,120,212,0,209,123,246,254,135,209,38,255,151,58,44,1,92,69,214,255,14,12,88,255,252,153,166,255,253,207,112,255,60,78,83,255,227,124,110,0,180,96,252,255,53,117,33,254,164,220,82,255,41,1,27,255,38,164,166,255,164,99,169,254,61,144,70,255,192,166,18,0,107,250,66,0,197,65,50,0,1,179,18,255,255,104,1,255,43,153,35,255,80,111,168,0,110,175,168,0,41,105,45,255,219,14,205,255,164,233,140,254,43,1,118,0,233,67,195,0,178,82,159,255,138,87,122,255,212,238,90,255,144,35,124,254,25,140,164,0,251,215,44,254,133,70,107,255,101,227,80,254,92,169,55,0,215,42,49,0,114,180,85,255,33,232,27,1,172,213,25,0,62,176,123,254,32,133,24,255,225,191,62,0,93,70,153,0,181,42,104,1,22,191,224,255,200,200,140,255,249,234,37,0,149,57,141,0,195,56,208,255,254,130,70,255,32,173,240,255,29,220,199,0,110,100,115,255,132,229,249,0,228,233,223,255,37,216,209,254,178,177,209,255,183,45,165,254,224,97,114,0,137,97,168,255,225,222,172,0,165,13,49,1,210,235,204,255,252,4,28,254,70,160,151,0,232,190,52,254,83,248,93,255,62,215,77,1,175,175,179,255,160,50,66,0,121,48,208,0,63,169,209,255,0,210,200,0,224,187,44,1,73,162,82,0,9,176,143,255,19,76,193,255,29,59,167,1,24,43,154,0,28,190,190,0,141,188,129,0,232,235,203,255,234,0,109,255,54,65,159,0,60,88,232,255,121,253,150,254,252,233,131,255,198,110,41,1,83,77,71,255,200,22,59,254,106,253,242,255,21,12,207,255,237,66,189,0,90,198,202,1,225,172,127,0,53,22,202,0,56,230,132,0,1,86,183,0,109,190,42,0,243,68,174,1,109,228,154,0,200,177,122,1,35,160,183,255,177,48,85,255,90,218,169,255,248,152,78,0,202,254,110,0,6,52,43,0,142,98,65,255,63,145,22,0,70,106,93,0,232,138,107,1,110,179,61,255,211,129,218,1,242,209,92,0,35,90,217,1,182,143,106,255,116,101,217,255,114,250,221,255,173,204,6,0,60,150,163,0,73,172,44,255,239,110,80,255,237,76,153,254,161,140,249,0,149,232,229,0,133,31,40,255,174,164,119,0,113,51,214,0,129,228,2,254,64,34,243,0,107,227,244,255,174,106,200,255,84,153,70,1,50,35,16,0,250,74,216,254,236,189,66,255,153,249,13,0,230,178,4,255,221,41,238,0,118,227,121,255,94,87,140,254,254,119,92,0,73,239,246,254,117,87,128,0,19,211,145,255,177,46,252,0,229,91,246,1,69,128,247,255,202,77,54,1,8,11,9,255,153,96,166,0,217,214,173,255,134,192,2,1,0,207,0,0,189,174,107,1,140,134,100,0,158,193,243,1,182,102,171,0,235,154,51,0,142,5,123,255,60,168,89,1,217,14,92,255,19,214,5,1,211,167,254,0,44,6,202,254,120,18,236,255,15,113,184,255,184,223,139,0,40,177,119,254,182,123,90,255,176,165,176,0,247,77,194,0,27,234,120,0,231,0,214,255,59,39,30,0,125,99,145,255,150,68,68,1,141,222,248,0,153,123,210,255,110,127,152,255,229,33,214,1,135,221,197,0,137,97,2,0,12,143,204,255,81,41,188,0,115,79,130,255,94,3,132,0,152,175,187,255,124,141,10,255,126,192,179,255,11,103,198,0,149,6,45,0,219,85,187,1,230,18,178,255,72,182,152,0,3,198,184,255,128,112,224,1,97,161,230,0,254,99,38,255,58,159,197,0,151,66,219,0,59,69,143,255,185,112,249,0,119,136,47,255,123,130,132,0,168,71,95,255,113,176,40,1,232,185,173,0,207,93,117,1,68,157,108,255,102,5,147,254,49,97,33,0,89,65,111,254,247,30,163,255,124,217,221,1,102,250,216,0,198,174,75,254,57,55,18,0,227,5,236,1,229,213,173,0,201,109,218,1,49,233,239,0,30,55,158,1,25,178,106,0,155,111,188,1,94,126,140,0,215,31,238,1,77,240,16,0,213,242,25,1,38,71,168,0,205,186,93,254,49,211,140,255,219,0,180,255,134,118,165,0,160,147,134,255,110,186,35,255,198,243,42,0,243,146,119,0,134,235,163,1,4,241,135,255,193,46,193,254,103,180,79,255,225,4,184,254,242,118,130,0,146,135,176,1,234,111,30,0,69,66,213,254,41,96,123,0,121,94,42,255,178,191,195,255,46,130,42,0,117,84,8,255,233,49,214,254,238,122,109,0,6,71,89,1,236,211,123,0,244,13,48,254,119,148,14,0,114,28,86,255,75,237,25,255,145,229,16,254,129,100,53,255,134,150,120,254,168,157,50,0,23,72,104,255,224,49,14,0,255,123,22,255,151,185,151,255,170,80,184,1,134,182,20,0,41,100,101,1,153,33,16,0,76,154,111,1,86,206,234,255,192,160,164,254,165,123,93,255,1,216,164,254,67,17,175,255,169,11,59,255,158,41,61,255,73,188,14,255,195,6,137,255,22,147,29,255,20,103,3,255,246,130,227,255,122,40,128,0,226,47,24,254,35,36,32,0,152,186,183,255,69,202,20,0,195,133,195,0,222,51,247,0,169,171,94,1,183,0,160,255,64,205,18,1,156,83,15,255,197,58,249,254,251,89,110,255,50,10,88,254,51,43,216,0,98,242,198,1,245,151,113,0,171,236,194,1,197,31,199,255,229,81,38,1,41,59,20,0,253,104,230,0,152,93,14,255,246,242,146,254,214,169,240,255,240,102,108,254,160,167,236,0,154,218,188,0,150,233,202,255,27,19,250,1,2,71,133,255,175,12,63,1,145,183,198,0,104,120,115,255,130,251,247,0,17,212,167,255,62,123,132,255,247,100,189,0,155,223,152,0,143,197,33,0,155,59,44,255,150,93,240,1,127,3,87,255,95,71,207,1,167,85,1,255,188,152,116,255,10,23,23,0,137,195,93,1,54,98,97,0,240,0,168,255,148,188,127,0,134,107,151,0,76,253,171,0,90,132,192,0,146,22,54,0,224,66,54,254,230,186,229,255,39,182,196,0,148,251,130,255,65,131,108,254,128,1,160,0,169,49,167,254,199,254,148,255,251,6,131,0,187,254,129,255,85,82,62,0,178,23,58,255,254,132,5,0,164,213,39,0,134,252,146,254,37,53,81,255,155,134,82,0,205,167,238,255,94,45,180,255,132,40,161,0,254,111,112,1,54,75,217,0,179,230,221,1,235,94,191,255,23,243,48,1,202,145,203,255,39,118,42,255,117,141,253,0,254,0,222,0,43,251,50,0,54,169,234,1,80,68,208,0,148,203,243,254,145,7,135,0,6,254,0,0,252,185,127,0,98,8,129,255,38,35,72,255,211,36,220,1,40,26,89,0,168,64,197,254,3,222,239,255,2,83,215,254,180,159,105,0,58,115,194,0,186,116,106,255,229,247,219,255,129,118,193,0,202,174,183,1,166,161,72,0,201,107,147,254,237,136,74,0,233,230,106,1,105,111,168,0,64,224,30,1,1,229,3,0,102,151,175,255,194,238,228,255,254,250,212,0,187,237,121,0,67,251,96,1,197,30,11,0,183,95,204,0,205,89,138,0,64,221,37,1,255,223,30,255,178,48,211,255,241,200,90,255,167,209,96,255,57,130,221,0,46,114,200,255,61,184,66,0,55,182,24,254,110,182,33,0,171,190,232,255,114,94,31,0,18,221,8,0,47,231,254,0,255,112,83,0,118,15,215,255,173,25,40,254,192,193,31,255,238,21,146,255,171,193,118,255,101,234,53,254,131,212,112,0,89,192,107,1,8,208,27,0,181,217,15,255,231,149,232,0,140,236,126,0,144,9,199,255,12,79,181,254,147,182,202,255,19,109,182,255,49,212,225,0,74,163,203,0,175,233,148,0,26,112,51,0,193,193,9,255,15,135,249,0,150,227,130,0,204,0,219,1,24,242,205,0,238,208,117,255,22,244,112,0,26,229,34,0,37,80,188,255,38,45,206,254,240,90,225,255,29,3,47,255,42,224,76,0,186,243,167,0,32,132,15,255,5,51,125,0,139,135,24,0,6,241,219,0,172,229,133,255,246,214,50,0,231,11,207,255,191,126,83,1,180,163,170,255,245,56,24,1,178,164,211,255,3,16,202,1,98,57,118,255,141,131,89,254,33,51,24,0,243,149,91,255,253,52,14,0,35,169,67,254,49,30,88,255,179,27,36,255,165,140,183,0,58,189,151,0,88,31,0,0,75,169,66,0,66,101,199,255,24,216,199,1,121,196,26,255,14,79,203,254,240,226,81,255,94,28,10,255,83,193,240,255,204,193,131,255,94,15,86,0,218,40,157,0,51,193,209,0,0,242,177,0,102,185,247,0,158,109,116,0,38,135,91,0,223,175,149,0,220,66,1,255,86,60,232,0,25,96,37,255,225,122,162,1,215,187,168,255,158,157,46,0,56,171,162,0,232,240,101,1,122,22,9,0,51,9,21,255,53,25,238,255,217,30,232,254,125,169,148,0,13,232,102,0,148,9,37,0,165,97,141,1,228,131,41,0,222,15,243,255,254,18,17,0,6,60,237,1,106,3,113,0,59,132,189,0,92,112,30,0,105,208,213,0,48,84,179,255,187,121,231,254,27,216,109,255,162,221,107,254,73,239,195,255,250,31,57,255,149,135,89,255,185,23,115,1,3,163,157,255,18,112,250,0,25,57,187,255,161,96,164,0,47,16,243,0,12,141,251,254,67,234,184,255,41,18,161,0,175,6,96,255,160,172,52,254,24,176,183,255,198,193,85,1,124,121,137,255,151,50,114,255,220,203,60,255,207,239,5,1,0,38,107,255,55,238,94,254,70,152,94,0,213,220,77,1,120,17,69,255,85,164,190,255,203,234,81,0,38,49,37,254,61,144,124,0,137,78,49,254,168,247,48,0,95,164,252,0,105,169,135,0,253,228,134,0,64,166,75,0,81,73,20,255,207,210,10,0,234,106,150,255,94,34,90,255,254,159,57,254,220,133,99,0,139,147,180,254,24,23,185,0,41,57,30,255,189,97,76,0,65,187,223,255,224,172,37,255,34,62,95,1,231,144,240,0,77,106,126,254,64,152,91,0,29,98,155,0,226,251,53,255,234,211,5,255,144,203,222,255,164,176,221,254,5,231,24,0,179,122,205,0,36,1,134,255,125,70,151,254,97,228,252,0,172,129,23,254,48,90,209,255,150,224,82,1,84,134,30,0,241,196,46,0,103,113,234,255,46,101,121,254,40,124,250,255,135,45,242,254,9,249,168,255,140,108,131,255,143,163,171,0,50,173,199,255,88,222,142,255,200,95,158,0,142,192,163,255,7,117,135,0,111,124,22,0,236,12,65,254,68,38,65,255,227,174,254,0,244,245,38,0,240,50,208,255,161,63,250,0,60,209,239,0,122,35,19,0,14,33,230,254,2,159,113,0,106,20,127,255,228,205,96,0,137,210,174,254,180,212,144,255,89,98,154,1,34,88,139,0,167,162,112,1,65,110,197,0,241,37,169,0,66,56,131,255,10,201,83,254,133,253,187,255,177,112,45,254,196,251,0,0,196,250,151,255,238,232,214,255,150,209,205,0,28,240,118,0,71,76,83,1,236,99,91,0,42,250,131,1,96,18,64,255,118,222,35,0,113,214,203,255,122,119,184,255,66,19,36,0,204,64,249,0,146,89,139,0,134,62,135,1,104,233,101,0,188,84,26,0,49,249,129,0,208,214,75,255,207,130,77,255,115,175,235,0,171,2,137,255,175,145,186,1,55,245,135,255,154,86,181,1,100,58,246,255,109,199,60,255,82,204,134,255,215,49,230,1,140,229,192,255,222,193,251,255,81,136,15,255,179,149,162,255,23,39,29,255,7,95,75,254,191,81,222,0,241,81,90,255,107,49,201,255,244,211,157,0,222,140,149,255,65,219,56,254,189,246,90,255,178,59,157,1,48,219,52,0,98,34,215,0,28,17,187,255,175,169,24,0,92,79,161,255,236,200,194,1,147,143,234,0,229,225,7,1,197,168,14,0,235,51,53,1,253,120,174,0,197,6,168,255,202,117,171,0,163,21,206,0,114,85,90,255,15,41,10,255,194,19,99,0,65,55,216,254,162,146,116,0,50,206,212,255,64,146,29,255,158,158,131,1,100,165,130,255,172,23,129,255,125,53,9,255,15,193,18,1,26,49,11,255,181,174,201,1,135,201,14,255,100,19,149,0,219,98,79,0,42,99,143,254,96,0,48,255,197,249,83,254,104,149,79,255,235,110,136,254,82,128,44,255,65,41,36,254,88,211,10,0,187,121,187,0,98,134,199,0,171,188,179,254,210,11,238,255,66,123,130,254,52,234,61,0,48,113,23,254,6,86,120,255,119,178,245,0,87,129,201,0,242,141,209,0,202,114,85,0,148,22,161,0,103,195,48,0,25,49,171,255,138,67,130,0,182,73,122,254,148,24,130,0,211,229,154,0,32,155,158,0,84,105,61,0,177,194,9,255,166,89,86,1,54,83,187,0,249,40,117,255,109,3,215,255,53,146,44,1,63,47,179,0,194,216,3,254,14,84,136,0,136,177,13,255,72,243,186,255,117,17,125,255,211,58,211,255,93,79,223,0,90,88,245,255,139,209,111,255,70,222,47,0,10,246,79,255,198,217,178,0,227,225,11,1,78,126,179,255,62,43,126,0,103,148,35,0,129,8,165,254,245,240,148,0,61,51,142,0,81,208,134,0,15,137,115,255,211,119,236,255,159,245,248,255,2,134,136,255,230,139,58,1,160,164,254,0,114,85,141,255,49,166,182,255,144,70,84,1,85,182,7,0,46,53,93,0,9,166,161,255,55,162,178,255,45,184,188,0,146,28,44,254,169,90,49,0,120,178,241,1,14,123,127,255,7,241,199,1,189,66,50,255,198,143,101,254,189,243,135,255,141,24,24,254,75,97,87,0,118,251,154,1,237,54,156,0,171,146,207,255,131,196,246,255,136,64,113,1,151,232,57,0,240,218,115,0,49,61,27,255,64,129,73,1,252,169,27,255,40,132,10,1,90,201,193,255,252,121,240,1,186,206,41,0,43,198,97,0,145,100,183,0,204,216,80,254,172,150,65,0,249,229,196,254,104,123,73,255,77,104,96,254,130,180,8,0,104,123,57,0,220,202,229,255,102,249,211,0,86,14,232,255,182,78,209,0,239,225,164,0,106,13,32,255,120,73,17,255,134,67,233,0,83,254,181,0,183,236,112,1,48,64,131,255,241,216,243,255,65,193,226,0,206,241,100,254,100,134,166,255,237,202,197,0,55,13,81,0,32,124,102,255,40,228,177,0,118,181,31,1,231,160,134,255,119,187,202,0,0,142,60,255,128,38,189,255,166,201,150,0,207,120,26,1,54,184,172,0,12,242,204,254,133,66,230,0,34,38,31,1,184,112,80,0,32,51,165,254,191,243,55,0,58,73,146,254,155,167,205,255,100,104,152,255,197,254,207,255,173,19,247,0,238,10,202,0,239,151,242,0,94,59,39,255,240,29,102,255,10,92,154,255,229,84,219,255,161,129,80,0,208,90,204,1,240,219,174,255,158,102,145,1,53,178,76,255,52,108,168,1,83,222,107,0,211,36,109,0,118,58,56,0,8,29,22,0,237,160,199,0,170,209,157,0,137,71,47,0,143,86,32,0,198,242,2,0,212,48,136,1,92,172,186,0,230,151,105,1,96,191,229,0,138,80,191,254,240,216,130,255,98,43,6,254,168,196,49,0,253,18,91,1,144,73,121,0,61,146,39,1,63,104,24,255,184,165,112,254,126,235,98,0,80,213,98,255,123,60,87,255,82,140,245,1,223,120,173,255,15,198,134,1,206,60,239,0,231,234,92,255,33,238,19,255,165,113,142,1,176,119,38,0,160,43,166,254,239,91,105,0,107,61,194,1,25,4,68,0,15,139,51,0,164,132,106,255,34,116,46,254,168,95,197,0,137,212,23,0,72,156,58,0,137,112,69,254,150,105,154,255,236,201,157,0,23,212,154,255,136,82,227,254,226,59,221,255,95,149,192,0,81,118,52,255,33,43,215,1,14,147,75,255,89,156,121,254,14,18,79,0,147,208,139,1,151,218,62,255,156,88,8,1,210,184,98,255,20,175,123,255,102,83,229,0,220,65,116,1,150,250,4,255,92,142,220,255,34,247,66,255,204,225,179,254,151,81,151,0,71,40,236,255,138,63,62,0,6,79,240,255,183,185,181,0,118,50,27,0,63,227,192,0,123,99,58,1,50,224,155,255,17,225,223,254,220,224,77,255,14,44,123,1,141,128,175,0,248,212,200,0,150,59,183,255,147,97,29,0,150,204,181,0,253,37,71,0,145,85,119,0,154,200,186,0,2,128,249,255,83,24,124,0,14,87,143,0,168,51,245,1,124,151,231,255,208,240,197,1,124,190,185,0,48,58,246,0,20,233,232,0,125,18,98,255,13,254,31,255,245,177,130,255,108,142,35,0,171,125,242,254,140,12,34,255,165,161,162,0,206,205,101,0,247,25,34,1,100,145,57,0,39,70,57,0,118,204,203,255,242,0,162,0,165,244,30,0,198,116,226,0,128,111,153,255,140,54,182,1,60,122,15,255,155,58,57,1,54,50,198,0,171,211,29,255,107,138,167,255,173,107,199,255,109,161,193,0,89,72,242,255,206,115,89,255,250,254,142,254,177,202,94,255,81,89,50,0,7,105,66,255,25,254,255,254,203,64,23,255,79,222,108,255,39,249,75,0,241,124,50,0,239,152,133,0,221,241,105,0,147,151,98,0,213,161,121,254,242,49,137,0,233,37,249,254,42,183,27,0,184,119,230,255,217,32,163,255,208,251,228,1,137,62,131,255,79,64,9,254,94,48,113,0,17,138,50,254,193,255,22,0,247,18,197,1,67,55,104,0,16,205,95,255,48,37,66,0,55,156,63,1,64,82,74,255,200,53,71,254,239,67,125,0,26,224,222,0,223,137,93,255,30,224,202,255,9,220,132,0,198,38,235,1,102,141,86,0,60,43,81,1,136,28,26,0,233,36,8,254,207,242,148,0,164,162,63,0,51,46,224,255,114,48,79,255,9,175,226,0,222,3,193,255,47,160,232,255,255,93,105,254,14,42,230,0,26,138,82,1,208,43,244,0,27,39,38,255,98,208,127,255,64,149,182,255,5,250,209,0,187,60,28,254,49,25,218,255,169,116,205,255,119,18,120,0,156,116,147,255,132,53,109,255,13,10,202,0,110,83,167,0,157,219,137,255,6,3,130,255,50,167,30,255,60,159,47,255,129,128,157,254,94,3,189,0,3,166,68,0,83,223,215,0,150,90,194,1,15,168,65,0,227,83,51,255,205,171,66,255,54,187,60,1,152,102,45,255,119,154,225,0,240,247,136,0,100,197,178,255,139,71,223,255,204,82,16,1,41,206,42,255,156,192,221,255,216,123,244,255,218,218,185,255,187,186,239,255,252,172,160,255,195,52,22,0,144,174,181,254,187,100,115,255,211,78,176,255,27,7,193,0,147,213,104,255,90,201,10,255,80,123,66,1,22,33,186,0,1,7,99,254,30,206,10,0,229,234,5,0,53,30,210,0,138,8,220,254,71,55,167,0,72,225,86,1,118,190,188,0,254,193,101,1,171,249,172,255,94,158,183,254,93,2,108,255,176,93,76,255,73,99,79,255,74,64,129,254,246,46,65,0,99,241,127,254,246,151,102,255,44,53,208,254,59,102,234,0,154,175,164,255,88,242,32,0,111,38,1,0,255,182,190,255,115,176,15,254,169,60,129,0,122,237,241,0,90,76,63,0,62,74,120,255,122,195,110,0,119,4,178,0,222,242,210,0,130,33,46,254,156,40,41,0,167,146,112,1,49,163,111,255,121,176,235,0,76,207,14,255,3,25,198,1,41,235,213,0,85,36,214,1,49,92,109,255,200,24,30,254,168,236,195,0,145,39,124,1,236,195,149,0,90,36,184,255,67,85,170,255,38,35,26,254,131,124,68,255,239,155,35,255,54,201,164,0,196,22,117,255,49,15,205,0,24,224,29,1,126,113,144,0,117,21,182,0,203,159,141,0,223,135,77,0,176,230,176,255,190,229,215,255,99,37,181,255,51,21,138,255,25,189,89,255,49,48,165,254,152,45,247,0,170,108,222,0,80,202,5,0,27,69,103,254,204,22,129,255,180,252,62,254,210,1,91,255,146,110,254,255,219,162,28,0,223,252,213,1,59,8,33,0,206,16,244,0,129,211,48,0,107,160,208,0,112,59,209,0,109,77,216,254,34,21,185,255,246,99,56,255,179,139,19,255,185,29,50,255,84,89,19,0,74,250,98,255,225,42,200,255,192,217,205,255,210,16,167,0,99,132,95,1,43,230,57,0,254,11,203,255,99,188,63,255,119,193,251,254,80,105,54,0,232,181,189,1,183,69,112,255,208,171,165,255,47,109,180,255,123,83,165,0,146,162,52,255,154,11,4,255,151,227,90,255,146,137,97,254,61,233,41,255,94,42,55,255,108,164,236,0,152,68,254,0,10,140,131,255,10,106,79,254,243,158,137,0,67,178,66,254,177,123,198,255,15,62,34,0,197,88,42,255,149,95,177,255,152,0,198,255,149,254,113,255,225,90,163,255,125,217,247,0,18,17,224,0,128,66,120,254,192,25,9,255,50,221,205,0,49,212,70,0,233,255,164,0,2,209,9,0,221,52,219,254,172,224,244,255,94,56,206,1,242,179,2,255,31,91,164,1,230,46,138,255,189,230,220,0,57,47,61,255,111,11,157,0,177,91,152,0,28,230,98,0,97,87,126,0,198,89,145,255,167,79,107,0,249,77,160,1,29,233,230,255,150,21,86,254,60,11,193,0,151,37,36,254,185,150,243,255,228,212,83,1,172,151,180,0,201,169,155,0,244,60,234,0,142,235,4,1,67,218,60,0,192,113,75,1,116,243,207,255,65,172,155,0,81,30,156,255,80,72,33,254,18,231,109,255,142,107,21,254,125,26,132,255,176,16,59,255,150,201,58,0,206,169,201,0,208,121,226,0,40,172,14,255,150,61,94,255,56,57,156,255,141,60,145,255,45,108,149,255,238,145,155,255,209,85,31,254,192,12,210,0,99,98,93,254,152,16,151,0,225,185,220,0,141,235,44,255,160,172,21,254,71,26,31,255,13,64,93,254,28,56,198,0,177,62,248,1,182,8,241,0,166,101,148,255,78,81,133,255,129,222,215,1,188,169,129,255,232,7,97,0,49,112,60,255,217,229,251,0,119,108,138,0,39,19,123,254,131,49,235,0,132,84,145,0,130,230,148,255,25,74,187,0,5,245,54,255,185,219,241,1,18,194,228,255,241,202,102,0,105,113,202,0,155,235,79,0,21,9,178,255,156,1,239,0,200,148,61,0,115,247,210,255,49,221,135,0,58,189,8,1,35,46,9,0,81,65,5,255,52,158,185,255,125,116,46,255,74,140,13,255,210,92,172,254,147,23,71,0,217,224,253,254,115,108,180,255,145,58,48,254,219,177,24,255,156,255,60,1,154,147,242,0,253,134,87,0,53,75,229,0,48,195,222,255,31,175,50,255,156,210,120,255,208,35,222,255,18,248,179,1,2,10,101,255,157,194,248,255,158,204,101,255,104,254,197,255,79,62,4,0,178,172,101,1,96,146,251,255,65,10,156,0,2,137,165,255,116,4,231,0,242,215,1,0,19,35,29,255,43,161,79,0,59,149,246,1,251,66,176,0,200,33,3,255,80,110,142,255,195,161,17,1,228,56,66,255,123,47,145,254,132,4,164,0,67,174,172,0,25,253,114,0,87,97,87,1,250,220,84,0,96,91,200,255,37,125,59,0,19,65,118,0,161,52,241,255,237,172,6,255,176,191,255,255,1,65,130,254,223,190,230,0,101,253,231,255,146,35,109,0,250,29,77,1,49,0,19,0,123,90,155,1,22,86,32,255,218,213,65,0,111,93,127,0,60,93,169,255,8,127,182,0,17,186,14,254,253,137,246,255,213,25,48,254,76,238,0,255,248,92,70,255,99,224,139,0,184,9,255,1,7,164,208,0,205,131,198,1,87,214,199,0,130,214,95,0,221,149,222,0,23,38,171,254,197,110,213,0,43,115,140,254,215,177,118,0,96,52,66,1,117,158,237,0,14,64,182,255,46,63,174,255,158,95,190,255,225,205,177,255,43,5,142,255,172,99,212,255,244,187,147,0,29,51,153,255,228,116,24,254,30,101,207,0,19,246,150,255,134,231,5,0,125,134,226,1,77,65,98,0,236,130,33,255,5,110,62,0,69,108,127,255,7,113,22,0,145,20,83,254,194,161,231,255,131,181,60,0,217,209,177,255,229,148,212,254,3,131,184,0,117,177,187,1,28,14,31,255,176,102,80,0,50,84,151,255,125,31,54,255,21,157,133,255,19,179,139,1,224,232,26,0,34,117,170,255,167,252,171,255,73,141,206,254,129,250,35,0,72,79,236,1,220,229,20,255,41,202,173,255,99,76,238,255,198,22,224,255,108,198,195,255,36,141,96,1,236,158,59,255,106,100,87,0,110,226,2,0,227,234,222,0,154,93,119,255,74,112,164,255,67,91,2,255,21,145,33,255,102,214,137,255,175,230,103,254,163,246,166,0,93,247,116,254,167,224,28,255,220,2,57,1,171,206,84,0,123,228,17,255,27,120,119,0,119,11,147,1,180,47,225,255,104,200,185,254,165,2,114,0,77,78,212,0,45,154,177,255,24,196,121,254,82,157,182,0,90,16,190,1,12,147,197,0,95,239,152,255,11,235,71,0,86,146,119,255,172,134,214,0,60,131,196,0,161,225,129,0,31,130,120,254,95,200,51,0,105,231,210,255,58,9,148,255,43,168,221,255,124,237,142,0,198,211,50,254,46,245,103,0,164,248,84,0,152,70,208,255,180,117,177,0,70,79,185,0,243,74,32,0,149,156,207,0,197,196,161,1,245,53,239,0,15,93,246,254,139,240,49,255,196,88,36,255,162,38,123,0,128,200,157,1,174,76,103,255,173,169,34,254,216,1,171,255,114,51,17,0,136,228,194,0,110,150,56,254,106,246,159,0,19,184,79,255,150,77,240,255,155,80,162,0,0,53,169,255,29,151,86,0,68,94,16,0,92,7,110,254,98,117,149,255,249,77,230,255,253,10,140,0,214,124,92,254,35,118,235,0,89,48,57,1,22,53,166,0,184,144,61,255,179,255,194,0,214,248,61,254,59,110,246,0,121,21,81,254,166,3,228,0,106,64,26,255,69,232,134,255,242,220,53,254,46,220,85,0,113,149,247,255,97,179,103,255,190,127,11,0,135,209,182,0,95,52,129,1,170,144,206,255,122,200,204,255,168,100,146,0,60,144,149,254,70,60,40,0,122,52,177,255,246,211,101,255,174,237,8,0,7,51,120,0,19,31,173,0,126,239,156,255,143,189,203,0,196,128,88,255,233,133,226,255,30,125,173,255,201,108,50,0,123,100,59,255,254,163,3,1,221,148,181,255,214,136,57,254,222,180,137,255,207,88,54,255,28,33,251,255,67,214,52,1,210,208,100,0,81,170,94,0,145,40,53,0,224,111,231,254,35,28,244,255,226,199,195,254,238,17,230,0,217,217,164,254,169,157,221,0,218,46,162,1,199,207,163,255,108,115,162,1,14,96,187,255,118,60,76,0,184,159,152,0,209,231,71,254,42,164,186,255,186,153,51,254,221,171,182,255,162,142,173,0,235,47,193,0,7,139,16,1,95,164,64,255,16,221,166,0,219,197,16,0,132,29,44,255,100,69,117,255,60,235,88,254,40,81,173,0,71,190,61,255,187,88,157,0,231,11,23,0,237,117,164,0,225,168,223,255,154,114,116,255,163,152,242,1,24,32,170,0,125,98,113,254,168,19,76,0,17,157,220,254,155,52,5,0,19,111,161,255,71,90,252,255,173,110,240,0,10,198,121,255,253,255,240,255,66,123,210,0,221,194,215,254,121,163,17,255,225,7,99,0,190,49,182,0,115,9,133,1,232,26,138,255,213,68,132,0,44,119,122,255,179,98,51,0,149,90,106,0,71,50,230,255,10,153,118,255,177,70,25,0,165,87,205,0,55,138,234,0,238,30,97,0,113,155,207,0,98,153,127,0,34,107,219,254,117,114,172,255,76,180,255,254,242,57,179,255,221,34,172,254,56,162,49,255,83,3,255,255,113,221,189,255,188,25,228,254,16,88,89,255,71,28,198,254,22,17,149,255,243,121,254,255,107,202,99,255,9,206,14,1,220,47,153,0,107,137,39,1,97,49,194,255,149,51,197,254,186,58,11,255,107,43,232,1,200,6,14,255,181,133,65,254,221,228,171,255,123,62,231,1,227,234,179,255,34,189,212,254,244,187,249,0,190,13,80,1,130,89,1,0,223,133,173,0,9,222,198,255,66,127,74,0,167,216,93,255,155,168,198,1,66,145,0,0,68,102,46,1,172,90,154,0,216,128,75,255,160,40,51,0,158,17,27,1,124,240,49,0,236,202,176,255,151,124,192,255,38,193,190,0,95,182,61,0,163,147,124,255,255,165,51,255,28,40,17,254,215,96,78,0,86,145,218,254,31,36,202,255,86,9,5,0,111,41,200,255,237,108,97,0,57,62,44,0,117,184,15,1,45,241,116,0,152,1,220,255,157,165,188,0,250,15,131,1,60,44,125,255,65,220,251,255,75,50,184,0,53,90,128,255,231,80,194,255,136,129,127,1,21,18,187,255,45,58,161,255,71,147,34,0,174,249,11,254,35,141,29,0,239,68,177,255,115,110,58,0,238,190,177,1,87,245,166,255,190,49,247,255,146,83,184,255,173,14,39,255,146,215,104,0,142,223,120,0,149,200,155,255,212,207,145,1,16,181,217,0,173,32,87,255,255,35,181,0,119,223,161,1,200,223,94,255,70,6,186,255,192,67,85,255,50,169,152,0,144,26,123,255,56,243,179,254,20,68,136,0,39,140,188,254,253,208,5,255,200,115,135,1,43,172,229,255,156,104,187,0,151,251,167,0,52,135,23,0,151,153,72,0,147,197,107,254,148,158,5,255,238,143,206,0,126,153,137,255,88,152,197,254,7,68,167,0,252,159,165,255,239,78,54,255,24,63,55,255,38,222,94,0,237,183,12,255,206,204,210,0,19,39,246,254,30,74,231,0,135,108,29,1,179,115,0,0,117,118,116,1,132,6,252,255,145,129,161,1,105,67,141,0,82,37,226,255,238,226,228,255,204,214,129,254,162,123,100,255,185,121,234,0,45,108,231,0,66,8,56,255,132,136,128,0,172,224,66,254,175,157,188,0,230,223,226,254,242,219,69,0,184,14,119,1,82,162,56,0,114,123,20,0,162,103,85,255,49,239,99,254,156,135,215,0,111,255,167,254,39,196,214,0,144,38,79,1,249,168,125,0,155,97,156,255,23,52,219,255,150,22,144,0,44,149,165,255,40,127,183,0,196,77,233,255,118,129,210,255,170,135,230,255,214,119,198,0,233,240,35,0,253,52,7,255,117,102,48,255,21,204,154,255,179,136,177,255,23,2,3,1,149,130,89,255,252,17,159,1,70,60,26,0,144,107,17,0,180,190,60,255,56,182,59,255,110,71,54,255,198,18,129,255,149,224,87,255,223,21,152,255,138,22,182,255,250,156,205,0,236,45,208,255,79,148,242,1,101,70,209,0,103,78,174,0,101,144,172,255,152,136,237,1,191,194,136,0,113,80,125,1,152,4,141,0,155,150,53,255,196,116,245,0,239,114,73,254,19,82,17,255,124,125,234,255,40,52,191,0,42,210,158,255,155,132,165,0,178,5,42,1,64,92,40,255,36,85,77,255,178,228,118,0,137,66,96,254,115,226,66,0,110,240,69,254,151,111,80,0,167,174,236,255,227,108,107,255,188,242,65,255,183,81,255,0,57,206,181,255,47,34,181,255,213,240,158,1,71,75,95,0,156,40,24,255,102,210,81,0,171,199,228,255,154,34,41,0,227,175,75,0,21,239,195,0,138,229,95,1,76,192,49,0,117,123,87,1,227,225,130,0,125,62,63,255,2,198,171,0,254,36,13,254,145,186,206,0,148,255,244,255,35,0,166,0,30,150,219,1,92,228,212,0,92,198,60,254,62,133,200,255,201,41,59,0,125,238,109,255,180,163,238,1,140,122,82,0,9,22,88,255,197,157,47,255,153,94,57,0,88,30,182,0,84,161,85,0,178,146,124,0,166,166,7,255,21,208,223,0,156,182,242,0,155,121,185,0,83,156,174,254,154,16,118,255,186,83,232,1,223,58,121,255,29,23,88,0,35,125,127,255,170,5,149,254,164,12,130,255,155,196,29,0,161,96,136,0,7,35,29,1,162,37,251,0,3,46,242,255,0,217,188,0,57,174,226,1,206,233,2,0,57,187,136,254,123,189,9,255,201,117,127,255,186,36,204,0,231,25,216,0,80,78,105,0,19,134,129,255,148,203,68,0,141,81,125,254,248,165,200,255,214,144,135,0,151,55,166,255,38,235,91,0,21,46,154,0,223,254,150,255,35,153,180,255,125,176,29,1,43,98,30,255,216,122,230,255,233,160,12,0,57,185,12,254,240,113,7,255,5,9,16,254,26,91,108,0,109,198,203,0,8,147,40,0,129,134,228,255,124,186,40,255,114,98,132,254,166,132,23,0,99,69,44,0,9,242,238,255,184,53,59,0,132,129,102,255,52,32,243,254,147,223,200,255,123,83,179,254,135,144,201,255,141,37,56,1,151,60,227,255,90,73,156,1,203,172,187,0,80,151,47,255,94,137,231,255,36,191,59,255,225,209,181,255,74,215,213,254,6,118,179,255,153,54,193,1,50,0,231,0,104,157,72,1,140,227,154,255,182,226,16,254,96,225,92,255,115,20,170,254,6,250,78,0,248,75,173,255,53,89,6,255,0,180,118,0,72,173,1,0,64,8,206,1,174,133,223,0,185,62,133,255,214,11,98,0,197,31,208,0,171,167,244,255,22,231,181,1,150,218,185,0,247,169,97,1,165,139,247,255,47,120,149,1,103,248,51,0,60,69,28,254,25,179,196,0,124,7,218,254,58,107,81,0,184,233,156,255,252,74,36,0,118,188,67,0,141,95,53,255,222,94,165,254,46,61,53,0,206,59,115,255,47,236,250,255,74,5,32,1,129,154,238,255,106,32,226,0,121,187,61,255,3,166,241,254,67,170,172,255,29,216,178,255,23,201,252,0,253,110,243,0,200,125,57,0,109,192,96,255,52,115,238,0,38,121,243,255,201,56,33,0,194,118,130,0,75,96,25,255,170,30,230,254,39,63,253,0,36,45,250,255,251,1,239,0,160,212,92,1,45,209,237,0,243,33,87,254,237,84,201,255,212,18,157,254,212,99,127,255,217,98,16,254,139,172,239,0,168,201,130,255,143,193,169,255,238,151,193,1,215,104,41,0,239,61,165,254,2,3,242,0,22,203,177,254,177,204,22,0,149,129,213,254,31,11,41,255,0,159,121,254,160,25,114,255,162,80,200,0,157,151,11,0,154,134,78,1,216,54,252,0,48,103,133,0,105,220,197,0,253,168,77,254,53,179,23,0,24,121,240,1,255,46,96,255,107,60,135,254,98,205,249,255,63,249,119,255,120,59,211,255,114,180,55,254,91,85,237,0,149,212,77,1,56,73,49,0,86,198,150,0,93,209,160,0,69,205,182,255,244,90,43,0,20,36,176,0,122,116,221,0,51,167,39,1,231,1,63,255,13,197,134,0,3,209,34,255,135,59,202,0,167,100,78,0,47,223,76,0,185,60,62,0,178,166,123,1,132,12,161,255,61,174,43,0,195,69,144,0,127,47,191,1,34,44,78,0,57,234,52,1,255,22,40,255,246,94,146,0,83,228,128,0,60,78,224,255,0,96,210,255,153,175,236,0,159,21,73,0,180,115,196,254,131,225,106,0,255,167,134,0,159,8,112,255,120,68,194,255,176,196,198,255,118,48,168,255,93,169,1,0,112,200,102,1,74,24,254,0,19,141,4,254,142,62,63,0,131,179,187,255,77,156,155,255,119,86,164,0,170,208,146,255,208,133,154,255,148,155,58,255,162,120,232,254,252,213,155,0,241,13,42,0,94,50,131,0,179,170,112,0,140,83,151,255,55,119,84,1,140,35,239,255,153,45,67,1,236,175,39,0,54,151,103,255,158,42,65,255,196,239,135,254,86,53,203,0,149,97,47,254,216,35,17,255,70,3,70,1,103,36,90,255,40,26,173,0,184,48,13,0,163,219,217,255,81,6,1,255,221,170,108,254,233,208,93,0,100,201,249,254,86,36,35,255,209,154,30,1,227,201,251,255,2,189,167,254,100,57,3,0,13,128,41,0,197,100,75,0,150,204,235,255,145,174,59,0,120,248,149,255,85,55,225,0,114,210,53,254,199,204,119,0,14,247,74,1,63,251,129,0,67,104,151,1,135,130,80,0,79,89,55,255,117,230,157,255,25,96,143,0,213,145,5,0,69,241,120,1,149,243,95,255,114,42,20,0,131,72,2,0,154,53,20,255,73,62,109,0,196,102,152,0,41,12,204,255,122,38,11,1,250,10,145,0,207,125,148,0,246,244,222,255,41,32,85,1,112,213,126,0,162,249,86,1,71,198,127,255,81,9,21,1,98,39,4,255,204,71,45,1,75,111,137,0,234,59,231,0,32,48,95,255,204,31,114,1,29,196,181,255,51,241,167,254,93,109,142,0,104,144,45,0,235,12,181,255,52,112,164,0,76,254,202,255,174,14,162,0,61,235,147,255,43,64,185,254,233,125,217,0,243,88,167,254,74,49,8,0,156,204,66,0,124,214,123,0,38,221,118,1,146,112,236,0,114,98,177,0,151,89,199,0,87,197,112,0,185,149,161,0,44,96,165,0,248,179,20,255,188,219,216,254,40,62,13,0,243,142,141,0,229,227,206,255,172,202,35,255,117,176,225,255,82,110,38,1,42,245,14,255,20,83,97,0,49,171,10,0,242,119,120,0,25,232,61,0,212,240,147,255,4,115,56,255,145,17,239,254,202,17,251,255,249,18,245,255,99,117,239,0,184,4,179,255,246,237,51,255,37,239,137,255,166,112,166,255,81,188,33,255,185,250,142,255,54,187,173,0,208,112,201,0,246,43,228,1,104,184,88,255,212,52,196,255,51,117,108,255,254,117,155,0,46,91,15,255,87,14,144,255,87,227,204,0,83,26,83,1,159,76,227,0,159,27,213,1,24,151,108,0,117,144,179,254,137,209,82,0,38,159,10,0,115,133,201,0,223,182,156,1,110,196,93,255,57,60,233,0,5,167,105,255,154,197,164,0,96,34,186,255,147,133,37,1,220,99,190,0,1,167,84,255,20,145,171,0,194,197,251,254,95,78,133,255,252,248,243,255,225,93,131,255,187,134,196,255,216,153,170,0,20,118,158,254,140,1,118,0,86,158,15,1,45,211,41,255,147,1,100,254,113,116,76,255,211,127,108,1,103,15,48,0,193,16,102,1,69,51,95,255,107,128,157,0,137,171,233,0,90,124,144,1,106,161,182,0,175,76,236,1,200,141,172,255,163,58,104,0,233,180,52,255,240,253,14,255,162,113,254,255,38,239,138,254,52,46,166,0,241,101,33,254,131,186,156,0,111,208,62,255,124,94,160,255,31,172,254,0,112,174,56,255,188,99,27,255,67,138,251,0,125,58,128,1,156,152,174,255,178,12,247,255,252,84,158,0,82,197,14,254,172,200,83,255,37,39,46,1,106,207,167,0,24,189,34,0,131,178,144,0,206,213,4,0,161,226,210,0,72,51,105,255,97,45,187,255,78,184,223,255,176,29,251,0,79,160,86,255,116,37,178,0,82,77,213,1,82,84,141,255,226,101,212,1,175,88,199,255,245,94,247,1,172,118,109,255,166,185,190,0,131,181,120,0,87,254,93,255,134,240,73,255,32,245,143,255,139,162,103,255,179,98,18,254,217,204,112,0,147,223,120,255,53,10,243,0,166,140,150,0,125,80,200,255,14,109,219,255,91,218,1,255,252,252,47,254,109,156,116,255,115,49,127,1,204,87,211,255,148,202,217,255,26,85,249,255,14,245,134,1,76,89,169,255,242,45,230,0,59,98,172,255,114,73,132,254,78,155,49,255,158,126,84,0,49,175,43,255,16,182,84,255,157,103,35,0,104,193,109,255,67,221,154,0,201,172,1,254,8,162,88,0,165,1,29,255,125,155,229,255,30,154,220,1,103,239,92,0,220,1,109,255,202,198,1,0,94,2,142,1,36,54,44,0,235,226,158,255,170,251,214,255,185,77,9,0,97,74,242,0,219,163,149,255,240,35,118,255,223,114,88,254,192,199,3,0,106,37,24,255,201,161,118,255,97,89,99,1,224,58,103,255,101,199,147,254,222,60,99,0,234,25,59,1,52,135,27,0,102,3,91,254,168,216,235,0,229,232,136,0,104,60,129,0,46,168,238,0,39,191,67,0,75,163,47,0,143,97,98,255,56,216,168,1,168,233,252,255,35,111,22,255,92,84,43,0,26,200,87,1,91,253,152,0,202,56,70,0,142,8,77,0,80,10,175,1,252,199,76,0,22,110,82,255,129,1,194,0,11,128,61,1,87,14,145,255,253,222,190,1,15,72,174,0,85,163,86,254,58,99,44,255,45,24,188,254,26,205,15,0,19,229,210,254,248,67,195,0,99,71,184,0,154,199,37,255,151,243,121,255,38,51,75,255,201,85,130,254,44,65,250,0,57,147,243,254,146,43,59,255,89,28,53,0,33,84,24,255,179,51,18,254,189,70,83,0,11,156,179,1,98,134,119,0,158,111,111,0,119,154,73,255,200,63,140,254,45,13,13,255,154,192,2,254,81,72,42,0,46,160,185,254,44,112,6,0,146,215,149,1,26,176,104,0,68,28,87,1,236,50,153,255,179,128,250,254,206,193,191,255,166,92,137,254,53,40,239,0,210,1,204,254,168,173,35,0,141,243,45,1,36,50,109,255,15,242,194,255,227,159,122,255,176,175,202,254,70,57,72,0,40,223,56,0,208,162,58,255,183,98,93,0,15,111,12,0,30,8,76,255,132,127,246,255,45,242,103,0,69,181,15,255,10,209,30,0,3,179,121,0,241,232,218,1,123,199,88,255,2,210,202,1,188,130,81,255,94,101,208,1,103,36,45,0,76,193,24,1,95,26,241,255,165,162,187,0,36,114,140,0,202,66,5,255,37,56,147,0,152,11,243,1,127,85,232,255,250,135,212,1,185,177,113,0,90,220,75,255,69,248,146,0,50,111,50,0,92,22,80,0,244,36,115,254,163,100,82,255,25,193,6,1,127,61,36,0,253,67,30,254,65,236,170,255,161,17,215,254,63,175,140,0,55,127,4,0,79,112,233,0,109,160,40,0,143,83,7,255,65,26,238,255,217,169,140,255,78,94,189,255,0,147,190,255,147,71,186,254,106,77,127,255,233,157,233,1,135,87,237,255,208,13,236,1,155,109,36,255,180,100,218,0,180,163,18,0,190,110,9,1,17,63,123,255,179,136,180,255,165,123,123,255,144,188,81,254,71,240,108,255,25,112,11,255,227,218,51,255,167,50,234,255,114,79,108,255,31,19,115,255,183,240,99,0,227,87,143,255,72,217,248,255,102,169,95,1,129,149,149,0,238,133,12,1,227,204,35,0,208,115,26,1,102,8,234,0,112,88,143,1,144,249,14,0,240,158,172,254,100,112,119,0,194,141,153,254,40,56,83,255,121,176,46,0,42,53,76,255,158,191,154,0,91,209,92,0,173,13,16,1,5,72,226,255,204,254,149,0,80,184,207,0,100,9,122,254,118,101,171,255,252,203,0,254,160,207,54,0,56,72,249,1,56,140,13,255,10,64,107,254,91,101,52,255,225,181,248,1,139,255,132,0,230,145,17,0,233,56,23,0,119,1,241,255,213,169,151,255,99,99,9,254,185,15,191,255,173,103,109,1,174,13,251,255,178,88,7,254,27,59,68,255,10,33,2,255,248,97,59,0,26,30,146,1,176,147,10,0,95,121,207,1,188,88,24,0,185,94,254,254,115,55,201,0,24,50,70,0,120,53,6,0,142,66,146,0,228,226,249,255,104,192,222,1,173,68,219,0,162,184,36,255,143,102,137,255,157,11,23,0,125,45,98,0,235,93,225,254,56,112,160,255,70,116,243,1,153,249,55,255,129,39,17,1,241,80,244,0,87,69,21,1,94,228,73,255,78,66,65,255,194,227,231,0,61,146,87,255,173,155,23,255,112,116,219,254,216,38,11,255,131,186,133,0,94,212,187,0,100,47,91,0,204,254,175,255,222,18,215,254,173,68,108,255,227,228,79,255,38,221,213,0,163,227,150,254,31,190,18,0,160,179,11,1,10,90,94,255,220,174,88,0,163,211,229,255,199,136,52,0,130,95,221,255,140,188,231,254,139,113,128,255,117,171,236,254,49,220,20,255,59,20,171,255,228,109,188,0,20,225,32,254,195,16,174,0,227,254,136,1,135,39,105,0,150,77,206,255,210,238,226,0,55,212,132,254,239,57,124,0,170,194,93,255,249,16,247,255,24,151,62,255,10,151,10,0,79,139,178,255,120,242,202,0,26,219,213,0,62,125,35,255,144,2,108,255,230,33,83,255,81,45,216,1,224,62,17,0,214,217,125,0,98,153,153,255], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+10240);
  1304. /* memory initializer */ allocate([179,176,106,254,131,93,138,255,109,62,36,255,178,121,32,255,120,252,70,0,220,248,37,0,204,88,103,1,128,220,251,255,236,227,7,1,106,49,198,255,60,56,107,0,99,114,238,0,220,204,94,1,73,187,1,0,89,154,34,0,78,217,165,255,14,195,249,255,9,230,253,255,205,135,245,0,26,252,7,255,84,205,27,1,134,2,112,0,37,158,32,0,231,91,237,255,191,170,204,255,152,7,222,0,109,192,49,0,193,166,146,255,232,19,181,255,105,142,52,255,103,16,27,1,253,200,165,0,195,217,4,255,52,189,144,255,123,155,160,254,87,130,54,255,78,120,61,255,14,56,41,0,25,41,125,255,87,168,245,0,214,165,70,0,212,169,6,255,219,211,194,254,72,93,164,255,197,33,103,255,43,142,141,0,131,225,172,0,244,105,28,0,68,68,225,0,136,84,13,255,130,57,40,254,139,77,56,0,84,150,53,0,54,95,157,0,144,13,177,254,95,115,186,0,117,23,118,255,244,166,241,255,11,186,135,0,178,106,203,255,97,218,93,0,43,253,45,0,164,152,4,0,139,118,239,0,96,1,24,254,235,153,211,255,168,110,20,255,50,239,176,0,114,41,232,0,193,250,53,0,254,160,111,254,136,122,41,255,97,108,67,0,215,152,23,255,140,209,212,0,42,189,163,0,202,42,50,255,106,106,189,255,190,68,217,255,233,58,117,0,229,220,243,1,197,3,4,0,37,120,54,254,4,156,134,255,36,61,171,254,165,136,100,255,212,232,14,0,90,174,10,0,216,198,65,255,12,3,64,0,116,113,115,255,248,103,8,0,231,125,18,255,160,28,197,0,30,184,35,1,223,73,249,255,123,20,46,254,135,56,37,255,173,13,229,1,119,161,34,255,245,61,73,0,205,125,112,0,137,104,134,0,217,246,30,255,237,142,143,0,65,159,102,255,108,164,190,0,219,117,173,255,34,37,120,254,200,69,80,0,31,124,218,254,74,27,160,255,186,154,199,255,71,199,252,0,104,81,159,1,17,200,39,0,211,61,192,1,26,238,91,0,148,217,12,0,59,91,213,255,11,81,183,255,129,230,122,255,114,203,145,1,119,180,66,255,72,138,180,0,224,149,106,0,119,82,104,255,208,140,43,0,98,9,182,255,205,101,134,255,18,101,38,0,95,197,166,255,203,241,147,0,62,208,145,255,133,246,251,0,2,169,14,0,13,247,184,0,142,7,254,0,36,200,23,255,88,205,223,0,91,129,52,255,21,186,30,0,143,228,210,1,247,234,248,255,230,69,31,254,176,186,135,255,238,205,52,1,139,79,43,0,17,176,217,254,32,243,67,0,242,111,233,0,44,35,9,255,227,114,81,1,4,71,12,255,38,105,191,0,7,117,50,255,81,79,16,0,63,68,65,255,157,36,110,255,77,241,3,255,226,45,251,1,142,25,206,0,120,123,209,1,28,254,238,255,5,128,126,255,91,222,215,255,162,15,191,0,86,240,73,0,135,185,81,254,44,241,163,0,212,219,210,255,112,162,155,0,207,101,118,0,168,72,56,255,196,5,52,0,72,172,242,255,126,22,157,255,146,96,59,255,162,121,152,254,140,16,95,0,195,254,200,254,82,150,162,0,119,43,145,254,204,172,78,255,166,224,159,0,104,19,237,255,245,126,208,255,226,59,213,0,117,217,197,0,152,72,237,0,220,31,23,254,14,90,231,255,188,212,64,1,60,101,246,255,85,24,86,0,1,177,109,0,146,83,32,1,75,182,192,0,119,241,224,0,185,237,27,255,184,101,82,1,235,37,77,255,253,134,19,0,232,246,122,0,60,106,179,0,195,11,12,0,109,66,235,1,125,113,59,0,61,40,164,0,175,104,240,0,2,47,187,255,50,12,141,0,194,139,181,255,135,250,104,0,97,92,222,255,217,149,201,255,203,241,118,255,79,151,67,0,122,142,218,255,149,245,239,0,138,42,200,254,80,37,97,255,124,112,167,255,36,138,87,255,130,29,147,255,241,87,78,255,204,97,19,1,177,209,22,255,247,227,127,254,99,119,83,255,212,25,198,1,16,179,179,0,145,77,172,254,89,153,14,255,218,189,167,0,107,233,59,255,35,33,243,254,44,112,112,255,161,127,79,1,204,175,10,0,40,21,138,254,104,116,228,0,199,95,137,255,133,190,168,255,146,165,234,1,183,99,39,0,183,220,54,254,255,222,133,0,162,219,121,254,63,239,6,0,225,102,54,255,251,18,246,0,4,34,129,1,135,36,131,0,206,50,59,1,15,97,183,0,171,216,135,255,101,152,43,255,150,251,91,0,38,145,95,0,34,204,38,254,178,140,83,255,25,129,243,255,76,144,37,0,106,36,26,254,118,144,172,255,68,186,229,255,107,161,213,255,46,163,68,255,149,170,253,0,187,17,15,0,218,160,165,255,171,35,246,1,96,13,19,0,165,203,117,0,214,107,192,255,244,123,177,1,100,3,104,0,178,242,97,255,251,76,130,255,211,77,42,1,250,79,70,255,63,244,80,1,105,101,246,0,61,136,58,1,238,91,213,0,14,59,98,255,167,84,77,0,17,132,46,254,57,175,197,255,185,62,184,0,76,64,207,0,172,175,208,254,175,74,37,0,138,27,211,254,148,125,194,0,10,89,81,0,168,203,101,255,43,213,209,1,235,245,54,0,30,35,226,255,9,126,70,0,226,125,94,254,156,117,20,255,57,248,112,1,230,48,64,255,164,92,166,1,224,214,230,255,36,120,143,0,55,8,43,255,251,1,245,1,106,98,165,0,74,107,106,254,53,4,54,255,90,178,150,1,3,120,123,255,244,5,89,1,114,250,61,255,254,153,82,1,77,15,17,0,57,238,90,1,95,223,230,0,236,52,47,254,103,148,164,255,121,207,36,1,18,16,185,255,75,20,74,0,187,11,101,0,46,48,129,255,22,239,210,255,77,236,129,255,111,77,204,255,61,72,97,255,199,217,251,255,42,215,204,0,133,145,201,255,57,230,146,1,235,100,198,0,146,73,35,254,108,198,20,255,182,79,210,255,82,103,136,0,246,108,176,0,34,17,60,255,19,74,114,254,168,170,78,255,157,239,20,255,149,41,168,0,58,121,28,0,79,179,134,255,231,121,135,255,174,209,98,255,243,122,190,0,171,166,205,0,212,116,48,0,29,108,66,255,162,222,182,1,14,119,21,0,213,39,249,255,254,223,228,255,183,165,198,0,133,190,48,0,124,208,109,255,119,175,85,255,9,209,121,1,48,171,189,255,195,71,134,1,136,219,51,255,182,91,141,254,49,159,72,0,35,118,245,255,112,186,227,255,59,137,31,0,137,44,163,0,114,103,60,254,8,213,150,0,162,10,113,255,194,104,72,0,220,131,116,255,178,79,92,0,203,250,213,254,93,193,189,255,130,255,34,254,212,188,151,0,136,17,20,255,20,101,83,255,212,206,166,0,229,238,73,255,151,74,3,255,168,87,215,0,155,188,133,255,166,129,73,0,240,79,133,255,178,211,81,255,203,72,163,254,193,168,165,0,14,164,199,254,30,255,204,0,65,72,91,1,166,74,102,255,200,42,0,255,194,113,227,255,66,23,208,0,229,216,100,255,24,239,26,0,10,233,62,255,123,10,178,1,26,36,174,255,119,219,199,1,45,163,190,0,16,168,42,0,166,57,198,255,28,26,26,0,126,165,231,0,251,108,100,255,61,229,121,255,58,118,138,0,76,207,17,0,13,34,112,254,89,16,168,0,37,208,105,255,35,201,215,255,40,106,101,254,6,239,114,0,40,103,226,254,246,127,110,255,63,167,58,0,132,240,142,0,5,158,88,255,129,73,158,255,94,89,146,0,230,54,146,0,8,45,173,0,79,169,1,0,115,186,247,0,84,64,131,0,67,224,253,255,207,189,64,0,154,28,81,1,45,184,54,255,87,212,224,255,0,96,73,255,129,33,235,1,52,66,80,255,251,174,155,255,4,179,37,0,234,164,93,254,93,175,253,0,198,69,87,255,224,106,46,0,99,29,210,0,62,188,114,255,44,234,8,0,169,175,247,255,23,109,137,255,229,182,39,0,192,165,94,254,245,101,217,0,191,88,96,0,196,94,99,255,106,238,11,254,53,126,243,0,94,1,101,255,46,147,2,0,201,124,124,255,141,12,218,0,13,166,157,1,48,251,237,255,155,250,124,255,106,148,146,255,182,13,202,0,28,61,167,0,217,152,8,254,220,130,45,255,200,230,255,1,55,65,87,255,93,191,97,254,114,251,14,0,32,105,92,1,26,207,141,0,24,207,13,254,21,50,48,255,186,148,116,255,211,43,225,0,37,34,162,254,164,210,42,255,68,23,96,255,182,214,8,255,245,117,137,255,66,195,50,0,75,12,83,254,80,140,164,0,9,165,36,1,228,110,227,0,241,17,90,1,25,52,212,0,6,223,12,255,139,243,57,0,12,113,75,1,246,183,191,255,213,191,69,255,230,15,142,0,1,195,196,255,138,171,47,255,64,63,106,1,16,169,214,255,207,174,56,1,88,73,133,255,182,133,140,0,177,14,25,255,147,184,53,255,10,227,161,255,120,216,244,255,73,77,233,0,157,238,139,1,59,65,233,0,70,251,216,1,41,184,153,255,32,203,112,0,146,147,253,0,87,101,109,1,44,82,133,255,244,150,53,255,94,152,232,255,59,93,39,255,88,147,220,255,78,81,13,1,32,47,252,255,160,19,114,255,93,107,39,255,118,16,211,1,185,119,209,255,227,219,127,254,88,105,236,255,162,110,23,255,36,166,110,255,91,236,221,255,66,234,116,0,111,19,244,254,10,233,26,0,32,183,6,254,2,191,242,0,218,156,53,254,41,60,70,255,168,236,111,0,121,185,126,255,238,142,207,255,55,126,52,0,220,129,208,254,80,204,164,255,67,23,144,254,218,40,108,255,127,202,164,0,203,33,3,255,2,158,0,0,37,96,188,255,192,49,74,0,109,4,0,0,111,167,10,254,91,218,135,255,203,66,173,255,150,194,226,0,201,253,6,255,174,102,121,0,205,191,110,0,53,194,4,0,81,40,45,254,35,102,143,255,12,108,198,255,16,27,232,255,252,71,186,1,176,110,114,0,142,3,117,1,113,77,142,0,19,156,197,1,92,47,252,0,53,232,22,1,54,18,235,0,46,35,189,255,236,212,129,0,2,96,208,254,200,238,199,255,59,175,164,255,146,43,231,0,194,217,52,255,3,223,12,0,138,54,178,254,85,235,207,0,232,207,34,0,49,52,50,255,166,113,89,255,10,45,216,255,62,173,28,0,111,165,246,0,118,115,91,255,128,84,60,0,167,144,203,0,87,13,243,0,22,30,228,1,177,113,146,255,129,170,230,254,252,153,129,255,145,225,43,0,70,231,5,255,122,105,126,254,86,246,148,255,110,37,154,254,209,3,91,0,68,145,62,0,228,16,165,255,55,221,249,254,178,210,91,0,83,146,226,254,69,146,186,0,93,210,104,254,16,25,173,0,231,186,38,0,189,122,140,255,251,13,112,255,105,110,93,0,251,72,170,0,192,23,223,255,24,3,202,1,225,93,228,0,153,147,199,254,109,170,22,0,248,101,246,255,178,124,12,255,178,254,102,254,55,4,65,0,125,214,180,0,183,96,147,0,45,117,23,254,132,191,249,0,143,176,203,254,136,183,54,255,146,234,177,0,146,101,86,255,44,123,143,1,33,209,152,0,192,90,41,254,83,15,125,255,213,172,82,0,215,169,144,0,16,13,34,0,32,209,100,255,84,18,249,1,197,17,236,255,217,186,230,0,49,160,176,255,111,118,97,255,237,104,235,0,79,59,92,254,69,249,11,255,35,172,74,1,19,118,68,0,222,124,165,255,180,66,35,255,86,174,246,0,43,74,111,255,126,144,86,255,228,234,91,0,242,213,24,254,69,44,235,255,220,180,35,0,8,248,7,255,102,47,92,255,240,205,102,255,113,230,171,1,31,185,201,255,194,246,70,255,122,17,187,0,134,70,199,255,149,3,150,255,117,63,103,0,65,104,123,255,212,54,19,1,6,141,88,0,83,134,243,255,136,53,103,0,169,27,180,0,177,49,24,0,111,54,167,0,195,61,215,255,31,1,108,1,60,42,70,0,185,3,162,255,194,149,40,255,246,127,38,254,190,119,38,255,61,119,8,1,96,161,219,255,42,203,221,1,177,242,164,255,245,159,10,0,116,196,0,0,5,93,205,254,128,127,179,0,125,237,246,255,149,162,217,255,87,37,20,254,140,238,192,0,9,9,193,0,97,1,226,0,29,38,10,0,0,136,63,255,229,72,210,254,38,134,92,255,78,218,208,1,104,36,84,255,12,5,193,255,242,175,61,255,191,169,46,1,179,147,147,255,113,190,139,254,125,172,31,0,3,75,252,254,215,36,15,0,193,27,24,1,255,69,149,255,110,129,118,0,203,93,249,0,138,137,64,254,38,70,6,0,153,116,222,0,161,74,123,0,193,99,79,255,118,59,94,255,61,12,43,1,146,177,157,0,46,147,191,0,16,255,38,0,11,51,31,1,60,58,98,255,111,194,77,1,154,91,244,0,140,40,144,1,173,10,251,0,203,209,50,254,108,130,78,0,228,180,90,0,174,7,250,0,31,174,60,0,41,171,30,0,116,99,82,255,118,193,139,255,187,173,198,254,218,111,56,0,185,123,216,0,249,158,52,0,52,180,93,255,201,9,91,255,56,45,166,254,132,155,203,255,58,232,110,0,52,211,89,255,253,0,162,1,9,87,183,0,145,136,44,1,94,122,245,0,85,188,171,1,147,92,198,0,0,8,104,0,30,95,174,0,221,230,52,1,247,247,235,255,137,174,53,255,35,21,204,255,71,227,214,1,232,82,194,0,11,48,227,255,170,73,184,255,198,251,252,254,44,112,34,0,131,101,131,255,72,168,187,0,132,135,125,255,138,104,97,255,238,184,168,255,243,104,84,255,135,216,226,255,139,144,237,0,188,137,150,1,80,56,140,255,86,169,167,255,194,78,25,255,220,17,180,255,17,13,193,0,117,137,212,255,141,224,151,0,49,244,175,0,193,99,175,255,19,99,154,1,255,65,62,255,156,210,55,255,242,244,3,255,250,14,149,0,158,88,217,255,157,207,134,254,251,232,28,0,46,156,251,255,171,56,184,255,239,51,234,0,142,138,131,255,25,254,243,1,10,201,194,0,63,97,75,0,210,239,162,0,192,200,31,1,117,214,243,0,24,71,222,254,54,40,232,255,76,183,111,254,144,14,87,255,214,79,136,255,216,196,212,0,132,27,140,254,131,5,253,0,124,108,19,255,28,215,75,0,76,222,55,254,233,182,63,0,68,171,191,254,52,111,222,255,10,105,77,255,80,170,235,0,143,24,88,255,45,231,121,0,148,129,224,1,61,246,84,0,253,46,219,255,239,76,33,0,49,148,18,254,230,37,69,0,67,134,22,254,142,155,94,0,31,157,211,254,213,42,30,255,4,228,247,254,252,176,13,255,39,0,31,254,241,244,255,255,170,45,10,254,253,222,249,0,222,114,132,0,255,47,6,255,180,163,179,1,84,94,151,255,89,209,82,254,229,52,169,255,213,236,0,1,214,56,228,255,135,119,151,255,112,201,193,0,83,160,53,254,6,151,66,0,18,162,17,0,233,97,91,0,131,5,78,1,181,120,53,255,117,95,63,255,237,117,185,0,191,126,136,255,144,119,233,0,183,57,97,1,47,201,187,255,167,165,119,1,45,100,126,0,21,98,6,254,145,150,95,255,120,54,152,0,209,98,104,0,143,111,30,254,184,148,249,0,235,216,46,0,248,202,148,255,57,95,22,0,242,225,163,0,233,247,232,255,71,171,19,255,103,244,49,255,84,103,93,255,68,121,244,1,82,224,13,0,41,79,43,255,249,206,167,255,215,52,21,254,192,32,22,255,247,111,60,0,101,74,38,255,22,91,84,254,29,28,13,255,198,231,215,254,244,154,200,0,223,137,237,0,211,132,14,0,95,64,206,255,17,62,247,255,233,131,121,1,93,23,77,0,205,204,52,254,81,189,136,0,180,219,138,1,143,18,94,0,204,43,140,254,188,175,219,0,111,98,143,255,151,63,162,255,211,50,71,254,19,146,53,0,146,45,83,254,178,82,238,255,16,133,84,255,226,198,93,255,201,97,20,255,120,118,35,255,114,50,231,255,162,229,156,255,211,26,12,0,114,39,115,255,206,212,134,0,197,217,160,255,116,129,94,254,199,215,219,255,75,223,249,1,253,116,181,255,232,215,104,255,228,130,246,255,185,117,86,0,14,5,8,0,239,29,61,1,237,87,133,255,125,146,137,254,204,168,223,0,46,168,245,0,154,105,22,0,220,212,161,255,107,69,24,255,137,218,181,255,241,84,198,255,130,122,211,255,141,8,153,255,190,177,118,0,96,89,178,0,255,16,48,254,122,96,105,255,117,54,232,255,34,126,105,255,204,67,166,0,232,52,138,255,211,147,12,0,25,54,7,0,44,15,215,254,51,236,45,0,190,68,129,1,106,147,225,0,28,93,45,254,236,141,15,255,17,61,161,0,220,115,192,0,236,145,24,254,111,168,169,0,224,58,63,255,127,164,188,0,82,234,75,1,224,158,134,0,209,68,110,1,217,166,217,0,70,225,166,1,187,193,143,255,16,7,88,255,10,205,140,0,117,192,156,1,17,56,38,0,27,124,108,1,171,215,55,255,95,253,212,0,155,135,168,255,246,178,153,254,154,68,74,0,232,61,96,254,105,132,59,0,33,76,199,1,189,176,130,255,9,104,25,254,75,198,102,255,233,1,112,0,108,220,20,255,114,230,70,0,140,194,133,255,57,158,164,254,146,6,80,255,169,196,97,1,85,183,130,0,70,158,222,1,59,237,234,255,96,25,26,255,232,175,97,255,11,121,248,254,88,35,194,0,219,180,252,254,74,8,227,0,195,227,73,1,184,110,161,255,49,233,164,1,128,53,47,0,82,14,121,255,193,190,58,0,48,174,117,255,132,23,32,0,40,10,134,1,22,51,25,255,240,11,176,255,110,57,146,0,117,143,239,1,157,101,118,255,54,84,76,0,205,184,18,255,47,4,72,255,78,112,85,255,193,50,66,1,93,16,52,255,8,105,134,0,12,109,72,255,58,156,251,0,144,35,204,0,44,160,117,254,50,107,194,0,1,68,165,255,111,110,162,0,158,83,40,254,76,214,234,0,58,216,205,255,171,96,147,255,40,227,114,1,176,227,241,0,70,249,183,1,136,84,139,255,60,122,247,254,143,9,117,255,177,174,137,254,73,247,143,0,236,185,126,255,62,25,247,255,45,64,56,255,161,244,6,0,34,57,56,1,105,202,83,0,128,147,208,0,6,103,10,255,74,138,65,255,97,80,100,255,214,174,33,255,50,134,74,255,110,151,130,254,111,84,172,0,84,199,75,254,248,59,112,255,8,216,178,1,9,183,95,0,238,27,8,254,170,205,220,0,195,229,135,0,98,76,237,255,226,91,26,1,82,219,39,255,225,190,199,1,217,200,121,255,81,179,8,255,140,65,206,0,178,207,87,254,250,252,46,255,104,89,110,1,253,189,158,255,144,214,158,255,160,245,54,255,53,183,92,1,21,200,194,255,146,33,113,1,209,1,255,0,235,106,43,255,167,52,232,0,157,229,221,0,51,30,25,0,250,221,27,1,65,147,87,255,79,123,196,0,65,196,223,255,76,44,17,1,85,241,68,0,202,183,249,255,65,212,212,255,9,33,154,1,71,59,80,0,175,194,59,255,141,72,9,0,100,160,244,0,230,208,56,0,59,25,75,254,80,194,194,0,18,3,200,254,160,159,115,0,132,143,247,1,111,93,57,255,58,237,11,1,134,222,135,255,122,163,108,1,123,43,190,255,251,189,206,254,80,182,72,255,208,246,224,1,17,60,9,0,161,207,38,0,141,109,91,0,216,15,211,255,136,78,110,0,98,163,104,255,21,80,121,255,173,178,183,1,127,143,4,0,104,60,82,254,214,16,13,255,96,238,33,1,158,148,230,255,127,129,62,255,51,255,210,255,62,141,236,254,157,55,224,255,114,39,244,0,192,188,250,255,228,76,53,0,98,84,81,255,173,203,61,254,147,50,55,255,204,235,191,0,52,197,244,0,88,43,211,254,27,191,119,0,188,231,154,0,66,81,161,0,92,193,160,1,250,227,120,0,123,55,226,0,184,17,72,0,133,168,10,254,22,135,156,255,41,25,103,255,48,202,58,0,186,149,81,255,188,134,239,0,235,181,189,254,217,139,188,255,74,48,82,0,46,218,229,0,189,253,251,0,50,229,12,255,211,141,191,1,128,244,25,255,169,231,122,254,86,47,189,255,132,183,23,255,37,178,150,255,51,137,253,0,200,78,31,0,22,105,50,0,130,60,0,0,132,163,91,254,23,231,187,0,192,79,239,0,157,102,164,255,192,82,20,1,24,181,103,255,240,9,234,0,1,123,164,255,133,233,0,255,202,242,242,0,60,186,245,0,241,16,199,255,224,116,158,254,191,125,91,255,224,86,207,0,121,37,231,255,227,9,198,255,15,153,239,255,121,232,217,254,75,112,82,0,95,12,57,254,51,214,105,255,148,220,97,1,199,98,36,0,156,209,12,254,10,212,52,0,217,180,55,254,212,170,232,255,216,20,84,255,157,250,135,0,157,99,127,254,1,206,41,0,149,36,70,1,54,196,201,255,87,116,0,254,235,171,150,0,27,163,234,0,202,135,180,0,208,95,0,254,123,156,93,0,183,62,75,0,137,235,182,0,204,225,255,255,214,139,210,255,2,115,8,255,29,12,111,0,52,156,1,0,253,21,251,255,37,165,31,254,12,130,211,0,106,18,53,254,42,99,154,0,14,217,61,254,216,11,92,255,200,197,112,254,147,38,199,0,36,252,120,254,107,169,77,0,1,123,159,255,207,75,102,0,163,175,196,0,44,1,240,0,120,186,176,254,13,98,76,255,237,124,241,255,232,146,188,255,200,96,224,0,204,31,41,0,208,200,13,0,21,225,96,255,175,156,196,0,247,208,126,0,62,184,244,254,2,171,81,0,85,115,158,0,54,64,45,255,19,138,114,0,135,71,205,0,227,47,147,1,218,231,66,0,253,209,28,0,244,15,173,255,6,15,118,254,16,150,208,255,185,22,50,255,86,112,207,255,75,113,215,1,63,146,43,255,4,225,19,254,227,23,62,255,14,255,214,254,45,8,205,255,87,197,151,254,210,82,215,255,245,248,247,255,128,248,70,0,225,247,87,0,90,120,70,0,213,245,92,0,13,133,226,0,47,181,5,1,92,163,105,255,6,30,133,254,232,178,61,255,230,149,24,255,18,49,158,0,228,100,61,254,116,243,251,255,77,75,92,1,81,219,147,255,76,163,254,254,141,213,246,0,232,37,152,254,97,44,100,0,201,37,50,1,212,244,57,0,174,171,183,255,249,74,112,0,166,156,30,0,222,221,97,255,243,93,73,254,251,101,100,255,216,217,93,255,254,138,187,255,142,190,52,255,59,203,177,255,200,94,52,0,115,114,158,255,165,152,104,1,126,99,226,255,118,157,244,1,107,200,16,0,193,90,229,0,121,6,88,0,156,32,93,254,125,241,211,255,14,237,157,255,165,154,21,255,184,224,22,255,250,24,152,255,113,77,31,0,247,171,23,255,237,177,204,255,52,137,145,255,194,182,114,0,224,234,149,0,10,111,103,1,201,129,4,0,238,142,78,0,52,6,40,255,110,213,165,254,60,207,253,0,62,215,69,0,96,97,0,255,49,45,202,0,120,121,22,255,235,139,48,1,198,45,34,255,182,50,27,1,131,210,91,255,46,54,128,0,175,123,105,255,198,141,78,254,67,244,239,255,245,54,103,254,78,38,242,255,2,92,249,254,251,174,87,255,139,63,144,0,24,108,27,255,34,102,18,1,34,22,152,0,66,229,118,254,50,143,99,0,144,169,149,1,118,30,152,0,178,8,121,1,8,159,18,0,90,101,230,255,129,29,119,0,68,36,11,1,232,183,55,0,23,255,96,255,161,41,193,255,63,139,222,0,15,179,243,0,255,100,15,255,82,53,135,0,137,57,149,1,99,240,170,255,22,230,228,254,49,180,82,255,61,82,43,0,110,245,217,0,199,125,61,0,46,253,52,0,141,197,219,0,211,159,193,0,55,121,105,254,183,20,129,0,169,119,170,255,203,178,139,255,135,40,182,255,172,13,202,255,65,178,148,0,8,207,43,0,122,53,127,1,74,161,48,0,227,214,128,254,86,11,243,255,100,86,7,1,245,68,134,255,61,43,21,1,152,84,94,255,190,60,250,254,239,118,232,255,214,136,37,1,113,76,107,255,93,104,100,1,144,206,23,255,110,150,154,1,228,103,185,0,218,49,50,254,135,77,139,255,185,1,78,0,0,161,148,255,97,29,233,255,207,148,149,255,160,168,0,0,91,128,171,255,6,28,19,254,11,111,247,0,39,187,150,255,138,232,149,0,117,62,68,255,63,216,188,255,235,234,32,254,29,57,160,255,25,12,241,1,169,60,191,0,32,131,141,255,237,159,123,255,94,197,94,254,116,254,3,255,92,179,97,254,121,97,92,255,170,112,14,0,21,149,248,0,248,227,3,0,80,96,109,0,75,192,74,1,12,90,226,255,161,106,68,1,208,114,127,255,114,42,255,254,74,26,74,255,247,179,150,254,121,140,60,0,147,70,200,255,214,40,161,255,161,188,201,255,141,65,135,255,242,115,252,0,62,47,202,0,180,149,255,254,130,55,237,0,165,17,186,255,10,169,194,0,156,109,218,255,112,140,123,255,104,128,223,254,177,142,108,255,121,37,219,255,128,77,18,255,111,108,23,1,91,192,75,0,174,245,22,255,4,236,62,255,43,64,153,1,227,173,254,0,237,122,132,1,127,89,186,255,142,82,128,254,252,84,174,0,90,179,177,1,243,214,87,255,103,60,162,255,208,130,14,255,11,130,139,0,206,129,219,255,94,217,157,255,239,230,230,255,116,115,159,254,164,107,95,0,51,218,2,1,216,125,198,255,140,202,128,254,11,95,68,255,55,9,93,254,174,153,6,255,204,172,96,0,69,160,110,0,213,38,49,254,27,80,213,0,118,125,114,0,70,70,67,255,15,142,73,255,131,122,185,255,243,20,50,254,130,237,40,0,210,159,140,1,197,151,65,255,84,153,66,0,195,126,90,0,16,238,236,1,118,187,102,255,3,24,133,255,187,69,230,0,56,197,92,1,213,69,94,255,80,138,229,1,206,7,230,0,222,111,230,1,91,233,119,255,9,89,7,1,2,98,1,0,148,74,133,255,51,246,180,255,228,177,112,1,58,189,108,255,194,203,237,254,21,209,195,0,147,10,35,1,86,157,226,0,31,163,139,254,56,7,75,255,62,90,116,0,181,60,169,0,138,162,212,254,81,167,31,0,205,90,112,255,33,112,227,0,83,151,117,1,177,224,73,255,174,144,217,255,230,204,79,255,22,77,232,255,114,78,234,0,224,57,126,254,9,49,141,0,242,147,165,1,104,182,140,255,167,132,12,1,123,68,127,0,225,87,39,1,251,108,8,0,198,193,143,1,121,135,207,255,172,22,70,0,50,68,116,255,101,175,40,255,248,105,233,0,166,203,7,0,110,197,218,0,215,254,26,254,168,226,253,0,31,143,96,0,11,103,41,0,183,129,203,254,100,247,74,255,213,126,132,0,210,147,44,0,199,234,27,1,148,47,181,0,155,91,158,1,54,105,175,255,2,78,145,254,102,154,95,0,128,207,127,254,52,124,236,255,130,84,71,0,221,243,211,0,152,170,207,0,222,106,199,0,183,84,94,254,92,200,56,255,138,182,115,1,142,96,146,0,133,136,228,0,97,18,150,0,55,251,66,0,140,102,4,0,202,103,151,0,30,19,248,255,51,184,207,0,202,198,89,0,55,197,225,254,169,95,249,255,66,65,68,255,188,234,126,0,166,223,100,1,112,239,244,0,144,23,194,0,58,39,182,0,244,44,24,254,175,68,179,255,152,118,154,1,176,162,130,0,217,114,204,254,173,126,78,255,33,222,30,255,36,2,91,255,2,143,243,0,9,235,215,0,3,171,151,1,24,215,245,255,168,47,164,254,241,146,207,0,69,129,180,0,68,243,113,0,144,53,72,254,251,45,14,0,23,110,168,0,68,68,79,255,110,70,95,254,174,91,144,255,33,206,95,255,137,41,7,255,19,187,153,254,35,255,112,255,9,145,185,254,50,157,37,0,11,112,49,1,102,8,190,255,234,243,169,1,60,85,23,0,74,39,189,0,116,49,239,0,173,213,210,0,46,161,108,255,159,150,37,0,196,120,185,255,34,98,6,255,153,195,62,255,97,230,71,255,102,61,76,0,26,212,236,255,164,97,16,0,198,59,146,0,163,23,196,0,56,24,61,0,181,98,193,0,251,147,229,255,98,189,24,255,46,54,206,255,234,82,246,0,183,103,38,1,109,62,204,0,10,240,224,0,146,22,117,255,142,154,120,0,69,212,35,0,208,99,118,1,121,255,3,255,72,6,194,0,117,17,197,255,125,15,23,0,154,79,153,0,214,94,197,255,185,55,147,255,62,254,78,254,127,82,153,0,110,102,63,255,108,82,161,255,105,187,212,1,80,138,39,0,60,255,93,255,72,12,186,0,210,251,31,1,190,167,144,255,228,44,19,254,128,67,232,0,214,249,107,254,136,145,86,255,132,46,176,0,189,187,227,255,208,22,140,0,217,211,116,0,50,81,186,254,139,250,31,0,30,64,198,1,135,155,100,0,160,206,23,254,187,162,211,255,16,188,63,0,254,208,49,0,85,84,191,0,241,192,242,255,153,126,145,1,234,162,162,255,230,97,216,1,64,135,126,0,190,148,223,1,52,0,43,255,28,39,189,1,64,136,238,0,175,196,185,0,98,226,213,255,127,159,244,1,226,175,60,0,160,233,142,1,180,243,207,255,69,152,89,1,31,101,21,0,144,25,164,254,139,191,209,0,91,25,121,0,32,147,5,0,39,186,123,255,63,115,230,255,93,167,198,255,143,213,220,255,179,156,19,255,25,66,122,0,214,160,217,255,2,45,62,255,106,79,146,254,51,137,99,255,87,100,231,255,175,145,232,255,101,184,1,255,174,9,125,0,82,37,161,1,36,114,141,255,48,222,142,255,245,186,154,0,5,174,221,254,63,114,155,255,135,55,160,1,80,31,135,0,126,250,179,1,236,218,45,0,20,28,145,1,16,147,73,0,249,189,132,1,17,189,192,255,223,142,198,255,72,20,15,255,250,53,237,254,15,11,18,0,27,211,113,254,213,107,56,255,174,147,146,255,96,126,48,0,23,193,109,1,37,162,94,0,199,157,249,254,24,128,187,255,205,49,178,254,93,164,42,255,43,119,235,1,88,183,237,255,218,210,1,255,107,254,42,0,230,10,99,255,162,0,226,0,219,237,91,0,129,178,203,0,208,50,95,254,206,208,95,255,247,191,89,254,110,234,79,255,165,61,243,0,20,122,112,255,246,246,185,254,103,4,123,0,233,99,230,1,219,91,252,255,199,222,22,255,179,245,233,255,211,241,234,0,111,250,192,255,85,84,136,0,101,58,50,255,131,173,156,254,119,45,51,255,118,233,16,254,242,90,214,0,94,159,219,1,3,3,234,255,98,76,92,254,80,54,230,0,5,228,231,254,53,24,223,255,113,56,118,1,20,132,1,255,171,210,236,0,56,241,158,255,186,115,19,255,8,229,174,0,48,44,0,1,114,114,166,255,6,73,226,255,205,89,244,0,137,227,75,1,248,173,56,0,74,120,246,254,119,3,11,255,81,120,198,255,136,122,98,255,146,241,221,1,109,194,78,255,223,241,70,1,214,200,169,255,97,190,47,255,47,103,174,255,99,92,72,254,118,233,180,255,193,35,233,254,26,229,32,255,222,252,198,0,204,43,71,255,199,84,172,0,134,102,190,0,111,238,97,254,230,40,230,0,227,205,64,254,200,12,225,0,166,25,222,0,113,69,51,255,143,159,24,0,167,184,74,0,29,224,116,254,158,208,233,0,193,116,126,255,212,11,133,255,22,58,140,1,204,36,51,255,232,30,43,0,235,70,181,255,64,56,146,254,169,18,84,255,226,1,13,255,200,50,176,255,52,213,245,254,168,209,97,0,191,71,55,0,34,78,156,0,232,144,58,1,185,74,189,0,186,142,149,254,64,69,127,255,161,203,147,255,176,151,191,0,136,231,203,254,163,182,137,0,161,126,251,254,233,32,66,0,68,207,66,0,30,28,37,0,93,114,96,1,254,92,247,255,44,171,69,0,202,119,11,255,188,118,50,1,255,83,136,255,71,82,26,0,70,227,2,0,32,235,121,1,181,41,154,0,71,134,229,254,202,255,36,0,41,152,5,0,154,63,73,255,34,182,124,0,121,221,150,255,26,204,213,1,41,172,87,0,90,157,146,255,109,130,20,0,71,107,200,255,243,102,189,0,1,195,145,254,46,88,117,0,8,206,227,0,191,110,253,255,109,128,20,254,134,85,51,255,137,177,112,1,216,34,22,255,131,16,208,255,121,149,170,0,114,19,23,1,166,80,31,255,113,240,122,0,232,179,250,0,68,110,180,254,210,170,119,0,223,108,164,255,207,79,233,255,27,229,226,254,209,98,81,255,79,68,7,0,131,185,100,0,170,29,162,255,17,162,107,255,57,21,11,1,100,200,181,255,127,65,166,1,165,134,204,0,104,167,168,0,1,164,79,0,146,135,59,1,70,50,128,255,102,119,13,254,227,6,135,0,162,142,179,255,160,100,222,0,27,224,219,1,158,93,195,255,234,141,137,0,16,24,125,255,238,206,47,255,97,17,98,255,116,110,12,255,96,115,77,0,91,227,232,255,248,254,79,255,92,229,6,254,88,198,139,0,206,75,129,0,250,77,206,255,141,244,123,1,138,69,220,0,32,151,6,1,131,167,22,255,237,68,167,254,199,189,150,0,163,171,138,255,51,188,6,255,95,29,137,254,148,226,179,0,181,107,208,255,134,31,82,255,151,101,45,255,129,202,225,0,224,72,147,0,48,138,151,255,195,64,206,254,237,218,158,0,106,29,137,254,253,189,233,255,103,15,17,255,194,97,255,0,178,45,169,254,198,225,155,0,39,48,117,255,135,106,115,0,97,38,181,0,150,47,65,255,83,130,229,254,246,38,129,0,92,239,154,254,91,99,127,0,161,111,33,255,238,217,242,255,131,185,195,255,213,191,158,255,41,150,218,0,132,169,131,0,89,84,252,1,171,70,128,255,163,248,203,254,1,50,180,255,124,76,85,1,251,111,80,0,99,66,239,255,154,237,182,255,221,126,133,254,74,204,99,255,65,147,119,255,99,56,167,255,79,248,149,255,116,155,228,255,237,43,14,254,69,137,11,255,22,250,241,1,91,122,143,255,205,249,243,0,212,26,60,255,48,182,176,1,48,23,191,255,203,121,152,254,45,74,213,255,62,90,18,254,245,163,230,255,185,106,116,255,83,35,159,0,12,33,2,255,80,34,62,0,16,87,174,255,173,101,85,0,202,36,81,254,160,69,204,255,64,225,187,0,58,206,94,0,86,144,47,0,229,86,245,0,63,145,190,1,37,5,39,0,109,251,26,0,137,147,234,0,162,121,145,255,144,116,206,255,197,232,185,255,183,190,140,255,73,12,254,255,139,20,242,255,170,90,239,255,97,66,187,255,245,181,135,254,222,136,52,0,245,5,51,254,203,47,78,0,152,101,216,0,73,23,125,0,254,96,33,1,235,210,73,255,43,209,88,1,7,129,109,0,122,104,228,254,170,242,203,0,242,204,135,255,202,28,233,255,65,6,127,0,159,144,71,0,100,140,95,0,78,150,13,0,251,107,118,1,182,58,125,255,1,38,108,255,141,189,209,255,8,155,125,1,113,163,91,255,121,79,190,255,134,239,108,255,76,47,248,0,163,228,239,0,17,111,10,0,88,149,75,255,215,235,239,0,167,159,24,255,47,151,108,255,107,209,188,0,233,231,99,254,28,202,148,255,174,35,138,255,110,24,68,255,2,69,181,0,107,102,82,0,102,237,7,0,92,36,237,255,221,162,83,1,55,202,6,255,135,234,135,255,24,250,222,0,65,94,168,254,245,248,210,255,167,108,201,254,255,161,111,0,205,8,254,0,136,13,116,0,100,176,132,255,43,215,126,255,177,133,130,255,158,79,148,0,67,224,37,1,12,206,21,255,62,34,110,1,237,104,175,255,80,132,111,255,142,174,72,0,84,229,180,254,105,179,140,0,64,248,15,255,233,138,16,0,245,67,123,254,218,121,212,255,63,95,218,1,213,133,137,255,143,182,82,255,48,28,11,0,244,114,141,1,209,175,76,255,157,181,150,255,186,229,3,255,164,157,111,1,231,189,139,0,119,202,190,255,218,106,64,255,68,235,63,254,96,26,172,255,187,47,11,1,215,18,251,255,81,84,89,0,68,58,128,0,94,113,5,1,92,129,208,255,97,15,83,254,9,28,188,0,239,9,164,0,60,205,152,0,192,163,98,255,184,18,60,0,217,182,139,0,109,59,120,255,4,192,251,0,169,210,240,255,37,172,92,254,148,211,245,255,179,65,52,0,253,13,115,0,185,174,206,1,114,188,149,255,237,90,173,0,43,199,192,255,88,108,113,0,52,35,76,0,66,25,148,255,221,4,7,255,151,241,114,255,190,209,232,0,98,50,199,0,151,150,213,255,18,74,36,1,53,40,7,0,19,135,65,255,26,172,69,0,174,237,85,0,99,95,41,0,3,56,16,0,39,160,177,255,200,106,218,254,185,68,84,255,91,186,61,254,67,143,141,255,13,244,166,255,99,114,198,0,199,110,163,255,193,18,186,0,124,239,246,1,110,68,22,0,2,235,46,1,212,60,107,0,105,42,105,1,14,230,152,0,7,5,131,0,141,104,154,255,213,3,6,0,131,228,162,255,179,100,28,1,231,123,85,255,206,14,223,1,253,96,230,0,38,152,149,1,98,137,122,0,214,205,3,255,226,152,179,255,6,133,137,0,158,69,140,255,113,162,154,255,180,243,172,255,27,189,115,255,143,46,220,255,213,134,225,255,126,29,69,0,188,43,137,1,242,70,9,0,90,204,255,255,231,170,147,0,23,56,19,254,56,125,157,255,48,179,218,255,79,182,253,255,38,212,191,1,41,235,124,0,96,151,28,0,135,148,190,0,205,249,39,254,52,96,136,255,212,44,136,255,67,209,131,255,252,130,23,255,219,128,20,255,198,129,118,0,108,101,11,0,178,5,146,1,62,7,100,255,181,236,94,254,28,26,164,0,76,22,112,255,120,102,79,0,202,192,229,1,200,176,215,0,41,64,244,255,206,184,78,0,167,45,63,1,160,35,0,255,59,12,142,255,204,9,144,255,219,94,229,1,122,27,112,0,189,105,109,255,64,208,74,255,251,127,55,1,2,226,198,0,44,76,209,0,151,152,77,255,210,23,46,1,201,171,69,255,44,211,231,0,190,37,224,255,245,196,62,255,169,181,222,255,34,211,17,0,119,241,197,255,229,35,152,1,21,69,40,255,178,226,161,0,148,179,193,0,219,194,254,1,40,206,51,255,231,92,250,1,67,153,170,0,21,148,241,0,170,69,82,255,121,18,231,255,92,114,3,0,184,62,230,0,225,201,87,255,146,96,162,255,181,242,220,0,173,187,221,1,226,62,170,255,56,126,217,1,117,13,227,255,179,44,239,0,157,141,155,255,144,221,83,0,235,209,208,0,42,17,165,1,251,81,133,0,124,245,201,254,97,211,24,255,83,214,166,0,154,36,9,255,248,47,127,0,90,219,140,255,161,217,38,254,212,147,63,255,66,84,148,1,207,3,1,0,230,134,89,1,127,78,122,255,224,155,1,255,82,136,74,0,178,156,208,255,186,25,49,255,222,3,210,1,229,150,190,255,85,162,52,255,41,84,141,255,73,123,84,254,93,17,150,0,119,19,28,1,32,22,215,255,28,23,204,255,142,241,52,255,228,52,125,0,29,76,207,0,215,167,250,254,175,164,230,0,55,207,105,1,109,187,245,255,161,44,220,1,41,101,128,255,167,16,94,0,93,214,107,255,118,72,0,254,80,61,234,255,121,175,125,0,139,169,251,0,97,39,147,254,250,196,49,255,165,179,110,254,223,70,187,255,22,142,125,1,154,179,138,255,118,176,42,1,10,174,153,0,156,92,102,0,168,13,161,255,143,16,32,0,250,197,180,255,203,163,44,1,87,32,36,0,161,153,20,255,123,252,15,0,25,227,80,0,60,88,142,0,17,22,201,1,154,205,77,255,39,63,47,0,8,122,141,0,128,23,182,254,204,39,19,255,4,112,29,255,23,36,140,255,210,234,116,254,53,50,63,255,121,171,104,255,160,219,94,0,87,82,14,254,231,42,5,0,165,139,127,254,86,78,38,0,130,60,66,254,203,30,45,255,46,196,122,1,249,53,162,255,136,143,103,254,215,210,114,0,231,7,160,254,169,152,42,255,111,45,246,0,142,131,135,255,131,71,204,255,36,226,11,0,0,28,242,255,225,138,213,255,247,46,216,254,245,3,183,0,108,252,74,1,206,26,48,255,205,54,246,255,211,198,36,255,121,35,50,0,52,216,202,255,38,139,129,254,242,73,148,0,67,231,141,255,42,47,204,0,78,116,25,1,4,225,191,255,6,147,228,0,58,88,177,0,122,165,229,255,252,83,201,255,224,167,96,1,177,184,158,255,242,105,179,1,248,198,240,0,133,66,203,1,254,36,47,0,45,24,115,255,119,62,254,0,196,225,186,254,123,141,172,0,26,85,41,255,226,111,183,0,213,231,151,0,4,59,7,255,238,138,148,0,66,147,33,255,31,246,141,255,209,141,116,255,104,112,31,0,88,161,172,0,83,215,230,254,47,111,151,0,45,38,52,1,132,45,204,0,138,128,109,254,233,117,134,255,243,190,173,254,241,236,240,0,82,127,236,254,40,223,161,255,110,182,225,255,123,174,239,0,135,242,145,1,51,209,154,0,150,3,115,254,217,164,252,255,55,156,69,1,84,94,255,255,232,73,45,1,20,19,212,255,96,197,59,254,96,251,33,0,38,199,73,1,64,172,247,255,117,116,56,255,228,17,18,0,62,138,103,1,246,229,164,255,244,118,201,254,86,32,159,255,109,34,137,1,85,211,186,0,10,193,193,254,122,194,177,0,122,238,102,255,162,218,171,0,108,217,161,1,158,170,34,0,176,47,155,1,181,228,11,255,8,156,0,0,16,75,93,0,206,98,255,1,58,154,35,0,12,243,184,254,67,117,66,255,230,229,123,0,201,42,110,0,134,228,178,254,186,108,118,255,58,19,154,255,82,169,62,255,114,143,115,1,239,196,50,255,173,48,193,255,147,2,84,255,150,134,147,254,95,232,73,0,109,227,52,254,191,137,10,0,40,204,30,254,76,52,97,255,164,235,126,0,254,124,188,0,74,182,21,1,121,29,35,255,241,30,7,254,85,218,214,255,7,84,150,254,81,27,117,255,160,159,152,254,66,24,221,255,227,10,60,1,141,135,102,0,208,189,150,1,117,179,92,0,132,22,136,255,120,199,28,0,21,129,79,254,182,9,65,0,218,163,169,0,246,147,198,255,107,38,144,1,78,175,205,255,214,5,250,254,47,88,29,255,164,47,204,255,43,55,6,255,131,134,207,254,116,100,214,0,96,140,75,1,106,220,144,0,195,32,28,1,172,81,5,255,199,179,52,255,37,84,203,0,170,112,174,0,11,4,91,0,69,244,27,1,117,131,92,0,33,152,175,255,140,153,107,255,251,135,43,254,87,138,4,255,198,234,147,254,121,152,84,255,205,101,155,1,157,9,25,0,72,106,17,254,108,153,0,255,189,229,186,0,193,8,176,255,174,149,209,0,238,130,29,0,233,214,126,1,61,226,102,0,57,163,4,1,198,111,51,255,45,79,78,1,115,210,10,255,218,9,25,255,158,139,198,255,211,82,187,254,80,133,83,0,157,129,230,1,243,133,134,255,40,136,16,0,77,107,79,255,183,85,92,1,177,204,202,0,163,71,147,255,152,69,190,0,172,51,188,1,250,210,172,255,211,242,113,1,89,89,26,255,64,66,111,254,116,152,42,0,161,39,27,255,54,80,254,0,106,209,115,1,103,124,97,0,221,230,98,255,31,231,6,0,178,192,120,254,15,217,203,255,124,158,79,0,112,145,247,0,92,250,48,1,163,181,193,255,37,47,142,254,144,189,165,255,46,146,240,0,6,75,128,0,41,157,200,254,87,121,213,0,1,113,236,0,5,45,250,0,144,12,82,0,31,108,231,0,225,239,119,255,167,7,189,255,187,228,132,255,110,189,34,0,94,44,204,1,162,52,197,0,78,188,241,254,57,20,141,0,244,146,47,1,206,100,51,0,125,107,148,254,27,195,77,0,152,253,90,1,7,143,144,255,51,37,31,0,34,119,38,255,7,197,118,0,153,188,211,0,151,20,116,254,245,65,52,255,180,253,110,1,47,177,209,0,161,99,17,255,118,222,202,0,125,179,252,1,123,54,126,255,145,57,191,0,55,186,121,0,10,243,138,0,205,211,229,255,125,156,241,254,148,156,185,255,227,19,188,255,124,41,32,255,31,34,206,254,17,57,83,0,204,22,37,255,42,96,98,0,119,102,184,1,3,190,28,0,110,82,218,255,200,204,192,255,201,145,118,0,117,204,146,0,132,32,98,1,192,194,121,0,106,161,248,1,237,88,124,0,23,212,26,0,205,171,90,255,248,48,216,1,141,37,230,255,124,203,0,254,158,168,30,255,214,248,21,0,112,187,7,255], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+20480);
  1305. /* memory initializer */ allocate([75,133,239,255,74,227,243,255,250,147,70,0,214,120,162,0,167,9,179,255,22,158,18,0,218,77,209,1,97,109,81,255,244,33,179,255,57,52,57,255,65,172,210,255,249,71,209,255,142,169,238,0,158,189,153,255,174,254,103,254,98,33,14,0,141,76,230,255,113,139,52,255,15,58,212,0,168,215,201,255,248,204,215,1,223,68,160,255,57,154,183,254,47,231,121,0,106,166,137,0,81,136,138,0,165,43,51,0,231,139,61,0,57,95,59,254,118,98,25,255,151,63,236,1,94,190,250,255,169,185,114,1,5,250,58,255,75,105,97,1,215,223,134,0,113,99,163,1,128,62,112,0,99,106,147,0,163,195,10,0,33,205,182,0,214,14,174,255,129,38,231,255,53,182,223,0,98,42,159,255,247,13,40,0,188,210,177,1,6,21,0,255,255,61,148,254,137,45,129,255,89,26,116,254,126,38,114,0,251,50,242,254,121,134,128,255,204,249,167,254,165,235,215,0,202,177,243,0,133,141,62,0,240,130,190,1,110,175,255,0,0,20,146,1,37,210,121,255,7,39,130,0,142,250,84,255,141,200,207,0,9,95,104,255,11,244,174,0,134,232,126,0,167,1,123,254,16,193,149,255,232,233,239,1,213,70,112,255,252,116,160,254,242,222,220,255,205,85,227,0,7,185,58,0,118,247,63,1,116,77,177,255,62,245,200,254,63,18,37,255,107,53,232,254,50,221,211,0,162,219,7,254,2,94,43,0,182,62,182,254,160,78,200,255,135,140,170,0,235,184,228,0,175,53,138,254,80,58,77,255,152,201,2,1,63,196,34,0,5,30,184,0,171,176,154,0,121,59,206,0,38,99,39,0,172,80,77,254,0,134,151,0,186,33,241,254,94,253,223,255,44,114,252,0,108,126,57,255,201,40,13,255,39,229,27,255,39,239,23,1,151,121,51,255,153,150,248,0,10,234,174,255,118,246,4,254,200,245,38,0,69,161,242,1,16,178,150,0,113,56,130,0,171,31,105,0,26,88,108,255,49,42,106,0,251,169,66,0,69,93,149,0,20,57,254,0,164,25,111,0,90,188,90,255,204,4,197,0,40,213,50,1,212,96,132,255,88,138,180,254,228,146,124,255,184,246,247,0,65,117,86,255,253,102,210,254,254,121,36,0,137,115,3,255,60,24,216,0,134,18,29,0,59,226,97,0,176,142,71,0,7,209,161,0,189,84,51,254,155,250,72,0,213,84,235,255,45,222,224,0,238,148,143,255,170,42,53,255,78,167,117,0,186,0,40,255,125,177,103,255,69,225,66,0,227,7,88,1,75,172,6,0,169,45,227,1,16,36,70,255,50,2,9,255,139,193,22,0,143,183,231,254,218,69,50,0,236,56,161,1,213,131,42,0,138,145,44,254,136,229,40,255,49,63,35,255,61,145,245,255,101,192,2,254,232,167,113,0,152,104,38,1,121,185,218,0,121,139,211,254,119,240,35,0,65,189,217,254,187,179,162,255,160,187,230,0,62,248,14,255,60,78,97,0,255,247,163,255,225,59,91,255,107,71,58,255,241,47,33,1,50,117,236,0,219,177,63,254,244,90,179,0,35,194,215,255,189,67,50,255,23,135,129,0,104,189,37,255,185,57,194,0,35,62,231,255,220,248,108,0,12,231,178,0,143,80,91,1,131,93,101,255,144,39,2,1,255,250,178,0,5,17,236,254,139,32,46,0,204,188,38,254,245,115,52,255,191,113,73,254,191,108,69,255,22,69,245,1,23,203,178,0,170,99,170,0,65,248,111,0,37,108,153,255,64,37,69,0,0,88,62,254,89,148,144,255,191,68,224,1,241,39,53,0,41,203,237,255,145,126,194,255,221,42,253,255,25,99,151,0,97,253,223,1,74,115,49,255,6,175,72,255,59,176,203,0,124,183,249,1,228,228,99,0,129,12,207,254,168,192,195,255,204,176,16,254,152,234,171,0,77,37,85,255,33,120,135,255,142,194,227,1,31,214,58,0,213,187,125,255,232,46,60,255,190,116,42,254,151,178,19,255,51,62,237,254,204,236,193,0,194,232,60,0,172,34,157,255,189,16,184,254,103,3,95,255,141,233,36,254,41,25,11,255,21,195,166,0,118,245,45,0,67,213,149,255,159,12,18,255,187,164,227,1,160,25,5,0,12,78,195,1,43,197,225,0,48,142,41,254,196,155,60,255,223,199,18,1,145,136,156,0,252,117,169,254,145,226,238,0,239,23,107,0,109,181,188,255,230,112,49,254,73,170,237,255,231,183,227,255,80,220,20,0,194,107,127,1,127,205,101,0,46,52,197,1,210,171,36,255,88,3,90,255,56,151,141,0,96,187,255,255,42,78,200,0,254,70,70,1,244,125,168,0,204,68,138,1,124,215,70,0,102,66,200,254,17,52,228,0,117,220,143,254,203,248,123,0,56,18,174,255,186,151,164,255,51,232,208,1,160,228,43,255,249,29,25,1,68,190,63,0,8,201,188,243,103,230,9,106,59,167,202,132,133,174,103,187,43,248,148,254,114,243,110,60,241,54,29,95,58,245,79,165,209,130,230,173,127,82,14,81,31,108,62,43,140,104,5,155,107,189,65,251,171,217,131,31,121,33,126,19,25,205,224,91,34,174,40,215,152,47,138,66,205,101,239,35,145,68,55,113,47,59,77,236,207,251,192,181,188,219,137,129,165,219,181,233,56,181,72,243,91,194,86,57,25,208,5,182,241,17,241,89,155,79,25,175,164,130,63,146,24,129,109,218,213,94,28,171,66,2,3,163,152,170,7,216,190,111,112,69,1,91,131,18,140,178,228,78,190,133,49,36,226,180,255,213,195,125,12,85,111,137,123,242,116,93,190,114,177,150,22,59,254,177,222,128,53,18,199,37,167,6,220,155,148,38,105,207,116,241,155,193,210,74,241,158,193,105,155,228,227,37,79,56,134,71,190,239,181,213,140,139,198,157,193,15,101,156,172,119,204,161,12,36,117,2,43,89,111,44,233,45,131,228,166,110,170,132,116,74,212,251,65,189,220,169,176,92,181,83,17,131,218,136,249,118,171,223,102,238,82,81,62,152,16,50,180,45,109,198,49,168,63,33,251,152,200,39,3,176,228,14,239,190,199,127,89,191,194,143,168,61,243,11,224,198,37,167,10,147,71,145,167,213,111,130,3,224,81,99,202,6,112,110,14,10,103,41,41,20,252,47,210,70,133,10,183,39,38,201,38,92,56,33,27,46,237,42,196,90,252,109,44,77,223,179,149,157,19,13,56,83,222,99,175,139,84,115,10,101,168,178,119,60,187,10,106,118,230,174,237,71,46,201,194,129,59,53,130,20,133,44,114,146,100,3,241,76,161,232,191,162,1,48,66,188,75,102,26,168,145,151,248,208,112,139,75,194,48,190,84,6,163,81,108,199,24,82,239,214,25,232,146,209,16,169,101,85,36,6,153,214,42,32,113,87,133,53,14,244,184,209,187,50,112,160,106,16,200,208,210,184,22,193,164,25,83,171,65,81,8,108,55,30,153,235,142,223,76,119,72,39,168,72,155,225,181,188,176,52,99,90,201,197,179,12,28,57,203,138,65,227,74,170,216,78,115,227,99,119,79,202,156,91,163,184,178,214,243,111,46,104,252,178,239,93,238,130,143,116,96,47,23,67,111,99,165,120,114,171,240,161,20,120,200,132,236,57,100,26,8,2,199,140,40,30,99,35,250,255,190,144,233,189,130,222,235,108,80,164,21,121,198,178,247,163,249,190,43,83,114,227,242,120,113,198,156,97,38,234,206,62,39,202,7,194,192,33,199,184,134,209,30,235,224,205,214,125,218,234,120,209,110,238,127,79,125,245,186,111,23,114,170,103,240,6,166,152,200,162,197,125,99,10,174,13,249,190,4,152,63,17,27,71,28,19,53,11,113,27,132,125,4,35,245,119,219,40,147,36,199,64,123,171,202,50,188,190,201,21,10,190,158,60,76,13,16,156,196,103,29,67,182,66,62,203,190,212,197,76,42,126,101,252,156,41,127,89,236,250,214,58,171,111,203,95,23,88,71,74,140,25,68,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+30720);
  1306. var tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8);
  1307. assert(tempDoublePtr % 8 == 0);
  1308. function copyTempFloat(ptr) { // functions, because inlining this code increases code size too much
  1309. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1310. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1311. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1312. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1313. }
  1314. function copyTempDouble(ptr) {
  1315. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1316. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1317. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1318. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1319. HEAP8[tempDoublePtr+4] = HEAP8[ptr+4];
  1320. HEAP8[tempDoublePtr+5] = HEAP8[ptr+5];
  1321. HEAP8[tempDoublePtr+6] = HEAP8[ptr+6];
  1322. HEAP8[tempDoublePtr+7] = HEAP8[ptr+7];
  1323. }
  1324. Module["_bitshift64Ashr"] = _bitshift64Ashr;
  1325. Module["_i64Subtract"] = _i64Subtract;
  1326. Module["_i64Add"] = _i64Add;
  1327. Module["_memset"] = _memset;
  1328. Module["_bitshift64Lshr"] = _bitshift64Lshr;
  1329. Module["_bitshift64Shl"] = _bitshift64Shl;
  1330. function _abort() {
  1331. Module['abort']();
  1332. }
  1333. Module["_strlen"] = _strlen;
  1334. function _emscripten_memcpy_big(dest, src, num) {
  1335. HEAPU8.set(HEAPU8.subarray(src, src+num), dest);
  1336. return dest;
  1337. }
  1338. Module["_memcpy"] = _memcpy;
  1339. var ___errno_state=0;function ___setErrNo(value) {
  1340. // For convenient setting and returning of errno.
  1341. HEAP32[((___errno_state)>>2)]=value;
  1342. return value;
  1343. }
  1344. 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};function _sysconf(name) {
  1345. // long sysconf(int name);
  1346. // http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html
  1347. switch(name) {
  1348. case 30: return PAGE_SIZE;
  1349. case 132:
  1350. case 133:
  1351. case 12:
  1352. case 137:
  1353. case 138:
  1354. case 15:
  1355. case 235:
  1356. case 16:
  1357. case 17:
  1358. case 18:
  1359. case 19:
  1360. case 20:
  1361. case 149:
  1362. case 13:
  1363. case 10:
  1364. case 236:
  1365. case 153:
  1366. case 9:
  1367. case 21:
  1368. case 22:
  1369. case 159:
  1370. case 154:
  1371. case 14:
  1372. case 77:
  1373. case 78:
  1374. case 139:
  1375. case 80:
  1376. case 81:
  1377. case 79:
  1378. case 82:
  1379. case 68:
  1380. case 67:
  1381. case 164:
  1382. case 11:
  1383. case 29:
  1384. case 47:
  1385. case 48:
  1386. case 95:
  1387. case 52:
  1388. case 51:
  1389. case 46:
  1390. return 200809;
  1391. case 27:
  1392. case 246:
  1393. case 127:
  1394. case 128:
  1395. case 23:
  1396. case 24:
  1397. case 160:
  1398. case 161:
  1399. case 181:
  1400. case 182:
  1401. case 242:
  1402. case 183:
  1403. case 184:
  1404. case 243:
  1405. case 244:
  1406. case 245:
  1407. case 165:
  1408. case 178:
  1409. case 179:
  1410. case 49:
  1411. case 50:
  1412. case 168:
  1413. case 169:
  1414. case 175:
  1415. case 170:
  1416. case 171:
  1417. case 172:
  1418. case 97:
  1419. case 76:
  1420. case 32:
  1421. case 173:
  1422. case 35:
  1423. return -1;
  1424. case 176:
  1425. case 177:
  1426. case 7:
  1427. case 155:
  1428. case 8:
  1429. case 157:
  1430. case 125:
  1431. case 126:
  1432. case 92:
  1433. case 93:
  1434. case 129:
  1435. case 130:
  1436. case 131:
  1437. case 94:
  1438. case 91:
  1439. return 1;
  1440. case 74:
  1441. case 60:
  1442. case 69:
  1443. case 70:
  1444. case 4:
  1445. return 1024;
  1446. case 31:
  1447. case 42:
  1448. case 72:
  1449. return 32;
  1450. case 87:
  1451. case 26:
  1452. case 33:
  1453. return 2147483647;
  1454. case 34:
  1455. case 1:
  1456. return 47839;
  1457. case 38:
  1458. case 36:
  1459. return 99;
  1460. case 43:
  1461. case 37:
  1462. return 2048;
  1463. case 0: return 2097152;
  1464. case 3: return 65536;
  1465. case 28: return 32768;
  1466. case 44: return 32767;
  1467. case 75: return 16384;
  1468. case 39: return 1000;
  1469. case 89: return 700;
  1470. case 71: return 256;
  1471. case 40: return 255;
  1472. case 2: return 100;
  1473. case 180: return 64;
  1474. case 25: return 20;
  1475. case 5: return 16;
  1476. case 6: return 6;
  1477. case 73: return 4;
  1478. case 84: {
  1479. if (typeof navigator === 'object') return navigator['hardwareConcurrency'] || 1;
  1480. return 1;
  1481. }
  1482. }
  1483. ___setErrNo(ERRNO_CODES.EINVAL);
  1484. return -1;
  1485. }
  1486. function _sbrk(bytes) {
  1487. // Implement a Linux-like 'memory area' for our 'process'.
  1488. // Changes the size of the memory area by |bytes|; returns the
  1489. // address of the previous top ('break') of the memory area
  1490. // We control the "dynamic" memory - DYNAMIC_BASE to DYNAMICTOP
  1491. var self = _sbrk;
  1492. if (!self.called) {
  1493. DYNAMICTOP = alignMemoryPage(DYNAMICTOP); // make sure we start out aligned
  1494. self.called = true;
  1495. assert(Runtime.dynamicAlloc);
  1496. self.alloc = Runtime.dynamicAlloc;
  1497. Runtime.dynamicAlloc = function() { abort('cannot dynamically allocate, sbrk now has control') };
  1498. }
  1499. var ret = DYNAMICTOP;
  1500. if (bytes != 0) self.alloc(bytes);
  1501. return ret; // Previous break location.
  1502. }
  1503. Module["_memmove"] = _memmove;
  1504. function ___errno_location() {
  1505. return ___errno_state;
  1506. }
  1507. 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"};
  1508. var TTY={ttys:[],init:function () {
  1509. // https://github.com/kripken/emscripten/pull/1555
  1510. // if (ENVIRONMENT_IS_NODE) {
  1511. // // currently, FS.init does not distinguish if process.stdin is a file or TTY
  1512. // // device, it always assumes it's a TTY device. because of this, we're forcing
  1513. // // process.stdin to UTF8 encoding to at least make stdin reading compatible
  1514. // // with text files until FS.init can be refactored.
  1515. // process['stdin']['setEncoding']('utf8');
  1516. // }
  1517. },shutdown:function () {
  1518. // https://github.com/kripken/emscripten/pull/1555
  1519. // if (ENVIRONMENT_IS_NODE) {
  1520. // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)?
  1521. // // 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
  1522. // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists?
  1523. // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle
  1524. // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call
  1525. // process['stdin']['pause']();
  1526. // }
  1527. },register:function (dev, ops) {
  1528. TTY.ttys[dev] = { input: [], output: [], ops: ops };
  1529. FS.registerDevice(dev, TTY.stream_ops);
  1530. },stream_ops:{open:function (stream) {
  1531. var tty = TTY.ttys[stream.node.rdev];
  1532. if (!tty) {
  1533. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  1534. }
  1535. stream.tty = tty;
  1536. stream.seekable = false;
  1537. },close:function (stream) {
  1538. // flush any pending line data
  1539. stream.tty.ops.flush(stream.tty);
  1540. },flush:function (stream) {
  1541. stream.tty.ops.flush(stream.tty);
  1542. },read:function (stream, buffer, offset, length, pos /* ignored */) {
  1543. if (!stream.tty || !stream.tty.ops.get_char) {
  1544. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1545. }
  1546. var bytesRead = 0;
  1547. for (var i = 0; i < length; i++) {
  1548. var result;
  1549. try {
  1550. result = stream.tty.ops.get_char(stream.tty);
  1551. } catch (e) {
  1552. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1553. }
  1554. if (result === undefined && bytesRead === 0) {
  1555. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  1556. }
  1557. if (result === null || result === undefined) break;
  1558. bytesRead++;
  1559. buffer[offset+i] = result;
  1560. }
  1561. if (bytesRead) {
  1562. stream.node.timestamp = Date.now();
  1563. }
  1564. return bytesRead;
  1565. },write:function (stream, buffer, offset, length, pos) {
  1566. if (!stream.tty || !stream.tty.ops.put_char) {
  1567. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1568. }
  1569. for (var i = 0; i < length; i++) {
  1570. try {
  1571. stream.tty.ops.put_char(stream.tty, buffer[offset+i]);
  1572. } catch (e) {
  1573. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1574. }
  1575. }
  1576. if (length) {
  1577. stream.node.timestamp = Date.now();
  1578. }
  1579. return i;
  1580. }},default_tty_ops:{get_char:function (tty) {
  1581. if (!tty.input.length) {
  1582. var result = null;
  1583. if (ENVIRONMENT_IS_NODE) {
  1584. result = process['stdin']['read']();
  1585. if (!result) {
  1586. if (process['stdin']['_readableState'] && process['stdin']['_readableState']['ended']) {
  1587. return null; // EOF
  1588. }
  1589. return undefined; // no data available
  1590. }
  1591. } else if (typeof window != 'undefined' &&
  1592. typeof window.prompt == 'function') {
  1593. // Browser.
  1594. result = window.prompt('Input: '); // returns null on cancel
  1595. if (result !== null) {
  1596. result += '\n';
  1597. }
  1598. } else if (typeof readline == 'function') {
  1599. // Command line.
  1600. result = readline();
  1601. if (result !== null) {
  1602. result += '\n';
  1603. }
  1604. }
  1605. if (!result) {
  1606. return null;
  1607. }
  1608. tty.input = intArrayFromString(result, true);
  1609. }
  1610. return tty.input.shift();
  1611. },flush:function (tty) {
  1612. if (tty.output && tty.output.length > 0) {
  1613. Module['print'](tty.output.join(''));
  1614. tty.output = [];
  1615. }
  1616. },put_char:function (tty, val) {
  1617. if (val === null || val === 10) {
  1618. Module['print'](tty.output.join(''));
  1619. tty.output = [];
  1620. } else {
  1621. tty.output.push(TTY.utf8.processCChar(val));
  1622. }
  1623. }},default_tty1_ops:{put_char:function (tty, val) {
  1624. if (val === null || val === 10) {
  1625. Module['printErr'](tty.output.join(''));
  1626. tty.output = [];
  1627. } else {
  1628. tty.output.push(TTY.utf8.processCChar(val));
  1629. }
  1630. },flush:function (tty) {
  1631. if (tty.output && tty.output.length > 0) {
  1632. Module['printErr'](tty.output.join(''));
  1633. tty.output = [];
  1634. }
  1635. }}};
  1636. var MEMFS={ops_table:null,mount:function (mount) {
  1637. return MEMFS.createNode(null, '/', 16384 | 511 /* 0777 */, 0);
  1638. },createNode:function (parent, name, mode, dev) {
  1639. if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
  1640. // no supported
  1641. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  1642. }
  1643. if (!MEMFS.ops_table) {
  1644. MEMFS.ops_table = {
  1645. dir: {
  1646. node: {
  1647. getattr: MEMFS.node_ops.getattr,
  1648. setattr: MEMFS.node_ops.setattr,
  1649. lookup: MEMFS.node_ops.lookup,
  1650. mknod: MEMFS.node_ops.mknod,
  1651. rename: MEMFS.node_ops.rename,
  1652. unlink: MEMFS.node_ops.unlink,
  1653. rmdir: MEMFS.node_ops.rmdir,
  1654. readdir: MEMFS.node_ops.readdir,
  1655. symlink: MEMFS.node_ops.symlink
  1656. },
  1657. stream: {
  1658. llseek: MEMFS.stream_ops.llseek
  1659. }
  1660. },
  1661. file: {
  1662. node: {
  1663. getattr: MEMFS.node_ops.getattr,
  1664. setattr: MEMFS.node_ops.setattr
  1665. },
  1666. stream: {
  1667. llseek: MEMFS.stream_ops.llseek,
  1668. read: MEMFS.stream_ops.read,
  1669. write: MEMFS.stream_ops.write,
  1670. allocate: MEMFS.stream_ops.allocate,
  1671. mmap: MEMFS.stream_ops.mmap
  1672. }
  1673. },
  1674. link: {
  1675. node: {
  1676. getattr: MEMFS.node_ops.getattr,
  1677. setattr: MEMFS.node_ops.setattr,
  1678. readlink: MEMFS.node_ops.readlink
  1679. },
  1680. stream: {}
  1681. },
  1682. chrdev: {
  1683. node: {
  1684. getattr: MEMFS.node_ops.getattr,
  1685. setattr: MEMFS.node_ops.setattr
  1686. },
  1687. stream: FS.chrdev_stream_ops
  1688. }
  1689. };
  1690. }
  1691. var node = FS.createNode(parent, name, mode, dev);
  1692. if (FS.isDir(node.mode)) {
  1693. node.node_ops = MEMFS.ops_table.dir.node;
  1694. node.stream_ops = MEMFS.ops_table.dir.stream;
  1695. node.contents = {};
  1696. } else if (FS.isFile(node.mode)) {
  1697. node.node_ops = MEMFS.ops_table.file.node;
  1698. node.stream_ops = MEMFS.ops_table.file.stream;
  1699. node.usedBytes = 0; // The actual number of bytes used in the typed array, as opposed to contents.buffer.byteLength which gives the whole capacity.
  1700. // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred
  1701. // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size
  1702. // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme.
  1703. node.contents = null;
  1704. } else if (FS.isLink(node.mode)) {
  1705. node.node_ops = MEMFS.ops_table.link.node;
  1706. node.stream_ops = MEMFS.ops_table.link.stream;
  1707. } else if (FS.isChrdev(node.mode)) {
  1708. node.node_ops = MEMFS.ops_table.chrdev.node;
  1709. node.stream_ops = MEMFS.ops_table.chrdev.stream;
  1710. }
  1711. node.timestamp = Date.now();
  1712. // add the new node to the parent
  1713. if (parent) {
  1714. parent.contents[name] = node;
  1715. }
  1716. return node;
  1717. },getFileDataAsRegularArray:function (node) {
  1718. if (node.contents && node.contents.subarray) {
  1719. var arr = [];
  1720. for (var i = 0; i < node.usedBytes; ++i) arr.push(node.contents[i]);
  1721. return arr; // Returns a copy of the original data.
  1722. }
  1723. return node.contents; // No-op, the file contents are already in a JS array. Return as-is.
  1724. },getFileDataAsTypedArray:function (node) {
  1725. if (!node.contents) return new Uint8Array;
  1726. if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); // Make sure to not return excess unused bytes.
  1727. return new Uint8Array(node.contents);
  1728. },expandFileStorage:function (node, newCapacity) {
  1729. // If we are asked to expand the size of a file that already exists, revert to using a standard JS array to store the file
  1730. // instead of a typed array. This makes resizing the array more flexible because we can just .push() elements at the back to
  1731. // increase the size.
  1732. if (node.contents && node.contents.subarray && newCapacity > node.contents.length) {
  1733. node.contents = MEMFS.getFileDataAsRegularArray(node);
  1734. node.usedBytes = node.contents.length; // We might be writing to a lazy-loaded file which had overridden this property, so force-reset it.
  1735. }
  1736. if (!node.contents || node.contents.subarray) { // Keep using a typed array if creating a new storage, or if old one was a typed array as well.
  1737. var prevCapacity = node.contents ? node.contents.buffer.byteLength : 0;
  1738. if (prevCapacity >= newCapacity) return; // No need to expand, the storage was already large enough.
  1739. // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity.
  1740. // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to
  1741. // avoid overshooting the allocation cap by a very large margin.
  1742. var CAPACITY_DOUBLING_MAX = 1024 * 1024;
  1743. newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) | 0);
  1744. if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); // At minimum allocate 256b for each file when expanding.
  1745. var oldContents = node.contents;
  1746. node.contents = new Uint8Array(newCapacity); // Allocate new storage.
  1747. if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); // Copy old data over to the new storage.
  1748. return;
  1749. }
  1750. // Not using a typed array to back the file storage. Use a standard JS array instead.
  1751. if (!node.contents && newCapacity > 0) node.contents = [];
  1752. while (node.contents.length < newCapacity) node.contents.push(0);
  1753. },resizeFileStorage:function (node, newSize) {
  1754. if (node.usedBytes == newSize) return;
  1755. if (newSize == 0) {
  1756. node.contents = null; // Fully decommit when requesting a resize to zero.
  1757. node.usedBytes = 0;
  1758. return;
  1759. }
  1760. if (!node.contents || node.contents.subarray) { // Resize a typed array if that is being used as the backing store.
  1761. var oldContents = node.contents;
  1762. node.contents = new Uint8Array(new ArrayBuffer(newSize)); // Allocate new storage.
  1763. if (oldContents) {
  1764. node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); // Copy old data over to the new storage.
  1765. }
  1766. node.usedBytes = newSize;
  1767. return;
  1768. }
  1769. // Backing with a JS array.
  1770. if (!node.contents) node.contents = [];
  1771. if (node.contents.length > newSize) node.contents.length = newSize;
  1772. else while (node.contents.length < newSize) node.contents.push(0);
  1773. node.usedBytes = newSize;
  1774. },node_ops:{getattr:function (node) {
  1775. var attr = {};
  1776. // device numbers reuse inode numbers.
  1777. attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
  1778. attr.ino = node.id;
  1779. attr.mode = node.mode;
  1780. attr.nlink = 1;
  1781. attr.uid = 0;
  1782. attr.gid = 0;
  1783. attr.rdev = node.rdev;
  1784. if (FS.isDir(node.mode)) {
  1785. attr.size = 4096;
  1786. } else if (FS.isFile(node.mode)) {
  1787. attr.size = node.usedBytes;
  1788. } else if (FS.isLink(node.mode)) {
  1789. attr.size = node.link.length;
  1790. } else {
  1791. attr.size = 0;
  1792. }
  1793. attr.atime = new Date(node.timestamp);
  1794. attr.mtime = new Date(node.timestamp);
  1795. attr.ctime = new Date(node.timestamp);
  1796. // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize),
  1797. // but this is not required by the standard.
  1798. attr.blksize = 4096;
  1799. attr.blocks = Math.ceil(attr.size / attr.blksize);
  1800. return attr;
  1801. },setattr:function (node, attr) {
  1802. if (attr.mode !== undefined) {
  1803. node.mode = attr.mode;
  1804. }
  1805. if (attr.timestamp !== undefined) {
  1806. node.timestamp = attr.timestamp;
  1807. }
  1808. if (attr.size !== undefined) {
  1809. MEMFS.resizeFileStorage(node, attr.size);
  1810. }
  1811. },lookup:function (parent, name) {
  1812. throw FS.genericErrors[ERRNO_CODES.ENOENT];
  1813. },mknod:function (parent, name, mode, dev) {
  1814. return MEMFS.createNode(parent, name, mode, dev);
  1815. },rename:function (old_node, new_dir, new_name) {
  1816. // if we're overwriting a directory at new_name, make sure it's empty.
  1817. if (FS.isDir(old_node.mode)) {
  1818. var new_node;
  1819. try {
  1820. new_node = FS.lookupNode(new_dir, new_name);
  1821. } catch (e) {
  1822. }
  1823. if (new_node) {
  1824. for (var i in new_node.contents) {
  1825. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  1826. }
  1827. }
  1828. }
  1829. // do the internal rewiring
  1830. delete old_node.parent.contents[old_node.name];
  1831. old_node.name = new_name;
  1832. new_dir.contents[new_name] = old_node;
  1833. old_node.parent = new_dir;
  1834. },unlink:function (parent, name) {
  1835. delete parent.contents[name];
  1836. },rmdir:function (parent, name) {
  1837. var node = FS.lookupNode(parent, name);
  1838. for (var i in node.contents) {
  1839. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  1840. }
  1841. delete parent.contents[name];
  1842. },readdir:function (node) {
  1843. var entries = ['.', '..']
  1844. for (var key in node.contents) {
  1845. if (!node.contents.hasOwnProperty(key)) {
  1846. continue;
  1847. }
  1848. entries.push(key);
  1849. }
  1850. return entries;
  1851. },symlink:function (parent, newname, oldpath) {
  1852. var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0);
  1853. node.link = oldpath;
  1854. return node;
  1855. },readlink:function (node) {
  1856. if (!FS.isLink(node.mode)) {
  1857. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  1858. }
  1859. return node.link;
  1860. }},stream_ops:{read:function (stream, buffer, offset, length, position) {
  1861. var contents = stream.node.contents;
  1862. if (position >= stream.node.usedBytes) return 0;
  1863. var size = Math.min(stream.node.usedBytes - position, length);
  1864. assert(size >= 0);
  1865. if (size > 8 && contents.subarray) { // non-trivial, and typed array
  1866. buffer.set(contents.subarray(position, position + size), offset);
  1867. } else
  1868. {
  1869. for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
  1870. }
  1871. return size;
  1872. },write:function (stream, buffer, offset, length, position, canOwn) {
  1873. if (!length) return 0;
  1874. var node = stream.node;
  1875. node.timestamp = Date.now();
  1876. if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
  1877. if (canOwn) { // Can we just reuse the buffer we are given?
  1878. node.contents = buffer.subarray(offset, offset + length);
  1879. node.usedBytes = length;
  1880. return length;
  1881. } else if (node.usedBytes === 0 && position === 0) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
  1882. node.contents = new Uint8Array(buffer.subarray(offset, offset + length));
  1883. node.usedBytes = length;
  1884. return length;
  1885. } else if (position + length <= node.usedBytes) { // Writing to an already allocated and used subrange of the file?
  1886. node.contents.set(buffer.subarray(offset, offset + length), position);
  1887. return length;
  1888. }
  1889. }
  1890. // Appending to an existing file and we need to reallocate, or source data did not come as a typed array.
  1891. MEMFS.expandFileStorage(node, position+length);
  1892. if (node.contents.subarray && buffer.subarray) node.contents.set(buffer.subarray(offset, offset + length), position); // Use typed array write if available.
  1893. else
  1894. for (var i = 0; i < length; i++) {
  1895. node.contents[position + i] = buffer[offset + i]; // Or fall back to manual write if not.
  1896. }
  1897. node.usedBytes = Math.max(node.usedBytes, position+length);
  1898. return length;
  1899. },llseek:function (stream, offset, whence) {
  1900. var position = offset;
  1901. if (whence === 1) { // SEEK_CUR.
  1902. position += stream.position;
  1903. } else if (whence === 2) { // SEEK_END.
  1904. if (FS.isFile(stream.node.mode)) {
  1905. position += stream.node.usedBytes;
  1906. }
  1907. }
  1908. if (position < 0) {
  1909. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  1910. }
  1911. return position;
  1912. },allocate:function (stream, offset, length) {
  1913. MEMFS.expandFileStorage(stream.node, offset + length);
  1914. stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
  1915. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  1916. if (!FS.isFile(stream.node.mode)) {
  1917. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  1918. }
  1919. var ptr;
  1920. var allocated;
  1921. var contents = stream.node.contents;
  1922. // Only make a new copy when MAP_PRIVATE is specified.
  1923. if ( !(flags & 2) &&
  1924. (contents.buffer === buffer || contents.buffer === buffer.buffer) ) {
  1925. // We can't emulate MAP_SHARED when the file is not backed by the buffer
  1926. // we're mapping to (e.g. the HEAP buffer).
  1927. allocated = false;
  1928. ptr = contents.byteOffset;
  1929. } else {
  1930. // Try to avoid unnecessary slices.
  1931. if (position > 0 || position + length < stream.node.usedBytes) {
  1932. if (contents.subarray) {
  1933. contents = contents.subarray(position, position + length);
  1934. } else {
  1935. contents = Array.prototype.slice.call(contents, position, position + length);
  1936. }
  1937. }
  1938. allocated = true;
  1939. ptr = _malloc(length);
  1940. if (!ptr) {
  1941. throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
  1942. }
  1943. buffer.set(contents, ptr);
  1944. }
  1945. return { ptr: ptr, allocated: allocated };
  1946. }}};
  1947. var IDBFS={dbs:{},indexedDB:function () {
  1948. if (typeof indexedDB !== 'undefined') return indexedDB;
  1949. var ret = null;
  1950. if (typeof window === 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  1951. assert(ret, 'IDBFS used, but indexedDB not supported');
  1952. return ret;
  1953. },DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function (mount) {
  1954. // reuse all of the core MEMFS functionality
  1955. return MEMFS.mount.apply(null, arguments);
  1956. },syncfs:function (mount, populate, callback) {
  1957. IDBFS.getLocalSet(mount, function(err, local) {
  1958. if (err) return callback(err);
  1959. IDBFS.getRemoteSet(mount, function(err, remote) {
  1960. if (err) return callback(err);
  1961. var src = populate ? remote : local;
  1962. var dst = populate ? local : remote;
  1963. IDBFS.reconcile(src, dst, callback);
  1964. });
  1965. });
  1966. },getDB:function (name, callback) {
  1967. // check the cache first
  1968. var db = IDBFS.dbs[name];
  1969. if (db) {
  1970. return callback(null, db);
  1971. }
  1972. var req;
  1973. try {
  1974. req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
  1975. } catch (e) {
  1976. return callback(e);
  1977. }
  1978. req.onupgradeneeded = function(e) {
  1979. var db = e.target.result;
  1980. var transaction = e.target.transaction;
  1981. var fileStore;
  1982. if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) {
  1983. fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
  1984. } else {
  1985. fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME);
  1986. }
  1987. fileStore.createIndex('timestamp', 'timestamp', { unique: false });
  1988. };
  1989. req.onsuccess = function() {
  1990. db = req.result;
  1991. // add to the cache
  1992. IDBFS.dbs[name] = db;
  1993. callback(null, db);
  1994. };
  1995. req.onerror = function() {
  1996. callback(this.error);
  1997. };
  1998. },getLocalSet:function (mount, callback) {
  1999. var entries = {};
  2000. function isRealDir(p) {
  2001. return p !== '.' && p !== '..';
  2002. };
  2003. function toAbsolute(root) {
  2004. return function(p) {
  2005. return PATH.join2(root, p);
  2006. }
  2007. };
  2008. var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
  2009. while (check.length) {
  2010. var path = check.pop();
  2011. var stat;
  2012. try {
  2013. stat = FS.stat(path);
  2014. } catch (e) {
  2015. return callback(e);
  2016. }
  2017. if (FS.isDir(stat.mode)) {
  2018. check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
  2019. }
  2020. entries[path] = { timestamp: stat.mtime };
  2021. }
  2022. return callback(null, { type: 'local', entries: entries });
  2023. },getRemoteSet:function (mount, callback) {
  2024. var entries = {};
  2025. IDBFS.getDB(mount.mountpoint, function(err, db) {
  2026. if (err) return callback(err);
  2027. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly');
  2028. transaction.onerror = function() { callback(this.error); };
  2029. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  2030. var index = store.index('timestamp');
  2031. index.openKeyCursor().onsuccess = function(event) {
  2032. var cursor = event.target.result;
  2033. if (!cursor) {
  2034. return callback(null, { type: 'remote', db: db, entries: entries });
  2035. }
  2036. entries[cursor.primaryKey] = { timestamp: cursor.key };
  2037. cursor.continue();
  2038. };
  2039. });
  2040. },loadLocalEntry:function (path, callback) {
  2041. var stat, node;
  2042. try {
  2043. var lookup = FS.lookupPath(path);
  2044. node = lookup.node;
  2045. stat = FS.stat(path);
  2046. } catch (e) {
  2047. return callback(e);
  2048. }
  2049. if (FS.isDir(stat.mode)) {
  2050. return callback(null, { timestamp: stat.mtime, mode: stat.mode });
  2051. } else if (FS.isFile(stat.mode)) {
  2052. // Performance consideration: storing a normal JavaScript array to a IndexedDB is much slower than storing a typed array.
  2053. // Therefore always convert the file contents to a typed array first before writing the data to IndexedDB.
  2054. node.contents = MEMFS.getFileDataAsTypedArray(node);
  2055. return callback(null, { timestamp: stat.mtime, mode: stat.mode, contents: node.contents });
  2056. } else {
  2057. return callback(new Error('node type not supported'));
  2058. }
  2059. },storeLocalEntry:function (path, entry, callback) {
  2060. try {
  2061. if (FS.isDir(entry.mode)) {
  2062. FS.mkdir(path, entry.mode);
  2063. } else if (FS.isFile(entry.mode)) {
  2064. FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
  2065. } else {
  2066. return callback(new Error('node type not supported'));
  2067. }
  2068. FS.chmod(path, entry.mode);
  2069. FS.utime(path, entry.timestamp, entry.timestamp);
  2070. } catch (e) {
  2071. return callback(e);
  2072. }
  2073. callback(null);
  2074. },removeLocalEntry:function (path, callback) {
  2075. try {
  2076. var lookup = FS.lookupPath(path);
  2077. var stat = FS.stat(path);
  2078. if (FS.isDir(stat.mode)) {
  2079. FS.rmdir(path);
  2080. } else if (FS.isFile(stat.mode)) {
  2081. FS.unlink(path);
  2082. }
  2083. } catch (e) {
  2084. return callback(e);
  2085. }
  2086. callback(null);
  2087. },loadRemoteEntry:function (store, path, callback) {
  2088. var req = store.get(path);
  2089. req.onsuccess = function(event) { callback(null, event.target.result); };
  2090. req.onerror = function() { callback(this.error); };
  2091. },storeRemoteEntry:function (store, path, entry, callback) {
  2092. var req = store.put(entry, path);
  2093. req.onsuccess = function() { callback(null); };
  2094. req.onerror = function() { callback(this.error); };
  2095. },removeRemoteEntry:function (store, path, callback) {
  2096. var req = store.delete(path);
  2097. req.onsuccess = function() { callback(null); };
  2098. req.onerror = function() { callback(this.error); };
  2099. },reconcile:function (src, dst, callback) {
  2100. var total = 0;
  2101. var create = [];
  2102. Object.keys(src.entries).forEach(function (key) {
  2103. var e = src.entries[key];
  2104. var e2 = dst.entries[key];
  2105. if (!e2 || e.timestamp > e2.timestamp) {
  2106. create.push(key);
  2107. total++;
  2108. }
  2109. });
  2110. var remove = [];
  2111. Object.keys(dst.entries).forEach(function (key) {
  2112. var e = dst.entries[key];
  2113. var e2 = src.entries[key];
  2114. if (!e2) {
  2115. remove.push(key);
  2116. total++;
  2117. }
  2118. });
  2119. if (!total) {
  2120. return callback(null);
  2121. }
  2122. var errored = false;
  2123. var completed = 0;
  2124. var db = src.type === 'remote' ? src.db : dst.db;
  2125. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite');
  2126. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  2127. function done(err) {
  2128. if (err) {
  2129. if (!done.errored) {
  2130. done.errored = true;
  2131. return callback(err);
  2132. }
  2133. return;
  2134. }
  2135. if (++completed >= total) {
  2136. return callback(null);
  2137. }
  2138. };
  2139. transaction.onerror = function() { done(this.error); };
  2140. // sort paths in ascending order so directory entries are created
  2141. // before the files inside them
  2142. create.sort().forEach(function (path) {
  2143. if (dst.type === 'local') {
  2144. IDBFS.loadRemoteEntry(store, path, function (err, entry) {
  2145. if (err) return done(err);
  2146. IDBFS.storeLocalEntry(path, entry, done);
  2147. });
  2148. } else {
  2149. IDBFS.loadLocalEntry(path, function (err, entry) {
  2150. if (err) return done(err);
  2151. IDBFS.storeRemoteEntry(store, path, entry, done);
  2152. });
  2153. }
  2154. });
  2155. // sort paths in descending order so files are deleted before their
  2156. // parent directories
  2157. remove.sort().reverse().forEach(function(path) {
  2158. if (dst.type === 'local') {
  2159. IDBFS.removeLocalEntry(path, done);
  2160. } else {
  2161. IDBFS.removeRemoteEntry(store, path, done);
  2162. }
  2163. });
  2164. }};
  2165. var NODEFS={isWindows:false,staticInit:function () {
  2166. NODEFS.isWindows = !!process.platform.match(/^win/);
  2167. },mount:function (mount) {
  2168. assert(ENVIRONMENT_IS_NODE);
  2169. return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0);
  2170. },createNode:function (parent, name, mode, dev) {
  2171. if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
  2172. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2173. }
  2174. var node = FS.createNode(parent, name, mode);
  2175. node.node_ops = NODEFS.node_ops;
  2176. node.stream_ops = NODEFS.stream_ops;
  2177. return node;
  2178. },getMode:function (path) {
  2179. var stat;
  2180. try {
  2181. stat = fs.lstatSync(path);
  2182. if (NODEFS.isWindows) {
  2183. // On Windows, directories return permission bits 'rw-rw-rw-', even though they have 'rwxrwxrwx', so
  2184. // propagate write bits to execute bits.
  2185. stat.mode = stat.mode | ((stat.mode & 146) >> 1);
  2186. }
  2187. } catch (e) {
  2188. if (!e.code) throw e;
  2189. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2190. }
  2191. return stat.mode;
  2192. },realPath:function (node) {
  2193. var parts = [];
  2194. while (node.parent !== node) {
  2195. parts.push(node.name);
  2196. node = node.parent;
  2197. }
  2198. parts.push(node.mount.opts.root);
  2199. parts.reverse();
  2200. return PATH.join.apply(null, parts);
  2201. },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) {
  2202. if (flags in NODEFS.flagsToPermissionStringMap) {
  2203. return NODEFS.flagsToPermissionStringMap[flags];
  2204. } else {
  2205. return flags;
  2206. }
  2207. },node_ops:{getattr:function (node) {
  2208. var path = NODEFS.realPath(node);
  2209. var stat;
  2210. try {
  2211. stat = fs.lstatSync(path);
  2212. } catch (e) {
  2213. if (!e.code) throw e;
  2214. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2215. }
  2216. // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake them with default blksize of 4096.
  2217. // See http://support.microsoft.com/kb/140365
  2218. if (NODEFS.isWindows && !stat.blksize) {
  2219. stat.blksize = 4096;
  2220. }
  2221. if (NODEFS.isWindows && !stat.blocks) {
  2222. stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0;
  2223. }
  2224. return {
  2225. dev: stat.dev,
  2226. ino: stat.ino,
  2227. mode: stat.mode,
  2228. nlink: stat.nlink,
  2229. uid: stat.uid,
  2230. gid: stat.gid,
  2231. rdev: stat.rdev,
  2232. size: stat.size,
  2233. atime: stat.atime,
  2234. mtime: stat.mtime,
  2235. ctime: stat.ctime,
  2236. blksize: stat.blksize,
  2237. blocks: stat.blocks
  2238. };
  2239. },setattr:function (node, attr) {
  2240. var path = NODEFS.realPath(node);
  2241. try {
  2242. if (attr.mode !== undefined) {
  2243. fs.chmodSync(path, attr.mode);
  2244. // update the common node structure mode as well
  2245. node.mode = attr.mode;
  2246. }
  2247. if (attr.timestamp !== undefined) {
  2248. var date = new Date(attr.timestamp);
  2249. fs.utimesSync(path, date, date);
  2250. }
  2251. if (attr.size !== undefined) {
  2252. fs.truncateSync(path, attr.size);
  2253. }
  2254. } catch (e) {
  2255. if (!e.code) throw e;
  2256. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2257. }
  2258. },lookup:function (parent, name) {
  2259. var path = PATH.join2(NODEFS.realPath(parent), name);
  2260. var mode = NODEFS.getMode(path);
  2261. return NODEFS.createNode(parent, name, mode);
  2262. },mknod:function (parent, name, mode, dev) {
  2263. var node = NODEFS.createNode(parent, name, mode, dev);
  2264. // create the backing node for this in the fs root as well
  2265. var path = NODEFS.realPath(node);
  2266. try {
  2267. if (FS.isDir(node.mode)) {
  2268. fs.mkdirSync(path, node.mode);
  2269. } else {
  2270. fs.writeFileSync(path, '', { mode: node.mode });
  2271. }
  2272. } catch (e) {
  2273. if (!e.code) throw e;
  2274. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2275. }
  2276. return node;
  2277. },rename:function (oldNode, newDir, newName) {
  2278. var oldPath = NODEFS.realPath(oldNode);
  2279. var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
  2280. try {
  2281. fs.renameSync(oldPath, newPath);
  2282. } catch (e) {
  2283. if (!e.code) throw e;
  2284. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2285. }
  2286. },unlink:function (parent, name) {
  2287. var path = PATH.join2(NODEFS.realPath(parent), name);
  2288. try {
  2289. fs.unlinkSync(path);
  2290. } catch (e) {
  2291. if (!e.code) throw e;
  2292. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2293. }
  2294. },rmdir:function (parent, name) {
  2295. var path = PATH.join2(NODEFS.realPath(parent), name);
  2296. try {
  2297. fs.rmdirSync(path);
  2298. } catch (e) {
  2299. if (!e.code) throw e;
  2300. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2301. }
  2302. },readdir:function (node) {
  2303. var path = NODEFS.realPath(node);
  2304. try {
  2305. return fs.readdirSync(path);
  2306. } catch (e) {
  2307. if (!e.code) throw e;
  2308. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2309. }
  2310. },symlink:function (parent, newName, oldPath) {
  2311. var newPath = PATH.join2(NODEFS.realPath(parent), newName);
  2312. try {
  2313. fs.symlinkSync(oldPath, newPath);
  2314. } catch (e) {
  2315. if (!e.code) throw e;
  2316. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2317. }
  2318. },readlink:function (node) {
  2319. var path = NODEFS.realPath(node);
  2320. try {
  2321. return fs.readlinkSync(path);
  2322. } catch (e) {
  2323. if (!e.code) throw e;
  2324. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2325. }
  2326. }},stream_ops:{open:function (stream) {
  2327. var path = NODEFS.realPath(stream.node);
  2328. try {
  2329. if (FS.isFile(stream.node.mode)) {
  2330. stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
  2331. }
  2332. } catch (e) {
  2333. if (!e.code) throw e;
  2334. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2335. }
  2336. },close:function (stream) {
  2337. try {
  2338. if (FS.isFile(stream.node.mode) && stream.nfd) {
  2339. fs.closeSync(stream.nfd);
  2340. }
  2341. } catch (e) {
  2342. if (!e.code) throw e;
  2343. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2344. }
  2345. },read:function (stream, buffer, offset, length, position) {
  2346. if (length === 0) return 0; // node errors on 0 length reads
  2347. // FIXME this is terrible.
  2348. var nbuffer = new Buffer(length);
  2349. var res;
  2350. try {
  2351. res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
  2352. } catch (e) {
  2353. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2354. }
  2355. if (res > 0) {
  2356. for (var i = 0; i < res; i++) {
  2357. buffer[offset + i] = nbuffer[i];
  2358. }
  2359. }
  2360. return res;
  2361. },write:function (stream, buffer, offset, length, position) {
  2362. // FIXME this is terrible.
  2363. var nbuffer = new Buffer(buffer.subarray(offset, offset + length));
  2364. var res;
  2365. try {
  2366. res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
  2367. } catch (e) {
  2368. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2369. }
  2370. return res;
  2371. },llseek:function (stream, offset, whence) {
  2372. var position = offset;
  2373. if (whence === 1) { // SEEK_CUR.
  2374. position += stream.position;
  2375. } else if (whence === 2) { // SEEK_END.
  2376. if (FS.isFile(stream.node.mode)) {
  2377. try {
  2378. var stat = fs.fstatSync(stream.nfd);
  2379. position += stat.size;
  2380. } catch (e) {
  2381. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2382. }
  2383. }
  2384. }
  2385. if (position < 0) {
  2386. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2387. }
  2388. return position;
  2389. }}};
  2390. var _stdin=allocate(1, "i32*", ALLOC_STATIC);
  2391. var _stdout=allocate(1, "i32*", ALLOC_STATIC);
  2392. var _stderr=allocate(1, "i32*", ALLOC_STATIC);
  2393. function _fflush(stream) {
  2394. // int fflush(FILE *stream);
  2395. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fflush.html
  2396. /*
  2397. // Disabled, see https://github.com/kripken/emscripten/issues/2770
  2398. stream = FS.getStreamFromPtr(stream);
  2399. if (stream.stream_ops.flush) {
  2400. stream.stream_ops.flush(stream);
  2401. }
  2402. */
  2403. }var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},handleFSError:function (e) {
  2404. if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
  2405. return ___setErrNo(e.errno);
  2406. },lookupPath:function (path, opts) {
  2407. path = PATH.resolve(FS.cwd(), path);
  2408. opts = opts || {};
  2409. if (!path) return { path: '', node: null };
  2410. var defaults = {
  2411. follow_mount: true,
  2412. recurse_count: 0
  2413. };
  2414. for (var key in defaults) {
  2415. if (opts[key] === undefined) {
  2416. opts[key] = defaults[key];
  2417. }
  2418. }
  2419. if (opts.recurse_count > 8) { // max recursive lookup of 8
  2420. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2421. }
  2422. // split the path
  2423. var parts = PATH.normalizeArray(path.split('/').filter(function(p) {
  2424. return !!p;
  2425. }), false);
  2426. // start at the root
  2427. var current = FS.root;
  2428. var current_path = '/';
  2429. for (var i = 0; i < parts.length; i++) {
  2430. var islast = (i === parts.length-1);
  2431. if (islast && opts.parent) {
  2432. // stop resolving
  2433. break;
  2434. }
  2435. current = FS.lookupNode(current, parts[i]);
  2436. current_path = PATH.join2(current_path, parts[i]);
  2437. // jump to the mount's root node if this is a mountpoint
  2438. if (FS.isMountpoint(current)) {
  2439. if (!islast || (islast && opts.follow_mount)) {
  2440. current = current.mounted.root;
  2441. }
  2442. }
  2443. // by default, lookupPath will not follow a symlink if it is the final path component.
  2444. // setting opts.follow = true will override this behavior.
  2445. if (!islast || opts.follow) {
  2446. var count = 0;
  2447. while (FS.isLink(current.mode)) {
  2448. var link = FS.readlink(current_path);
  2449. current_path = PATH.resolve(PATH.dirname(current_path), link);
  2450. var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count });
  2451. current = lookup.node;
  2452. if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
  2453. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2454. }
  2455. }
  2456. }
  2457. }
  2458. return { path: current_path, node: current };
  2459. },getPath:function (node) {
  2460. var path;
  2461. while (true) {
  2462. if (FS.isRoot(node)) {
  2463. var mount = node.mount.mountpoint;
  2464. if (!path) return mount;
  2465. return mount[mount.length-1] !== '/' ? mount + '/' + path : mount + path;
  2466. }
  2467. path = path ? node.name + '/' + path : node.name;
  2468. node = node.parent;
  2469. }
  2470. },hashName:function (parentid, name) {
  2471. var hash = 0;
  2472. for (var i = 0; i < name.length; i++) {
  2473. hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0;
  2474. }
  2475. return ((parentid + hash) >>> 0) % FS.nameTable.length;
  2476. },hashAddNode:function (node) {
  2477. var hash = FS.hashName(node.parent.id, node.name);
  2478. node.name_next = FS.nameTable[hash];
  2479. FS.nameTable[hash] = node;
  2480. },hashRemoveNode:function (node) {
  2481. var hash = FS.hashName(node.parent.id, node.name);
  2482. if (FS.nameTable[hash] === node) {
  2483. FS.nameTable[hash] = node.name_next;
  2484. } else {
  2485. var current = FS.nameTable[hash];
  2486. while (current) {
  2487. if (current.name_next === node) {
  2488. current.name_next = node.name_next;
  2489. break;
  2490. }
  2491. current = current.name_next;
  2492. }
  2493. }
  2494. },lookupNode:function (parent, name) {
  2495. var err = FS.mayLookup(parent);
  2496. if (err) {
  2497. throw new FS.ErrnoError(err, parent);
  2498. }
  2499. var hash = FS.hashName(parent.id, name);
  2500. for (var node = FS.nameTable[hash]; node; node = node.name_next) {
  2501. var nodeName = node.name;
  2502. if (node.parent.id === parent.id && nodeName === name) {
  2503. return node;
  2504. }
  2505. }
  2506. // if we failed to find it in the cache, call into the VFS
  2507. return FS.lookup(parent, name);
  2508. },createNode:function (parent, name, mode, rdev) {
  2509. if (!FS.FSNode) {
  2510. FS.FSNode = function(parent, name, mode, rdev) {
  2511. if (!parent) {
  2512. parent = this; // root node sets parent to itself
  2513. }
  2514. this.parent = parent;
  2515. this.mount = parent.mount;
  2516. this.mounted = null;
  2517. this.id = FS.nextInode++;
  2518. this.name = name;
  2519. this.mode = mode;
  2520. this.node_ops = {};
  2521. this.stream_ops = {};
  2522. this.rdev = rdev;
  2523. };
  2524. FS.FSNode.prototype = {};
  2525. // compatibility
  2526. var readMode = 292 | 73;
  2527. var writeMode = 146;
  2528. // NOTE we must use Object.defineProperties instead of individual calls to
  2529. // Object.defineProperty in order to make closure compiler happy
  2530. Object.defineProperties(FS.FSNode.prototype, {
  2531. read: {
  2532. get: function() { return (this.mode & readMode) === readMode; },
  2533. set: function(val) { val ? this.mode |= readMode : this.mode &= ~readMode; }
  2534. },
  2535. write: {
  2536. get: function() { return (this.mode & writeMode) === writeMode; },
  2537. set: function(val) { val ? this.mode |= writeMode : this.mode &= ~writeMode; }
  2538. },
  2539. isFolder: {
  2540. get: function() { return FS.isDir(this.mode); }
  2541. },
  2542. isDevice: {
  2543. get: function() { return FS.isChrdev(this.mode); }
  2544. }
  2545. });
  2546. }
  2547. var node = new FS.FSNode(parent, name, mode, rdev);
  2548. FS.hashAddNode(node);
  2549. return node;
  2550. },destroyNode:function (node) {
  2551. FS.hashRemoveNode(node);
  2552. },isRoot:function (node) {
  2553. return node === node.parent;
  2554. },isMountpoint:function (node) {
  2555. return !!node.mounted;
  2556. },isFile:function (mode) {
  2557. return (mode & 61440) === 32768;
  2558. },isDir:function (mode) {
  2559. return (mode & 61440) === 16384;
  2560. },isLink:function (mode) {
  2561. return (mode & 61440) === 40960;
  2562. },isChrdev:function (mode) {
  2563. return (mode & 61440) === 8192;
  2564. },isBlkdev:function (mode) {
  2565. return (mode & 61440) === 24576;
  2566. },isFIFO:function (mode) {
  2567. return (mode & 61440) === 4096;
  2568. },isSocket:function (mode) {
  2569. return (mode & 49152) === 49152;
  2570. },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) {
  2571. var flags = FS.flagModes[str];
  2572. if (typeof flags === 'undefined') {
  2573. throw new Error('Unknown file open mode: ' + str);
  2574. }
  2575. return flags;
  2576. },flagsToPermissionString:function (flag) {
  2577. var accmode = flag & 2097155;
  2578. var perms = ['r', 'w', 'rw'][accmode];
  2579. if ((flag & 512)) {
  2580. perms += 'w';
  2581. }
  2582. return perms;
  2583. },nodePermissions:function (node, perms) {
  2584. if (FS.ignorePermissions) {
  2585. return 0;
  2586. }
  2587. // return 0 if any user, group or owner bits are set.
  2588. if (perms.indexOf('r') !== -1 && !(node.mode & 292)) {
  2589. return ERRNO_CODES.EACCES;
  2590. } else if (perms.indexOf('w') !== -1 && !(node.mode & 146)) {
  2591. return ERRNO_CODES.EACCES;
  2592. } else if (perms.indexOf('x') !== -1 && !(node.mode & 73)) {
  2593. return ERRNO_CODES.EACCES;
  2594. }
  2595. return 0;
  2596. },mayLookup:function (dir) {
  2597. var err = FS.nodePermissions(dir, 'x');
  2598. if (err) return err;
  2599. if (!dir.node_ops.lookup) return ERRNO_CODES.EACCES;
  2600. return 0;
  2601. },mayCreate:function (dir, name) {
  2602. try {
  2603. var node = FS.lookupNode(dir, name);
  2604. return ERRNO_CODES.EEXIST;
  2605. } catch (e) {
  2606. }
  2607. return FS.nodePermissions(dir, 'wx');
  2608. },mayDelete:function (dir, name, isdir) {
  2609. var node;
  2610. try {
  2611. node = FS.lookupNode(dir, name);
  2612. } catch (e) {
  2613. return e.errno;
  2614. }
  2615. var err = FS.nodePermissions(dir, 'wx');
  2616. if (err) {
  2617. return err;
  2618. }
  2619. if (isdir) {
  2620. if (!FS.isDir(node.mode)) {
  2621. return ERRNO_CODES.ENOTDIR;
  2622. }
  2623. if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
  2624. return ERRNO_CODES.EBUSY;
  2625. }
  2626. } else {
  2627. if (FS.isDir(node.mode)) {
  2628. return ERRNO_CODES.EISDIR;
  2629. }
  2630. }
  2631. return 0;
  2632. },mayOpen:function (node, flags) {
  2633. if (!node) {
  2634. return ERRNO_CODES.ENOENT;
  2635. }
  2636. if (FS.isLink(node.mode)) {
  2637. return ERRNO_CODES.ELOOP;
  2638. } else if (FS.isDir(node.mode)) {
  2639. if ((flags & 2097155) !== 0 || // opening for write
  2640. (flags & 512)) {
  2641. return ERRNO_CODES.EISDIR;
  2642. }
  2643. }
  2644. return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
  2645. },MAX_OPEN_FDS:4096,nextfd:function (fd_start, fd_end) {
  2646. fd_start = fd_start || 0;
  2647. fd_end = fd_end || FS.MAX_OPEN_FDS;
  2648. for (var fd = fd_start; fd <= fd_end; fd++) {
  2649. if (!FS.streams[fd]) {
  2650. return fd;
  2651. }
  2652. }
  2653. throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
  2654. },getStream:function (fd) {
  2655. return FS.streams[fd];
  2656. },createStream:function (stream, fd_start, fd_end) {
  2657. if (!FS.FSStream) {
  2658. FS.FSStream = function(){};
  2659. FS.FSStream.prototype = {};
  2660. // compatibility
  2661. Object.defineProperties(FS.FSStream.prototype, {
  2662. object: {
  2663. get: function() { return this.node; },
  2664. set: function(val) { this.node = val; }
  2665. },
  2666. isRead: {
  2667. get: function() { return (this.flags & 2097155) !== 1; }
  2668. },
  2669. isWrite: {
  2670. get: function() { return (this.flags & 2097155) !== 0; }
  2671. },
  2672. isAppend: {
  2673. get: function() { return (this.flags & 1024); }
  2674. }
  2675. });
  2676. }
  2677. // clone it, so we can return an instance of FSStream
  2678. var newStream = new FS.FSStream();
  2679. for (var p in stream) {
  2680. newStream[p] = stream[p];
  2681. }
  2682. stream = newStream;
  2683. var fd = FS.nextfd(fd_start, fd_end);
  2684. stream.fd = fd;
  2685. FS.streams[fd] = stream;
  2686. return stream;
  2687. },closeStream:function (fd) {
  2688. FS.streams[fd] = null;
  2689. },getStreamFromPtr:function (ptr) {
  2690. return FS.streams[ptr - 1];
  2691. },getPtrForStream:function (stream) {
  2692. return stream ? stream.fd + 1 : 0;
  2693. },chrdev_stream_ops:{open:function (stream) {
  2694. var device = FS.getDevice(stream.node.rdev);
  2695. // override node's stream ops with the device's
  2696. stream.stream_ops = device.stream_ops;
  2697. // forward the open call
  2698. if (stream.stream_ops.open) {
  2699. stream.stream_ops.open(stream);
  2700. }
  2701. },llseek:function () {
  2702. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  2703. }},major:function (dev) {
  2704. return ((dev) >> 8);
  2705. },minor:function (dev) {
  2706. return ((dev) & 0xff);
  2707. },makedev:function (ma, mi) {
  2708. return ((ma) << 8 | (mi));
  2709. },registerDevice:function (dev, ops) {
  2710. FS.devices[dev] = { stream_ops: ops };
  2711. },getDevice:function (dev) {
  2712. return FS.devices[dev];
  2713. },getMounts:function (mount) {
  2714. var mounts = [];
  2715. var check = [mount];
  2716. while (check.length) {
  2717. var m = check.pop();
  2718. mounts.push(m);
  2719. check.push.apply(check, m.mounts);
  2720. }
  2721. return mounts;
  2722. },syncfs:function (populate, callback) {
  2723. if (typeof(populate) === 'function') {
  2724. callback = populate;
  2725. populate = false;
  2726. }
  2727. var mounts = FS.getMounts(FS.root.mount);
  2728. var completed = 0;
  2729. function done(err) {
  2730. if (err) {
  2731. if (!done.errored) {
  2732. done.errored = true;
  2733. return callback(err);
  2734. }
  2735. return;
  2736. }
  2737. if (++completed >= mounts.length) {
  2738. callback(null);
  2739. }
  2740. };
  2741. // sync all mounts
  2742. mounts.forEach(function (mount) {
  2743. if (!mount.type.syncfs) {
  2744. return done(null);
  2745. }
  2746. mount.type.syncfs(mount, populate, done);
  2747. });
  2748. },mount:function (type, opts, mountpoint) {
  2749. var root = mountpoint === '/';
  2750. var pseudo = !mountpoint;
  2751. var node;
  2752. if (root && FS.root) {
  2753. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2754. } else if (!root && !pseudo) {
  2755. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  2756. mountpoint = lookup.path; // use the absolute path
  2757. node = lookup.node;
  2758. if (FS.isMountpoint(node)) {
  2759. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2760. }
  2761. if (!FS.isDir(node.mode)) {
  2762. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  2763. }
  2764. }
  2765. var mount = {
  2766. type: type,
  2767. opts: opts,
  2768. mountpoint: mountpoint,
  2769. mounts: []
  2770. };
  2771. // create a root node for the fs
  2772. var mountRoot = type.mount(mount);
  2773. mountRoot.mount = mount;
  2774. mount.root = mountRoot;
  2775. if (root) {
  2776. FS.root = mountRoot;
  2777. } else if (node) {
  2778. // set as a mountpoint
  2779. node.mounted = mount;
  2780. // add the new mount to the current mount's children
  2781. if (node.mount) {
  2782. node.mount.mounts.push(mount);
  2783. }
  2784. }
  2785. return mountRoot;
  2786. },unmount:function (mountpoint) {
  2787. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  2788. if (!FS.isMountpoint(lookup.node)) {
  2789. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2790. }
  2791. // destroy the nodes for this mount, and all its child mounts
  2792. var node = lookup.node;
  2793. var mount = node.mounted;
  2794. var mounts = FS.getMounts(mount);
  2795. Object.keys(FS.nameTable).forEach(function (hash) {
  2796. var current = FS.nameTable[hash];
  2797. while (current) {
  2798. var next = current.name_next;
  2799. if (mounts.indexOf(current.mount) !== -1) {
  2800. FS.destroyNode(current);
  2801. }
  2802. current = next;
  2803. }
  2804. });
  2805. // no longer a mountpoint
  2806. node.mounted = null;
  2807. // remove this mount from the child mounts
  2808. var idx = node.mount.mounts.indexOf(mount);
  2809. assert(idx !== -1);
  2810. node.mount.mounts.splice(idx, 1);
  2811. },lookup:function (parent, name) {
  2812. return parent.node_ops.lookup(parent, name);
  2813. },mknod:function (path, mode, dev) {
  2814. var lookup = FS.lookupPath(path, { parent: true });
  2815. var parent = lookup.node;
  2816. var name = PATH.basename(path);
  2817. if (!name || name === '.' || name === '..') {
  2818. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2819. }
  2820. var err = FS.mayCreate(parent, name);
  2821. if (err) {
  2822. throw new FS.ErrnoError(err);
  2823. }
  2824. if (!parent.node_ops.mknod) {
  2825. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2826. }
  2827. return parent.node_ops.mknod(parent, name, mode, dev);
  2828. },create:function (path, mode) {
  2829. mode = mode !== undefined ? mode : 438 /* 0666 */;
  2830. mode &= 4095;
  2831. mode |= 32768;
  2832. return FS.mknod(path, mode, 0);
  2833. },mkdir:function (path, mode) {
  2834. mode = mode !== undefined ? mode : 511 /* 0777 */;
  2835. mode &= 511 | 512;
  2836. mode |= 16384;
  2837. return FS.mknod(path, mode, 0);
  2838. },mkdev:function (path, mode, dev) {
  2839. if (typeof(dev) === 'undefined') {
  2840. dev = mode;
  2841. mode = 438 /* 0666 */;
  2842. }
  2843. mode |= 8192;
  2844. return FS.mknod(path, mode, dev);
  2845. },symlink:function (oldpath, newpath) {
  2846. if (!PATH.resolve(oldpath)) {
  2847. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  2848. }
  2849. var lookup = FS.lookupPath(newpath, { parent: true });
  2850. var parent = lookup.node;
  2851. if (!parent) {
  2852. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  2853. }
  2854. var newname = PATH.basename(newpath);
  2855. var err = FS.mayCreate(parent, newname);
  2856. if (err) {
  2857. throw new FS.ErrnoError(err);
  2858. }
  2859. if (!parent.node_ops.symlink) {
  2860. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2861. }
  2862. return parent.node_ops.symlink(parent, newname, oldpath);
  2863. },rename:function (old_path, new_path) {
  2864. var old_dirname = PATH.dirname(old_path);
  2865. var new_dirname = PATH.dirname(new_path);
  2866. var old_name = PATH.basename(old_path);
  2867. var new_name = PATH.basename(new_path);
  2868. // parents must exist
  2869. var lookup, old_dir, new_dir;
  2870. try {
  2871. lookup = FS.lookupPath(old_path, { parent: true });
  2872. old_dir = lookup.node;
  2873. lookup = FS.lookupPath(new_path, { parent: true });
  2874. new_dir = lookup.node;
  2875. } catch (e) {
  2876. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2877. }
  2878. if (!old_dir || !new_dir) throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  2879. // need to be part of the same mount
  2880. if (old_dir.mount !== new_dir.mount) {
  2881. throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
  2882. }
  2883. // source must exist
  2884. var old_node = FS.lookupNode(old_dir, old_name);
  2885. // old path should not be an ancestor of the new path
  2886. var relative = PATH.relative(old_path, new_dirname);
  2887. if (relative.charAt(0) !== '.') {
  2888. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2889. }
  2890. // new path should not be an ancestor of the old path
  2891. relative = PATH.relative(new_path, old_dirname);
  2892. if (relative.charAt(0) !== '.') {
  2893. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  2894. }
  2895. // see if the new path already exists
  2896. var new_node;
  2897. try {
  2898. new_node = FS.lookupNode(new_dir, new_name);
  2899. } catch (e) {
  2900. // not fatal
  2901. }
  2902. // early out if nothing needs to change
  2903. if (old_node === new_node) {
  2904. return;
  2905. }
  2906. // we'll need to delete the old entry
  2907. var isdir = FS.isDir(old_node.mode);
  2908. var err = FS.mayDelete(old_dir, old_name, isdir);
  2909. if (err) {
  2910. throw new FS.ErrnoError(err);
  2911. }
  2912. // need delete permissions if we'll be overwriting.
  2913. // need create permissions if new doesn't already exist.
  2914. err = new_node ?
  2915. FS.mayDelete(new_dir, new_name, isdir) :
  2916. FS.mayCreate(new_dir, new_name);
  2917. if (err) {
  2918. throw new FS.ErrnoError(err);
  2919. }
  2920. if (!old_dir.node_ops.rename) {
  2921. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2922. }
  2923. if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
  2924. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2925. }
  2926. // if we are going to change the parent, check write permissions
  2927. if (new_dir !== old_dir) {
  2928. err = FS.nodePermissions(old_dir, 'w');
  2929. if (err) {
  2930. throw new FS.ErrnoError(err);
  2931. }
  2932. }
  2933. try {
  2934. if (FS.trackingDelegate['willMovePath']) {
  2935. FS.trackingDelegate['willMovePath'](old_path, new_path);
  2936. }
  2937. } catch(e) {
  2938. console.log("FS.trackingDelegate['willMovePath']('"+old_path+"', '"+new_path+"') threw an exception: " + e.message);
  2939. }
  2940. // remove the node from the lookup hash
  2941. FS.hashRemoveNode(old_node);
  2942. // do the underlying fs rename
  2943. try {
  2944. old_dir.node_ops.rename(old_node, new_dir, new_name);
  2945. } catch (e) {
  2946. throw e;
  2947. } finally {
  2948. // add the node back to the hash (in case node_ops.rename
  2949. // changed its name)
  2950. FS.hashAddNode(old_node);
  2951. }
  2952. try {
  2953. if (FS.trackingDelegate['onMovePath']) FS.trackingDelegate['onMovePath'](old_path, new_path);
  2954. } catch(e) {
  2955. console.log("FS.trackingDelegate['onMovePath']('"+old_path+"', '"+new_path+"') threw an exception: " + e.message);
  2956. }
  2957. },rmdir:function (path) {
  2958. var lookup = FS.lookupPath(path, { parent: true });
  2959. var parent = lookup.node;
  2960. var name = PATH.basename(path);
  2961. var node = FS.lookupNode(parent, name);
  2962. var err = FS.mayDelete(parent, name, true);
  2963. if (err) {
  2964. throw new FS.ErrnoError(err);
  2965. }
  2966. if (!parent.node_ops.rmdir) {
  2967. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2968. }
  2969. if (FS.isMountpoint(node)) {
  2970. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2971. }
  2972. try {
  2973. if (FS.trackingDelegate['willDeletePath']) {
  2974. FS.trackingDelegate['willDeletePath'](path);
  2975. }
  2976. } catch(e) {
  2977. console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: " + e.message);
  2978. }
  2979. parent.node_ops.rmdir(parent, name);
  2980. FS.destroyNode(node);
  2981. try {
  2982. if (FS.trackingDelegate['onDeletePath']) FS.trackingDelegate['onDeletePath'](path);
  2983. } catch(e) {
  2984. console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: " + e.message);
  2985. }
  2986. },readdir:function (path) {
  2987. var lookup = FS.lookupPath(path, { follow: true });
  2988. var node = lookup.node;
  2989. if (!node.node_ops.readdir) {
  2990. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  2991. }
  2992. return node.node_ops.readdir(node);
  2993. },unlink:function (path) {
  2994. var lookup = FS.lookupPath(path, { parent: true });
  2995. var parent = lookup.node;
  2996. var name = PATH.basename(path);
  2997. var node = FS.lookupNode(parent, name);
  2998. var err = FS.mayDelete(parent, name, false);
  2999. if (err) {
  3000. // POSIX says unlink should set EPERM, not EISDIR
  3001. if (err === ERRNO_CODES.EISDIR) err = ERRNO_CODES.EPERM;
  3002. throw new FS.ErrnoError(err);
  3003. }
  3004. if (!parent.node_ops.unlink) {
  3005. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3006. }
  3007. if (FS.isMountpoint(node)) {
  3008. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3009. }
  3010. try {
  3011. if (FS.trackingDelegate['willDeletePath']) {
  3012. FS.trackingDelegate['willDeletePath'](path);
  3013. }
  3014. } catch(e) {
  3015. console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: " + e.message);
  3016. }
  3017. parent.node_ops.unlink(parent, name);
  3018. FS.destroyNode(node);
  3019. try {
  3020. if (FS.trackingDelegate['onDeletePath']) FS.trackingDelegate['onDeletePath'](path);
  3021. } catch(e) {
  3022. console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: " + e.message);
  3023. }
  3024. },readlink:function (path) {
  3025. var lookup = FS.lookupPath(path);
  3026. var link = lookup.node;
  3027. if (!link) {
  3028. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3029. }
  3030. if (!link.node_ops.readlink) {
  3031. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3032. }
  3033. return link.node_ops.readlink(link);
  3034. },stat:function (path, dontFollow) {
  3035. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3036. var node = lookup.node;
  3037. if (!node) {
  3038. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3039. }
  3040. if (!node.node_ops.getattr) {
  3041. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3042. }
  3043. return node.node_ops.getattr(node);
  3044. },lstat:function (path) {
  3045. return FS.stat(path, true);
  3046. },chmod:function (path, mode, dontFollow) {
  3047. var node;
  3048. if (typeof path === 'string') {
  3049. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3050. node = lookup.node;
  3051. } else {
  3052. node = path;
  3053. }
  3054. if (!node.node_ops.setattr) {
  3055. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3056. }
  3057. node.node_ops.setattr(node, {
  3058. mode: (mode & 4095) | (node.mode & ~4095),
  3059. timestamp: Date.now()
  3060. });
  3061. },lchmod:function (path, mode) {
  3062. FS.chmod(path, mode, true);
  3063. },fchmod:function (fd, mode) {
  3064. var stream = FS.getStream(fd);
  3065. if (!stream) {
  3066. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3067. }
  3068. FS.chmod(stream.node, mode);
  3069. },chown:function (path, uid, gid, dontFollow) {
  3070. var node;
  3071. if (typeof path === 'string') {
  3072. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3073. node = lookup.node;
  3074. } else {
  3075. node = path;
  3076. }
  3077. if (!node.node_ops.setattr) {
  3078. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3079. }
  3080. node.node_ops.setattr(node, {
  3081. timestamp: Date.now()
  3082. // we ignore the uid / gid for now
  3083. });
  3084. },lchown:function (path, uid, gid) {
  3085. FS.chown(path, uid, gid, true);
  3086. },fchown:function (fd, uid, gid) {
  3087. var stream = FS.getStream(fd);
  3088. if (!stream) {
  3089. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3090. }
  3091. FS.chown(stream.node, uid, gid);
  3092. },truncate:function (path, len) {
  3093. if (len < 0) {
  3094. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3095. }
  3096. var node;
  3097. if (typeof path === 'string') {
  3098. var lookup = FS.lookupPath(path, { follow: true });
  3099. node = lookup.node;
  3100. } else {
  3101. node = path;
  3102. }
  3103. if (!node.node_ops.setattr) {
  3104. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3105. }
  3106. if (FS.isDir(node.mode)) {
  3107. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3108. }
  3109. if (!FS.isFile(node.mode)) {
  3110. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3111. }
  3112. var err = FS.nodePermissions(node, 'w');
  3113. if (err) {
  3114. throw new FS.ErrnoError(err);
  3115. }
  3116. node.node_ops.setattr(node, {
  3117. size: len,
  3118. timestamp: Date.now()
  3119. });
  3120. },ftruncate:function (fd, len) {
  3121. var stream = FS.getStream(fd);
  3122. if (!stream) {
  3123. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3124. }
  3125. if ((stream.flags & 2097155) === 0) {
  3126. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3127. }
  3128. FS.truncate(stream.node, len);
  3129. },utime:function (path, atime, mtime) {
  3130. var lookup = FS.lookupPath(path, { follow: true });
  3131. var node = lookup.node;
  3132. node.node_ops.setattr(node, {
  3133. timestamp: Math.max(atime, mtime)
  3134. });
  3135. },open:function (path, flags, mode, fd_start, fd_end) {
  3136. if (path === "") {
  3137. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3138. }
  3139. flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
  3140. mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode;
  3141. if ((flags & 64)) {
  3142. mode = (mode & 4095) | 32768;
  3143. } else {
  3144. mode = 0;
  3145. }
  3146. var node;
  3147. if (typeof path === 'object') {
  3148. node = path;
  3149. } else {
  3150. path = PATH.normalize(path);
  3151. try {
  3152. var lookup = FS.lookupPath(path, {
  3153. follow: !(flags & 131072)
  3154. });
  3155. node = lookup.node;
  3156. } catch (e) {
  3157. // ignore
  3158. }
  3159. }
  3160. // perhaps we need to create the node
  3161. var created = false;
  3162. if ((flags & 64)) {
  3163. if (node) {
  3164. // if O_CREAT and O_EXCL are set, error out if the node already exists
  3165. if ((flags & 128)) {
  3166. throw new FS.ErrnoError(ERRNO_CODES.EEXIST);
  3167. }
  3168. } else {
  3169. // node doesn't exist, try to create it
  3170. node = FS.mknod(path, mode, 0);
  3171. created = true;
  3172. }
  3173. }
  3174. if (!node) {
  3175. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3176. }
  3177. // can't truncate a device
  3178. if (FS.isChrdev(node.mode)) {
  3179. flags &= ~512;
  3180. }
  3181. // check permissions, if this is not a file we just created now (it is ok to
  3182. // create and write to a file with read-only permissions; it is read-only
  3183. // for later use)
  3184. if (!created) {
  3185. var err = FS.mayOpen(node, flags);
  3186. if (err) {
  3187. throw new FS.ErrnoError(err);
  3188. }
  3189. }
  3190. // do truncation if necessary
  3191. if ((flags & 512)) {
  3192. FS.truncate(node, 0);
  3193. }
  3194. // we've already handled these, don't pass down to the underlying vfs
  3195. flags &= ~(128 | 512);
  3196. // register the stream with the filesystem
  3197. var stream = FS.createStream({
  3198. node: node,
  3199. path: FS.getPath(node), // we want the absolute path to the node
  3200. flags: flags,
  3201. seekable: true,
  3202. position: 0,
  3203. stream_ops: node.stream_ops,
  3204. // used by the file family libc calls (fopen, fwrite, ferror, etc.)
  3205. ungotten: [],
  3206. error: false
  3207. }, fd_start, fd_end);
  3208. // call the new stream's open function
  3209. if (stream.stream_ops.open) {
  3210. stream.stream_ops.open(stream);
  3211. }
  3212. if (Module['logReadFiles'] && !(flags & 1)) {
  3213. if (!FS.readFiles) FS.readFiles = {};
  3214. if (!(path in FS.readFiles)) {
  3215. FS.readFiles[path] = 1;
  3216. Module['printErr']('read file: ' + path);
  3217. }
  3218. }
  3219. try {
  3220. if (FS.trackingDelegate['onOpenFile']) {
  3221. var trackingFlags = 0;
  3222. if ((flags & 2097155) !== 1) {
  3223. trackingFlags |= FS.tracking.openFlags.READ;
  3224. }
  3225. if ((flags & 2097155) !== 0) {
  3226. trackingFlags |= FS.tracking.openFlags.WRITE;
  3227. }
  3228. FS.trackingDelegate['onOpenFile'](path, trackingFlags);
  3229. }
  3230. } catch(e) {
  3231. console.log("FS.trackingDelegate['onOpenFile']('"+path+"', flags) threw an exception: " + e.message);
  3232. }
  3233. return stream;
  3234. },close:function (stream) {
  3235. try {
  3236. if (stream.stream_ops.close) {
  3237. stream.stream_ops.close(stream);
  3238. }
  3239. } catch (e) {
  3240. throw e;
  3241. } finally {
  3242. FS.closeStream(stream.fd);
  3243. }
  3244. },llseek:function (stream, offset, whence) {
  3245. if (!stream.seekable || !stream.stream_ops.llseek) {
  3246. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3247. }
  3248. stream.position = stream.stream_ops.llseek(stream, offset, whence);
  3249. stream.ungotten = [];
  3250. return stream.position;
  3251. },read:function (stream, buffer, offset, length, position) {
  3252. if (length < 0 || position < 0) {
  3253. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3254. }
  3255. if ((stream.flags & 2097155) === 1) {
  3256. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3257. }
  3258. if (FS.isDir(stream.node.mode)) {
  3259. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3260. }
  3261. if (!stream.stream_ops.read) {
  3262. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3263. }
  3264. var seeking = true;
  3265. if (typeof position === 'undefined') {
  3266. position = stream.position;
  3267. seeking = false;
  3268. } else if (!stream.seekable) {
  3269. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3270. }
  3271. var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
  3272. if (!seeking) stream.position += bytesRead;
  3273. return bytesRead;
  3274. },write:function (stream, buffer, offset, length, position, canOwn) {
  3275. if (length < 0 || position < 0) {
  3276. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3277. }
  3278. if ((stream.flags & 2097155) === 0) {
  3279. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3280. }
  3281. if (FS.isDir(stream.node.mode)) {
  3282. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3283. }
  3284. if (!stream.stream_ops.write) {
  3285. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3286. }
  3287. if (stream.flags & 1024) {
  3288. // seek to the end before writing in append mode
  3289. FS.llseek(stream, 0, 2);
  3290. }
  3291. var seeking = true;
  3292. if (typeof position === 'undefined') {
  3293. position = stream.position;
  3294. seeking = false;
  3295. } else if (!stream.seekable) {
  3296. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3297. }
  3298. var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
  3299. if (!seeking) stream.position += bytesWritten;
  3300. try {
  3301. if (stream.path && FS.trackingDelegate['onWriteToFile']) FS.trackingDelegate['onWriteToFile'](stream.path);
  3302. } catch(e) {
  3303. console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: " + e.message);
  3304. }
  3305. return bytesWritten;
  3306. },allocate:function (stream, offset, length) {
  3307. if (offset < 0 || length <= 0) {
  3308. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3309. }
  3310. if ((stream.flags & 2097155) === 0) {
  3311. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3312. }
  3313. if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
  3314. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3315. }
  3316. if (!stream.stream_ops.allocate) {
  3317. throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
  3318. }
  3319. stream.stream_ops.allocate(stream, offset, length);
  3320. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  3321. // TODO if PROT is PROT_WRITE, make sure we have write access
  3322. if ((stream.flags & 2097155) === 1) {
  3323. throw new FS.ErrnoError(ERRNO_CODES.EACCES);
  3324. }
  3325. if (!stream.stream_ops.mmap) {
  3326. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3327. }
  3328. return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags);
  3329. },ioctl:function (stream, cmd, arg) {
  3330. if (!stream.stream_ops.ioctl) {
  3331. throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
  3332. }
  3333. return stream.stream_ops.ioctl(stream, cmd, arg);
  3334. },readFile:function (path, opts) {
  3335. opts = opts || {};
  3336. opts.flags = opts.flags || 'r';
  3337. opts.encoding = opts.encoding || 'binary';
  3338. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3339. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3340. }
  3341. var ret;
  3342. var stream = FS.open(path, opts.flags);
  3343. var stat = FS.stat(path);
  3344. var length = stat.size;
  3345. var buf = new Uint8Array(length);
  3346. FS.read(stream, buf, 0, length, 0);
  3347. if (opts.encoding === 'utf8') {
  3348. ret = '';
  3349. var utf8 = new Runtime.UTF8Processor();
  3350. for (var i = 0; i < length; i++) {
  3351. ret += utf8.processCChar(buf[i]);
  3352. }
  3353. } else if (opts.encoding === 'binary') {
  3354. ret = buf;
  3355. }
  3356. FS.close(stream);
  3357. return ret;
  3358. },writeFile:function (path, data, opts) {
  3359. opts = opts || {};
  3360. opts.flags = opts.flags || 'w';
  3361. opts.encoding = opts.encoding || 'utf8';
  3362. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3363. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3364. }
  3365. var stream = FS.open(path, opts.flags, opts.mode);
  3366. if (opts.encoding === 'utf8') {
  3367. var utf8 = new Runtime.UTF8Processor();
  3368. var buf = new Uint8Array(utf8.processJSString(data));
  3369. FS.write(stream, buf, 0, buf.length, 0, opts.canOwn);
  3370. } else if (opts.encoding === 'binary') {
  3371. FS.write(stream, data, 0, data.length, 0, opts.canOwn);
  3372. }
  3373. FS.close(stream);
  3374. },cwd:function () {
  3375. return FS.currentPath;
  3376. },chdir:function (path) {
  3377. var lookup = FS.lookupPath(path, { follow: true });
  3378. if (!FS.isDir(lookup.node.mode)) {
  3379. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3380. }
  3381. var err = FS.nodePermissions(lookup.node, 'x');
  3382. if (err) {
  3383. throw new FS.ErrnoError(err);
  3384. }
  3385. FS.currentPath = lookup.path;
  3386. },createDefaultDirectories:function () {
  3387. FS.mkdir('/tmp');
  3388. FS.mkdir('/home');
  3389. FS.mkdir('/home/web_user');
  3390. },createDefaultDevices:function () {
  3391. // create /dev
  3392. FS.mkdir('/dev');
  3393. // setup /dev/null
  3394. FS.registerDevice(FS.makedev(1, 3), {
  3395. read: function() { return 0; },
  3396. write: function() { return 0; }
  3397. });
  3398. FS.mkdev('/dev/null', FS.makedev(1, 3));
  3399. // setup /dev/tty and /dev/tty1
  3400. // stderr needs to print output using Module['printErr']
  3401. // so we register a second tty just for it.
  3402. TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
  3403. TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
  3404. FS.mkdev('/dev/tty', FS.makedev(5, 0));
  3405. FS.mkdev('/dev/tty1', FS.makedev(6, 0));
  3406. // setup /dev/[u]random
  3407. var random_device;
  3408. if (typeof crypto !== 'undefined') {
  3409. // for modern web browsers
  3410. var randomBuffer = new Uint8Array(1);
  3411. random_device = function() { crypto.getRandomValues(randomBuffer); return randomBuffer[0]; };
  3412. } else if (ENVIRONMENT_IS_NODE) {
  3413. // for nodejs
  3414. random_device = function() { return require('crypto').randomBytes(1)[0]; };
  3415. } else {
  3416. // default for ES5 platforms
  3417. random_device = function() { return (Math.random()*256)|0; };
  3418. }
  3419. FS.createDevice('/dev', 'random', random_device);
  3420. FS.createDevice('/dev', 'urandom', random_device);
  3421. // we're not going to emulate the actual shm device,
  3422. // just create the tmp dirs that reside in it commonly
  3423. FS.mkdir('/dev/shm');
  3424. FS.mkdir('/dev/shm/tmp');
  3425. },createStandardStreams:function () {
  3426. // TODO deprecate the old functionality of a single
  3427. // input / output callback and that utilizes FS.createDevice
  3428. // and instead require a unique set of stream ops
  3429. // by default, we symlink the standard streams to the
  3430. // default tty devices. however, if the standard streams
  3431. // have been overwritten we create a unique device for
  3432. // them instead.
  3433. if (Module['stdin']) {
  3434. FS.createDevice('/dev', 'stdin', Module['stdin']);
  3435. } else {
  3436. FS.symlink('/dev/tty', '/dev/stdin');
  3437. }
  3438. if (Module['stdout']) {
  3439. FS.createDevice('/dev', 'stdout', null, Module['stdout']);
  3440. } else {
  3441. FS.symlink('/dev/tty', '/dev/stdout');
  3442. }
  3443. if (Module['stderr']) {
  3444. FS.createDevice('/dev', 'stderr', null, Module['stderr']);
  3445. } else {
  3446. FS.symlink('/dev/tty1', '/dev/stderr');
  3447. }
  3448. // open default streams for the stdin, stdout and stderr devices
  3449. var stdin = FS.open('/dev/stdin', 'r');
  3450. HEAP32[((_stdin)>>2)]=FS.getPtrForStream(stdin);
  3451. assert(stdin.fd === 0, 'invalid handle for stdin (' + stdin.fd + ')');
  3452. var stdout = FS.open('/dev/stdout', 'w');
  3453. HEAP32[((_stdout)>>2)]=FS.getPtrForStream(stdout);
  3454. assert(stdout.fd === 1, 'invalid handle for stdout (' + stdout.fd + ')');
  3455. var stderr = FS.open('/dev/stderr', 'w');
  3456. HEAP32[((_stderr)>>2)]=FS.getPtrForStream(stderr);
  3457. assert(stderr.fd === 2, 'invalid handle for stderr (' + stderr.fd + ')');
  3458. },ensureErrnoError:function () {
  3459. if (FS.ErrnoError) return;
  3460. FS.ErrnoError = function ErrnoError(errno, node) {
  3461. this.node = node;
  3462. this.setErrno = function(errno) {
  3463. this.errno = errno;
  3464. for (var key in ERRNO_CODES) {
  3465. if (ERRNO_CODES[key] === errno) {
  3466. this.code = key;
  3467. break;
  3468. }
  3469. }
  3470. };
  3471. this.setErrno(errno);
  3472. this.message = ERRNO_MESSAGES[errno];
  3473. };
  3474. FS.ErrnoError.prototype = new Error();
  3475. FS.ErrnoError.prototype.constructor = FS.ErrnoError;
  3476. // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info)
  3477. [ERRNO_CODES.ENOENT].forEach(function(code) {
  3478. FS.genericErrors[code] = new FS.ErrnoError(code);
  3479. FS.genericErrors[code].stack = '<generic error, no stack>';
  3480. });
  3481. },staticInit:function () {
  3482. FS.ensureErrnoError();
  3483. FS.nameTable = new Array(4096);
  3484. FS.mount(MEMFS, {}, '/');
  3485. FS.createDefaultDirectories();
  3486. FS.createDefaultDevices();
  3487. },init:function (input, output, error) {
  3488. assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)');
  3489. FS.init.initialized = true;
  3490. FS.ensureErrnoError();
  3491. // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
  3492. Module['stdin'] = input || Module['stdin'];
  3493. Module['stdout'] = output || Module['stdout'];
  3494. Module['stderr'] = error || Module['stderr'];
  3495. FS.createStandardStreams();
  3496. },quit:function () {
  3497. FS.init.initialized = false;
  3498. for (var i = 0; i < FS.streams.length; i++) {
  3499. var stream = FS.streams[i];
  3500. if (!stream) {
  3501. continue;
  3502. }
  3503. FS.close(stream);
  3504. }
  3505. },getMode:function (canRead, canWrite) {
  3506. var mode = 0;
  3507. if (canRead) mode |= 292 | 73;
  3508. if (canWrite) mode |= 146;
  3509. return mode;
  3510. },joinPath:function (parts, forceRelative) {
  3511. var path = PATH.join.apply(null, parts);
  3512. if (forceRelative && path[0] == '/') path = path.substr(1);
  3513. return path;
  3514. },absolutePath:function (relative, base) {
  3515. return PATH.resolve(base, relative);
  3516. },standardizePath:function (path) {
  3517. return PATH.normalize(path);
  3518. },findObject:function (path, dontResolveLastLink) {
  3519. var ret = FS.analyzePath(path, dontResolveLastLink);
  3520. if (ret.exists) {
  3521. return ret.object;
  3522. } else {
  3523. ___setErrNo(ret.error);
  3524. return null;
  3525. }
  3526. },analyzePath:function (path, dontResolveLastLink) {
  3527. // operate from within the context of the symlink's target
  3528. try {
  3529. var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  3530. path = lookup.path;
  3531. } catch (e) {
  3532. }
  3533. var ret = {
  3534. isRoot: false, exists: false, error: 0, name: null, path: null, object: null,
  3535. parentExists: false, parentPath: null, parentObject: null
  3536. };
  3537. try {
  3538. var lookup = FS.lookupPath(path, { parent: true });
  3539. ret.parentExists = true;
  3540. ret.parentPath = lookup.path;
  3541. ret.parentObject = lookup.node;
  3542. ret.name = PATH.basename(path);
  3543. lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  3544. ret.exists = true;
  3545. ret.path = lookup.path;
  3546. ret.object = lookup.node;
  3547. ret.name = lookup.node.name;
  3548. ret.isRoot = lookup.path === '/';
  3549. } catch (e) {
  3550. ret.error = e.errno;
  3551. };
  3552. return ret;
  3553. },createFolder:function (parent, name, canRead, canWrite) {
  3554. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3555. var mode = FS.getMode(canRead, canWrite);
  3556. return FS.mkdir(path, mode);
  3557. },createPath:function (parent, path, canRead, canWrite) {
  3558. parent = typeof parent === 'string' ? parent : FS.getPath(parent);
  3559. var parts = path.split('/').reverse();
  3560. while (parts.length) {
  3561. var part = parts.pop();
  3562. if (!part) continue;
  3563. var current = PATH.join2(parent, part);
  3564. try {
  3565. FS.mkdir(current);
  3566. } catch (e) {
  3567. // ignore EEXIST
  3568. }
  3569. parent = current;
  3570. }
  3571. return current;
  3572. },createFile:function (parent, name, properties, canRead, canWrite) {
  3573. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3574. var mode = FS.getMode(canRead, canWrite);
  3575. return FS.create(path, mode);
  3576. },createDataFile:function (parent, name, data, canRead, canWrite, canOwn) {
  3577. var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
  3578. var mode = FS.getMode(canRead, canWrite);
  3579. var node = FS.create(path, mode);
  3580. if (data) {
  3581. if (typeof data === 'string') {
  3582. var arr = new Array(data.length);
  3583. for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
  3584. data = arr;
  3585. }
  3586. // make sure we can write to the file
  3587. FS.chmod(node, mode | 146);
  3588. var stream = FS.open(node, 'w');
  3589. FS.write(stream, data, 0, data.length, 0, canOwn);
  3590. FS.close(stream);
  3591. FS.chmod(node, mode);
  3592. }
  3593. return node;
  3594. },createDevice:function (parent, name, input, output) {
  3595. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3596. var mode = FS.getMode(!!input, !!output);
  3597. if (!FS.createDevice.major) FS.createDevice.major = 64;
  3598. var dev = FS.makedev(FS.createDevice.major++, 0);
  3599. // Create a fake device that a set of stream ops to emulate
  3600. // the old behavior.
  3601. FS.registerDevice(dev, {
  3602. open: function(stream) {
  3603. stream.seekable = false;
  3604. },
  3605. close: function(stream) {
  3606. // flush any pending line data
  3607. if (output && output.buffer && output.buffer.length) {
  3608. output(10);
  3609. }
  3610. },
  3611. read: function(stream, buffer, offset, length, pos /* ignored */) {
  3612. var bytesRead = 0;
  3613. for (var i = 0; i < length; i++) {
  3614. var result;
  3615. try {
  3616. result = input();
  3617. } catch (e) {
  3618. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3619. }
  3620. if (result === undefined && bytesRead === 0) {
  3621. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  3622. }
  3623. if (result === null || result === undefined) break;
  3624. bytesRead++;
  3625. buffer[offset+i] = result;
  3626. }
  3627. if (bytesRead) {
  3628. stream.node.timestamp = Date.now();
  3629. }
  3630. return bytesRead;
  3631. },
  3632. write: function(stream, buffer, offset, length, pos) {
  3633. for (var i = 0; i < length; i++) {
  3634. try {
  3635. output(buffer[offset+i]);
  3636. } catch (e) {
  3637. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3638. }
  3639. }
  3640. if (length) {
  3641. stream.node.timestamp = Date.now();
  3642. }
  3643. return i;
  3644. }
  3645. });
  3646. return FS.mkdev(path, mode, dev);
  3647. },createLink:function (parent, name, target, canRead, canWrite) {
  3648. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3649. return FS.symlink(target, path);
  3650. },forceLoadFile:function (obj) {
  3651. if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
  3652. var success = true;
  3653. if (typeof XMLHttpRequest !== 'undefined') {
  3654. throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
  3655. } else if (Module['read']) {
  3656. // Command-line.
  3657. try {
  3658. // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as
  3659. // read() will try to parse UTF8.
  3660. obj.contents = intArrayFromString(Module['read'](obj.url), true);
  3661. obj.usedBytes = obj.contents.length;
  3662. } catch (e) {
  3663. success = false;
  3664. }
  3665. } else {
  3666. throw new Error('Cannot load without read() or XMLHttpRequest.');
  3667. }
  3668. if (!success) ___setErrNo(ERRNO_CODES.EIO);
  3669. return success;
  3670. },createLazyFile:function (parent, name, url, canRead, canWrite) {
  3671. // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse.
  3672. function LazyUint8Array() {
  3673. this.lengthKnown = false;
  3674. this.chunks = []; // Loaded chunks. Index is the chunk number
  3675. }
  3676. LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
  3677. if (idx > this.length-1 || idx < 0) {
  3678. return undefined;
  3679. }
  3680. var chunkOffset = idx % this.chunkSize;
  3681. var chunkNum = (idx / this.chunkSize)|0;
  3682. return this.getter(chunkNum)[chunkOffset];
  3683. }
  3684. LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
  3685. this.getter = getter;
  3686. }
  3687. LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
  3688. // Find length
  3689. var xhr = new XMLHttpRequest();
  3690. xhr.open('HEAD', url, false);
  3691. xhr.send(null);
  3692. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  3693. var datalength = Number(xhr.getResponseHeader("Content-length"));
  3694. var header;
  3695. var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
  3696. var chunkSize = 1024*1024; // Chunk size in bytes
  3697. if (!hasByteServing) chunkSize = datalength;
  3698. // Function to get a range from the remote URL.
  3699. var doXHR = (function(from, to) {
  3700. if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
  3701. if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!");
  3702. // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
  3703. var xhr = new XMLHttpRequest();
  3704. xhr.open('GET', url, false);
  3705. if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
  3706. // Some hints to the browser that we want binary data.
  3707. if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer';
  3708. if (xhr.overrideMimeType) {
  3709. xhr.overrideMimeType('text/plain; charset=x-user-defined');
  3710. }
  3711. xhr.send(null);
  3712. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  3713. if (xhr.response !== undefined) {
  3714. return new Uint8Array(xhr.response || []);
  3715. } else {
  3716. return intArrayFromString(xhr.responseText || '', true);
  3717. }
  3718. });
  3719. var lazyArray = this;
  3720. lazyArray.setDataGetter(function(chunkNum) {
  3721. var start = chunkNum * chunkSize;
  3722. var end = (chunkNum+1) * chunkSize - 1; // including this byte
  3723. end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block
  3724. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") {
  3725. lazyArray.chunks[chunkNum] = doXHR(start, end);
  3726. }
  3727. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!");
  3728. return lazyArray.chunks[chunkNum];
  3729. });
  3730. this._length = datalength;
  3731. this._chunkSize = chunkSize;
  3732. this.lengthKnown = true;
  3733. }
  3734. if (typeof XMLHttpRequest !== 'undefined') {
  3735. if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc';
  3736. var lazyArray = new LazyUint8Array();
  3737. Object.defineProperty(lazyArray, "length", {
  3738. get: function() {
  3739. if(!this.lengthKnown) {
  3740. this.cacheLength();
  3741. }
  3742. return this._length;
  3743. }
  3744. });
  3745. Object.defineProperty(lazyArray, "chunkSize", {
  3746. get: function() {
  3747. if(!this.lengthKnown) {
  3748. this.cacheLength();
  3749. }
  3750. return this._chunkSize;
  3751. }
  3752. });
  3753. var properties = { isDevice: false, contents: lazyArray };
  3754. } else {
  3755. var properties = { isDevice: false, url: url };
  3756. }
  3757. var node = FS.createFile(parent, name, properties, canRead, canWrite);
  3758. // This is a total hack, but I want to get this lazy file code out of the
  3759. // core of MEMFS. If we want to keep this lazy file concept I feel it should
  3760. // be its own thin LAZYFS proxying calls to MEMFS.
  3761. if (properties.contents) {
  3762. node.contents = properties.contents;
  3763. } else if (properties.url) {
  3764. node.contents = null;
  3765. node.url = properties.url;
  3766. }
  3767. // Add a function that defers querying the file size until it is asked the first time.
  3768. Object.defineProperty(node, "usedBytes", {
  3769. get: function() { return this.contents.length; }
  3770. });
  3771. // override each stream op with one that tries to force load the lazy file first
  3772. var stream_ops = {};
  3773. var keys = Object.keys(node.stream_ops);
  3774. keys.forEach(function(key) {
  3775. var fn = node.stream_ops[key];
  3776. stream_ops[key] = function forceLoadLazyFile() {
  3777. if (!FS.forceLoadFile(node)) {
  3778. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3779. }
  3780. return fn.apply(null, arguments);
  3781. };
  3782. });
  3783. // use a custom read function
  3784. stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
  3785. if (!FS.forceLoadFile(node)) {
  3786. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3787. }
  3788. var contents = stream.node.contents;
  3789. if (position >= contents.length)
  3790. return 0;
  3791. var size = Math.min(contents.length - position, length);
  3792. assert(size >= 0);
  3793. if (contents.slice) { // normal array
  3794. for (var i = 0; i < size; i++) {
  3795. buffer[offset + i] = contents[position + i];
  3796. }
  3797. } else {
  3798. for (var i = 0; i < size; i++) { // LazyUint8Array from sync binary XHR
  3799. buffer[offset + i] = contents.get(position + i);
  3800. }
  3801. }
  3802. return size;
  3803. };
  3804. node.stream_ops = stream_ops;
  3805. return node;
  3806. },createPreloadedFile:function (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn) {
  3807. Browser.init();
  3808. // TODO we should allow people to just pass in a complete filename instead
  3809. // of parent and name being that we just join them anyways
  3810. var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent;
  3811. function processData(byteArray) {
  3812. function finish(byteArray) {
  3813. if (!dontCreateFile) {
  3814. FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
  3815. }
  3816. if (onload) onload();
  3817. removeRunDependency('cp ' + fullname);
  3818. }
  3819. var handled = false;
  3820. Module['preloadPlugins'].forEach(function(plugin) {
  3821. if (handled) return;
  3822. if (plugin['canHandle'](fullname)) {
  3823. plugin['handle'](byteArray, fullname, finish, function() {
  3824. if (onerror) onerror();
  3825. removeRunDependency('cp ' + fullname);
  3826. });
  3827. handled = true;
  3828. }
  3829. });
  3830. if (!handled) finish(byteArray);
  3831. }
  3832. addRunDependency('cp ' + fullname);
  3833. if (typeof url == 'string') {
  3834. Browser.asyncLoad(url, function(byteArray) {
  3835. processData(byteArray);
  3836. }, onerror);
  3837. } else {
  3838. processData(url);
  3839. }
  3840. },indexedDB:function () {
  3841. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  3842. },DB_NAME:function () {
  3843. return 'EM_FS_' + window.location.pathname;
  3844. },DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function (paths, onload, onerror) {
  3845. onload = onload || function(){};
  3846. onerror = onerror || function(){};
  3847. var indexedDB = FS.indexedDB();
  3848. try {
  3849. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  3850. } catch (e) {
  3851. return onerror(e);
  3852. }
  3853. openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
  3854. console.log('creating db');
  3855. var db = openRequest.result;
  3856. db.createObjectStore(FS.DB_STORE_NAME);
  3857. };
  3858. openRequest.onsuccess = function openRequest_onsuccess() {
  3859. var db = openRequest.result;
  3860. var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
  3861. var files = transaction.objectStore(FS.DB_STORE_NAME);
  3862. var ok = 0, fail = 0, total = paths.length;
  3863. function finish() {
  3864. if (fail == 0) onload(); else onerror();
  3865. }
  3866. paths.forEach(function(path) {
  3867. var putRequest = files.put(FS.analyzePath(path).object.contents, path);
  3868. putRequest.onsuccess = function putRequest_onsuccess() { ok++; if (ok + fail == total) finish() };
  3869. putRequest.onerror = function putRequest_onerror() { fail++; if (ok + fail == total) finish() };
  3870. });
  3871. transaction.onerror = onerror;
  3872. };
  3873. openRequest.onerror = onerror;
  3874. },loadFilesFromDB:function (paths, onload, onerror) {
  3875. onload = onload || function(){};
  3876. onerror = onerror || function(){};
  3877. var indexedDB = FS.indexedDB();
  3878. try {
  3879. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  3880. } catch (e) {
  3881. return onerror(e);
  3882. }
  3883. openRequest.onupgradeneeded = onerror; // no database to load from
  3884. openRequest.onsuccess = function openRequest_onsuccess() {
  3885. var db = openRequest.result;
  3886. try {
  3887. var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
  3888. } catch(e) {
  3889. onerror(e);
  3890. return;
  3891. }
  3892. var files = transaction.objectStore(FS.DB_STORE_NAME);
  3893. var ok = 0, fail = 0, total = paths.length;
  3894. function finish() {
  3895. if (fail == 0) onload(); else onerror();
  3896. }
  3897. paths.forEach(function(path) {
  3898. var getRequest = files.get(path);
  3899. getRequest.onsuccess = function getRequest_onsuccess() {
  3900. if (FS.analyzePath(path).exists) {
  3901. FS.unlink(path);
  3902. }
  3903. FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
  3904. ok++;
  3905. if (ok + fail == total) finish();
  3906. };
  3907. getRequest.onerror = function getRequest_onerror() { fail++; if (ok + fail == total) finish() };
  3908. });
  3909. transaction.onerror = onerror;
  3910. };
  3911. openRequest.onerror = onerror;
  3912. }};var PATH={splitPath:function (filename) {
  3913. var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  3914. return splitPathRe.exec(filename).slice(1);
  3915. },normalizeArray:function (parts, allowAboveRoot) {
  3916. // if the path tries to go above the root, `up` ends up > 0
  3917. var up = 0;
  3918. for (var i = parts.length - 1; i >= 0; i--) {
  3919. var last = parts[i];
  3920. if (last === '.') {
  3921. parts.splice(i, 1);
  3922. } else if (last === '..') {
  3923. parts.splice(i, 1);
  3924. up++;
  3925. } else if (up) {
  3926. parts.splice(i, 1);
  3927. up--;
  3928. }
  3929. }
  3930. // if the path is allowed to go above the root, restore leading ..s
  3931. if (allowAboveRoot) {
  3932. for (; up--; up) {
  3933. parts.unshift('..');
  3934. }
  3935. }
  3936. return parts;
  3937. },normalize:function (path) {
  3938. var isAbsolute = path.charAt(0) === '/',
  3939. trailingSlash = path.substr(-1) === '/';
  3940. // Normalize the path
  3941. path = PATH.normalizeArray(path.split('/').filter(function(p) {
  3942. return !!p;
  3943. }), !isAbsolute).join('/');
  3944. if (!path && !isAbsolute) {
  3945. path = '.';
  3946. }
  3947. if (path && trailingSlash) {
  3948. path += '/';
  3949. }
  3950. return (isAbsolute ? '/' : '') + path;
  3951. },dirname:function (path) {
  3952. var result = PATH.splitPath(path),
  3953. root = result[0],
  3954. dir = result[1];
  3955. if (!root && !dir) {
  3956. // No dirname whatsoever
  3957. return '.';
  3958. }
  3959. if (dir) {
  3960. // It has a dirname, strip trailing slash
  3961. dir = dir.substr(0, dir.length - 1);
  3962. }
  3963. return root + dir;
  3964. },basename:function (path) {
  3965. // EMSCRIPTEN return '/'' for '/', not an empty string
  3966. if (path === '/') return '/';
  3967. var lastSlash = path.lastIndexOf('/');
  3968. if (lastSlash === -1) return path;
  3969. return path.substr(lastSlash+1);
  3970. },extname:function (path) {
  3971. return PATH.splitPath(path)[3];
  3972. },join:function () {
  3973. var paths = Array.prototype.slice.call(arguments, 0);
  3974. return PATH.normalize(paths.join('/'));
  3975. },join2:function (l, r) {
  3976. return PATH.normalize(l + '/' + r);
  3977. },resolve:function () {
  3978. var resolvedPath = '',
  3979. resolvedAbsolute = false;
  3980. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  3981. var path = (i >= 0) ? arguments[i] : FS.cwd();
  3982. // Skip empty and invalid entries
  3983. if (typeof path !== 'string') {
  3984. throw new TypeError('Arguments to path.resolve must be strings');
  3985. } else if (!path) {
  3986. return ''; // an invalid portion invalidates the whole thing
  3987. }
  3988. resolvedPath = path + '/' + resolvedPath;
  3989. resolvedAbsolute = path.charAt(0) === '/';
  3990. }
  3991. // At this point the path should be resolved to a full absolute path, but
  3992. // handle relative paths to be safe (might happen when process.cwd() fails)
  3993. resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter(function(p) {
  3994. return !!p;
  3995. }), !resolvedAbsolute).join('/');
  3996. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  3997. },relative:function (from, to) {
  3998. from = PATH.resolve(from).substr(1);
  3999. to = PATH.resolve(to).substr(1);
  4000. function trim(arr) {
  4001. var start = 0;
  4002. for (; start < arr.length; start++) {
  4003. if (arr[start] !== '') break;
  4004. }
  4005. var end = arr.length - 1;
  4006. for (; end >= 0; end--) {
  4007. if (arr[end] !== '') break;
  4008. }
  4009. if (start > end) return [];
  4010. return arr.slice(start, end - start + 1);
  4011. }
  4012. var fromParts = trim(from.split('/'));
  4013. var toParts = trim(to.split('/'));
  4014. var length = Math.min(fromParts.length, toParts.length);
  4015. var samePartsLength = length;
  4016. for (var i = 0; i < length; i++) {
  4017. if (fromParts[i] !== toParts[i]) {
  4018. samePartsLength = i;
  4019. break;
  4020. }
  4021. }
  4022. var outputParts = [];
  4023. for (var i = samePartsLength; i < fromParts.length; i++) {
  4024. outputParts.push('..');
  4025. }
  4026. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  4027. return outputParts.join('/');
  4028. }};
  4029. function _emscripten_set_main_loop_timing(mode, value) {
  4030. Browser.mainLoop.timingMode = mode;
  4031. Browser.mainLoop.timingValue = value;
  4032. if (!Browser.mainLoop.func) {
  4033. return 1; // Return non-zero on failure, can't set timing mode when there is no main loop.
  4034. }
  4035. if (mode == 0 /*EM_TIMING_SETTIMEOUT*/) {
  4036. Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() {
  4037. setTimeout(Browser.mainLoop.runner, value); // doing this each time means that on exception, we stop
  4038. };
  4039. Browser.mainLoop.method = 'timeout';
  4040. } else if (mode == 1 /*EM_TIMING_RAF*/) {
  4041. Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() {
  4042. Browser.requestAnimationFrame(Browser.mainLoop.runner);
  4043. };
  4044. Browser.mainLoop.method = 'rAF';
  4045. }
  4046. return 0;
  4047. }function _emscripten_set_main_loop(func, fps, simulateInfiniteLoop, arg) {
  4048. Module['noExitRuntime'] = true;
  4049. assert(!Browser.mainLoop.func, 'emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.');
  4050. Browser.mainLoop.func = func;
  4051. Browser.mainLoop.arg = arg;
  4052. var thisMainLoopId = Browser.mainLoop.currentlyRunningMainloop;
  4053. Browser.mainLoop.runner = function Browser_mainLoop_runner() {
  4054. if (ABORT) return;
  4055. if (Browser.mainLoop.queue.length > 0) {
  4056. var start = Date.now();
  4057. var blocker = Browser.mainLoop.queue.shift();
  4058. blocker.func(blocker.arg);
  4059. if (Browser.mainLoop.remainingBlockers) {
  4060. var remaining = Browser.mainLoop.remainingBlockers;
  4061. var next = remaining%1 == 0 ? remaining-1 : Math.floor(remaining);
  4062. if (blocker.counted) {
  4063. Browser.mainLoop.remainingBlockers = next;
  4064. } else {
  4065. // not counted, but move the progress along a tiny bit
  4066. next = next + 0.5; // do not steal all the next one's progress
  4067. Browser.mainLoop.remainingBlockers = (8*remaining + next)/9;
  4068. }
  4069. }
  4070. console.log('main loop blocker "' + blocker.name + '" took ' + (Date.now() - start) + ' ms'); //, left: ' + Browser.mainLoop.remainingBlockers);
  4071. Browser.mainLoop.updateStatus();
  4072. setTimeout(Browser.mainLoop.runner, 0);
  4073. return;
  4074. }
  4075. // catch pauses from non-main loop sources
  4076. if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) return;
  4077. // Implement very basic swap interval control
  4078. Browser.mainLoop.currentFrameNumber = Browser.mainLoop.currentFrameNumber + 1 | 0;
  4079. if (Browser.mainLoop.timingMode == 1/*EM_TIMING_RAF*/ && Browser.mainLoop.timingValue > 1 && Browser.mainLoop.currentFrameNumber % Browser.mainLoop.timingValue != 0) {
  4080. // Not the scheduled time to render this frame - skip.
  4081. Browser.mainLoop.scheduler();
  4082. return;
  4083. }
  4084. // Signal GL rendering layer that processing of a new frame is about to start. This helps it optimize
  4085. // VBO double-buffering and reduce GPU stalls.
  4086. if (Browser.mainLoop.method === 'timeout' && Module.ctx) {
  4087. Module.printErr('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
  4088. Browser.mainLoop.method = ''; // just warn once per call to set main loop
  4089. }
  4090. Browser.mainLoop.runIter(function() {
  4091. if (typeof arg !== 'undefined') {
  4092. Runtime.dynCall('vi', func, [arg]);
  4093. } else {
  4094. Runtime.dynCall('v', func);
  4095. }
  4096. });
  4097. // catch pauses from the main loop itself
  4098. if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) return;
  4099. // Queue new audio data. This is important to be right after the main loop invocation, so that we will immediately be able
  4100. // to queue the newest produced audio samples.
  4101. // TODO: Consider adding pre- and post- rAF callbacks so that GL.newRenderingFrameStarted() and SDL.audio.queueNewAudioData()
  4102. // do not need to be hardcoded into this function, but can be more generic.
  4103. if (typeof SDL === 'object' && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData();
  4104. Browser.mainLoop.scheduler();
  4105. }
  4106. if (fps && fps > 0) _emscripten_set_main_loop_timing(0/*EM_TIMING_SETTIMEOUT*/, 1000.0 / fps);
  4107. else _emscripten_set_main_loop_timing(1/*EM_TIMING_RAF*/, 1); // Do rAF by rendering each frame (no decimating)
  4108. Browser.mainLoop.scheduler();
  4109. if (simulateInfiniteLoop) {
  4110. throw 'SimulateInfiniteLoop';
  4111. }
  4112. }var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function () {
  4113. Browser.mainLoop.scheduler = null;
  4114. Browser.mainLoop.currentlyRunningMainloop++; // Incrementing this signals the previous main loop that it's now become old, and it must return.
  4115. },resume:function () {
  4116. Browser.mainLoop.currentlyRunningMainloop++;
  4117. var timingMode = Browser.mainLoop.timingMode;
  4118. var timingValue = Browser.mainLoop.timingValue;
  4119. var func = Browser.mainLoop.func;
  4120. Browser.mainLoop.func = null;
  4121. _emscripten_set_main_loop(func, 0, false, Browser.mainLoop.arg);
  4122. _emscripten_set_main_loop_timing(timingMode, timingValue);
  4123. },updateStatus:function () {
  4124. if (Module['setStatus']) {
  4125. var message = Module['statusMessage'] || 'Please wait...';
  4126. var remaining = Browser.mainLoop.remainingBlockers;
  4127. var expected = Browser.mainLoop.expectedBlockers;
  4128. if (remaining) {
  4129. if (remaining < expected) {
  4130. Module['setStatus'](message + ' (' + (expected - remaining) + '/' + expected + ')');
  4131. } else {
  4132. Module['setStatus'](message);
  4133. }
  4134. } else {
  4135. Module['setStatus']('');
  4136. }
  4137. }
  4138. },runIter:function (func) {
  4139. if (ABORT) return;
  4140. if (Module['preMainLoop']) {
  4141. var preRet = Module['preMainLoop']();
  4142. if (preRet === false) {
  4143. return; // |return false| skips a frame
  4144. }
  4145. }
  4146. try {
  4147. func();
  4148. } catch (e) {
  4149. if (e instanceof ExitStatus) {
  4150. return;
  4151. } else {
  4152. if (e && typeof e === 'object' && e.stack) Module.printErr('exception thrown: ' + [e, e.stack]);
  4153. throw e;
  4154. }
  4155. }
  4156. if (Module['postMainLoop']) Module['postMainLoop']();
  4157. }},isFullScreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],init:function () {
  4158. if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; // needs to exist even in workers
  4159. if (Browser.initted) return;
  4160. Browser.initted = true;
  4161. try {
  4162. new Blob();
  4163. Browser.hasBlobConstructor = true;
  4164. } catch(e) {
  4165. Browser.hasBlobConstructor = false;
  4166. console.log("warning: no blob constructor, cannot create blobs with mimetypes");
  4167. }
  4168. Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : (typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : (!Browser.hasBlobConstructor ? console.log("warning: no BlobBuilder") : null));
  4169. Browser.URLObject = typeof window != "undefined" ? (window.URL ? window.URL : window.webkitURL) : undefined;
  4170. if (!Module.noImageDecoding && typeof Browser.URLObject === 'undefined') {
  4171. console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.");
  4172. Module.noImageDecoding = true;
  4173. }
  4174. // Support for plugins that can process preloaded files. You can add more of these to
  4175. // your app by creating and appending to Module.preloadPlugins.
  4176. //
  4177. // Each plugin is asked if it can handle a file based on the file's name. If it can,
  4178. // it is given the file's raw data. When it is done, it calls a callback with the file's
  4179. // (possibly modified) data. For example, a plugin might decompress a file, or it
  4180. // might create some side data structure for use later (like an Image element, etc.).
  4181. var imagePlugin = {};
  4182. imagePlugin['canHandle'] = function imagePlugin_canHandle(name) {
  4183. return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name);
  4184. };
  4185. imagePlugin['handle'] = function imagePlugin_handle(byteArray, name, onload, onerror) {
  4186. var b = null;
  4187. if (Browser.hasBlobConstructor) {
  4188. try {
  4189. b = new Blob([byteArray], { type: Browser.getMimetype(name) });
  4190. if (b.size !== byteArray.length) { // Safari bug #118630
  4191. // Safari's Blob can only take an ArrayBuffer
  4192. b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
  4193. }
  4194. } catch(e) {
  4195. Runtime.warnOnce('Blob constructor present but fails: ' + e + '; falling back to blob builder');
  4196. }
  4197. }
  4198. if (!b) {
  4199. var bb = new Browser.BlobBuilder();
  4200. bb.append((new Uint8Array(byteArray)).buffer); // we need to pass a buffer, and must copy the array to get the right data range
  4201. b = bb.getBlob();
  4202. }
  4203. var url = Browser.URLObject.createObjectURL(b);
  4204. var img = new Image();
  4205. img.onload = function img_onload() {
  4206. assert(img.complete, 'Image ' + name + ' could not be decoded');
  4207. var canvas = document.createElement('canvas');
  4208. canvas.width = img.width;
  4209. canvas.height = img.height;
  4210. var ctx = canvas.getContext('2d');
  4211. ctx.drawImage(img, 0, 0);
  4212. Module["preloadedImages"][name] = canvas;
  4213. Browser.URLObject.revokeObjectURL(url);
  4214. if (onload) onload(byteArray);
  4215. };
  4216. img.onerror = function img_onerror(event) {
  4217. console.log('Image ' + url + ' could not be decoded');
  4218. if (onerror) onerror();
  4219. };
  4220. img.src = url;
  4221. };
  4222. Module['preloadPlugins'].push(imagePlugin);
  4223. var audioPlugin = {};
  4224. audioPlugin['canHandle'] = function audioPlugin_canHandle(name) {
  4225. return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 };
  4226. };
  4227. audioPlugin['handle'] = function audioPlugin_handle(byteArray, name, onload, onerror) {
  4228. var done = false;
  4229. function finish(audio) {
  4230. if (done) return;
  4231. done = true;
  4232. Module["preloadedAudios"][name] = audio;
  4233. if (onload) onload(byteArray);
  4234. }
  4235. function fail() {
  4236. if (done) return;
  4237. done = true;
  4238. Module["preloadedAudios"][name] = new Audio(); // empty shim
  4239. if (onerror) onerror();
  4240. }
  4241. if (Browser.hasBlobConstructor) {
  4242. try {
  4243. var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
  4244. } catch(e) {
  4245. return fail();
  4246. }
  4247. var url = Browser.URLObject.createObjectURL(b); // XXX we never revoke this!
  4248. var audio = new Audio();
  4249. audio.addEventListener('canplaythrough', function() { finish(audio) }, false); // use addEventListener due to chromium bug 124926
  4250. audio.onerror = function audio_onerror(event) {
  4251. if (done) return;
  4252. console.log('warning: browser could not fully decode audio ' + name + ', trying slower base64 approach');
  4253. function encode64(data) {
  4254. var BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  4255. var PAD = '=';
  4256. var ret = '';
  4257. var leftchar = 0;
  4258. var leftbits = 0;
  4259. for (var i = 0; i < data.length; i++) {
  4260. leftchar = (leftchar << 8) | data[i];
  4261. leftbits += 8;
  4262. while (leftbits >= 6) {
  4263. var curr = (leftchar >> (leftbits-6)) & 0x3f;
  4264. leftbits -= 6;
  4265. ret += BASE[curr];
  4266. }
  4267. }
  4268. if (leftbits == 2) {
  4269. ret += BASE[(leftchar&3) << 4];
  4270. ret += PAD + PAD;
  4271. } else if (leftbits == 4) {
  4272. ret += BASE[(leftchar&0xf) << 2];
  4273. ret += PAD;
  4274. }
  4275. return ret;
  4276. }
  4277. audio.src = 'data:audio/x-' + name.substr(-3) + ';base64,' + encode64(byteArray);
  4278. finish(audio); // we don't wait for confirmation this worked - but it's worth trying
  4279. };
  4280. audio.src = url;
  4281. // workaround for chrome bug 124926 - we do not always get oncanplaythrough or onerror
  4282. Browser.safeSetTimeout(function() {
  4283. finish(audio); // try to use it even though it is not necessarily ready to play
  4284. }, 10000);
  4285. } else {
  4286. return fail();
  4287. }
  4288. };
  4289. Module['preloadPlugins'].push(audioPlugin);
  4290. // Canvas event setup
  4291. var canvas = Module['canvas'];
  4292. function pointerLockChange() {
  4293. Browser.pointerLock = document['pointerLockElement'] === canvas ||
  4294. document['mozPointerLockElement'] === canvas ||
  4295. document['webkitPointerLockElement'] === canvas ||
  4296. document['msPointerLockElement'] === canvas;
  4297. }
  4298. if (canvas) {
  4299. // forced aspect ratio can be enabled by defining 'forcedAspectRatio' on Module
  4300. // Module['forcedAspectRatio'] = 4 / 3;
  4301. canvas.requestPointerLock = canvas['requestPointerLock'] ||
  4302. canvas['mozRequestPointerLock'] ||
  4303. canvas['webkitRequestPointerLock'] ||
  4304. canvas['msRequestPointerLock'] ||
  4305. function(){};
  4306. canvas.exitPointerLock = document['exitPointerLock'] ||
  4307. document['mozExitPointerLock'] ||
  4308. document['webkitExitPointerLock'] ||
  4309. document['msExitPointerLock'] ||
  4310. function(){}; // no-op if function does not exist
  4311. canvas.exitPointerLock = canvas.exitPointerLock.bind(document);
  4312. document.addEventListener('pointerlockchange', pointerLockChange, false);
  4313. document.addEventListener('mozpointerlockchange', pointerLockChange, false);
  4314. document.addEventListener('webkitpointerlockchange', pointerLockChange, false);
  4315. document.addEventListener('mspointerlockchange', pointerLockChange, false);
  4316. if (Module['elementPointerLock']) {
  4317. canvas.addEventListener("click", function(ev) {
  4318. if (!Browser.pointerLock && canvas.requestPointerLock) {
  4319. canvas.requestPointerLock();
  4320. ev.preventDefault();
  4321. }
  4322. }, false);
  4323. }
  4324. }
  4325. },createContext:function (canvas, useWebGL, setInModule, webGLContextAttributes) {
  4326. if (useWebGL && Module.ctx && canvas == Module.canvas) return Module.ctx; // no need to recreate GL context if it's already been created for this canvas.
  4327. var ctx;
  4328. var contextHandle;
  4329. if (useWebGL) {
  4330. // For GLES2/desktop GL compatibility, adjust a few defaults to be different to WebGL defaults, so that they align better with the desktop defaults.
  4331. var contextAttributes = {
  4332. antialias: false,
  4333. alpha: false
  4334. };
  4335. if (webGLContextAttributes) {
  4336. for (var attribute in webGLContextAttributes) {
  4337. contextAttributes[attribute] = webGLContextAttributes[attribute];
  4338. }
  4339. }
  4340. contextHandle = GL.createContext(canvas, contextAttributes);
  4341. if (contextHandle) {
  4342. ctx = GL.getContext(contextHandle).GLctx;
  4343. }
  4344. // Set the background of the WebGL canvas to black
  4345. canvas.style.backgroundColor = "black";
  4346. } else {
  4347. ctx = canvas.getContext('2d');
  4348. }
  4349. if (!ctx) return null;
  4350. if (setInModule) {
  4351. if (!useWebGL) assert(typeof GLctx === 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it');
  4352. Module.ctx = ctx;
  4353. if (useWebGL) GL.makeContextCurrent(contextHandle);
  4354. Module.useWebGL = useWebGL;
  4355. Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
  4356. Browser.init();
  4357. }
  4358. return ctx;
  4359. },destroyContext:function (canvas, useWebGL, setInModule) {},fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:function (lockPointer, resizeCanvas) {
  4360. Browser.lockPointer = lockPointer;
  4361. Browser.resizeCanvas = resizeCanvas;
  4362. if (typeof Browser.lockPointer === 'undefined') Browser.lockPointer = true;
  4363. if (typeof Browser.resizeCanvas === 'undefined') Browser.resizeCanvas = false;
  4364. var canvas = Module['canvas'];
  4365. function fullScreenChange() {
  4366. Browser.isFullScreen = false;
  4367. var canvasContainer = canvas.parentNode;
  4368. if ((document['webkitFullScreenElement'] || document['webkitFullscreenElement'] ||
  4369. document['mozFullScreenElement'] || document['mozFullscreenElement'] ||
  4370. document['fullScreenElement'] || document['fullscreenElement'] ||
  4371. document['msFullScreenElement'] || document['msFullscreenElement'] ||
  4372. document['webkitCurrentFullScreenElement']) === canvasContainer) {
  4373. canvas.cancelFullScreen = document['cancelFullScreen'] ||
  4374. document['mozCancelFullScreen'] ||
  4375. document['webkitCancelFullScreen'] ||
  4376. document['msExitFullscreen'] ||
  4377. document['exitFullscreen'] ||
  4378. function() {};
  4379. canvas.cancelFullScreen = canvas.cancelFullScreen.bind(document);
  4380. if (Browser.lockPointer) canvas.requestPointerLock();
  4381. Browser.isFullScreen = true;
  4382. if (Browser.resizeCanvas) Browser.setFullScreenCanvasSize();
  4383. } else {
  4384. // remove the full screen specific parent of the canvas again to restore the HTML structure from before going full screen
  4385. canvasContainer.parentNode.insertBefore(canvas, canvasContainer);
  4386. canvasContainer.parentNode.removeChild(canvasContainer);
  4387. if (Browser.resizeCanvas) Browser.setWindowedCanvasSize();
  4388. }
  4389. if (Module['onFullScreen']) Module['onFullScreen'](Browser.isFullScreen);
  4390. Browser.updateCanvasDimensions(canvas);
  4391. }
  4392. if (!Browser.fullScreenHandlersInstalled) {
  4393. Browser.fullScreenHandlersInstalled = true;
  4394. document.addEventListener('fullscreenchange', fullScreenChange, false);
  4395. document.addEventListener('mozfullscreenchange', fullScreenChange, false);
  4396. document.addEventListener('webkitfullscreenchange', fullScreenChange, false);
  4397. document.addEventListener('MSFullscreenChange', fullScreenChange, false);
  4398. }
  4399. // create a new parent to ensure the canvas has no siblings. this allows browsers to optimize full screen performance when its parent is the full screen root
  4400. var canvasContainer = document.createElement("div");
  4401. canvas.parentNode.insertBefore(canvasContainer, canvas);
  4402. canvasContainer.appendChild(canvas);
  4403. // use parent of canvas as full screen root to allow aspect ratio correction (Firefox stretches the root to screen size)
  4404. canvasContainer.requestFullScreen = canvasContainer['requestFullScreen'] ||
  4405. canvasContainer['mozRequestFullScreen'] ||
  4406. canvasContainer['msRequestFullscreen'] ||
  4407. (canvasContainer['webkitRequestFullScreen'] ? function() { canvasContainer['webkitRequestFullScreen'](Element['ALLOW_KEYBOARD_INPUT']) } : null);
  4408. canvasContainer.requestFullScreen();
  4409. },nextRAF:0,fakeRequestAnimationFrame:function (func) {
  4410. // try to keep 60fps between calls to here
  4411. var now = Date.now();
  4412. if (Browser.nextRAF === 0) {
  4413. Browser.nextRAF = now + 1000/60;
  4414. } else {
  4415. while (now + 2 >= Browser.nextRAF) { // fudge a little, to avoid timer jitter causing us to do lots of delay:0
  4416. Browser.nextRAF += 1000/60;
  4417. }
  4418. }
  4419. var delay = Math.max(Browser.nextRAF - now, 0);
  4420. setTimeout(func, delay);
  4421. },requestAnimationFrame:function requestAnimationFrame(func) {
  4422. if (typeof window === 'undefined') { // Provide fallback to setTimeout if window is undefined (e.g. in Node.js)
  4423. Browser.fakeRequestAnimationFrame(func);
  4424. } else {
  4425. if (!window.requestAnimationFrame) {
  4426. window.requestAnimationFrame = window['requestAnimationFrame'] ||
  4427. window['mozRequestAnimationFrame'] ||
  4428. window['webkitRequestAnimationFrame'] ||
  4429. window['msRequestAnimationFrame'] ||
  4430. window['oRequestAnimationFrame'] ||
  4431. Browser.fakeRequestAnimationFrame;
  4432. }
  4433. window.requestAnimationFrame(func);
  4434. }
  4435. },safeCallback:function (func) {
  4436. return function() {
  4437. if (!ABORT) return func.apply(null, arguments);
  4438. };
  4439. },safeRequestAnimationFrame:function (func) {
  4440. return Browser.requestAnimationFrame(function() {
  4441. if (!ABORT) func();
  4442. });
  4443. },safeSetTimeout:function (func, timeout) {
  4444. Module['noExitRuntime'] = true;
  4445. return setTimeout(function() {
  4446. if (!ABORT) func();
  4447. }, timeout);
  4448. },safeSetInterval:function (func, timeout) {
  4449. Module['noExitRuntime'] = true;
  4450. return setInterval(function() {
  4451. if (!ABORT) func();
  4452. }, timeout);
  4453. },getMimetype:function (name) {
  4454. return {
  4455. 'jpg': 'image/jpeg',
  4456. 'jpeg': 'image/jpeg',
  4457. 'png': 'image/png',
  4458. 'bmp': 'image/bmp',
  4459. 'ogg': 'audio/ogg',
  4460. 'wav': 'audio/wav',
  4461. 'mp3': 'audio/mpeg'
  4462. }[name.substr(name.lastIndexOf('.')+1)];
  4463. },getUserMedia:function (func) {
  4464. if(!window.getUserMedia) {
  4465. window.getUserMedia = navigator['getUserMedia'] ||
  4466. navigator['mozGetUserMedia'];
  4467. }
  4468. window.getUserMedia(func);
  4469. },getMovementX:function (event) {
  4470. return event['movementX'] ||
  4471. event['mozMovementX'] ||
  4472. event['webkitMovementX'] ||
  4473. 0;
  4474. },getMovementY:function (event) {
  4475. return event['movementY'] ||
  4476. event['mozMovementY'] ||
  4477. event['webkitMovementY'] ||
  4478. 0;
  4479. },getMouseWheelDelta:function (event) {
  4480. var delta = 0;
  4481. switch (event.type) {
  4482. case 'DOMMouseScroll':
  4483. delta = event.detail;
  4484. break;
  4485. case 'mousewheel':
  4486. delta = event.wheelDelta;
  4487. break;
  4488. case 'wheel':
  4489. delta = event['deltaY'];
  4490. break;
  4491. default:
  4492. throw 'unrecognized mouse wheel event: ' + event.type;
  4493. }
  4494. return delta;
  4495. },mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function (event) { // event should be mousemove, mousedown or mouseup
  4496. if (Browser.pointerLock) {
  4497. // When the pointer is locked, calculate the coordinates
  4498. // based on the movement of the mouse.
  4499. // Workaround for Firefox bug 764498
  4500. if (event.type != 'mousemove' &&
  4501. ('mozMovementX' in event)) {
  4502. Browser.mouseMovementX = Browser.mouseMovementY = 0;
  4503. } else {
  4504. Browser.mouseMovementX = Browser.getMovementX(event);
  4505. Browser.mouseMovementY = Browser.getMovementY(event);
  4506. }
  4507. // check if SDL is available
  4508. if (typeof SDL != "undefined") {
  4509. Browser.mouseX = SDL.mouseX + Browser.mouseMovementX;
  4510. Browser.mouseY = SDL.mouseY + Browser.mouseMovementY;
  4511. } else {
  4512. // just add the mouse delta to the current absolut mouse position
  4513. // FIXME: ideally this should be clamped against the canvas size and zero
  4514. Browser.mouseX += Browser.mouseMovementX;
  4515. Browser.mouseY += Browser.mouseMovementY;
  4516. }
  4517. } else {
  4518. // Otherwise, calculate the movement based on the changes
  4519. // in the coordinates.
  4520. var rect = Module["canvas"].getBoundingClientRect();
  4521. var cw = Module["canvas"].width;
  4522. var ch = Module["canvas"].height;
  4523. // Neither .scrollX or .pageXOffset are defined in a spec, but
  4524. // we prefer .scrollX because it is currently in a spec draft.
  4525. // (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
  4526. var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset);
  4527. var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset);
  4528. if (event.type === 'touchstart' || event.type === 'touchend' || event.type === 'touchmove') {
  4529. var touch = event.touch;
  4530. if (touch === undefined) {
  4531. return; // the "touch" property is only defined in SDL
  4532. }
  4533. var adjustedX = touch.pageX - (scrollX + rect.left);
  4534. var adjustedY = touch.pageY - (scrollY + rect.top);
  4535. adjustedX = adjustedX * (cw / rect.width);
  4536. adjustedY = adjustedY * (ch / rect.height);
  4537. var coords = { x: adjustedX, y: adjustedY };
  4538. if (event.type === 'touchstart') {
  4539. Browser.lastTouches[touch.identifier] = coords;
  4540. Browser.touches[touch.identifier] = coords;
  4541. } else if (event.type === 'touchend' || event.type === 'touchmove') {
  4542. Browser.lastTouches[touch.identifier] = Browser.touches[touch.identifier];
  4543. Browser.touches[touch.identifier] = { x: adjustedX, y: adjustedY };
  4544. }
  4545. return;
  4546. }
  4547. var x = event.pageX - (scrollX + rect.left);
  4548. var y = event.pageY - (scrollY + rect.top);
  4549. // the canvas might be CSS-scaled compared to its backbuffer;
  4550. // SDL-using content will want mouse coordinates in terms
  4551. // of backbuffer units.
  4552. x = x * (cw / rect.width);
  4553. y = y * (ch / rect.height);
  4554. Browser.mouseMovementX = x - Browser.mouseX;
  4555. Browser.mouseMovementY = y - Browser.mouseY;
  4556. Browser.mouseX = x;
  4557. Browser.mouseY = y;
  4558. }
  4559. },xhrLoad:function (url, onload, onerror) {
  4560. var xhr = new XMLHttpRequest();
  4561. xhr.open('GET', url, true);
  4562. xhr.responseType = 'arraybuffer';
  4563. xhr.onload = function xhr_onload() {
  4564. if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
  4565. onload(xhr.response);
  4566. } else {
  4567. onerror();
  4568. }
  4569. };
  4570. xhr.onerror = onerror;
  4571. xhr.send(null);
  4572. },asyncLoad:function (url, onload, onerror, noRunDep) {
  4573. Browser.xhrLoad(url, function(arrayBuffer) {
  4574. assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
  4575. onload(new Uint8Array(arrayBuffer));
  4576. if (!noRunDep) removeRunDependency('al ' + url);
  4577. }, function(event) {
  4578. if (onerror) {
  4579. onerror();
  4580. } else {
  4581. throw 'Loading data file "' + url + '" failed.';
  4582. }
  4583. });
  4584. if (!noRunDep) addRunDependency('al ' + url);
  4585. },resizeListeners:[],updateResizeListeners:function () {
  4586. var canvas = Module['canvas'];
  4587. Browser.resizeListeners.forEach(function(listener) {
  4588. listener(canvas.width, canvas.height);
  4589. });
  4590. },setCanvasSize:function (width, height, noUpdates) {
  4591. var canvas = Module['canvas'];
  4592. Browser.updateCanvasDimensions(canvas, width, height);
  4593. if (!noUpdates) Browser.updateResizeListeners();
  4594. },windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function () {
  4595. // check if SDL is available
  4596. if (typeof SDL != "undefined") {
  4597. var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)];
  4598. flags = flags | 0x00800000; // set SDL_FULLSCREEN flag
  4599. HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags
  4600. }
  4601. Browser.updateResizeListeners();
  4602. },setWindowedCanvasSize:function () {
  4603. // check if SDL is available
  4604. if (typeof SDL != "undefined") {
  4605. var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)];
  4606. flags = flags & ~0x00800000; // clear SDL_FULLSCREEN flag
  4607. HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags
  4608. }
  4609. Browser.updateResizeListeners();
  4610. },updateCanvasDimensions:function (canvas, wNative, hNative) {
  4611. if (wNative && hNative) {
  4612. canvas.widthNative = wNative;
  4613. canvas.heightNative = hNative;
  4614. } else {
  4615. wNative = canvas.widthNative;
  4616. hNative = canvas.heightNative;
  4617. }
  4618. var w = wNative;
  4619. var h = hNative;
  4620. if (Module['forcedAspectRatio'] && Module['forcedAspectRatio'] > 0) {
  4621. if (w/h < Module['forcedAspectRatio']) {
  4622. w = Math.round(h * Module['forcedAspectRatio']);
  4623. } else {
  4624. h = Math.round(w / Module['forcedAspectRatio']);
  4625. }
  4626. }
  4627. if (((document['webkitFullScreenElement'] || document['webkitFullscreenElement'] ||
  4628. document['mozFullScreenElement'] || document['mozFullscreenElement'] ||
  4629. document['fullScreenElement'] || document['fullscreenElement'] ||
  4630. document['msFullScreenElement'] || document['msFullscreenElement'] ||
  4631. document['webkitCurrentFullScreenElement']) === canvas.parentNode) && (typeof screen != 'undefined')) {
  4632. var factor = Math.min(screen.width / w, screen.height / h);
  4633. w = Math.round(w * factor);
  4634. h = Math.round(h * factor);
  4635. }
  4636. if (Browser.resizeCanvas) {
  4637. if (canvas.width != w) canvas.width = w;
  4638. if (canvas.height != h) canvas.height = h;
  4639. if (typeof canvas.style != 'undefined') {
  4640. canvas.style.removeProperty( "width");
  4641. canvas.style.removeProperty("height");
  4642. }
  4643. } else {
  4644. if (canvas.width != wNative) canvas.width = wNative;
  4645. if (canvas.height != hNative) canvas.height = hNative;
  4646. if (typeof canvas.style != 'undefined') {
  4647. if (w != wNative || h != hNative) {
  4648. canvas.style.setProperty( "width", w + "px", "important");
  4649. canvas.style.setProperty("height", h + "px", "important");
  4650. } else {
  4651. canvas.style.removeProperty( "width");
  4652. canvas.style.removeProperty("height");
  4653. }
  4654. }
  4655. }
  4656. },wgetRequests:{},nextWgetRequestHandle:0,getNextWgetRequestHandle:function () {
  4657. var handle = Browser.nextWgetRequestHandle;
  4658. Browser.nextWgetRequestHandle++;
  4659. return handle;
  4660. }};
  4661. function _time(ptr) {
  4662. var ret = (Date.now()/1000)|0;
  4663. if (ptr) {
  4664. HEAP32[((ptr)>>2)]=ret;
  4665. }
  4666. return ret;
  4667. }
  4668. ___errno_state = Runtime.staticAlloc(4); HEAP32[((___errno_state)>>2)]=0;
  4669. Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };
  4670. Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) { Browser.requestAnimationFrame(func) };
  4671. Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };
  4672. Module["pauseMainLoop"] = function Module_pauseMainLoop() { Browser.mainLoop.pause() };
  4673. Module["resumeMainLoop"] = function Module_resumeMainLoop() { Browser.mainLoop.resume() };
  4674. Module["getUserMedia"] = function Module_getUserMedia() { Browser.getUserMedia() }
  4675. FS.staticInit();__ATINIT__.unshift({ func: function() { if (!Module["noFSInit"] && !FS.init.initialized) FS.init() } });__ATMAIN__.push({ func: function() { FS.ignorePermissions = false } });__ATEXIT__.push({ func: function() { FS.quit() } });Module["FS_createFolder"] = FS.createFolder;Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createLink"] = FS.createLink;Module["FS_createDevice"] = FS.createDevice;
  4676. __ATINIT__.unshift({ func: function() { TTY.init() } });__ATEXIT__.push({ func: function() { TTY.shutdown() } });TTY.utf8 = new Runtime.UTF8Processor();
  4677. if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); NODEFS.staticInit(); }
  4678. STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
  4679. staticSealed = true; // seal the static portion of memory
  4680. STACK_MAX = STACK_BASE + TOTAL_STACK;
  4681. DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX);
  4682. assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");
  4683. var ctlz_i8 = allocate([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_DYNAMIC);
  4684. var cttz_i8 = allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0], "i8", ALLOC_DYNAMIC);
  4685. Module.asmGlobalArg = { "Math": Math, "Int8Array": Int8Array, "Int16Array": Int16Array, "Int32Array": Int32Array, "Uint8Array": Uint8Array, "Uint16Array": Uint16Array, "Uint32Array": Uint32Array, "Float32Array": Float32Array, "Float64Array": Float64Array };
  4686. Module.asmLibraryArg = { "abort": abort, "assert": assert, "min": Math_min, "_fflush": _fflush, "_sysconf": _sysconf, "_abort": _abort, "___setErrNo": ___setErrNo, "_sbrk": _sbrk, "_time": _time, "_emscripten_set_main_loop_timing": _emscripten_set_main_loop_timing, "_emscripten_memcpy_big": _emscripten_memcpy_big, "_emscripten_set_main_loop": _emscripten_set_main_loop, "___errno_location": ___errno_location, "STACKTOP": STACKTOP, "STACK_MAX": STACK_MAX, "tempDoublePtr": tempDoublePtr, "ABORT": ABORT, "cttz_i8": cttz_i8, "ctlz_i8": ctlz_i8, "NaN": NaN, "Infinity": Infinity };
  4687. // EMSCRIPTEN_START_ASM
  4688. var asm = (function(global, env, buffer) {
  4689. 'use asm';
  4690. var HEAP8 = new global.Int8Array(buffer);
  4691. var HEAP16 = new global.Int16Array(buffer);
  4692. var HEAP32 = new global.Int32Array(buffer);
  4693. var HEAPU8 = new global.Uint8Array(buffer);
  4694. var HEAPU16 = new global.Uint16Array(buffer);
  4695. var HEAPU32 = new global.Uint32Array(buffer);
  4696. var HEAPF32 = new global.Float32Array(buffer);
  4697. var HEAPF64 = new global.Float64Array(buffer);
  4698. var STACKTOP=env.STACKTOP|0;
  4699. var STACK_MAX=env.STACK_MAX|0;
  4700. var tempDoublePtr=env.tempDoublePtr|0;
  4701. var ABORT=env.ABORT|0;
  4702. var cttz_i8=env.cttz_i8|0;
  4703. var ctlz_i8=env.ctlz_i8|0;
  4704. var __THREW__ = 0;
  4705. var threwValue = 0;
  4706. var setjmpId = 0;
  4707. var undef = 0;
  4708. var nan = +env.NaN, inf = +env.Infinity;
  4709. var tempInt = 0, tempBigInt = 0, tempBigIntP = 0, tempBigIntS = 0, tempBigIntR = 0.0, tempBigIntI = 0, tempBigIntD = 0, tempValue = 0, tempDouble = 0.0;
  4710. var tempRet0 = 0;
  4711. var tempRet1 = 0;
  4712. var tempRet2 = 0;
  4713. var tempRet3 = 0;
  4714. var tempRet4 = 0;
  4715. var tempRet5 = 0;
  4716. var tempRet6 = 0;
  4717. var tempRet7 = 0;
  4718. var tempRet8 = 0;
  4719. var tempRet9 = 0;
  4720. var Math_floor=global.Math.floor;
  4721. var Math_abs=global.Math.abs;
  4722. var Math_sqrt=global.Math.sqrt;
  4723. var Math_pow=global.Math.pow;
  4724. var Math_cos=global.Math.cos;
  4725. var Math_sin=global.Math.sin;
  4726. var Math_tan=global.Math.tan;
  4727. var Math_acos=global.Math.acos;
  4728. var Math_asin=global.Math.asin;
  4729. var Math_atan=global.Math.atan;
  4730. var Math_atan2=global.Math.atan2;
  4731. var Math_exp=global.Math.exp;
  4732. var Math_log=global.Math.log;
  4733. var Math_ceil=global.Math.ceil;
  4734. var Math_imul=global.Math.imul;
  4735. var abort=env.abort;
  4736. var assert=env.assert;
  4737. var Math_min=env.min;
  4738. var _fflush=env._fflush;
  4739. var _sysconf=env._sysconf;
  4740. var _abort=env._abort;
  4741. var ___setErrNo=env.___setErrNo;
  4742. var _sbrk=env._sbrk;
  4743. var _time=env._time;
  4744. var _emscripten_set_main_loop_timing=env._emscripten_set_main_loop_timing;
  4745. var _emscripten_memcpy_big=env._emscripten_memcpy_big;
  4746. var _emscripten_set_main_loop=env._emscripten_set_main_loop;
  4747. var ___errno_location=env.___errno_location;
  4748. var tempFloat = 0.0;
  4749. // EMSCRIPTEN_START_FUNCS
  4750. function stackAlloc(size) {
  4751. size = size|0;
  4752. var ret = 0;
  4753. ret = STACKTOP;
  4754. STACKTOP = (STACKTOP + size)|0;
  4755. STACKTOP = (STACKTOP + 15)&-16;
  4756. return ret|0;
  4757. }
  4758. function stackSave() {
  4759. return STACKTOP|0;
  4760. }
  4761. function stackRestore(top) {
  4762. top = top|0;
  4763. STACKTOP = top;
  4764. }
  4765. function setThrew(threw, value) {
  4766. threw = threw|0;
  4767. value = value|0;
  4768. if ((__THREW__|0) == 0) {
  4769. __THREW__ = threw;
  4770. threwValue = value;
  4771. }
  4772. }
  4773. function copyTempFloat(ptr) {
  4774. ptr = ptr|0;
  4775. HEAP8[tempDoublePtr>>0] = HEAP8[ptr>>0];
  4776. HEAP8[tempDoublePtr+1>>0] = HEAP8[ptr+1>>0];
  4777. HEAP8[tempDoublePtr+2>>0] = HEAP8[ptr+2>>0];
  4778. HEAP8[tempDoublePtr+3>>0] = HEAP8[ptr+3>>0];
  4779. }
  4780. function copyTempDouble(ptr) {
  4781. ptr = ptr|0;
  4782. HEAP8[tempDoublePtr>>0] = HEAP8[ptr>>0];
  4783. HEAP8[tempDoublePtr+1>>0] = HEAP8[ptr+1>>0];
  4784. HEAP8[tempDoublePtr+2>>0] = HEAP8[ptr+2>>0];
  4785. HEAP8[tempDoublePtr+3>>0] = HEAP8[ptr+3>>0];
  4786. HEAP8[tempDoublePtr+4>>0] = HEAP8[ptr+4>>0];
  4787. HEAP8[tempDoublePtr+5>>0] = HEAP8[ptr+5>>0];
  4788. HEAP8[tempDoublePtr+6>>0] = HEAP8[ptr+6>>0];
  4789. HEAP8[tempDoublePtr+7>>0] = HEAP8[ptr+7>>0];
  4790. }
  4791. function setTempRet0(value) {
  4792. value = value|0;
  4793. tempRet0 = value;
  4794. }
  4795. function getTempRet0() {
  4796. return tempRet0|0;
  4797. }
  4798. function _crypto_verify_32_ref($x,$y) {
  4799. $x = $x|0;
  4800. $y = $y|0;
  4801. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  4802. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  4803. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  4804. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  4805. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  4806. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0;
  4807. var $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0;
  4808. var $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0;
  4809. var $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0;
  4810. var $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  4811. sp = STACKTOP;
  4812. $0 = HEAP8[$x>>0]|0;
  4813. $1 = HEAP8[$y>>0]|0;
  4814. $2 = $1 ^ $0;
  4815. $3 = (($x) + 1|0);
  4816. $4 = HEAP8[$3>>0]|0;
  4817. $5 = (($y) + 1|0);
  4818. $6 = HEAP8[$5>>0]|0;
  4819. $7 = $6 ^ $4;
  4820. $8 = $7 | $2;
  4821. $9 = (($x) + 2|0);
  4822. $10 = HEAP8[$9>>0]|0;
  4823. $11 = (($y) + 2|0);
  4824. $12 = HEAP8[$11>>0]|0;
  4825. $13 = $12 ^ $10;
  4826. $14 = $8 | $13;
  4827. $15 = (($x) + 3|0);
  4828. $16 = HEAP8[$15>>0]|0;
  4829. $17 = (($y) + 3|0);
  4830. $18 = HEAP8[$17>>0]|0;
  4831. $19 = $18 ^ $16;
  4832. $20 = $14 | $19;
  4833. $21 = (($x) + 4|0);
  4834. $22 = HEAP8[$21>>0]|0;
  4835. $23 = (($y) + 4|0);
  4836. $24 = HEAP8[$23>>0]|0;
  4837. $25 = $24 ^ $22;
  4838. $26 = $20 | $25;
  4839. $27 = (($x) + 5|0);
  4840. $28 = HEAP8[$27>>0]|0;
  4841. $29 = (($y) + 5|0);
  4842. $30 = HEAP8[$29>>0]|0;
  4843. $31 = $30 ^ $28;
  4844. $32 = $26 | $31;
  4845. $33 = (($x) + 6|0);
  4846. $34 = HEAP8[$33>>0]|0;
  4847. $35 = (($y) + 6|0);
  4848. $36 = HEAP8[$35>>0]|0;
  4849. $37 = $36 ^ $34;
  4850. $38 = $32 | $37;
  4851. $39 = (($x) + 7|0);
  4852. $40 = HEAP8[$39>>0]|0;
  4853. $41 = (($y) + 7|0);
  4854. $42 = HEAP8[$41>>0]|0;
  4855. $43 = $42 ^ $40;
  4856. $44 = $38 | $43;
  4857. $45 = (($x) + 8|0);
  4858. $46 = HEAP8[$45>>0]|0;
  4859. $47 = (($y) + 8|0);
  4860. $48 = HEAP8[$47>>0]|0;
  4861. $49 = $48 ^ $46;
  4862. $50 = $44 | $49;
  4863. $51 = (($x) + 9|0);
  4864. $52 = HEAP8[$51>>0]|0;
  4865. $53 = (($y) + 9|0);
  4866. $54 = HEAP8[$53>>0]|0;
  4867. $55 = $54 ^ $52;
  4868. $56 = $50 | $55;
  4869. $57 = (($x) + 10|0);
  4870. $58 = HEAP8[$57>>0]|0;
  4871. $59 = (($y) + 10|0);
  4872. $60 = HEAP8[$59>>0]|0;
  4873. $61 = $60 ^ $58;
  4874. $62 = $56 | $61;
  4875. $63 = (($x) + 11|0);
  4876. $64 = HEAP8[$63>>0]|0;
  4877. $65 = (($y) + 11|0);
  4878. $66 = HEAP8[$65>>0]|0;
  4879. $67 = $66 ^ $64;
  4880. $68 = $62 | $67;
  4881. $69 = (($x) + 12|0);
  4882. $70 = HEAP8[$69>>0]|0;
  4883. $71 = (($y) + 12|0);
  4884. $72 = HEAP8[$71>>0]|0;
  4885. $73 = $72 ^ $70;
  4886. $74 = $68 | $73;
  4887. $75 = (($x) + 13|0);
  4888. $76 = HEAP8[$75>>0]|0;
  4889. $77 = (($y) + 13|0);
  4890. $78 = HEAP8[$77>>0]|0;
  4891. $79 = $78 ^ $76;
  4892. $80 = $74 | $79;
  4893. $81 = (($x) + 14|0);
  4894. $82 = HEAP8[$81>>0]|0;
  4895. $83 = (($y) + 14|0);
  4896. $84 = HEAP8[$83>>0]|0;
  4897. $85 = $84 ^ $82;
  4898. $86 = $80 | $85;
  4899. $87 = (($x) + 15|0);
  4900. $88 = HEAP8[$87>>0]|0;
  4901. $89 = (($y) + 15|0);
  4902. $90 = HEAP8[$89>>0]|0;
  4903. $91 = $90 ^ $88;
  4904. $92 = $86 | $91;
  4905. $93 = (($x) + 16|0);
  4906. $94 = HEAP8[$93>>0]|0;
  4907. $95 = (($y) + 16|0);
  4908. $96 = HEAP8[$95>>0]|0;
  4909. $97 = $96 ^ $94;
  4910. $98 = $92 | $97;
  4911. $99 = (($x) + 17|0);
  4912. $100 = HEAP8[$99>>0]|0;
  4913. $101 = (($y) + 17|0);
  4914. $102 = HEAP8[$101>>0]|0;
  4915. $103 = $102 ^ $100;
  4916. $104 = $98 | $103;
  4917. $105 = (($x) + 18|0);
  4918. $106 = HEAP8[$105>>0]|0;
  4919. $107 = (($y) + 18|0);
  4920. $108 = HEAP8[$107>>0]|0;
  4921. $109 = $108 ^ $106;
  4922. $110 = $104 | $109;
  4923. $111 = (($x) + 19|0);
  4924. $112 = HEAP8[$111>>0]|0;
  4925. $113 = (($y) + 19|0);
  4926. $114 = HEAP8[$113>>0]|0;
  4927. $115 = $114 ^ $112;
  4928. $116 = $110 | $115;
  4929. $117 = (($x) + 20|0);
  4930. $118 = HEAP8[$117>>0]|0;
  4931. $119 = (($y) + 20|0);
  4932. $120 = HEAP8[$119>>0]|0;
  4933. $121 = $120 ^ $118;
  4934. $122 = $116 | $121;
  4935. $123 = (($x) + 21|0);
  4936. $124 = HEAP8[$123>>0]|0;
  4937. $125 = (($y) + 21|0);
  4938. $126 = HEAP8[$125>>0]|0;
  4939. $127 = $126 ^ $124;
  4940. $128 = $122 | $127;
  4941. $129 = (($x) + 22|0);
  4942. $130 = HEAP8[$129>>0]|0;
  4943. $131 = (($y) + 22|0);
  4944. $132 = HEAP8[$131>>0]|0;
  4945. $133 = $132 ^ $130;
  4946. $134 = $128 | $133;
  4947. $135 = (($x) + 23|0);
  4948. $136 = HEAP8[$135>>0]|0;
  4949. $137 = (($y) + 23|0);
  4950. $138 = HEAP8[$137>>0]|0;
  4951. $139 = $138 ^ $136;
  4952. $140 = $134 | $139;
  4953. $141 = (($x) + 24|0);
  4954. $142 = HEAP8[$141>>0]|0;
  4955. $143 = (($y) + 24|0);
  4956. $144 = HEAP8[$143>>0]|0;
  4957. $145 = $144 ^ $142;
  4958. $146 = $140 | $145;
  4959. $147 = (($x) + 25|0);
  4960. $148 = HEAP8[$147>>0]|0;
  4961. $149 = (($y) + 25|0);
  4962. $150 = HEAP8[$149>>0]|0;
  4963. $151 = $150 ^ $148;
  4964. $152 = $146 | $151;
  4965. $153 = (($x) + 26|0);
  4966. $154 = HEAP8[$153>>0]|0;
  4967. $155 = (($y) + 26|0);
  4968. $156 = HEAP8[$155>>0]|0;
  4969. $157 = $156 ^ $154;
  4970. $158 = $152 | $157;
  4971. $159 = (($x) + 27|0);
  4972. $160 = HEAP8[$159>>0]|0;
  4973. $161 = (($y) + 27|0);
  4974. $162 = HEAP8[$161>>0]|0;
  4975. $163 = $162 ^ $160;
  4976. $164 = $158 | $163;
  4977. $165 = (($x) + 28|0);
  4978. $166 = HEAP8[$165>>0]|0;
  4979. $167 = (($y) + 28|0);
  4980. $168 = HEAP8[$167>>0]|0;
  4981. $169 = $168 ^ $166;
  4982. $170 = $164 | $169;
  4983. $171 = (($x) + 29|0);
  4984. $172 = HEAP8[$171>>0]|0;
  4985. $173 = (($y) + 29|0);
  4986. $174 = HEAP8[$173>>0]|0;
  4987. $175 = $174 ^ $172;
  4988. $176 = $170 | $175;
  4989. $177 = (($x) + 30|0);
  4990. $178 = HEAP8[$177>>0]|0;
  4991. $179 = (($y) + 30|0);
  4992. $180 = HEAP8[$179>>0]|0;
  4993. $181 = $180 ^ $178;
  4994. $182 = $176 | $181;
  4995. $183 = (($x) + 31|0);
  4996. $184 = HEAP8[$183>>0]|0;
  4997. $185 = (($y) + 31|0);
  4998. $186 = HEAP8[$185>>0]|0;
  4999. $187 = $186 ^ $184;
  5000. $188 = $182 | $187;
  5001. $189 = $188&255;
  5002. $190 = (($189) + 511)|0;
  5003. $191 = $190 >>> 8;
  5004. $192 = $191 & 1;
  5005. $193 = (($192) + -1)|0;
  5006. STACKTOP = sp;return ($193|0);
  5007. }
  5008. function _curve25519_sign($signature_out,$curve25519_privkey,$msg,$msg_len) {
  5009. $signature_out = $signature_out|0;
  5010. $curve25519_privkey = $curve25519_privkey|0;
  5011. $msg = $msg|0;
  5012. $msg_len = $msg_len|0;
  5013. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $ed_keypair = 0, $ed_pubkey_point = 0, $sigbuf_out_len = 0, dest = 0;
  5014. var label = 0, sp = 0, src = 0, stop = 0;
  5015. sp = STACKTOP;
  5016. STACKTOP = STACKTOP + 240|0;
  5017. $ed_pubkey_point = sp + 8|0;
  5018. $ed_keypair = sp + 168|0;
  5019. $sigbuf_out_len = sp;
  5020. $0 = (($msg_len) + 64)|0;
  5021. $1 = STACKTOP; STACKTOP = STACKTOP + ((((1*$0)|0)+15)&-16)|0;;
  5022. $2 = $sigbuf_out_len;
  5023. $3 = $2;
  5024. HEAP32[$3>>2] = 0;
  5025. $4 = (($2) + 4)|0;
  5026. $5 = $4;
  5027. HEAP32[$5>>2] = 0;
  5028. dest=$ed_keypair+0|0; src=$curve25519_privkey+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5029. _crypto_sign_ed25519_ref10_ge_scalarmult_base($ed_pubkey_point,$curve25519_privkey);
  5030. $6 = (($ed_keypair) + 32|0);
  5031. _crypto_sign_ed25519_ref10_ge_p3_tobytes($6,$ed_pubkey_point);
  5032. $7 = (($ed_keypair) + 63|0);
  5033. $8 = HEAP8[$7>>0]|0;
  5034. $9 = $8&255;
  5035. $10 = $9 & 128;
  5036. (_crypto_sign_modified($1,$sigbuf_out_len,$msg,$msg_len,0,$ed_keypair)|0);
  5037. dest=$signature_out+0|0; src=$1+0|0; stop=dest+64|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5038. $11 = (($signature_out) + 63|0);
  5039. $12 = HEAP8[$11>>0]|0;
  5040. $13 = $12&255;
  5041. $14 = $13 | $10;
  5042. $15 = $14&255;
  5043. HEAP8[$11>>0] = $15;
  5044. STACKTOP = sp;return;
  5045. }
  5046. function _curve25519_verify($signature,$curve25519_pubkey,$msg,$msg_len) {
  5047. $signature = $signature|0;
  5048. $curve25519_pubkey = $curve25519_pubkey|0;
  5049. $msg = $msg|0;
  5050. $msg_len = $msg_len|0;
  5051. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $ed_pubkey = 0, $ed_y = 0;
  5052. var $inv_mont_x_plus_one = 0, $mont_x = 0, $mont_x_minus_one = 0, $mont_x_plus_one = 0, $one = 0, $some_retval = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  5053. sp = STACKTOP;
  5054. STACKTOP = STACKTOP + 288|0;
  5055. $mont_x = sp + 208|0;
  5056. $mont_x_minus_one = sp + 168|0;
  5057. $mont_x_plus_one = sp + 128|0;
  5058. $inv_mont_x_plus_one = sp + 88|0;
  5059. $one = sp + 48|0;
  5060. $ed_y = sp + 8|0;
  5061. $ed_pubkey = sp + 248|0;
  5062. $some_retval = sp;
  5063. $0 = (($msg_len) + 64)|0;
  5064. $1 = STACKTOP; STACKTOP = STACKTOP + ((((1*$0)|0)+15)&-16)|0;;
  5065. $2 = STACKTOP; STACKTOP = STACKTOP + ((((1*$0)|0)+15)&-16)|0;;
  5066. _crypto_sign_ed25519_ref10_fe_frombytes($mont_x,$curve25519_pubkey);
  5067. _crypto_sign_ed25519_ref10_fe_1($one);
  5068. _crypto_sign_ed25519_ref10_fe_sub($mont_x_minus_one,$mont_x,$one);
  5069. _crypto_sign_ed25519_ref10_fe_add($mont_x_plus_one,$mont_x,$one);
  5070. _crypto_sign_ed25519_ref10_fe_invert($inv_mont_x_plus_one,$mont_x_plus_one);
  5071. _crypto_sign_ed25519_ref10_fe_mul($ed_y,$mont_x_minus_one,$inv_mont_x_plus_one);
  5072. _crypto_sign_ed25519_ref10_fe_tobytes($ed_pubkey,$ed_y);
  5073. $3 = (($signature) + 63|0);
  5074. $4 = HEAP8[$3>>0]|0;
  5075. $5 = $4&255;
  5076. $6 = $5 & 128;
  5077. $7 = (($ed_pubkey) + 31|0);
  5078. $8 = HEAP8[$7>>0]|0;
  5079. $9 = $8&255;
  5080. $10 = $9 | $6;
  5081. $11 = $10&255;
  5082. HEAP8[$7>>0] = $11;
  5083. $12 = HEAP8[$3>>0]|0;
  5084. $13 = $12&255;
  5085. $14 = $13 & 127;
  5086. $15 = $14&255;
  5087. HEAP8[$3>>0] = $15;
  5088. dest=$1+0|0; src=$signature+0|0; stop=dest+64|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5089. $16 = (($1) + 64|0);
  5090. _memcpy(($16|0),($msg|0),($msg_len|0))|0;
  5091. $17 = (_crypto_sign_edwards25519sha512batch_ref10_open($2,$some_retval,$1,$0,0,$ed_pubkey)|0);
  5092. STACKTOP = sp;return ($17|0);
  5093. }
  5094. function _crypto_hash_sha512_ref($output,$input,$0,$1) {
  5095. $output = $output|0;
  5096. $input = $input|0;
  5097. $0 = $0|0;
  5098. $1 = $1|0;
  5099. var $ctx = 0, label = 0, sp = 0;
  5100. sp = STACKTOP;
  5101. STACKTOP = STACKTOP + 208|0;
  5102. $ctx = sp;
  5103. _sph_sha512_init($ctx);
  5104. _sph_sha384($ctx,$input,$0);
  5105. _sph_sha512_close($ctx,$output);
  5106. STACKTOP = sp;return 0;
  5107. }
  5108. function _crypto_sign_modified($sm,$smlen,$m,$0,$1,$sk) {
  5109. $sm = $sm|0;
  5110. $smlen = $smlen|0;
  5111. $m = $m|0;
  5112. $0 = $0|0;
  5113. $1 = $1|0;
  5114. $sk = $sk|0;
  5115. var $10 = 0, $11 = 0, $12 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $R = 0, $hram = 0, $nonce = 0, $pk1 = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  5116. sp = STACKTOP;
  5117. STACKTOP = STACKTOP + 320|0;
  5118. $pk1 = sp + 288|0;
  5119. $nonce = sp + 224|0;
  5120. $hram = sp + 160|0;
  5121. $R = sp;
  5122. $2 = (($sk) + 32|0);
  5123. dest=$pk1+0|0; src=$2+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5124. $3 = (_i64Add(($0|0),($1|0),64,0)|0);
  5125. $4 = tempRet0;
  5126. $5 = $smlen;
  5127. $6 = $5;
  5128. HEAP32[$6>>2] = $3;
  5129. $7 = (($5) + 4)|0;
  5130. $8 = $7;
  5131. HEAP32[$8>>2] = $4;
  5132. $9 = (($sm) + 64|0);
  5133. _memmove(($9|0),($m|0),($0|0))|0;
  5134. $10 = (($sm) + 32|0);
  5135. _memmove(($10|0),($sk|0),32)|0;
  5136. $11 = (_i64Add(($0|0),($1|0),32,0)|0);
  5137. $12 = tempRet0;
  5138. (_crypto_hash_sha512_ref($nonce,$10,$11,$12)|0);
  5139. dest=$10+0|0; src=$pk1+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5140. _crypto_sign_ed25519_ref10_sc_reduce($nonce);
  5141. _crypto_sign_ed25519_ref10_ge_scalarmult_base($R,$nonce);
  5142. _crypto_sign_ed25519_ref10_ge_p3_tobytes($sm,$R);
  5143. (_crypto_hash_sha512_ref($hram,$sm,$3,$4)|0);
  5144. _crypto_sign_ed25519_ref10_sc_reduce($hram);
  5145. _crypto_sign_ed25519_ref10_sc_muladd($10,$hram,$sk,$nonce);
  5146. STACKTOP = sp;return 0;
  5147. }
  5148. function _curve25519_donna($mypublic,$secret,$basepoint) {
  5149. $mypublic = $mypublic|0;
  5150. $secret = $secret|0;
  5151. $basepoint = $basepoint|0;
  5152. var $bp = 0, $e = 0, $x = 0, $z = 0, $zmone = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  5153. sp = STACKTOP;
  5154. STACKTOP = STACKTOP + 368|0;
  5155. $bp = sp + 248|0;
  5156. $x = sp + 168|0;
  5157. $z = sp + 80|0;
  5158. $zmone = sp;
  5159. $e = sp + 328|0;
  5160. dest=$e+0|0; src=$secret+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  5161. _fexpand($bp,$basepoint);
  5162. _cmult($x,$z,$e,$bp);
  5163. _crecip($zmone,$z);
  5164. _fmul($z,$x,$zmone);
  5165. _fcontract($mypublic,$z);
  5166. STACKTOP = sp;return 0;
  5167. }
  5168. function _fexpand($output,$input) {
  5169. $output = $output|0;
  5170. $input = $input|0;
  5171. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  5172. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  5173. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  5174. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  5175. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  5176. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  5177. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  5178. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  5179. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  5180. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  5181. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $3 = 0, $30 = 0, $31 = 0;
  5182. var $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0;
  5183. var $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0;
  5184. var $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0;
  5185. var $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  5186. sp = STACKTOP;
  5187. $0 = HEAP8[$input>>0]|0;
  5188. $1 = $0&255;
  5189. $2 = (($input) + 1|0);
  5190. $3 = HEAP8[$2>>0]|0;
  5191. $4 = $3&255;
  5192. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  5193. $6 = tempRet0;
  5194. $7 = $5 | $1;
  5195. $8 = (($input) + 2|0);
  5196. $9 = HEAP8[$8>>0]|0;
  5197. $10 = $9&255;
  5198. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  5199. $12 = tempRet0;
  5200. $13 = $7 | $11;
  5201. $14 = $6 | $12;
  5202. $15 = (($input) + 3|0);
  5203. $16 = HEAP8[$15>>0]|0;
  5204. $17 = $16&255;
  5205. $18 = (_bitshift64Shl(($17|0),0,24)|0);
  5206. $19 = tempRet0;
  5207. $20 = $18 & 50331648;
  5208. $21 = $13 | $20;
  5209. $22 = $output;
  5210. $23 = $22;
  5211. HEAP32[$23>>2] = $21;
  5212. $24 = (($22) + 4)|0;
  5213. $25 = $24;
  5214. HEAP32[$25>>2] = $14;
  5215. $26 = HEAP8[$15>>0]|0;
  5216. $27 = $26&255;
  5217. $28 = (($input) + 4|0);
  5218. $29 = HEAP8[$28>>0]|0;
  5219. $30 = $29&255;
  5220. $31 = (_bitshift64Shl(($30|0),0,8)|0);
  5221. $32 = tempRet0;
  5222. $33 = $31 | $27;
  5223. $34 = (($input) + 5|0);
  5224. $35 = HEAP8[$34>>0]|0;
  5225. $36 = $35&255;
  5226. $37 = (_bitshift64Shl(($36|0),0,16)|0);
  5227. $38 = tempRet0;
  5228. $39 = $33 | $37;
  5229. $40 = $32 | $38;
  5230. $41 = (($input) + 6|0);
  5231. $42 = HEAP8[$41>>0]|0;
  5232. $43 = $42&255;
  5233. $44 = (_bitshift64Shl(($43|0),0,24)|0);
  5234. $45 = tempRet0;
  5235. $46 = $39 | $44;
  5236. $47 = $40 | $45;
  5237. $48 = (_bitshift64Lshr(($46|0),($47|0),2)|0);
  5238. $49 = tempRet0;
  5239. $50 = $48 & 33554431;
  5240. $51 = (($output) + 8|0);
  5241. $52 = $51;
  5242. $53 = $52;
  5243. HEAP32[$53>>2] = $50;
  5244. $54 = (($52) + 4)|0;
  5245. $55 = $54;
  5246. HEAP32[$55>>2] = 0;
  5247. $56 = HEAP8[$41>>0]|0;
  5248. $57 = $56&255;
  5249. $58 = (($input) + 7|0);
  5250. $59 = HEAP8[$58>>0]|0;
  5251. $60 = $59&255;
  5252. $61 = (_bitshift64Shl(($60|0),0,8)|0);
  5253. $62 = tempRet0;
  5254. $63 = $61 | $57;
  5255. $64 = (($input) + 8|0);
  5256. $65 = HEAP8[$64>>0]|0;
  5257. $66 = $65&255;
  5258. $67 = (_bitshift64Shl(($66|0),0,16)|0);
  5259. $68 = tempRet0;
  5260. $69 = $63 | $67;
  5261. $70 = $62 | $68;
  5262. $71 = (($input) + 9|0);
  5263. $72 = HEAP8[$71>>0]|0;
  5264. $73 = $72&255;
  5265. $74 = (_bitshift64Shl(($73|0),0,24)|0);
  5266. $75 = tempRet0;
  5267. $76 = $69 | $74;
  5268. $77 = $70 | $75;
  5269. $78 = (_bitshift64Lshr(($76|0),($77|0),3)|0);
  5270. $79 = tempRet0;
  5271. $80 = $78 & 67108863;
  5272. $81 = (($output) + 16|0);
  5273. $82 = $81;
  5274. $83 = $82;
  5275. HEAP32[$83>>2] = $80;
  5276. $84 = (($82) + 4)|0;
  5277. $85 = $84;
  5278. HEAP32[$85>>2] = 0;
  5279. $86 = HEAP8[$71>>0]|0;
  5280. $87 = $86&255;
  5281. $88 = (($input) + 10|0);
  5282. $89 = HEAP8[$88>>0]|0;
  5283. $90 = $89&255;
  5284. $91 = (_bitshift64Shl(($90|0),0,8)|0);
  5285. $92 = tempRet0;
  5286. $93 = $91 | $87;
  5287. $94 = (($input) + 11|0);
  5288. $95 = HEAP8[$94>>0]|0;
  5289. $96 = $95&255;
  5290. $97 = (_bitshift64Shl(($96|0),0,16)|0);
  5291. $98 = tempRet0;
  5292. $99 = $93 | $97;
  5293. $100 = $92 | $98;
  5294. $101 = (($input) + 12|0);
  5295. $102 = HEAP8[$101>>0]|0;
  5296. $103 = $102&255;
  5297. $104 = (_bitshift64Shl(($103|0),0,24)|0);
  5298. $105 = tempRet0;
  5299. $106 = $99 | $104;
  5300. $107 = $100 | $105;
  5301. $108 = (_bitshift64Lshr(($106|0),($107|0),5)|0);
  5302. $109 = tempRet0;
  5303. $110 = $108 & 33554431;
  5304. $111 = (($output) + 24|0);
  5305. $112 = $111;
  5306. $113 = $112;
  5307. HEAP32[$113>>2] = $110;
  5308. $114 = (($112) + 4)|0;
  5309. $115 = $114;
  5310. HEAP32[$115>>2] = 0;
  5311. $116 = HEAP8[$101>>0]|0;
  5312. $117 = $116&255;
  5313. $118 = (($input) + 13|0);
  5314. $119 = HEAP8[$118>>0]|0;
  5315. $120 = $119&255;
  5316. $121 = (_bitshift64Shl(($120|0),0,8)|0);
  5317. $122 = tempRet0;
  5318. $123 = $121 | $117;
  5319. $124 = (($input) + 14|0);
  5320. $125 = HEAP8[$124>>0]|0;
  5321. $126 = $125&255;
  5322. $127 = (_bitshift64Shl(($126|0),0,16)|0);
  5323. $128 = tempRet0;
  5324. $129 = $123 | $127;
  5325. $130 = $122 | $128;
  5326. $131 = (($input) + 15|0);
  5327. $132 = HEAP8[$131>>0]|0;
  5328. $133 = $132&255;
  5329. $134 = (_bitshift64Shl(($133|0),0,24)|0);
  5330. $135 = tempRet0;
  5331. $136 = $129 | $134;
  5332. $137 = $130 | $135;
  5333. $138 = (_bitshift64Lshr(($136|0),($137|0),6)|0);
  5334. $139 = tempRet0;
  5335. $140 = $138 & 67108863;
  5336. $141 = (($output) + 32|0);
  5337. $142 = $141;
  5338. $143 = $142;
  5339. HEAP32[$143>>2] = $140;
  5340. $144 = (($142) + 4)|0;
  5341. $145 = $144;
  5342. HEAP32[$145>>2] = 0;
  5343. $146 = (($input) + 16|0);
  5344. $147 = HEAP8[$146>>0]|0;
  5345. $148 = $147&255;
  5346. $149 = (($input) + 17|0);
  5347. $150 = HEAP8[$149>>0]|0;
  5348. $151 = $150&255;
  5349. $152 = (_bitshift64Shl(($151|0),0,8)|0);
  5350. $153 = tempRet0;
  5351. $154 = $152 | $148;
  5352. $155 = (($input) + 18|0);
  5353. $156 = HEAP8[$155>>0]|0;
  5354. $157 = $156&255;
  5355. $158 = (_bitshift64Shl(($157|0),0,16)|0);
  5356. $159 = tempRet0;
  5357. $160 = $154 | $158;
  5358. $161 = $153 | $159;
  5359. $162 = (($input) + 19|0);
  5360. $163 = HEAP8[$162>>0]|0;
  5361. $164 = $163&255;
  5362. $165 = (_bitshift64Shl(($164|0),0,24)|0);
  5363. $166 = tempRet0;
  5364. $167 = $165 & 16777216;
  5365. $168 = $160 | $167;
  5366. $169 = (($output) + 40|0);
  5367. $170 = $169;
  5368. $171 = $170;
  5369. HEAP32[$171>>2] = $168;
  5370. $172 = (($170) + 4)|0;
  5371. $173 = $172;
  5372. HEAP32[$173>>2] = $161;
  5373. $174 = HEAP8[$162>>0]|0;
  5374. $175 = $174&255;
  5375. $176 = (($input) + 20|0);
  5376. $177 = HEAP8[$176>>0]|0;
  5377. $178 = $177&255;
  5378. $179 = (_bitshift64Shl(($178|0),0,8)|0);
  5379. $180 = tempRet0;
  5380. $181 = $179 | $175;
  5381. $182 = (($input) + 21|0);
  5382. $183 = HEAP8[$182>>0]|0;
  5383. $184 = $183&255;
  5384. $185 = (_bitshift64Shl(($184|0),0,16)|0);
  5385. $186 = tempRet0;
  5386. $187 = $181 | $185;
  5387. $188 = $180 | $186;
  5388. $189 = (($input) + 22|0);
  5389. $190 = HEAP8[$189>>0]|0;
  5390. $191 = $190&255;
  5391. $192 = (_bitshift64Shl(($191|0),0,24)|0);
  5392. $193 = tempRet0;
  5393. $194 = $187 | $192;
  5394. $195 = $188 | $193;
  5395. $196 = (_bitshift64Lshr(($194|0),($195|0),1)|0);
  5396. $197 = tempRet0;
  5397. $198 = $196 & 67108863;
  5398. $199 = (($output) + 48|0);
  5399. $200 = $199;
  5400. $201 = $200;
  5401. HEAP32[$201>>2] = $198;
  5402. $202 = (($200) + 4)|0;
  5403. $203 = $202;
  5404. HEAP32[$203>>2] = 0;
  5405. $204 = HEAP8[$189>>0]|0;
  5406. $205 = $204&255;
  5407. $206 = (($input) + 23|0);
  5408. $207 = HEAP8[$206>>0]|0;
  5409. $208 = $207&255;
  5410. $209 = (_bitshift64Shl(($208|0),0,8)|0);
  5411. $210 = tempRet0;
  5412. $211 = $209 | $205;
  5413. $212 = (($input) + 24|0);
  5414. $213 = HEAP8[$212>>0]|0;
  5415. $214 = $213&255;
  5416. $215 = (_bitshift64Shl(($214|0),0,16)|0);
  5417. $216 = tempRet0;
  5418. $217 = $211 | $215;
  5419. $218 = $210 | $216;
  5420. $219 = (($input) + 25|0);
  5421. $220 = HEAP8[$219>>0]|0;
  5422. $221 = $220&255;
  5423. $222 = (_bitshift64Shl(($221|0),0,24)|0);
  5424. $223 = tempRet0;
  5425. $224 = $217 | $222;
  5426. $225 = $218 | $223;
  5427. $226 = (_bitshift64Lshr(($224|0),($225|0),3)|0);
  5428. $227 = tempRet0;
  5429. $228 = $226 & 33554431;
  5430. $229 = (($output) + 56|0);
  5431. $230 = $229;
  5432. $231 = $230;
  5433. HEAP32[$231>>2] = $228;
  5434. $232 = (($230) + 4)|0;
  5435. $233 = $232;
  5436. HEAP32[$233>>2] = 0;
  5437. $234 = HEAP8[$219>>0]|0;
  5438. $235 = $234&255;
  5439. $236 = (($input) + 26|0);
  5440. $237 = HEAP8[$236>>0]|0;
  5441. $238 = $237&255;
  5442. $239 = (_bitshift64Shl(($238|0),0,8)|0);
  5443. $240 = tempRet0;
  5444. $241 = $239 | $235;
  5445. $242 = (($input) + 27|0);
  5446. $243 = HEAP8[$242>>0]|0;
  5447. $244 = $243&255;
  5448. $245 = (_bitshift64Shl(($244|0),0,16)|0);
  5449. $246 = tempRet0;
  5450. $247 = $241 | $245;
  5451. $248 = $240 | $246;
  5452. $249 = (($input) + 28|0);
  5453. $250 = HEAP8[$249>>0]|0;
  5454. $251 = $250&255;
  5455. $252 = (_bitshift64Shl(($251|0),0,24)|0);
  5456. $253 = tempRet0;
  5457. $254 = $247 | $252;
  5458. $255 = $248 | $253;
  5459. $256 = (_bitshift64Lshr(($254|0),($255|0),4)|0);
  5460. $257 = tempRet0;
  5461. $258 = $256 & 67108863;
  5462. $259 = (($output) + 64|0);
  5463. $260 = $259;
  5464. $261 = $260;
  5465. HEAP32[$261>>2] = $258;
  5466. $262 = (($260) + 4)|0;
  5467. $263 = $262;
  5468. HEAP32[$263>>2] = 0;
  5469. $264 = HEAP8[$249>>0]|0;
  5470. $265 = $264&255;
  5471. $266 = (($input) + 29|0);
  5472. $267 = HEAP8[$266>>0]|0;
  5473. $268 = $267&255;
  5474. $269 = (_bitshift64Shl(($268|0),0,8)|0);
  5475. $270 = tempRet0;
  5476. $271 = $269 | $265;
  5477. $272 = (($input) + 30|0);
  5478. $273 = HEAP8[$272>>0]|0;
  5479. $274 = $273&255;
  5480. $275 = (_bitshift64Shl(($274|0),0,16)|0);
  5481. $276 = tempRet0;
  5482. $277 = $271 | $275;
  5483. $278 = $270 | $276;
  5484. $279 = (($input) + 31|0);
  5485. $280 = HEAP8[$279>>0]|0;
  5486. $281 = $280&255;
  5487. $282 = (_bitshift64Shl(($281|0),0,24)|0);
  5488. $283 = tempRet0;
  5489. $284 = $277 | $282;
  5490. $285 = $278 | $283;
  5491. $286 = (_bitshift64Lshr(($284|0),($285|0),6)|0);
  5492. $287 = tempRet0;
  5493. $288 = $286 & 33554431;
  5494. $289 = (($output) + 72|0);
  5495. $290 = $289;
  5496. $291 = $290;
  5497. HEAP32[$291>>2] = $288;
  5498. $292 = (($290) + 4)|0;
  5499. $293 = $292;
  5500. HEAP32[$293>>2] = 0;
  5501. STACKTOP = sp;return;
  5502. }
  5503. function _cmult($resultx,$resultz,$n,$q) {
  5504. $resultx = $resultx|0;
  5505. $resultz = $resultz|0;
  5506. $n = $n|0;
  5507. $q = $q|0;
  5508. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $3 = 0, $4 = 0;
  5509. var $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $a = 0, $b = 0, $byte$09 = 0, $c = 0, $d = 0, $e = 0, $exitcond = 0, $exitcond20 = 0, $f = 0, $g = 0, $h = 0, $i$018 = 0, $j$08 = 0, $nqpqx$019 = 0, $nqpqx$110 = 0;
  5510. var $nqpqx$110$phi = 0, $nqpqx2$014 = 0, $nqpqx2$14 = 0, $nqpqx2$14$phi = 0, $nqpqz$013 = 0, $nqpqz$13 = 0, $nqpqz$13$phi = 0, $nqpqz2$015 = 0, $nqpqz2$15 = 0, $nqpqz2$15$phi = 0, $nqx$011 = 0, $nqx$11 = 0, $nqx$11$phi = 0, $nqx2$016 = 0, $nqx2$16 = 0, $nqx2$16$phi = 0, $nqz$012 = 0, $nqz$12 = 0, $nqz$12$phi = 0, $nqz2$017 = 0;
  5511. var $nqz2$17 = 0, $nqz2$17$phi = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  5512. sp = STACKTOP;
  5513. STACKTOP = STACKTOP + 1216|0;
  5514. $a = sp + 1064|0;
  5515. $b = sp + 912|0;
  5516. $c = sp + 760|0;
  5517. $d = sp + 608|0;
  5518. $e = sp + 456|0;
  5519. $f = sp + 304|0;
  5520. $g = sp + 152|0;
  5521. $h = sp;
  5522. _memset(($a|0),0,152)|0;
  5523. _memset(($b|0),0,152)|0;
  5524. $0 = $b;
  5525. $1 = $0;
  5526. HEAP32[$1>>2] = 1;
  5527. $2 = (($0) + 4)|0;
  5528. $3 = $2;
  5529. HEAP32[$3>>2] = 0;
  5530. _memset(($c|0),0,152)|0;
  5531. $4 = $c;
  5532. $5 = $4;
  5533. HEAP32[$5>>2] = 1;
  5534. $6 = (($4) + 4)|0;
  5535. $7 = $6;
  5536. HEAP32[$7>>2] = 0;
  5537. _memset(($d|0),0,152)|0;
  5538. _memset(($e|0),0,152)|0;
  5539. _memset(($f|0),0,152)|0;
  5540. $8 = $f;
  5541. $9 = $8;
  5542. HEAP32[$9>>2] = 1;
  5543. $10 = (($8) + 4)|0;
  5544. $11 = $10;
  5545. HEAP32[$11>>2] = 0;
  5546. _memset(($g|0),0,152)|0;
  5547. _memset(($h|0),0,152)|0;
  5548. $12 = $h;
  5549. $13 = $12;
  5550. HEAP32[$13>>2] = 1;
  5551. $14 = (($12) + 4)|0;
  5552. $15 = $14;
  5553. HEAP32[$15>>2] = 0;
  5554. dest=$a+0|0; src=$q+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  5555. $i$018 = 0;$nqpqx$019 = $a;$nqpqx2$014 = $e;$nqpqz$013 = $b;$nqpqz2$015 = $f;$nqx$011 = $c;$nqx2$016 = $g;$nqz$012 = $d;$nqz2$017 = $h;
  5556. while(1) {
  5557. $16 = (31 - ($i$018))|0;
  5558. $17 = (($n) + ($16)|0);
  5559. $18 = HEAP8[$17>>0]|0;
  5560. $byte$09 = $18;$j$08 = 0;$nqpqx$110 = $nqpqx$019;$nqpqx2$14 = $nqpqx2$014;$nqpqz$13 = $nqpqz$013;$nqpqz2$15 = $nqpqz2$015;$nqx$11 = $nqx$011;$nqx2$16 = $nqx2$016;$nqz$12 = $nqz$012;$nqz2$17 = $nqz2$017;
  5561. while(1) {
  5562. $19 = $byte$09&255;
  5563. $20 = $19 >>> 7;
  5564. _swap_conditional($nqx$11,$nqpqx$110,$20,0);
  5565. _swap_conditional($nqz$12,$nqpqz$13,$20,0);
  5566. _fmonty($nqx2$16,$nqz2$17,$nqpqx2$14,$nqpqz2$15,$nqx$11,$nqz$12,$nqpqx$110,$nqpqz$13,$q);
  5567. _swap_conditional($nqx2$16,$nqpqx2$14,$20,0);
  5568. _swap_conditional($nqz2$17,$nqpqz2$15,$20,0);
  5569. $21 = $19 << 1;
  5570. $22 = $21&255;
  5571. $23 = (($j$08) + 1)|0;
  5572. $exitcond = ($23|0)==(8);
  5573. if ($exitcond) {
  5574. break;
  5575. } else {
  5576. $nqz2$17$phi = $nqz$12;$nqz$12$phi = $nqz2$17;$nqx2$16$phi = $nqx$11;$nqx$11$phi = $nqx2$16;$nqpqz2$15$phi = $nqpqz$13;$nqpqz$13$phi = $nqpqz2$15;$nqpqx2$14$phi = $nqpqx$110;$nqpqx$110$phi = $nqpqx2$14;$byte$09 = $22;$j$08 = $23;$nqz2$17 = $nqz2$17$phi;$nqz$12 = $nqz$12$phi;$nqx2$16 = $nqx2$16$phi;$nqx$11 = $nqx$11$phi;$nqpqz2$15 = $nqpqz2$15$phi;$nqpqz$13 = $nqpqz$13$phi;$nqpqx2$14 = $nqpqx2$14$phi;$nqpqx$110 = $nqpqx$110$phi;
  5577. }
  5578. }
  5579. $24 = (($i$018) + 1)|0;
  5580. $exitcond20 = ($24|0)==(32);
  5581. if ($exitcond20) {
  5582. break;
  5583. } else {
  5584. $i$018 = $24;$nqpqx$019 = $nqpqx2$14;$nqpqx2$014 = $nqpqx$110;$nqpqz$013 = $nqpqz2$15;$nqpqz2$015 = $nqpqz$13;$nqx$011 = $nqx2$16;$nqx2$016 = $nqx$11;$nqz$012 = $nqz2$17;$nqz2$017 = $nqz$12;
  5585. }
  5586. }
  5587. dest=$resultx+0|0; src=$nqx2$16+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  5588. dest=$resultz+0|0; src=$nqz2$17+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  5589. STACKTOP = sp;return;
  5590. }
  5591. function _crecip($out,$z) {
  5592. $out = $out|0;
  5593. $z = $z|0;
  5594. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $i$33 = 0, $i$42 = 0, $i$51 = 0, $t0 = 0, $t1 = 0, $z11 = 0, $z2 = 0, $z2_100_0 = 0, $z2_10_0 = 0, $z2_20_0 = 0, $z2_50_0 = 0, $z2_5_0 = 0, $z9 = 0, label = 0;
  5595. var sp = 0;
  5596. sp = STACKTOP;
  5597. STACKTOP = STACKTOP + 800|0;
  5598. $z2 = sp + 720|0;
  5599. $z9 = sp + 640|0;
  5600. $z11 = sp + 560|0;
  5601. $z2_5_0 = sp + 480|0;
  5602. $z2_10_0 = sp + 400|0;
  5603. $z2_20_0 = sp + 320|0;
  5604. $z2_50_0 = sp + 240|0;
  5605. $z2_100_0 = sp + 160|0;
  5606. $t0 = sp + 80|0;
  5607. $t1 = sp;
  5608. _fsquare($z2,$z);
  5609. _fsquare($t1,$z2);
  5610. _fsquare($t0,$t1);
  5611. _fmul($z9,$t0,$z);
  5612. _fmul($z11,$z9,$z2);
  5613. _fsquare($t0,$z11);
  5614. _fmul($z2_5_0,$t0,$z9);
  5615. _fsquare($t0,$z2_5_0);
  5616. _fsquare($t1,$t0);
  5617. _fsquare($t0,$t1);
  5618. _fsquare($t1,$t0);
  5619. _fsquare($t0,$t1);
  5620. _fmul($z2_10_0,$t0,$z2_5_0);
  5621. _fsquare($t0,$z2_10_0);
  5622. _fsquare($t1,$t0);
  5623. _fsquare($t0,$t1);
  5624. _fsquare($t1,$t0);
  5625. _fsquare($t0,$t1);
  5626. _fsquare($t1,$t0);
  5627. _fsquare($t0,$t1);
  5628. _fsquare($t1,$t0);
  5629. _fsquare($t0,$t1);
  5630. _fsquare($t1,$t0);
  5631. _fmul($z2_20_0,$t1,$z2_10_0);
  5632. _fsquare($t0,$z2_20_0);
  5633. _fsquare($t1,$t0);
  5634. _fsquare($t0,$t1);
  5635. _fsquare($t1,$t0);
  5636. _fsquare($t0,$t1);
  5637. _fsquare($t1,$t0);
  5638. _fsquare($t0,$t1);
  5639. _fsquare($t1,$t0);
  5640. _fsquare($t0,$t1);
  5641. _fsquare($t1,$t0);
  5642. _fsquare($t0,$t1);
  5643. _fsquare($t1,$t0);
  5644. _fsquare($t0,$t1);
  5645. _fsquare($t1,$t0);
  5646. _fsquare($t0,$t1);
  5647. _fsquare($t1,$t0);
  5648. _fsquare($t0,$t1);
  5649. _fsquare($t1,$t0);
  5650. _fsquare($t0,$t1);
  5651. _fsquare($t1,$t0);
  5652. _fmul($t0,$t1,$z2_20_0);
  5653. _fsquare($t1,$t0);
  5654. _fsquare($t0,$t1);
  5655. _fsquare($t1,$t0);
  5656. _fsquare($t0,$t1);
  5657. _fsquare($t1,$t0);
  5658. _fsquare($t0,$t1);
  5659. _fsquare($t1,$t0);
  5660. _fsquare($t0,$t1);
  5661. _fsquare($t1,$t0);
  5662. _fsquare($t0,$t1);
  5663. _fmul($z2_50_0,$t0,$z2_10_0);
  5664. _fsquare($t0,$z2_50_0);
  5665. _fsquare($t1,$t0);
  5666. $i$33 = 2;
  5667. while(1) {
  5668. _fsquare($t0,$t1);
  5669. _fsquare($t1,$t0);
  5670. $0 = (($i$33) + 2)|0;
  5671. $1 = ($0|0)<(50);
  5672. if ($1) {
  5673. $i$33 = $0;
  5674. } else {
  5675. break;
  5676. }
  5677. }
  5678. _fmul($z2_100_0,$t1,$z2_50_0);
  5679. _fsquare($t1,$z2_100_0);
  5680. _fsquare($t0,$t1);
  5681. $i$42 = 2;
  5682. while(1) {
  5683. _fsquare($t1,$t0);
  5684. _fsquare($t0,$t1);
  5685. $2 = (($i$42) + 2)|0;
  5686. $3 = ($2|0)<(100);
  5687. if ($3) {
  5688. $i$42 = $2;
  5689. } else {
  5690. break;
  5691. }
  5692. }
  5693. _fmul($t1,$t0,$z2_100_0);
  5694. _fsquare($t0,$t1);
  5695. _fsquare($t1,$t0);
  5696. $i$51 = 2;
  5697. while(1) {
  5698. _fsquare($t0,$t1);
  5699. _fsquare($t1,$t0);
  5700. $4 = (($i$51) + 2)|0;
  5701. $5 = ($4|0)<(50);
  5702. if ($5) {
  5703. $i$51 = $4;
  5704. } else {
  5705. break;
  5706. }
  5707. }
  5708. _fmul($t0,$t1,$z2_50_0);
  5709. _fsquare($t1,$t0);
  5710. _fsquare($t0,$t1);
  5711. _fsquare($t1,$t0);
  5712. _fsquare($t0,$t1);
  5713. _fsquare($t1,$t0);
  5714. _fmul($out,$t1,$z11);
  5715. STACKTOP = sp;return;
  5716. }
  5717. function _fmul($output,$in,$in2) {
  5718. $output = $output|0;
  5719. $in = $in|0;
  5720. $in2 = $in2|0;
  5721. var $t = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  5722. sp = STACKTOP;
  5723. STACKTOP = STACKTOP + 160|0;
  5724. $t = sp;
  5725. _fproduct($t,$in,$in2);
  5726. _freduce_degree($t);
  5727. _freduce_coefficients($t);
  5728. dest=$output+0|0; src=$t+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  5729. STACKTOP = sp;return;
  5730. }
  5731. function _fcontract($output,$input_limbs) {
  5732. $output = $output|0;
  5733. $input_limbs = $input_limbs|0;
  5734. var $$pn = 0, $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0;
  5735. var $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0;
  5736. var $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0;
  5737. var $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0;
  5738. var $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0;
  5739. var $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0;
  5740. var $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0;
  5741. var $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0;
  5742. var $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0;
  5743. var $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0;
  5744. var $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0;
  5745. var $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0;
  5746. var $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0;
  5747. var $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0;
  5748. var $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0;
  5749. var $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0;
  5750. var $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0;
  5751. var $403 = 0, $404 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0;
  5752. var $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0;
  5753. var $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0;
  5754. var $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, $exitcond = 0, $exitcond11 = 0, $exitcond11$1 = 0, $exitcond14 = 0, $exitcond14$1 = 0, $i$17 = 0, $i$17$1 = 0, $i$24 = 0, $i$24$1 = 0, $i$33 = 0, $input = 0, $mask$02 = 0, $mask$1 = 0, label = 0;
  5755. var sp = 0;
  5756. sp = STACKTOP;
  5757. STACKTOP = STACKTOP + 48|0;
  5758. $input = sp;
  5759. $0 = $input_limbs;
  5760. $1 = $0;
  5761. $2 = HEAP32[$1>>2]|0;
  5762. $3 = (($0) + 4)|0;
  5763. $4 = $3;
  5764. $5 = HEAP32[$4>>2]|0;
  5765. HEAP32[$input>>2] = $2;
  5766. $6 = (($input_limbs) + 8|0);
  5767. $7 = $6;
  5768. $8 = $7;
  5769. $9 = HEAP32[$8>>2]|0;
  5770. $10 = (($7) + 4)|0;
  5771. $11 = $10;
  5772. $12 = HEAP32[$11>>2]|0;
  5773. $13 = (($input) + 4|0);
  5774. HEAP32[$13>>2] = $9;
  5775. $14 = (($input_limbs) + 16|0);
  5776. $15 = $14;
  5777. $16 = $15;
  5778. $17 = HEAP32[$16>>2]|0;
  5779. $18 = (($15) + 4)|0;
  5780. $19 = $18;
  5781. $20 = HEAP32[$19>>2]|0;
  5782. $21 = (($input) + 8|0);
  5783. HEAP32[$21>>2] = $17;
  5784. $22 = (($input_limbs) + 24|0);
  5785. $23 = $22;
  5786. $24 = $23;
  5787. $25 = HEAP32[$24>>2]|0;
  5788. $26 = (($23) + 4)|0;
  5789. $27 = $26;
  5790. $28 = HEAP32[$27>>2]|0;
  5791. $29 = (($input) + 12|0);
  5792. HEAP32[$29>>2] = $25;
  5793. $30 = (($input_limbs) + 32|0);
  5794. $31 = $30;
  5795. $32 = $31;
  5796. $33 = HEAP32[$32>>2]|0;
  5797. $34 = (($31) + 4)|0;
  5798. $35 = $34;
  5799. $36 = HEAP32[$35>>2]|0;
  5800. $37 = (($input) + 16|0);
  5801. HEAP32[$37>>2] = $33;
  5802. $38 = (($input_limbs) + 40|0);
  5803. $39 = $38;
  5804. $40 = $39;
  5805. $41 = HEAP32[$40>>2]|0;
  5806. $42 = (($39) + 4)|0;
  5807. $43 = $42;
  5808. $44 = HEAP32[$43>>2]|0;
  5809. $45 = (($input) + 20|0);
  5810. HEAP32[$45>>2] = $41;
  5811. $46 = (($input_limbs) + 48|0);
  5812. $47 = $46;
  5813. $48 = $47;
  5814. $49 = HEAP32[$48>>2]|0;
  5815. $50 = (($47) + 4)|0;
  5816. $51 = $50;
  5817. $52 = HEAP32[$51>>2]|0;
  5818. $53 = (($input) + 24|0);
  5819. HEAP32[$53>>2] = $49;
  5820. $54 = (($input_limbs) + 56|0);
  5821. $55 = $54;
  5822. $56 = $55;
  5823. $57 = HEAP32[$56>>2]|0;
  5824. $58 = (($55) + 4)|0;
  5825. $59 = $58;
  5826. $60 = HEAP32[$59>>2]|0;
  5827. $61 = (($input) + 28|0);
  5828. HEAP32[$61>>2] = $57;
  5829. $62 = (($input_limbs) + 64|0);
  5830. $63 = $62;
  5831. $64 = $63;
  5832. $65 = HEAP32[$64>>2]|0;
  5833. $66 = (($63) + 4)|0;
  5834. $67 = $66;
  5835. $68 = HEAP32[$67>>2]|0;
  5836. $69 = (($input) + 32|0);
  5837. HEAP32[$69>>2] = $65;
  5838. $70 = (($input_limbs) + 72|0);
  5839. $71 = $70;
  5840. $72 = $71;
  5841. $73 = HEAP32[$72>>2]|0;
  5842. $74 = (($71) + 4)|0;
  5843. $75 = $74;
  5844. $76 = HEAP32[$75>>2]|0;
  5845. $77 = (($input) + 36|0);
  5846. HEAP32[$77>>2] = $73;
  5847. $78 = (($input) + 36|0);
  5848. $i$17 = 0;
  5849. while(1) {
  5850. $79 = $i$17 & 1;
  5851. $80 = ($79|0)==(0);
  5852. $81 = (($input) + ($i$17<<2)|0);
  5853. $82 = HEAP32[$81>>2]|0;
  5854. $83 = $82 >> 31;
  5855. $84 = $83 & $82;
  5856. if ($80) {
  5857. $92 = $84 >> 26;
  5858. $93 = Math_imul($92, -67108864)|0;
  5859. $94 = (($93) + ($82))|0;
  5860. HEAP32[$81>>2] = $94;
  5861. $95 = (($i$17) + 1)|0;
  5862. $96 = (($input) + ($95<<2)|0);
  5863. $97 = HEAP32[$96>>2]|0;
  5864. $98 = (($97) + ($92))|0;
  5865. HEAP32[$96>>2] = $98;
  5866. } else {
  5867. $85 = $84 >> 25;
  5868. $86 = Math_imul($85, -33554432)|0;
  5869. $87 = (($86) + ($82))|0;
  5870. HEAP32[$81>>2] = $87;
  5871. $88 = (($i$17) + 1)|0;
  5872. $89 = (($input) + ($88<<2)|0);
  5873. $90 = HEAP32[$89>>2]|0;
  5874. $91 = (($90) + ($85))|0;
  5875. HEAP32[$89>>2] = $91;
  5876. }
  5877. $99 = (($i$17) + 1)|0;
  5878. $exitcond14 = ($99|0)==(9);
  5879. if ($exitcond14) {
  5880. break;
  5881. } else {
  5882. $i$17 = $99;
  5883. }
  5884. }
  5885. $100 = HEAP32[$78>>2]|0;
  5886. $101 = $100 >> 31;
  5887. $102 = $101 & $100;
  5888. $103 = $102 >> 25;
  5889. $104 = Math_imul($103, -33554432)|0;
  5890. $105 = (($104) + ($100))|0;
  5891. HEAP32[$78>>2] = $105;
  5892. $106 = HEAP32[$input>>2]|0;
  5893. $107 = ($103*19)|0;
  5894. $108 = (($107) + ($106))|0;
  5895. HEAP32[$input>>2] = $108;
  5896. $i$17$1 = 0;
  5897. while(1) {
  5898. $384 = $i$17$1 & 1;
  5899. $385 = ($384|0)==(0);
  5900. $386 = (($input) + ($i$17$1<<2)|0);
  5901. $387 = HEAP32[$386>>2]|0;
  5902. $388 = $387 >> 31;
  5903. $389 = $388 & $387;
  5904. if ($385) {
  5905. $397 = $389 >> 26;
  5906. $398 = Math_imul($397, -67108864)|0;
  5907. $399 = (($398) + ($387))|0;
  5908. HEAP32[$386>>2] = $399;
  5909. $400 = (($i$17$1) + 1)|0;
  5910. $401 = (($input) + ($400<<2)|0);
  5911. $402 = HEAP32[$401>>2]|0;
  5912. $403 = (($402) + ($397))|0;
  5913. HEAP32[$401>>2] = $403;
  5914. } else {
  5915. $390 = $389 >> 25;
  5916. $391 = Math_imul($390, -33554432)|0;
  5917. $392 = (($391) + ($387))|0;
  5918. HEAP32[$386>>2] = $392;
  5919. $393 = (($i$17$1) + 1)|0;
  5920. $394 = (($input) + ($393<<2)|0);
  5921. $395 = HEAP32[$394>>2]|0;
  5922. $396 = (($395) + ($390))|0;
  5923. HEAP32[$394>>2] = $396;
  5924. }
  5925. $404 = (($i$17$1) + 1)|0;
  5926. $exitcond14$1 = ($404|0)==(9);
  5927. if ($exitcond14$1) {
  5928. break;
  5929. } else {
  5930. $i$17$1 = $404;
  5931. }
  5932. }
  5933. $109 = HEAP32[$78>>2]|0;
  5934. $110 = $109 >> 31;
  5935. $111 = $110 & $109;
  5936. $112 = $111 >> 25;
  5937. $113 = Math_imul($112, -33554432)|0;
  5938. $114 = (($113) + ($109))|0;
  5939. HEAP32[$78>>2] = $114;
  5940. $115 = HEAP32[$input>>2]|0;
  5941. $116 = ($112*19)|0;
  5942. $117 = (($116) + ($115))|0;
  5943. $118 = $117 >> 31;
  5944. $119 = $118 & $117;
  5945. $120 = $119 >> 26;
  5946. $121 = Math_imul($120, -67108864)|0;
  5947. $122 = (($121) + ($117))|0;
  5948. HEAP32[$input>>2] = $122;
  5949. $123 = (($input) + 4|0);
  5950. $124 = HEAP32[$123>>2]|0;
  5951. $125 = (($120) + ($124))|0;
  5952. HEAP32[$123>>2] = $125;
  5953. $126 = (($input) + 36|0);
  5954. $i$24 = 0;
  5955. while(1) {
  5956. $127 = $i$24 & 1;
  5957. $128 = ($127|0)==(0);
  5958. $129 = (($input) + ($i$24<<2)|0);
  5959. $130 = HEAP32[$129>>2]|0;
  5960. if ($128) {
  5961. $137 = $130 >> 26;
  5962. $138 = $130 & 67108863;
  5963. HEAP32[$129>>2] = $138;
  5964. $139 = (($i$24) + 1)|0;
  5965. $140 = (($input) + ($139<<2)|0);
  5966. $141 = HEAP32[$140>>2]|0;
  5967. $142 = (($141) + ($137))|0;
  5968. HEAP32[$140>>2] = $142;
  5969. } else {
  5970. $131 = $130 >> 25;
  5971. $132 = $130 & 33554431;
  5972. HEAP32[$129>>2] = $132;
  5973. $133 = (($i$24) + 1)|0;
  5974. $134 = (($input) + ($133<<2)|0);
  5975. $135 = HEAP32[$134>>2]|0;
  5976. $136 = (($135) + ($131))|0;
  5977. HEAP32[$134>>2] = $136;
  5978. }
  5979. $143 = (($i$24) + 1)|0;
  5980. $exitcond11 = ($143|0)==(9);
  5981. if ($exitcond11) {
  5982. break;
  5983. } else {
  5984. $i$24 = $143;
  5985. }
  5986. }
  5987. $144 = HEAP32[$126>>2]|0;
  5988. $145 = $144 >> 25;
  5989. $146 = $144 & 33554431;
  5990. HEAP32[$126>>2] = $146;
  5991. $147 = ($145*19)|0;
  5992. $148 = HEAP32[$input>>2]|0;
  5993. $149 = (($147) + ($148))|0;
  5994. HEAP32[$input>>2] = $149;
  5995. $i$24$1 = 0;
  5996. while(1) {
  5997. $360 = $i$24$1 & 1;
  5998. $361 = ($360|0)==(0);
  5999. $362 = (($input) + ($i$24$1<<2)|0);
  6000. $363 = HEAP32[$362>>2]|0;
  6001. if ($361) {
  6002. $370 = $363 >> 26;
  6003. $371 = $363 & 67108863;
  6004. HEAP32[$362>>2] = $371;
  6005. $372 = (($i$24$1) + 1)|0;
  6006. $373 = (($input) + ($372<<2)|0);
  6007. $374 = HEAP32[$373>>2]|0;
  6008. $375 = (($374) + ($370))|0;
  6009. HEAP32[$373>>2] = $375;
  6010. } else {
  6011. $364 = $363 >> 25;
  6012. $365 = $363 & 33554431;
  6013. HEAP32[$362>>2] = $365;
  6014. $366 = (($i$24$1) + 1)|0;
  6015. $367 = (($input) + ($366<<2)|0);
  6016. $368 = HEAP32[$367>>2]|0;
  6017. $369 = (($368) + ($364))|0;
  6018. HEAP32[$367>>2] = $369;
  6019. }
  6020. $376 = (($i$24$1) + 1)|0;
  6021. $exitcond11$1 = ($376|0)==(9);
  6022. if ($exitcond11$1) {
  6023. break;
  6024. } else {
  6025. $i$24$1 = $376;
  6026. }
  6027. }
  6028. $377 = HEAP32[$126>>2]|0;
  6029. $378 = $377 >> 25;
  6030. $379 = $377 & 33554431;
  6031. HEAP32[$126>>2] = $379;
  6032. $380 = ($378*19)|0;
  6033. $381 = HEAP32[$input>>2]|0;
  6034. $382 = (($380) + ($381))|0;
  6035. HEAP32[$input>>2] = $382;
  6036. $383 = (_s32_gte($382)|0);
  6037. $i$33 = 1;$mask$02 = $383;
  6038. while(1) {
  6039. $150 = $i$33 & 1;
  6040. $151 = ($150|0)==(0);
  6041. $152 = (($input) + ($i$33<<2)|0);
  6042. $153 = HEAP32[$152>>2]|0;
  6043. if ($151) {
  6044. $155 = (_s32_eq($153,67108863)|0);
  6045. $$pn = $155;
  6046. } else {
  6047. $154 = (_s32_eq($153,33554431)|0);
  6048. $$pn = $154;
  6049. }
  6050. $mask$1 = $$pn & $mask$02;
  6051. $156 = (($i$33) + 1)|0;
  6052. $exitcond = ($156|0)==(10);
  6053. if ($exitcond) {
  6054. break;
  6055. } else {
  6056. $i$33 = $156;$mask$02 = $mask$1;
  6057. }
  6058. }
  6059. $157 = $mask$1 & 67108845;
  6060. $158 = HEAP32[$input>>2]|0;
  6061. $159 = (($158) - ($157))|0;
  6062. HEAP32[$input>>2] = $159;
  6063. $160 = $mask$1 & 67108863;
  6064. $161 = $mask$1 & 33554431;
  6065. $162 = (($input) + 4|0);
  6066. $163 = HEAP32[$162>>2]|0;
  6067. $164 = (($163) - ($161))|0;
  6068. HEAP32[$162>>2] = $164;
  6069. $165 = (($input) + 8|0);
  6070. $166 = HEAP32[$165>>2]|0;
  6071. $167 = (($166) - ($160))|0;
  6072. HEAP32[$165>>2] = $167;
  6073. $168 = (($input) + 12|0);
  6074. $169 = HEAP32[$168>>2]|0;
  6075. $170 = (($169) - ($161))|0;
  6076. HEAP32[$168>>2] = $170;
  6077. $171 = (($input) + 16|0);
  6078. $172 = HEAP32[$171>>2]|0;
  6079. $173 = (($172) - ($160))|0;
  6080. HEAP32[$171>>2] = $173;
  6081. $174 = (($input) + 20|0);
  6082. $175 = HEAP32[$174>>2]|0;
  6083. $176 = (($175) - ($161))|0;
  6084. HEAP32[$174>>2] = $176;
  6085. $177 = (($input) + 24|0);
  6086. $178 = HEAP32[$177>>2]|0;
  6087. $179 = (($178) - ($160))|0;
  6088. HEAP32[$177>>2] = $179;
  6089. $180 = (($input) + 28|0);
  6090. $181 = HEAP32[$180>>2]|0;
  6091. $182 = (($181) - ($161))|0;
  6092. HEAP32[$180>>2] = $182;
  6093. $183 = (($input) + 32|0);
  6094. $184 = HEAP32[$183>>2]|0;
  6095. $185 = (($184) - ($160))|0;
  6096. HEAP32[$183>>2] = $185;
  6097. $186 = (($input) + 36|0);
  6098. $187 = HEAP32[$186>>2]|0;
  6099. $188 = (($187) - ($161))|0;
  6100. HEAP32[$186>>2] = $188;
  6101. $189 = HEAP32[$123>>2]|0;
  6102. $190 = $189 << 2;
  6103. HEAP32[$123>>2] = $190;
  6104. $191 = (($input) + 8|0);
  6105. $192 = HEAP32[$191>>2]|0;
  6106. $193 = $192 << 3;
  6107. HEAP32[$191>>2] = $193;
  6108. $194 = (($input) + 12|0);
  6109. $195 = HEAP32[$194>>2]|0;
  6110. $196 = $195 << 5;
  6111. HEAP32[$194>>2] = $196;
  6112. $197 = (($input) + 16|0);
  6113. $198 = HEAP32[$197>>2]|0;
  6114. $199 = $198 << 6;
  6115. HEAP32[$197>>2] = $199;
  6116. $200 = (($input) + 24|0);
  6117. $201 = HEAP32[$200>>2]|0;
  6118. $202 = $201 << 1;
  6119. HEAP32[$200>>2] = $202;
  6120. $203 = (($input) + 28|0);
  6121. $204 = HEAP32[$203>>2]|0;
  6122. $205 = $204 << 3;
  6123. HEAP32[$203>>2] = $205;
  6124. $206 = (($input) + 32|0);
  6125. $207 = HEAP32[$206>>2]|0;
  6126. $208 = $207 << 4;
  6127. HEAP32[$206>>2] = $208;
  6128. $209 = (($input) + 36|0);
  6129. $210 = HEAP32[$209>>2]|0;
  6130. $211 = $210 << 6;
  6131. HEAP32[$209>>2] = $211;
  6132. HEAP8[$output>>0] = 0;
  6133. $212 = (($output) + 16|0);
  6134. HEAP8[$212>>0] = 0;
  6135. $213 = HEAP32[$input>>2]|0;
  6136. $214 = HEAP8[$output>>0]|0;
  6137. $215 = $214&255;
  6138. $216 = $215 | $213;
  6139. $217 = $216&255;
  6140. HEAP8[$output>>0] = $217;
  6141. $218 = HEAP32[$input>>2]|0;
  6142. $219 = $218 >>> 8;
  6143. $220 = $219&255;
  6144. $221 = (($output) + 1|0);
  6145. HEAP8[$221>>0] = $220;
  6146. $222 = HEAP32[$input>>2]|0;
  6147. $223 = $222 >>> 16;
  6148. $224 = $223&255;
  6149. $225 = (($output) + 2|0);
  6150. HEAP8[$225>>0] = $224;
  6151. $226 = HEAP32[$input>>2]|0;
  6152. $227 = $226 >>> 24;
  6153. $228 = (($output) + 3|0);
  6154. $229 = HEAP32[$123>>2]|0;
  6155. $230 = $227 | $229;
  6156. $231 = $230&255;
  6157. HEAP8[$228>>0] = $231;
  6158. $232 = HEAP32[$123>>2]|0;
  6159. $233 = $232 >>> 8;
  6160. $234 = $233&255;
  6161. $235 = (($output) + 4|0);
  6162. HEAP8[$235>>0] = $234;
  6163. $236 = HEAP32[$123>>2]|0;
  6164. $237 = $236 >>> 16;
  6165. $238 = $237&255;
  6166. $239 = (($output) + 5|0);
  6167. HEAP8[$239>>0] = $238;
  6168. $240 = HEAP32[$123>>2]|0;
  6169. $241 = $240 >>> 24;
  6170. $242 = (($output) + 6|0);
  6171. $243 = HEAP32[$191>>2]|0;
  6172. $244 = $241 | $243;
  6173. $245 = $244&255;
  6174. HEAP8[$242>>0] = $245;
  6175. $246 = HEAP32[$191>>2]|0;
  6176. $247 = $246 >>> 8;
  6177. $248 = $247&255;
  6178. $249 = (($output) + 7|0);
  6179. HEAP8[$249>>0] = $248;
  6180. $250 = HEAP32[$191>>2]|0;
  6181. $251 = $250 >>> 16;
  6182. $252 = $251&255;
  6183. $253 = (($output) + 8|0);
  6184. HEAP8[$253>>0] = $252;
  6185. $254 = HEAP32[$191>>2]|0;
  6186. $255 = $254 >>> 24;
  6187. $256 = (($output) + 9|0);
  6188. $257 = HEAP32[$194>>2]|0;
  6189. $258 = $255 | $257;
  6190. $259 = $258&255;
  6191. HEAP8[$256>>0] = $259;
  6192. $260 = HEAP32[$194>>2]|0;
  6193. $261 = $260 >>> 8;
  6194. $262 = $261&255;
  6195. $263 = (($output) + 10|0);
  6196. HEAP8[$263>>0] = $262;
  6197. $264 = HEAP32[$194>>2]|0;
  6198. $265 = $264 >>> 16;
  6199. $266 = $265&255;
  6200. $267 = (($output) + 11|0);
  6201. HEAP8[$267>>0] = $266;
  6202. $268 = HEAP32[$194>>2]|0;
  6203. $269 = $268 >>> 24;
  6204. $270 = (($output) + 12|0);
  6205. $271 = HEAP32[$197>>2]|0;
  6206. $272 = $269 | $271;
  6207. $273 = $272&255;
  6208. HEAP8[$270>>0] = $273;
  6209. $274 = HEAP32[$197>>2]|0;
  6210. $275 = $274 >>> 8;
  6211. $276 = $275&255;
  6212. $277 = (($output) + 13|0);
  6213. HEAP8[$277>>0] = $276;
  6214. $278 = HEAP32[$197>>2]|0;
  6215. $279 = $278 >>> 16;
  6216. $280 = $279&255;
  6217. $281 = (($output) + 14|0);
  6218. HEAP8[$281>>0] = $280;
  6219. $282 = HEAP32[$197>>2]|0;
  6220. $283 = $282 >>> 24;
  6221. $284 = $283&255;
  6222. $285 = (($output) + 15|0);
  6223. HEAP8[$285>>0] = $284;
  6224. $286 = (($input) + 20|0);
  6225. $287 = HEAP32[$286>>2]|0;
  6226. $288 = HEAP8[$212>>0]|0;
  6227. $289 = $288&255;
  6228. $290 = $289 | $287;
  6229. $291 = $290&255;
  6230. HEAP8[$212>>0] = $291;
  6231. $292 = HEAP32[$286>>2]|0;
  6232. $293 = $292 >>> 8;
  6233. $294 = $293&255;
  6234. $295 = (($output) + 17|0);
  6235. HEAP8[$295>>0] = $294;
  6236. $296 = HEAP32[$286>>2]|0;
  6237. $297 = $296 >>> 16;
  6238. $298 = $297&255;
  6239. $299 = (($output) + 18|0);
  6240. HEAP8[$299>>0] = $298;
  6241. $300 = HEAP32[$286>>2]|0;
  6242. $301 = $300 >>> 24;
  6243. $302 = (($output) + 19|0);
  6244. $303 = HEAP32[$200>>2]|0;
  6245. $304 = $301 | $303;
  6246. $305 = $304&255;
  6247. HEAP8[$302>>0] = $305;
  6248. $306 = HEAP32[$200>>2]|0;
  6249. $307 = $306 >>> 8;
  6250. $308 = $307&255;
  6251. $309 = (($output) + 20|0);
  6252. HEAP8[$309>>0] = $308;
  6253. $310 = HEAP32[$200>>2]|0;
  6254. $311 = $310 >>> 16;
  6255. $312 = $311&255;
  6256. $313 = (($output) + 21|0);
  6257. HEAP8[$313>>0] = $312;
  6258. $314 = HEAP32[$200>>2]|0;
  6259. $315 = $314 >>> 24;
  6260. $316 = (($output) + 22|0);
  6261. $317 = HEAP32[$203>>2]|0;
  6262. $318 = $315 | $317;
  6263. $319 = $318&255;
  6264. HEAP8[$316>>0] = $319;
  6265. $320 = HEAP32[$203>>2]|0;
  6266. $321 = $320 >>> 8;
  6267. $322 = $321&255;
  6268. $323 = (($output) + 23|0);
  6269. HEAP8[$323>>0] = $322;
  6270. $324 = HEAP32[$203>>2]|0;
  6271. $325 = $324 >>> 16;
  6272. $326 = $325&255;
  6273. $327 = (($output) + 24|0);
  6274. HEAP8[$327>>0] = $326;
  6275. $328 = HEAP32[$203>>2]|0;
  6276. $329 = $328 >>> 24;
  6277. $330 = (($output) + 25|0);
  6278. $331 = HEAP32[$206>>2]|0;
  6279. $332 = $329 | $331;
  6280. $333 = $332&255;
  6281. HEAP8[$330>>0] = $333;
  6282. $334 = HEAP32[$206>>2]|0;
  6283. $335 = $334 >>> 8;
  6284. $336 = $335&255;
  6285. $337 = (($output) + 26|0);
  6286. HEAP8[$337>>0] = $336;
  6287. $338 = HEAP32[$206>>2]|0;
  6288. $339 = $338 >>> 16;
  6289. $340 = $339&255;
  6290. $341 = (($output) + 27|0);
  6291. HEAP8[$341>>0] = $340;
  6292. $342 = HEAP32[$206>>2]|0;
  6293. $343 = $342 >>> 24;
  6294. $344 = (($output) + 28|0);
  6295. $345 = HEAP32[$209>>2]|0;
  6296. $346 = $343 | $345;
  6297. $347 = $346&255;
  6298. HEAP8[$344>>0] = $347;
  6299. $348 = HEAP32[$209>>2]|0;
  6300. $349 = $348 >>> 8;
  6301. $350 = $349&255;
  6302. $351 = (($output) + 29|0);
  6303. HEAP8[$351>>0] = $350;
  6304. $352 = HEAP32[$209>>2]|0;
  6305. $353 = $352 >>> 16;
  6306. $354 = $353&255;
  6307. $355 = (($output) + 30|0);
  6308. HEAP8[$355>>0] = $354;
  6309. $356 = HEAP32[$209>>2]|0;
  6310. $357 = $356 >>> 24;
  6311. $358 = $357&255;
  6312. $359 = (($output) + 31|0);
  6313. HEAP8[$359>>0] = $358;
  6314. STACKTOP = sp;return;
  6315. }
  6316. function _swap_conditional($a,$b,$0,$1) {
  6317. $a = $a|0;
  6318. $b = $b|0;
  6319. $0 = $0|0;
  6320. $1 = $1|0;
  6321. var $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  6322. var $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0;
  6323. var $9 = 0, $exitcond = 0, $i$02 = 0, label = 0, sp = 0;
  6324. sp = STACKTOP;
  6325. $2 = (_i64Subtract(0,0,($0|0),($1|0))|0);
  6326. $3 = tempRet0;
  6327. $i$02 = 0;
  6328. while(1) {
  6329. $4 = (($a) + ($i$02<<3)|0);
  6330. $5 = $4;
  6331. $6 = $5;
  6332. $7 = HEAP32[$6>>2]|0;
  6333. $8 = (($5) + 4)|0;
  6334. $9 = $8;
  6335. $10 = HEAP32[$9>>2]|0;
  6336. $11 = (($b) + ($i$02<<3)|0);
  6337. $12 = $11;
  6338. $13 = $12;
  6339. $14 = HEAP32[$13>>2]|0;
  6340. $15 = (($12) + 4)|0;
  6341. $16 = $15;
  6342. $17 = HEAP32[$16>>2]|0;
  6343. $18 = $14 ^ $7;
  6344. $19 = $17 ^ $10;
  6345. $20 = $18 & $2;
  6346. $21 = $19 & $3;
  6347. $22 = $20 ^ $7;
  6348. $21 ^ $10;
  6349. $23 = (_bitshift64Ashr(0,($22|0),32)|0);
  6350. $24 = tempRet0;
  6351. $25 = $4;
  6352. $26 = $25;
  6353. HEAP32[$26>>2] = $23;
  6354. $27 = (($25) + 4)|0;
  6355. $28 = $27;
  6356. HEAP32[$28>>2] = $24;
  6357. $29 = $11;
  6358. $30 = $29;
  6359. $31 = HEAP32[$30>>2]|0;
  6360. $32 = (($29) + 4)|0;
  6361. $33 = $32;
  6362. $34 = HEAP32[$33>>2]|0;
  6363. $35 = $20 ^ $31;
  6364. $21 ^ $34;
  6365. $36 = (_bitshift64Ashr(0,($35|0),32)|0);
  6366. $37 = tempRet0;
  6367. $38 = $11;
  6368. $39 = $38;
  6369. HEAP32[$39>>2] = $36;
  6370. $40 = (($38) + 4)|0;
  6371. $41 = $40;
  6372. HEAP32[$41>>2] = $37;
  6373. $42 = (($i$02) + 1)|0;
  6374. $exitcond = ($42|0)==(10);
  6375. if ($exitcond) {
  6376. break;
  6377. } else {
  6378. $i$02 = $42;
  6379. }
  6380. }
  6381. STACKTOP = sp;return;
  6382. }
  6383. function _fmonty($x2,$z2,$x3,$z3,$x,$z,$xprime,$zprime,$qmqp) {
  6384. $x2 = $x2|0;
  6385. $z2 = $z2|0;
  6386. $x3 = $x3|0;
  6387. $z3 = $z3|0;
  6388. $x = $x|0;
  6389. $z = $z|0;
  6390. $xprime = $xprime|0;
  6391. $zprime = $zprime|0;
  6392. $qmqp = $qmqp|0;
  6393. var $0 = 0, $origx = 0, $origxprime = 0, $xx = 0, $xxprime = 0, $xxxprime = 0, $zz = 0, $zzprime = 0, $zzz = 0, $zzzprime = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  6394. sp = STACKTOP;
  6395. STACKTOP = STACKTOP + 1232|0;
  6396. $origx = sp + 1144|0;
  6397. $origxprime = sp + 1064|0;
  6398. $zzz = sp + 912|0;
  6399. $xx = sp + 760|0;
  6400. $zz = sp + 608|0;
  6401. $xxprime = sp + 456|0;
  6402. $zzprime = sp + 304|0;
  6403. $zzzprime = sp + 152|0;
  6404. $xxxprime = sp;
  6405. dest=$origx+0|0; src=$x+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6406. _fsum($x,$z);
  6407. _fdifference($z,$origx);
  6408. dest=$origxprime+0|0; src=$xprime+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6409. _fsum($xprime,$zprime);
  6410. _fdifference($zprime,$origxprime);
  6411. _fproduct($xxprime,$xprime,$z);
  6412. _fproduct($zzprime,$x,$zprime);
  6413. _freduce_degree($xxprime);
  6414. _freduce_coefficients($xxprime);
  6415. _freduce_degree($zzprime);
  6416. _freduce_coefficients($zzprime);
  6417. dest=$origxprime+0|0; src=$xxprime+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6418. _fsum($xxprime,$zzprime);
  6419. _fdifference($zzprime,$origxprime);
  6420. _fsquare($xxxprime,$xxprime);
  6421. _fsquare($zzzprime,$zzprime);
  6422. _fproduct($zzprime,$zzzprime,$qmqp);
  6423. _freduce_degree($zzprime);
  6424. _freduce_coefficients($zzprime);
  6425. dest=$x3+0|0; src=$xxxprime+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6426. dest=$z3+0|0; src=$zzprime+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6427. _fsquare($xx,$x);
  6428. _fsquare($zz,$z);
  6429. _fproduct($x2,$xx,$zz);
  6430. _freduce_degree($x2);
  6431. _freduce_coefficients($x2);
  6432. _fdifference($zz,$xx);
  6433. $0 = (($zzz) + 80|0);
  6434. dest=$0+0|0; stop=dest+72|0; do { HEAP32[dest>>2]=0|0; dest=dest+4|0; } while ((dest|0) < (stop|0));
  6435. _fscalar_product($zzz,$zz);
  6436. _freduce_coefficients($zzz);
  6437. _fsum($zzz,$xx);
  6438. _fproduct($z2,$zz,$zzz);
  6439. _freduce_degree($z2);
  6440. _freduce_coefficients($z2);
  6441. STACKTOP = sp;return;
  6442. }
  6443. function _fsquare($output,$in) {
  6444. $output = $output|0;
  6445. $in = $in|0;
  6446. var $t = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  6447. sp = STACKTOP;
  6448. STACKTOP = STACKTOP + 160|0;
  6449. $t = sp;
  6450. _fsquare_inner($t,$in);
  6451. _freduce_degree($t);
  6452. _freduce_coefficients($t);
  6453. dest=$output+0|0; src=$t+0|0; stop=dest+80|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  6454. STACKTOP = sp;return;
  6455. }
  6456. function _fproduct($output,$in2,$in) {
  6457. $output = $output|0;
  6458. $in2 = $in2|0;
  6459. $in = $in|0;
  6460. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0, $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0;
  6461. var $1015 = 0, $1016 = 0, $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0, $1021 = 0, $1022 = 0, $1023 = 0, $1024 = 0, $1025 = 0, $1026 = 0, $1027 = 0, $1028 = 0, $1029 = 0, $103 = 0, $1030 = 0, $1031 = 0, $1032 = 0;
  6462. var $1033 = 0, $1034 = 0, $1035 = 0, $1036 = 0, $1037 = 0, $1038 = 0, $1039 = 0, $104 = 0, $1040 = 0, $1041 = 0, $1042 = 0, $1043 = 0, $1044 = 0, $1045 = 0, $1046 = 0, $1047 = 0, $1048 = 0, $1049 = 0, $105 = 0, $1050 = 0;
  6463. var $1051 = 0, $1052 = 0, $1053 = 0, $1054 = 0, $1055 = 0, $1056 = 0, $1057 = 0, $1058 = 0, $1059 = 0, $106 = 0, $1060 = 0, $1061 = 0, $1062 = 0, $1063 = 0, $1064 = 0, $1065 = 0, $1066 = 0, $1067 = 0, $1068 = 0, $1069 = 0;
  6464. var $107 = 0, $1070 = 0, $1071 = 0, $1072 = 0, $1073 = 0, $1074 = 0, $1075 = 0, $1076 = 0, $1077 = 0, $1078 = 0, $1079 = 0, $108 = 0, $1080 = 0, $1081 = 0, $1082 = 0, $1083 = 0, $1084 = 0, $1085 = 0, $1086 = 0, $1087 = 0;
  6465. var $1088 = 0, $1089 = 0, $109 = 0, $1090 = 0, $1091 = 0, $1092 = 0, $1093 = 0, $1094 = 0, $1095 = 0, $1096 = 0, $1097 = 0, $1098 = 0, $1099 = 0, $11 = 0, $110 = 0, $1100 = 0, $1101 = 0, $1102 = 0, $1103 = 0, $1104 = 0;
  6466. var $1105 = 0, $1106 = 0, $1107 = 0, $1108 = 0, $1109 = 0, $111 = 0, $1110 = 0, $1111 = 0, $1112 = 0, $1113 = 0, $1114 = 0, $1115 = 0, $1116 = 0, $1117 = 0, $1118 = 0, $1119 = 0, $112 = 0, $1120 = 0, $1121 = 0, $1122 = 0;
  6467. var $1123 = 0, $1124 = 0, $1125 = 0, $1126 = 0, $1127 = 0, $1128 = 0, $1129 = 0, $113 = 0, $1130 = 0, $1131 = 0, $1132 = 0, $1133 = 0, $1134 = 0, $1135 = 0, $1136 = 0, $1137 = 0, $1138 = 0, $1139 = 0, $114 = 0, $1140 = 0;
  6468. var $1141 = 0, $1142 = 0, $1143 = 0, $1144 = 0, $1145 = 0, $1146 = 0, $1147 = 0, $1148 = 0, $1149 = 0, $115 = 0, $1150 = 0, $1151 = 0, $1152 = 0, $1153 = 0, $1154 = 0, $1155 = 0, $1156 = 0, $1157 = 0, $1158 = 0, $1159 = 0;
  6469. var $116 = 0, $1160 = 0, $1161 = 0, $1162 = 0, $1163 = 0, $1164 = 0, $1165 = 0, $1166 = 0, $1167 = 0, $1168 = 0, $1169 = 0, $117 = 0, $1170 = 0, $1171 = 0, $1172 = 0, $1173 = 0, $1174 = 0, $1175 = 0, $1176 = 0, $1177 = 0;
  6470. var $1178 = 0, $1179 = 0, $118 = 0, $1180 = 0, $1181 = 0, $1182 = 0, $1183 = 0, $1184 = 0, $1185 = 0, $1186 = 0, $1187 = 0, $1188 = 0, $1189 = 0, $119 = 0, $1190 = 0, $1191 = 0, $1192 = 0, $1193 = 0, $1194 = 0, $1195 = 0;
  6471. var $1196 = 0, $1197 = 0, $1198 = 0, $1199 = 0, $12 = 0, $120 = 0, $1200 = 0, $1201 = 0, $1202 = 0, $1203 = 0, $1204 = 0, $1205 = 0, $1206 = 0, $1207 = 0, $1208 = 0, $1209 = 0, $121 = 0, $1210 = 0, $1211 = 0, $1212 = 0;
  6472. var $1213 = 0, $1214 = 0, $1215 = 0, $1216 = 0, $1217 = 0, $1218 = 0, $1219 = 0, $122 = 0, $1220 = 0, $1221 = 0, $1222 = 0, $1223 = 0, $1224 = 0, $1225 = 0, $1226 = 0, $1227 = 0, $1228 = 0, $1229 = 0, $123 = 0, $1230 = 0;
  6473. var $1231 = 0, $1232 = 0, $1233 = 0, $1234 = 0, $1235 = 0, $1236 = 0, $1237 = 0, $1238 = 0, $1239 = 0, $124 = 0, $1240 = 0, $1241 = 0, $1242 = 0, $1243 = 0, $1244 = 0, $1245 = 0, $1246 = 0, $1247 = 0, $1248 = 0, $1249 = 0;
  6474. var $125 = 0, $1250 = 0, $1251 = 0, $1252 = 0, $1253 = 0, $1254 = 0, $1255 = 0, $1256 = 0, $1257 = 0, $1258 = 0, $1259 = 0, $126 = 0, $1260 = 0, $1261 = 0, $1262 = 0, $1263 = 0, $1264 = 0, $1265 = 0, $1266 = 0, $1267 = 0;
  6475. var $1268 = 0, $1269 = 0, $127 = 0, $1270 = 0, $1271 = 0, $1272 = 0, $1273 = 0, $1274 = 0, $1275 = 0, $1276 = 0, $1277 = 0, $1278 = 0, $1279 = 0, $128 = 0, $1280 = 0, $1281 = 0, $1282 = 0, $1283 = 0, $1284 = 0, $1285 = 0;
  6476. var $1286 = 0, $1287 = 0, $1288 = 0, $1289 = 0, $129 = 0, $1290 = 0, $1291 = 0, $1292 = 0, $1293 = 0, $1294 = 0, $1295 = 0, $1296 = 0, $1297 = 0, $1298 = 0, $1299 = 0, $13 = 0, $130 = 0, $1300 = 0, $1301 = 0, $1302 = 0;
  6477. var $1303 = 0, $1304 = 0, $1305 = 0, $1306 = 0, $1307 = 0, $1308 = 0, $1309 = 0, $131 = 0, $1310 = 0, $1311 = 0, $1312 = 0, $1313 = 0, $1314 = 0, $1315 = 0, $1316 = 0, $1317 = 0, $1318 = 0, $1319 = 0, $132 = 0, $1320 = 0;
  6478. var $1321 = 0, $1322 = 0, $1323 = 0, $1324 = 0, $1325 = 0, $1326 = 0, $1327 = 0, $1328 = 0, $1329 = 0, $133 = 0, $1330 = 0, $1331 = 0, $1332 = 0, $1333 = 0, $1334 = 0, $1335 = 0, $1336 = 0, $1337 = 0, $1338 = 0, $1339 = 0;
  6479. var $134 = 0, $1340 = 0, $1341 = 0, $1342 = 0, $1343 = 0, $1344 = 0, $1345 = 0, $1346 = 0, $1347 = 0, $1348 = 0, $1349 = 0, $135 = 0, $1350 = 0, $1351 = 0, $1352 = 0, $1353 = 0, $1354 = 0, $1355 = 0, $1356 = 0, $1357 = 0;
  6480. var $1358 = 0, $1359 = 0, $136 = 0, $1360 = 0, $1361 = 0, $1362 = 0, $1363 = 0, $1364 = 0, $1365 = 0, $1366 = 0, $1367 = 0, $1368 = 0, $1369 = 0, $137 = 0, $1370 = 0, $1371 = 0, $1372 = 0, $1373 = 0, $1374 = 0, $1375 = 0;
  6481. var $1376 = 0, $1377 = 0, $1378 = 0, $1379 = 0, $138 = 0, $1380 = 0, $1381 = 0, $1382 = 0, $1383 = 0, $1384 = 0, $1385 = 0, $1386 = 0, $1387 = 0, $1388 = 0, $1389 = 0, $139 = 0, $1390 = 0, $1391 = 0, $1392 = 0, $1393 = 0;
  6482. var $1394 = 0, $1395 = 0, $1396 = 0, $1397 = 0, $1398 = 0, $1399 = 0, $14 = 0, $140 = 0, $1400 = 0, $1401 = 0, $1402 = 0, $1403 = 0, $1404 = 0, $1405 = 0, $1406 = 0, $1407 = 0, $1408 = 0, $1409 = 0, $141 = 0, $1410 = 0;
  6483. var $1411 = 0, $1412 = 0, $1413 = 0, $1414 = 0, $1415 = 0, $1416 = 0, $1417 = 0, $1418 = 0, $1419 = 0, $142 = 0, $1420 = 0, $1421 = 0, $1422 = 0, $1423 = 0, $1424 = 0, $1425 = 0, $1426 = 0, $1427 = 0, $1428 = 0, $1429 = 0;
  6484. var $143 = 0, $1430 = 0, $1431 = 0, $1432 = 0, $1433 = 0, $1434 = 0, $1435 = 0, $1436 = 0, $1437 = 0, $1438 = 0, $1439 = 0, $144 = 0, $1440 = 0, $1441 = 0, $1442 = 0, $1443 = 0, $1444 = 0, $1445 = 0, $1446 = 0, $1447 = 0;
  6485. var $1448 = 0, $1449 = 0, $145 = 0, $1450 = 0, $1451 = 0, $1452 = 0, $1453 = 0, $1454 = 0, $1455 = 0, $1456 = 0, $1457 = 0, $1458 = 0, $1459 = 0, $146 = 0, $1460 = 0, $1461 = 0, $1462 = 0, $1463 = 0, $1464 = 0, $1465 = 0;
  6486. var $1466 = 0, $1467 = 0, $1468 = 0, $1469 = 0, $147 = 0, $1470 = 0, $1471 = 0, $1472 = 0, $1473 = 0, $1474 = 0, $1475 = 0, $1476 = 0, $1477 = 0, $1478 = 0, $1479 = 0, $148 = 0, $1480 = 0, $1481 = 0, $1482 = 0, $1483 = 0;
  6487. var $1484 = 0, $1485 = 0, $1486 = 0, $1487 = 0, $1488 = 0, $1489 = 0, $149 = 0, $1490 = 0, $1491 = 0, $1492 = 0, $1493 = 0, $1494 = 0, $1495 = 0, $1496 = 0, $1497 = 0, $1498 = 0, $1499 = 0, $15 = 0, $150 = 0, $1500 = 0;
  6488. var $1501 = 0, $1502 = 0, $1503 = 0, $1504 = 0, $1505 = 0, $1506 = 0, $1507 = 0, $1508 = 0, $1509 = 0, $151 = 0, $1510 = 0, $1511 = 0, $1512 = 0, $1513 = 0, $1514 = 0, $1515 = 0, $1516 = 0, $1517 = 0, $1518 = 0, $1519 = 0;
  6489. var $152 = 0, $1520 = 0, $1521 = 0, $1522 = 0, $1523 = 0, $1524 = 0, $1525 = 0, $1526 = 0, $1527 = 0, $1528 = 0, $1529 = 0, $153 = 0, $1530 = 0, $1531 = 0, $1532 = 0, $1533 = 0, $1534 = 0, $1535 = 0, $1536 = 0, $1537 = 0;
  6490. var $1538 = 0, $1539 = 0, $154 = 0, $1540 = 0, $1541 = 0, $1542 = 0, $1543 = 0, $1544 = 0, $1545 = 0, $1546 = 0, $1547 = 0, $1548 = 0, $1549 = 0, $155 = 0, $1550 = 0, $1551 = 0, $1552 = 0, $1553 = 0, $1554 = 0, $1555 = 0;
  6491. var $1556 = 0, $1557 = 0, $1558 = 0, $1559 = 0, $156 = 0, $1560 = 0, $1561 = 0, $1562 = 0, $1563 = 0, $1564 = 0, $1565 = 0, $1566 = 0, $1567 = 0, $1568 = 0, $1569 = 0, $157 = 0, $1570 = 0, $1571 = 0, $1572 = 0, $1573 = 0;
  6492. var $1574 = 0, $1575 = 0, $1576 = 0, $1577 = 0, $1578 = 0, $1579 = 0, $158 = 0, $1580 = 0, $1581 = 0, $1582 = 0, $1583 = 0, $1584 = 0, $1585 = 0, $1586 = 0, $1587 = 0, $1588 = 0, $1589 = 0, $159 = 0, $1590 = 0, $1591 = 0;
  6493. var $1592 = 0, $1593 = 0, $1594 = 0, $1595 = 0, $1596 = 0, $1597 = 0, $1598 = 0, $1599 = 0, $16 = 0, $160 = 0, $1600 = 0, $1601 = 0, $1602 = 0, $1603 = 0, $1604 = 0, $1605 = 0, $1606 = 0, $1607 = 0, $1608 = 0, $1609 = 0;
  6494. var $161 = 0, $1610 = 0, $1611 = 0, $1612 = 0, $1613 = 0, $1614 = 0, $1615 = 0, $1616 = 0, $1617 = 0, $1618 = 0, $1619 = 0, $162 = 0, $1620 = 0, $1621 = 0, $1622 = 0, $1623 = 0, $1624 = 0, $1625 = 0, $1626 = 0, $1627 = 0;
  6495. var $1628 = 0, $1629 = 0, $163 = 0, $1630 = 0, $1631 = 0, $1632 = 0, $1633 = 0, $1634 = 0, $1635 = 0, $1636 = 0, $1637 = 0, $1638 = 0, $1639 = 0, $164 = 0, $1640 = 0, $1641 = 0, $1642 = 0, $1643 = 0, $1644 = 0, $1645 = 0;
  6496. var $1646 = 0, $1647 = 0, $1648 = 0, $1649 = 0, $165 = 0, $1650 = 0, $1651 = 0, $1652 = 0, $1653 = 0, $1654 = 0, $1655 = 0, $1656 = 0, $1657 = 0, $1658 = 0, $1659 = 0, $166 = 0, $1660 = 0, $1661 = 0, $1662 = 0, $1663 = 0;
  6497. var $1664 = 0, $1665 = 0, $1666 = 0, $1667 = 0, $1668 = 0, $1669 = 0, $167 = 0, $1670 = 0, $1671 = 0, $1672 = 0, $1673 = 0, $1674 = 0, $1675 = 0, $1676 = 0, $1677 = 0, $1678 = 0, $1679 = 0, $168 = 0, $1680 = 0, $1681 = 0;
  6498. var $1682 = 0, $1683 = 0, $1684 = 0, $1685 = 0, $1686 = 0, $1687 = 0, $1688 = 0, $1689 = 0, $169 = 0, $1690 = 0, $1691 = 0, $1692 = 0, $1693 = 0, $1694 = 0, $1695 = 0, $1696 = 0, $1697 = 0, $1698 = 0, $1699 = 0, $17 = 0;
  6499. var $170 = 0, $1700 = 0, $1701 = 0, $1702 = 0, $1703 = 0, $1704 = 0, $1705 = 0, $1706 = 0, $1707 = 0, $1708 = 0, $1709 = 0, $171 = 0, $1710 = 0, $1711 = 0, $1712 = 0, $1713 = 0, $1714 = 0, $1715 = 0, $1716 = 0, $1717 = 0;
  6500. var $1718 = 0, $1719 = 0, $172 = 0, $1720 = 0, $1721 = 0, $1722 = 0, $1723 = 0, $1724 = 0, $1725 = 0, $1726 = 0, $1727 = 0, $1728 = 0, $1729 = 0, $173 = 0, $1730 = 0, $1731 = 0, $1732 = 0, $1733 = 0, $1734 = 0, $1735 = 0;
  6501. var $1736 = 0, $1737 = 0, $1738 = 0, $1739 = 0, $174 = 0, $1740 = 0, $1741 = 0, $1742 = 0, $1743 = 0, $1744 = 0, $1745 = 0, $1746 = 0, $1747 = 0, $1748 = 0, $1749 = 0, $175 = 0, $1750 = 0, $1751 = 0, $1752 = 0, $1753 = 0;
  6502. var $1754 = 0, $1755 = 0, $1756 = 0, $1757 = 0, $1758 = 0, $1759 = 0, $176 = 0, $1760 = 0, $1761 = 0, $1762 = 0, $1763 = 0, $1764 = 0, $1765 = 0, $1766 = 0, $1767 = 0, $1768 = 0, $1769 = 0, $177 = 0, $1770 = 0, $1771 = 0;
  6503. var $1772 = 0, $1773 = 0, $1774 = 0, $1775 = 0, $1776 = 0, $1777 = 0, $1778 = 0, $1779 = 0, $178 = 0, $1780 = 0, $1781 = 0, $1782 = 0, $1783 = 0, $1784 = 0, $1785 = 0, $1786 = 0, $1787 = 0, $1788 = 0, $1789 = 0, $179 = 0;
  6504. var $1790 = 0, $1791 = 0, $1792 = 0, $1793 = 0, $1794 = 0, $1795 = 0, $1796 = 0, $1797 = 0, $1798 = 0, $1799 = 0, $18 = 0, $180 = 0, $1800 = 0, $1801 = 0, $1802 = 0, $1803 = 0, $1804 = 0, $1805 = 0, $1806 = 0, $1807 = 0;
  6505. var $1808 = 0, $1809 = 0, $181 = 0, $1810 = 0, $1811 = 0, $1812 = 0, $1813 = 0, $1814 = 0, $1815 = 0, $1816 = 0, $1817 = 0, $1818 = 0, $1819 = 0, $182 = 0, $1820 = 0, $1821 = 0, $1822 = 0, $1823 = 0, $1824 = 0, $1825 = 0;
  6506. var $1826 = 0, $1827 = 0, $1828 = 0, $1829 = 0, $183 = 0, $1830 = 0, $1831 = 0, $1832 = 0, $1833 = 0, $1834 = 0, $1835 = 0, $1836 = 0, $1837 = 0, $1838 = 0, $1839 = 0, $184 = 0, $1840 = 0, $1841 = 0, $1842 = 0, $1843 = 0;
  6507. var $1844 = 0, $1845 = 0, $1846 = 0, $1847 = 0, $1848 = 0, $1849 = 0, $185 = 0, $1850 = 0, $1851 = 0, $1852 = 0, $1853 = 0, $1854 = 0, $1855 = 0, $1856 = 0, $1857 = 0, $1858 = 0, $1859 = 0, $186 = 0, $1860 = 0, $1861 = 0;
  6508. var $1862 = 0, $1863 = 0, $1864 = 0, $1865 = 0, $1866 = 0, $1867 = 0, $1868 = 0, $1869 = 0, $187 = 0, $1870 = 0, $1871 = 0, $1872 = 0, $1873 = 0, $1874 = 0, $1875 = 0, $1876 = 0, $1877 = 0, $1878 = 0, $1879 = 0, $188 = 0;
  6509. var $1880 = 0, $1881 = 0, $1882 = 0, $1883 = 0, $1884 = 0, $1885 = 0, $1886 = 0, $1887 = 0, $1888 = 0, $1889 = 0, $189 = 0, $1890 = 0, $1891 = 0, $1892 = 0, $1893 = 0, $1894 = 0, $1895 = 0, $1896 = 0, $1897 = 0, $1898 = 0;
  6510. var $1899 = 0, $19 = 0, $190 = 0, $1900 = 0, $1901 = 0, $1902 = 0, $1903 = 0, $1904 = 0, $1905 = 0, $1906 = 0, $1907 = 0, $1908 = 0, $1909 = 0, $191 = 0, $1910 = 0, $1911 = 0, $1912 = 0, $1913 = 0, $1914 = 0, $1915 = 0;
  6511. var $1916 = 0, $1917 = 0, $1918 = 0, $1919 = 0, $192 = 0, $1920 = 0, $1921 = 0, $1922 = 0, $1923 = 0, $1924 = 0, $1925 = 0, $1926 = 0, $1927 = 0, $1928 = 0, $1929 = 0, $193 = 0, $1930 = 0, $1931 = 0, $1932 = 0, $1933 = 0;
  6512. var $1934 = 0, $1935 = 0, $1936 = 0, $1937 = 0, $1938 = 0, $1939 = 0, $194 = 0, $1940 = 0, $1941 = 0, $1942 = 0, $1943 = 0, $1944 = 0, $1945 = 0, $1946 = 0, $1947 = 0, $1948 = 0, $1949 = 0, $195 = 0, $1950 = 0, $1951 = 0;
  6513. var $1952 = 0, $1953 = 0, $1954 = 0, $1955 = 0, $1956 = 0, $1957 = 0, $1958 = 0, $1959 = 0, $196 = 0, $1960 = 0, $1961 = 0, $1962 = 0, $1963 = 0, $1964 = 0, $1965 = 0, $1966 = 0, $1967 = 0, $1968 = 0, $1969 = 0, $197 = 0;
  6514. var $1970 = 0, $1971 = 0, $1972 = 0, $1973 = 0, $1974 = 0, $1975 = 0, $1976 = 0, $1977 = 0, $1978 = 0, $1979 = 0, $198 = 0, $1980 = 0, $1981 = 0, $1982 = 0, $1983 = 0, $1984 = 0, $1985 = 0, $1986 = 0, $1987 = 0, $1988 = 0;
  6515. var $1989 = 0, $199 = 0, $1990 = 0, $1991 = 0, $1992 = 0, $1993 = 0, $1994 = 0, $1995 = 0, $1996 = 0, $1997 = 0, $1998 = 0, $1999 = 0, $2 = 0, $20 = 0, $200 = 0, $2000 = 0, $2001 = 0, $2002 = 0, $2003 = 0, $2004 = 0;
  6516. var $2005 = 0, $2006 = 0, $2007 = 0, $2008 = 0, $2009 = 0, $201 = 0, $2010 = 0, $2011 = 0, $2012 = 0, $2013 = 0, $2014 = 0, $2015 = 0, $2016 = 0, $2017 = 0, $2018 = 0, $2019 = 0, $202 = 0, $2020 = 0, $2021 = 0, $2022 = 0;
  6517. var $2023 = 0, $2024 = 0, $2025 = 0, $2026 = 0, $2027 = 0, $2028 = 0, $2029 = 0, $203 = 0, $2030 = 0, $2031 = 0, $2032 = 0, $2033 = 0, $2034 = 0, $2035 = 0, $2036 = 0, $2037 = 0, $2038 = 0, $2039 = 0, $204 = 0, $2040 = 0;
  6518. var $2041 = 0, $2042 = 0, $2043 = 0, $2044 = 0, $2045 = 0, $2046 = 0, $2047 = 0, $2048 = 0, $2049 = 0, $205 = 0, $2050 = 0, $2051 = 0, $2052 = 0, $2053 = 0, $2054 = 0, $2055 = 0, $2056 = 0, $2057 = 0, $2058 = 0, $2059 = 0;
  6519. var $206 = 0, $2060 = 0, $2061 = 0, $2062 = 0, $2063 = 0, $2064 = 0, $2065 = 0, $2066 = 0, $2067 = 0, $2068 = 0, $2069 = 0, $207 = 0, $2070 = 0, $2071 = 0, $2072 = 0, $2073 = 0, $2074 = 0, $2075 = 0, $2076 = 0, $2077 = 0;
  6520. var $2078 = 0, $2079 = 0, $208 = 0, $2080 = 0, $2081 = 0, $2082 = 0, $2083 = 0, $2084 = 0, $2085 = 0, $2086 = 0, $2087 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0;
  6521. var $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0;
  6522. var $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0;
  6523. var $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0;
  6524. var $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0;
  6525. var $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0;
  6526. var $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0;
  6527. var $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0;
  6528. var $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0;
  6529. var $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0;
  6530. var $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0;
  6531. var $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0, $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0;
  6532. var $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0, $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0;
  6533. var $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0;
  6534. var $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0, $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0;
  6535. var $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0;
  6536. var $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0, $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0;
  6537. var $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0;
  6538. var $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0;
  6539. var $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0;
  6540. var $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0;
  6541. var $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0;
  6542. var $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0;
  6543. var $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0;
  6544. var $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0;
  6545. var $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0;
  6546. var $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0;
  6547. var $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0;
  6548. var $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0;
  6549. var $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0;
  6550. var $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0;
  6551. var $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0;
  6552. var $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0;
  6553. var $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0;
  6554. var $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0, $819 = 0, $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0;
  6555. var $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0, $837 = 0, $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0;
  6556. var $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0, $855 = 0, $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0;
  6557. var $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0, $873 = 0, $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0;
  6558. var $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0, $891 = 0, $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0;
  6559. var $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0, $909 = 0, $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0;
  6560. var $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0, $927 = 0, $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0;
  6561. var $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0, $945 = 0, $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0;
  6562. var $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0, $960 = 0, $961 = 0, $962 = 0, $963 = 0, $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0, $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0;
  6563. var $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0, $979 = 0, $98 = 0, $980 = 0, $981 = 0, $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0, $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0;
  6564. var $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0, $997 = 0, $998 = 0, $999 = 0, label = 0, sp = 0;
  6565. sp = STACKTOP;
  6566. $0 = $in2;
  6567. $1 = $0;
  6568. $2 = HEAP32[$1>>2]|0;
  6569. $3 = (($0) + 4)|0;
  6570. $4 = $3;
  6571. $5 = HEAP32[$4>>2]|0;
  6572. $6 = (_bitshift64Ashr(0,($2|0),32)|0);
  6573. $7 = tempRet0;
  6574. $8 = $in;
  6575. $9 = $8;
  6576. $10 = HEAP32[$9>>2]|0;
  6577. $11 = (($8) + 4)|0;
  6578. $12 = $11;
  6579. $13 = HEAP32[$12>>2]|0;
  6580. $14 = (_bitshift64Ashr(0,($10|0),32)|0);
  6581. $15 = tempRet0;
  6582. $16 = (___muldi3(($14|0),($15|0),($6|0),($7|0))|0);
  6583. $17 = tempRet0;
  6584. $18 = $output;
  6585. $19 = $18;
  6586. HEAP32[$19>>2] = $16;
  6587. $20 = (($18) + 4)|0;
  6588. $21 = $20;
  6589. HEAP32[$21>>2] = $17;
  6590. $22 = $in2;
  6591. $23 = $22;
  6592. $24 = HEAP32[$23>>2]|0;
  6593. $25 = (($22) + 4)|0;
  6594. $26 = $25;
  6595. $27 = HEAP32[$26>>2]|0;
  6596. $28 = (_bitshift64Ashr(0,($24|0),32)|0);
  6597. $29 = tempRet0;
  6598. $30 = (($in) + 8|0);
  6599. $31 = $30;
  6600. $32 = $31;
  6601. $33 = HEAP32[$32>>2]|0;
  6602. $34 = (($31) + 4)|0;
  6603. $35 = $34;
  6604. $36 = HEAP32[$35>>2]|0;
  6605. $37 = (_bitshift64Ashr(0,($33|0),32)|0);
  6606. $38 = tempRet0;
  6607. $39 = (___muldi3(($37|0),($38|0),($28|0),($29|0))|0);
  6608. $40 = tempRet0;
  6609. $41 = (($in2) + 8|0);
  6610. $42 = $41;
  6611. $43 = $42;
  6612. $44 = HEAP32[$43>>2]|0;
  6613. $45 = (($42) + 4)|0;
  6614. $46 = $45;
  6615. $47 = HEAP32[$46>>2]|0;
  6616. $48 = (_bitshift64Ashr(0,($44|0),32)|0);
  6617. $49 = tempRet0;
  6618. $50 = $in;
  6619. $51 = $50;
  6620. $52 = HEAP32[$51>>2]|0;
  6621. $53 = (($50) + 4)|0;
  6622. $54 = $53;
  6623. $55 = HEAP32[$54>>2]|0;
  6624. $56 = (_bitshift64Ashr(0,($52|0),32)|0);
  6625. $57 = tempRet0;
  6626. $58 = (___muldi3(($56|0),($57|0),($48|0),($49|0))|0);
  6627. $59 = tempRet0;
  6628. $60 = (_i64Add(($58|0),($59|0),($39|0),($40|0))|0);
  6629. $61 = tempRet0;
  6630. $62 = (($output) + 8|0);
  6631. $63 = $62;
  6632. $64 = $63;
  6633. HEAP32[$64>>2] = $60;
  6634. $65 = (($63) + 4)|0;
  6635. $66 = $65;
  6636. HEAP32[$66>>2] = $61;
  6637. $67 = $41;
  6638. $68 = $67;
  6639. $69 = HEAP32[$68>>2]|0;
  6640. $70 = (($67) + 4)|0;
  6641. $71 = $70;
  6642. $72 = HEAP32[$71>>2]|0;
  6643. $73 = (_bitshift64Ashr(0,($69|0),31)|0);
  6644. $74 = tempRet0;
  6645. $75 = $30;
  6646. $76 = $75;
  6647. $77 = HEAP32[$76>>2]|0;
  6648. $78 = (($75) + 4)|0;
  6649. $79 = $78;
  6650. $80 = HEAP32[$79>>2]|0;
  6651. $81 = (_bitshift64Ashr(0,($77|0),32)|0);
  6652. $82 = tempRet0;
  6653. $83 = (___muldi3(($81|0),($82|0),($73|0),($74|0))|0);
  6654. $84 = tempRet0;
  6655. $85 = $in2;
  6656. $86 = $85;
  6657. $87 = HEAP32[$86>>2]|0;
  6658. $88 = (($85) + 4)|0;
  6659. $89 = $88;
  6660. $90 = HEAP32[$89>>2]|0;
  6661. $91 = (_bitshift64Ashr(0,($87|0),32)|0);
  6662. $92 = tempRet0;
  6663. $93 = (($in) + 16|0);
  6664. $94 = $93;
  6665. $95 = $94;
  6666. $96 = HEAP32[$95>>2]|0;
  6667. $97 = (($94) + 4)|0;
  6668. $98 = $97;
  6669. $99 = HEAP32[$98>>2]|0;
  6670. $100 = (_bitshift64Ashr(0,($96|0),32)|0);
  6671. $101 = tempRet0;
  6672. $102 = (___muldi3(($100|0),($101|0),($91|0),($92|0))|0);
  6673. $103 = tempRet0;
  6674. $104 = (_i64Add(($102|0),($103|0),($83|0),($84|0))|0);
  6675. $105 = tempRet0;
  6676. $106 = (($in2) + 16|0);
  6677. $107 = $106;
  6678. $108 = $107;
  6679. $109 = HEAP32[$108>>2]|0;
  6680. $110 = (($107) + 4)|0;
  6681. $111 = $110;
  6682. $112 = HEAP32[$111>>2]|0;
  6683. $113 = (_bitshift64Ashr(0,($109|0),32)|0);
  6684. $114 = tempRet0;
  6685. $115 = $in;
  6686. $116 = $115;
  6687. $117 = HEAP32[$116>>2]|0;
  6688. $118 = (($115) + 4)|0;
  6689. $119 = $118;
  6690. $120 = HEAP32[$119>>2]|0;
  6691. $121 = (_bitshift64Ashr(0,($117|0),32)|0);
  6692. $122 = tempRet0;
  6693. $123 = (___muldi3(($121|0),($122|0),($113|0),($114|0))|0);
  6694. $124 = tempRet0;
  6695. $125 = (_i64Add(($104|0),($105|0),($123|0),($124|0))|0);
  6696. $126 = tempRet0;
  6697. $127 = (($output) + 16|0);
  6698. $128 = $127;
  6699. $129 = $128;
  6700. HEAP32[$129>>2] = $125;
  6701. $130 = (($128) + 4)|0;
  6702. $131 = $130;
  6703. HEAP32[$131>>2] = $126;
  6704. $132 = $41;
  6705. $133 = $132;
  6706. $134 = HEAP32[$133>>2]|0;
  6707. $135 = (($132) + 4)|0;
  6708. $136 = $135;
  6709. $137 = HEAP32[$136>>2]|0;
  6710. $138 = (_bitshift64Ashr(0,($134|0),32)|0);
  6711. $139 = tempRet0;
  6712. $140 = $93;
  6713. $141 = $140;
  6714. $142 = HEAP32[$141>>2]|0;
  6715. $143 = (($140) + 4)|0;
  6716. $144 = $143;
  6717. $145 = HEAP32[$144>>2]|0;
  6718. $146 = (_bitshift64Ashr(0,($142|0),32)|0);
  6719. $147 = tempRet0;
  6720. $148 = (___muldi3(($146|0),($147|0),($138|0),($139|0))|0);
  6721. $149 = tempRet0;
  6722. $150 = $106;
  6723. $151 = $150;
  6724. $152 = HEAP32[$151>>2]|0;
  6725. $153 = (($150) + 4)|0;
  6726. $154 = $153;
  6727. $155 = HEAP32[$154>>2]|0;
  6728. $156 = (_bitshift64Ashr(0,($152|0),32)|0);
  6729. $157 = tempRet0;
  6730. $158 = $30;
  6731. $159 = $158;
  6732. $160 = HEAP32[$159>>2]|0;
  6733. $161 = (($158) + 4)|0;
  6734. $162 = $161;
  6735. $163 = HEAP32[$162>>2]|0;
  6736. $164 = (_bitshift64Ashr(0,($160|0),32)|0);
  6737. $165 = tempRet0;
  6738. $166 = (___muldi3(($164|0),($165|0),($156|0),($157|0))|0);
  6739. $167 = tempRet0;
  6740. $168 = (_i64Add(($166|0),($167|0),($148|0),($149|0))|0);
  6741. $169 = tempRet0;
  6742. $170 = $in2;
  6743. $171 = $170;
  6744. $172 = HEAP32[$171>>2]|0;
  6745. $173 = (($170) + 4)|0;
  6746. $174 = $173;
  6747. $175 = HEAP32[$174>>2]|0;
  6748. $176 = (_bitshift64Ashr(0,($172|0),32)|0);
  6749. $177 = tempRet0;
  6750. $178 = (($in) + 24|0);
  6751. $179 = $178;
  6752. $180 = $179;
  6753. $181 = HEAP32[$180>>2]|0;
  6754. $182 = (($179) + 4)|0;
  6755. $183 = $182;
  6756. $184 = HEAP32[$183>>2]|0;
  6757. $185 = (_bitshift64Ashr(0,($181|0),32)|0);
  6758. $186 = tempRet0;
  6759. $187 = (___muldi3(($185|0),($186|0),($176|0),($177|0))|0);
  6760. $188 = tempRet0;
  6761. $189 = (_i64Add(($168|0),($169|0),($187|0),($188|0))|0);
  6762. $190 = tempRet0;
  6763. $191 = (($in2) + 24|0);
  6764. $192 = $191;
  6765. $193 = $192;
  6766. $194 = HEAP32[$193>>2]|0;
  6767. $195 = (($192) + 4)|0;
  6768. $196 = $195;
  6769. $197 = HEAP32[$196>>2]|0;
  6770. $198 = (_bitshift64Ashr(0,($194|0),32)|0);
  6771. $199 = tempRet0;
  6772. $200 = $in;
  6773. $201 = $200;
  6774. $202 = HEAP32[$201>>2]|0;
  6775. $203 = (($200) + 4)|0;
  6776. $204 = $203;
  6777. $205 = HEAP32[$204>>2]|0;
  6778. $206 = (_bitshift64Ashr(0,($202|0),32)|0);
  6779. $207 = tempRet0;
  6780. $208 = (___muldi3(($206|0),($207|0),($198|0),($199|0))|0);
  6781. $209 = tempRet0;
  6782. $210 = (_i64Add(($189|0),($190|0),($208|0),($209|0))|0);
  6783. $211 = tempRet0;
  6784. $212 = (($output) + 24|0);
  6785. $213 = $212;
  6786. $214 = $213;
  6787. HEAP32[$214>>2] = $210;
  6788. $215 = (($213) + 4)|0;
  6789. $216 = $215;
  6790. HEAP32[$216>>2] = $211;
  6791. $217 = $106;
  6792. $218 = $217;
  6793. $219 = HEAP32[$218>>2]|0;
  6794. $220 = (($217) + 4)|0;
  6795. $221 = $220;
  6796. $222 = HEAP32[$221>>2]|0;
  6797. $223 = (_bitshift64Ashr(0,($219|0),32)|0);
  6798. $224 = tempRet0;
  6799. $225 = $93;
  6800. $226 = $225;
  6801. $227 = HEAP32[$226>>2]|0;
  6802. $228 = (($225) + 4)|0;
  6803. $229 = $228;
  6804. $230 = HEAP32[$229>>2]|0;
  6805. $231 = (_bitshift64Ashr(0,($227|0),32)|0);
  6806. $232 = tempRet0;
  6807. $233 = (___muldi3(($231|0),($232|0),($223|0),($224|0))|0);
  6808. $234 = tempRet0;
  6809. $235 = $41;
  6810. $236 = $235;
  6811. $237 = HEAP32[$236>>2]|0;
  6812. $238 = (($235) + 4)|0;
  6813. $239 = $238;
  6814. $240 = HEAP32[$239>>2]|0;
  6815. $241 = (_bitshift64Ashr(0,($237|0),32)|0);
  6816. $242 = tempRet0;
  6817. $243 = $178;
  6818. $244 = $243;
  6819. $245 = HEAP32[$244>>2]|0;
  6820. $246 = (($243) + 4)|0;
  6821. $247 = $246;
  6822. $248 = HEAP32[$247>>2]|0;
  6823. $249 = (_bitshift64Ashr(0,($245|0),32)|0);
  6824. $250 = tempRet0;
  6825. $251 = (___muldi3(($249|0),($250|0),($241|0),($242|0))|0);
  6826. $252 = tempRet0;
  6827. $253 = $191;
  6828. $254 = $253;
  6829. $255 = HEAP32[$254>>2]|0;
  6830. $256 = (($253) + 4)|0;
  6831. $257 = $256;
  6832. $258 = HEAP32[$257>>2]|0;
  6833. $259 = (_bitshift64Ashr(0,($255|0),32)|0);
  6834. $260 = tempRet0;
  6835. $261 = $30;
  6836. $262 = $261;
  6837. $263 = HEAP32[$262>>2]|0;
  6838. $264 = (($261) + 4)|0;
  6839. $265 = $264;
  6840. $266 = HEAP32[$265>>2]|0;
  6841. $267 = (_bitshift64Ashr(0,($263|0),32)|0);
  6842. $268 = tempRet0;
  6843. $269 = (___muldi3(($267|0),($268|0),($259|0),($260|0))|0);
  6844. $270 = tempRet0;
  6845. $271 = (_i64Add(($269|0),($270|0),($251|0),($252|0))|0);
  6846. $272 = tempRet0;
  6847. $273 = (_bitshift64Shl(($271|0),($272|0),1)|0);
  6848. $274 = tempRet0;
  6849. $275 = (_i64Add(($273|0),($274|0),($233|0),($234|0))|0);
  6850. $276 = tempRet0;
  6851. $277 = $in2;
  6852. $278 = $277;
  6853. $279 = HEAP32[$278>>2]|0;
  6854. $280 = (($277) + 4)|0;
  6855. $281 = $280;
  6856. $282 = HEAP32[$281>>2]|0;
  6857. $283 = (_bitshift64Ashr(0,($279|0),32)|0);
  6858. $284 = tempRet0;
  6859. $285 = (($in) + 32|0);
  6860. $286 = $285;
  6861. $287 = $286;
  6862. $288 = HEAP32[$287>>2]|0;
  6863. $289 = (($286) + 4)|0;
  6864. $290 = $289;
  6865. $291 = HEAP32[$290>>2]|0;
  6866. $292 = (_bitshift64Ashr(0,($288|0),32)|0);
  6867. $293 = tempRet0;
  6868. $294 = (___muldi3(($292|0),($293|0),($283|0),($284|0))|0);
  6869. $295 = tempRet0;
  6870. $296 = (_i64Add(($275|0),($276|0),($294|0),($295|0))|0);
  6871. $297 = tempRet0;
  6872. $298 = (($in2) + 32|0);
  6873. $299 = $298;
  6874. $300 = $299;
  6875. $301 = HEAP32[$300>>2]|0;
  6876. $302 = (($299) + 4)|0;
  6877. $303 = $302;
  6878. $304 = HEAP32[$303>>2]|0;
  6879. $305 = (_bitshift64Ashr(0,($301|0),32)|0);
  6880. $306 = tempRet0;
  6881. $307 = $in;
  6882. $308 = $307;
  6883. $309 = HEAP32[$308>>2]|0;
  6884. $310 = (($307) + 4)|0;
  6885. $311 = $310;
  6886. $312 = HEAP32[$311>>2]|0;
  6887. $313 = (_bitshift64Ashr(0,($309|0),32)|0);
  6888. $314 = tempRet0;
  6889. $315 = (___muldi3(($313|0),($314|0),($305|0),($306|0))|0);
  6890. $316 = tempRet0;
  6891. $317 = (_i64Add(($296|0),($297|0),($315|0),($316|0))|0);
  6892. $318 = tempRet0;
  6893. $319 = (($output) + 32|0);
  6894. $320 = $319;
  6895. $321 = $320;
  6896. HEAP32[$321>>2] = $317;
  6897. $322 = (($320) + 4)|0;
  6898. $323 = $322;
  6899. HEAP32[$323>>2] = $318;
  6900. $324 = $106;
  6901. $325 = $324;
  6902. $326 = HEAP32[$325>>2]|0;
  6903. $327 = (($324) + 4)|0;
  6904. $328 = $327;
  6905. $329 = HEAP32[$328>>2]|0;
  6906. $330 = (_bitshift64Ashr(0,($326|0),32)|0);
  6907. $331 = tempRet0;
  6908. $332 = $178;
  6909. $333 = $332;
  6910. $334 = HEAP32[$333>>2]|0;
  6911. $335 = (($332) + 4)|0;
  6912. $336 = $335;
  6913. $337 = HEAP32[$336>>2]|0;
  6914. $338 = (_bitshift64Ashr(0,($334|0),32)|0);
  6915. $339 = tempRet0;
  6916. $340 = (___muldi3(($338|0),($339|0),($330|0),($331|0))|0);
  6917. $341 = tempRet0;
  6918. $342 = $191;
  6919. $343 = $342;
  6920. $344 = HEAP32[$343>>2]|0;
  6921. $345 = (($342) + 4)|0;
  6922. $346 = $345;
  6923. $347 = HEAP32[$346>>2]|0;
  6924. $348 = (_bitshift64Ashr(0,($344|0),32)|0);
  6925. $349 = tempRet0;
  6926. $350 = $93;
  6927. $351 = $350;
  6928. $352 = HEAP32[$351>>2]|0;
  6929. $353 = (($350) + 4)|0;
  6930. $354 = $353;
  6931. $355 = HEAP32[$354>>2]|0;
  6932. $356 = (_bitshift64Ashr(0,($352|0),32)|0);
  6933. $357 = tempRet0;
  6934. $358 = (___muldi3(($356|0),($357|0),($348|0),($349|0))|0);
  6935. $359 = tempRet0;
  6936. $360 = (_i64Add(($358|0),($359|0),($340|0),($341|0))|0);
  6937. $361 = tempRet0;
  6938. $362 = $41;
  6939. $363 = $362;
  6940. $364 = HEAP32[$363>>2]|0;
  6941. $365 = (($362) + 4)|0;
  6942. $366 = $365;
  6943. $367 = HEAP32[$366>>2]|0;
  6944. $368 = (_bitshift64Ashr(0,($364|0),32)|0);
  6945. $369 = tempRet0;
  6946. $370 = $285;
  6947. $371 = $370;
  6948. $372 = HEAP32[$371>>2]|0;
  6949. $373 = (($370) + 4)|0;
  6950. $374 = $373;
  6951. $375 = HEAP32[$374>>2]|0;
  6952. $376 = (_bitshift64Ashr(0,($372|0),32)|0);
  6953. $377 = tempRet0;
  6954. $378 = (___muldi3(($376|0),($377|0),($368|0),($369|0))|0);
  6955. $379 = tempRet0;
  6956. $380 = (_i64Add(($360|0),($361|0),($378|0),($379|0))|0);
  6957. $381 = tempRet0;
  6958. $382 = $298;
  6959. $383 = $382;
  6960. $384 = HEAP32[$383>>2]|0;
  6961. $385 = (($382) + 4)|0;
  6962. $386 = $385;
  6963. $387 = HEAP32[$386>>2]|0;
  6964. $388 = (_bitshift64Ashr(0,($384|0),32)|0);
  6965. $389 = tempRet0;
  6966. $390 = $30;
  6967. $391 = $390;
  6968. $392 = HEAP32[$391>>2]|0;
  6969. $393 = (($390) + 4)|0;
  6970. $394 = $393;
  6971. $395 = HEAP32[$394>>2]|0;
  6972. $396 = (_bitshift64Ashr(0,($392|0),32)|0);
  6973. $397 = tempRet0;
  6974. $398 = (___muldi3(($396|0),($397|0),($388|0),($389|0))|0);
  6975. $399 = tempRet0;
  6976. $400 = (_i64Add(($380|0),($381|0),($398|0),($399|0))|0);
  6977. $401 = tempRet0;
  6978. $402 = $in2;
  6979. $403 = $402;
  6980. $404 = HEAP32[$403>>2]|0;
  6981. $405 = (($402) + 4)|0;
  6982. $406 = $405;
  6983. $407 = HEAP32[$406>>2]|0;
  6984. $408 = (_bitshift64Ashr(0,($404|0),32)|0);
  6985. $409 = tempRet0;
  6986. $410 = (($in) + 40|0);
  6987. $411 = $410;
  6988. $412 = $411;
  6989. $413 = HEAP32[$412>>2]|0;
  6990. $414 = (($411) + 4)|0;
  6991. $415 = $414;
  6992. $416 = HEAP32[$415>>2]|0;
  6993. $417 = (_bitshift64Ashr(0,($413|0),32)|0);
  6994. $418 = tempRet0;
  6995. $419 = (___muldi3(($417|0),($418|0),($408|0),($409|0))|0);
  6996. $420 = tempRet0;
  6997. $421 = (_i64Add(($400|0),($401|0),($419|0),($420|0))|0);
  6998. $422 = tempRet0;
  6999. $423 = (($in2) + 40|0);
  7000. $424 = $423;
  7001. $425 = $424;
  7002. $426 = HEAP32[$425>>2]|0;
  7003. $427 = (($424) + 4)|0;
  7004. $428 = $427;
  7005. $429 = HEAP32[$428>>2]|0;
  7006. $430 = (_bitshift64Ashr(0,($426|0),32)|0);
  7007. $431 = tempRet0;
  7008. $432 = $in;
  7009. $433 = $432;
  7010. $434 = HEAP32[$433>>2]|0;
  7011. $435 = (($432) + 4)|0;
  7012. $436 = $435;
  7013. $437 = HEAP32[$436>>2]|0;
  7014. $438 = (_bitshift64Ashr(0,($434|0),32)|0);
  7015. $439 = tempRet0;
  7016. $440 = (___muldi3(($438|0),($439|0),($430|0),($431|0))|0);
  7017. $441 = tempRet0;
  7018. $442 = (_i64Add(($421|0),($422|0),($440|0),($441|0))|0);
  7019. $443 = tempRet0;
  7020. $444 = (($output) + 40|0);
  7021. $445 = $444;
  7022. $446 = $445;
  7023. HEAP32[$446>>2] = $442;
  7024. $447 = (($445) + 4)|0;
  7025. $448 = $447;
  7026. HEAP32[$448>>2] = $443;
  7027. $449 = $191;
  7028. $450 = $449;
  7029. $451 = HEAP32[$450>>2]|0;
  7030. $452 = (($449) + 4)|0;
  7031. $453 = $452;
  7032. $454 = HEAP32[$453>>2]|0;
  7033. $455 = (_bitshift64Ashr(0,($451|0),32)|0);
  7034. $456 = tempRet0;
  7035. $457 = $178;
  7036. $458 = $457;
  7037. $459 = HEAP32[$458>>2]|0;
  7038. $460 = (($457) + 4)|0;
  7039. $461 = $460;
  7040. $462 = HEAP32[$461>>2]|0;
  7041. $463 = (_bitshift64Ashr(0,($459|0),32)|0);
  7042. $464 = tempRet0;
  7043. $465 = (___muldi3(($463|0),($464|0),($455|0),($456|0))|0);
  7044. $466 = tempRet0;
  7045. $467 = $41;
  7046. $468 = $467;
  7047. $469 = HEAP32[$468>>2]|0;
  7048. $470 = (($467) + 4)|0;
  7049. $471 = $470;
  7050. $472 = HEAP32[$471>>2]|0;
  7051. $473 = (_bitshift64Ashr(0,($469|0),32)|0);
  7052. $474 = tempRet0;
  7053. $475 = $410;
  7054. $476 = $475;
  7055. $477 = HEAP32[$476>>2]|0;
  7056. $478 = (($475) + 4)|0;
  7057. $479 = $478;
  7058. $480 = HEAP32[$479>>2]|0;
  7059. $481 = (_bitshift64Ashr(0,($477|0),32)|0);
  7060. $482 = tempRet0;
  7061. $483 = (___muldi3(($481|0),($482|0),($473|0),($474|0))|0);
  7062. $484 = tempRet0;
  7063. $485 = (_i64Add(($483|0),($484|0),($465|0),($466|0))|0);
  7064. $486 = tempRet0;
  7065. $487 = $423;
  7066. $488 = $487;
  7067. $489 = HEAP32[$488>>2]|0;
  7068. $490 = (($487) + 4)|0;
  7069. $491 = $490;
  7070. $492 = HEAP32[$491>>2]|0;
  7071. $493 = (_bitshift64Ashr(0,($489|0),32)|0);
  7072. $494 = tempRet0;
  7073. $495 = $30;
  7074. $496 = $495;
  7075. $497 = HEAP32[$496>>2]|0;
  7076. $498 = (($495) + 4)|0;
  7077. $499 = $498;
  7078. $500 = HEAP32[$499>>2]|0;
  7079. $501 = (_bitshift64Ashr(0,($497|0),32)|0);
  7080. $502 = tempRet0;
  7081. $503 = (___muldi3(($501|0),($502|0),($493|0),($494|0))|0);
  7082. $504 = tempRet0;
  7083. $505 = (_i64Add(($485|0),($486|0),($503|0),($504|0))|0);
  7084. $506 = tempRet0;
  7085. $507 = (_bitshift64Shl(($505|0),($506|0),1)|0);
  7086. $508 = tempRet0;
  7087. $509 = $106;
  7088. $510 = $509;
  7089. $511 = HEAP32[$510>>2]|0;
  7090. $512 = (($509) + 4)|0;
  7091. $513 = $512;
  7092. $514 = HEAP32[$513>>2]|0;
  7093. $515 = (_bitshift64Ashr(0,($511|0),32)|0);
  7094. $516 = tempRet0;
  7095. $517 = $285;
  7096. $518 = $517;
  7097. $519 = HEAP32[$518>>2]|0;
  7098. $520 = (($517) + 4)|0;
  7099. $521 = $520;
  7100. $522 = HEAP32[$521>>2]|0;
  7101. $523 = (_bitshift64Ashr(0,($519|0),32)|0);
  7102. $524 = tempRet0;
  7103. $525 = (___muldi3(($523|0),($524|0),($515|0),($516|0))|0);
  7104. $526 = tempRet0;
  7105. $527 = (_i64Add(($507|0),($508|0),($525|0),($526|0))|0);
  7106. $528 = tempRet0;
  7107. $529 = $298;
  7108. $530 = $529;
  7109. $531 = HEAP32[$530>>2]|0;
  7110. $532 = (($529) + 4)|0;
  7111. $533 = $532;
  7112. $534 = HEAP32[$533>>2]|0;
  7113. $535 = (_bitshift64Ashr(0,($531|0),32)|0);
  7114. $536 = tempRet0;
  7115. $537 = $93;
  7116. $538 = $537;
  7117. $539 = HEAP32[$538>>2]|0;
  7118. $540 = (($537) + 4)|0;
  7119. $541 = $540;
  7120. $542 = HEAP32[$541>>2]|0;
  7121. $543 = (_bitshift64Ashr(0,($539|0),32)|0);
  7122. $544 = tempRet0;
  7123. $545 = (___muldi3(($543|0),($544|0),($535|0),($536|0))|0);
  7124. $546 = tempRet0;
  7125. $547 = (_i64Add(($527|0),($528|0),($545|0),($546|0))|0);
  7126. $548 = tempRet0;
  7127. $549 = $in2;
  7128. $550 = $549;
  7129. $551 = HEAP32[$550>>2]|0;
  7130. $552 = (($549) + 4)|0;
  7131. $553 = $552;
  7132. $554 = HEAP32[$553>>2]|0;
  7133. $555 = (_bitshift64Ashr(0,($551|0),32)|0);
  7134. $556 = tempRet0;
  7135. $557 = (($in) + 48|0);
  7136. $558 = $557;
  7137. $559 = $558;
  7138. $560 = HEAP32[$559>>2]|0;
  7139. $561 = (($558) + 4)|0;
  7140. $562 = $561;
  7141. $563 = HEAP32[$562>>2]|0;
  7142. $564 = (_bitshift64Ashr(0,($560|0),32)|0);
  7143. $565 = tempRet0;
  7144. $566 = (___muldi3(($564|0),($565|0),($555|0),($556|0))|0);
  7145. $567 = tempRet0;
  7146. $568 = (_i64Add(($547|0),($548|0),($566|0),($567|0))|0);
  7147. $569 = tempRet0;
  7148. $570 = (($in2) + 48|0);
  7149. $571 = $570;
  7150. $572 = $571;
  7151. $573 = HEAP32[$572>>2]|0;
  7152. $574 = (($571) + 4)|0;
  7153. $575 = $574;
  7154. $576 = HEAP32[$575>>2]|0;
  7155. $577 = (_bitshift64Ashr(0,($573|0),32)|0);
  7156. $578 = tempRet0;
  7157. $579 = $in;
  7158. $580 = $579;
  7159. $581 = HEAP32[$580>>2]|0;
  7160. $582 = (($579) + 4)|0;
  7161. $583 = $582;
  7162. $584 = HEAP32[$583>>2]|0;
  7163. $585 = (_bitshift64Ashr(0,($581|0),32)|0);
  7164. $586 = tempRet0;
  7165. $587 = (___muldi3(($585|0),($586|0),($577|0),($578|0))|0);
  7166. $588 = tempRet0;
  7167. $589 = (_i64Add(($568|0),($569|0),($587|0),($588|0))|0);
  7168. $590 = tempRet0;
  7169. $591 = (($output) + 48|0);
  7170. $592 = $591;
  7171. $593 = $592;
  7172. HEAP32[$593>>2] = $589;
  7173. $594 = (($592) + 4)|0;
  7174. $595 = $594;
  7175. HEAP32[$595>>2] = $590;
  7176. $596 = $191;
  7177. $597 = $596;
  7178. $598 = HEAP32[$597>>2]|0;
  7179. $599 = (($596) + 4)|0;
  7180. $600 = $599;
  7181. $601 = HEAP32[$600>>2]|0;
  7182. $602 = (_bitshift64Ashr(0,($598|0),32)|0);
  7183. $603 = tempRet0;
  7184. $604 = $285;
  7185. $605 = $604;
  7186. $606 = HEAP32[$605>>2]|0;
  7187. $607 = (($604) + 4)|0;
  7188. $608 = $607;
  7189. $609 = HEAP32[$608>>2]|0;
  7190. $610 = (_bitshift64Ashr(0,($606|0),32)|0);
  7191. $611 = tempRet0;
  7192. $612 = (___muldi3(($610|0),($611|0),($602|0),($603|0))|0);
  7193. $613 = tempRet0;
  7194. $614 = $298;
  7195. $615 = $614;
  7196. $616 = HEAP32[$615>>2]|0;
  7197. $617 = (($614) + 4)|0;
  7198. $618 = $617;
  7199. $619 = HEAP32[$618>>2]|0;
  7200. $620 = (_bitshift64Ashr(0,($616|0),32)|0);
  7201. $621 = tempRet0;
  7202. $622 = $178;
  7203. $623 = $622;
  7204. $624 = HEAP32[$623>>2]|0;
  7205. $625 = (($622) + 4)|0;
  7206. $626 = $625;
  7207. $627 = HEAP32[$626>>2]|0;
  7208. $628 = (_bitshift64Ashr(0,($624|0),32)|0);
  7209. $629 = tempRet0;
  7210. $630 = (___muldi3(($628|0),($629|0),($620|0),($621|0))|0);
  7211. $631 = tempRet0;
  7212. $632 = (_i64Add(($630|0),($631|0),($612|0),($613|0))|0);
  7213. $633 = tempRet0;
  7214. $634 = $106;
  7215. $635 = $634;
  7216. $636 = HEAP32[$635>>2]|0;
  7217. $637 = (($634) + 4)|0;
  7218. $638 = $637;
  7219. $639 = HEAP32[$638>>2]|0;
  7220. $640 = (_bitshift64Ashr(0,($636|0),32)|0);
  7221. $641 = tempRet0;
  7222. $642 = $410;
  7223. $643 = $642;
  7224. $644 = HEAP32[$643>>2]|0;
  7225. $645 = (($642) + 4)|0;
  7226. $646 = $645;
  7227. $647 = HEAP32[$646>>2]|0;
  7228. $648 = (_bitshift64Ashr(0,($644|0),32)|0);
  7229. $649 = tempRet0;
  7230. $650 = (___muldi3(($648|0),($649|0),($640|0),($641|0))|0);
  7231. $651 = tempRet0;
  7232. $652 = (_i64Add(($632|0),($633|0),($650|0),($651|0))|0);
  7233. $653 = tempRet0;
  7234. $654 = $423;
  7235. $655 = $654;
  7236. $656 = HEAP32[$655>>2]|0;
  7237. $657 = (($654) + 4)|0;
  7238. $658 = $657;
  7239. $659 = HEAP32[$658>>2]|0;
  7240. $660 = (_bitshift64Ashr(0,($656|0),32)|0);
  7241. $661 = tempRet0;
  7242. $662 = $93;
  7243. $663 = $662;
  7244. $664 = HEAP32[$663>>2]|0;
  7245. $665 = (($662) + 4)|0;
  7246. $666 = $665;
  7247. $667 = HEAP32[$666>>2]|0;
  7248. $668 = (_bitshift64Ashr(0,($664|0),32)|0);
  7249. $669 = tempRet0;
  7250. $670 = (___muldi3(($668|0),($669|0),($660|0),($661|0))|0);
  7251. $671 = tempRet0;
  7252. $672 = (_i64Add(($652|0),($653|0),($670|0),($671|0))|0);
  7253. $673 = tempRet0;
  7254. $674 = $41;
  7255. $675 = $674;
  7256. $676 = HEAP32[$675>>2]|0;
  7257. $677 = (($674) + 4)|0;
  7258. $678 = $677;
  7259. $679 = HEAP32[$678>>2]|0;
  7260. $680 = (_bitshift64Ashr(0,($676|0),32)|0);
  7261. $681 = tempRet0;
  7262. $682 = $557;
  7263. $683 = $682;
  7264. $684 = HEAP32[$683>>2]|0;
  7265. $685 = (($682) + 4)|0;
  7266. $686 = $685;
  7267. $687 = HEAP32[$686>>2]|0;
  7268. $688 = (_bitshift64Ashr(0,($684|0),32)|0);
  7269. $689 = tempRet0;
  7270. $690 = (___muldi3(($688|0),($689|0),($680|0),($681|0))|0);
  7271. $691 = tempRet0;
  7272. $692 = (_i64Add(($672|0),($673|0),($690|0),($691|0))|0);
  7273. $693 = tempRet0;
  7274. $694 = $570;
  7275. $695 = $694;
  7276. $696 = HEAP32[$695>>2]|0;
  7277. $697 = (($694) + 4)|0;
  7278. $698 = $697;
  7279. $699 = HEAP32[$698>>2]|0;
  7280. $700 = (_bitshift64Ashr(0,($696|0),32)|0);
  7281. $701 = tempRet0;
  7282. $702 = $30;
  7283. $703 = $702;
  7284. $704 = HEAP32[$703>>2]|0;
  7285. $705 = (($702) + 4)|0;
  7286. $706 = $705;
  7287. $707 = HEAP32[$706>>2]|0;
  7288. $708 = (_bitshift64Ashr(0,($704|0),32)|0);
  7289. $709 = tempRet0;
  7290. $710 = (___muldi3(($708|0),($709|0),($700|0),($701|0))|0);
  7291. $711 = tempRet0;
  7292. $712 = (_i64Add(($692|0),($693|0),($710|0),($711|0))|0);
  7293. $713 = tempRet0;
  7294. $714 = $in2;
  7295. $715 = $714;
  7296. $716 = HEAP32[$715>>2]|0;
  7297. $717 = (($714) + 4)|0;
  7298. $718 = $717;
  7299. $719 = HEAP32[$718>>2]|0;
  7300. $720 = (_bitshift64Ashr(0,($716|0),32)|0);
  7301. $721 = tempRet0;
  7302. $722 = (($in) + 56|0);
  7303. $723 = $722;
  7304. $724 = $723;
  7305. $725 = HEAP32[$724>>2]|0;
  7306. $726 = (($723) + 4)|0;
  7307. $727 = $726;
  7308. $728 = HEAP32[$727>>2]|0;
  7309. $729 = (_bitshift64Ashr(0,($725|0),32)|0);
  7310. $730 = tempRet0;
  7311. $731 = (___muldi3(($729|0),($730|0),($720|0),($721|0))|0);
  7312. $732 = tempRet0;
  7313. $733 = (_i64Add(($712|0),($713|0),($731|0),($732|0))|0);
  7314. $734 = tempRet0;
  7315. $735 = (($in2) + 56|0);
  7316. $736 = $735;
  7317. $737 = $736;
  7318. $738 = HEAP32[$737>>2]|0;
  7319. $739 = (($736) + 4)|0;
  7320. $740 = $739;
  7321. $741 = HEAP32[$740>>2]|0;
  7322. $742 = (_bitshift64Ashr(0,($738|0),32)|0);
  7323. $743 = tempRet0;
  7324. $744 = $in;
  7325. $745 = $744;
  7326. $746 = HEAP32[$745>>2]|0;
  7327. $747 = (($744) + 4)|0;
  7328. $748 = $747;
  7329. $749 = HEAP32[$748>>2]|0;
  7330. $750 = (_bitshift64Ashr(0,($746|0),32)|0);
  7331. $751 = tempRet0;
  7332. $752 = (___muldi3(($750|0),($751|0),($742|0),($743|0))|0);
  7333. $753 = tempRet0;
  7334. $754 = (_i64Add(($733|0),($734|0),($752|0),($753|0))|0);
  7335. $755 = tempRet0;
  7336. $756 = (($output) + 56|0);
  7337. $757 = $756;
  7338. $758 = $757;
  7339. HEAP32[$758>>2] = $754;
  7340. $759 = (($757) + 4)|0;
  7341. $760 = $759;
  7342. HEAP32[$760>>2] = $755;
  7343. $761 = $298;
  7344. $762 = $761;
  7345. $763 = HEAP32[$762>>2]|0;
  7346. $764 = (($761) + 4)|0;
  7347. $765 = $764;
  7348. $766 = HEAP32[$765>>2]|0;
  7349. $767 = (_bitshift64Ashr(0,($763|0),32)|0);
  7350. $768 = tempRet0;
  7351. $769 = $285;
  7352. $770 = $769;
  7353. $771 = HEAP32[$770>>2]|0;
  7354. $772 = (($769) + 4)|0;
  7355. $773 = $772;
  7356. $774 = HEAP32[$773>>2]|0;
  7357. $775 = (_bitshift64Ashr(0,($771|0),32)|0);
  7358. $776 = tempRet0;
  7359. $777 = (___muldi3(($775|0),($776|0),($767|0),($768|0))|0);
  7360. $778 = tempRet0;
  7361. $779 = $191;
  7362. $780 = $779;
  7363. $781 = HEAP32[$780>>2]|0;
  7364. $782 = (($779) + 4)|0;
  7365. $783 = $782;
  7366. $784 = HEAP32[$783>>2]|0;
  7367. $785 = (_bitshift64Ashr(0,($781|0),32)|0);
  7368. $786 = tempRet0;
  7369. $787 = $410;
  7370. $788 = $787;
  7371. $789 = HEAP32[$788>>2]|0;
  7372. $790 = (($787) + 4)|0;
  7373. $791 = $790;
  7374. $792 = HEAP32[$791>>2]|0;
  7375. $793 = (_bitshift64Ashr(0,($789|0),32)|0);
  7376. $794 = tempRet0;
  7377. $795 = (___muldi3(($793|0),($794|0),($785|0),($786|0))|0);
  7378. $796 = tempRet0;
  7379. $797 = $423;
  7380. $798 = $797;
  7381. $799 = HEAP32[$798>>2]|0;
  7382. $800 = (($797) + 4)|0;
  7383. $801 = $800;
  7384. $802 = HEAP32[$801>>2]|0;
  7385. $803 = (_bitshift64Ashr(0,($799|0),32)|0);
  7386. $804 = tempRet0;
  7387. $805 = $178;
  7388. $806 = $805;
  7389. $807 = HEAP32[$806>>2]|0;
  7390. $808 = (($805) + 4)|0;
  7391. $809 = $808;
  7392. $810 = HEAP32[$809>>2]|0;
  7393. $811 = (_bitshift64Ashr(0,($807|0),32)|0);
  7394. $812 = tempRet0;
  7395. $813 = (___muldi3(($811|0),($812|0),($803|0),($804|0))|0);
  7396. $814 = tempRet0;
  7397. $815 = (_i64Add(($813|0),($814|0),($795|0),($796|0))|0);
  7398. $816 = tempRet0;
  7399. $817 = $41;
  7400. $818 = $817;
  7401. $819 = HEAP32[$818>>2]|0;
  7402. $820 = (($817) + 4)|0;
  7403. $821 = $820;
  7404. $822 = HEAP32[$821>>2]|0;
  7405. $823 = (_bitshift64Ashr(0,($819|0),32)|0);
  7406. $824 = tempRet0;
  7407. $825 = $722;
  7408. $826 = $825;
  7409. $827 = HEAP32[$826>>2]|0;
  7410. $828 = (($825) + 4)|0;
  7411. $829 = $828;
  7412. $830 = HEAP32[$829>>2]|0;
  7413. $831 = (_bitshift64Ashr(0,($827|0),32)|0);
  7414. $832 = tempRet0;
  7415. $833 = (___muldi3(($831|0),($832|0),($823|0),($824|0))|0);
  7416. $834 = tempRet0;
  7417. $835 = (_i64Add(($815|0),($816|0),($833|0),($834|0))|0);
  7418. $836 = tempRet0;
  7419. $837 = $735;
  7420. $838 = $837;
  7421. $839 = HEAP32[$838>>2]|0;
  7422. $840 = (($837) + 4)|0;
  7423. $841 = $840;
  7424. $842 = HEAP32[$841>>2]|0;
  7425. $843 = (_bitshift64Ashr(0,($839|0),32)|0);
  7426. $844 = tempRet0;
  7427. $845 = $30;
  7428. $846 = $845;
  7429. $847 = HEAP32[$846>>2]|0;
  7430. $848 = (($845) + 4)|0;
  7431. $849 = $848;
  7432. $850 = HEAP32[$849>>2]|0;
  7433. $851 = (_bitshift64Ashr(0,($847|0),32)|0);
  7434. $852 = tempRet0;
  7435. $853 = (___muldi3(($851|0),($852|0),($843|0),($844|0))|0);
  7436. $854 = tempRet0;
  7437. $855 = (_i64Add(($835|0),($836|0),($853|0),($854|0))|0);
  7438. $856 = tempRet0;
  7439. $857 = (_bitshift64Shl(($855|0),($856|0),1)|0);
  7440. $858 = tempRet0;
  7441. $859 = (_i64Add(($857|0),($858|0),($777|0),($778|0))|0);
  7442. $860 = tempRet0;
  7443. $861 = $106;
  7444. $862 = $861;
  7445. $863 = HEAP32[$862>>2]|0;
  7446. $864 = (($861) + 4)|0;
  7447. $865 = $864;
  7448. $866 = HEAP32[$865>>2]|0;
  7449. $867 = (_bitshift64Ashr(0,($863|0),32)|0);
  7450. $868 = tempRet0;
  7451. $869 = $557;
  7452. $870 = $869;
  7453. $871 = HEAP32[$870>>2]|0;
  7454. $872 = (($869) + 4)|0;
  7455. $873 = $872;
  7456. $874 = HEAP32[$873>>2]|0;
  7457. $875 = (_bitshift64Ashr(0,($871|0),32)|0);
  7458. $876 = tempRet0;
  7459. $877 = (___muldi3(($875|0),($876|0),($867|0),($868|0))|0);
  7460. $878 = tempRet0;
  7461. $879 = (_i64Add(($859|0),($860|0),($877|0),($878|0))|0);
  7462. $880 = tempRet0;
  7463. $881 = $570;
  7464. $882 = $881;
  7465. $883 = HEAP32[$882>>2]|0;
  7466. $884 = (($881) + 4)|0;
  7467. $885 = $884;
  7468. $886 = HEAP32[$885>>2]|0;
  7469. $887 = (_bitshift64Ashr(0,($883|0),32)|0);
  7470. $888 = tempRet0;
  7471. $889 = $93;
  7472. $890 = $889;
  7473. $891 = HEAP32[$890>>2]|0;
  7474. $892 = (($889) + 4)|0;
  7475. $893 = $892;
  7476. $894 = HEAP32[$893>>2]|0;
  7477. $895 = (_bitshift64Ashr(0,($891|0),32)|0);
  7478. $896 = tempRet0;
  7479. $897 = (___muldi3(($895|0),($896|0),($887|0),($888|0))|0);
  7480. $898 = tempRet0;
  7481. $899 = (_i64Add(($879|0),($880|0),($897|0),($898|0))|0);
  7482. $900 = tempRet0;
  7483. $901 = $in2;
  7484. $902 = $901;
  7485. $903 = HEAP32[$902>>2]|0;
  7486. $904 = (($901) + 4)|0;
  7487. $905 = $904;
  7488. $906 = HEAP32[$905>>2]|0;
  7489. $907 = (_bitshift64Ashr(0,($903|0),32)|0);
  7490. $908 = tempRet0;
  7491. $909 = (($in) + 64|0);
  7492. $910 = $909;
  7493. $911 = $910;
  7494. $912 = HEAP32[$911>>2]|0;
  7495. $913 = (($910) + 4)|0;
  7496. $914 = $913;
  7497. $915 = HEAP32[$914>>2]|0;
  7498. $916 = (_bitshift64Ashr(0,($912|0),32)|0);
  7499. $917 = tempRet0;
  7500. $918 = (___muldi3(($916|0),($917|0),($907|0),($908|0))|0);
  7501. $919 = tempRet0;
  7502. $920 = (_i64Add(($899|0),($900|0),($918|0),($919|0))|0);
  7503. $921 = tempRet0;
  7504. $922 = (($in2) + 64|0);
  7505. $923 = $922;
  7506. $924 = $923;
  7507. $925 = HEAP32[$924>>2]|0;
  7508. $926 = (($923) + 4)|0;
  7509. $927 = $926;
  7510. $928 = HEAP32[$927>>2]|0;
  7511. $929 = (_bitshift64Ashr(0,($925|0),32)|0);
  7512. $930 = tempRet0;
  7513. $931 = $in;
  7514. $932 = $931;
  7515. $933 = HEAP32[$932>>2]|0;
  7516. $934 = (($931) + 4)|0;
  7517. $935 = $934;
  7518. $936 = HEAP32[$935>>2]|0;
  7519. $937 = (_bitshift64Ashr(0,($933|0),32)|0);
  7520. $938 = tempRet0;
  7521. $939 = (___muldi3(($937|0),($938|0),($929|0),($930|0))|0);
  7522. $940 = tempRet0;
  7523. $941 = (_i64Add(($920|0),($921|0),($939|0),($940|0))|0);
  7524. $942 = tempRet0;
  7525. $943 = (($output) + 64|0);
  7526. $944 = $943;
  7527. $945 = $944;
  7528. HEAP32[$945>>2] = $941;
  7529. $946 = (($944) + 4)|0;
  7530. $947 = $946;
  7531. HEAP32[$947>>2] = $942;
  7532. $948 = $298;
  7533. $949 = $948;
  7534. $950 = HEAP32[$949>>2]|0;
  7535. $951 = (($948) + 4)|0;
  7536. $952 = $951;
  7537. $953 = HEAP32[$952>>2]|0;
  7538. $954 = (_bitshift64Ashr(0,($950|0),32)|0);
  7539. $955 = tempRet0;
  7540. $956 = $410;
  7541. $957 = $956;
  7542. $958 = HEAP32[$957>>2]|0;
  7543. $959 = (($956) + 4)|0;
  7544. $960 = $959;
  7545. $961 = HEAP32[$960>>2]|0;
  7546. $962 = (_bitshift64Ashr(0,($958|0),32)|0);
  7547. $963 = tempRet0;
  7548. $964 = (___muldi3(($962|0),($963|0),($954|0),($955|0))|0);
  7549. $965 = tempRet0;
  7550. $966 = $423;
  7551. $967 = $966;
  7552. $968 = HEAP32[$967>>2]|0;
  7553. $969 = (($966) + 4)|0;
  7554. $970 = $969;
  7555. $971 = HEAP32[$970>>2]|0;
  7556. $972 = (_bitshift64Ashr(0,($968|0),32)|0);
  7557. $973 = tempRet0;
  7558. $974 = $285;
  7559. $975 = $974;
  7560. $976 = HEAP32[$975>>2]|0;
  7561. $977 = (($974) + 4)|0;
  7562. $978 = $977;
  7563. $979 = HEAP32[$978>>2]|0;
  7564. $980 = (_bitshift64Ashr(0,($976|0),32)|0);
  7565. $981 = tempRet0;
  7566. $982 = (___muldi3(($980|0),($981|0),($972|0),($973|0))|0);
  7567. $983 = tempRet0;
  7568. $984 = (_i64Add(($982|0),($983|0),($964|0),($965|0))|0);
  7569. $985 = tempRet0;
  7570. $986 = $191;
  7571. $987 = $986;
  7572. $988 = HEAP32[$987>>2]|0;
  7573. $989 = (($986) + 4)|0;
  7574. $990 = $989;
  7575. $991 = HEAP32[$990>>2]|0;
  7576. $992 = (_bitshift64Ashr(0,($988|0),32)|0);
  7577. $993 = tempRet0;
  7578. $994 = $557;
  7579. $995 = $994;
  7580. $996 = HEAP32[$995>>2]|0;
  7581. $997 = (($994) + 4)|0;
  7582. $998 = $997;
  7583. $999 = HEAP32[$998>>2]|0;
  7584. $1000 = (_bitshift64Ashr(0,($996|0),32)|0);
  7585. $1001 = tempRet0;
  7586. $1002 = (___muldi3(($1000|0),($1001|0),($992|0),($993|0))|0);
  7587. $1003 = tempRet0;
  7588. $1004 = (_i64Add(($984|0),($985|0),($1002|0),($1003|0))|0);
  7589. $1005 = tempRet0;
  7590. $1006 = $570;
  7591. $1007 = $1006;
  7592. $1008 = HEAP32[$1007>>2]|0;
  7593. $1009 = (($1006) + 4)|0;
  7594. $1010 = $1009;
  7595. $1011 = HEAP32[$1010>>2]|0;
  7596. $1012 = (_bitshift64Ashr(0,($1008|0),32)|0);
  7597. $1013 = tempRet0;
  7598. $1014 = $178;
  7599. $1015 = $1014;
  7600. $1016 = HEAP32[$1015>>2]|0;
  7601. $1017 = (($1014) + 4)|0;
  7602. $1018 = $1017;
  7603. $1019 = HEAP32[$1018>>2]|0;
  7604. $1020 = (_bitshift64Ashr(0,($1016|0),32)|0);
  7605. $1021 = tempRet0;
  7606. $1022 = (___muldi3(($1020|0),($1021|0),($1012|0),($1013|0))|0);
  7607. $1023 = tempRet0;
  7608. $1024 = (_i64Add(($1004|0),($1005|0),($1022|0),($1023|0))|0);
  7609. $1025 = tempRet0;
  7610. $1026 = $106;
  7611. $1027 = $1026;
  7612. $1028 = HEAP32[$1027>>2]|0;
  7613. $1029 = (($1026) + 4)|0;
  7614. $1030 = $1029;
  7615. $1031 = HEAP32[$1030>>2]|0;
  7616. $1032 = (_bitshift64Ashr(0,($1028|0),32)|0);
  7617. $1033 = tempRet0;
  7618. $1034 = $722;
  7619. $1035 = $1034;
  7620. $1036 = HEAP32[$1035>>2]|0;
  7621. $1037 = (($1034) + 4)|0;
  7622. $1038 = $1037;
  7623. $1039 = HEAP32[$1038>>2]|0;
  7624. $1040 = (_bitshift64Ashr(0,($1036|0),32)|0);
  7625. $1041 = tempRet0;
  7626. $1042 = (___muldi3(($1040|0),($1041|0),($1032|0),($1033|0))|0);
  7627. $1043 = tempRet0;
  7628. $1044 = (_i64Add(($1024|0),($1025|0),($1042|0),($1043|0))|0);
  7629. $1045 = tempRet0;
  7630. $1046 = $735;
  7631. $1047 = $1046;
  7632. $1048 = HEAP32[$1047>>2]|0;
  7633. $1049 = (($1046) + 4)|0;
  7634. $1050 = $1049;
  7635. $1051 = HEAP32[$1050>>2]|0;
  7636. $1052 = (_bitshift64Ashr(0,($1048|0),32)|0);
  7637. $1053 = tempRet0;
  7638. $1054 = $93;
  7639. $1055 = $1054;
  7640. $1056 = HEAP32[$1055>>2]|0;
  7641. $1057 = (($1054) + 4)|0;
  7642. $1058 = $1057;
  7643. $1059 = HEAP32[$1058>>2]|0;
  7644. $1060 = (_bitshift64Ashr(0,($1056|0),32)|0);
  7645. $1061 = tempRet0;
  7646. $1062 = (___muldi3(($1060|0),($1061|0),($1052|0),($1053|0))|0);
  7647. $1063 = tempRet0;
  7648. $1064 = (_i64Add(($1044|0),($1045|0),($1062|0),($1063|0))|0);
  7649. $1065 = tempRet0;
  7650. $1066 = $41;
  7651. $1067 = $1066;
  7652. $1068 = HEAP32[$1067>>2]|0;
  7653. $1069 = (($1066) + 4)|0;
  7654. $1070 = $1069;
  7655. $1071 = HEAP32[$1070>>2]|0;
  7656. $1072 = (_bitshift64Ashr(0,($1068|0),32)|0);
  7657. $1073 = tempRet0;
  7658. $1074 = $909;
  7659. $1075 = $1074;
  7660. $1076 = HEAP32[$1075>>2]|0;
  7661. $1077 = (($1074) + 4)|0;
  7662. $1078 = $1077;
  7663. $1079 = HEAP32[$1078>>2]|0;
  7664. $1080 = (_bitshift64Ashr(0,($1076|0),32)|0);
  7665. $1081 = tempRet0;
  7666. $1082 = (___muldi3(($1080|0),($1081|0),($1072|0),($1073|0))|0);
  7667. $1083 = tempRet0;
  7668. $1084 = (_i64Add(($1064|0),($1065|0),($1082|0),($1083|0))|0);
  7669. $1085 = tempRet0;
  7670. $1086 = $922;
  7671. $1087 = $1086;
  7672. $1088 = HEAP32[$1087>>2]|0;
  7673. $1089 = (($1086) + 4)|0;
  7674. $1090 = $1089;
  7675. $1091 = HEAP32[$1090>>2]|0;
  7676. $1092 = (_bitshift64Ashr(0,($1088|0),32)|0);
  7677. $1093 = tempRet0;
  7678. $1094 = $30;
  7679. $1095 = $1094;
  7680. $1096 = HEAP32[$1095>>2]|0;
  7681. $1097 = (($1094) + 4)|0;
  7682. $1098 = $1097;
  7683. $1099 = HEAP32[$1098>>2]|0;
  7684. $1100 = (_bitshift64Ashr(0,($1096|0),32)|0);
  7685. $1101 = tempRet0;
  7686. $1102 = (___muldi3(($1100|0),($1101|0),($1092|0),($1093|0))|0);
  7687. $1103 = tempRet0;
  7688. $1104 = (_i64Add(($1084|0),($1085|0),($1102|0),($1103|0))|0);
  7689. $1105 = tempRet0;
  7690. $1106 = $in2;
  7691. $1107 = $1106;
  7692. $1108 = HEAP32[$1107>>2]|0;
  7693. $1109 = (($1106) + 4)|0;
  7694. $1110 = $1109;
  7695. $1111 = HEAP32[$1110>>2]|0;
  7696. $1112 = (_bitshift64Ashr(0,($1108|0),32)|0);
  7697. $1113 = tempRet0;
  7698. $1114 = (($in) + 72|0);
  7699. $1115 = $1114;
  7700. $1116 = $1115;
  7701. $1117 = HEAP32[$1116>>2]|0;
  7702. $1118 = (($1115) + 4)|0;
  7703. $1119 = $1118;
  7704. $1120 = HEAP32[$1119>>2]|0;
  7705. $1121 = (_bitshift64Ashr(0,($1117|0),32)|0);
  7706. $1122 = tempRet0;
  7707. $1123 = (___muldi3(($1121|0),($1122|0),($1112|0),($1113|0))|0);
  7708. $1124 = tempRet0;
  7709. $1125 = (_i64Add(($1104|0),($1105|0),($1123|0),($1124|0))|0);
  7710. $1126 = tempRet0;
  7711. $1127 = (($in2) + 72|0);
  7712. $1128 = $1127;
  7713. $1129 = $1128;
  7714. $1130 = HEAP32[$1129>>2]|0;
  7715. $1131 = (($1128) + 4)|0;
  7716. $1132 = $1131;
  7717. $1133 = HEAP32[$1132>>2]|0;
  7718. $1134 = (_bitshift64Ashr(0,($1130|0),32)|0);
  7719. $1135 = tempRet0;
  7720. $1136 = $in;
  7721. $1137 = $1136;
  7722. $1138 = HEAP32[$1137>>2]|0;
  7723. $1139 = (($1136) + 4)|0;
  7724. $1140 = $1139;
  7725. $1141 = HEAP32[$1140>>2]|0;
  7726. $1142 = (_bitshift64Ashr(0,($1138|0),32)|0);
  7727. $1143 = tempRet0;
  7728. $1144 = (___muldi3(($1142|0),($1143|0),($1134|0),($1135|0))|0);
  7729. $1145 = tempRet0;
  7730. $1146 = (_i64Add(($1125|0),($1126|0),($1144|0),($1145|0))|0);
  7731. $1147 = tempRet0;
  7732. $1148 = (($output) + 72|0);
  7733. $1149 = $1148;
  7734. $1150 = $1149;
  7735. HEAP32[$1150>>2] = $1146;
  7736. $1151 = (($1149) + 4)|0;
  7737. $1152 = $1151;
  7738. HEAP32[$1152>>2] = $1147;
  7739. $1153 = $423;
  7740. $1154 = $1153;
  7741. $1155 = HEAP32[$1154>>2]|0;
  7742. $1156 = (($1153) + 4)|0;
  7743. $1157 = $1156;
  7744. $1158 = HEAP32[$1157>>2]|0;
  7745. $1159 = (_bitshift64Ashr(0,($1155|0),32)|0);
  7746. $1160 = tempRet0;
  7747. $1161 = $410;
  7748. $1162 = $1161;
  7749. $1163 = HEAP32[$1162>>2]|0;
  7750. $1164 = (($1161) + 4)|0;
  7751. $1165 = $1164;
  7752. $1166 = HEAP32[$1165>>2]|0;
  7753. $1167 = (_bitshift64Ashr(0,($1163|0),32)|0);
  7754. $1168 = tempRet0;
  7755. $1169 = (___muldi3(($1167|0),($1168|0),($1159|0),($1160|0))|0);
  7756. $1170 = tempRet0;
  7757. $1171 = $191;
  7758. $1172 = $1171;
  7759. $1173 = HEAP32[$1172>>2]|0;
  7760. $1174 = (($1171) + 4)|0;
  7761. $1175 = $1174;
  7762. $1176 = HEAP32[$1175>>2]|0;
  7763. $1177 = (_bitshift64Ashr(0,($1173|0),32)|0);
  7764. $1178 = tempRet0;
  7765. $1179 = $722;
  7766. $1180 = $1179;
  7767. $1181 = HEAP32[$1180>>2]|0;
  7768. $1182 = (($1179) + 4)|0;
  7769. $1183 = $1182;
  7770. $1184 = HEAP32[$1183>>2]|0;
  7771. $1185 = (_bitshift64Ashr(0,($1181|0),32)|0);
  7772. $1186 = tempRet0;
  7773. $1187 = (___muldi3(($1185|0),($1186|0),($1177|0),($1178|0))|0);
  7774. $1188 = tempRet0;
  7775. $1189 = (_i64Add(($1187|0),($1188|0),($1169|0),($1170|0))|0);
  7776. $1190 = tempRet0;
  7777. $1191 = $735;
  7778. $1192 = $1191;
  7779. $1193 = HEAP32[$1192>>2]|0;
  7780. $1194 = (($1191) + 4)|0;
  7781. $1195 = $1194;
  7782. $1196 = HEAP32[$1195>>2]|0;
  7783. $1197 = (_bitshift64Ashr(0,($1193|0),32)|0);
  7784. $1198 = tempRet0;
  7785. $1199 = $178;
  7786. $1200 = $1199;
  7787. $1201 = HEAP32[$1200>>2]|0;
  7788. $1202 = (($1199) + 4)|0;
  7789. $1203 = $1202;
  7790. $1204 = HEAP32[$1203>>2]|0;
  7791. $1205 = (_bitshift64Ashr(0,($1201|0),32)|0);
  7792. $1206 = tempRet0;
  7793. $1207 = (___muldi3(($1205|0),($1206|0),($1197|0),($1198|0))|0);
  7794. $1208 = tempRet0;
  7795. $1209 = (_i64Add(($1189|0),($1190|0),($1207|0),($1208|0))|0);
  7796. $1210 = tempRet0;
  7797. $1211 = $41;
  7798. $1212 = $1211;
  7799. $1213 = HEAP32[$1212>>2]|0;
  7800. $1214 = (($1211) + 4)|0;
  7801. $1215 = $1214;
  7802. $1216 = HEAP32[$1215>>2]|0;
  7803. $1217 = (_bitshift64Ashr(0,($1213|0),32)|0);
  7804. $1218 = tempRet0;
  7805. $1219 = $1114;
  7806. $1220 = $1219;
  7807. $1221 = HEAP32[$1220>>2]|0;
  7808. $1222 = (($1219) + 4)|0;
  7809. $1223 = $1222;
  7810. $1224 = HEAP32[$1223>>2]|0;
  7811. $1225 = (_bitshift64Ashr(0,($1221|0),32)|0);
  7812. $1226 = tempRet0;
  7813. $1227 = (___muldi3(($1225|0),($1226|0),($1217|0),($1218|0))|0);
  7814. $1228 = tempRet0;
  7815. $1229 = (_i64Add(($1209|0),($1210|0),($1227|0),($1228|0))|0);
  7816. $1230 = tempRet0;
  7817. $1231 = $1127;
  7818. $1232 = $1231;
  7819. $1233 = HEAP32[$1232>>2]|0;
  7820. $1234 = (($1231) + 4)|0;
  7821. $1235 = $1234;
  7822. $1236 = HEAP32[$1235>>2]|0;
  7823. $1237 = (_bitshift64Ashr(0,($1233|0),32)|0);
  7824. $1238 = tempRet0;
  7825. $1239 = $30;
  7826. $1240 = $1239;
  7827. $1241 = HEAP32[$1240>>2]|0;
  7828. $1242 = (($1239) + 4)|0;
  7829. $1243 = $1242;
  7830. $1244 = HEAP32[$1243>>2]|0;
  7831. $1245 = (_bitshift64Ashr(0,($1241|0),32)|0);
  7832. $1246 = tempRet0;
  7833. $1247 = (___muldi3(($1245|0),($1246|0),($1237|0),($1238|0))|0);
  7834. $1248 = tempRet0;
  7835. $1249 = (_i64Add(($1229|0),($1230|0),($1247|0),($1248|0))|0);
  7836. $1250 = tempRet0;
  7837. $1251 = (_bitshift64Shl(($1249|0),($1250|0),1)|0);
  7838. $1252 = tempRet0;
  7839. $1253 = $298;
  7840. $1254 = $1253;
  7841. $1255 = HEAP32[$1254>>2]|0;
  7842. $1256 = (($1253) + 4)|0;
  7843. $1257 = $1256;
  7844. $1258 = HEAP32[$1257>>2]|0;
  7845. $1259 = (_bitshift64Ashr(0,($1255|0),32)|0);
  7846. $1260 = tempRet0;
  7847. $1261 = $557;
  7848. $1262 = $1261;
  7849. $1263 = HEAP32[$1262>>2]|0;
  7850. $1264 = (($1261) + 4)|0;
  7851. $1265 = $1264;
  7852. $1266 = HEAP32[$1265>>2]|0;
  7853. $1267 = (_bitshift64Ashr(0,($1263|0),32)|0);
  7854. $1268 = tempRet0;
  7855. $1269 = (___muldi3(($1267|0),($1268|0),($1259|0),($1260|0))|0);
  7856. $1270 = tempRet0;
  7857. $1271 = (_i64Add(($1251|0),($1252|0),($1269|0),($1270|0))|0);
  7858. $1272 = tempRet0;
  7859. $1273 = $570;
  7860. $1274 = $1273;
  7861. $1275 = HEAP32[$1274>>2]|0;
  7862. $1276 = (($1273) + 4)|0;
  7863. $1277 = $1276;
  7864. $1278 = HEAP32[$1277>>2]|0;
  7865. $1279 = (_bitshift64Ashr(0,($1275|0),32)|0);
  7866. $1280 = tempRet0;
  7867. $1281 = $285;
  7868. $1282 = $1281;
  7869. $1283 = HEAP32[$1282>>2]|0;
  7870. $1284 = (($1281) + 4)|0;
  7871. $1285 = $1284;
  7872. $1286 = HEAP32[$1285>>2]|0;
  7873. $1287 = (_bitshift64Ashr(0,($1283|0),32)|0);
  7874. $1288 = tempRet0;
  7875. $1289 = (___muldi3(($1287|0),($1288|0),($1279|0),($1280|0))|0);
  7876. $1290 = tempRet0;
  7877. $1291 = (_i64Add(($1271|0),($1272|0),($1289|0),($1290|0))|0);
  7878. $1292 = tempRet0;
  7879. $1293 = $106;
  7880. $1294 = $1293;
  7881. $1295 = HEAP32[$1294>>2]|0;
  7882. $1296 = (($1293) + 4)|0;
  7883. $1297 = $1296;
  7884. $1298 = HEAP32[$1297>>2]|0;
  7885. $1299 = (_bitshift64Ashr(0,($1295|0),32)|0);
  7886. $1300 = tempRet0;
  7887. $1301 = $909;
  7888. $1302 = $1301;
  7889. $1303 = HEAP32[$1302>>2]|0;
  7890. $1304 = (($1301) + 4)|0;
  7891. $1305 = $1304;
  7892. $1306 = HEAP32[$1305>>2]|0;
  7893. $1307 = (_bitshift64Ashr(0,($1303|0),32)|0);
  7894. $1308 = tempRet0;
  7895. $1309 = (___muldi3(($1307|0),($1308|0),($1299|0),($1300|0))|0);
  7896. $1310 = tempRet0;
  7897. $1311 = (_i64Add(($1291|0),($1292|0),($1309|0),($1310|0))|0);
  7898. $1312 = tempRet0;
  7899. $1313 = $922;
  7900. $1314 = $1313;
  7901. $1315 = HEAP32[$1314>>2]|0;
  7902. $1316 = (($1313) + 4)|0;
  7903. $1317 = $1316;
  7904. $1318 = HEAP32[$1317>>2]|0;
  7905. $1319 = (_bitshift64Ashr(0,($1315|0),32)|0);
  7906. $1320 = tempRet0;
  7907. $1321 = $93;
  7908. $1322 = $1321;
  7909. $1323 = HEAP32[$1322>>2]|0;
  7910. $1324 = (($1321) + 4)|0;
  7911. $1325 = $1324;
  7912. $1326 = HEAP32[$1325>>2]|0;
  7913. $1327 = (_bitshift64Ashr(0,($1323|0),32)|0);
  7914. $1328 = tempRet0;
  7915. $1329 = (___muldi3(($1327|0),($1328|0),($1319|0),($1320|0))|0);
  7916. $1330 = tempRet0;
  7917. $1331 = (_i64Add(($1311|0),($1312|0),($1329|0),($1330|0))|0);
  7918. $1332 = tempRet0;
  7919. $1333 = (($output) + 80|0);
  7920. $1334 = $1333;
  7921. $1335 = $1334;
  7922. HEAP32[$1335>>2] = $1331;
  7923. $1336 = (($1334) + 4)|0;
  7924. $1337 = $1336;
  7925. HEAP32[$1337>>2] = $1332;
  7926. $1338 = $423;
  7927. $1339 = $1338;
  7928. $1340 = HEAP32[$1339>>2]|0;
  7929. $1341 = (($1338) + 4)|0;
  7930. $1342 = $1341;
  7931. $1343 = HEAP32[$1342>>2]|0;
  7932. $1344 = (_bitshift64Ashr(0,($1340|0),32)|0);
  7933. $1345 = tempRet0;
  7934. $1346 = $557;
  7935. $1347 = $1346;
  7936. $1348 = HEAP32[$1347>>2]|0;
  7937. $1349 = (($1346) + 4)|0;
  7938. $1350 = $1349;
  7939. $1351 = HEAP32[$1350>>2]|0;
  7940. $1352 = (_bitshift64Ashr(0,($1348|0),32)|0);
  7941. $1353 = tempRet0;
  7942. $1354 = (___muldi3(($1352|0),($1353|0),($1344|0),($1345|0))|0);
  7943. $1355 = tempRet0;
  7944. $1356 = $570;
  7945. $1357 = $1356;
  7946. $1358 = HEAP32[$1357>>2]|0;
  7947. $1359 = (($1356) + 4)|0;
  7948. $1360 = $1359;
  7949. $1361 = HEAP32[$1360>>2]|0;
  7950. $1362 = (_bitshift64Ashr(0,($1358|0),32)|0);
  7951. $1363 = tempRet0;
  7952. $1364 = $410;
  7953. $1365 = $1364;
  7954. $1366 = HEAP32[$1365>>2]|0;
  7955. $1367 = (($1364) + 4)|0;
  7956. $1368 = $1367;
  7957. $1369 = HEAP32[$1368>>2]|0;
  7958. $1370 = (_bitshift64Ashr(0,($1366|0),32)|0);
  7959. $1371 = tempRet0;
  7960. $1372 = (___muldi3(($1370|0),($1371|0),($1362|0),($1363|0))|0);
  7961. $1373 = tempRet0;
  7962. $1374 = (_i64Add(($1372|0),($1373|0),($1354|0),($1355|0))|0);
  7963. $1375 = tempRet0;
  7964. $1376 = $298;
  7965. $1377 = $1376;
  7966. $1378 = HEAP32[$1377>>2]|0;
  7967. $1379 = (($1376) + 4)|0;
  7968. $1380 = $1379;
  7969. $1381 = HEAP32[$1380>>2]|0;
  7970. $1382 = (_bitshift64Ashr(0,($1378|0),32)|0);
  7971. $1383 = tempRet0;
  7972. $1384 = $722;
  7973. $1385 = $1384;
  7974. $1386 = HEAP32[$1385>>2]|0;
  7975. $1387 = (($1384) + 4)|0;
  7976. $1388 = $1387;
  7977. $1389 = HEAP32[$1388>>2]|0;
  7978. $1390 = (_bitshift64Ashr(0,($1386|0),32)|0);
  7979. $1391 = tempRet0;
  7980. $1392 = (___muldi3(($1390|0),($1391|0),($1382|0),($1383|0))|0);
  7981. $1393 = tempRet0;
  7982. $1394 = (_i64Add(($1374|0),($1375|0),($1392|0),($1393|0))|0);
  7983. $1395 = tempRet0;
  7984. $1396 = $735;
  7985. $1397 = $1396;
  7986. $1398 = HEAP32[$1397>>2]|0;
  7987. $1399 = (($1396) + 4)|0;
  7988. $1400 = $1399;
  7989. $1401 = HEAP32[$1400>>2]|0;
  7990. $1402 = (_bitshift64Ashr(0,($1398|0),32)|0);
  7991. $1403 = tempRet0;
  7992. $1404 = $285;
  7993. $1405 = $1404;
  7994. $1406 = HEAP32[$1405>>2]|0;
  7995. $1407 = (($1404) + 4)|0;
  7996. $1408 = $1407;
  7997. $1409 = HEAP32[$1408>>2]|0;
  7998. $1410 = (_bitshift64Ashr(0,($1406|0),32)|0);
  7999. $1411 = tempRet0;
  8000. $1412 = (___muldi3(($1410|0),($1411|0),($1402|0),($1403|0))|0);
  8001. $1413 = tempRet0;
  8002. $1414 = (_i64Add(($1394|0),($1395|0),($1412|0),($1413|0))|0);
  8003. $1415 = tempRet0;
  8004. $1416 = $191;
  8005. $1417 = $1416;
  8006. $1418 = HEAP32[$1417>>2]|0;
  8007. $1419 = (($1416) + 4)|0;
  8008. $1420 = $1419;
  8009. $1421 = HEAP32[$1420>>2]|0;
  8010. $1422 = (_bitshift64Ashr(0,($1418|0),32)|0);
  8011. $1423 = tempRet0;
  8012. $1424 = $909;
  8013. $1425 = $1424;
  8014. $1426 = HEAP32[$1425>>2]|0;
  8015. $1427 = (($1424) + 4)|0;
  8016. $1428 = $1427;
  8017. $1429 = HEAP32[$1428>>2]|0;
  8018. $1430 = (_bitshift64Ashr(0,($1426|0),32)|0);
  8019. $1431 = tempRet0;
  8020. $1432 = (___muldi3(($1430|0),($1431|0),($1422|0),($1423|0))|0);
  8021. $1433 = tempRet0;
  8022. $1434 = (_i64Add(($1414|0),($1415|0),($1432|0),($1433|0))|0);
  8023. $1435 = tempRet0;
  8024. $1436 = $922;
  8025. $1437 = $1436;
  8026. $1438 = HEAP32[$1437>>2]|0;
  8027. $1439 = (($1436) + 4)|0;
  8028. $1440 = $1439;
  8029. $1441 = HEAP32[$1440>>2]|0;
  8030. $1442 = (_bitshift64Ashr(0,($1438|0),32)|0);
  8031. $1443 = tempRet0;
  8032. $1444 = $178;
  8033. $1445 = $1444;
  8034. $1446 = HEAP32[$1445>>2]|0;
  8035. $1447 = (($1444) + 4)|0;
  8036. $1448 = $1447;
  8037. $1449 = HEAP32[$1448>>2]|0;
  8038. $1450 = (_bitshift64Ashr(0,($1446|0),32)|0);
  8039. $1451 = tempRet0;
  8040. $1452 = (___muldi3(($1450|0),($1451|0),($1442|0),($1443|0))|0);
  8041. $1453 = tempRet0;
  8042. $1454 = (_i64Add(($1434|0),($1435|0),($1452|0),($1453|0))|0);
  8043. $1455 = tempRet0;
  8044. $1456 = $106;
  8045. $1457 = $1456;
  8046. $1458 = HEAP32[$1457>>2]|0;
  8047. $1459 = (($1456) + 4)|0;
  8048. $1460 = $1459;
  8049. $1461 = HEAP32[$1460>>2]|0;
  8050. $1462 = (_bitshift64Ashr(0,($1458|0),32)|0);
  8051. $1463 = tempRet0;
  8052. $1464 = $1114;
  8053. $1465 = $1464;
  8054. $1466 = HEAP32[$1465>>2]|0;
  8055. $1467 = (($1464) + 4)|0;
  8056. $1468 = $1467;
  8057. $1469 = HEAP32[$1468>>2]|0;
  8058. $1470 = (_bitshift64Ashr(0,($1466|0),32)|0);
  8059. $1471 = tempRet0;
  8060. $1472 = (___muldi3(($1470|0),($1471|0),($1462|0),($1463|0))|0);
  8061. $1473 = tempRet0;
  8062. $1474 = (_i64Add(($1454|0),($1455|0),($1472|0),($1473|0))|0);
  8063. $1475 = tempRet0;
  8064. $1476 = $1127;
  8065. $1477 = $1476;
  8066. $1478 = HEAP32[$1477>>2]|0;
  8067. $1479 = (($1476) + 4)|0;
  8068. $1480 = $1479;
  8069. $1481 = HEAP32[$1480>>2]|0;
  8070. $1482 = (_bitshift64Ashr(0,($1478|0),32)|0);
  8071. $1483 = tempRet0;
  8072. $1484 = $93;
  8073. $1485 = $1484;
  8074. $1486 = HEAP32[$1485>>2]|0;
  8075. $1487 = (($1484) + 4)|0;
  8076. $1488 = $1487;
  8077. $1489 = HEAP32[$1488>>2]|0;
  8078. $1490 = (_bitshift64Ashr(0,($1486|0),32)|0);
  8079. $1491 = tempRet0;
  8080. $1492 = (___muldi3(($1490|0),($1491|0),($1482|0),($1483|0))|0);
  8081. $1493 = tempRet0;
  8082. $1494 = (_i64Add(($1474|0),($1475|0),($1492|0),($1493|0))|0);
  8083. $1495 = tempRet0;
  8084. $1496 = (($output) + 88|0);
  8085. $1497 = $1496;
  8086. $1498 = $1497;
  8087. HEAP32[$1498>>2] = $1494;
  8088. $1499 = (($1497) + 4)|0;
  8089. $1500 = $1499;
  8090. HEAP32[$1500>>2] = $1495;
  8091. $1501 = $570;
  8092. $1502 = $1501;
  8093. $1503 = HEAP32[$1502>>2]|0;
  8094. $1504 = (($1501) + 4)|0;
  8095. $1505 = $1504;
  8096. $1506 = HEAP32[$1505>>2]|0;
  8097. $1507 = (_bitshift64Ashr(0,($1503|0),32)|0);
  8098. $1508 = tempRet0;
  8099. $1509 = $557;
  8100. $1510 = $1509;
  8101. $1511 = HEAP32[$1510>>2]|0;
  8102. $1512 = (($1509) + 4)|0;
  8103. $1513 = $1512;
  8104. $1514 = HEAP32[$1513>>2]|0;
  8105. $1515 = (_bitshift64Ashr(0,($1511|0),32)|0);
  8106. $1516 = tempRet0;
  8107. $1517 = (___muldi3(($1515|0),($1516|0),($1507|0),($1508|0))|0);
  8108. $1518 = tempRet0;
  8109. $1519 = $423;
  8110. $1520 = $1519;
  8111. $1521 = HEAP32[$1520>>2]|0;
  8112. $1522 = (($1519) + 4)|0;
  8113. $1523 = $1522;
  8114. $1524 = HEAP32[$1523>>2]|0;
  8115. $1525 = (_bitshift64Ashr(0,($1521|0),32)|0);
  8116. $1526 = tempRet0;
  8117. $1527 = $722;
  8118. $1528 = $1527;
  8119. $1529 = HEAP32[$1528>>2]|0;
  8120. $1530 = (($1527) + 4)|0;
  8121. $1531 = $1530;
  8122. $1532 = HEAP32[$1531>>2]|0;
  8123. $1533 = (_bitshift64Ashr(0,($1529|0),32)|0);
  8124. $1534 = tempRet0;
  8125. $1535 = (___muldi3(($1533|0),($1534|0),($1525|0),($1526|0))|0);
  8126. $1536 = tempRet0;
  8127. $1537 = $735;
  8128. $1538 = $1537;
  8129. $1539 = HEAP32[$1538>>2]|0;
  8130. $1540 = (($1537) + 4)|0;
  8131. $1541 = $1540;
  8132. $1542 = HEAP32[$1541>>2]|0;
  8133. $1543 = (_bitshift64Ashr(0,($1539|0),32)|0);
  8134. $1544 = tempRet0;
  8135. $1545 = $410;
  8136. $1546 = $1545;
  8137. $1547 = HEAP32[$1546>>2]|0;
  8138. $1548 = (($1545) + 4)|0;
  8139. $1549 = $1548;
  8140. $1550 = HEAP32[$1549>>2]|0;
  8141. $1551 = (_bitshift64Ashr(0,($1547|0),32)|0);
  8142. $1552 = tempRet0;
  8143. $1553 = (___muldi3(($1551|0),($1552|0),($1543|0),($1544|0))|0);
  8144. $1554 = tempRet0;
  8145. $1555 = (_i64Add(($1553|0),($1554|0),($1535|0),($1536|0))|0);
  8146. $1556 = tempRet0;
  8147. $1557 = $191;
  8148. $1558 = $1557;
  8149. $1559 = HEAP32[$1558>>2]|0;
  8150. $1560 = (($1557) + 4)|0;
  8151. $1561 = $1560;
  8152. $1562 = HEAP32[$1561>>2]|0;
  8153. $1563 = (_bitshift64Ashr(0,($1559|0),32)|0);
  8154. $1564 = tempRet0;
  8155. $1565 = $1114;
  8156. $1566 = $1565;
  8157. $1567 = HEAP32[$1566>>2]|0;
  8158. $1568 = (($1565) + 4)|0;
  8159. $1569 = $1568;
  8160. $1570 = HEAP32[$1569>>2]|0;
  8161. $1571 = (_bitshift64Ashr(0,($1567|0),32)|0);
  8162. $1572 = tempRet0;
  8163. $1573 = (___muldi3(($1571|0),($1572|0),($1563|0),($1564|0))|0);
  8164. $1574 = tempRet0;
  8165. $1575 = (_i64Add(($1555|0),($1556|0),($1573|0),($1574|0))|0);
  8166. $1576 = tempRet0;
  8167. $1577 = $1127;
  8168. $1578 = $1577;
  8169. $1579 = HEAP32[$1578>>2]|0;
  8170. $1580 = (($1577) + 4)|0;
  8171. $1581 = $1580;
  8172. $1582 = HEAP32[$1581>>2]|0;
  8173. $1583 = (_bitshift64Ashr(0,($1579|0),32)|0);
  8174. $1584 = tempRet0;
  8175. $1585 = $178;
  8176. $1586 = $1585;
  8177. $1587 = HEAP32[$1586>>2]|0;
  8178. $1588 = (($1585) + 4)|0;
  8179. $1589 = $1588;
  8180. $1590 = HEAP32[$1589>>2]|0;
  8181. $1591 = (_bitshift64Ashr(0,($1587|0),32)|0);
  8182. $1592 = tempRet0;
  8183. $1593 = (___muldi3(($1591|0),($1592|0),($1583|0),($1584|0))|0);
  8184. $1594 = tempRet0;
  8185. $1595 = (_i64Add(($1575|0),($1576|0),($1593|0),($1594|0))|0);
  8186. $1596 = tempRet0;
  8187. $1597 = (_bitshift64Shl(($1595|0),($1596|0),1)|0);
  8188. $1598 = tempRet0;
  8189. $1599 = (_i64Add(($1597|0),($1598|0),($1517|0),($1518|0))|0);
  8190. $1600 = tempRet0;
  8191. $1601 = $298;
  8192. $1602 = $1601;
  8193. $1603 = HEAP32[$1602>>2]|0;
  8194. $1604 = (($1601) + 4)|0;
  8195. $1605 = $1604;
  8196. $1606 = HEAP32[$1605>>2]|0;
  8197. $1607 = (_bitshift64Ashr(0,($1603|0),32)|0);
  8198. $1608 = tempRet0;
  8199. $1609 = $909;
  8200. $1610 = $1609;
  8201. $1611 = HEAP32[$1610>>2]|0;
  8202. $1612 = (($1609) + 4)|0;
  8203. $1613 = $1612;
  8204. $1614 = HEAP32[$1613>>2]|0;
  8205. $1615 = (_bitshift64Ashr(0,($1611|0),32)|0);
  8206. $1616 = tempRet0;
  8207. $1617 = (___muldi3(($1615|0),($1616|0),($1607|0),($1608|0))|0);
  8208. $1618 = tempRet0;
  8209. $1619 = (_i64Add(($1599|0),($1600|0),($1617|0),($1618|0))|0);
  8210. $1620 = tempRet0;
  8211. $1621 = $922;
  8212. $1622 = $1621;
  8213. $1623 = HEAP32[$1622>>2]|0;
  8214. $1624 = (($1621) + 4)|0;
  8215. $1625 = $1624;
  8216. $1626 = HEAP32[$1625>>2]|0;
  8217. $1627 = (_bitshift64Ashr(0,($1623|0),32)|0);
  8218. $1628 = tempRet0;
  8219. $1629 = $285;
  8220. $1630 = $1629;
  8221. $1631 = HEAP32[$1630>>2]|0;
  8222. $1632 = (($1629) + 4)|0;
  8223. $1633 = $1632;
  8224. $1634 = HEAP32[$1633>>2]|0;
  8225. $1635 = (_bitshift64Ashr(0,($1631|0),32)|0);
  8226. $1636 = tempRet0;
  8227. $1637 = (___muldi3(($1635|0),($1636|0),($1627|0),($1628|0))|0);
  8228. $1638 = tempRet0;
  8229. $1639 = (_i64Add(($1619|0),($1620|0),($1637|0),($1638|0))|0);
  8230. $1640 = tempRet0;
  8231. $1641 = (($output) + 96|0);
  8232. $1642 = $1641;
  8233. $1643 = $1642;
  8234. HEAP32[$1643>>2] = $1639;
  8235. $1644 = (($1642) + 4)|0;
  8236. $1645 = $1644;
  8237. HEAP32[$1645>>2] = $1640;
  8238. $1646 = $570;
  8239. $1647 = $1646;
  8240. $1648 = HEAP32[$1647>>2]|0;
  8241. $1649 = (($1646) + 4)|0;
  8242. $1650 = $1649;
  8243. $1651 = HEAP32[$1650>>2]|0;
  8244. $1652 = (_bitshift64Ashr(0,($1648|0),32)|0);
  8245. $1653 = tempRet0;
  8246. $1654 = $722;
  8247. $1655 = $1654;
  8248. $1656 = HEAP32[$1655>>2]|0;
  8249. $1657 = (($1654) + 4)|0;
  8250. $1658 = $1657;
  8251. $1659 = HEAP32[$1658>>2]|0;
  8252. $1660 = (_bitshift64Ashr(0,($1656|0),32)|0);
  8253. $1661 = tempRet0;
  8254. $1662 = (___muldi3(($1660|0),($1661|0),($1652|0),($1653|0))|0);
  8255. $1663 = tempRet0;
  8256. $1664 = $735;
  8257. $1665 = $1664;
  8258. $1666 = HEAP32[$1665>>2]|0;
  8259. $1667 = (($1664) + 4)|0;
  8260. $1668 = $1667;
  8261. $1669 = HEAP32[$1668>>2]|0;
  8262. $1670 = (_bitshift64Ashr(0,($1666|0),32)|0);
  8263. $1671 = tempRet0;
  8264. $1672 = $557;
  8265. $1673 = $1672;
  8266. $1674 = HEAP32[$1673>>2]|0;
  8267. $1675 = (($1672) + 4)|0;
  8268. $1676 = $1675;
  8269. $1677 = HEAP32[$1676>>2]|0;
  8270. $1678 = (_bitshift64Ashr(0,($1674|0),32)|0);
  8271. $1679 = tempRet0;
  8272. $1680 = (___muldi3(($1678|0),($1679|0),($1670|0),($1671|0))|0);
  8273. $1681 = tempRet0;
  8274. $1682 = (_i64Add(($1680|0),($1681|0),($1662|0),($1663|0))|0);
  8275. $1683 = tempRet0;
  8276. $1684 = $423;
  8277. $1685 = $1684;
  8278. $1686 = HEAP32[$1685>>2]|0;
  8279. $1687 = (($1684) + 4)|0;
  8280. $1688 = $1687;
  8281. $1689 = HEAP32[$1688>>2]|0;
  8282. $1690 = (_bitshift64Ashr(0,($1686|0),32)|0);
  8283. $1691 = tempRet0;
  8284. $1692 = $909;
  8285. $1693 = $1692;
  8286. $1694 = HEAP32[$1693>>2]|0;
  8287. $1695 = (($1692) + 4)|0;
  8288. $1696 = $1695;
  8289. $1697 = HEAP32[$1696>>2]|0;
  8290. $1698 = (_bitshift64Ashr(0,($1694|0),32)|0);
  8291. $1699 = tempRet0;
  8292. $1700 = (___muldi3(($1698|0),($1699|0),($1690|0),($1691|0))|0);
  8293. $1701 = tempRet0;
  8294. $1702 = (_i64Add(($1682|0),($1683|0),($1700|0),($1701|0))|0);
  8295. $1703 = tempRet0;
  8296. $1704 = $922;
  8297. $1705 = $1704;
  8298. $1706 = HEAP32[$1705>>2]|0;
  8299. $1707 = (($1704) + 4)|0;
  8300. $1708 = $1707;
  8301. $1709 = HEAP32[$1708>>2]|0;
  8302. $1710 = (_bitshift64Ashr(0,($1706|0),32)|0);
  8303. $1711 = tempRet0;
  8304. $1712 = $410;
  8305. $1713 = $1712;
  8306. $1714 = HEAP32[$1713>>2]|0;
  8307. $1715 = (($1712) + 4)|0;
  8308. $1716 = $1715;
  8309. $1717 = HEAP32[$1716>>2]|0;
  8310. $1718 = (_bitshift64Ashr(0,($1714|0),32)|0);
  8311. $1719 = tempRet0;
  8312. $1720 = (___muldi3(($1718|0),($1719|0),($1710|0),($1711|0))|0);
  8313. $1721 = tempRet0;
  8314. $1722 = (_i64Add(($1702|0),($1703|0),($1720|0),($1721|0))|0);
  8315. $1723 = tempRet0;
  8316. $1724 = $298;
  8317. $1725 = $1724;
  8318. $1726 = HEAP32[$1725>>2]|0;
  8319. $1727 = (($1724) + 4)|0;
  8320. $1728 = $1727;
  8321. $1729 = HEAP32[$1728>>2]|0;
  8322. $1730 = (_bitshift64Ashr(0,($1726|0),32)|0);
  8323. $1731 = tempRet0;
  8324. $1732 = $1114;
  8325. $1733 = $1732;
  8326. $1734 = HEAP32[$1733>>2]|0;
  8327. $1735 = (($1732) + 4)|0;
  8328. $1736 = $1735;
  8329. $1737 = HEAP32[$1736>>2]|0;
  8330. $1738 = (_bitshift64Ashr(0,($1734|0),32)|0);
  8331. $1739 = tempRet0;
  8332. $1740 = (___muldi3(($1738|0),($1739|0),($1730|0),($1731|0))|0);
  8333. $1741 = tempRet0;
  8334. $1742 = (_i64Add(($1722|0),($1723|0),($1740|0),($1741|0))|0);
  8335. $1743 = tempRet0;
  8336. $1744 = $1127;
  8337. $1745 = $1744;
  8338. $1746 = HEAP32[$1745>>2]|0;
  8339. $1747 = (($1744) + 4)|0;
  8340. $1748 = $1747;
  8341. $1749 = HEAP32[$1748>>2]|0;
  8342. $1750 = (_bitshift64Ashr(0,($1746|0),32)|0);
  8343. $1751 = tempRet0;
  8344. $1752 = $285;
  8345. $1753 = $1752;
  8346. $1754 = HEAP32[$1753>>2]|0;
  8347. $1755 = (($1752) + 4)|0;
  8348. $1756 = $1755;
  8349. $1757 = HEAP32[$1756>>2]|0;
  8350. $1758 = (_bitshift64Ashr(0,($1754|0),32)|0);
  8351. $1759 = tempRet0;
  8352. $1760 = (___muldi3(($1758|0),($1759|0),($1750|0),($1751|0))|0);
  8353. $1761 = tempRet0;
  8354. $1762 = (_i64Add(($1742|0),($1743|0),($1760|0),($1761|0))|0);
  8355. $1763 = tempRet0;
  8356. $1764 = (($output) + 104|0);
  8357. $1765 = $1764;
  8358. $1766 = $1765;
  8359. HEAP32[$1766>>2] = $1762;
  8360. $1767 = (($1765) + 4)|0;
  8361. $1768 = $1767;
  8362. HEAP32[$1768>>2] = $1763;
  8363. $1769 = $735;
  8364. $1770 = $1769;
  8365. $1771 = HEAP32[$1770>>2]|0;
  8366. $1772 = (($1769) + 4)|0;
  8367. $1773 = $1772;
  8368. $1774 = HEAP32[$1773>>2]|0;
  8369. $1775 = (_bitshift64Ashr(0,($1771|0),32)|0);
  8370. $1776 = tempRet0;
  8371. $1777 = $722;
  8372. $1778 = $1777;
  8373. $1779 = HEAP32[$1778>>2]|0;
  8374. $1780 = (($1777) + 4)|0;
  8375. $1781 = $1780;
  8376. $1782 = HEAP32[$1781>>2]|0;
  8377. $1783 = (_bitshift64Ashr(0,($1779|0),32)|0);
  8378. $1784 = tempRet0;
  8379. $1785 = (___muldi3(($1783|0),($1784|0),($1775|0),($1776|0))|0);
  8380. $1786 = tempRet0;
  8381. $1787 = $423;
  8382. $1788 = $1787;
  8383. $1789 = HEAP32[$1788>>2]|0;
  8384. $1790 = (($1787) + 4)|0;
  8385. $1791 = $1790;
  8386. $1792 = HEAP32[$1791>>2]|0;
  8387. $1793 = (_bitshift64Ashr(0,($1789|0),32)|0);
  8388. $1794 = tempRet0;
  8389. $1795 = $1114;
  8390. $1796 = $1795;
  8391. $1797 = HEAP32[$1796>>2]|0;
  8392. $1798 = (($1795) + 4)|0;
  8393. $1799 = $1798;
  8394. $1800 = HEAP32[$1799>>2]|0;
  8395. $1801 = (_bitshift64Ashr(0,($1797|0),32)|0);
  8396. $1802 = tempRet0;
  8397. $1803 = (___muldi3(($1801|0),($1802|0),($1793|0),($1794|0))|0);
  8398. $1804 = tempRet0;
  8399. $1805 = (_i64Add(($1803|0),($1804|0),($1785|0),($1786|0))|0);
  8400. $1806 = tempRet0;
  8401. $1807 = $1127;
  8402. $1808 = $1807;
  8403. $1809 = HEAP32[$1808>>2]|0;
  8404. $1810 = (($1807) + 4)|0;
  8405. $1811 = $1810;
  8406. $1812 = HEAP32[$1811>>2]|0;
  8407. $1813 = (_bitshift64Ashr(0,($1809|0),32)|0);
  8408. $1814 = tempRet0;
  8409. $1815 = $410;
  8410. $1816 = $1815;
  8411. $1817 = HEAP32[$1816>>2]|0;
  8412. $1818 = (($1815) + 4)|0;
  8413. $1819 = $1818;
  8414. $1820 = HEAP32[$1819>>2]|0;
  8415. $1821 = (_bitshift64Ashr(0,($1817|0),32)|0);
  8416. $1822 = tempRet0;
  8417. $1823 = (___muldi3(($1821|0),($1822|0),($1813|0),($1814|0))|0);
  8418. $1824 = tempRet0;
  8419. $1825 = (_i64Add(($1805|0),($1806|0),($1823|0),($1824|0))|0);
  8420. $1826 = tempRet0;
  8421. $1827 = (_bitshift64Shl(($1825|0),($1826|0),1)|0);
  8422. $1828 = tempRet0;
  8423. $1829 = $570;
  8424. $1830 = $1829;
  8425. $1831 = HEAP32[$1830>>2]|0;
  8426. $1832 = (($1829) + 4)|0;
  8427. $1833 = $1832;
  8428. $1834 = HEAP32[$1833>>2]|0;
  8429. $1835 = (_bitshift64Ashr(0,($1831|0),32)|0);
  8430. $1836 = tempRet0;
  8431. $1837 = $909;
  8432. $1838 = $1837;
  8433. $1839 = HEAP32[$1838>>2]|0;
  8434. $1840 = (($1837) + 4)|0;
  8435. $1841 = $1840;
  8436. $1842 = HEAP32[$1841>>2]|0;
  8437. $1843 = (_bitshift64Ashr(0,($1839|0),32)|0);
  8438. $1844 = tempRet0;
  8439. $1845 = (___muldi3(($1843|0),($1844|0),($1835|0),($1836|0))|0);
  8440. $1846 = tempRet0;
  8441. $1847 = (_i64Add(($1827|0),($1828|0),($1845|0),($1846|0))|0);
  8442. $1848 = tempRet0;
  8443. $1849 = $922;
  8444. $1850 = $1849;
  8445. $1851 = HEAP32[$1850>>2]|0;
  8446. $1852 = (($1849) + 4)|0;
  8447. $1853 = $1852;
  8448. $1854 = HEAP32[$1853>>2]|0;
  8449. $1855 = (_bitshift64Ashr(0,($1851|0),32)|0);
  8450. $1856 = tempRet0;
  8451. $1857 = $557;
  8452. $1858 = $1857;
  8453. $1859 = HEAP32[$1858>>2]|0;
  8454. $1860 = (($1857) + 4)|0;
  8455. $1861 = $1860;
  8456. $1862 = HEAP32[$1861>>2]|0;
  8457. $1863 = (_bitshift64Ashr(0,($1859|0),32)|0);
  8458. $1864 = tempRet0;
  8459. $1865 = (___muldi3(($1863|0),($1864|0),($1855|0),($1856|0))|0);
  8460. $1866 = tempRet0;
  8461. $1867 = (_i64Add(($1847|0),($1848|0),($1865|0),($1866|0))|0);
  8462. $1868 = tempRet0;
  8463. $1869 = (($output) + 112|0);
  8464. $1870 = $1869;
  8465. $1871 = $1870;
  8466. HEAP32[$1871>>2] = $1867;
  8467. $1872 = (($1870) + 4)|0;
  8468. $1873 = $1872;
  8469. HEAP32[$1873>>2] = $1868;
  8470. $1874 = $735;
  8471. $1875 = $1874;
  8472. $1876 = HEAP32[$1875>>2]|0;
  8473. $1877 = (($1874) + 4)|0;
  8474. $1878 = $1877;
  8475. $1879 = HEAP32[$1878>>2]|0;
  8476. $1880 = (_bitshift64Ashr(0,($1876|0),32)|0);
  8477. $1881 = tempRet0;
  8478. $1882 = $909;
  8479. $1883 = $1882;
  8480. $1884 = HEAP32[$1883>>2]|0;
  8481. $1885 = (($1882) + 4)|0;
  8482. $1886 = $1885;
  8483. $1887 = HEAP32[$1886>>2]|0;
  8484. $1888 = (_bitshift64Ashr(0,($1884|0),32)|0);
  8485. $1889 = tempRet0;
  8486. $1890 = (___muldi3(($1888|0),($1889|0),($1880|0),($1881|0))|0);
  8487. $1891 = tempRet0;
  8488. $1892 = $922;
  8489. $1893 = $1892;
  8490. $1894 = HEAP32[$1893>>2]|0;
  8491. $1895 = (($1892) + 4)|0;
  8492. $1896 = $1895;
  8493. $1897 = HEAP32[$1896>>2]|0;
  8494. $1898 = (_bitshift64Ashr(0,($1894|0),32)|0);
  8495. $1899 = tempRet0;
  8496. $1900 = $722;
  8497. $1901 = $1900;
  8498. $1902 = HEAP32[$1901>>2]|0;
  8499. $1903 = (($1900) + 4)|0;
  8500. $1904 = $1903;
  8501. $1905 = HEAP32[$1904>>2]|0;
  8502. $1906 = (_bitshift64Ashr(0,($1902|0),32)|0);
  8503. $1907 = tempRet0;
  8504. $1908 = (___muldi3(($1906|0),($1907|0),($1898|0),($1899|0))|0);
  8505. $1909 = tempRet0;
  8506. $1910 = (_i64Add(($1908|0),($1909|0),($1890|0),($1891|0))|0);
  8507. $1911 = tempRet0;
  8508. $1912 = $570;
  8509. $1913 = $1912;
  8510. $1914 = HEAP32[$1913>>2]|0;
  8511. $1915 = (($1912) + 4)|0;
  8512. $1916 = $1915;
  8513. $1917 = HEAP32[$1916>>2]|0;
  8514. $1918 = (_bitshift64Ashr(0,($1914|0),32)|0);
  8515. $1919 = tempRet0;
  8516. $1920 = $1114;
  8517. $1921 = $1920;
  8518. $1922 = HEAP32[$1921>>2]|0;
  8519. $1923 = (($1920) + 4)|0;
  8520. $1924 = $1923;
  8521. $1925 = HEAP32[$1924>>2]|0;
  8522. $1926 = (_bitshift64Ashr(0,($1922|0),32)|0);
  8523. $1927 = tempRet0;
  8524. $1928 = (___muldi3(($1926|0),($1927|0),($1918|0),($1919|0))|0);
  8525. $1929 = tempRet0;
  8526. $1930 = (_i64Add(($1910|0),($1911|0),($1928|0),($1929|0))|0);
  8527. $1931 = tempRet0;
  8528. $1932 = $1127;
  8529. $1933 = $1932;
  8530. $1934 = HEAP32[$1933>>2]|0;
  8531. $1935 = (($1932) + 4)|0;
  8532. $1936 = $1935;
  8533. $1937 = HEAP32[$1936>>2]|0;
  8534. $1938 = (_bitshift64Ashr(0,($1934|0),32)|0);
  8535. $1939 = tempRet0;
  8536. $1940 = $557;
  8537. $1941 = $1940;
  8538. $1942 = HEAP32[$1941>>2]|0;
  8539. $1943 = (($1940) + 4)|0;
  8540. $1944 = $1943;
  8541. $1945 = HEAP32[$1944>>2]|0;
  8542. $1946 = (_bitshift64Ashr(0,($1942|0),32)|0);
  8543. $1947 = tempRet0;
  8544. $1948 = (___muldi3(($1946|0),($1947|0),($1938|0),($1939|0))|0);
  8545. $1949 = tempRet0;
  8546. $1950 = (_i64Add(($1930|0),($1931|0),($1948|0),($1949|0))|0);
  8547. $1951 = tempRet0;
  8548. $1952 = (($output) + 120|0);
  8549. $1953 = $1952;
  8550. $1954 = $1953;
  8551. HEAP32[$1954>>2] = $1950;
  8552. $1955 = (($1953) + 4)|0;
  8553. $1956 = $1955;
  8554. HEAP32[$1956>>2] = $1951;
  8555. $1957 = $922;
  8556. $1958 = $1957;
  8557. $1959 = HEAP32[$1958>>2]|0;
  8558. $1960 = (($1957) + 4)|0;
  8559. $1961 = $1960;
  8560. $1962 = HEAP32[$1961>>2]|0;
  8561. $1963 = (_bitshift64Ashr(0,($1959|0),32)|0);
  8562. $1964 = tempRet0;
  8563. $1965 = $909;
  8564. $1966 = $1965;
  8565. $1967 = HEAP32[$1966>>2]|0;
  8566. $1968 = (($1965) + 4)|0;
  8567. $1969 = $1968;
  8568. $1970 = HEAP32[$1969>>2]|0;
  8569. $1971 = (_bitshift64Ashr(0,($1967|0),32)|0);
  8570. $1972 = tempRet0;
  8571. $1973 = (___muldi3(($1971|0),($1972|0),($1963|0),($1964|0))|0);
  8572. $1974 = tempRet0;
  8573. $1975 = $735;
  8574. $1976 = $1975;
  8575. $1977 = HEAP32[$1976>>2]|0;
  8576. $1978 = (($1975) + 4)|0;
  8577. $1979 = $1978;
  8578. $1980 = HEAP32[$1979>>2]|0;
  8579. $1981 = (_bitshift64Ashr(0,($1977|0),32)|0);
  8580. $1982 = tempRet0;
  8581. $1983 = $1114;
  8582. $1984 = $1983;
  8583. $1985 = HEAP32[$1984>>2]|0;
  8584. $1986 = (($1983) + 4)|0;
  8585. $1987 = $1986;
  8586. $1988 = HEAP32[$1987>>2]|0;
  8587. $1989 = (_bitshift64Ashr(0,($1985|0),32)|0);
  8588. $1990 = tempRet0;
  8589. $1991 = (___muldi3(($1989|0),($1990|0),($1981|0),($1982|0))|0);
  8590. $1992 = tempRet0;
  8591. $1993 = $1127;
  8592. $1994 = $1993;
  8593. $1995 = HEAP32[$1994>>2]|0;
  8594. $1996 = (($1993) + 4)|0;
  8595. $1997 = $1996;
  8596. $1998 = HEAP32[$1997>>2]|0;
  8597. $1999 = (_bitshift64Ashr(0,($1995|0),32)|0);
  8598. $2000 = tempRet0;
  8599. $2001 = $722;
  8600. $2002 = $2001;
  8601. $2003 = HEAP32[$2002>>2]|0;
  8602. $2004 = (($2001) + 4)|0;
  8603. $2005 = $2004;
  8604. $2006 = HEAP32[$2005>>2]|0;
  8605. $2007 = (_bitshift64Ashr(0,($2003|0),32)|0);
  8606. $2008 = tempRet0;
  8607. $2009 = (___muldi3(($2007|0),($2008|0),($1999|0),($2000|0))|0);
  8608. $2010 = tempRet0;
  8609. $2011 = (_i64Add(($2009|0),($2010|0),($1991|0),($1992|0))|0);
  8610. $2012 = tempRet0;
  8611. $2013 = (_bitshift64Shl(($2011|0),($2012|0),1)|0);
  8612. $2014 = tempRet0;
  8613. $2015 = (_i64Add(($2013|0),($2014|0),($1973|0),($1974|0))|0);
  8614. $2016 = tempRet0;
  8615. $2017 = (($output) + 128|0);
  8616. $2018 = $2017;
  8617. $2019 = $2018;
  8618. HEAP32[$2019>>2] = $2015;
  8619. $2020 = (($2018) + 4)|0;
  8620. $2021 = $2020;
  8621. HEAP32[$2021>>2] = $2016;
  8622. $2022 = $922;
  8623. $2023 = $2022;
  8624. $2024 = HEAP32[$2023>>2]|0;
  8625. $2025 = (($2022) + 4)|0;
  8626. $2026 = $2025;
  8627. $2027 = HEAP32[$2026>>2]|0;
  8628. $2028 = (_bitshift64Ashr(0,($2024|0),32)|0);
  8629. $2029 = tempRet0;
  8630. $2030 = $1114;
  8631. $2031 = $2030;
  8632. $2032 = HEAP32[$2031>>2]|0;
  8633. $2033 = (($2030) + 4)|0;
  8634. $2034 = $2033;
  8635. $2035 = HEAP32[$2034>>2]|0;
  8636. $2036 = (_bitshift64Ashr(0,($2032|0),32)|0);
  8637. $2037 = tempRet0;
  8638. $2038 = (___muldi3(($2036|0),($2037|0),($2028|0),($2029|0))|0);
  8639. $2039 = tempRet0;
  8640. $2040 = $1127;
  8641. $2041 = $2040;
  8642. $2042 = HEAP32[$2041>>2]|0;
  8643. $2043 = (($2040) + 4)|0;
  8644. $2044 = $2043;
  8645. $2045 = HEAP32[$2044>>2]|0;
  8646. $2046 = (_bitshift64Ashr(0,($2042|0),32)|0);
  8647. $2047 = tempRet0;
  8648. $2048 = $909;
  8649. $2049 = $2048;
  8650. $2050 = HEAP32[$2049>>2]|0;
  8651. $2051 = (($2048) + 4)|0;
  8652. $2052 = $2051;
  8653. $2053 = HEAP32[$2052>>2]|0;
  8654. $2054 = (_bitshift64Ashr(0,($2050|0),32)|0);
  8655. $2055 = tempRet0;
  8656. $2056 = (___muldi3(($2054|0),($2055|0),($2046|0),($2047|0))|0);
  8657. $2057 = tempRet0;
  8658. $2058 = (_i64Add(($2056|0),($2057|0),($2038|0),($2039|0))|0);
  8659. $2059 = tempRet0;
  8660. $2060 = (($output) + 136|0);
  8661. $2061 = $2060;
  8662. $2062 = $2061;
  8663. HEAP32[$2062>>2] = $2058;
  8664. $2063 = (($2061) + 4)|0;
  8665. $2064 = $2063;
  8666. HEAP32[$2064>>2] = $2059;
  8667. $2065 = $1127;
  8668. $2066 = $2065;
  8669. $2067 = HEAP32[$2066>>2]|0;
  8670. $2068 = (($2065) + 4)|0;
  8671. $2069 = $2068;
  8672. $2070 = HEAP32[$2069>>2]|0;
  8673. $2071 = (_bitshift64Ashr(0,($2067|0),31)|0);
  8674. $2072 = tempRet0;
  8675. $2073 = $1114;
  8676. $2074 = $2073;
  8677. $2075 = HEAP32[$2074>>2]|0;
  8678. $2076 = (($2073) + 4)|0;
  8679. $2077 = $2076;
  8680. $2078 = HEAP32[$2077>>2]|0;
  8681. $2079 = (_bitshift64Ashr(0,($2075|0),32)|0);
  8682. $2080 = tempRet0;
  8683. $2081 = (___muldi3(($2079|0),($2080|0),($2071|0),($2072|0))|0);
  8684. $2082 = tempRet0;
  8685. $2083 = (($output) + 144|0);
  8686. $2084 = $2083;
  8687. $2085 = $2084;
  8688. HEAP32[$2085>>2] = $2081;
  8689. $2086 = (($2084) + 4)|0;
  8690. $2087 = $2086;
  8691. HEAP32[$2087>>2] = $2082;
  8692. STACKTOP = sp;return;
  8693. }
  8694. function _freduce_degree($output) {
  8695. $output = $output|0;
  8696. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  8697. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  8698. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  8699. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  8700. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  8701. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  8702. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  8703. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  8704. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  8705. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  8706. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  8707. var $297 = 0, $298 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0;
  8708. var $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0;
  8709. var $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0;
  8710. var $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0;
  8711. var sp = 0;
  8712. sp = STACKTOP;
  8713. $0 = (($output) + 144|0);
  8714. $1 = $0;
  8715. $2 = $1;
  8716. $3 = HEAP32[$2>>2]|0;
  8717. $4 = (($1) + 4)|0;
  8718. $5 = $4;
  8719. $6 = HEAP32[$5>>2]|0;
  8720. $7 = (_bitshift64Shl(($3|0),($6|0),4)|0);
  8721. $8 = tempRet0;
  8722. $9 = (($output) + 64|0);
  8723. $10 = $9;
  8724. $11 = $10;
  8725. $12 = HEAP32[$11>>2]|0;
  8726. $13 = (($10) + 4)|0;
  8727. $14 = $13;
  8728. $15 = HEAP32[$14>>2]|0;
  8729. $16 = (_i64Add(($12|0),($15|0),($7|0),($8|0))|0);
  8730. $17 = tempRet0;
  8731. $18 = (_bitshift64Shl(($3|0),($6|0),1)|0);
  8732. $19 = tempRet0;
  8733. $20 = (_i64Add(($18|0),($19|0),($16|0),($17|0))|0);
  8734. $21 = tempRet0;
  8735. $22 = $0;
  8736. $23 = $22;
  8737. $24 = HEAP32[$23>>2]|0;
  8738. $25 = (($22) + 4)|0;
  8739. $26 = $25;
  8740. $27 = HEAP32[$26>>2]|0;
  8741. $28 = (_i64Add(($20|0),($21|0),($24|0),($27|0))|0);
  8742. $29 = tempRet0;
  8743. $30 = $9;
  8744. $31 = $30;
  8745. HEAP32[$31>>2] = $28;
  8746. $32 = (($30) + 4)|0;
  8747. $33 = $32;
  8748. HEAP32[$33>>2] = $29;
  8749. $34 = (($output) + 136|0);
  8750. $35 = $34;
  8751. $36 = $35;
  8752. $37 = HEAP32[$36>>2]|0;
  8753. $38 = (($35) + 4)|0;
  8754. $39 = $38;
  8755. $40 = HEAP32[$39>>2]|0;
  8756. $41 = (_bitshift64Shl(($37|0),($40|0),4)|0);
  8757. $42 = tempRet0;
  8758. $43 = (($output) + 56|0);
  8759. $44 = $43;
  8760. $45 = $44;
  8761. $46 = HEAP32[$45>>2]|0;
  8762. $47 = (($44) + 4)|0;
  8763. $48 = $47;
  8764. $49 = HEAP32[$48>>2]|0;
  8765. $50 = (_i64Add(($46|0),($49|0),($41|0),($42|0))|0);
  8766. $51 = tempRet0;
  8767. $52 = (_bitshift64Shl(($37|0),($40|0),1)|0);
  8768. $53 = tempRet0;
  8769. $54 = (_i64Add(($52|0),($53|0),($50|0),($51|0))|0);
  8770. $55 = tempRet0;
  8771. $56 = $34;
  8772. $57 = $56;
  8773. $58 = HEAP32[$57>>2]|0;
  8774. $59 = (($56) + 4)|0;
  8775. $60 = $59;
  8776. $61 = HEAP32[$60>>2]|0;
  8777. $62 = (_i64Add(($54|0),($55|0),($58|0),($61|0))|0);
  8778. $63 = tempRet0;
  8779. $64 = $43;
  8780. $65 = $64;
  8781. HEAP32[$65>>2] = $62;
  8782. $66 = (($64) + 4)|0;
  8783. $67 = $66;
  8784. HEAP32[$67>>2] = $63;
  8785. $68 = (($output) + 128|0);
  8786. $69 = $68;
  8787. $70 = $69;
  8788. $71 = HEAP32[$70>>2]|0;
  8789. $72 = (($69) + 4)|0;
  8790. $73 = $72;
  8791. $74 = HEAP32[$73>>2]|0;
  8792. $75 = (_bitshift64Shl(($71|0),($74|0),4)|0);
  8793. $76 = tempRet0;
  8794. $77 = (($output) + 48|0);
  8795. $78 = $77;
  8796. $79 = $78;
  8797. $80 = HEAP32[$79>>2]|0;
  8798. $81 = (($78) + 4)|0;
  8799. $82 = $81;
  8800. $83 = HEAP32[$82>>2]|0;
  8801. $84 = (_i64Add(($80|0),($83|0),($75|0),($76|0))|0);
  8802. $85 = tempRet0;
  8803. $86 = (_bitshift64Shl(($71|0),($74|0),1)|0);
  8804. $87 = tempRet0;
  8805. $88 = (_i64Add(($86|0),($87|0),($84|0),($85|0))|0);
  8806. $89 = tempRet0;
  8807. $90 = $68;
  8808. $91 = $90;
  8809. $92 = HEAP32[$91>>2]|0;
  8810. $93 = (($90) + 4)|0;
  8811. $94 = $93;
  8812. $95 = HEAP32[$94>>2]|0;
  8813. $96 = (_i64Add(($88|0),($89|0),($92|0),($95|0))|0);
  8814. $97 = tempRet0;
  8815. $98 = $77;
  8816. $99 = $98;
  8817. HEAP32[$99>>2] = $96;
  8818. $100 = (($98) + 4)|0;
  8819. $101 = $100;
  8820. HEAP32[$101>>2] = $97;
  8821. $102 = (($output) + 120|0);
  8822. $103 = $102;
  8823. $104 = $103;
  8824. $105 = HEAP32[$104>>2]|0;
  8825. $106 = (($103) + 4)|0;
  8826. $107 = $106;
  8827. $108 = HEAP32[$107>>2]|0;
  8828. $109 = (_bitshift64Shl(($105|0),($108|0),4)|0);
  8829. $110 = tempRet0;
  8830. $111 = (($output) + 40|0);
  8831. $112 = $111;
  8832. $113 = $112;
  8833. $114 = HEAP32[$113>>2]|0;
  8834. $115 = (($112) + 4)|0;
  8835. $116 = $115;
  8836. $117 = HEAP32[$116>>2]|0;
  8837. $118 = (_i64Add(($114|0),($117|0),($109|0),($110|0))|0);
  8838. $119 = tempRet0;
  8839. $120 = (_bitshift64Shl(($105|0),($108|0),1)|0);
  8840. $121 = tempRet0;
  8841. $122 = (_i64Add(($120|0),($121|0),($118|0),($119|0))|0);
  8842. $123 = tempRet0;
  8843. $124 = $102;
  8844. $125 = $124;
  8845. $126 = HEAP32[$125>>2]|0;
  8846. $127 = (($124) + 4)|0;
  8847. $128 = $127;
  8848. $129 = HEAP32[$128>>2]|0;
  8849. $130 = (_i64Add(($122|0),($123|0),($126|0),($129|0))|0);
  8850. $131 = tempRet0;
  8851. $132 = $111;
  8852. $133 = $132;
  8853. HEAP32[$133>>2] = $130;
  8854. $134 = (($132) + 4)|0;
  8855. $135 = $134;
  8856. HEAP32[$135>>2] = $131;
  8857. $136 = (($output) + 112|0);
  8858. $137 = $136;
  8859. $138 = $137;
  8860. $139 = HEAP32[$138>>2]|0;
  8861. $140 = (($137) + 4)|0;
  8862. $141 = $140;
  8863. $142 = HEAP32[$141>>2]|0;
  8864. $143 = (_bitshift64Shl(($139|0),($142|0),4)|0);
  8865. $144 = tempRet0;
  8866. $145 = (($output) + 32|0);
  8867. $146 = $145;
  8868. $147 = $146;
  8869. $148 = HEAP32[$147>>2]|0;
  8870. $149 = (($146) + 4)|0;
  8871. $150 = $149;
  8872. $151 = HEAP32[$150>>2]|0;
  8873. $152 = (_i64Add(($148|0),($151|0),($143|0),($144|0))|0);
  8874. $153 = tempRet0;
  8875. $154 = (_bitshift64Shl(($139|0),($142|0),1)|0);
  8876. $155 = tempRet0;
  8877. $156 = (_i64Add(($154|0),($155|0),($152|0),($153|0))|0);
  8878. $157 = tempRet0;
  8879. $158 = $136;
  8880. $159 = $158;
  8881. $160 = HEAP32[$159>>2]|0;
  8882. $161 = (($158) + 4)|0;
  8883. $162 = $161;
  8884. $163 = HEAP32[$162>>2]|0;
  8885. $164 = (_i64Add(($156|0),($157|0),($160|0),($163|0))|0);
  8886. $165 = tempRet0;
  8887. $166 = $145;
  8888. $167 = $166;
  8889. HEAP32[$167>>2] = $164;
  8890. $168 = (($166) + 4)|0;
  8891. $169 = $168;
  8892. HEAP32[$169>>2] = $165;
  8893. $170 = (($output) + 104|0);
  8894. $171 = $170;
  8895. $172 = $171;
  8896. $173 = HEAP32[$172>>2]|0;
  8897. $174 = (($171) + 4)|0;
  8898. $175 = $174;
  8899. $176 = HEAP32[$175>>2]|0;
  8900. $177 = (_bitshift64Shl(($173|0),($176|0),4)|0);
  8901. $178 = tempRet0;
  8902. $179 = (($output) + 24|0);
  8903. $180 = $179;
  8904. $181 = $180;
  8905. $182 = HEAP32[$181>>2]|0;
  8906. $183 = (($180) + 4)|0;
  8907. $184 = $183;
  8908. $185 = HEAP32[$184>>2]|0;
  8909. $186 = (_i64Add(($182|0),($185|0),($177|0),($178|0))|0);
  8910. $187 = tempRet0;
  8911. $188 = (_bitshift64Shl(($173|0),($176|0),1)|0);
  8912. $189 = tempRet0;
  8913. $190 = (_i64Add(($188|0),($189|0),($186|0),($187|0))|0);
  8914. $191 = tempRet0;
  8915. $192 = $170;
  8916. $193 = $192;
  8917. $194 = HEAP32[$193>>2]|0;
  8918. $195 = (($192) + 4)|0;
  8919. $196 = $195;
  8920. $197 = HEAP32[$196>>2]|0;
  8921. $198 = (_i64Add(($190|0),($191|0),($194|0),($197|0))|0);
  8922. $199 = tempRet0;
  8923. $200 = $179;
  8924. $201 = $200;
  8925. HEAP32[$201>>2] = $198;
  8926. $202 = (($200) + 4)|0;
  8927. $203 = $202;
  8928. HEAP32[$203>>2] = $199;
  8929. $204 = (($output) + 96|0);
  8930. $205 = $204;
  8931. $206 = $205;
  8932. $207 = HEAP32[$206>>2]|0;
  8933. $208 = (($205) + 4)|0;
  8934. $209 = $208;
  8935. $210 = HEAP32[$209>>2]|0;
  8936. $211 = (_bitshift64Shl(($207|0),($210|0),4)|0);
  8937. $212 = tempRet0;
  8938. $213 = (($output) + 16|0);
  8939. $214 = $213;
  8940. $215 = $214;
  8941. $216 = HEAP32[$215>>2]|0;
  8942. $217 = (($214) + 4)|0;
  8943. $218 = $217;
  8944. $219 = HEAP32[$218>>2]|0;
  8945. $220 = (_i64Add(($216|0),($219|0),($211|0),($212|0))|0);
  8946. $221 = tempRet0;
  8947. $222 = (_bitshift64Shl(($207|0),($210|0),1)|0);
  8948. $223 = tempRet0;
  8949. $224 = (_i64Add(($222|0),($223|0),($220|0),($221|0))|0);
  8950. $225 = tempRet0;
  8951. $226 = $204;
  8952. $227 = $226;
  8953. $228 = HEAP32[$227>>2]|0;
  8954. $229 = (($226) + 4)|0;
  8955. $230 = $229;
  8956. $231 = HEAP32[$230>>2]|0;
  8957. $232 = (_i64Add(($224|0),($225|0),($228|0),($231|0))|0);
  8958. $233 = tempRet0;
  8959. $234 = $213;
  8960. $235 = $234;
  8961. HEAP32[$235>>2] = $232;
  8962. $236 = (($234) + 4)|0;
  8963. $237 = $236;
  8964. HEAP32[$237>>2] = $233;
  8965. $238 = (($output) + 88|0);
  8966. $239 = $238;
  8967. $240 = $239;
  8968. $241 = HEAP32[$240>>2]|0;
  8969. $242 = (($239) + 4)|0;
  8970. $243 = $242;
  8971. $244 = HEAP32[$243>>2]|0;
  8972. $245 = (_bitshift64Shl(($241|0),($244|0),4)|0);
  8973. $246 = tempRet0;
  8974. $247 = (($output) + 8|0);
  8975. $248 = $247;
  8976. $249 = $248;
  8977. $250 = HEAP32[$249>>2]|0;
  8978. $251 = (($248) + 4)|0;
  8979. $252 = $251;
  8980. $253 = HEAP32[$252>>2]|0;
  8981. $254 = (_i64Add(($250|0),($253|0),($245|0),($246|0))|0);
  8982. $255 = tempRet0;
  8983. $256 = (_bitshift64Shl(($241|0),($244|0),1)|0);
  8984. $257 = tempRet0;
  8985. $258 = (_i64Add(($256|0),($257|0),($254|0),($255|0))|0);
  8986. $259 = tempRet0;
  8987. $260 = $238;
  8988. $261 = $260;
  8989. $262 = HEAP32[$261>>2]|0;
  8990. $263 = (($260) + 4)|0;
  8991. $264 = $263;
  8992. $265 = HEAP32[$264>>2]|0;
  8993. $266 = (_i64Add(($258|0),($259|0),($262|0),($265|0))|0);
  8994. $267 = tempRet0;
  8995. $268 = $247;
  8996. $269 = $268;
  8997. HEAP32[$269>>2] = $266;
  8998. $270 = (($268) + 4)|0;
  8999. $271 = $270;
  9000. HEAP32[$271>>2] = $267;
  9001. $272 = (($output) + 80|0);
  9002. $273 = $272;
  9003. $274 = $273;
  9004. $275 = HEAP32[$274>>2]|0;
  9005. $276 = (($273) + 4)|0;
  9006. $277 = $276;
  9007. $278 = HEAP32[$277>>2]|0;
  9008. $279 = (_bitshift64Shl(($275|0),($278|0),4)|0);
  9009. $280 = tempRet0;
  9010. $281 = $output;
  9011. $282 = $281;
  9012. $283 = HEAP32[$282>>2]|0;
  9013. $284 = (($281) + 4)|0;
  9014. $285 = $284;
  9015. $286 = HEAP32[$285>>2]|0;
  9016. $287 = (_i64Add(($283|0),($286|0),($279|0),($280|0))|0);
  9017. $288 = tempRet0;
  9018. $289 = (_bitshift64Shl(($275|0),($278|0),1)|0);
  9019. $290 = tempRet0;
  9020. $291 = (_i64Add(($289|0),($290|0),($287|0),($288|0))|0);
  9021. $292 = tempRet0;
  9022. $293 = (_i64Add(($291|0),($292|0),($275|0),($278|0))|0);
  9023. $294 = tempRet0;
  9024. $295 = $output;
  9025. $296 = $295;
  9026. HEAP32[$296>>2] = $293;
  9027. $297 = (($295) + 4)|0;
  9028. $298 = $297;
  9029. HEAP32[$298>>2] = $294;
  9030. STACKTOP = sp;return;
  9031. }
  9032. function _freduce_coefficients($output) {
  9033. $output = $output|0;
  9034. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  9035. var $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0;
  9036. var $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0;
  9037. var $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0;
  9038. var $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0;
  9039. var $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, $i$01 = 0, label = 0, sp = 0;
  9040. sp = STACKTOP;
  9041. $0 = (($output) + 80|0);
  9042. $1 = $0;
  9043. $2 = $1;
  9044. HEAP32[$2>>2] = 0;
  9045. $3 = (($1) + 4)|0;
  9046. $4 = $3;
  9047. HEAP32[$4>>2] = 0;
  9048. $i$01 = 0;
  9049. while(1) {
  9050. $5 = (($output) + ($i$01<<3)|0);
  9051. $6 = $5;
  9052. $7 = $6;
  9053. $8 = HEAP32[$7>>2]|0;
  9054. $9 = (($6) + 4)|0;
  9055. $10 = $9;
  9056. $11 = HEAP32[$10>>2]|0;
  9057. $12 = (_div_by_2_26($8,$11)|0);
  9058. $13 = tempRet0;
  9059. $14 = (_bitshift64Shl(($12|0),($13|0),26)|0);
  9060. $15 = tempRet0;
  9061. $16 = (_i64Subtract(($8|0),($11|0),($14|0),($15|0))|0);
  9062. $17 = tempRet0;
  9063. $18 = $5;
  9064. $19 = $18;
  9065. HEAP32[$19>>2] = $16;
  9066. $20 = (($18) + 4)|0;
  9067. $21 = $20;
  9068. HEAP32[$21>>2] = $17;
  9069. $22 = $i$01 | 1;
  9070. $23 = (($output) + ($22<<3)|0);
  9071. $24 = $23;
  9072. $25 = $24;
  9073. $26 = HEAP32[$25>>2]|0;
  9074. $27 = (($24) + 4)|0;
  9075. $28 = $27;
  9076. $29 = HEAP32[$28>>2]|0;
  9077. $30 = (_i64Add(($26|0),($29|0),($12|0),($13|0))|0);
  9078. $31 = tempRet0;
  9079. $32 = (_div_by_2_25($30,$31)|0);
  9080. $33 = tempRet0;
  9081. $34 = (_bitshift64Shl(($32|0),($33|0),25)|0);
  9082. $35 = tempRet0;
  9083. $36 = (_i64Subtract(($30|0),($31|0),($34|0),($35|0))|0);
  9084. $37 = tempRet0;
  9085. $38 = $23;
  9086. $39 = $38;
  9087. HEAP32[$39>>2] = $36;
  9088. $40 = (($38) + 4)|0;
  9089. $41 = $40;
  9090. HEAP32[$41>>2] = $37;
  9091. $42 = (($i$01) + 2)|0;
  9092. $43 = (($output) + ($42<<3)|0);
  9093. $44 = $43;
  9094. $45 = $44;
  9095. $46 = HEAP32[$45>>2]|0;
  9096. $47 = (($44) + 4)|0;
  9097. $48 = $47;
  9098. $49 = HEAP32[$48>>2]|0;
  9099. $50 = (_i64Add(($46|0),($49|0),($32|0),($33|0))|0);
  9100. $51 = tempRet0;
  9101. $52 = $43;
  9102. $53 = $52;
  9103. HEAP32[$53>>2] = $50;
  9104. $54 = (($52) + 4)|0;
  9105. $55 = $54;
  9106. HEAP32[$55>>2] = $51;
  9107. $56 = ($42>>>0)<(10);
  9108. if ($56) {
  9109. $i$01 = $42;
  9110. } else {
  9111. break;
  9112. }
  9113. }
  9114. $57 = $0;
  9115. $58 = $57;
  9116. $59 = HEAP32[$58>>2]|0;
  9117. $60 = (($57) + 4)|0;
  9118. $61 = $60;
  9119. $62 = HEAP32[$61>>2]|0;
  9120. $63 = (_bitshift64Shl(($59|0),($62|0),4)|0);
  9121. $64 = tempRet0;
  9122. $65 = $output;
  9123. $66 = $65;
  9124. $67 = HEAP32[$66>>2]|0;
  9125. $68 = (($65) + 4)|0;
  9126. $69 = $68;
  9127. $70 = HEAP32[$69>>2]|0;
  9128. $71 = (_i64Add(($67|0),($70|0),($63|0),($64|0))|0);
  9129. $72 = tempRet0;
  9130. $73 = (_bitshift64Shl(($59|0),($62|0),1)|0);
  9131. $74 = tempRet0;
  9132. $75 = (_i64Add(($73|0),($74|0),($71|0),($72|0))|0);
  9133. $76 = tempRet0;
  9134. $77 = (_i64Add(($75|0),($76|0),($59|0),($62|0))|0);
  9135. $78 = tempRet0;
  9136. $79 = $output;
  9137. $80 = $79;
  9138. HEAP32[$80>>2] = $77;
  9139. $81 = (($79) + 4)|0;
  9140. $82 = $81;
  9141. HEAP32[$82>>2] = $78;
  9142. $83 = $0;
  9143. $84 = $83;
  9144. HEAP32[$84>>2] = 0;
  9145. $85 = (($83) + 4)|0;
  9146. $86 = $85;
  9147. HEAP32[$86>>2] = 0;
  9148. $87 = $output;
  9149. $88 = $87;
  9150. $89 = HEAP32[$88>>2]|0;
  9151. $90 = (($87) + 4)|0;
  9152. $91 = $90;
  9153. $92 = HEAP32[$91>>2]|0;
  9154. $93 = (_div_by_2_26($89,$92)|0);
  9155. $94 = tempRet0;
  9156. $95 = (_bitshift64Shl(($93|0),($94|0),26)|0);
  9157. $96 = tempRet0;
  9158. $97 = (_i64Subtract(($89|0),($92|0),($95|0),($96|0))|0);
  9159. $98 = tempRet0;
  9160. $99 = $output;
  9161. $100 = $99;
  9162. HEAP32[$100>>2] = $97;
  9163. $101 = (($99) + 4)|0;
  9164. $102 = $101;
  9165. HEAP32[$102>>2] = $98;
  9166. $103 = (($output) + 8|0);
  9167. $104 = $103;
  9168. $105 = $104;
  9169. $106 = HEAP32[$105>>2]|0;
  9170. $107 = (($104) + 4)|0;
  9171. $108 = $107;
  9172. $109 = HEAP32[$108>>2]|0;
  9173. $110 = (_i64Add(($106|0),($109|0),($93|0),($94|0))|0);
  9174. $111 = tempRet0;
  9175. $112 = $103;
  9176. $113 = $112;
  9177. HEAP32[$113>>2] = $110;
  9178. $114 = (($112) + 4)|0;
  9179. $115 = $114;
  9180. HEAP32[$115>>2] = $111;
  9181. STACKTOP = sp;return;
  9182. }
  9183. function _s32_eq($a,$b) {
  9184. $a = $a|0;
  9185. $b = $b|0;
  9186. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  9187. sp = STACKTOP;
  9188. $0 = $a ^ -1;
  9189. $1 = $0 ^ $b;
  9190. $2 = $1 << 16;
  9191. $3 = $2 & $1;
  9192. $4 = $3 << 8;
  9193. $5 = $4 & $3;
  9194. $6 = $5 << 4;
  9195. $7 = $6 & $5;
  9196. $8 = $7 << 2;
  9197. $9 = $8 & $7;
  9198. $10 = $9 << 1;
  9199. $11 = $10 & $9;
  9200. $12 = $11 >> 31;
  9201. STACKTOP = sp;return ($12|0);
  9202. }
  9203. function _s32_gte($a) {
  9204. $a = $a|0;
  9205. var $0 = 0, $1 = 0, $2 = 0, label = 0, sp = 0;
  9206. sp = STACKTOP;
  9207. $0 = (($a) + -67108845)|0;
  9208. $1 = $0 >> 31;
  9209. $2 = $1 ^ -1;
  9210. STACKTOP = sp;return ($2|0);
  9211. }
  9212. function _fsum($output,$in) {
  9213. $output = $output|0;
  9214. $in = $in|0;
  9215. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  9216. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  9217. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  9218. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  9219. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  9220. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  9221. var $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0;
  9222. var $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0;
  9223. var $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0;
  9224. var $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  9225. sp = STACKTOP;
  9226. $0 = $output;
  9227. $1 = $0;
  9228. $2 = HEAP32[$1>>2]|0;
  9229. $3 = (($0) + 4)|0;
  9230. $4 = $3;
  9231. $5 = HEAP32[$4>>2]|0;
  9232. $6 = $in;
  9233. $7 = $6;
  9234. $8 = HEAP32[$7>>2]|0;
  9235. $9 = (($6) + 4)|0;
  9236. $10 = $9;
  9237. $11 = HEAP32[$10>>2]|0;
  9238. $12 = (_i64Add(($8|0),($11|0),($2|0),($5|0))|0);
  9239. $13 = tempRet0;
  9240. $14 = $output;
  9241. $15 = $14;
  9242. HEAP32[$15>>2] = $12;
  9243. $16 = (($14) + 4)|0;
  9244. $17 = $16;
  9245. HEAP32[$17>>2] = $13;
  9246. $18 = (($output) + 8|0);
  9247. $19 = $18;
  9248. $20 = $19;
  9249. $21 = HEAP32[$20>>2]|0;
  9250. $22 = (($19) + 4)|0;
  9251. $23 = $22;
  9252. $24 = HEAP32[$23>>2]|0;
  9253. $25 = (($in) + 8|0);
  9254. $26 = $25;
  9255. $27 = $26;
  9256. $28 = HEAP32[$27>>2]|0;
  9257. $29 = (($26) + 4)|0;
  9258. $30 = $29;
  9259. $31 = HEAP32[$30>>2]|0;
  9260. $32 = (_i64Add(($28|0),($31|0),($21|0),($24|0))|0);
  9261. $33 = tempRet0;
  9262. $34 = $18;
  9263. $35 = $34;
  9264. HEAP32[$35>>2] = $32;
  9265. $36 = (($34) + 4)|0;
  9266. $37 = $36;
  9267. HEAP32[$37>>2] = $33;
  9268. $38 = (($output) + 16|0);
  9269. $39 = $38;
  9270. $40 = $39;
  9271. $41 = HEAP32[$40>>2]|0;
  9272. $42 = (($39) + 4)|0;
  9273. $43 = $42;
  9274. $44 = HEAP32[$43>>2]|0;
  9275. $45 = (($in) + 16|0);
  9276. $46 = $45;
  9277. $47 = $46;
  9278. $48 = HEAP32[$47>>2]|0;
  9279. $49 = (($46) + 4)|0;
  9280. $50 = $49;
  9281. $51 = HEAP32[$50>>2]|0;
  9282. $52 = (_i64Add(($48|0),($51|0),($41|0),($44|0))|0);
  9283. $53 = tempRet0;
  9284. $54 = $38;
  9285. $55 = $54;
  9286. HEAP32[$55>>2] = $52;
  9287. $56 = (($54) + 4)|0;
  9288. $57 = $56;
  9289. HEAP32[$57>>2] = $53;
  9290. $58 = (($output) + 24|0);
  9291. $59 = $58;
  9292. $60 = $59;
  9293. $61 = HEAP32[$60>>2]|0;
  9294. $62 = (($59) + 4)|0;
  9295. $63 = $62;
  9296. $64 = HEAP32[$63>>2]|0;
  9297. $65 = (($in) + 24|0);
  9298. $66 = $65;
  9299. $67 = $66;
  9300. $68 = HEAP32[$67>>2]|0;
  9301. $69 = (($66) + 4)|0;
  9302. $70 = $69;
  9303. $71 = HEAP32[$70>>2]|0;
  9304. $72 = (_i64Add(($68|0),($71|0),($61|0),($64|0))|0);
  9305. $73 = tempRet0;
  9306. $74 = $58;
  9307. $75 = $74;
  9308. HEAP32[$75>>2] = $72;
  9309. $76 = (($74) + 4)|0;
  9310. $77 = $76;
  9311. HEAP32[$77>>2] = $73;
  9312. $78 = (($output) + 32|0);
  9313. $79 = $78;
  9314. $80 = $79;
  9315. $81 = HEAP32[$80>>2]|0;
  9316. $82 = (($79) + 4)|0;
  9317. $83 = $82;
  9318. $84 = HEAP32[$83>>2]|0;
  9319. $85 = (($in) + 32|0);
  9320. $86 = $85;
  9321. $87 = $86;
  9322. $88 = HEAP32[$87>>2]|0;
  9323. $89 = (($86) + 4)|0;
  9324. $90 = $89;
  9325. $91 = HEAP32[$90>>2]|0;
  9326. $92 = (_i64Add(($88|0),($91|0),($81|0),($84|0))|0);
  9327. $93 = tempRet0;
  9328. $94 = $78;
  9329. $95 = $94;
  9330. HEAP32[$95>>2] = $92;
  9331. $96 = (($94) + 4)|0;
  9332. $97 = $96;
  9333. HEAP32[$97>>2] = $93;
  9334. $98 = (($output) + 40|0);
  9335. $99 = $98;
  9336. $100 = $99;
  9337. $101 = HEAP32[$100>>2]|0;
  9338. $102 = (($99) + 4)|0;
  9339. $103 = $102;
  9340. $104 = HEAP32[$103>>2]|0;
  9341. $105 = (($in) + 40|0);
  9342. $106 = $105;
  9343. $107 = $106;
  9344. $108 = HEAP32[$107>>2]|0;
  9345. $109 = (($106) + 4)|0;
  9346. $110 = $109;
  9347. $111 = HEAP32[$110>>2]|0;
  9348. $112 = (_i64Add(($108|0),($111|0),($101|0),($104|0))|0);
  9349. $113 = tempRet0;
  9350. $114 = $98;
  9351. $115 = $114;
  9352. HEAP32[$115>>2] = $112;
  9353. $116 = (($114) + 4)|0;
  9354. $117 = $116;
  9355. HEAP32[$117>>2] = $113;
  9356. $118 = (($output) + 48|0);
  9357. $119 = $118;
  9358. $120 = $119;
  9359. $121 = HEAP32[$120>>2]|0;
  9360. $122 = (($119) + 4)|0;
  9361. $123 = $122;
  9362. $124 = HEAP32[$123>>2]|0;
  9363. $125 = (($in) + 48|0);
  9364. $126 = $125;
  9365. $127 = $126;
  9366. $128 = HEAP32[$127>>2]|0;
  9367. $129 = (($126) + 4)|0;
  9368. $130 = $129;
  9369. $131 = HEAP32[$130>>2]|0;
  9370. $132 = (_i64Add(($128|0),($131|0),($121|0),($124|0))|0);
  9371. $133 = tempRet0;
  9372. $134 = $118;
  9373. $135 = $134;
  9374. HEAP32[$135>>2] = $132;
  9375. $136 = (($134) + 4)|0;
  9376. $137 = $136;
  9377. HEAP32[$137>>2] = $133;
  9378. $138 = (($output) + 56|0);
  9379. $139 = $138;
  9380. $140 = $139;
  9381. $141 = HEAP32[$140>>2]|0;
  9382. $142 = (($139) + 4)|0;
  9383. $143 = $142;
  9384. $144 = HEAP32[$143>>2]|0;
  9385. $145 = (($in) + 56|0);
  9386. $146 = $145;
  9387. $147 = $146;
  9388. $148 = HEAP32[$147>>2]|0;
  9389. $149 = (($146) + 4)|0;
  9390. $150 = $149;
  9391. $151 = HEAP32[$150>>2]|0;
  9392. $152 = (_i64Add(($148|0),($151|0),($141|0),($144|0))|0);
  9393. $153 = tempRet0;
  9394. $154 = $138;
  9395. $155 = $154;
  9396. HEAP32[$155>>2] = $152;
  9397. $156 = (($154) + 4)|0;
  9398. $157 = $156;
  9399. HEAP32[$157>>2] = $153;
  9400. $158 = (($output) + 64|0);
  9401. $159 = $158;
  9402. $160 = $159;
  9403. $161 = HEAP32[$160>>2]|0;
  9404. $162 = (($159) + 4)|0;
  9405. $163 = $162;
  9406. $164 = HEAP32[$163>>2]|0;
  9407. $165 = (($in) + 64|0);
  9408. $166 = $165;
  9409. $167 = $166;
  9410. $168 = HEAP32[$167>>2]|0;
  9411. $169 = (($166) + 4)|0;
  9412. $170 = $169;
  9413. $171 = HEAP32[$170>>2]|0;
  9414. $172 = (_i64Add(($168|0),($171|0),($161|0),($164|0))|0);
  9415. $173 = tempRet0;
  9416. $174 = $158;
  9417. $175 = $174;
  9418. HEAP32[$175>>2] = $172;
  9419. $176 = (($174) + 4)|0;
  9420. $177 = $176;
  9421. HEAP32[$177>>2] = $173;
  9422. $178 = (($output) + 72|0);
  9423. $179 = $178;
  9424. $180 = $179;
  9425. $181 = HEAP32[$180>>2]|0;
  9426. $182 = (($179) + 4)|0;
  9427. $183 = $182;
  9428. $184 = HEAP32[$183>>2]|0;
  9429. $185 = (($in) + 72|0);
  9430. $186 = $185;
  9431. $187 = $186;
  9432. $188 = HEAP32[$187>>2]|0;
  9433. $189 = (($186) + 4)|0;
  9434. $190 = $189;
  9435. $191 = HEAP32[$190>>2]|0;
  9436. $192 = (_i64Add(($188|0),($191|0),($181|0),($184|0))|0);
  9437. $193 = tempRet0;
  9438. $194 = $178;
  9439. $195 = $194;
  9440. HEAP32[$195>>2] = $192;
  9441. $196 = (($194) + 4)|0;
  9442. $197 = $196;
  9443. HEAP32[$197>>2] = $193;
  9444. STACKTOP = sp;return;
  9445. }
  9446. function _fdifference($output,$in) {
  9447. $output = $output|0;
  9448. $in = $in|0;
  9449. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  9450. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  9451. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  9452. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  9453. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  9454. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  9455. var $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0;
  9456. var $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0;
  9457. var $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0;
  9458. var $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  9459. sp = STACKTOP;
  9460. $0 = $in;
  9461. $1 = $0;
  9462. $2 = HEAP32[$1>>2]|0;
  9463. $3 = (($0) + 4)|0;
  9464. $4 = $3;
  9465. $5 = HEAP32[$4>>2]|0;
  9466. $6 = $output;
  9467. $7 = $6;
  9468. $8 = HEAP32[$7>>2]|0;
  9469. $9 = (($6) + 4)|0;
  9470. $10 = $9;
  9471. $11 = HEAP32[$10>>2]|0;
  9472. $12 = (_i64Subtract(($2|0),($5|0),($8|0),($11|0))|0);
  9473. $13 = tempRet0;
  9474. $14 = $output;
  9475. $15 = $14;
  9476. HEAP32[$15>>2] = $12;
  9477. $16 = (($14) + 4)|0;
  9478. $17 = $16;
  9479. HEAP32[$17>>2] = $13;
  9480. $18 = (($in) + 8|0);
  9481. $19 = $18;
  9482. $20 = $19;
  9483. $21 = HEAP32[$20>>2]|0;
  9484. $22 = (($19) + 4)|0;
  9485. $23 = $22;
  9486. $24 = HEAP32[$23>>2]|0;
  9487. $25 = (($output) + 8|0);
  9488. $26 = $25;
  9489. $27 = $26;
  9490. $28 = HEAP32[$27>>2]|0;
  9491. $29 = (($26) + 4)|0;
  9492. $30 = $29;
  9493. $31 = HEAP32[$30>>2]|0;
  9494. $32 = (_i64Subtract(($21|0),($24|0),($28|0),($31|0))|0);
  9495. $33 = tempRet0;
  9496. $34 = $25;
  9497. $35 = $34;
  9498. HEAP32[$35>>2] = $32;
  9499. $36 = (($34) + 4)|0;
  9500. $37 = $36;
  9501. HEAP32[$37>>2] = $33;
  9502. $38 = (($in) + 16|0);
  9503. $39 = $38;
  9504. $40 = $39;
  9505. $41 = HEAP32[$40>>2]|0;
  9506. $42 = (($39) + 4)|0;
  9507. $43 = $42;
  9508. $44 = HEAP32[$43>>2]|0;
  9509. $45 = (($output) + 16|0);
  9510. $46 = $45;
  9511. $47 = $46;
  9512. $48 = HEAP32[$47>>2]|0;
  9513. $49 = (($46) + 4)|0;
  9514. $50 = $49;
  9515. $51 = HEAP32[$50>>2]|0;
  9516. $52 = (_i64Subtract(($41|0),($44|0),($48|0),($51|0))|0);
  9517. $53 = tempRet0;
  9518. $54 = $45;
  9519. $55 = $54;
  9520. HEAP32[$55>>2] = $52;
  9521. $56 = (($54) + 4)|0;
  9522. $57 = $56;
  9523. HEAP32[$57>>2] = $53;
  9524. $58 = (($in) + 24|0);
  9525. $59 = $58;
  9526. $60 = $59;
  9527. $61 = HEAP32[$60>>2]|0;
  9528. $62 = (($59) + 4)|0;
  9529. $63 = $62;
  9530. $64 = HEAP32[$63>>2]|0;
  9531. $65 = (($output) + 24|0);
  9532. $66 = $65;
  9533. $67 = $66;
  9534. $68 = HEAP32[$67>>2]|0;
  9535. $69 = (($66) + 4)|0;
  9536. $70 = $69;
  9537. $71 = HEAP32[$70>>2]|0;
  9538. $72 = (_i64Subtract(($61|0),($64|0),($68|0),($71|0))|0);
  9539. $73 = tempRet0;
  9540. $74 = $65;
  9541. $75 = $74;
  9542. HEAP32[$75>>2] = $72;
  9543. $76 = (($74) + 4)|0;
  9544. $77 = $76;
  9545. HEAP32[$77>>2] = $73;
  9546. $78 = (($in) + 32|0);
  9547. $79 = $78;
  9548. $80 = $79;
  9549. $81 = HEAP32[$80>>2]|0;
  9550. $82 = (($79) + 4)|0;
  9551. $83 = $82;
  9552. $84 = HEAP32[$83>>2]|0;
  9553. $85 = (($output) + 32|0);
  9554. $86 = $85;
  9555. $87 = $86;
  9556. $88 = HEAP32[$87>>2]|0;
  9557. $89 = (($86) + 4)|0;
  9558. $90 = $89;
  9559. $91 = HEAP32[$90>>2]|0;
  9560. $92 = (_i64Subtract(($81|0),($84|0),($88|0),($91|0))|0);
  9561. $93 = tempRet0;
  9562. $94 = $85;
  9563. $95 = $94;
  9564. HEAP32[$95>>2] = $92;
  9565. $96 = (($94) + 4)|0;
  9566. $97 = $96;
  9567. HEAP32[$97>>2] = $93;
  9568. $98 = (($in) + 40|0);
  9569. $99 = $98;
  9570. $100 = $99;
  9571. $101 = HEAP32[$100>>2]|0;
  9572. $102 = (($99) + 4)|0;
  9573. $103 = $102;
  9574. $104 = HEAP32[$103>>2]|0;
  9575. $105 = (($output) + 40|0);
  9576. $106 = $105;
  9577. $107 = $106;
  9578. $108 = HEAP32[$107>>2]|0;
  9579. $109 = (($106) + 4)|0;
  9580. $110 = $109;
  9581. $111 = HEAP32[$110>>2]|0;
  9582. $112 = (_i64Subtract(($101|0),($104|0),($108|0),($111|0))|0);
  9583. $113 = tempRet0;
  9584. $114 = $105;
  9585. $115 = $114;
  9586. HEAP32[$115>>2] = $112;
  9587. $116 = (($114) + 4)|0;
  9588. $117 = $116;
  9589. HEAP32[$117>>2] = $113;
  9590. $118 = (($in) + 48|0);
  9591. $119 = $118;
  9592. $120 = $119;
  9593. $121 = HEAP32[$120>>2]|0;
  9594. $122 = (($119) + 4)|0;
  9595. $123 = $122;
  9596. $124 = HEAP32[$123>>2]|0;
  9597. $125 = (($output) + 48|0);
  9598. $126 = $125;
  9599. $127 = $126;
  9600. $128 = HEAP32[$127>>2]|0;
  9601. $129 = (($126) + 4)|0;
  9602. $130 = $129;
  9603. $131 = HEAP32[$130>>2]|0;
  9604. $132 = (_i64Subtract(($121|0),($124|0),($128|0),($131|0))|0);
  9605. $133 = tempRet0;
  9606. $134 = $125;
  9607. $135 = $134;
  9608. HEAP32[$135>>2] = $132;
  9609. $136 = (($134) + 4)|0;
  9610. $137 = $136;
  9611. HEAP32[$137>>2] = $133;
  9612. $138 = (($in) + 56|0);
  9613. $139 = $138;
  9614. $140 = $139;
  9615. $141 = HEAP32[$140>>2]|0;
  9616. $142 = (($139) + 4)|0;
  9617. $143 = $142;
  9618. $144 = HEAP32[$143>>2]|0;
  9619. $145 = (($output) + 56|0);
  9620. $146 = $145;
  9621. $147 = $146;
  9622. $148 = HEAP32[$147>>2]|0;
  9623. $149 = (($146) + 4)|0;
  9624. $150 = $149;
  9625. $151 = HEAP32[$150>>2]|0;
  9626. $152 = (_i64Subtract(($141|0),($144|0),($148|0),($151|0))|0);
  9627. $153 = tempRet0;
  9628. $154 = $145;
  9629. $155 = $154;
  9630. HEAP32[$155>>2] = $152;
  9631. $156 = (($154) + 4)|0;
  9632. $157 = $156;
  9633. HEAP32[$157>>2] = $153;
  9634. $158 = (($in) + 64|0);
  9635. $159 = $158;
  9636. $160 = $159;
  9637. $161 = HEAP32[$160>>2]|0;
  9638. $162 = (($159) + 4)|0;
  9639. $163 = $162;
  9640. $164 = HEAP32[$163>>2]|0;
  9641. $165 = (($output) + 64|0);
  9642. $166 = $165;
  9643. $167 = $166;
  9644. $168 = HEAP32[$167>>2]|0;
  9645. $169 = (($166) + 4)|0;
  9646. $170 = $169;
  9647. $171 = HEAP32[$170>>2]|0;
  9648. $172 = (_i64Subtract(($161|0),($164|0),($168|0),($171|0))|0);
  9649. $173 = tempRet0;
  9650. $174 = $165;
  9651. $175 = $174;
  9652. HEAP32[$175>>2] = $172;
  9653. $176 = (($174) + 4)|0;
  9654. $177 = $176;
  9655. HEAP32[$177>>2] = $173;
  9656. $178 = (($in) + 72|0);
  9657. $179 = $178;
  9658. $180 = $179;
  9659. $181 = HEAP32[$180>>2]|0;
  9660. $182 = (($179) + 4)|0;
  9661. $183 = $182;
  9662. $184 = HEAP32[$183>>2]|0;
  9663. $185 = (($output) + 72|0);
  9664. $186 = $185;
  9665. $187 = $186;
  9666. $188 = HEAP32[$187>>2]|0;
  9667. $189 = (($186) + 4)|0;
  9668. $190 = $189;
  9669. $191 = HEAP32[$190>>2]|0;
  9670. $192 = (_i64Subtract(($181|0),($184|0),($188|0),($191|0))|0);
  9671. $193 = tempRet0;
  9672. $194 = $185;
  9673. $195 = $194;
  9674. HEAP32[$195>>2] = $192;
  9675. $196 = (($194) + 4)|0;
  9676. $197 = $196;
  9677. HEAP32[$197>>2] = $193;
  9678. STACKTOP = sp;return;
  9679. }
  9680. function _fscalar_product($output,$in) {
  9681. $output = $output|0;
  9682. $in = $in|0;
  9683. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  9684. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  9685. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  9686. var $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0;
  9687. var $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0;
  9688. var $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0;
  9689. var $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  9690. sp = STACKTOP;
  9691. $0 = $in;
  9692. $1 = $0;
  9693. $2 = HEAP32[$1>>2]|0;
  9694. $3 = (($0) + 4)|0;
  9695. $4 = $3;
  9696. $5 = HEAP32[$4>>2]|0;
  9697. $6 = (___muldi3(($2|0),($5|0),121665,0)|0);
  9698. $7 = tempRet0;
  9699. $8 = $output;
  9700. $9 = $8;
  9701. HEAP32[$9>>2] = $6;
  9702. $10 = (($8) + 4)|0;
  9703. $11 = $10;
  9704. HEAP32[$11>>2] = $7;
  9705. $12 = (($in) + 8|0);
  9706. $13 = $12;
  9707. $14 = $13;
  9708. $15 = HEAP32[$14>>2]|0;
  9709. $16 = (($13) + 4)|0;
  9710. $17 = $16;
  9711. $18 = HEAP32[$17>>2]|0;
  9712. $19 = (___muldi3(($15|0),($18|0),121665,0)|0);
  9713. $20 = tempRet0;
  9714. $21 = (($output) + 8|0);
  9715. $22 = $21;
  9716. $23 = $22;
  9717. HEAP32[$23>>2] = $19;
  9718. $24 = (($22) + 4)|0;
  9719. $25 = $24;
  9720. HEAP32[$25>>2] = $20;
  9721. $26 = (($in) + 16|0);
  9722. $27 = $26;
  9723. $28 = $27;
  9724. $29 = HEAP32[$28>>2]|0;
  9725. $30 = (($27) + 4)|0;
  9726. $31 = $30;
  9727. $32 = HEAP32[$31>>2]|0;
  9728. $33 = (___muldi3(($29|0),($32|0),121665,0)|0);
  9729. $34 = tempRet0;
  9730. $35 = (($output) + 16|0);
  9731. $36 = $35;
  9732. $37 = $36;
  9733. HEAP32[$37>>2] = $33;
  9734. $38 = (($36) + 4)|0;
  9735. $39 = $38;
  9736. HEAP32[$39>>2] = $34;
  9737. $40 = (($in) + 24|0);
  9738. $41 = $40;
  9739. $42 = $41;
  9740. $43 = HEAP32[$42>>2]|0;
  9741. $44 = (($41) + 4)|0;
  9742. $45 = $44;
  9743. $46 = HEAP32[$45>>2]|0;
  9744. $47 = (___muldi3(($43|0),($46|0),121665,0)|0);
  9745. $48 = tempRet0;
  9746. $49 = (($output) + 24|0);
  9747. $50 = $49;
  9748. $51 = $50;
  9749. HEAP32[$51>>2] = $47;
  9750. $52 = (($50) + 4)|0;
  9751. $53 = $52;
  9752. HEAP32[$53>>2] = $48;
  9753. $54 = (($in) + 32|0);
  9754. $55 = $54;
  9755. $56 = $55;
  9756. $57 = HEAP32[$56>>2]|0;
  9757. $58 = (($55) + 4)|0;
  9758. $59 = $58;
  9759. $60 = HEAP32[$59>>2]|0;
  9760. $61 = (___muldi3(($57|0),($60|0),121665,0)|0);
  9761. $62 = tempRet0;
  9762. $63 = (($output) + 32|0);
  9763. $64 = $63;
  9764. $65 = $64;
  9765. HEAP32[$65>>2] = $61;
  9766. $66 = (($64) + 4)|0;
  9767. $67 = $66;
  9768. HEAP32[$67>>2] = $62;
  9769. $68 = (($in) + 40|0);
  9770. $69 = $68;
  9771. $70 = $69;
  9772. $71 = HEAP32[$70>>2]|0;
  9773. $72 = (($69) + 4)|0;
  9774. $73 = $72;
  9775. $74 = HEAP32[$73>>2]|0;
  9776. $75 = (___muldi3(($71|0),($74|0),121665,0)|0);
  9777. $76 = tempRet0;
  9778. $77 = (($output) + 40|0);
  9779. $78 = $77;
  9780. $79 = $78;
  9781. HEAP32[$79>>2] = $75;
  9782. $80 = (($78) + 4)|0;
  9783. $81 = $80;
  9784. HEAP32[$81>>2] = $76;
  9785. $82 = (($in) + 48|0);
  9786. $83 = $82;
  9787. $84 = $83;
  9788. $85 = HEAP32[$84>>2]|0;
  9789. $86 = (($83) + 4)|0;
  9790. $87 = $86;
  9791. $88 = HEAP32[$87>>2]|0;
  9792. $89 = (___muldi3(($85|0),($88|0),121665,0)|0);
  9793. $90 = tempRet0;
  9794. $91 = (($output) + 48|0);
  9795. $92 = $91;
  9796. $93 = $92;
  9797. HEAP32[$93>>2] = $89;
  9798. $94 = (($92) + 4)|0;
  9799. $95 = $94;
  9800. HEAP32[$95>>2] = $90;
  9801. $96 = (($in) + 56|0);
  9802. $97 = $96;
  9803. $98 = $97;
  9804. $99 = HEAP32[$98>>2]|0;
  9805. $100 = (($97) + 4)|0;
  9806. $101 = $100;
  9807. $102 = HEAP32[$101>>2]|0;
  9808. $103 = (___muldi3(($99|0),($102|0),121665,0)|0);
  9809. $104 = tempRet0;
  9810. $105 = (($output) + 56|0);
  9811. $106 = $105;
  9812. $107 = $106;
  9813. HEAP32[$107>>2] = $103;
  9814. $108 = (($106) + 4)|0;
  9815. $109 = $108;
  9816. HEAP32[$109>>2] = $104;
  9817. $110 = (($in) + 64|0);
  9818. $111 = $110;
  9819. $112 = $111;
  9820. $113 = HEAP32[$112>>2]|0;
  9821. $114 = (($111) + 4)|0;
  9822. $115 = $114;
  9823. $116 = HEAP32[$115>>2]|0;
  9824. $117 = (___muldi3(($113|0),($116|0),121665,0)|0);
  9825. $118 = tempRet0;
  9826. $119 = (($output) + 64|0);
  9827. $120 = $119;
  9828. $121 = $120;
  9829. HEAP32[$121>>2] = $117;
  9830. $122 = (($120) + 4)|0;
  9831. $123 = $122;
  9832. HEAP32[$123>>2] = $118;
  9833. $124 = (($in) + 72|0);
  9834. $125 = $124;
  9835. $126 = $125;
  9836. $127 = HEAP32[$126>>2]|0;
  9837. $128 = (($125) + 4)|0;
  9838. $129 = $128;
  9839. $130 = HEAP32[$129>>2]|0;
  9840. $131 = (___muldi3(($127|0),($130|0),121665,0)|0);
  9841. $132 = tempRet0;
  9842. $133 = (($output) + 72|0);
  9843. $134 = $133;
  9844. $135 = $134;
  9845. HEAP32[$135>>2] = $131;
  9846. $136 = (($134) + 4)|0;
  9847. $137 = $136;
  9848. HEAP32[$137>>2] = $132;
  9849. STACKTOP = sp;return;
  9850. }
  9851. function _fsquare_inner($output,$in) {
  9852. $output = $output|0;
  9853. $in = $in|0;
  9854. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0, $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0;
  9855. var $1015 = 0, $1016 = 0, $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0, $1021 = 0, $1022 = 0, $1023 = 0, $1024 = 0, $1025 = 0, $1026 = 0, $1027 = 0, $1028 = 0, $1029 = 0, $103 = 0, $1030 = 0, $1031 = 0, $1032 = 0;
  9856. var $1033 = 0, $1034 = 0, $1035 = 0, $1036 = 0, $1037 = 0, $1038 = 0, $1039 = 0, $104 = 0, $1040 = 0, $1041 = 0, $1042 = 0, $1043 = 0, $1044 = 0, $1045 = 0, $1046 = 0, $1047 = 0, $1048 = 0, $1049 = 0, $105 = 0, $1050 = 0;
  9857. var $1051 = 0, $1052 = 0, $1053 = 0, $1054 = 0, $1055 = 0, $1056 = 0, $1057 = 0, $1058 = 0, $1059 = 0, $106 = 0, $1060 = 0, $1061 = 0, $1062 = 0, $1063 = 0, $1064 = 0, $1065 = 0, $1066 = 0, $1067 = 0, $1068 = 0, $1069 = 0;
  9858. var $107 = 0, $1070 = 0, $1071 = 0, $1072 = 0, $1073 = 0, $1074 = 0, $1075 = 0, $1076 = 0, $1077 = 0, $1078 = 0, $1079 = 0, $108 = 0, $1080 = 0, $1081 = 0, $1082 = 0, $1083 = 0, $1084 = 0, $1085 = 0, $1086 = 0, $1087 = 0;
  9859. var $1088 = 0, $1089 = 0, $109 = 0, $1090 = 0, $1091 = 0, $1092 = 0, $1093 = 0, $1094 = 0, $1095 = 0, $1096 = 0, $1097 = 0, $1098 = 0, $1099 = 0, $11 = 0, $110 = 0, $1100 = 0, $1101 = 0, $1102 = 0, $1103 = 0, $1104 = 0;
  9860. var $1105 = 0, $1106 = 0, $1107 = 0, $1108 = 0, $1109 = 0, $111 = 0, $1110 = 0, $1111 = 0, $1112 = 0, $1113 = 0, $1114 = 0, $1115 = 0, $1116 = 0, $1117 = 0, $1118 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0, $116 = 0;
  9861. var $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0, $134 = 0;
  9862. var $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0, $152 = 0;
  9863. var $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0, $170 = 0;
  9864. var $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0, $189 = 0;
  9865. var $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0;
  9866. var $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0;
  9867. var $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0;
  9868. var $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0;
  9869. var $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0;
  9870. var $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0;
  9871. var $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0;
  9872. var $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0;
  9873. var $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0;
  9874. var $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0;
  9875. var $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0;
  9876. var $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0, $404 = 0;
  9877. var $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0, $422 = 0;
  9878. var $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0;
  9879. var $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0, $459 = 0;
  9880. var $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0;
  9881. var $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0, $495 = 0;
  9882. var $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0;
  9883. var $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0;
  9884. var $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0;
  9885. var $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0;
  9886. var $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0;
  9887. var $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0;
  9888. var $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0;
  9889. var $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0;
  9890. var $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0;
  9891. var $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0;
  9892. var $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0;
  9893. var $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0;
  9894. var $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0;
  9895. var $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0;
  9896. var $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0;
  9897. var $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0;
  9898. var $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0;
  9899. var $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0, $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0, $819 = 0;
  9900. var $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0, $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0, $837 = 0;
  9901. var $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0, $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0, $855 = 0;
  9902. var $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0, $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0, $873 = 0;
  9903. var $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0, $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0, $891 = 0;
  9904. var $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0, $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0, $909 = 0;
  9905. var $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0, $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0, $927 = 0;
  9906. var $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0, $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0, $945 = 0;
  9907. var $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0, $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0, $960 = 0, $961 = 0, $962 = 0, $963 = 0;
  9908. var $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0, $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0, $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0, $979 = 0, $98 = 0, $980 = 0, $981 = 0;
  9909. var $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0, $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0, $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0, $997 = 0, $998 = 0, $999 = 0, label = 0;
  9910. var sp = 0;
  9911. sp = STACKTOP;
  9912. $0 = $in;
  9913. $1 = $0;
  9914. $2 = HEAP32[$1>>2]|0;
  9915. $3 = (($0) + 4)|0;
  9916. $4 = $3;
  9917. $5 = HEAP32[$4>>2]|0;
  9918. $6 = (_bitshift64Ashr(0,($2|0),32)|0);
  9919. $7 = tempRet0;
  9920. $8 = (___muldi3(($6|0),($7|0),($6|0),($7|0))|0);
  9921. $9 = tempRet0;
  9922. $10 = $output;
  9923. $11 = $10;
  9924. HEAP32[$11>>2] = $8;
  9925. $12 = (($10) + 4)|0;
  9926. $13 = $12;
  9927. HEAP32[$13>>2] = $9;
  9928. $14 = $in;
  9929. $15 = $14;
  9930. $16 = HEAP32[$15>>2]|0;
  9931. $17 = (($14) + 4)|0;
  9932. $18 = $17;
  9933. $19 = HEAP32[$18>>2]|0;
  9934. $20 = (_bitshift64Ashr(0,($16|0),31)|0);
  9935. $21 = tempRet0;
  9936. $22 = (($in) + 8|0);
  9937. $23 = $22;
  9938. $24 = $23;
  9939. $25 = HEAP32[$24>>2]|0;
  9940. $26 = (($23) + 4)|0;
  9941. $27 = $26;
  9942. $28 = HEAP32[$27>>2]|0;
  9943. $29 = (_bitshift64Ashr(0,($25|0),32)|0);
  9944. $30 = tempRet0;
  9945. $31 = (___muldi3(($29|0),($30|0),($20|0),($21|0))|0);
  9946. $32 = tempRet0;
  9947. $33 = (($output) + 8|0);
  9948. $34 = $33;
  9949. $35 = $34;
  9950. HEAP32[$35>>2] = $31;
  9951. $36 = (($34) + 4)|0;
  9952. $37 = $36;
  9953. HEAP32[$37>>2] = $32;
  9954. $38 = $22;
  9955. $39 = $38;
  9956. $40 = HEAP32[$39>>2]|0;
  9957. $41 = (($38) + 4)|0;
  9958. $42 = $41;
  9959. $43 = HEAP32[$42>>2]|0;
  9960. $44 = (_bitshift64Ashr(0,($40|0),32)|0);
  9961. $45 = tempRet0;
  9962. $46 = (___muldi3(($44|0),($45|0),($44|0),($45|0))|0);
  9963. $47 = tempRet0;
  9964. $48 = $in;
  9965. $49 = $48;
  9966. $50 = HEAP32[$49>>2]|0;
  9967. $51 = (($48) + 4)|0;
  9968. $52 = $51;
  9969. $53 = HEAP32[$52>>2]|0;
  9970. $54 = (_bitshift64Ashr(0,($50|0),32)|0);
  9971. $55 = tempRet0;
  9972. $56 = (($in) + 16|0);
  9973. $57 = $56;
  9974. $58 = $57;
  9975. $59 = HEAP32[$58>>2]|0;
  9976. $60 = (($57) + 4)|0;
  9977. $61 = $60;
  9978. $62 = HEAP32[$61>>2]|0;
  9979. $63 = (_bitshift64Ashr(0,($59|0),32)|0);
  9980. $64 = tempRet0;
  9981. $65 = (___muldi3(($63|0),($64|0),($54|0),($55|0))|0);
  9982. $66 = tempRet0;
  9983. $67 = (_i64Add(($65|0),($66|0),($46|0),($47|0))|0);
  9984. $68 = tempRet0;
  9985. $69 = (_bitshift64Shl(($67|0),($68|0),1)|0);
  9986. $70 = tempRet0;
  9987. $71 = (($output) + 16|0);
  9988. $72 = $71;
  9989. $73 = $72;
  9990. HEAP32[$73>>2] = $69;
  9991. $74 = (($72) + 4)|0;
  9992. $75 = $74;
  9993. HEAP32[$75>>2] = $70;
  9994. $76 = $22;
  9995. $77 = $76;
  9996. $78 = HEAP32[$77>>2]|0;
  9997. $79 = (($76) + 4)|0;
  9998. $80 = $79;
  9999. $81 = HEAP32[$80>>2]|0;
  10000. $82 = (_bitshift64Ashr(0,($78|0),32)|0);
  10001. $83 = tempRet0;
  10002. $84 = $56;
  10003. $85 = $84;
  10004. $86 = HEAP32[$85>>2]|0;
  10005. $87 = (($84) + 4)|0;
  10006. $88 = $87;
  10007. $89 = HEAP32[$88>>2]|0;
  10008. $90 = (_bitshift64Ashr(0,($86|0),32)|0);
  10009. $91 = tempRet0;
  10010. $92 = (___muldi3(($90|0),($91|0),($82|0),($83|0))|0);
  10011. $93 = tempRet0;
  10012. $94 = $in;
  10013. $95 = $94;
  10014. $96 = HEAP32[$95>>2]|0;
  10015. $97 = (($94) + 4)|0;
  10016. $98 = $97;
  10017. $99 = HEAP32[$98>>2]|0;
  10018. $100 = (_bitshift64Ashr(0,($96|0),32)|0);
  10019. $101 = tempRet0;
  10020. $102 = (($in) + 24|0);
  10021. $103 = $102;
  10022. $104 = $103;
  10023. $105 = HEAP32[$104>>2]|0;
  10024. $106 = (($103) + 4)|0;
  10025. $107 = $106;
  10026. $108 = HEAP32[$107>>2]|0;
  10027. $109 = (_bitshift64Ashr(0,($105|0),32)|0);
  10028. $110 = tempRet0;
  10029. $111 = (___muldi3(($109|0),($110|0),($100|0),($101|0))|0);
  10030. $112 = tempRet0;
  10031. $113 = (_i64Add(($111|0),($112|0),($92|0),($93|0))|0);
  10032. $114 = tempRet0;
  10033. $115 = (_bitshift64Shl(($113|0),($114|0),1)|0);
  10034. $116 = tempRet0;
  10035. $117 = (($output) + 24|0);
  10036. $118 = $117;
  10037. $119 = $118;
  10038. HEAP32[$119>>2] = $115;
  10039. $120 = (($118) + 4)|0;
  10040. $121 = $120;
  10041. HEAP32[$121>>2] = $116;
  10042. $122 = $56;
  10043. $123 = $122;
  10044. $124 = HEAP32[$123>>2]|0;
  10045. $125 = (($122) + 4)|0;
  10046. $126 = $125;
  10047. $127 = HEAP32[$126>>2]|0;
  10048. $128 = (_bitshift64Ashr(0,($124|0),32)|0);
  10049. $129 = tempRet0;
  10050. $130 = (___muldi3(($128|0),($129|0),($128|0),($129|0))|0);
  10051. $131 = tempRet0;
  10052. $132 = $22;
  10053. $133 = $132;
  10054. $134 = HEAP32[$133>>2]|0;
  10055. $135 = (($132) + 4)|0;
  10056. $136 = $135;
  10057. $137 = HEAP32[$136>>2]|0;
  10058. $138 = (_bitshift64Ashr(0,($134|0),30)|0);
  10059. $139 = tempRet0;
  10060. $140 = $102;
  10061. $141 = $140;
  10062. $142 = HEAP32[$141>>2]|0;
  10063. $143 = (($140) + 4)|0;
  10064. $144 = $143;
  10065. $145 = HEAP32[$144>>2]|0;
  10066. $146 = (_bitshift64Ashr(0,($142|0),32)|0);
  10067. $147 = tempRet0;
  10068. $148 = (___muldi3(($146|0),($147|0),($138|0),($139|0))|0);
  10069. $149 = tempRet0;
  10070. $150 = (_i64Add(($148|0),($149|0),($130|0),($131|0))|0);
  10071. $151 = tempRet0;
  10072. $152 = $in;
  10073. $153 = $152;
  10074. $154 = HEAP32[$153>>2]|0;
  10075. $155 = (($152) + 4)|0;
  10076. $156 = $155;
  10077. $157 = HEAP32[$156>>2]|0;
  10078. $158 = (_bitshift64Ashr(0,($154|0),31)|0);
  10079. $159 = tempRet0;
  10080. $160 = (($in) + 32|0);
  10081. $161 = $160;
  10082. $162 = $161;
  10083. $163 = HEAP32[$162>>2]|0;
  10084. $164 = (($161) + 4)|0;
  10085. $165 = $164;
  10086. $166 = HEAP32[$165>>2]|0;
  10087. $167 = (_bitshift64Ashr(0,($163|0),32)|0);
  10088. $168 = tempRet0;
  10089. $169 = (___muldi3(($167|0),($168|0),($158|0),($159|0))|0);
  10090. $170 = tempRet0;
  10091. $171 = (_i64Add(($150|0),($151|0),($169|0),($170|0))|0);
  10092. $172 = tempRet0;
  10093. $173 = (($output) + 32|0);
  10094. $174 = $173;
  10095. $175 = $174;
  10096. HEAP32[$175>>2] = $171;
  10097. $176 = (($174) + 4)|0;
  10098. $177 = $176;
  10099. HEAP32[$177>>2] = $172;
  10100. $178 = $56;
  10101. $179 = $178;
  10102. $180 = HEAP32[$179>>2]|0;
  10103. $181 = (($178) + 4)|0;
  10104. $182 = $181;
  10105. $183 = HEAP32[$182>>2]|0;
  10106. $184 = (_bitshift64Ashr(0,($180|0),32)|0);
  10107. $185 = tempRet0;
  10108. $186 = $102;
  10109. $187 = $186;
  10110. $188 = HEAP32[$187>>2]|0;
  10111. $189 = (($186) + 4)|0;
  10112. $190 = $189;
  10113. $191 = HEAP32[$190>>2]|0;
  10114. $192 = (_bitshift64Ashr(0,($188|0),32)|0);
  10115. $193 = tempRet0;
  10116. $194 = (___muldi3(($192|0),($193|0),($184|0),($185|0))|0);
  10117. $195 = tempRet0;
  10118. $196 = $22;
  10119. $197 = $196;
  10120. $198 = HEAP32[$197>>2]|0;
  10121. $199 = (($196) + 4)|0;
  10122. $200 = $199;
  10123. $201 = HEAP32[$200>>2]|0;
  10124. $202 = (_bitshift64Ashr(0,($198|0),32)|0);
  10125. $203 = tempRet0;
  10126. $204 = $160;
  10127. $205 = $204;
  10128. $206 = HEAP32[$205>>2]|0;
  10129. $207 = (($204) + 4)|0;
  10130. $208 = $207;
  10131. $209 = HEAP32[$208>>2]|0;
  10132. $210 = (_bitshift64Ashr(0,($206|0),32)|0);
  10133. $211 = tempRet0;
  10134. $212 = (___muldi3(($210|0),($211|0),($202|0),($203|0))|0);
  10135. $213 = tempRet0;
  10136. $214 = (_i64Add(($212|0),($213|0),($194|0),($195|0))|0);
  10137. $215 = tempRet0;
  10138. $216 = $in;
  10139. $217 = $216;
  10140. $218 = HEAP32[$217>>2]|0;
  10141. $219 = (($216) + 4)|0;
  10142. $220 = $219;
  10143. $221 = HEAP32[$220>>2]|0;
  10144. $222 = (_bitshift64Ashr(0,($218|0),32)|0);
  10145. $223 = tempRet0;
  10146. $224 = (($in) + 40|0);
  10147. $225 = $224;
  10148. $226 = $225;
  10149. $227 = HEAP32[$226>>2]|0;
  10150. $228 = (($225) + 4)|0;
  10151. $229 = $228;
  10152. $230 = HEAP32[$229>>2]|0;
  10153. $231 = (_bitshift64Ashr(0,($227|0),32)|0);
  10154. $232 = tempRet0;
  10155. $233 = (___muldi3(($231|0),($232|0),($222|0),($223|0))|0);
  10156. $234 = tempRet0;
  10157. $235 = (_i64Add(($214|0),($215|0),($233|0),($234|0))|0);
  10158. $236 = tempRet0;
  10159. $237 = (_bitshift64Shl(($235|0),($236|0),1)|0);
  10160. $238 = tempRet0;
  10161. $239 = (($output) + 40|0);
  10162. $240 = $239;
  10163. $241 = $240;
  10164. HEAP32[$241>>2] = $237;
  10165. $242 = (($240) + 4)|0;
  10166. $243 = $242;
  10167. HEAP32[$243>>2] = $238;
  10168. $244 = $102;
  10169. $245 = $244;
  10170. $246 = HEAP32[$245>>2]|0;
  10171. $247 = (($244) + 4)|0;
  10172. $248 = $247;
  10173. $249 = HEAP32[$248>>2]|0;
  10174. $250 = (_bitshift64Ashr(0,($246|0),32)|0);
  10175. $251 = tempRet0;
  10176. $252 = (___muldi3(($250|0),($251|0),($250|0),($251|0))|0);
  10177. $253 = tempRet0;
  10178. $254 = $56;
  10179. $255 = $254;
  10180. $256 = HEAP32[$255>>2]|0;
  10181. $257 = (($254) + 4)|0;
  10182. $258 = $257;
  10183. $259 = HEAP32[$258>>2]|0;
  10184. $260 = (_bitshift64Ashr(0,($256|0),32)|0);
  10185. $261 = tempRet0;
  10186. $262 = $160;
  10187. $263 = $262;
  10188. $264 = HEAP32[$263>>2]|0;
  10189. $265 = (($262) + 4)|0;
  10190. $266 = $265;
  10191. $267 = HEAP32[$266>>2]|0;
  10192. $268 = (_bitshift64Ashr(0,($264|0),32)|0);
  10193. $269 = tempRet0;
  10194. $270 = (___muldi3(($268|0),($269|0),($260|0),($261|0))|0);
  10195. $271 = tempRet0;
  10196. $272 = (_i64Add(($270|0),($271|0),($252|0),($253|0))|0);
  10197. $273 = tempRet0;
  10198. $274 = $in;
  10199. $275 = $274;
  10200. $276 = HEAP32[$275>>2]|0;
  10201. $277 = (($274) + 4)|0;
  10202. $278 = $277;
  10203. $279 = HEAP32[$278>>2]|0;
  10204. $280 = (_bitshift64Ashr(0,($276|0),32)|0);
  10205. $281 = tempRet0;
  10206. $282 = (($in) + 48|0);
  10207. $283 = $282;
  10208. $284 = $283;
  10209. $285 = HEAP32[$284>>2]|0;
  10210. $286 = (($283) + 4)|0;
  10211. $287 = $286;
  10212. $288 = HEAP32[$287>>2]|0;
  10213. $289 = (_bitshift64Ashr(0,($285|0),32)|0);
  10214. $290 = tempRet0;
  10215. $291 = (___muldi3(($289|0),($290|0),($280|0),($281|0))|0);
  10216. $292 = tempRet0;
  10217. $293 = (_i64Add(($272|0),($273|0),($291|0),($292|0))|0);
  10218. $294 = tempRet0;
  10219. $295 = $22;
  10220. $296 = $295;
  10221. $297 = HEAP32[$296>>2]|0;
  10222. $298 = (($295) + 4)|0;
  10223. $299 = $298;
  10224. $300 = HEAP32[$299>>2]|0;
  10225. $301 = (_bitshift64Ashr(0,($297|0),31)|0);
  10226. $302 = tempRet0;
  10227. $303 = $224;
  10228. $304 = $303;
  10229. $305 = HEAP32[$304>>2]|0;
  10230. $306 = (($303) + 4)|0;
  10231. $307 = $306;
  10232. $308 = HEAP32[$307>>2]|0;
  10233. $309 = (_bitshift64Ashr(0,($305|0),32)|0);
  10234. $310 = tempRet0;
  10235. $311 = (___muldi3(($309|0),($310|0),($301|0),($302|0))|0);
  10236. $312 = tempRet0;
  10237. $313 = (_i64Add(($293|0),($294|0),($311|0),($312|0))|0);
  10238. $314 = tempRet0;
  10239. $315 = (_bitshift64Shl(($313|0),($314|0),1)|0);
  10240. $316 = tempRet0;
  10241. $317 = (($output) + 48|0);
  10242. $318 = $317;
  10243. $319 = $318;
  10244. HEAP32[$319>>2] = $315;
  10245. $320 = (($318) + 4)|0;
  10246. $321 = $320;
  10247. HEAP32[$321>>2] = $316;
  10248. $322 = $102;
  10249. $323 = $322;
  10250. $324 = HEAP32[$323>>2]|0;
  10251. $325 = (($322) + 4)|0;
  10252. $326 = $325;
  10253. $327 = HEAP32[$326>>2]|0;
  10254. $328 = (_bitshift64Ashr(0,($324|0),32)|0);
  10255. $329 = tempRet0;
  10256. $330 = $160;
  10257. $331 = $330;
  10258. $332 = HEAP32[$331>>2]|0;
  10259. $333 = (($330) + 4)|0;
  10260. $334 = $333;
  10261. $335 = HEAP32[$334>>2]|0;
  10262. $336 = (_bitshift64Ashr(0,($332|0),32)|0);
  10263. $337 = tempRet0;
  10264. $338 = (___muldi3(($336|0),($337|0),($328|0),($329|0))|0);
  10265. $339 = tempRet0;
  10266. $340 = $56;
  10267. $341 = $340;
  10268. $342 = HEAP32[$341>>2]|0;
  10269. $343 = (($340) + 4)|0;
  10270. $344 = $343;
  10271. $345 = HEAP32[$344>>2]|0;
  10272. $346 = (_bitshift64Ashr(0,($342|0),32)|0);
  10273. $347 = tempRet0;
  10274. $348 = $224;
  10275. $349 = $348;
  10276. $350 = HEAP32[$349>>2]|0;
  10277. $351 = (($348) + 4)|0;
  10278. $352 = $351;
  10279. $353 = HEAP32[$352>>2]|0;
  10280. $354 = (_bitshift64Ashr(0,($350|0),32)|0);
  10281. $355 = tempRet0;
  10282. $356 = (___muldi3(($354|0),($355|0),($346|0),($347|0))|0);
  10283. $357 = tempRet0;
  10284. $358 = (_i64Add(($356|0),($357|0),($338|0),($339|0))|0);
  10285. $359 = tempRet0;
  10286. $360 = $22;
  10287. $361 = $360;
  10288. $362 = HEAP32[$361>>2]|0;
  10289. $363 = (($360) + 4)|0;
  10290. $364 = $363;
  10291. $365 = HEAP32[$364>>2]|0;
  10292. $366 = (_bitshift64Ashr(0,($362|0),32)|0);
  10293. $367 = tempRet0;
  10294. $368 = $282;
  10295. $369 = $368;
  10296. $370 = HEAP32[$369>>2]|0;
  10297. $371 = (($368) + 4)|0;
  10298. $372 = $371;
  10299. $373 = HEAP32[$372>>2]|0;
  10300. $374 = (_bitshift64Ashr(0,($370|0),32)|0);
  10301. $375 = tempRet0;
  10302. $376 = (___muldi3(($374|0),($375|0),($366|0),($367|0))|0);
  10303. $377 = tempRet0;
  10304. $378 = (_i64Add(($358|0),($359|0),($376|0),($377|0))|0);
  10305. $379 = tempRet0;
  10306. $380 = $in;
  10307. $381 = $380;
  10308. $382 = HEAP32[$381>>2]|0;
  10309. $383 = (($380) + 4)|0;
  10310. $384 = $383;
  10311. $385 = HEAP32[$384>>2]|0;
  10312. $386 = (_bitshift64Ashr(0,($382|0),32)|0);
  10313. $387 = tempRet0;
  10314. $388 = (($in) + 56|0);
  10315. $389 = $388;
  10316. $390 = $389;
  10317. $391 = HEAP32[$390>>2]|0;
  10318. $392 = (($389) + 4)|0;
  10319. $393 = $392;
  10320. $394 = HEAP32[$393>>2]|0;
  10321. $395 = (_bitshift64Ashr(0,($391|0),32)|0);
  10322. $396 = tempRet0;
  10323. $397 = (___muldi3(($395|0),($396|0),($386|0),($387|0))|0);
  10324. $398 = tempRet0;
  10325. $399 = (_i64Add(($378|0),($379|0),($397|0),($398|0))|0);
  10326. $400 = tempRet0;
  10327. $401 = (_bitshift64Shl(($399|0),($400|0),1)|0);
  10328. $402 = tempRet0;
  10329. $403 = (($output) + 56|0);
  10330. $404 = $403;
  10331. $405 = $404;
  10332. HEAP32[$405>>2] = $401;
  10333. $406 = (($404) + 4)|0;
  10334. $407 = $406;
  10335. HEAP32[$407>>2] = $402;
  10336. $408 = $160;
  10337. $409 = $408;
  10338. $410 = HEAP32[$409>>2]|0;
  10339. $411 = (($408) + 4)|0;
  10340. $412 = $411;
  10341. $413 = HEAP32[$412>>2]|0;
  10342. $414 = (_bitshift64Ashr(0,($410|0),32)|0);
  10343. $415 = tempRet0;
  10344. $416 = (___muldi3(($414|0),($415|0),($414|0),($415|0))|0);
  10345. $417 = tempRet0;
  10346. $418 = $56;
  10347. $419 = $418;
  10348. $420 = HEAP32[$419>>2]|0;
  10349. $421 = (($418) + 4)|0;
  10350. $422 = $421;
  10351. $423 = HEAP32[$422>>2]|0;
  10352. $424 = (_bitshift64Ashr(0,($420|0),32)|0);
  10353. $425 = tempRet0;
  10354. $426 = $282;
  10355. $427 = $426;
  10356. $428 = HEAP32[$427>>2]|0;
  10357. $429 = (($426) + 4)|0;
  10358. $430 = $429;
  10359. $431 = HEAP32[$430>>2]|0;
  10360. $432 = (_bitshift64Ashr(0,($428|0),32)|0);
  10361. $433 = tempRet0;
  10362. $434 = (___muldi3(($432|0),($433|0),($424|0),($425|0))|0);
  10363. $435 = tempRet0;
  10364. $436 = $in;
  10365. $437 = $436;
  10366. $438 = HEAP32[$437>>2]|0;
  10367. $439 = (($436) + 4)|0;
  10368. $440 = $439;
  10369. $441 = HEAP32[$440>>2]|0;
  10370. $442 = (_bitshift64Ashr(0,($438|0),32)|0);
  10371. $443 = tempRet0;
  10372. $444 = (($in) + 64|0);
  10373. $445 = $444;
  10374. $446 = $445;
  10375. $447 = HEAP32[$446>>2]|0;
  10376. $448 = (($445) + 4)|0;
  10377. $449 = $448;
  10378. $450 = HEAP32[$449>>2]|0;
  10379. $451 = (_bitshift64Ashr(0,($447|0),32)|0);
  10380. $452 = tempRet0;
  10381. $453 = (___muldi3(($451|0),($452|0),($442|0),($443|0))|0);
  10382. $454 = tempRet0;
  10383. $455 = (_i64Add(($453|0),($454|0),($434|0),($435|0))|0);
  10384. $456 = tempRet0;
  10385. $457 = $22;
  10386. $458 = $457;
  10387. $459 = HEAP32[$458>>2]|0;
  10388. $460 = (($457) + 4)|0;
  10389. $461 = $460;
  10390. $462 = HEAP32[$461>>2]|0;
  10391. $463 = (_bitshift64Ashr(0,($459|0),32)|0);
  10392. $464 = tempRet0;
  10393. $465 = $388;
  10394. $466 = $465;
  10395. $467 = HEAP32[$466>>2]|0;
  10396. $468 = (($465) + 4)|0;
  10397. $469 = $468;
  10398. $470 = HEAP32[$469>>2]|0;
  10399. $471 = (_bitshift64Ashr(0,($467|0),32)|0);
  10400. $472 = tempRet0;
  10401. $473 = (___muldi3(($471|0),($472|0),($463|0),($464|0))|0);
  10402. $474 = tempRet0;
  10403. $475 = $102;
  10404. $476 = $475;
  10405. $477 = HEAP32[$476>>2]|0;
  10406. $478 = (($475) + 4)|0;
  10407. $479 = $478;
  10408. $480 = HEAP32[$479>>2]|0;
  10409. $481 = (_bitshift64Ashr(0,($477|0),32)|0);
  10410. $482 = tempRet0;
  10411. $483 = $224;
  10412. $484 = $483;
  10413. $485 = HEAP32[$484>>2]|0;
  10414. $486 = (($483) + 4)|0;
  10415. $487 = $486;
  10416. $488 = HEAP32[$487>>2]|0;
  10417. $489 = (_bitshift64Ashr(0,($485|0),32)|0);
  10418. $490 = tempRet0;
  10419. $491 = (___muldi3(($489|0),($490|0),($481|0),($482|0))|0);
  10420. $492 = tempRet0;
  10421. $493 = (_i64Add(($491|0),($492|0),($473|0),($474|0))|0);
  10422. $494 = tempRet0;
  10423. $495 = (_bitshift64Shl(($493|0),($494|0),1)|0);
  10424. $496 = tempRet0;
  10425. $497 = (_i64Add(($455|0),($456|0),($495|0),($496|0))|0);
  10426. $498 = tempRet0;
  10427. $499 = (_bitshift64Shl(($497|0),($498|0),1)|0);
  10428. $500 = tempRet0;
  10429. $501 = (_i64Add(($499|0),($500|0),($416|0),($417|0))|0);
  10430. $502 = tempRet0;
  10431. $503 = (($output) + 64|0);
  10432. $504 = $503;
  10433. $505 = $504;
  10434. HEAP32[$505>>2] = $501;
  10435. $506 = (($504) + 4)|0;
  10436. $507 = $506;
  10437. HEAP32[$507>>2] = $502;
  10438. $508 = $160;
  10439. $509 = $508;
  10440. $510 = HEAP32[$509>>2]|0;
  10441. $511 = (($508) + 4)|0;
  10442. $512 = $511;
  10443. $513 = HEAP32[$512>>2]|0;
  10444. $514 = (_bitshift64Ashr(0,($510|0),32)|0);
  10445. $515 = tempRet0;
  10446. $516 = $224;
  10447. $517 = $516;
  10448. $518 = HEAP32[$517>>2]|0;
  10449. $519 = (($516) + 4)|0;
  10450. $520 = $519;
  10451. $521 = HEAP32[$520>>2]|0;
  10452. $522 = (_bitshift64Ashr(0,($518|0),32)|0);
  10453. $523 = tempRet0;
  10454. $524 = (___muldi3(($522|0),($523|0),($514|0),($515|0))|0);
  10455. $525 = tempRet0;
  10456. $526 = $102;
  10457. $527 = $526;
  10458. $528 = HEAP32[$527>>2]|0;
  10459. $529 = (($526) + 4)|0;
  10460. $530 = $529;
  10461. $531 = HEAP32[$530>>2]|0;
  10462. $532 = (_bitshift64Ashr(0,($528|0),32)|0);
  10463. $533 = tempRet0;
  10464. $534 = $282;
  10465. $535 = $534;
  10466. $536 = HEAP32[$535>>2]|0;
  10467. $537 = (($534) + 4)|0;
  10468. $538 = $537;
  10469. $539 = HEAP32[$538>>2]|0;
  10470. $540 = (_bitshift64Ashr(0,($536|0),32)|0);
  10471. $541 = tempRet0;
  10472. $542 = (___muldi3(($540|0),($541|0),($532|0),($533|0))|0);
  10473. $543 = tempRet0;
  10474. $544 = (_i64Add(($542|0),($543|0),($524|0),($525|0))|0);
  10475. $545 = tempRet0;
  10476. $546 = $56;
  10477. $547 = $546;
  10478. $548 = HEAP32[$547>>2]|0;
  10479. $549 = (($546) + 4)|0;
  10480. $550 = $549;
  10481. $551 = HEAP32[$550>>2]|0;
  10482. $552 = (_bitshift64Ashr(0,($548|0),32)|0);
  10483. $553 = tempRet0;
  10484. $554 = $388;
  10485. $555 = $554;
  10486. $556 = HEAP32[$555>>2]|0;
  10487. $557 = (($554) + 4)|0;
  10488. $558 = $557;
  10489. $559 = HEAP32[$558>>2]|0;
  10490. $560 = (_bitshift64Ashr(0,($556|0),32)|0);
  10491. $561 = tempRet0;
  10492. $562 = (___muldi3(($560|0),($561|0),($552|0),($553|0))|0);
  10493. $563 = tempRet0;
  10494. $564 = (_i64Add(($544|0),($545|0),($562|0),($563|0))|0);
  10495. $565 = tempRet0;
  10496. $566 = $22;
  10497. $567 = $566;
  10498. $568 = HEAP32[$567>>2]|0;
  10499. $569 = (($566) + 4)|0;
  10500. $570 = $569;
  10501. $571 = HEAP32[$570>>2]|0;
  10502. $572 = (_bitshift64Ashr(0,($568|0),32)|0);
  10503. $573 = tempRet0;
  10504. $574 = $444;
  10505. $575 = $574;
  10506. $576 = HEAP32[$575>>2]|0;
  10507. $577 = (($574) + 4)|0;
  10508. $578 = $577;
  10509. $579 = HEAP32[$578>>2]|0;
  10510. $580 = (_bitshift64Ashr(0,($576|0),32)|0);
  10511. $581 = tempRet0;
  10512. $582 = (___muldi3(($580|0),($581|0),($572|0),($573|0))|0);
  10513. $583 = tempRet0;
  10514. $584 = (_i64Add(($564|0),($565|0),($582|0),($583|0))|0);
  10515. $585 = tempRet0;
  10516. $586 = $in;
  10517. $587 = $586;
  10518. $588 = HEAP32[$587>>2]|0;
  10519. $589 = (($586) + 4)|0;
  10520. $590 = $589;
  10521. $591 = HEAP32[$590>>2]|0;
  10522. $592 = (_bitshift64Ashr(0,($588|0),32)|0);
  10523. $593 = tempRet0;
  10524. $594 = (($in) + 72|0);
  10525. $595 = $594;
  10526. $596 = $595;
  10527. $597 = HEAP32[$596>>2]|0;
  10528. $598 = (($595) + 4)|0;
  10529. $599 = $598;
  10530. $600 = HEAP32[$599>>2]|0;
  10531. $601 = (_bitshift64Ashr(0,($597|0),32)|0);
  10532. $602 = tempRet0;
  10533. $603 = (___muldi3(($601|0),($602|0),($592|0),($593|0))|0);
  10534. $604 = tempRet0;
  10535. $605 = (_i64Add(($584|0),($585|0),($603|0),($604|0))|0);
  10536. $606 = tempRet0;
  10537. $607 = (_bitshift64Shl(($605|0),($606|0),1)|0);
  10538. $608 = tempRet0;
  10539. $609 = (($output) + 72|0);
  10540. $610 = $609;
  10541. $611 = $610;
  10542. HEAP32[$611>>2] = $607;
  10543. $612 = (($610) + 4)|0;
  10544. $613 = $612;
  10545. HEAP32[$613>>2] = $608;
  10546. $614 = $224;
  10547. $615 = $614;
  10548. $616 = HEAP32[$615>>2]|0;
  10549. $617 = (($614) + 4)|0;
  10550. $618 = $617;
  10551. $619 = HEAP32[$618>>2]|0;
  10552. $620 = (_bitshift64Ashr(0,($616|0),32)|0);
  10553. $621 = tempRet0;
  10554. $622 = (___muldi3(($620|0),($621|0),($620|0),($621|0))|0);
  10555. $623 = tempRet0;
  10556. $624 = $160;
  10557. $625 = $624;
  10558. $626 = HEAP32[$625>>2]|0;
  10559. $627 = (($624) + 4)|0;
  10560. $628 = $627;
  10561. $629 = HEAP32[$628>>2]|0;
  10562. $630 = (_bitshift64Ashr(0,($626|0),32)|0);
  10563. $631 = tempRet0;
  10564. $632 = $282;
  10565. $633 = $632;
  10566. $634 = HEAP32[$633>>2]|0;
  10567. $635 = (($632) + 4)|0;
  10568. $636 = $635;
  10569. $637 = HEAP32[$636>>2]|0;
  10570. $638 = (_bitshift64Ashr(0,($634|0),32)|0);
  10571. $639 = tempRet0;
  10572. $640 = (___muldi3(($638|0),($639|0),($630|0),($631|0))|0);
  10573. $641 = tempRet0;
  10574. $642 = (_i64Add(($640|0),($641|0),($622|0),($623|0))|0);
  10575. $643 = tempRet0;
  10576. $644 = $56;
  10577. $645 = $644;
  10578. $646 = HEAP32[$645>>2]|0;
  10579. $647 = (($644) + 4)|0;
  10580. $648 = $647;
  10581. $649 = HEAP32[$648>>2]|0;
  10582. $650 = (_bitshift64Ashr(0,($646|0),32)|0);
  10583. $651 = tempRet0;
  10584. $652 = $444;
  10585. $653 = $652;
  10586. $654 = HEAP32[$653>>2]|0;
  10587. $655 = (($652) + 4)|0;
  10588. $656 = $655;
  10589. $657 = HEAP32[$656>>2]|0;
  10590. $658 = (_bitshift64Ashr(0,($654|0),32)|0);
  10591. $659 = tempRet0;
  10592. $660 = (___muldi3(($658|0),($659|0),($650|0),($651|0))|0);
  10593. $661 = tempRet0;
  10594. $662 = (_i64Add(($642|0),($643|0),($660|0),($661|0))|0);
  10595. $663 = tempRet0;
  10596. $664 = $102;
  10597. $665 = $664;
  10598. $666 = HEAP32[$665>>2]|0;
  10599. $667 = (($664) + 4)|0;
  10600. $668 = $667;
  10601. $669 = HEAP32[$668>>2]|0;
  10602. $670 = (_bitshift64Ashr(0,($666|0),32)|0);
  10603. $671 = tempRet0;
  10604. $672 = $388;
  10605. $673 = $672;
  10606. $674 = HEAP32[$673>>2]|0;
  10607. $675 = (($672) + 4)|0;
  10608. $676 = $675;
  10609. $677 = HEAP32[$676>>2]|0;
  10610. $678 = (_bitshift64Ashr(0,($674|0),32)|0);
  10611. $679 = tempRet0;
  10612. $680 = (___muldi3(($678|0),($679|0),($670|0),($671|0))|0);
  10613. $681 = tempRet0;
  10614. $682 = $22;
  10615. $683 = $682;
  10616. $684 = HEAP32[$683>>2]|0;
  10617. $685 = (($682) + 4)|0;
  10618. $686 = $685;
  10619. $687 = HEAP32[$686>>2]|0;
  10620. $688 = (_bitshift64Ashr(0,($684|0),32)|0);
  10621. $689 = tempRet0;
  10622. $690 = $594;
  10623. $691 = $690;
  10624. $692 = HEAP32[$691>>2]|0;
  10625. $693 = (($690) + 4)|0;
  10626. $694 = $693;
  10627. $695 = HEAP32[$694>>2]|0;
  10628. $696 = (_bitshift64Ashr(0,($692|0),32)|0);
  10629. $697 = tempRet0;
  10630. $698 = (___muldi3(($696|0),($697|0),($688|0),($689|0))|0);
  10631. $699 = tempRet0;
  10632. $700 = (_i64Add(($698|0),($699|0),($680|0),($681|0))|0);
  10633. $701 = tempRet0;
  10634. $702 = (_bitshift64Shl(($700|0),($701|0),1)|0);
  10635. $703 = tempRet0;
  10636. $704 = (_i64Add(($662|0),($663|0),($702|0),($703|0))|0);
  10637. $705 = tempRet0;
  10638. $706 = (_bitshift64Shl(($704|0),($705|0),1)|0);
  10639. $707 = tempRet0;
  10640. $708 = (($output) + 80|0);
  10641. $709 = $708;
  10642. $710 = $709;
  10643. HEAP32[$710>>2] = $706;
  10644. $711 = (($709) + 4)|0;
  10645. $712 = $711;
  10646. HEAP32[$712>>2] = $707;
  10647. $713 = $224;
  10648. $714 = $713;
  10649. $715 = HEAP32[$714>>2]|0;
  10650. $716 = (($713) + 4)|0;
  10651. $717 = $716;
  10652. $718 = HEAP32[$717>>2]|0;
  10653. $719 = (_bitshift64Ashr(0,($715|0),32)|0);
  10654. $720 = tempRet0;
  10655. $721 = $282;
  10656. $722 = $721;
  10657. $723 = HEAP32[$722>>2]|0;
  10658. $724 = (($721) + 4)|0;
  10659. $725 = $724;
  10660. $726 = HEAP32[$725>>2]|0;
  10661. $727 = (_bitshift64Ashr(0,($723|0),32)|0);
  10662. $728 = tempRet0;
  10663. $729 = (___muldi3(($727|0),($728|0),($719|0),($720|0))|0);
  10664. $730 = tempRet0;
  10665. $731 = $160;
  10666. $732 = $731;
  10667. $733 = HEAP32[$732>>2]|0;
  10668. $734 = (($731) + 4)|0;
  10669. $735 = $734;
  10670. $736 = HEAP32[$735>>2]|0;
  10671. $737 = (_bitshift64Ashr(0,($733|0),32)|0);
  10672. $738 = tempRet0;
  10673. $739 = $388;
  10674. $740 = $739;
  10675. $741 = HEAP32[$740>>2]|0;
  10676. $742 = (($739) + 4)|0;
  10677. $743 = $742;
  10678. $744 = HEAP32[$743>>2]|0;
  10679. $745 = (_bitshift64Ashr(0,($741|0),32)|0);
  10680. $746 = tempRet0;
  10681. $747 = (___muldi3(($745|0),($746|0),($737|0),($738|0))|0);
  10682. $748 = tempRet0;
  10683. $749 = (_i64Add(($747|0),($748|0),($729|0),($730|0))|0);
  10684. $750 = tempRet0;
  10685. $751 = $102;
  10686. $752 = $751;
  10687. $753 = HEAP32[$752>>2]|0;
  10688. $754 = (($751) + 4)|0;
  10689. $755 = $754;
  10690. $756 = HEAP32[$755>>2]|0;
  10691. $757 = (_bitshift64Ashr(0,($753|0),32)|0);
  10692. $758 = tempRet0;
  10693. $759 = $444;
  10694. $760 = $759;
  10695. $761 = HEAP32[$760>>2]|0;
  10696. $762 = (($759) + 4)|0;
  10697. $763 = $762;
  10698. $764 = HEAP32[$763>>2]|0;
  10699. $765 = (_bitshift64Ashr(0,($761|0),32)|0);
  10700. $766 = tempRet0;
  10701. $767 = (___muldi3(($765|0),($766|0),($757|0),($758|0))|0);
  10702. $768 = tempRet0;
  10703. $769 = (_i64Add(($749|0),($750|0),($767|0),($768|0))|0);
  10704. $770 = tempRet0;
  10705. $771 = $56;
  10706. $772 = $771;
  10707. $773 = HEAP32[$772>>2]|0;
  10708. $774 = (($771) + 4)|0;
  10709. $775 = $774;
  10710. $776 = HEAP32[$775>>2]|0;
  10711. $777 = (_bitshift64Ashr(0,($773|0),32)|0);
  10712. $778 = tempRet0;
  10713. $779 = $594;
  10714. $780 = $779;
  10715. $781 = HEAP32[$780>>2]|0;
  10716. $782 = (($779) + 4)|0;
  10717. $783 = $782;
  10718. $784 = HEAP32[$783>>2]|0;
  10719. $785 = (_bitshift64Ashr(0,($781|0),32)|0);
  10720. $786 = tempRet0;
  10721. $787 = (___muldi3(($785|0),($786|0),($777|0),($778|0))|0);
  10722. $788 = tempRet0;
  10723. $789 = (_i64Add(($769|0),($770|0),($787|0),($788|0))|0);
  10724. $790 = tempRet0;
  10725. $791 = (_bitshift64Shl(($789|0),($790|0),1)|0);
  10726. $792 = tempRet0;
  10727. $793 = (($output) + 88|0);
  10728. $794 = $793;
  10729. $795 = $794;
  10730. HEAP32[$795>>2] = $791;
  10731. $796 = (($794) + 4)|0;
  10732. $797 = $796;
  10733. HEAP32[$797>>2] = $792;
  10734. $798 = $282;
  10735. $799 = $798;
  10736. $800 = HEAP32[$799>>2]|0;
  10737. $801 = (($798) + 4)|0;
  10738. $802 = $801;
  10739. $803 = HEAP32[$802>>2]|0;
  10740. $804 = (_bitshift64Ashr(0,($800|0),32)|0);
  10741. $805 = tempRet0;
  10742. $806 = (___muldi3(($804|0),($805|0),($804|0),($805|0))|0);
  10743. $807 = tempRet0;
  10744. $808 = $160;
  10745. $809 = $808;
  10746. $810 = HEAP32[$809>>2]|0;
  10747. $811 = (($808) + 4)|0;
  10748. $812 = $811;
  10749. $813 = HEAP32[$812>>2]|0;
  10750. $814 = (_bitshift64Ashr(0,($810|0),32)|0);
  10751. $815 = tempRet0;
  10752. $816 = $444;
  10753. $817 = $816;
  10754. $818 = HEAP32[$817>>2]|0;
  10755. $819 = (($816) + 4)|0;
  10756. $820 = $819;
  10757. $821 = HEAP32[$820>>2]|0;
  10758. $822 = (_bitshift64Ashr(0,($818|0),32)|0);
  10759. $823 = tempRet0;
  10760. $824 = (___muldi3(($822|0),($823|0),($814|0),($815|0))|0);
  10761. $825 = tempRet0;
  10762. $826 = $224;
  10763. $827 = $826;
  10764. $828 = HEAP32[$827>>2]|0;
  10765. $829 = (($826) + 4)|0;
  10766. $830 = $829;
  10767. $831 = HEAP32[$830>>2]|0;
  10768. $832 = (_bitshift64Ashr(0,($828|0),32)|0);
  10769. $833 = tempRet0;
  10770. $834 = $388;
  10771. $835 = $834;
  10772. $836 = HEAP32[$835>>2]|0;
  10773. $837 = (($834) + 4)|0;
  10774. $838 = $837;
  10775. $839 = HEAP32[$838>>2]|0;
  10776. $840 = (_bitshift64Ashr(0,($836|0),32)|0);
  10777. $841 = tempRet0;
  10778. $842 = (___muldi3(($840|0),($841|0),($832|0),($833|0))|0);
  10779. $843 = tempRet0;
  10780. $844 = $102;
  10781. $845 = $844;
  10782. $846 = HEAP32[$845>>2]|0;
  10783. $847 = (($844) + 4)|0;
  10784. $848 = $847;
  10785. $849 = HEAP32[$848>>2]|0;
  10786. $850 = (_bitshift64Ashr(0,($846|0),32)|0);
  10787. $851 = tempRet0;
  10788. $852 = $594;
  10789. $853 = $852;
  10790. $854 = HEAP32[$853>>2]|0;
  10791. $855 = (($852) + 4)|0;
  10792. $856 = $855;
  10793. $857 = HEAP32[$856>>2]|0;
  10794. $858 = (_bitshift64Ashr(0,($854|0),32)|0);
  10795. $859 = tempRet0;
  10796. $860 = (___muldi3(($858|0),($859|0),($850|0),($851|0))|0);
  10797. $861 = tempRet0;
  10798. $862 = (_i64Add(($860|0),($861|0),($842|0),($843|0))|0);
  10799. $863 = tempRet0;
  10800. $864 = (_bitshift64Shl(($862|0),($863|0),1)|0);
  10801. $865 = tempRet0;
  10802. $866 = (_i64Add(($864|0),($865|0),($824|0),($825|0))|0);
  10803. $867 = tempRet0;
  10804. $868 = (_bitshift64Shl(($866|0),($867|0),1)|0);
  10805. $869 = tempRet0;
  10806. $870 = (_i64Add(($868|0),($869|0),($806|0),($807|0))|0);
  10807. $871 = tempRet0;
  10808. $872 = (($output) + 96|0);
  10809. $873 = $872;
  10810. $874 = $873;
  10811. HEAP32[$874>>2] = $870;
  10812. $875 = (($873) + 4)|0;
  10813. $876 = $875;
  10814. HEAP32[$876>>2] = $871;
  10815. $877 = $282;
  10816. $878 = $877;
  10817. $879 = HEAP32[$878>>2]|0;
  10818. $880 = (($877) + 4)|0;
  10819. $881 = $880;
  10820. $882 = HEAP32[$881>>2]|0;
  10821. $883 = (_bitshift64Ashr(0,($879|0),32)|0);
  10822. $884 = tempRet0;
  10823. $885 = $388;
  10824. $886 = $885;
  10825. $887 = HEAP32[$886>>2]|0;
  10826. $888 = (($885) + 4)|0;
  10827. $889 = $888;
  10828. $890 = HEAP32[$889>>2]|0;
  10829. $891 = (_bitshift64Ashr(0,($887|0),32)|0);
  10830. $892 = tempRet0;
  10831. $893 = (___muldi3(($891|0),($892|0),($883|0),($884|0))|0);
  10832. $894 = tempRet0;
  10833. $895 = $224;
  10834. $896 = $895;
  10835. $897 = HEAP32[$896>>2]|0;
  10836. $898 = (($895) + 4)|0;
  10837. $899 = $898;
  10838. $900 = HEAP32[$899>>2]|0;
  10839. $901 = (_bitshift64Ashr(0,($897|0),32)|0);
  10840. $902 = tempRet0;
  10841. $903 = $444;
  10842. $904 = $903;
  10843. $905 = HEAP32[$904>>2]|0;
  10844. $906 = (($903) + 4)|0;
  10845. $907 = $906;
  10846. $908 = HEAP32[$907>>2]|0;
  10847. $909 = (_bitshift64Ashr(0,($905|0),32)|0);
  10848. $910 = tempRet0;
  10849. $911 = (___muldi3(($909|0),($910|0),($901|0),($902|0))|0);
  10850. $912 = tempRet0;
  10851. $913 = (_i64Add(($911|0),($912|0),($893|0),($894|0))|0);
  10852. $914 = tempRet0;
  10853. $915 = $160;
  10854. $916 = $915;
  10855. $917 = HEAP32[$916>>2]|0;
  10856. $918 = (($915) + 4)|0;
  10857. $919 = $918;
  10858. $920 = HEAP32[$919>>2]|0;
  10859. $921 = (_bitshift64Ashr(0,($917|0),32)|0);
  10860. $922 = tempRet0;
  10861. $923 = $594;
  10862. $924 = $923;
  10863. $925 = HEAP32[$924>>2]|0;
  10864. $926 = (($923) + 4)|0;
  10865. $927 = $926;
  10866. $928 = HEAP32[$927>>2]|0;
  10867. $929 = (_bitshift64Ashr(0,($925|0),32)|0);
  10868. $930 = tempRet0;
  10869. $931 = (___muldi3(($929|0),($930|0),($921|0),($922|0))|0);
  10870. $932 = tempRet0;
  10871. $933 = (_i64Add(($913|0),($914|0),($931|0),($932|0))|0);
  10872. $934 = tempRet0;
  10873. $935 = (_bitshift64Shl(($933|0),($934|0),1)|0);
  10874. $936 = tempRet0;
  10875. $937 = (($output) + 104|0);
  10876. $938 = $937;
  10877. $939 = $938;
  10878. HEAP32[$939>>2] = $935;
  10879. $940 = (($938) + 4)|0;
  10880. $941 = $940;
  10881. HEAP32[$941>>2] = $936;
  10882. $942 = $388;
  10883. $943 = $942;
  10884. $944 = HEAP32[$943>>2]|0;
  10885. $945 = (($942) + 4)|0;
  10886. $946 = $945;
  10887. $947 = HEAP32[$946>>2]|0;
  10888. $948 = (_bitshift64Ashr(0,($944|0),32)|0);
  10889. $949 = tempRet0;
  10890. $950 = (___muldi3(($948|0),($949|0),($948|0),($949|0))|0);
  10891. $951 = tempRet0;
  10892. $952 = $282;
  10893. $953 = $952;
  10894. $954 = HEAP32[$953>>2]|0;
  10895. $955 = (($952) + 4)|0;
  10896. $956 = $955;
  10897. $957 = HEAP32[$956>>2]|0;
  10898. $958 = (_bitshift64Ashr(0,($954|0),32)|0);
  10899. $959 = tempRet0;
  10900. $960 = $444;
  10901. $961 = $960;
  10902. $962 = HEAP32[$961>>2]|0;
  10903. $963 = (($960) + 4)|0;
  10904. $964 = $963;
  10905. $965 = HEAP32[$964>>2]|0;
  10906. $966 = (_bitshift64Ashr(0,($962|0),32)|0);
  10907. $967 = tempRet0;
  10908. $968 = (___muldi3(($966|0),($967|0),($958|0),($959|0))|0);
  10909. $969 = tempRet0;
  10910. $970 = (_i64Add(($968|0),($969|0),($950|0),($951|0))|0);
  10911. $971 = tempRet0;
  10912. $972 = $224;
  10913. $973 = $972;
  10914. $974 = HEAP32[$973>>2]|0;
  10915. $975 = (($972) + 4)|0;
  10916. $976 = $975;
  10917. $977 = HEAP32[$976>>2]|0;
  10918. $978 = (_bitshift64Ashr(0,($974|0),31)|0);
  10919. $979 = tempRet0;
  10920. $980 = $594;
  10921. $981 = $980;
  10922. $982 = HEAP32[$981>>2]|0;
  10923. $983 = (($980) + 4)|0;
  10924. $984 = $983;
  10925. $985 = HEAP32[$984>>2]|0;
  10926. $986 = (_bitshift64Ashr(0,($982|0),32)|0);
  10927. $987 = tempRet0;
  10928. $988 = (___muldi3(($986|0),($987|0),($978|0),($979|0))|0);
  10929. $989 = tempRet0;
  10930. $990 = (_i64Add(($970|0),($971|0),($988|0),($989|0))|0);
  10931. $991 = tempRet0;
  10932. $992 = (_bitshift64Shl(($990|0),($991|0),1)|0);
  10933. $993 = tempRet0;
  10934. $994 = (($output) + 112|0);
  10935. $995 = $994;
  10936. $996 = $995;
  10937. HEAP32[$996>>2] = $992;
  10938. $997 = (($995) + 4)|0;
  10939. $998 = $997;
  10940. HEAP32[$998>>2] = $993;
  10941. $999 = $388;
  10942. $1000 = $999;
  10943. $1001 = HEAP32[$1000>>2]|0;
  10944. $1002 = (($999) + 4)|0;
  10945. $1003 = $1002;
  10946. $1004 = HEAP32[$1003>>2]|0;
  10947. $1005 = (_bitshift64Ashr(0,($1001|0),32)|0);
  10948. $1006 = tempRet0;
  10949. $1007 = $444;
  10950. $1008 = $1007;
  10951. $1009 = HEAP32[$1008>>2]|0;
  10952. $1010 = (($1007) + 4)|0;
  10953. $1011 = $1010;
  10954. $1012 = HEAP32[$1011>>2]|0;
  10955. $1013 = (_bitshift64Ashr(0,($1009|0),32)|0);
  10956. $1014 = tempRet0;
  10957. $1015 = (___muldi3(($1013|0),($1014|0),($1005|0),($1006|0))|0);
  10958. $1016 = tempRet0;
  10959. $1017 = $282;
  10960. $1018 = $1017;
  10961. $1019 = HEAP32[$1018>>2]|0;
  10962. $1020 = (($1017) + 4)|0;
  10963. $1021 = $1020;
  10964. $1022 = HEAP32[$1021>>2]|0;
  10965. $1023 = (_bitshift64Ashr(0,($1019|0),32)|0);
  10966. $1024 = tempRet0;
  10967. $1025 = $594;
  10968. $1026 = $1025;
  10969. $1027 = HEAP32[$1026>>2]|0;
  10970. $1028 = (($1025) + 4)|0;
  10971. $1029 = $1028;
  10972. $1030 = HEAP32[$1029>>2]|0;
  10973. $1031 = (_bitshift64Ashr(0,($1027|0),32)|0);
  10974. $1032 = tempRet0;
  10975. $1033 = (___muldi3(($1031|0),($1032|0),($1023|0),($1024|0))|0);
  10976. $1034 = tempRet0;
  10977. $1035 = (_i64Add(($1033|0),($1034|0),($1015|0),($1016|0))|0);
  10978. $1036 = tempRet0;
  10979. $1037 = (_bitshift64Shl(($1035|0),($1036|0),1)|0);
  10980. $1038 = tempRet0;
  10981. $1039 = (($output) + 120|0);
  10982. $1040 = $1039;
  10983. $1041 = $1040;
  10984. HEAP32[$1041>>2] = $1037;
  10985. $1042 = (($1040) + 4)|0;
  10986. $1043 = $1042;
  10987. HEAP32[$1043>>2] = $1038;
  10988. $1044 = $444;
  10989. $1045 = $1044;
  10990. $1046 = HEAP32[$1045>>2]|0;
  10991. $1047 = (($1044) + 4)|0;
  10992. $1048 = $1047;
  10993. $1049 = HEAP32[$1048>>2]|0;
  10994. $1050 = (_bitshift64Ashr(0,($1046|0),32)|0);
  10995. $1051 = tempRet0;
  10996. $1052 = (___muldi3(($1050|0),($1051|0),($1050|0),($1051|0))|0);
  10997. $1053 = tempRet0;
  10998. $1054 = $388;
  10999. $1055 = $1054;
  11000. $1056 = HEAP32[$1055>>2]|0;
  11001. $1057 = (($1054) + 4)|0;
  11002. $1058 = $1057;
  11003. $1059 = HEAP32[$1058>>2]|0;
  11004. $1060 = (_bitshift64Ashr(0,($1056|0),30)|0);
  11005. $1061 = tempRet0;
  11006. $1062 = $594;
  11007. $1063 = $1062;
  11008. $1064 = HEAP32[$1063>>2]|0;
  11009. $1065 = (($1062) + 4)|0;
  11010. $1066 = $1065;
  11011. $1067 = HEAP32[$1066>>2]|0;
  11012. $1068 = (_bitshift64Ashr(0,($1064|0),32)|0);
  11013. $1069 = tempRet0;
  11014. $1070 = (___muldi3(($1068|0),($1069|0),($1060|0),($1061|0))|0);
  11015. $1071 = tempRet0;
  11016. $1072 = (_i64Add(($1070|0),($1071|0),($1052|0),($1053|0))|0);
  11017. $1073 = tempRet0;
  11018. $1074 = (($output) + 128|0);
  11019. $1075 = $1074;
  11020. $1076 = $1075;
  11021. HEAP32[$1076>>2] = $1072;
  11022. $1077 = (($1075) + 4)|0;
  11023. $1078 = $1077;
  11024. HEAP32[$1078>>2] = $1073;
  11025. $1079 = $444;
  11026. $1080 = $1079;
  11027. $1081 = HEAP32[$1080>>2]|0;
  11028. $1082 = (($1079) + 4)|0;
  11029. $1083 = $1082;
  11030. $1084 = HEAP32[$1083>>2]|0;
  11031. $1085 = (_bitshift64Ashr(0,($1081|0),31)|0);
  11032. $1086 = tempRet0;
  11033. $1087 = $594;
  11034. $1088 = $1087;
  11035. $1089 = HEAP32[$1088>>2]|0;
  11036. $1090 = (($1087) + 4)|0;
  11037. $1091 = $1090;
  11038. $1092 = HEAP32[$1091>>2]|0;
  11039. $1093 = (_bitshift64Ashr(0,($1089|0),32)|0);
  11040. $1094 = tempRet0;
  11041. $1095 = (___muldi3(($1093|0),($1094|0),($1085|0),($1086|0))|0);
  11042. $1096 = tempRet0;
  11043. $1097 = (($output) + 136|0);
  11044. $1098 = $1097;
  11045. $1099 = $1098;
  11046. HEAP32[$1099>>2] = $1095;
  11047. $1100 = (($1098) + 4)|0;
  11048. $1101 = $1100;
  11049. HEAP32[$1101>>2] = $1096;
  11050. $1102 = $594;
  11051. $1103 = $1102;
  11052. $1104 = HEAP32[$1103>>2]|0;
  11053. $1105 = (($1102) + 4)|0;
  11054. $1106 = $1105;
  11055. $1107 = HEAP32[$1106>>2]|0;
  11056. $1108 = (_bitshift64Ashr(0,($1104|0),32)|0);
  11057. $1109 = tempRet0;
  11058. $1110 = (_bitshift64Ashr(0,($1104|0),31)|0);
  11059. $1111 = tempRet0;
  11060. $1112 = (___muldi3(($1110|0),($1111|0),($1108|0),($1109|0))|0);
  11061. $1113 = tempRet0;
  11062. $1114 = (($output) + 144|0);
  11063. $1115 = $1114;
  11064. $1116 = $1115;
  11065. HEAP32[$1116>>2] = $1112;
  11066. $1117 = (($1115) + 4)|0;
  11067. $1118 = $1117;
  11068. HEAP32[$1118>>2] = $1113;
  11069. STACKTOP = sp;return;
  11070. }
  11071. function _div_by_2_26($0,$1) {
  11072. $0 = $0|0;
  11073. $1 = $1|0;
  11074. var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, label = 0, sp = 0;
  11075. sp = STACKTOP;
  11076. $2 = $1 >> 31;
  11077. $3 = $2 >>> 6;
  11078. $4 = (_i64Add(($3|0),0,($0|0),($1|0))|0);
  11079. $5 = tempRet0;
  11080. $6 = (_bitshift64Ashr(($4|0),($5|0),26)|0);
  11081. $7 = tempRet0;
  11082. tempRet0 = $7;
  11083. STACKTOP = sp;return ($6|0);
  11084. }
  11085. function _div_by_2_25($0,$1) {
  11086. $0 = $0|0;
  11087. $1 = $1|0;
  11088. var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, label = 0, sp = 0;
  11089. sp = STACKTOP;
  11090. $2 = $1 >> 31;
  11091. $3 = $2 >>> 7;
  11092. $4 = (_i64Add(($3|0),0,($0|0),($1|0))|0);
  11093. $5 = tempRet0;
  11094. $6 = (_bitshift64Ashr(($4|0),($5|0),25)|0);
  11095. $7 = tempRet0;
  11096. tempRet0 = $7;
  11097. STACKTOP = sp;return ($6|0);
  11098. }
  11099. function _crypto_sign_ed25519_ref10_fe_0($h) {
  11100. $h = $h|0;
  11101. var dest = 0, label = 0, sp = 0, stop = 0;
  11102. sp = STACKTOP;
  11103. dest=$h+0|0; stop=dest+40|0; do { HEAP32[dest>>2]=0|0; dest=dest+4|0; } while ((dest|0) < (stop|0));
  11104. STACKTOP = sp;return;
  11105. }
  11106. function _crypto_sign_ed25519_ref10_fe_1($h) {
  11107. $h = $h|0;
  11108. var $0 = 0, dest = 0, label = 0, sp = 0, stop = 0;
  11109. sp = STACKTOP;
  11110. HEAP32[$h>>2] = 1;
  11111. $0 = (($h) + 4|0);
  11112. dest=$0+0|0; stop=dest+36|0; do { HEAP32[dest>>2]=0|0; dest=dest+4|0; } while ((dest|0) < (stop|0));
  11113. STACKTOP = sp;return;
  11114. }
  11115. function _crypto_sign_ed25519_ref10_fe_add($h,$f,$g) {
  11116. $h = $h|0;
  11117. $f = $f|0;
  11118. $g = $g|0;
  11119. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  11120. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0;
  11121. var $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  11122. sp = STACKTOP;
  11123. $0 = HEAP32[$f>>2]|0;
  11124. $1 = (($f) + 4|0);
  11125. $2 = HEAP32[$1>>2]|0;
  11126. $3 = (($f) + 8|0);
  11127. $4 = HEAP32[$3>>2]|0;
  11128. $5 = (($f) + 12|0);
  11129. $6 = HEAP32[$5>>2]|0;
  11130. $7 = (($f) + 16|0);
  11131. $8 = HEAP32[$7>>2]|0;
  11132. $9 = (($f) + 20|0);
  11133. $10 = HEAP32[$9>>2]|0;
  11134. $11 = (($f) + 24|0);
  11135. $12 = HEAP32[$11>>2]|0;
  11136. $13 = (($f) + 28|0);
  11137. $14 = HEAP32[$13>>2]|0;
  11138. $15 = (($f) + 32|0);
  11139. $16 = HEAP32[$15>>2]|0;
  11140. $17 = (($f) + 36|0);
  11141. $18 = HEAP32[$17>>2]|0;
  11142. $19 = HEAP32[$g>>2]|0;
  11143. $20 = (($g) + 4|0);
  11144. $21 = HEAP32[$20>>2]|0;
  11145. $22 = (($g) + 8|0);
  11146. $23 = HEAP32[$22>>2]|0;
  11147. $24 = (($g) + 12|0);
  11148. $25 = HEAP32[$24>>2]|0;
  11149. $26 = (($g) + 16|0);
  11150. $27 = HEAP32[$26>>2]|0;
  11151. $28 = (($g) + 20|0);
  11152. $29 = HEAP32[$28>>2]|0;
  11153. $30 = (($g) + 24|0);
  11154. $31 = HEAP32[$30>>2]|0;
  11155. $32 = (($g) + 28|0);
  11156. $33 = HEAP32[$32>>2]|0;
  11157. $34 = (($g) + 32|0);
  11158. $35 = HEAP32[$34>>2]|0;
  11159. $36 = (($g) + 36|0);
  11160. $37 = HEAP32[$36>>2]|0;
  11161. $38 = (($19) + ($0))|0;
  11162. $39 = (($21) + ($2))|0;
  11163. $40 = (($23) + ($4))|0;
  11164. $41 = (($25) + ($6))|0;
  11165. $42 = (($27) + ($8))|0;
  11166. $43 = (($29) + ($10))|0;
  11167. $44 = (($31) + ($12))|0;
  11168. $45 = (($33) + ($14))|0;
  11169. $46 = (($35) + ($16))|0;
  11170. $47 = (($37) + ($18))|0;
  11171. HEAP32[$h>>2] = $38;
  11172. $48 = (($h) + 4|0);
  11173. HEAP32[$48>>2] = $39;
  11174. $49 = (($h) + 8|0);
  11175. HEAP32[$49>>2] = $40;
  11176. $50 = (($h) + 12|0);
  11177. HEAP32[$50>>2] = $41;
  11178. $51 = (($h) + 16|0);
  11179. HEAP32[$51>>2] = $42;
  11180. $52 = (($h) + 20|0);
  11181. HEAP32[$52>>2] = $43;
  11182. $53 = (($h) + 24|0);
  11183. HEAP32[$53>>2] = $44;
  11184. $54 = (($h) + 28|0);
  11185. HEAP32[$54>>2] = $45;
  11186. $55 = (($h) + 32|0);
  11187. HEAP32[$55>>2] = $46;
  11188. $56 = (($h) + 36|0);
  11189. HEAP32[$56>>2] = $47;
  11190. STACKTOP = sp;return;
  11191. }
  11192. function _crypto_sign_ed25519_ref10_fe_cmov($f,$g,$b) {
  11193. $f = $f|0;
  11194. $g = $g|0;
  11195. $b = $b|0;
  11196. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  11197. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0;
  11198. var $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0;
  11199. var $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  11200. sp = STACKTOP;
  11201. $0 = HEAP32[$f>>2]|0;
  11202. $1 = (($f) + 4|0);
  11203. $2 = HEAP32[$1>>2]|0;
  11204. $3 = (($f) + 8|0);
  11205. $4 = HEAP32[$3>>2]|0;
  11206. $5 = (($f) + 12|0);
  11207. $6 = HEAP32[$5>>2]|0;
  11208. $7 = (($f) + 16|0);
  11209. $8 = HEAP32[$7>>2]|0;
  11210. $9 = (($f) + 20|0);
  11211. $10 = HEAP32[$9>>2]|0;
  11212. $11 = (($f) + 24|0);
  11213. $12 = HEAP32[$11>>2]|0;
  11214. $13 = (($f) + 28|0);
  11215. $14 = HEAP32[$13>>2]|0;
  11216. $15 = (($f) + 32|0);
  11217. $16 = HEAP32[$15>>2]|0;
  11218. $17 = (($f) + 36|0);
  11219. $18 = HEAP32[$17>>2]|0;
  11220. $19 = HEAP32[$g>>2]|0;
  11221. $20 = (($g) + 4|0);
  11222. $21 = HEAP32[$20>>2]|0;
  11223. $22 = (($g) + 8|0);
  11224. $23 = HEAP32[$22>>2]|0;
  11225. $24 = (($g) + 12|0);
  11226. $25 = HEAP32[$24>>2]|0;
  11227. $26 = (($g) + 16|0);
  11228. $27 = HEAP32[$26>>2]|0;
  11229. $28 = (($g) + 20|0);
  11230. $29 = HEAP32[$28>>2]|0;
  11231. $30 = (($g) + 24|0);
  11232. $31 = HEAP32[$30>>2]|0;
  11233. $32 = (($g) + 28|0);
  11234. $33 = HEAP32[$32>>2]|0;
  11235. $34 = (($g) + 32|0);
  11236. $35 = HEAP32[$34>>2]|0;
  11237. $36 = (($g) + 36|0);
  11238. $37 = HEAP32[$36>>2]|0;
  11239. $38 = $19 ^ $0;
  11240. $39 = $21 ^ $2;
  11241. $40 = $23 ^ $4;
  11242. $41 = $25 ^ $6;
  11243. $42 = $27 ^ $8;
  11244. $43 = $29 ^ $10;
  11245. $44 = $31 ^ $12;
  11246. $45 = $33 ^ $14;
  11247. $46 = $35 ^ $16;
  11248. $47 = $37 ^ $18;
  11249. $48 = (0 - ($b))|0;
  11250. $49 = $38 & $48;
  11251. $50 = $39 & $48;
  11252. $51 = $40 & $48;
  11253. $52 = $41 & $48;
  11254. $53 = $42 & $48;
  11255. $54 = $43 & $48;
  11256. $55 = $44 & $48;
  11257. $56 = $45 & $48;
  11258. $57 = $46 & $48;
  11259. $58 = $47 & $48;
  11260. $59 = $49 ^ $0;
  11261. HEAP32[$f>>2] = $59;
  11262. $60 = $50 ^ $2;
  11263. HEAP32[$1>>2] = $60;
  11264. $61 = $51 ^ $4;
  11265. HEAP32[$3>>2] = $61;
  11266. $62 = $52 ^ $6;
  11267. HEAP32[$5>>2] = $62;
  11268. $63 = $53 ^ $8;
  11269. HEAP32[$7>>2] = $63;
  11270. $64 = $54 ^ $10;
  11271. HEAP32[$9>>2] = $64;
  11272. $65 = $55 ^ $12;
  11273. HEAP32[$11>>2] = $65;
  11274. $66 = $56 ^ $14;
  11275. HEAP32[$13>>2] = $66;
  11276. $67 = $57 ^ $16;
  11277. HEAP32[$15>>2] = $67;
  11278. $68 = $58 ^ $18;
  11279. HEAP32[$17>>2] = $68;
  11280. STACKTOP = sp;return;
  11281. }
  11282. function _crypto_sign_ed25519_ref10_fe_copy($h,$f) {
  11283. $h = $h|0;
  11284. $f = $f|0;
  11285. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  11286. var $27 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  11287. sp = STACKTOP;
  11288. $0 = HEAP32[$f>>2]|0;
  11289. $1 = (($f) + 4|0);
  11290. $2 = HEAP32[$1>>2]|0;
  11291. $3 = (($f) + 8|0);
  11292. $4 = HEAP32[$3>>2]|0;
  11293. $5 = (($f) + 12|0);
  11294. $6 = HEAP32[$5>>2]|0;
  11295. $7 = (($f) + 16|0);
  11296. $8 = HEAP32[$7>>2]|0;
  11297. $9 = (($f) + 20|0);
  11298. $10 = HEAP32[$9>>2]|0;
  11299. $11 = (($f) + 24|0);
  11300. $12 = HEAP32[$11>>2]|0;
  11301. $13 = (($f) + 28|0);
  11302. $14 = HEAP32[$13>>2]|0;
  11303. $15 = (($f) + 32|0);
  11304. $16 = HEAP32[$15>>2]|0;
  11305. $17 = (($f) + 36|0);
  11306. $18 = HEAP32[$17>>2]|0;
  11307. HEAP32[$h>>2] = $0;
  11308. $19 = (($h) + 4|0);
  11309. HEAP32[$19>>2] = $2;
  11310. $20 = (($h) + 8|0);
  11311. HEAP32[$20>>2] = $4;
  11312. $21 = (($h) + 12|0);
  11313. HEAP32[$21>>2] = $6;
  11314. $22 = (($h) + 16|0);
  11315. HEAP32[$22>>2] = $8;
  11316. $23 = (($h) + 20|0);
  11317. HEAP32[$23>>2] = $10;
  11318. $24 = (($h) + 24|0);
  11319. HEAP32[$24>>2] = $12;
  11320. $25 = (($h) + 28|0);
  11321. HEAP32[$25>>2] = $14;
  11322. $26 = (($h) + 32|0);
  11323. HEAP32[$26>>2] = $16;
  11324. $27 = (($h) + 36|0);
  11325. HEAP32[$27>>2] = $18;
  11326. STACKTOP = sp;return;
  11327. }
  11328. function _crypto_sign_ed25519_ref10_fe_frombytes($h,$s) {
  11329. $h = $h|0;
  11330. $s = $s|0;
  11331. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  11332. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  11333. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  11334. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0;
  11335. var $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0;
  11336. var $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0;
  11337. var $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0;
  11338. var $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  11339. sp = STACKTOP;
  11340. $0 = (_load_4($s)|0);
  11341. $1 = tempRet0;
  11342. $2 = (($s) + 4|0);
  11343. $3 = (_load_3($2)|0);
  11344. $4 = tempRet0;
  11345. $5 = (_bitshift64Shl(($3|0),($4|0),6)|0);
  11346. $6 = tempRet0;
  11347. $7 = (($s) + 7|0);
  11348. $8 = (_load_3($7)|0);
  11349. $9 = tempRet0;
  11350. $10 = (_bitshift64Shl(($8|0),($9|0),5)|0);
  11351. $11 = tempRet0;
  11352. $12 = (($s) + 10|0);
  11353. $13 = (_load_3($12)|0);
  11354. $14 = tempRet0;
  11355. $15 = (_bitshift64Shl(($13|0),($14|0),3)|0);
  11356. $16 = tempRet0;
  11357. $17 = (($s) + 13|0);
  11358. $18 = (_load_3($17)|0);
  11359. $19 = tempRet0;
  11360. $20 = (_bitshift64Shl(($18|0),($19|0),2)|0);
  11361. $21 = tempRet0;
  11362. $22 = (($s) + 16|0);
  11363. $23 = (_load_4($22)|0);
  11364. $24 = tempRet0;
  11365. $25 = (($s) + 20|0);
  11366. $26 = (_load_3($25)|0);
  11367. $27 = tempRet0;
  11368. $28 = (_bitshift64Shl(($26|0),($27|0),7)|0);
  11369. $29 = tempRet0;
  11370. $30 = (($s) + 23|0);
  11371. $31 = (_load_3($30)|0);
  11372. $32 = tempRet0;
  11373. $33 = (_bitshift64Shl(($31|0),($32|0),5)|0);
  11374. $34 = tempRet0;
  11375. $35 = (($s) + 26|0);
  11376. $36 = (_load_3($35)|0);
  11377. $37 = tempRet0;
  11378. $38 = (_bitshift64Shl(($36|0),($37|0),4)|0);
  11379. $39 = tempRet0;
  11380. $40 = (($s) + 29|0);
  11381. $41 = (_load_3($40)|0);
  11382. $42 = tempRet0;
  11383. $43 = (_bitshift64Shl(($41|0),($42|0),2)|0);
  11384. $44 = tempRet0;
  11385. $45 = $43 & 33554428;
  11386. $46 = (_i64Add(($45|0),0,16777216,0)|0);
  11387. $47 = tempRet0;
  11388. $48 = (_bitshift64Lshr(($46|0),($47|0),25)|0);
  11389. $49 = tempRet0;
  11390. $50 = (___muldi3(($48|0),($49|0),19,0)|0);
  11391. $51 = tempRet0;
  11392. $52 = (_i64Add(($50|0),($51|0),($0|0),($1|0))|0);
  11393. $53 = tempRet0;
  11394. $54 = (_bitshift64Shl(($48|0),($49|0),25)|0);
  11395. $55 = tempRet0;
  11396. $56 = (_i64Add(($5|0),($6|0),16777216,0)|0);
  11397. $57 = tempRet0;
  11398. $58 = (_bitshift64Ashr(($56|0),($57|0),25)|0);
  11399. $59 = tempRet0;
  11400. $60 = (_i64Add(($58|0),($59|0),($10|0),($11|0))|0);
  11401. $61 = tempRet0;
  11402. $62 = (_bitshift64Shl(($58|0),($59|0),25)|0);
  11403. $63 = tempRet0;
  11404. $64 = (_i64Subtract(($5|0),($6|0),($62|0),($63|0))|0);
  11405. $65 = tempRet0;
  11406. $66 = (_i64Add(($15|0),($16|0),16777216,0)|0);
  11407. $67 = tempRet0;
  11408. $68 = (_bitshift64Ashr(($66|0),($67|0),25)|0);
  11409. $69 = tempRet0;
  11410. $70 = (_i64Add(($68|0),($69|0),($20|0),($21|0))|0);
  11411. $71 = tempRet0;
  11412. $72 = (_bitshift64Shl(($68|0),($69|0),25)|0);
  11413. $73 = tempRet0;
  11414. $74 = (_i64Subtract(($15|0),($16|0),($72|0),($73|0))|0);
  11415. $75 = tempRet0;
  11416. $76 = (_i64Add(($23|0),($24|0),16777216,0)|0);
  11417. $77 = tempRet0;
  11418. $78 = (_bitshift64Ashr(($76|0),($77|0),25)|0);
  11419. $79 = tempRet0;
  11420. $80 = (_i64Add(($28|0),($29|0),($78|0),($79|0))|0);
  11421. $81 = tempRet0;
  11422. $82 = (_bitshift64Shl(($78|0),($79|0),25)|0);
  11423. $83 = tempRet0;
  11424. $84 = (_i64Subtract(($23|0),($24|0),($82|0),($83|0))|0);
  11425. $85 = tempRet0;
  11426. $86 = (_i64Add(($33|0),($34|0),16777216,0)|0);
  11427. $87 = tempRet0;
  11428. $88 = (_bitshift64Ashr(($86|0),($87|0),25)|0);
  11429. $89 = tempRet0;
  11430. $90 = (_i64Add(($88|0),($89|0),($38|0),($39|0))|0);
  11431. $91 = tempRet0;
  11432. $92 = (_bitshift64Shl(($88|0),($89|0),25)|0);
  11433. $93 = tempRet0;
  11434. $94 = (_i64Add(($52|0),($53|0),33554432,0)|0);
  11435. $95 = tempRet0;
  11436. $96 = (_bitshift64Ashr(($94|0),($95|0),26)|0);
  11437. $97 = tempRet0;
  11438. $98 = (_i64Add(($64|0),($65|0),($96|0),($97|0))|0);
  11439. $99 = tempRet0;
  11440. $100 = (_bitshift64Shl(($96|0),($97|0),26)|0);
  11441. $101 = tempRet0;
  11442. $102 = (_i64Subtract(($52|0),($53|0),($100|0),($101|0))|0);
  11443. $103 = tempRet0;
  11444. $104 = (_i64Add(($60|0),($61|0),33554432,0)|0);
  11445. $105 = tempRet0;
  11446. $106 = (_bitshift64Ashr(($104|0),($105|0),26)|0);
  11447. $107 = tempRet0;
  11448. $108 = (_i64Add(($74|0),($75|0),($106|0),($107|0))|0);
  11449. $109 = tempRet0;
  11450. $110 = (_bitshift64Shl(($106|0),($107|0),26)|0);
  11451. $111 = tempRet0;
  11452. $112 = (_i64Subtract(($60|0),($61|0),($110|0),($111|0))|0);
  11453. $113 = tempRet0;
  11454. $114 = (_i64Add(($70|0),($71|0),33554432,0)|0);
  11455. $115 = tempRet0;
  11456. $116 = (_bitshift64Ashr(($114|0),($115|0),26)|0);
  11457. $117 = tempRet0;
  11458. $118 = (_i64Add(($84|0),($85|0),($116|0),($117|0))|0);
  11459. $119 = tempRet0;
  11460. $120 = (_bitshift64Shl(($116|0),($117|0),26)|0);
  11461. $121 = tempRet0;
  11462. $122 = (_i64Subtract(($70|0),($71|0),($120|0),($121|0))|0);
  11463. $123 = tempRet0;
  11464. $124 = (_i64Add(($80|0),($81|0),33554432,0)|0);
  11465. $125 = tempRet0;
  11466. $126 = (_bitshift64Ashr(($124|0),($125|0),26)|0);
  11467. $127 = tempRet0;
  11468. $128 = (_i64Add(($126|0),($127|0),($33|0),($34|0))|0);
  11469. $129 = tempRet0;
  11470. $130 = (_i64Subtract(($128|0),($129|0),($92|0),($93|0))|0);
  11471. $131 = tempRet0;
  11472. $132 = (_bitshift64Shl(($126|0),($127|0),26)|0);
  11473. $133 = tempRet0;
  11474. $134 = (_i64Subtract(($80|0),($81|0),($132|0),($133|0))|0);
  11475. $135 = tempRet0;
  11476. $136 = (_i64Add(($90|0),($91|0),33554432,0)|0);
  11477. $137 = tempRet0;
  11478. $138 = (_bitshift64Ashr(($136|0),($137|0),26)|0);
  11479. $139 = tempRet0;
  11480. $140 = (_i64Add(($138|0),($139|0),($45|0),0)|0);
  11481. $141 = tempRet0;
  11482. $142 = (_i64Subtract(($140|0),($141|0),($54|0),($55|0))|0);
  11483. $143 = tempRet0;
  11484. $144 = (_bitshift64Shl(($138|0),($139|0),26)|0);
  11485. $145 = tempRet0;
  11486. $146 = (_i64Subtract(($90|0),($91|0),($144|0),($145|0))|0);
  11487. $147 = tempRet0;
  11488. HEAP32[$h>>2] = $102;
  11489. $148 = (($h) + 4|0);
  11490. HEAP32[$148>>2] = $98;
  11491. $149 = (($h) + 8|0);
  11492. HEAP32[$149>>2] = $112;
  11493. $150 = (($h) + 12|0);
  11494. HEAP32[$150>>2] = $108;
  11495. $151 = (($h) + 16|0);
  11496. HEAP32[$151>>2] = $122;
  11497. $152 = (($h) + 20|0);
  11498. HEAP32[$152>>2] = $118;
  11499. $153 = (($h) + 24|0);
  11500. HEAP32[$153>>2] = $134;
  11501. $154 = (($h) + 28|0);
  11502. HEAP32[$154>>2] = $130;
  11503. $155 = (($h) + 32|0);
  11504. HEAP32[$155>>2] = $146;
  11505. $156 = (($h) + 36|0);
  11506. HEAP32[$156>>2] = $142;
  11507. STACKTOP = sp;return;
  11508. }
  11509. function _load_4($in) {
  11510. $in = $in|0;
  11511. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
  11512. var $8 = 0, $9 = 0, label = 0, sp = 0;
  11513. sp = STACKTOP;
  11514. $0 = HEAP8[$in>>0]|0;
  11515. $1 = $0&255;
  11516. $2 = (($in) + 1|0);
  11517. $3 = HEAP8[$2>>0]|0;
  11518. $4 = $3&255;
  11519. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  11520. $6 = tempRet0;
  11521. $7 = $5 | $1;
  11522. $8 = (($in) + 2|0);
  11523. $9 = HEAP8[$8>>0]|0;
  11524. $10 = $9&255;
  11525. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  11526. $12 = tempRet0;
  11527. $13 = $7 | $11;
  11528. $14 = $6 | $12;
  11529. $15 = (($in) + 3|0);
  11530. $16 = HEAP8[$15>>0]|0;
  11531. $17 = $16&255;
  11532. $18 = (_bitshift64Shl(($17|0),0,24)|0);
  11533. $19 = tempRet0;
  11534. $20 = $13 | $18;
  11535. $21 = $14 | $19;
  11536. tempRet0 = $21;
  11537. STACKTOP = sp;return ($20|0);
  11538. }
  11539. function _load_3($in) {
  11540. $in = $in|0;
  11541. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  11542. sp = STACKTOP;
  11543. $0 = HEAP8[$in>>0]|0;
  11544. $1 = $0&255;
  11545. $2 = (($in) + 1|0);
  11546. $3 = HEAP8[$2>>0]|0;
  11547. $4 = $3&255;
  11548. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  11549. $6 = tempRet0;
  11550. $7 = $5 | $1;
  11551. $8 = (($in) + 2|0);
  11552. $9 = HEAP8[$8>>0]|0;
  11553. $10 = $9&255;
  11554. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  11555. $12 = tempRet0;
  11556. $13 = $7 | $11;
  11557. $14 = $6 | $12;
  11558. tempRet0 = $14;
  11559. STACKTOP = sp;return ($13|0);
  11560. }
  11561. function _crypto_sign_ed25519_ref10_fe_invert($out,$z) {
  11562. $out = $out|0;
  11563. $z = $z|0;
  11564. var $0 = 0, $1 = 0, $2 = 0, $exitcond = 0, $exitcond10 = 0, $exitcond11 = 0, $i$74 = 0, $i$83 = 0, $i$92 = 0, $t0 = 0, $t1 = 0, $t2 = 0, $t3 = 0, label = 0, sp = 0;
  11565. sp = STACKTOP;
  11566. STACKTOP = STACKTOP + 160|0;
  11567. $t0 = sp + 120|0;
  11568. $t1 = sp + 80|0;
  11569. $t2 = sp + 40|0;
  11570. $t3 = sp;
  11571. _crypto_sign_ed25519_ref10_fe_sq($t0,$z);
  11572. _crypto_sign_ed25519_ref10_fe_sq($t1,$t0);
  11573. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11574. _crypto_sign_ed25519_ref10_fe_mul($t1,$z,$t1);
  11575. _crypto_sign_ed25519_ref10_fe_mul($t0,$t0,$t1);
  11576. _crypto_sign_ed25519_ref10_fe_sq($t2,$t0);
  11577. _crypto_sign_ed25519_ref10_fe_mul($t1,$t1,$t2);
  11578. _crypto_sign_ed25519_ref10_fe_sq($t2,$t1);
  11579. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11580. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11581. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11582. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11583. _crypto_sign_ed25519_ref10_fe_mul($t1,$t2,$t1);
  11584. _crypto_sign_ed25519_ref10_fe_sq($t2,$t1);
  11585. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11586. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11587. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11588. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11589. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11590. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11591. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11592. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11593. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11594. _crypto_sign_ed25519_ref10_fe_mul($t2,$t2,$t1);
  11595. _crypto_sign_ed25519_ref10_fe_sq($t3,$t2);
  11596. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11597. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11598. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11599. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11600. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11601. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11602. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11603. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11604. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11605. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11606. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11607. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11608. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11609. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11610. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11611. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11612. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11613. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11614. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11615. _crypto_sign_ed25519_ref10_fe_mul($t2,$t3,$t2);
  11616. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11617. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11618. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11619. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11620. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11621. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11622. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11623. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11624. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11625. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11626. _crypto_sign_ed25519_ref10_fe_mul($t1,$t2,$t1);
  11627. _crypto_sign_ed25519_ref10_fe_sq($t2,$t1);
  11628. $i$74 = 1;
  11629. while(1) {
  11630. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11631. $0 = (($i$74) + 1)|0;
  11632. $exitcond11 = ($0|0)==(50);
  11633. if ($exitcond11) {
  11634. break;
  11635. } else {
  11636. $i$74 = $0;
  11637. }
  11638. }
  11639. _crypto_sign_ed25519_ref10_fe_mul($t2,$t2,$t1);
  11640. _crypto_sign_ed25519_ref10_fe_sq($t3,$t2);
  11641. $i$83 = 1;
  11642. while(1) {
  11643. _crypto_sign_ed25519_ref10_fe_sq($t3,$t3);
  11644. $1 = (($i$83) + 1)|0;
  11645. $exitcond10 = ($1|0)==(100);
  11646. if ($exitcond10) {
  11647. break;
  11648. } else {
  11649. $i$83 = $1;
  11650. }
  11651. }
  11652. _crypto_sign_ed25519_ref10_fe_mul($t2,$t3,$t2);
  11653. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11654. $i$92 = 1;
  11655. while(1) {
  11656. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  11657. $2 = (($i$92) + 1)|0;
  11658. $exitcond = ($2|0)==(50);
  11659. if ($exitcond) {
  11660. break;
  11661. } else {
  11662. $i$92 = $2;
  11663. }
  11664. }
  11665. _crypto_sign_ed25519_ref10_fe_mul($t1,$t2,$t1);
  11666. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11667. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11668. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11669. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11670. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  11671. _crypto_sign_ed25519_ref10_fe_mul($out,$t1,$t0);
  11672. STACKTOP = sp;return;
  11673. }
  11674. function _crypto_sign_ed25519_ref10_fe_isnegative($f) {
  11675. $f = $f|0;
  11676. var $0 = 0, $1 = 0, $2 = 0, $s = 0, label = 0, sp = 0;
  11677. sp = STACKTOP;
  11678. STACKTOP = STACKTOP + 32|0;
  11679. $s = sp;
  11680. _crypto_sign_ed25519_ref10_fe_tobytes($s,$f);
  11681. $0 = HEAP8[$s>>0]|0;
  11682. $1 = $0&255;
  11683. $2 = $1 & 1;
  11684. STACKTOP = sp;return ($2|0);
  11685. }
  11686. function _crypto_sign_ed25519_ref10_fe_isnonzero($f) {
  11687. $f = $f|0;
  11688. var $0 = 0, $s = 0, label = 0, sp = 0;
  11689. sp = STACKTOP;
  11690. STACKTOP = STACKTOP + 32|0;
  11691. $s = sp;
  11692. _crypto_sign_ed25519_ref10_fe_tobytes($s,$f);
  11693. $0 = (_crypto_verify_32_ref($s,8)|0);
  11694. STACKTOP = sp;return ($0|0);
  11695. }
  11696. function _crypto_sign_ed25519_ref10_fe_mul($h,$f,$g) {
  11697. $h = $h|0;
  11698. $f = $f|0;
  11699. $g = $g|0;
  11700. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  11701. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  11702. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  11703. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  11704. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  11705. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  11706. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  11707. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  11708. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  11709. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  11710. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  11711. var $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0;
  11712. var $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0;
  11713. var $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0;
  11714. var $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0;
  11715. var $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0;
  11716. var $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0;
  11717. var $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0;
  11718. var $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0;
  11719. var $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0;
  11720. var $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0;
  11721. var $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0;
  11722. var $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0;
  11723. var $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0;
  11724. var $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0;
  11725. var $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0;
  11726. var $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0;
  11727. var $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0;
  11728. var $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0;
  11729. var $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0;
  11730. var $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0;
  11731. var $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  11732. sp = STACKTOP;
  11733. $0 = HEAP32[$f>>2]|0;
  11734. $1 = (($f) + 4|0);
  11735. $2 = HEAP32[$1>>2]|0;
  11736. $3 = (($f) + 8|0);
  11737. $4 = HEAP32[$3>>2]|0;
  11738. $5 = (($f) + 12|0);
  11739. $6 = HEAP32[$5>>2]|0;
  11740. $7 = (($f) + 16|0);
  11741. $8 = HEAP32[$7>>2]|0;
  11742. $9 = (($f) + 20|0);
  11743. $10 = HEAP32[$9>>2]|0;
  11744. $11 = (($f) + 24|0);
  11745. $12 = HEAP32[$11>>2]|0;
  11746. $13 = (($f) + 28|0);
  11747. $14 = HEAP32[$13>>2]|0;
  11748. $15 = (($f) + 32|0);
  11749. $16 = HEAP32[$15>>2]|0;
  11750. $17 = (($f) + 36|0);
  11751. $18 = HEAP32[$17>>2]|0;
  11752. $19 = HEAP32[$g>>2]|0;
  11753. $20 = (($g) + 4|0);
  11754. $21 = HEAP32[$20>>2]|0;
  11755. $22 = (($g) + 8|0);
  11756. $23 = HEAP32[$22>>2]|0;
  11757. $24 = (($g) + 12|0);
  11758. $25 = HEAP32[$24>>2]|0;
  11759. $26 = (($g) + 16|0);
  11760. $27 = HEAP32[$26>>2]|0;
  11761. $28 = (($g) + 20|0);
  11762. $29 = HEAP32[$28>>2]|0;
  11763. $30 = (($g) + 24|0);
  11764. $31 = HEAP32[$30>>2]|0;
  11765. $32 = (($g) + 28|0);
  11766. $33 = HEAP32[$32>>2]|0;
  11767. $34 = (($g) + 32|0);
  11768. $35 = HEAP32[$34>>2]|0;
  11769. $36 = (($g) + 36|0);
  11770. $37 = HEAP32[$36>>2]|0;
  11771. $38 = ($21*19)|0;
  11772. $39 = ($23*19)|0;
  11773. $40 = ($25*19)|0;
  11774. $41 = ($27*19)|0;
  11775. $42 = ($29*19)|0;
  11776. $43 = ($31*19)|0;
  11777. $44 = ($33*19)|0;
  11778. $45 = ($35*19)|0;
  11779. $46 = ($37*19)|0;
  11780. $47 = $2 << 1;
  11781. $48 = $6 << 1;
  11782. $49 = $10 << 1;
  11783. $50 = $14 << 1;
  11784. $51 = $18 << 1;
  11785. $52 = ($0|0)<(0);
  11786. $53 = $52 << 31 >> 31;
  11787. $54 = ($19|0)<(0);
  11788. $55 = $54 << 31 >> 31;
  11789. $56 = (___muldi3(($19|0),($55|0),($0|0),($53|0))|0);
  11790. $57 = tempRet0;
  11791. $58 = ($21|0)<(0);
  11792. $59 = $58 << 31 >> 31;
  11793. $60 = (___muldi3(($21|0),($59|0),($0|0),($53|0))|0);
  11794. $61 = tempRet0;
  11795. $62 = ($23|0)<(0);
  11796. $63 = $62 << 31 >> 31;
  11797. $64 = (___muldi3(($23|0),($63|0),($0|0),($53|0))|0);
  11798. $65 = tempRet0;
  11799. $66 = ($25|0)<(0);
  11800. $67 = $66 << 31 >> 31;
  11801. $68 = (___muldi3(($25|0),($67|0),($0|0),($53|0))|0);
  11802. $69 = tempRet0;
  11803. $70 = ($27|0)<(0);
  11804. $71 = $70 << 31 >> 31;
  11805. $72 = (___muldi3(($27|0),($71|0),($0|0),($53|0))|0);
  11806. $73 = tempRet0;
  11807. $74 = ($29|0)<(0);
  11808. $75 = $74 << 31 >> 31;
  11809. $76 = (___muldi3(($29|0),($75|0),($0|0),($53|0))|0);
  11810. $77 = tempRet0;
  11811. $78 = ($31|0)<(0);
  11812. $79 = $78 << 31 >> 31;
  11813. $80 = (___muldi3(($31|0),($79|0),($0|0),($53|0))|0);
  11814. $81 = tempRet0;
  11815. $82 = ($33|0)<(0);
  11816. $83 = $82 << 31 >> 31;
  11817. $84 = (___muldi3(($33|0),($83|0),($0|0),($53|0))|0);
  11818. $85 = tempRet0;
  11819. $86 = ($35|0)<(0);
  11820. $87 = $86 << 31 >> 31;
  11821. $88 = (___muldi3(($35|0),($87|0),($0|0),($53|0))|0);
  11822. $89 = tempRet0;
  11823. $90 = ($37|0)<(0);
  11824. $91 = $90 << 31 >> 31;
  11825. $92 = (___muldi3(($37|0),($91|0),($0|0),($53|0))|0);
  11826. $93 = tempRet0;
  11827. $94 = ($2|0)<(0);
  11828. $95 = $94 << 31 >> 31;
  11829. $96 = (___muldi3(($19|0),($55|0),($2|0),($95|0))|0);
  11830. $97 = tempRet0;
  11831. $98 = ($47|0)<(0);
  11832. $99 = $98 << 31 >> 31;
  11833. $100 = (___muldi3(($21|0),($59|0),($47|0),($99|0))|0);
  11834. $101 = tempRet0;
  11835. $102 = (___muldi3(($23|0),($63|0),($2|0),($95|0))|0);
  11836. $103 = tempRet0;
  11837. $104 = (___muldi3(($25|0),($67|0),($47|0),($99|0))|0);
  11838. $105 = tempRet0;
  11839. $106 = (___muldi3(($27|0),($71|0),($2|0),($95|0))|0);
  11840. $107 = tempRet0;
  11841. $108 = (___muldi3(($29|0),($75|0),($47|0),($99|0))|0);
  11842. $109 = tempRet0;
  11843. $110 = (___muldi3(($31|0),($79|0),($2|0),($95|0))|0);
  11844. $111 = tempRet0;
  11845. $112 = (___muldi3(($33|0),($83|0),($47|0),($99|0))|0);
  11846. $113 = tempRet0;
  11847. $114 = (___muldi3(($35|0),($87|0),($2|0),($95|0))|0);
  11848. $115 = tempRet0;
  11849. $116 = ($46|0)<(0);
  11850. $117 = $116 << 31 >> 31;
  11851. $118 = (___muldi3(($46|0),($117|0),($47|0),($99|0))|0);
  11852. $119 = tempRet0;
  11853. $120 = ($4|0)<(0);
  11854. $121 = $120 << 31 >> 31;
  11855. $122 = (___muldi3(($19|0),($55|0),($4|0),($121|0))|0);
  11856. $123 = tempRet0;
  11857. $124 = (___muldi3(($21|0),($59|0),($4|0),($121|0))|0);
  11858. $125 = tempRet0;
  11859. $126 = (___muldi3(($23|0),($63|0),($4|0),($121|0))|0);
  11860. $127 = tempRet0;
  11861. $128 = (___muldi3(($25|0),($67|0),($4|0),($121|0))|0);
  11862. $129 = tempRet0;
  11863. $130 = (___muldi3(($27|0),($71|0),($4|0),($121|0))|0);
  11864. $131 = tempRet0;
  11865. $132 = (___muldi3(($29|0),($75|0),($4|0),($121|0))|0);
  11866. $133 = tempRet0;
  11867. $134 = (___muldi3(($31|0),($79|0),($4|0),($121|0))|0);
  11868. $135 = tempRet0;
  11869. $136 = (___muldi3(($33|0),($83|0),($4|0),($121|0))|0);
  11870. $137 = tempRet0;
  11871. $138 = ($45|0)<(0);
  11872. $139 = $138 << 31 >> 31;
  11873. $140 = (___muldi3(($45|0),($139|0),($4|0),($121|0))|0);
  11874. $141 = tempRet0;
  11875. $142 = (___muldi3(($46|0),($117|0),($4|0),($121|0))|0);
  11876. $143 = tempRet0;
  11877. $144 = ($6|0)<(0);
  11878. $145 = $144 << 31 >> 31;
  11879. $146 = (___muldi3(($19|0),($55|0),($6|0),($145|0))|0);
  11880. $147 = tempRet0;
  11881. $148 = ($48|0)<(0);
  11882. $149 = $148 << 31 >> 31;
  11883. $150 = (___muldi3(($21|0),($59|0),($48|0),($149|0))|0);
  11884. $151 = tempRet0;
  11885. $152 = (___muldi3(($23|0),($63|0),($6|0),($145|0))|0);
  11886. $153 = tempRet0;
  11887. $154 = (___muldi3(($25|0),($67|0),($48|0),($149|0))|0);
  11888. $155 = tempRet0;
  11889. $156 = (___muldi3(($27|0),($71|0),($6|0),($145|0))|0);
  11890. $157 = tempRet0;
  11891. $158 = (___muldi3(($29|0),($75|0),($48|0),($149|0))|0);
  11892. $159 = tempRet0;
  11893. $160 = (___muldi3(($31|0),($79|0),($6|0),($145|0))|0);
  11894. $161 = tempRet0;
  11895. $162 = ($44|0)<(0);
  11896. $163 = $162 << 31 >> 31;
  11897. $164 = (___muldi3(($44|0),($163|0),($48|0),($149|0))|0);
  11898. $165 = tempRet0;
  11899. $166 = (___muldi3(($45|0),($139|0),($6|0),($145|0))|0);
  11900. $167 = tempRet0;
  11901. $168 = (___muldi3(($46|0),($117|0),($48|0),($149|0))|0);
  11902. $169 = tempRet0;
  11903. $170 = ($8|0)<(0);
  11904. $171 = $170 << 31 >> 31;
  11905. $172 = (___muldi3(($19|0),($55|0),($8|0),($171|0))|0);
  11906. $173 = tempRet0;
  11907. $174 = (___muldi3(($21|0),($59|0),($8|0),($171|0))|0);
  11908. $175 = tempRet0;
  11909. $176 = (___muldi3(($23|0),($63|0),($8|0),($171|0))|0);
  11910. $177 = tempRet0;
  11911. $178 = (___muldi3(($25|0),($67|0),($8|0),($171|0))|0);
  11912. $179 = tempRet0;
  11913. $180 = (___muldi3(($27|0),($71|0),($8|0),($171|0))|0);
  11914. $181 = tempRet0;
  11915. $182 = (___muldi3(($29|0),($75|0),($8|0),($171|0))|0);
  11916. $183 = tempRet0;
  11917. $184 = ($43|0)<(0);
  11918. $185 = $184 << 31 >> 31;
  11919. $186 = (___muldi3(($43|0),($185|0),($8|0),($171|0))|0);
  11920. $187 = tempRet0;
  11921. $188 = (___muldi3(($44|0),($163|0),($8|0),($171|0))|0);
  11922. $189 = tempRet0;
  11923. $190 = (___muldi3(($45|0),($139|0),($8|0),($171|0))|0);
  11924. $191 = tempRet0;
  11925. $192 = (___muldi3(($46|0),($117|0),($8|0),($171|0))|0);
  11926. $193 = tempRet0;
  11927. $194 = ($10|0)<(0);
  11928. $195 = $194 << 31 >> 31;
  11929. $196 = (___muldi3(($19|0),($55|0),($10|0),($195|0))|0);
  11930. $197 = tempRet0;
  11931. $198 = ($49|0)<(0);
  11932. $199 = $198 << 31 >> 31;
  11933. $200 = (___muldi3(($21|0),($59|0),($49|0),($199|0))|0);
  11934. $201 = tempRet0;
  11935. $202 = (___muldi3(($23|0),($63|0),($10|0),($195|0))|0);
  11936. $203 = tempRet0;
  11937. $204 = (___muldi3(($25|0),($67|0),($49|0),($199|0))|0);
  11938. $205 = tempRet0;
  11939. $206 = (___muldi3(($27|0),($71|0),($10|0),($195|0))|0);
  11940. $207 = tempRet0;
  11941. $208 = ($42|0)<(0);
  11942. $209 = $208 << 31 >> 31;
  11943. $210 = (___muldi3(($42|0),($209|0),($49|0),($199|0))|0);
  11944. $211 = tempRet0;
  11945. $212 = (___muldi3(($43|0),($185|0),($10|0),($195|0))|0);
  11946. $213 = tempRet0;
  11947. $214 = (___muldi3(($44|0),($163|0),($49|0),($199|0))|0);
  11948. $215 = tempRet0;
  11949. $216 = (___muldi3(($45|0),($139|0),($10|0),($195|0))|0);
  11950. $217 = tempRet0;
  11951. $218 = (___muldi3(($46|0),($117|0),($49|0),($199|0))|0);
  11952. $219 = tempRet0;
  11953. $220 = ($12|0)<(0);
  11954. $221 = $220 << 31 >> 31;
  11955. $222 = (___muldi3(($19|0),($55|0),($12|0),($221|0))|0);
  11956. $223 = tempRet0;
  11957. $224 = (___muldi3(($21|0),($59|0),($12|0),($221|0))|0);
  11958. $225 = tempRet0;
  11959. $226 = (___muldi3(($23|0),($63|0),($12|0),($221|0))|0);
  11960. $227 = tempRet0;
  11961. $228 = (___muldi3(($25|0),($67|0),($12|0),($221|0))|0);
  11962. $229 = tempRet0;
  11963. $230 = ($41|0)<(0);
  11964. $231 = $230 << 31 >> 31;
  11965. $232 = (___muldi3(($41|0),($231|0),($12|0),($221|0))|0);
  11966. $233 = tempRet0;
  11967. $234 = (___muldi3(($42|0),($209|0),($12|0),($221|0))|0);
  11968. $235 = tempRet0;
  11969. $236 = (___muldi3(($43|0),($185|0),($12|0),($221|0))|0);
  11970. $237 = tempRet0;
  11971. $238 = (___muldi3(($44|0),($163|0),($12|0),($221|0))|0);
  11972. $239 = tempRet0;
  11973. $240 = (___muldi3(($45|0),($139|0),($12|0),($221|0))|0);
  11974. $241 = tempRet0;
  11975. $242 = (___muldi3(($46|0),($117|0),($12|0),($221|0))|0);
  11976. $243 = tempRet0;
  11977. $244 = ($14|0)<(0);
  11978. $245 = $244 << 31 >> 31;
  11979. $246 = (___muldi3(($19|0),($55|0),($14|0),($245|0))|0);
  11980. $247 = tempRet0;
  11981. $248 = ($50|0)<(0);
  11982. $249 = $248 << 31 >> 31;
  11983. $250 = (___muldi3(($21|0),($59|0),($50|0),($249|0))|0);
  11984. $251 = tempRet0;
  11985. $252 = (___muldi3(($23|0),($63|0),($14|0),($245|0))|0);
  11986. $253 = tempRet0;
  11987. $254 = ($40|0)<(0);
  11988. $255 = $254 << 31 >> 31;
  11989. $256 = (___muldi3(($40|0),($255|0),($50|0),($249|0))|0);
  11990. $257 = tempRet0;
  11991. $258 = (___muldi3(($41|0),($231|0),($14|0),($245|0))|0);
  11992. $259 = tempRet0;
  11993. $260 = (___muldi3(($42|0),($209|0),($50|0),($249|0))|0);
  11994. $261 = tempRet0;
  11995. $262 = (___muldi3(($43|0),($185|0),($14|0),($245|0))|0);
  11996. $263 = tempRet0;
  11997. $264 = (___muldi3(($44|0),($163|0),($50|0),($249|0))|0);
  11998. $265 = tempRet0;
  11999. $266 = (___muldi3(($45|0),($139|0),($14|0),($245|0))|0);
  12000. $267 = tempRet0;
  12001. $268 = (___muldi3(($46|0),($117|0),($50|0),($249|0))|0);
  12002. $269 = tempRet0;
  12003. $270 = ($16|0)<(0);
  12004. $271 = $270 << 31 >> 31;
  12005. $272 = (___muldi3(($19|0),($55|0),($16|0),($271|0))|0);
  12006. $273 = tempRet0;
  12007. $274 = (___muldi3(($21|0),($59|0),($16|0),($271|0))|0);
  12008. $275 = tempRet0;
  12009. $276 = ($39|0)<(0);
  12010. $277 = $276 << 31 >> 31;
  12011. $278 = (___muldi3(($39|0),($277|0),($16|0),($271|0))|0);
  12012. $279 = tempRet0;
  12013. $280 = (___muldi3(($40|0),($255|0),($16|0),($271|0))|0);
  12014. $281 = tempRet0;
  12015. $282 = (___muldi3(($41|0),($231|0),($16|0),($271|0))|0);
  12016. $283 = tempRet0;
  12017. $284 = (___muldi3(($42|0),($209|0),($16|0),($271|0))|0);
  12018. $285 = tempRet0;
  12019. $286 = (___muldi3(($43|0),($185|0),($16|0),($271|0))|0);
  12020. $287 = tempRet0;
  12021. $288 = (___muldi3(($44|0),($163|0),($16|0),($271|0))|0);
  12022. $289 = tempRet0;
  12023. $290 = (___muldi3(($45|0),($139|0),($16|0),($271|0))|0);
  12024. $291 = tempRet0;
  12025. $292 = (___muldi3(($46|0),($117|0),($16|0),($271|0))|0);
  12026. $293 = tempRet0;
  12027. $294 = ($18|0)<(0);
  12028. $295 = $294 << 31 >> 31;
  12029. $296 = (___muldi3(($19|0),($55|0),($18|0),($295|0))|0);
  12030. $297 = tempRet0;
  12031. $298 = ($51|0)<(0);
  12032. $299 = $298 << 31 >> 31;
  12033. $300 = ($38|0)<(0);
  12034. $301 = $300 << 31 >> 31;
  12035. $302 = (___muldi3(($38|0),($301|0),($51|0),($299|0))|0);
  12036. $303 = tempRet0;
  12037. $304 = (___muldi3(($39|0),($277|0),($18|0),($295|0))|0);
  12038. $305 = tempRet0;
  12039. $306 = (___muldi3(($40|0),($255|0),($51|0),($299|0))|0);
  12040. $307 = tempRet0;
  12041. $308 = (___muldi3(($41|0),($231|0),($18|0),($295|0))|0);
  12042. $309 = tempRet0;
  12043. $310 = (___muldi3(($42|0),($209|0),($51|0),($299|0))|0);
  12044. $311 = tempRet0;
  12045. $312 = (___muldi3(($43|0),($185|0),($18|0),($295|0))|0);
  12046. $313 = tempRet0;
  12047. $314 = (___muldi3(($44|0),($163|0),($51|0),($299|0))|0);
  12048. $315 = tempRet0;
  12049. $316 = (___muldi3(($45|0),($139|0),($18|0),($295|0))|0);
  12050. $317 = tempRet0;
  12051. $318 = (___muldi3(($46|0),($117|0),($51|0),($299|0))|0);
  12052. $319 = tempRet0;
  12053. $320 = (_i64Add(($302|0),($303|0),($56|0),($57|0))|0);
  12054. $321 = tempRet0;
  12055. $322 = (_i64Add(($320|0),($321|0),($278|0),($279|0))|0);
  12056. $323 = tempRet0;
  12057. $324 = (_i64Add(($322|0),($323|0),($256|0),($257|0))|0);
  12058. $325 = tempRet0;
  12059. $326 = (_i64Add(($324|0),($325|0),($232|0),($233|0))|0);
  12060. $327 = tempRet0;
  12061. $328 = (_i64Add(($326|0),($327|0),($210|0),($211|0))|0);
  12062. $329 = tempRet0;
  12063. $330 = (_i64Add(($328|0),($329|0),($186|0),($187|0))|0);
  12064. $331 = tempRet0;
  12065. $332 = (_i64Add(($330|0),($331|0),($164|0),($165|0))|0);
  12066. $333 = tempRet0;
  12067. $334 = (_i64Add(($332|0),($333|0),($140|0),($141|0))|0);
  12068. $335 = tempRet0;
  12069. $336 = (_i64Add(($334|0),($335|0),($118|0),($119|0))|0);
  12070. $337 = tempRet0;
  12071. $338 = (_i64Add(($60|0),($61|0),($96|0),($97|0))|0);
  12072. $339 = tempRet0;
  12073. $340 = (_i64Add(($150|0),($151|0),($172|0),($173|0))|0);
  12074. $341 = tempRet0;
  12075. $342 = (_i64Add(($340|0),($341|0),($126|0),($127|0))|0);
  12076. $343 = tempRet0;
  12077. $344 = (_i64Add(($342|0),($343|0),($104|0),($105|0))|0);
  12078. $345 = tempRet0;
  12079. $346 = (_i64Add(($344|0),($345|0),($72|0),($73|0))|0);
  12080. $347 = tempRet0;
  12081. $348 = (_i64Add(($346|0),($347|0),($310|0),($311|0))|0);
  12082. $349 = tempRet0;
  12083. $350 = (_i64Add(($348|0),($349|0),($286|0),($287|0))|0);
  12084. $351 = tempRet0;
  12085. $352 = (_i64Add(($350|0),($351|0),($264|0),($265|0))|0);
  12086. $353 = tempRet0;
  12087. $354 = (_i64Add(($352|0),($353|0),($240|0),($241|0))|0);
  12088. $355 = tempRet0;
  12089. $356 = (_i64Add(($354|0),($355|0),($218|0),($219|0))|0);
  12090. $357 = tempRet0;
  12091. $358 = (_i64Add(($336|0),($337|0),33554432,0)|0);
  12092. $359 = tempRet0;
  12093. $360 = (_bitshift64Ashr(($358|0),($359|0),26)|0);
  12094. $361 = tempRet0;
  12095. $362 = (_i64Add(($338|0),($339|0),($304|0),($305|0))|0);
  12096. $363 = tempRet0;
  12097. $364 = (_i64Add(($362|0),($363|0),($280|0),($281|0))|0);
  12098. $365 = tempRet0;
  12099. $366 = (_i64Add(($364|0),($365|0),($258|0),($259|0))|0);
  12100. $367 = tempRet0;
  12101. $368 = (_i64Add(($366|0),($367|0),($234|0),($235|0))|0);
  12102. $369 = tempRet0;
  12103. $370 = (_i64Add(($368|0),($369|0),($212|0),($213|0))|0);
  12104. $371 = tempRet0;
  12105. $372 = (_i64Add(($370|0),($371|0),($188|0),($189|0))|0);
  12106. $373 = tempRet0;
  12107. $374 = (_i64Add(($372|0),($373|0),($166|0),($167|0))|0);
  12108. $375 = tempRet0;
  12109. $376 = (_i64Add(($374|0),($375|0),($142|0),($143|0))|0);
  12110. $377 = tempRet0;
  12111. $378 = (_i64Add(($376|0),($377|0),($360|0),($361|0))|0);
  12112. $379 = tempRet0;
  12113. $380 = (_bitshift64Shl(($360|0),($361|0),26)|0);
  12114. $381 = tempRet0;
  12115. $382 = (_i64Subtract(($336|0),($337|0),($380|0),($381|0))|0);
  12116. $383 = tempRet0;
  12117. $384 = (_i64Add(($356|0),($357|0),33554432,0)|0);
  12118. $385 = tempRet0;
  12119. $386 = (_bitshift64Ashr(($384|0),($385|0),26)|0);
  12120. $387 = tempRet0;
  12121. $388 = (_i64Add(($174|0),($175|0),($196|0),($197|0))|0);
  12122. $389 = tempRet0;
  12123. $390 = (_i64Add(($388|0),($389|0),($152|0),($153|0))|0);
  12124. $391 = tempRet0;
  12125. $392 = (_i64Add(($390|0),($391|0),($128|0),($129|0))|0);
  12126. $393 = tempRet0;
  12127. $394 = (_i64Add(($392|0),($393|0),($106|0),($107|0))|0);
  12128. $395 = tempRet0;
  12129. $396 = (_i64Add(($394|0),($395|0),($76|0),($77|0))|0);
  12130. $397 = tempRet0;
  12131. $398 = (_i64Add(($396|0),($397|0),($312|0),($313|0))|0);
  12132. $399 = tempRet0;
  12133. $400 = (_i64Add(($398|0),($399|0),($288|0),($289|0))|0);
  12134. $401 = tempRet0;
  12135. $402 = (_i64Add(($400|0),($401|0),($266|0),($267|0))|0);
  12136. $403 = tempRet0;
  12137. $404 = (_i64Add(($402|0),($403|0),($242|0),($243|0))|0);
  12138. $405 = tempRet0;
  12139. $406 = (_i64Add(($404|0),($405|0),($386|0),($387|0))|0);
  12140. $407 = tempRet0;
  12141. $408 = (_bitshift64Shl(($386|0),($387|0),26)|0);
  12142. $409 = tempRet0;
  12143. $410 = (_i64Subtract(($356|0),($357|0),($408|0),($409|0))|0);
  12144. $411 = tempRet0;
  12145. $412 = (_i64Add(($378|0),($379|0),16777216,0)|0);
  12146. $413 = tempRet0;
  12147. $414 = (_bitshift64Ashr(($412|0),($413|0),25)|0);
  12148. $415 = tempRet0;
  12149. $416 = (_i64Add(($100|0),($101|0),($122|0),($123|0))|0);
  12150. $417 = tempRet0;
  12151. $418 = (_i64Add(($416|0),($417|0),($64|0),($65|0))|0);
  12152. $419 = tempRet0;
  12153. $420 = (_i64Add(($418|0),($419|0),($306|0),($307|0))|0);
  12154. $421 = tempRet0;
  12155. $422 = (_i64Add(($420|0),($421|0),($282|0),($283|0))|0);
  12156. $423 = tempRet0;
  12157. $424 = (_i64Add(($422|0),($423|0),($260|0),($261|0))|0);
  12158. $425 = tempRet0;
  12159. $426 = (_i64Add(($424|0),($425|0),($236|0),($237|0))|0);
  12160. $427 = tempRet0;
  12161. $428 = (_i64Add(($426|0),($427|0),($214|0),($215|0))|0);
  12162. $429 = tempRet0;
  12163. $430 = (_i64Add(($428|0),($429|0),($190|0),($191|0))|0);
  12164. $431 = tempRet0;
  12165. $432 = (_i64Add(($430|0),($431|0),($168|0),($169|0))|0);
  12166. $433 = tempRet0;
  12167. $434 = (_i64Add(($432|0),($433|0),($414|0),($415|0))|0);
  12168. $435 = tempRet0;
  12169. $436 = (_bitshift64Shl(($414|0),($415|0),25)|0);
  12170. $437 = tempRet0;
  12171. $438 = (_i64Subtract(($378|0),($379|0),($436|0),($437|0))|0);
  12172. $439 = tempRet0;
  12173. $440 = (_i64Add(($406|0),($407|0),16777216,0)|0);
  12174. $441 = tempRet0;
  12175. $442 = (_bitshift64Ashr(($440|0),($441|0),25)|0);
  12176. $443 = tempRet0;
  12177. $444 = (_i64Add(($200|0),($201|0),($222|0),($223|0))|0);
  12178. $445 = tempRet0;
  12179. $446 = (_i64Add(($444|0),($445|0),($176|0),($177|0))|0);
  12180. $447 = tempRet0;
  12181. $448 = (_i64Add(($446|0),($447|0),($154|0),($155|0))|0);
  12182. $449 = tempRet0;
  12183. $450 = (_i64Add(($448|0),($449|0),($130|0),($131|0))|0);
  12184. $451 = tempRet0;
  12185. $452 = (_i64Add(($450|0),($451|0),($108|0),($109|0))|0);
  12186. $453 = tempRet0;
  12187. $454 = (_i64Add(($452|0),($453|0),($80|0),($81|0))|0);
  12188. $455 = tempRet0;
  12189. $456 = (_i64Add(($454|0),($455|0),($314|0),($315|0))|0);
  12190. $457 = tempRet0;
  12191. $458 = (_i64Add(($456|0),($457|0),($290|0),($291|0))|0);
  12192. $459 = tempRet0;
  12193. $460 = (_i64Add(($458|0),($459|0),($268|0),($269|0))|0);
  12194. $461 = tempRet0;
  12195. $462 = (_i64Add(($460|0),($461|0),($442|0),($443|0))|0);
  12196. $463 = tempRet0;
  12197. $464 = (_bitshift64Shl(($442|0),($443|0),25)|0);
  12198. $465 = tempRet0;
  12199. $466 = (_i64Subtract(($406|0),($407|0),($464|0),($465|0))|0);
  12200. $467 = tempRet0;
  12201. $468 = (_i64Add(($434|0),($435|0),33554432,0)|0);
  12202. $469 = tempRet0;
  12203. $470 = (_bitshift64Ashr(($468|0),($469|0),26)|0);
  12204. $471 = tempRet0;
  12205. $472 = (_i64Add(($124|0),($125|0),($146|0),($147|0))|0);
  12206. $473 = tempRet0;
  12207. $474 = (_i64Add(($472|0),($473|0),($102|0),($103|0))|0);
  12208. $475 = tempRet0;
  12209. $476 = (_i64Add(($474|0),($475|0),($68|0),($69|0))|0);
  12210. $477 = tempRet0;
  12211. $478 = (_i64Add(($476|0),($477|0),($308|0),($309|0))|0);
  12212. $479 = tempRet0;
  12213. $480 = (_i64Add(($478|0),($479|0),($284|0),($285|0))|0);
  12214. $481 = tempRet0;
  12215. $482 = (_i64Add(($480|0),($481|0),($262|0),($263|0))|0);
  12216. $483 = tempRet0;
  12217. $484 = (_i64Add(($482|0),($483|0),($238|0),($239|0))|0);
  12218. $485 = tempRet0;
  12219. $486 = (_i64Add(($484|0),($485|0),($216|0),($217|0))|0);
  12220. $487 = tempRet0;
  12221. $488 = (_i64Add(($486|0),($487|0),($192|0),($193|0))|0);
  12222. $489 = tempRet0;
  12223. $490 = (_i64Add(($488|0),($489|0),($470|0),($471|0))|0);
  12224. $491 = tempRet0;
  12225. $492 = (_bitshift64Shl(($470|0),($471|0),26)|0);
  12226. $493 = tempRet0;
  12227. $494 = (_i64Subtract(($434|0),($435|0),($492|0),($493|0))|0);
  12228. $495 = tempRet0;
  12229. $496 = (_i64Add(($462|0),($463|0),33554432,0)|0);
  12230. $497 = tempRet0;
  12231. $498 = (_bitshift64Ashr(($496|0),($497|0),26)|0);
  12232. $499 = tempRet0;
  12233. $500 = (_i64Add(($224|0),($225|0),($246|0),($247|0))|0);
  12234. $501 = tempRet0;
  12235. $502 = (_i64Add(($500|0),($501|0),($202|0),($203|0))|0);
  12236. $503 = tempRet0;
  12237. $504 = (_i64Add(($502|0),($503|0),($178|0),($179|0))|0);
  12238. $505 = tempRet0;
  12239. $506 = (_i64Add(($504|0),($505|0),($156|0),($157|0))|0);
  12240. $507 = tempRet0;
  12241. $508 = (_i64Add(($506|0),($507|0),($132|0),($133|0))|0);
  12242. $509 = tempRet0;
  12243. $510 = (_i64Add(($508|0),($509|0),($110|0),($111|0))|0);
  12244. $511 = tempRet0;
  12245. $512 = (_i64Add(($510|0),($511|0),($84|0),($85|0))|0);
  12246. $513 = tempRet0;
  12247. $514 = (_i64Add(($512|0),($513|0),($316|0),($317|0))|0);
  12248. $515 = tempRet0;
  12249. $516 = (_i64Add(($514|0),($515|0),($292|0),($293|0))|0);
  12250. $517 = tempRet0;
  12251. $518 = (_i64Add(($516|0),($517|0),($498|0),($499|0))|0);
  12252. $519 = tempRet0;
  12253. $520 = (_bitshift64Shl(($498|0),($499|0),26)|0);
  12254. $521 = tempRet0;
  12255. $522 = (_i64Subtract(($462|0),($463|0),($520|0),($521|0))|0);
  12256. $523 = tempRet0;
  12257. $524 = (_i64Add(($490|0),($491|0),16777216,0)|0);
  12258. $525 = tempRet0;
  12259. $526 = (_bitshift64Ashr(($524|0),($525|0),25)|0);
  12260. $527 = tempRet0;
  12261. $528 = (_i64Add(($526|0),($527|0),($410|0),($411|0))|0);
  12262. $529 = tempRet0;
  12263. $530 = (_bitshift64Shl(($526|0),($527|0),25)|0);
  12264. $531 = tempRet0;
  12265. $532 = (_i64Subtract(($490|0),($491|0),($530|0),($531|0))|0);
  12266. $533 = tempRet0;
  12267. $534 = (_i64Add(($518|0),($519|0),16777216,0)|0);
  12268. $535 = tempRet0;
  12269. $536 = (_bitshift64Ashr(($534|0),($535|0),25)|0);
  12270. $537 = tempRet0;
  12271. $538 = (_i64Add(($250|0),($251|0),($272|0),($273|0))|0);
  12272. $539 = tempRet0;
  12273. $540 = (_i64Add(($538|0),($539|0),($226|0),($227|0))|0);
  12274. $541 = tempRet0;
  12275. $542 = (_i64Add(($540|0),($541|0),($204|0),($205|0))|0);
  12276. $543 = tempRet0;
  12277. $544 = (_i64Add(($542|0),($543|0),($180|0),($181|0))|0);
  12278. $545 = tempRet0;
  12279. $546 = (_i64Add(($544|0),($545|0),($158|0),($159|0))|0);
  12280. $547 = tempRet0;
  12281. $548 = (_i64Add(($546|0),($547|0),($134|0),($135|0))|0);
  12282. $549 = tempRet0;
  12283. $550 = (_i64Add(($548|0),($549|0),($112|0),($113|0))|0);
  12284. $551 = tempRet0;
  12285. $552 = (_i64Add(($550|0),($551|0),($88|0),($89|0))|0);
  12286. $553 = tempRet0;
  12287. $554 = (_i64Add(($552|0),($553|0),($318|0),($319|0))|0);
  12288. $555 = tempRet0;
  12289. $556 = (_i64Add(($554|0),($555|0),($536|0),($537|0))|0);
  12290. $557 = tempRet0;
  12291. $558 = (_bitshift64Shl(($536|0),($537|0),25)|0);
  12292. $559 = tempRet0;
  12293. $560 = (_i64Subtract(($518|0),($519|0),($558|0),($559|0))|0);
  12294. $561 = tempRet0;
  12295. $562 = (_i64Add(($528|0),($529|0),33554432,0)|0);
  12296. $563 = tempRet0;
  12297. $564 = (_bitshift64Ashr(($562|0),($563|0),26)|0);
  12298. $565 = tempRet0;
  12299. $566 = (_i64Add(($466|0),($467|0),($564|0),($565|0))|0);
  12300. $567 = tempRet0;
  12301. $568 = (_bitshift64Shl(($564|0),($565|0),26)|0);
  12302. $569 = tempRet0;
  12303. $570 = (_i64Subtract(($528|0),($529|0),($568|0),($569|0))|0);
  12304. $571 = tempRet0;
  12305. $572 = (_i64Add(($556|0),($557|0),33554432,0)|0);
  12306. $573 = tempRet0;
  12307. $574 = (_bitshift64Ashr(($572|0),($573|0),26)|0);
  12308. $575 = tempRet0;
  12309. $576 = (_i64Add(($274|0),($275|0),($296|0),($297|0))|0);
  12310. $577 = tempRet0;
  12311. $578 = (_i64Add(($576|0),($577|0),($252|0),($253|0))|0);
  12312. $579 = tempRet0;
  12313. $580 = (_i64Add(($578|0),($579|0),($228|0),($229|0))|0);
  12314. $581 = tempRet0;
  12315. $582 = (_i64Add(($580|0),($581|0),($206|0),($207|0))|0);
  12316. $583 = tempRet0;
  12317. $584 = (_i64Add(($582|0),($583|0),($182|0),($183|0))|0);
  12318. $585 = tempRet0;
  12319. $586 = (_i64Add(($584|0),($585|0),($160|0),($161|0))|0);
  12320. $587 = tempRet0;
  12321. $588 = (_i64Add(($586|0),($587|0),($136|0),($137|0))|0);
  12322. $589 = tempRet0;
  12323. $590 = (_i64Add(($588|0),($589|0),($114|0),($115|0))|0);
  12324. $591 = tempRet0;
  12325. $592 = (_i64Add(($590|0),($591|0),($92|0),($93|0))|0);
  12326. $593 = tempRet0;
  12327. $594 = (_i64Add(($592|0),($593|0),($574|0),($575|0))|0);
  12328. $595 = tempRet0;
  12329. $596 = (_bitshift64Shl(($574|0),($575|0),26)|0);
  12330. $597 = tempRet0;
  12331. $598 = (_i64Subtract(($556|0),($557|0),($596|0),($597|0))|0);
  12332. $599 = tempRet0;
  12333. $600 = (_i64Add(($594|0),($595|0),16777216,0)|0);
  12334. $601 = tempRet0;
  12335. $602 = (_bitshift64Ashr(($600|0),($601|0),25)|0);
  12336. $603 = tempRet0;
  12337. $604 = (___muldi3(($602|0),($603|0),19,0)|0);
  12338. $605 = tempRet0;
  12339. $606 = (_i64Add(($604|0),($605|0),($382|0),($383|0))|0);
  12340. $607 = tempRet0;
  12341. $608 = (_bitshift64Shl(($602|0),($603|0),25)|0);
  12342. $609 = tempRet0;
  12343. $610 = (_i64Subtract(($594|0),($595|0),($608|0),($609|0))|0);
  12344. $611 = tempRet0;
  12345. $612 = (_i64Add(($606|0),($607|0),33554432,0)|0);
  12346. $613 = tempRet0;
  12347. $614 = (_bitshift64Ashr(($612|0),($613|0),26)|0);
  12348. $615 = tempRet0;
  12349. $616 = (_i64Add(($438|0),($439|0),($614|0),($615|0))|0);
  12350. $617 = tempRet0;
  12351. $618 = (_bitshift64Shl(($614|0),($615|0),26)|0);
  12352. $619 = tempRet0;
  12353. $620 = (_i64Subtract(($606|0),($607|0),($618|0),($619|0))|0);
  12354. $621 = tempRet0;
  12355. HEAP32[$h>>2] = $620;
  12356. $622 = (($h) + 4|0);
  12357. HEAP32[$622>>2] = $616;
  12358. $623 = (($h) + 8|0);
  12359. HEAP32[$623>>2] = $494;
  12360. $624 = (($h) + 12|0);
  12361. HEAP32[$624>>2] = $532;
  12362. $625 = (($h) + 16|0);
  12363. HEAP32[$625>>2] = $570;
  12364. $626 = (($h) + 20|0);
  12365. HEAP32[$626>>2] = $566;
  12366. $627 = (($h) + 24|0);
  12367. HEAP32[$627>>2] = $522;
  12368. $628 = (($h) + 28|0);
  12369. HEAP32[$628>>2] = $560;
  12370. $629 = (($h) + 32|0);
  12371. HEAP32[$629>>2] = $598;
  12372. $630 = (($h) + 36|0);
  12373. HEAP32[$630>>2] = $610;
  12374. STACKTOP = sp;return;
  12375. }
  12376. function _crypto_sign_ed25519_ref10_fe_neg($h,$f) {
  12377. $h = $h|0;
  12378. $f = $f|0;
  12379. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  12380. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  12381. sp = STACKTOP;
  12382. $0 = HEAP32[$f>>2]|0;
  12383. $1 = (($f) + 4|0);
  12384. $2 = HEAP32[$1>>2]|0;
  12385. $3 = (($f) + 8|0);
  12386. $4 = HEAP32[$3>>2]|0;
  12387. $5 = (($f) + 12|0);
  12388. $6 = HEAP32[$5>>2]|0;
  12389. $7 = (($f) + 16|0);
  12390. $8 = HEAP32[$7>>2]|0;
  12391. $9 = (($f) + 20|0);
  12392. $10 = HEAP32[$9>>2]|0;
  12393. $11 = (($f) + 24|0);
  12394. $12 = HEAP32[$11>>2]|0;
  12395. $13 = (($f) + 28|0);
  12396. $14 = HEAP32[$13>>2]|0;
  12397. $15 = (($f) + 32|0);
  12398. $16 = HEAP32[$15>>2]|0;
  12399. $17 = (($f) + 36|0);
  12400. $18 = HEAP32[$17>>2]|0;
  12401. $19 = (0 - ($0))|0;
  12402. $20 = (0 - ($2))|0;
  12403. $21 = (0 - ($4))|0;
  12404. $22 = (0 - ($6))|0;
  12405. $23 = (0 - ($8))|0;
  12406. $24 = (0 - ($10))|0;
  12407. $25 = (0 - ($12))|0;
  12408. $26 = (0 - ($14))|0;
  12409. $27 = (0 - ($16))|0;
  12410. $28 = (0 - ($18))|0;
  12411. HEAP32[$h>>2] = $19;
  12412. $29 = (($h) + 4|0);
  12413. HEAP32[$29>>2] = $20;
  12414. $30 = (($h) + 8|0);
  12415. HEAP32[$30>>2] = $21;
  12416. $31 = (($h) + 12|0);
  12417. HEAP32[$31>>2] = $22;
  12418. $32 = (($h) + 16|0);
  12419. HEAP32[$32>>2] = $23;
  12420. $33 = (($h) + 20|0);
  12421. HEAP32[$33>>2] = $24;
  12422. $34 = (($h) + 24|0);
  12423. HEAP32[$34>>2] = $25;
  12424. $35 = (($h) + 28|0);
  12425. HEAP32[$35>>2] = $26;
  12426. $36 = (($h) + 32|0);
  12427. HEAP32[$36>>2] = $27;
  12428. $37 = (($h) + 36|0);
  12429. HEAP32[$37>>2] = $28;
  12430. STACKTOP = sp;return;
  12431. }
  12432. function _crypto_sign_ed25519_ref10_fe_pow22523($out,$z) {
  12433. $out = $out|0;
  12434. $z = $z|0;
  12435. var $0 = 0, $1 = 0, $2 = 0, $exitcond = 0, $exitcond10 = 0, $exitcond11 = 0, $i$74 = 0, $i$83 = 0, $i$92 = 0, $t0 = 0, $t1 = 0, $t2 = 0, label = 0, sp = 0;
  12436. sp = STACKTOP;
  12437. STACKTOP = STACKTOP + 128|0;
  12438. $t0 = sp + 80|0;
  12439. $t1 = sp + 40|0;
  12440. $t2 = sp;
  12441. _crypto_sign_ed25519_ref10_fe_sq($t0,$z);
  12442. _crypto_sign_ed25519_ref10_fe_sq($t1,$t0);
  12443. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12444. _crypto_sign_ed25519_ref10_fe_mul($t1,$z,$t1);
  12445. _crypto_sign_ed25519_ref10_fe_mul($t0,$t0,$t1);
  12446. _crypto_sign_ed25519_ref10_fe_sq($t0,$t0);
  12447. _crypto_sign_ed25519_ref10_fe_mul($t0,$t1,$t0);
  12448. _crypto_sign_ed25519_ref10_fe_sq($t1,$t0);
  12449. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12450. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12451. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12452. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12453. _crypto_sign_ed25519_ref10_fe_mul($t0,$t1,$t0);
  12454. _crypto_sign_ed25519_ref10_fe_sq($t1,$t0);
  12455. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12456. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12457. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12458. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12459. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12460. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12461. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12462. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12463. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12464. _crypto_sign_ed25519_ref10_fe_mul($t1,$t1,$t0);
  12465. _crypto_sign_ed25519_ref10_fe_sq($t2,$t1);
  12466. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12467. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12468. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12469. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12470. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12471. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12472. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12473. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12474. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12475. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12476. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12477. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12478. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12479. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12480. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12481. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12482. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12483. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12484. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12485. _crypto_sign_ed25519_ref10_fe_mul($t1,$t2,$t1);
  12486. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12487. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12488. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12489. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12490. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12491. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12492. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12493. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12494. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12495. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12496. _crypto_sign_ed25519_ref10_fe_mul($t0,$t1,$t0);
  12497. _crypto_sign_ed25519_ref10_fe_sq($t1,$t0);
  12498. $i$74 = 1;
  12499. while(1) {
  12500. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12501. $0 = (($i$74) + 1)|0;
  12502. $exitcond11 = ($0|0)==(50);
  12503. if ($exitcond11) {
  12504. break;
  12505. } else {
  12506. $i$74 = $0;
  12507. }
  12508. }
  12509. _crypto_sign_ed25519_ref10_fe_mul($t1,$t1,$t0);
  12510. _crypto_sign_ed25519_ref10_fe_sq($t2,$t1);
  12511. $i$83 = 1;
  12512. while(1) {
  12513. _crypto_sign_ed25519_ref10_fe_sq($t2,$t2);
  12514. $1 = (($i$83) + 1)|0;
  12515. $exitcond10 = ($1|0)==(100);
  12516. if ($exitcond10) {
  12517. break;
  12518. } else {
  12519. $i$83 = $1;
  12520. }
  12521. }
  12522. _crypto_sign_ed25519_ref10_fe_mul($t1,$t2,$t1);
  12523. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12524. $i$92 = 1;
  12525. while(1) {
  12526. _crypto_sign_ed25519_ref10_fe_sq($t1,$t1);
  12527. $2 = (($i$92) + 1)|0;
  12528. $exitcond = ($2|0)==(50);
  12529. if ($exitcond) {
  12530. break;
  12531. } else {
  12532. $i$92 = $2;
  12533. }
  12534. }
  12535. _crypto_sign_ed25519_ref10_fe_mul($t0,$t1,$t0);
  12536. _crypto_sign_ed25519_ref10_fe_sq($t0,$t0);
  12537. _crypto_sign_ed25519_ref10_fe_sq($t0,$t0);
  12538. _crypto_sign_ed25519_ref10_fe_mul($out,$t0,$z);
  12539. STACKTOP = sp;return;
  12540. }
  12541. function _crypto_sign_ed25519_ref10_fe_sq($h,$f) {
  12542. $h = $h|0;
  12543. $f = $f|0;
  12544. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  12545. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  12546. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  12547. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  12548. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  12549. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  12550. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  12551. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  12552. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  12553. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  12554. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  12555. var $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0;
  12556. var $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0;
  12557. var $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0;
  12558. var $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0;
  12559. var $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0;
  12560. var $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0;
  12561. var $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0;
  12562. var $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0;
  12563. var $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0;
  12564. var $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  12565. sp = STACKTOP;
  12566. $0 = HEAP32[$f>>2]|0;
  12567. $1 = (($f) + 4|0);
  12568. $2 = HEAP32[$1>>2]|0;
  12569. $3 = (($f) + 8|0);
  12570. $4 = HEAP32[$3>>2]|0;
  12571. $5 = (($f) + 12|0);
  12572. $6 = HEAP32[$5>>2]|0;
  12573. $7 = (($f) + 16|0);
  12574. $8 = HEAP32[$7>>2]|0;
  12575. $9 = (($f) + 20|0);
  12576. $10 = HEAP32[$9>>2]|0;
  12577. $11 = (($f) + 24|0);
  12578. $12 = HEAP32[$11>>2]|0;
  12579. $13 = (($f) + 28|0);
  12580. $14 = HEAP32[$13>>2]|0;
  12581. $15 = (($f) + 32|0);
  12582. $16 = HEAP32[$15>>2]|0;
  12583. $17 = (($f) + 36|0);
  12584. $18 = HEAP32[$17>>2]|0;
  12585. $19 = $0 << 1;
  12586. $20 = $2 << 1;
  12587. $21 = $4 << 1;
  12588. $22 = $6 << 1;
  12589. $23 = $8 << 1;
  12590. $24 = $10 << 1;
  12591. $25 = $12 << 1;
  12592. $26 = $14 << 1;
  12593. $27 = ($10*38)|0;
  12594. $28 = ($12*19)|0;
  12595. $29 = ($14*38)|0;
  12596. $30 = ($16*19)|0;
  12597. $31 = ($18*38)|0;
  12598. $32 = ($0|0)<(0);
  12599. $33 = $32 << 31 >> 31;
  12600. $34 = (___muldi3(($0|0),($33|0),($0|0),($33|0))|0);
  12601. $35 = tempRet0;
  12602. $36 = ($19|0)<(0);
  12603. $37 = $36 << 31 >> 31;
  12604. $38 = ($2|0)<(0);
  12605. $39 = $38 << 31 >> 31;
  12606. $40 = (___muldi3(($19|0),($37|0),($2|0),($39|0))|0);
  12607. $41 = tempRet0;
  12608. $42 = ($4|0)<(0);
  12609. $43 = $42 << 31 >> 31;
  12610. $44 = (___muldi3(($4|0),($43|0),($19|0),($37|0))|0);
  12611. $45 = tempRet0;
  12612. $46 = ($6|0)<(0);
  12613. $47 = $46 << 31 >> 31;
  12614. $48 = (___muldi3(($6|0),($47|0),($19|0),($37|0))|0);
  12615. $49 = tempRet0;
  12616. $50 = ($8|0)<(0);
  12617. $51 = $50 << 31 >> 31;
  12618. $52 = (___muldi3(($8|0),($51|0),($19|0),($37|0))|0);
  12619. $53 = tempRet0;
  12620. $54 = ($10|0)<(0);
  12621. $55 = $54 << 31 >> 31;
  12622. $56 = (___muldi3(($10|0),($55|0),($19|0),($37|0))|0);
  12623. $57 = tempRet0;
  12624. $58 = ($12|0)<(0);
  12625. $59 = $58 << 31 >> 31;
  12626. $60 = (___muldi3(($12|0),($59|0),($19|0),($37|0))|0);
  12627. $61 = tempRet0;
  12628. $62 = ($14|0)<(0);
  12629. $63 = $62 << 31 >> 31;
  12630. $64 = (___muldi3(($14|0),($63|0),($19|0),($37|0))|0);
  12631. $65 = tempRet0;
  12632. $66 = ($16|0)<(0);
  12633. $67 = $66 << 31 >> 31;
  12634. $68 = (___muldi3(($16|0),($67|0),($19|0),($37|0))|0);
  12635. $69 = tempRet0;
  12636. $70 = ($18|0)<(0);
  12637. $71 = $70 << 31 >> 31;
  12638. $72 = (___muldi3(($18|0),($71|0),($19|0),($37|0))|0);
  12639. $73 = tempRet0;
  12640. $74 = ($20|0)<(0);
  12641. $75 = $74 << 31 >> 31;
  12642. $76 = (___muldi3(($20|0),($75|0),($2|0),($39|0))|0);
  12643. $77 = tempRet0;
  12644. $78 = (___muldi3(($20|0),($75|0),($4|0),($43|0))|0);
  12645. $79 = tempRet0;
  12646. $80 = ($22|0)<(0);
  12647. $81 = $80 << 31 >> 31;
  12648. $82 = (___muldi3(($22|0),($81|0),($20|0),($75|0))|0);
  12649. $83 = tempRet0;
  12650. $84 = (___muldi3(($8|0),($51|0),($20|0),($75|0))|0);
  12651. $85 = tempRet0;
  12652. $86 = ($24|0)<(0);
  12653. $87 = $86 << 31 >> 31;
  12654. $88 = (___muldi3(($24|0),($87|0),($20|0),($75|0))|0);
  12655. $89 = tempRet0;
  12656. $90 = (___muldi3(($12|0),($59|0),($20|0),($75|0))|0);
  12657. $91 = tempRet0;
  12658. $92 = ($26|0)<(0);
  12659. $93 = $92 << 31 >> 31;
  12660. $94 = (___muldi3(($26|0),($93|0),($20|0),($75|0))|0);
  12661. $95 = tempRet0;
  12662. $96 = (___muldi3(($16|0),($67|0),($20|0),($75|0))|0);
  12663. $97 = tempRet0;
  12664. $98 = ($31|0)<(0);
  12665. $99 = $98 << 31 >> 31;
  12666. $100 = (___muldi3(($31|0),($99|0),($20|0),($75|0))|0);
  12667. $101 = tempRet0;
  12668. $102 = (___muldi3(($4|0),($43|0),($4|0),($43|0))|0);
  12669. $103 = tempRet0;
  12670. $104 = ($21|0)<(0);
  12671. $105 = $104 << 31 >> 31;
  12672. $106 = (___muldi3(($21|0),($105|0),($6|0),($47|0))|0);
  12673. $107 = tempRet0;
  12674. $108 = (___muldi3(($8|0),($51|0),($21|0),($105|0))|0);
  12675. $109 = tempRet0;
  12676. $110 = (___muldi3(($10|0),($55|0),($21|0),($105|0))|0);
  12677. $111 = tempRet0;
  12678. $112 = (___muldi3(($12|0),($59|0),($21|0),($105|0))|0);
  12679. $113 = tempRet0;
  12680. $114 = (___muldi3(($14|0),($63|0),($21|0),($105|0))|0);
  12681. $115 = tempRet0;
  12682. $116 = ($30|0)<(0);
  12683. $117 = $116 << 31 >> 31;
  12684. $118 = (___muldi3(($30|0),($117|0),($21|0),($105|0))|0);
  12685. $119 = tempRet0;
  12686. $120 = (___muldi3(($31|0),($99|0),($4|0),($43|0))|0);
  12687. $121 = tempRet0;
  12688. $122 = (___muldi3(($22|0),($81|0),($6|0),($47|0))|0);
  12689. $123 = tempRet0;
  12690. $124 = (___muldi3(($22|0),($81|0),($8|0),($51|0))|0);
  12691. $125 = tempRet0;
  12692. $126 = (___muldi3(($24|0),($87|0),($22|0),($81|0))|0);
  12693. $127 = tempRet0;
  12694. $128 = (___muldi3(($12|0),($59|0),($22|0),($81|0))|0);
  12695. $129 = tempRet0;
  12696. $130 = ($29|0)<(0);
  12697. $131 = $130 << 31 >> 31;
  12698. $132 = (___muldi3(($29|0),($131|0),($22|0),($81|0))|0);
  12699. $133 = tempRet0;
  12700. $134 = (___muldi3(($30|0),($117|0),($22|0),($81|0))|0);
  12701. $135 = tempRet0;
  12702. $136 = (___muldi3(($31|0),($99|0),($22|0),($81|0))|0);
  12703. $137 = tempRet0;
  12704. $138 = (___muldi3(($8|0),($51|0),($8|0),($51|0))|0);
  12705. $139 = tempRet0;
  12706. $140 = ($23|0)<(0);
  12707. $141 = $140 << 31 >> 31;
  12708. $142 = (___muldi3(($23|0),($141|0),($10|0),($55|0))|0);
  12709. $143 = tempRet0;
  12710. $144 = ($28|0)<(0);
  12711. $145 = $144 << 31 >> 31;
  12712. $146 = (___muldi3(($28|0),($145|0),($23|0),($141|0))|0);
  12713. $147 = tempRet0;
  12714. $148 = (___muldi3(($29|0),($131|0),($8|0),($51|0))|0);
  12715. $149 = tempRet0;
  12716. $150 = (___muldi3(($30|0),($117|0),($23|0),($141|0))|0);
  12717. $151 = tempRet0;
  12718. $152 = (___muldi3(($31|0),($99|0),($8|0),($51|0))|0);
  12719. $153 = tempRet0;
  12720. $154 = ($27|0)<(0);
  12721. $155 = $154 << 31 >> 31;
  12722. $156 = (___muldi3(($27|0),($155|0),($10|0),($55|0))|0);
  12723. $157 = tempRet0;
  12724. $158 = (___muldi3(($28|0),($145|0),($24|0),($87|0))|0);
  12725. $159 = tempRet0;
  12726. $160 = (___muldi3(($29|0),($131|0),($24|0),($87|0))|0);
  12727. $161 = tempRet0;
  12728. $162 = (___muldi3(($30|0),($117|0),($24|0),($87|0))|0);
  12729. $163 = tempRet0;
  12730. $164 = (___muldi3(($31|0),($99|0),($24|0),($87|0))|0);
  12731. $165 = tempRet0;
  12732. $166 = (___muldi3(($28|0),($145|0),($12|0),($59|0))|0);
  12733. $167 = tempRet0;
  12734. $168 = (___muldi3(($29|0),($131|0),($12|0),($59|0))|0);
  12735. $169 = tempRet0;
  12736. $170 = ($25|0)<(0);
  12737. $171 = $170 << 31 >> 31;
  12738. $172 = (___muldi3(($30|0),($117|0),($25|0),($171|0))|0);
  12739. $173 = tempRet0;
  12740. $174 = (___muldi3(($31|0),($99|0),($12|0),($59|0))|0);
  12741. $175 = tempRet0;
  12742. $176 = (___muldi3(($29|0),($131|0),($14|0),($63|0))|0);
  12743. $177 = tempRet0;
  12744. $178 = (___muldi3(($30|0),($117|0),($26|0),($93|0))|0);
  12745. $179 = tempRet0;
  12746. $180 = (___muldi3(($31|0),($99|0),($26|0),($93|0))|0);
  12747. $181 = tempRet0;
  12748. $182 = (___muldi3(($30|0),($117|0),($16|0),($67|0))|0);
  12749. $183 = tempRet0;
  12750. $184 = (___muldi3(($31|0),($99|0),($16|0),($67|0))|0);
  12751. $185 = tempRet0;
  12752. $186 = (___muldi3(($31|0),($99|0),($18|0),($71|0))|0);
  12753. $187 = tempRet0;
  12754. $188 = (_i64Add(($156|0),($157|0),($34|0),($35|0))|0);
  12755. $189 = tempRet0;
  12756. $190 = (_i64Add(($188|0),($189|0),($146|0),($147|0))|0);
  12757. $191 = tempRet0;
  12758. $192 = (_i64Add(($190|0),($191|0),($132|0),($133|0))|0);
  12759. $193 = tempRet0;
  12760. $194 = (_i64Add(($192|0),($193|0),($118|0),($119|0))|0);
  12761. $195 = tempRet0;
  12762. $196 = (_i64Add(($194|0),($195|0),($100|0),($101|0))|0);
  12763. $197 = tempRet0;
  12764. $198 = (_i64Add(($44|0),($45|0),($76|0),($77|0))|0);
  12765. $199 = tempRet0;
  12766. $200 = (_i64Add(($48|0),($49|0),($78|0),($79|0))|0);
  12767. $201 = tempRet0;
  12768. $202 = (_i64Add(($82|0),($83|0),($102|0),($103|0))|0);
  12769. $203 = tempRet0;
  12770. $204 = (_i64Add(($202|0),($203|0),($52|0),($53|0))|0);
  12771. $205 = tempRet0;
  12772. $206 = (_i64Add(($204|0),($205|0),($176|0),($177|0))|0);
  12773. $207 = tempRet0;
  12774. $208 = (_i64Add(($206|0),($207|0),($172|0),($173|0))|0);
  12775. $209 = tempRet0;
  12776. $210 = (_i64Add(($208|0),($209|0),($164|0),($165|0))|0);
  12777. $211 = tempRet0;
  12778. $212 = (_i64Add(($196|0),($197|0),33554432,0)|0);
  12779. $213 = tempRet0;
  12780. $214 = (_bitshift64Ashr(($212|0),($213|0),26)|0);
  12781. $215 = tempRet0;
  12782. $216 = (_i64Add(($158|0),($159|0),($40|0),($41|0))|0);
  12783. $217 = tempRet0;
  12784. $218 = (_i64Add(($216|0),($217|0),($148|0),($149|0))|0);
  12785. $219 = tempRet0;
  12786. $220 = (_i64Add(($218|0),($219|0),($134|0),($135|0))|0);
  12787. $221 = tempRet0;
  12788. $222 = (_i64Add(($220|0),($221|0),($120|0),($121|0))|0);
  12789. $223 = tempRet0;
  12790. $224 = (_i64Add(($222|0),($223|0),($214|0),($215|0))|0);
  12791. $225 = tempRet0;
  12792. $226 = (_bitshift64Shl(($214|0),($215|0),26)|0);
  12793. $227 = tempRet0;
  12794. $228 = (_i64Subtract(($196|0),($197|0),($226|0),($227|0))|0);
  12795. $229 = tempRet0;
  12796. $230 = (_i64Add(($210|0),($211|0),33554432,0)|0);
  12797. $231 = tempRet0;
  12798. $232 = (_bitshift64Ashr(($230|0),($231|0),26)|0);
  12799. $233 = tempRet0;
  12800. $234 = (_i64Add(($84|0),($85|0),($106|0),($107|0))|0);
  12801. $235 = tempRet0;
  12802. $236 = (_i64Add(($234|0),($235|0),($56|0),($57|0))|0);
  12803. $237 = tempRet0;
  12804. $238 = (_i64Add(($236|0),($237|0),($178|0),($179|0))|0);
  12805. $239 = tempRet0;
  12806. $240 = (_i64Add(($238|0),($239|0),($174|0),($175|0))|0);
  12807. $241 = tempRet0;
  12808. $242 = (_i64Add(($240|0),($241|0),($232|0),($233|0))|0);
  12809. $243 = tempRet0;
  12810. $244 = (_bitshift64Shl(($232|0),($233|0),26)|0);
  12811. $245 = tempRet0;
  12812. $246 = (_i64Subtract(($210|0),($211|0),($244|0),($245|0))|0);
  12813. $247 = tempRet0;
  12814. $248 = (_i64Add(($224|0),($225|0),16777216,0)|0);
  12815. $249 = tempRet0;
  12816. $250 = (_bitshift64Ashr(($248|0),($249|0),25)|0);
  12817. $251 = tempRet0;
  12818. $252 = (_i64Add(($198|0),($199|0),($166|0),($167|0))|0);
  12819. $253 = tempRet0;
  12820. $254 = (_i64Add(($252|0),($253|0),($160|0),($161|0))|0);
  12821. $255 = tempRet0;
  12822. $256 = (_i64Add(($254|0),($255|0),($150|0),($151|0))|0);
  12823. $257 = tempRet0;
  12824. $258 = (_i64Add(($256|0),($257|0),($136|0),($137|0))|0);
  12825. $259 = tempRet0;
  12826. $260 = (_i64Add(($258|0),($259|0),($250|0),($251|0))|0);
  12827. $261 = tempRet0;
  12828. $262 = (_bitshift64Shl(($250|0),($251|0),25)|0);
  12829. $263 = tempRet0;
  12830. $264 = (_i64Subtract(($224|0),($225|0),($262|0),($263|0))|0);
  12831. $265 = tempRet0;
  12832. $266 = (_i64Add(($242|0),($243|0),16777216,0)|0);
  12833. $267 = tempRet0;
  12834. $268 = (_bitshift64Ashr(($266|0),($267|0),25)|0);
  12835. $269 = tempRet0;
  12836. $270 = (_i64Add(($122|0),($123|0),($108|0),($109|0))|0);
  12837. $271 = tempRet0;
  12838. $272 = (_i64Add(($270|0),($271|0),($88|0),($89|0))|0);
  12839. $273 = tempRet0;
  12840. $274 = (_i64Add(($272|0),($273|0),($60|0),($61|0))|0);
  12841. $275 = tempRet0;
  12842. $276 = (_i64Add(($274|0),($275|0),($182|0),($183|0))|0);
  12843. $277 = tempRet0;
  12844. $278 = (_i64Add(($276|0),($277|0),($180|0),($181|0))|0);
  12845. $279 = tempRet0;
  12846. $280 = (_i64Add(($278|0),($279|0),($268|0),($269|0))|0);
  12847. $281 = tempRet0;
  12848. $282 = (_bitshift64Shl(($268|0),($269|0),25)|0);
  12849. $283 = tempRet0;
  12850. $284 = (_i64Subtract(($242|0),($243|0),($282|0),($283|0))|0);
  12851. $285 = tempRet0;
  12852. $286 = (_i64Add(($260|0),($261|0),33554432,0)|0);
  12853. $287 = tempRet0;
  12854. $288 = (_bitshift64Ashr(($286|0),($287|0),26)|0);
  12855. $289 = tempRet0;
  12856. $290 = (_i64Add(($200|0),($201|0),($168|0),($169|0))|0);
  12857. $291 = tempRet0;
  12858. $292 = (_i64Add(($290|0),($291|0),($162|0),($163|0))|0);
  12859. $293 = tempRet0;
  12860. $294 = (_i64Add(($292|0),($293|0),($152|0),($153|0))|0);
  12861. $295 = tempRet0;
  12862. $296 = (_i64Add(($294|0),($295|0),($288|0),($289|0))|0);
  12863. $297 = tempRet0;
  12864. $298 = (_bitshift64Shl(($288|0),($289|0),26)|0);
  12865. $299 = tempRet0;
  12866. $300 = (_i64Subtract(($260|0),($261|0),($298|0),($299|0))|0);
  12867. $301 = tempRet0;
  12868. $302 = (_i64Add(($280|0),($281|0),33554432,0)|0);
  12869. $303 = tempRet0;
  12870. $304 = (_bitshift64Ashr(($302|0),($303|0),26)|0);
  12871. $305 = tempRet0;
  12872. $306 = (_i64Add(($110|0),($111|0),($124|0),($125|0))|0);
  12873. $307 = tempRet0;
  12874. $308 = (_i64Add(($306|0),($307|0),($90|0),($91|0))|0);
  12875. $309 = tempRet0;
  12876. $310 = (_i64Add(($308|0),($309|0),($64|0),($65|0))|0);
  12877. $311 = tempRet0;
  12878. $312 = (_i64Add(($310|0),($311|0),($184|0),($185|0))|0);
  12879. $313 = tempRet0;
  12880. $314 = (_i64Add(($312|0),($313|0),($304|0),($305|0))|0);
  12881. $315 = tempRet0;
  12882. $316 = (_bitshift64Shl(($304|0),($305|0),26)|0);
  12883. $317 = tempRet0;
  12884. $318 = (_i64Subtract(($280|0),($281|0),($316|0),($317|0))|0);
  12885. $319 = tempRet0;
  12886. $320 = (_i64Add(($296|0),($297|0),16777216,0)|0);
  12887. $321 = tempRet0;
  12888. $322 = (_bitshift64Ashr(($320|0),($321|0),25)|0);
  12889. $323 = tempRet0;
  12890. $324 = (_i64Add(($322|0),($323|0),($246|0),($247|0))|0);
  12891. $325 = tempRet0;
  12892. $326 = (_bitshift64Shl(($322|0),($323|0),25)|0);
  12893. $327 = tempRet0;
  12894. $328 = (_i64Subtract(($296|0),($297|0),($326|0),($327|0))|0);
  12895. $329 = tempRet0;
  12896. $330 = (_i64Add(($314|0),($315|0),16777216,0)|0);
  12897. $331 = tempRet0;
  12898. $332 = (_bitshift64Ashr(($330|0),($331|0),25)|0);
  12899. $333 = tempRet0;
  12900. $334 = (_i64Add(($112|0),($113|0),($138|0),($139|0))|0);
  12901. $335 = tempRet0;
  12902. $336 = (_i64Add(($334|0),($335|0),($126|0),($127|0))|0);
  12903. $337 = tempRet0;
  12904. $338 = (_i64Add(($336|0),($337|0),($94|0),($95|0))|0);
  12905. $339 = tempRet0;
  12906. $340 = (_i64Add(($338|0),($339|0),($68|0),($69|0))|0);
  12907. $341 = tempRet0;
  12908. $342 = (_i64Add(($340|0),($341|0),($186|0),($187|0))|0);
  12909. $343 = tempRet0;
  12910. $344 = (_i64Add(($342|0),($343|0),($332|0),($333|0))|0);
  12911. $345 = tempRet0;
  12912. $346 = (_bitshift64Shl(($332|0),($333|0),25)|0);
  12913. $347 = tempRet0;
  12914. $348 = (_i64Subtract(($314|0),($315|0),($346|0),($347|0))|0);
  12915. $349 = tempRet0;
  12916. $350 = (_i64Add(($324|0),($325|0),33554432,0)|0);
  12917. $351 = tempRet0;
  12918. $352 = (_bitshift64Ashr(($350|0),($351|0),26)|0);
  12919. $353 = tempRet0;
  12920. $354 = (_i64Add(($284|0),($285|0),($352|0),($353|0))|0);
  12921. $355 = tempRet0;
  12922. $356 = (_bitshift64Shl(($352|0),($353|0),26)|0);
  12923. $357 = tempRet0;
  12924. $358 = (_i64Subtract(($324|0),($325|0),($356|0),($357|0))|0);
  12925. $359 = tempRet0;
  12926. $360 = (_i64Add(($344|0),($345|0),33554432,0)|0);
  12927. $361 = tempRet0;
  12928. $362 = (_bitshift64Ashr(($360|0),($361|0),26)|0);
  12929. $363 = tempRet0;
  12930. $364 = (_i64Add(($128|0),($129|0),($142|0),($143|0))|0);
  12931. $365 = tempRet0;
  12932. $366 = (_i64Add(($364|0),($365|0),($114|0),($115|0))|0);
  12933. $367 = tempRet0;
  12934. $368 = (_i64Add(($366|0),($367|0),($96|0),($97|0))|0);
  12935. $369 = tempRet0;
  12936. $370 = (_i64Add(($368|0),($369|0),($72|0),($73|0))|0);
  12937. $371 = tempRet0;
  12938. $372 = (_i64Add(($370|0),($371|0),($362|0),($363|0))|0);
  12939. $373 = tempRet0;
  12940. $374 = (_bitshift64Shl(($362|0),($363|0),26)|0);
  12941. $375 = tempRet0;
  12942. $376 = (_i64Subtract(($344|0),($345|0),($374|0),($375|0))|0);
  12943. $377 = tempRet0;
  12944. $378 = (_i64Add(($372|0),($373|0),16777216,0)|0);
  12945. $379 = tempRet0;
  12946. $380 = (_bitshift64Ashr(($378|0),($379|0),25)|0);
  12947. $381 = tempRet0;
  12948. $382 = (___muldi3(($380|0),($381|0),19,0)|0);
  12949. $383 = tempRet0;
  12950. $384 = (_i64Add(($382|0),($383|0),($228|0),($229|0))|0);
  12951. $385 = tempRet0;
  12952. $386 = (_bitshift64Shl(($380|0),($381|0),25)|0);
  12953. $387 = tempRet0;
  12954. $388 = (_i64Subtract(($372|0),($373|0),($386|0),($387|0))|0);
  12955. $389 = tempRet0;
  12956. $390 = (_i64Add(($384|0),($385|0),33554432,0)|0);
  12957. $391 = tempRet0;
  12958. $392 = (_bitshift64Ashr(($390|0),($391|0),26)|0);
  12959. $393 = tempRet0;
  12960. $394 = (_i64Add(($264|0),($265|0),($392|0),($393|0))|0);
  12961. $395 = tempRet0;
  12962. $396 = (_bitshift64Shl(($392|0),($393|0),26)|0);
  12963. $397 = tempRet0;
  12964. $398 = (_i64Subtract(($384|0),($385|0),($396|0),($397|0))|0);
  12965. $399 = tempRet0;
  12966. HEAP32[$h>>2] = $398;
  12967. $400 = (($h) + 4|0);
  12968. HEAP32[$400>>2] = $394;
  12969. $401 = (($h) + 8|0);
  12970. HEAP32[$401>>2] = $300;
  12971. $402 = (($h) + 12|0);
  12972. HEAP32[$402>>2] = $328;
  12973. $403 = (($h) + 16|0);
  12974. HEAP32[$403>>2] = $358;
  12975. $404 = (($h) + 20|0);
  12976. HEAP32[$404>>2] = $354;
  12977. $405 = (($h) + 24|0);
  12978. HEAP32[$405>>2] = $318;
  12979. $406 = (($h) + 28|0);
  12980. HEAP32[$406>>2] = $348;
  12981. $407 = (($h) + 32|0);
  12982. HEAP32[$407>>2] = $376;
  12983. $408 = (($h) + 36|0);
  12984. HEAP32[$408>>2] = $388;
  12985. STACKTOP = sp;return;
  12986. }
  12987. function _crypto_sign_ed25519_ref10_fe_sq2($h,$f) {
  12988. $h = $h|0;
  12989. $f = $f|0;
  12990. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  12991. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  12992. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  12993. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  12994. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  12995. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  12996. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  12997. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  12998. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  12999. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  13000. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  13001. var $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0;
  13002. var $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0;
  13003. var $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0;
  13004. var $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0;
  13005. var $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0;
  13006. var $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0;
  13007. var $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0;
  13008. var $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0;
  13009. var $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0;
  13010. var $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0;
  13011. var $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  13012. sp = STACKTOP;
  13013. $0 = HEAP32[$f>>2]|0;
  13014. $1 = (($f) + 4|0);
  13015. $2 = HEAP32[$1>>2]|0;
  13016. $3 = (($f) + 8|0);
  13017. $4 = HEAP32[$3>>2]|0;
  13018. $5 = (($f) + 12|0);
  13019. $6 = HEAP32[$5>>2]|0;
  13020. $7 = (($f) + 16|0);
  13021. $8 = HEAP32[$7>>2]|0;
  13022. $9 = (($f) + 20|0);
  13023. $10 = HEAP32[$9>>2]|0;
  13024. $11 = (($f) + 24|0);
  13025. $12 = HEAP32[$11>>2]|0;
  13026. $13 = (($f) + 28|0);
  13027. $14 = HEAP32[$13>>2]|0;
  13028. $15 = (($f) + 32|0);
  13029. $16 = HEAP32[$15>>2]|0;
  13030. $17 = (($f) + 36|0);
  13031. $18 = HEAP32[$17>>2]|0;
  13032. $19 = $0 << 1;
  13033. $20 = $2 << 1;
  13034. $21 = $4 << 1;
  13035. $22 = $6 << 1;
  13036. $23 = $8 << 1;
  13037. $24 = $10 << 1;
  13038. $25 = $12 << 1;
  13039. $26 = $14 << 1;
  13040. $27 = ($10*38)|0;
  13041. $28 = ($12*19)|0;
  13042. $29 = ($14*38)|0;
  13043. $30 = ($16*19)|0;
  13044. $31 = ($18*38)|0;
  13045. $32 = ($0|0)<(0);
  13046. $33 = $32 << 31 >> 31;
  13047. $34 = (___muldi3(($0|0),($33|0),($0|0),($33|0))|0);
  13048. $35 = tempRet0;
  13049. $36 = ($19|0)<(0);
  13050. $37 = $36 << 31 >> 31;
  13051. $38 = ($2|0)<(0);
  13052. $39 = $38 << 31 >> 31;
  13053. $40 = (___muldi3(($19|0),($37|0),($2|0),($39|0))|0);
  13054. $41 = tempRet0;
  13055. $42 = ($4|0)<(0);
  13056. $43 = $42 << 31 >> 31;
  13057. $44 = (___muldi3(($4|0),($43|0),($19|0),($37|0))|0);
  13058. $45 = tempRet0;
  13059. $46 = ($6|0)<(0);
  13060. $47 = $46 << 31 >> 31;
  13061. $48 = (___muldi3(($6|0),($47|0),($19|0),($37|0))|0);
  13062. $49 = tempRet0;
  13063. $50 = ($8|0)<(0);
  13064. $51 = $50 << 31 >> 31;
  13065. $52 = (___muldi3(($8|0),($51|0),($19|0),($37|0))|0);
  13066. $53 = tempRet0;
  13067. $54 = ($10|0)<(0);
  13068. $55 = $54 << 31 >> 31;
  13069. $56 = (___muldi3(($10|0),($55|0),($19|0),($37|0))|0);
  13070. $57 = tempRet0;
  13071. $58 = ($12|0)<(0);
  13072. $59 = $58 << 31 >> 31;
  13073. $60 = (___muldi3(($12|0),($59|0),($19|0),($37|0))|0);
  13074. $61 = tempRet0;
  13075. $62 = ($14|0)<(0);
  13076. $63 = $62 << 31 >> 31;
  13077. $64 = (___muldi3(($14|0),($63|0),($19|0),($37|0))|0);
  13078. $65 = tempRet0;
  13079. $66 = ($16|0)<(0);
  13080. $67 = $66 << 31 >> 31;
  13081. $68 = (___muldi3(($16|0),($67|0),($19|0),($37|0))|0);
  13082. $69 = tempRet0;
  13083. $70 = ($18|0)<(0);
  13084. $71 = $70 << 31 >> 31;
  13085. $72 = (___muldi3(($18|0),($71|0),($19|0),($37|0))|0);
  13086. $73 = tempRet0;
  13087. $74 = ($20|0)<(0);
  13088. $75 = $74 << 31 >> 31;
  13089. $76 = (___muldi3(($20|0),($75|0),($2|0),($39|0))|0);
  13090. $77 = tempRet0;
  13091. $78 = (___muldi3(($20|0),($75|0),($4|0),($43|0))|0);
  13092. $79 = tempRet0;
  13093. $80 = ($22|0)<(0);
  13094. $81 = $80 << 31 >> 31;
  13095. $82 = (___muldi3(($22|0),($81|0),($20|0),($75|0))|0);
  13096. $83 = tempRet0;
  13097. $84 = (___muldi3(($8|0),($51|0),($20|0),($75|0))|0);
  13098. $85 = tempRet0;
  13099. $86 = ($24|0)<(0);
  13100. $87 = $86 << 31 >> 31;
  13101. $88 = (___muldi3(($24|0),($87|0),($20|0),($75|0))|0);
  13102. $89 = tempRet0;
  13103. $90 = (___muldi3(($12|0),($59|0),($20|0),($75|0))|0);
  13104. $91 = tempRet0;
  13105. $92 = ($26|0)<(0);
  13106. $93 = $92 << 31 >> 31;
  13107. $94 = (___muldi3(($26|0),($93|0),($20|0),($75|0))|0);
  13108. $95 = tempRet0;
  13109. $96 = (___muldi3(($16|0),($67|0),($20|0),($75|0))|0);
  13110. $97 = tempRet0;
  13111. $98 = ($31|0)<(0);
  13112. $99 = $98 << 31 >> 31;
  13113. $100 = (___muldi3(($31|0),($99|0),($20|0),($75|0))|0);
  13114. $101 = tempRet0;
  13115. $102 = (___muldi3(($4|0),($43|0),($4|0),($43|0))|0);
  13116. $103 = tempRet0;
  13117. $104 = ($21|0)<(0);
  13118. $105 = $104 << 31 >> 31;
  13119. $106 = (___muldi3(($21|0),($105|0),($6|0),($47|0))|0);
  13120. $107 = tempRet0;
  13121. $108 = (___muldi3(($8|0),($51|0),($21|0),($105|0))|0);
  13122. $109 = tempRet0;
  13123. $110 = (___muldi3(($10|0),($55|0),($21|0),($105|0))|0);
  13124. $111 = tempRet0;
  13125. $112 = (___muldi3(($12|0),($59|0),($21|0),($105|0))|0);
  13126. $113 = tempRet0;
  13127. $114 = (___muldi3(($14|0),($63|0),($21|0),($105|0))|0);
  13128. $115 = tempRet0;
  13129. $116 = ($30|0)<(0);
  13130. $117 = $116 << 31 >> 31;
  13131. $118 = (___muldi3(($30|0),($117|0),($21|0),($105|0))|0);
  13132. $119 = tempRet0;
  13133. $120 = (___muldi3(($31|0),($99|0),($4|0),($43|0))|0);
  13134. $121 = tempRet0;
  13135. $122 = (___muldi3(($22|0),($81|0),($6|0),($47|0))|0);
  13136. $123 = tempRet0;
  13137. $124 = (___muldi3(($22|0),($81|0),($8|0),($51|0))|0);
  13138. $125 = tempRet0;
  13139. $126 = (___muldi3(($24|0),($87|0),($22|0),($81|0))|0);
  13140. $127 = tempRet0;
  13141. $128 = (___muldi3(($12|0),($59|0),($22|0),($81|0))|0);
  13142. $129 = tempRet0;
  13143. $130 = ($29|0)<(0);
  13144. $131 = $130 << 31 >> 31;
  13145. $132 = (___muldi3(($29|0),($131|0),($22|0),($81|0))|0);
  13146. $133 = tempRet0;
  13147. $134 = (___muldi3(($30|0),($117|0),($22|0),($81|0))|0);
  13148. $135 = tempRet0;
  13149. $136 = (___muldi3(($31|0),($99|0),($22|0),($81|0))|0);
  13150. $137 = tempRet0;
  13151. $138 = (___muldi3(($8|0),($51|0),($8|0),($51|0))|0);
  13152. $139 = tempRet0;
  13153. $140 = ($23|0)<(0);
  13154. $141 = $140 << 31 >> 31;
  13155. $142 = (___muldi3(($23|0),($141|0),($10|0),($55|0))|0);
  13156. $143 = tempRet0;
  13157. $144 = ($28|0)<(0);
  13158. $145 = $144 << 31 >> 31;
  13159. $146 = (___muldi3(($28|0),($145|0),($23|0),($141|0))|0);
  13160. $147 = tempRet0;
  13161. $148 = (___muldi3(($29|0),($131|0),($8|0),($51|0))|0);
  13162. $149 = tempRet0;
  13163. $150 = (___muldi3(($30|0),($117|0),($23|0),($141|0))|0);
  13164. $151 = tempRet0;
  13165. $152 = (___muldi3(($31|0),($99|0),($8|0),($51|0))|0);
  13166. $153 = tempRet0;
  13167. $154 = ($27|0)<(0);
  13168. $155 = $154 << 31 >> 31;
  13169. $156 = (___muldi3(($27|0),($155|0),($10|0),($55|0))|0);
  13170. $157 = tempRet0;
  13171. $158 = (___muldi3(($28|0),($145|0),($24|0),($87|0))|0);
  13172. $159 = tempRet0;
  13173. $160 = (___muldi3(($29|0),($131|0),($24|0),($87|0))|0);
  13174. $161 = tempRet0;
  13175. $162 = (___muldi3(($30|0),($117|0),($24|0),($87|0))|0);
  13176. $163 = tempRet0;
  13177. $164 = (___muldi3(($31|0),($99|0),($24|0),($87|0))|0);
  13178. $165 = tempRet0;
  13179. $166 = (___muldi3(($28|0),($145|0),($12|0),($59|0))|0);
  13180. $167 = tempRet0;
  13181. $168 = (___muldi3(($29|0),($131|0),($12|0),($59|0))|0);
  13182. $169 = tempRet0;
  13183. $170 = ($25|0)<(0);
  13184. $171 = $170 << 31 >> 31;
  13185. $172 = (___muldi3(($30|0),($117|0),($25|0),($171|0))|0);
  13186. $173 = tempRet0;
  13187. $174 = (___muldi3(($31|0),($99|0),($12|0),($59|0))|0);
  13188. $175 = tempRet0;
  13189. $176 = (___muldi3(($29|0),($131|0),($14|0),($63|0))|0);
  13190. $177 = tempRet0;
  13191. $178 = (___muldi3(($30|0),($117|0),($26|0),($93|0))|0);
  13192. $179 = tempRet0;
  13193. $180 = (___muldi3(($31|0),($99|0),($26|0),($93|0))|0);
  13194. $181 = tempRet0;
  13195. $182 = (___muldi3(($30|0),($117|0),($16|0),($67|0))|0);
  13196. $183 = tempRet0;
  13197. $184 = (___muldi3(($31|0),($99|0),($16|0),($67|0))|0);
  13198. $185 = tempRet0;
  13199. $186 = (___muldi3(($31|0),($99|0),($18|0),($71|0))|0);
  13200. $187 = tempRet0;
  13201. $188 = (_i64Add(($156|0),($157|0),($34|0),($35|0))|0);
  13202. $189 = tempRet0;
  13203. $190 = (_i64Add(($188|0),($189|0),($146|0),($147|0))|0);
  13204. $191 = tempRet0;
  13205. $192 = (_i64Add(($190|0),($191|0),($132|0),($133|0))|0);
  13206. $193 = tempRet0;
  13207. $194 = (_i64Add(($192|0),($193|0),($118|0),($119|0))|0);
  13208. $195 = tempRet0;
  13209. $196 = (_i64Add(($194|0),($195|0),($100|0),($101|0))|0);
  13210. $197 = tempRet0;
  13211. $198 = (_i64Add(($158|0),($159|0),($40|0),($41|0))|0);
  13212. $199 = tempRet0;
  13213. $200 = (_i64Add(($198|0),($199|0),($148|0),($149|0))|0);
  13214. $201 = tempRet0;
  13215. $202 = (_i64Add(($200|0),($201|0),($134|0),($135|0))|0);
  13216. $203 = tempRet0;
  13217. $204 = (_i64Add(($202|0),($203|0),($120|0),($121|0))|0);
  13218. $205 = tempRet0;
  13219. $206 = (_i64Add(($44|0),($45|0),($76|0),($77|0))|0);
  13220. $207 = tempRet0;
  13221. $208 = (_i64Add(($206|0),($207|0),($166|0),($167|0))|0);
  13222. $209 = tempRet0;
  13223. $210 = (_i64Add(($208|0),($209|0),($160|0),($161|0))|0);
  13224. $211 = tempRet0;
  13225. $212 = (_i64Add(($210|0),($211|0),($150|0),($151|0))|0);
  13226. $213 = tempRet0;
  13227. $214 = (_i64Add(($212|0),($213|0),($136|0),($137|0))|0);
  13228. $215 = tempRet0;
  13229. $216 = (_i64Add(($48|0),($49|0),($78|0),($79|0))|0);
  13230. $217 = tempRet0;
  13231. $218 = (_i64Add(($216|0),($217|0),($168|0),($169|0))|0);
  13232. $219 = tempRet0;
  13233. $220 = (_i64Add(($218|0),($219|0),($162|0),($163|0))|0);
  13234. $221 = tempRet0;
  13235. $222 = (_i64Add(($220|0),($221|0),($152|0),($153|0))|0);
  13236. $223 = tempRet0;
  13237. $224 = (_i64Add(($82|0),($83|0),($102|0),($103|0))|0);
  13238. $225 = tempRet0;
  13239. $226 = (_i64Add(($224|0),($225|0),($52|0),($53|0))|0);
  13240. $227 = tempRet0;
  13241. $228 = (_i64Add(($226|0),($227|0),($176|0),($177|0))|0);
  13242. $229 = tempRet0;
  13243. $230 = (_i64Add(($228|0),($229|0),($172|0),($173|0))|0);
  13244. $231 = tempRet0;
  13245. $232 = (_i64Add(($230|0),($231|0),($164|0),($165|0))|0);
  13246. $233 = tempRet0;
  13247. $234 = (_i64Add(($84|0),($85|0),($106|0),($107|0))|0);
  13248. $235 = tempRet0;
  13249. $236 = (_i64Add(($234|0),($235|0),($56|0),($57|0))|0);
  13250. $237 = tempRet0;
  13251. $238 = (_i64Add(($236|0),($237|0),($178|0),($179|0))|0);
  13252. $239 = tempRet0;
  13253. $240 = (_i64Add(($238|0),($239|0),($174|0),($175|0))|0);
  13254. $241 = tempRet0;
  13255. $242 = (_i64Add(($122|0),($123|0),($108|0),($109|0))|0);
  13256. $243 = tempRet0;
  13257. $244 = (_i64Add(($242|0),($243|0),($88|0),($89|0))|0);
  13258. $245 = tempRet0;
  13259. $246 = (_i64Add(($244|0),($245|0),($60|0),($61|0))|0);
  13260. $247 = tempRet0;
  13261. $248 = (_i64Add(($246|0),($247|0),($182|0),($183|0))|0);
  13262. $249 = tempRet0;
  13263. $250 = (_i64Add(($248|0),($249|0),($180|0),($181|0))|0);
  13264. $251 = tempRet0;
  13265. $252 = (_i64Add(($110|0),($111|0),($124|0),($125|0))|0);
  13266. $253 = tempRet0;
  13267. $254 = (_i64Add(($252|0),($253|0),($90|0),($91|0))|0);
  13268. $255 = tempRet0;
  13269. $256 = (_i64Add(($254|0),($255|0),($64|0),($65|0))|0);
  13270. $257 = tempRet0;
  13271. $258 = (_i64Add(($256|0),($257|0),($184|0),($185|0))|0);
  13272. $259 = tempRet0;
  13273. $260 = (_i64Add(($112|0),($113|0),($138|0),($139|0))|0);
  13274. $261 = tempRet0;
  13275. $262 = (_i64Add(($260|0),($261|0),($126|0),($127|0))|0);
  13276. $263 = tempRet0;
  13277. $264 = (_i64Add(($262|0),($263|0),($94|0),($95|0))|0);
  13278. $265 = tempRet0;
  13279. $266 = (_i64Add(($264|0),($265|0),($68|0),($69|0))|0);
  13280. $267 = tempRet0;
  13281. $268 = (_i64Add(($266|0),($267|0),($186|0),($187|0))|0);
  13282. $269 = tempRet0;
  13283. $270 = (_i64Add(($128|0),($129|0),($142|0),($143|0))|0);
  13284. $271 = tempRet0;
  13285. $272 = (_i64Add(($270|0),($271|0),($114|0),($115|0))|0);
  13286. $273 = tempRet0;
  13287. $274 = (_i64Add(($272|0),($273|0),($96|0),($97|0))|0);
  13288. $275 = tempRet0;
  13289. $276 = (_i64Add(($274|0),($275|0),($72|0),($73|0))|0);
  13290. $277 = tempRet0;
  13291. $278 = (_bitshift64Shl(($196|0),($197|0),1)|0);
  13292. $279 = tempRet0;
  13293. $280 = (_bitshift64Shl(($204|0),($205|0),1)|0);
  13294. $281 = tempRet0;
  13295. $282 = (_bitshift64Shl(($214|0),($215|0),1)|0);
  13296. $283 = tempRet0;
  13297. $284 = (_bitshift64Shl(($222|0),($223|0),1)|0);
  13298. $285 = tempRet0;
  13299. $286 = (_bitshift64Shl(($232|0),($233|0),1)|0);
  13300. $287 = tempRet0;
  13301. $288 = (_bitshift64Shl(($240|0),($241|0),1)|0);
  13302. $289 = tempRet0;
  13303. $290 = (_bitshift64Shl(($250|0),($251|0),1)|0);
  13304. $291 = tempRet0;
  13305. $292 = (_bitshift64Shl(($258|0),($259|0),1)|0);
  13306. $293 = tempRet0;
  13307. $294 = (_bitshift64Shl(($268|0),($269|0),1)|0);
  13308. $295 = tempRet0;
  13309. $296 = (_bitshift64Shl(($276|0),($277|0),1)|0);
  13310. $297 = tempRet0;
  13311. $298 = (_i64Add(($278|0),($279|0),33554432,0)|0);
  13312. $299 = tempRet0;
  13313. $300 = (_bitshift64Ashr(($298|0),($299|0),26)|0);
  13314. $301 = tempRet0;
  13315. $302 = (_i64Add(($300|0),($301|0),($280|0),($281|0))|0);
  13316. $303 = tempRet0;
  13317. $304 = (_bitshift64Shl(($300|0),($301|0),26)|0);
  13318. $305 = tempRet0;
  13319. $306 = (_i64Subtract(($278|0),($279|0),($304|0),($305|0))|0);
  13320. $307 = tempRet0;
  13321. $308 = (_i64Add(($286|0),($287|0),33554432,0)|0);
  13322. $309 = tempRet0;
  13323. $310 = (_bitshift64Ashr(($308|0),($309|0),26)|0);
  13324. $311 = tempRet0;
  13325. $312 = (_i64Add(($310|0),($311|0),($288|0),($289|0))|0);
  13326. $313 = tempRet0;
  13327. $314 = (_bitshift64Shl(($310|0),($311|0),26)|0);
  13328. $315 = tempRet0;
  13329. $316 = (_i64Subtract(($286|0),($287|0),($314|0),($315|0))|0);
  13330. $317 = tempRet0;
  13331. $318 = (_i64Add(($302|0),($303|0),16777216,0)|0);
  13332. $319 = tempRet0;
  13333. $320 = (_bitshift64Ashr(($318|0),($319|0),25)|0);
  13334. $321 = tempRet0;
  13335. $322 = (_i64Add(($320|0),($321|0),($282|0),($283|0))|0);
  13336. $323 = tempRet0;
  13337. $324 = (_bitshift64Shl(($320|0),($321|0),25)|0);
  13338. $325 = tempRet0;
  13339. $326 = (_i64Subtract(($302|0),($303|0),($324|0),($325|0))|0);
  13340. $327 = tempRet0;
  13341. $328 = (_i64Add(($312|0),($313|0),16777216,0)|0);
  13342. $329 = tempRet0;
  13343. $330 = (_bitshift64Ashr(($328|0),($329|0),25)|0);
  13344. $331 = tempRet0;
  13345. $332 = (_i64Add(($330|0),($331|0),($290|0),($291|0))|0);
  13346. $333 = tempRet0;
  13347. $334 = (_bitshift64Shl(($330|0),($331|0),25)|0);
  13348. $335 = tempRet0;
  13349. $336 = (_i64Subtract(($312|0),($313|0),($334|0),($335|0))|0);
  13350. $337 = tempRet0;
  13351. $338 = (_i64Add(($322|0),($323|0),33554432,0)|0);
  13352. $339 = tempRet0;
  13353. $340 = (_bitshift64Ashr(($338|0),($339|0),26)|0);
  13354. $341 = tempRet0;
  13355. $342 = (_i64Add(($340|0),($341|0),($284|0),($285|0))|0);
  13356. $343 = tempRet0;
  13357. $344 = (_bitshift64Shl(($340|0),($341|0),26)|0);
  13358. $345 = tempRet0;
  13359. $346 = (_i64Subtract(($322|0),($323|0),($344|0),($345|0))|0);
  13360. $347 = tempRet0;
  13361. $348 = (_i64Add(($332|0),($333|0),33554432,0)|0);
  13362. $349 = tempRet0;
  13363. $350 = (_bitshift64Ashr(($348|0),($349|0),26)|0);
  13364. $351 = tempRet0;
  13365. $352 = (_i64Add(($350|0),($351|0),($292|0),($293|0))|0);
  13366. $353 = tempRet0;
  13367. $354 = (_bitshift64Shl(($350|0),($351|0),26)|0);
  13368. $355 = tempRet0;
  13369. $356 = (_i64Subtract(($332|0),($333|0),($354|0),($355|0))|0);
  13370. $357 = tempRet0;
  13371. $358 = (_i64Add(($342|0),($343|0),16777216,0)|0);
  13372. $359 = tempRet0;
  13373. $360 = (_bitshift64Ashr(($358|0),($359|0),25)|0);
  13374. $361 = tempRet0;
  13375. $362 = (_i64Add(($360|0),($361|0),($316|0),($317|0))|0);
  13376. $363 = tempRet0;
  13377. $364 = (_bitshift64Shl(($360|0),($361|0),25)|0);
  13378. $365 = tempRet0;
  13379. $366 = (_i64Subtract(($342|0),($343|0),($364|0),($365|0))|0);
  13380. $367 = tempRet0;
  13381. $368 = (_i64Add(($352|0),($353|0),16777216,0)|0);
  13382. $369 = tempRet0;
  13383. $370 = (_bitshift64Ashr(($368|0),($369|0),25)|0);
  13384. $371 = tempRet0;
  13385. $372 = (_i64Add(($370|0),($371|0),($294|0),($295|0))|0);
  13386. $373 = tempRet0;
  13387. $374 = (_bitshift64Shl(($370|0),($371|0),25)|0);
  13388. $375 = tempRet0;
  13389. $376 = (_i64Subtract(($352|0),($353|0),($374|0),($375|0))|0);
  13390. $377 = tempRet0;
  13391. $378 = (_i64Add(($362|0),($363|0),33554432,0)|0);
  13392. $379 = tempRet0;
  13393. $380 = (_bitshift64Ashr(($378|0),($379|0),26)|0);
  13394. $381 = tempRet0;
  13395. $382 = (_i64Add(($336|0),($337|0),($380|0),($381|0))|0);
  13396. $383 = tempRet0;
  13397. $384 = (_bitshift64Shl(($380|0),($381|0),26)|0);
  13398. $385 = tempRet0;
  13399. $386 = (_i64Subtract(($362|0),($363|0),($384|0),($385|0))|0);
  13400. $387 = tempRet0;
  13401. $388 = (_i64Add(($372|0),($373|0),33554432,0)|0);
  13402. $389 = tempRet0;
  13403. $390 = (_bitshift64Ashr(($388|0),($389|0),26)|0);
  13404. $391 = tempRet0;
  13405. $392 = (_i64Add(($390|0),($391|0),($296|0),($297|0))|0);
  13406. $393 = tempRet0;
  13407. $394 = (_bitshift64Shl(($390|0),($391|0),26)|0);
  13408. $395 = tempRet0;
  13409. $396 = (_i64Subtract(($372|0),($373|0),($394|0),($395|0))|0);
  13410. $397 = tempRet0;
  13411. $398 = (_i64Add(($392|0),($393|0),16777216,0)|0);
  13412. $399 = tempRet0;
  13413. $400 = (_bitshift64Ashr(($398|0),($399|0),25)|0);
  13414. $401 = tempRet0;
  13415. $402 = (___muldi3(($400|0),($401|0),19,0)|0);
  13416. $403 = tempRet0;
  13417. $404 = (_i64Add(($402|0),($403|0),($306|0),($307|0))|0);
  13418. $405 = tempRet0;
  13419. $406 = (_bitshift64Shl(($400|0),($401|0),25)|0);
  13420. $407 = tempRet0;
  13421. $408 = (_i64Subtract(($392|0),($393|0),($406|0),($407|0))|0);
  13422. $409 = tempRet0;
  13423. $410 = (_i64Add(($404|0),($405|0),33554432,0)|0);
  13424. $411 = tempRet0;
  13425. $412 = (_bitshift64Ashr(($410|0),($411|0),26)|0);
  13426. $413 = tempRet0;
  13427. $414 = (_i64Add(($326|0),($327|0),($412|0),($413|0))|0);
  13428. $415 = tempRet0;
  13429. $416 = (_bitshift64Shl(($412|0),($413|0),26)|0);
  13430. $417 = tempRet0;
  13431. $418 = (_i64Subtract(($404|0),($405|0),($416|0),($417|0))|0);
  13432. $419 = tempRet0;
  13433. HEAP32[$h>>2] = $418;
  13434. $420 = (($h) + 4|0);
  13435. HEAP32[$420>>2] = $414;
  13436. $421 = (($h) + 8|0);
  13437. HEAP32[$421>>2] = $346;
  13438. $422 = (($h) + 12|0);
  13439. HEAP32[$422>>2] = $366;
  13440. $423 = (($h) + 16|0);
  13441. HEAP32[$423>>2] = $386;
  13442. $424 = (($h) + 20|0);
  13443. HEAP32[$424>>2] = $382;
  13444. $425 = (($h) + 24|0);
  13445. HEAP32[$425>>2] = $356;
  13446. $426 = (($h) + 28|0);
  13447. HEAP32[$426>>2] = $376;
  13448. $427 = (($h) + 32|0);
  13449. HEAP32[$427>>2] = $396;
  13450. $428 = (($h) + 36|0);
  13451. HEAP32[$428>>2] = $408;
  13452. STACKTOP = sp;return;
  13453. }
  13454. function _crypto_sign_ed25519_ref10_fe_sub($h,$f,$g) {
  13455. $h = $h|0;
  13456. $f = $f|0;
  13457. $g = $g|0;
  13458. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  13459. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0;
  13460. var $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  13461. sp = STACKTOP;
  13462. $0 = HEAP32[$f>>2]|0;
  13463. $1 = (($f) + 4|0);
  13464. $2 = HEAP32[$1>>2]|0;
  13465. $3 = (($f) + 8|0);
  13466. $4 = HEAP32[$3>>2]|0;
  13467. $5 = (($f) + 12|0);
  13468. $6 = HEAP32[$5>>2]|0;
  13469. $7 = (($f) + 16|0);
  13470. $8 = HEAP32[$7>>2]|0;
  13471. $9 = (($f) + 20|0);
  13472. $10 = HEAP32[$9>>2]|0;
  13473. $11 = (($f) + 24|0);
  13474. $12 = HEAP32[$11>>2]|0;
  13475. $13 = (($f) + 28|0);
  13476. $14 = HEAP32[$13>>2]|0;
  13477. $15 = (($f) + 32|0);
  13478. $16 = HEAP32[$15>>2]|0;
  13479. $17 = (($f) + 36|0);
  13480. $18 = HEAP32[$17>>2]|0;
  13481. $19 = HEAP32[$g>>2]|0;
  13482. $20 = (($g) + 4|0);
  13483. $21 = HEAP32[$20>>2]|0;
  13484. $22 = (($g) + 8|0);
  13485. $23 = HEAP32[$22>>2]|0;
  13486. $24 = (($g) + 12|0);
  13487. $25 = HEAP32[$24>>2]|0;
  13488. $26 = (($g) + 16|0);
  13489. $27 = HEAP32[$26>>2]|0;
  13490. $28 = (($g) + 20|0);
  13491. $29 = HEAP32[$28>>2]|0;
  13492. $30 = (($g) + 24|0);
  13493. $31 = HEAP32[$30>>2]|0;
  13494. $32 = (($g) + 28|0);
  13495. $33 = HEAP32[$32>>2]|0;
  13496. $34 = (($g) + 32|0);
  13497. $35 = HEAP32[$34>>2]|0;
  13498. $36 = (($g) + 36|0);
  13499. $37 = HEAP32[$36>>2]|0;
  13500. $38 = (($0) - ($19))|0;
  13501. $39 = (($2) - ($21))|0;
  13502. $40 = (($4) - ($23))|0;
  13503. $41 = (($6) - ($25))|0;
  13504. $42 = (($8) - ($27))|0;
  13505. $43 = (($10) - ($29))|0;
  13506. $44 = (($12) - ($31))|0;
  13507. $45 = (($14) - ($33))|0;
  13508. $46 = (($16) - ($35))|0;
  13509. $47 = (($18) - ($37))|0;
  13510. HEAP32[$h>>2] = $38;
  13511. $48 = (($h) + 4|0);
  13512. HEAP32[$48>>2] = $39;
  13513. $49 = (($h) + 8|0);
  13514. HEAP32[$49>>2] = $40;
  13515. $50 = (($h) + 12|0);
  13516. HEAP32[$50>>2] = $41;
  13517. $51 = (($h) + 16|0);
  13518. HEAP32[$51>>2] = $42;
  13519. $52 = (($h) + 20|0);
  13520. HEAP32[$52>>2] = $43;
  13521. $53 = (($h) + 24|0);
  13522. HEAP32[$53>>2] = $44;
  13523. $54 = (($h) + 28|0);
  13524. HEAP32[$54>>2] = $45;
  13525. $55 = (($h) + 32|0);
  13526. HEAP32[$55>>2] = $46;
  13527. $56 = (($h) + 36|0);
  13528. HEAP32[$56>>2] = $47;
  13529. STACKTOP = sp;return;
  13530. }
  13531. function _crypto_sign_ed25519_ref10_fe_tobytes($s,$h) {
  13532. $s = $s|0;
  13533. $h = $h|0;
  13534. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  13535. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  13536. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  13537. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  13538. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  13539. var $189 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0;
  13540. var $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0;
  13541. var $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0;
  13542. var $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0;
  13543. var $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, label = 0, sp = 0;
  13544. sp = STACKTOP;
  13545. $0 = HEAP32[$h>>2]|0;
  13546. $1 = (($h) + 4|0);
  13547. $2 = HEAP32[$1>>2]|0;
  13548. $3 = (($h) + 8|0);
  13549. $4 = HEAP32[$3>>2]|0;
  13550. $5 = (($h) + 12|0);
  13551. $6 = HEAP32[$5>>2]|0;
  13552. $7 = (($h) + 16|0);
  13553. $8 = HEAP32[$7>>2]|0;
  13554. $9 = (($h) + 20|0);
  13555. $10 = HEAP32[$9>>2]|0;
  13556. $11 = (($h) + 24|0);
  13557. $12 = HEAP32[$11>>2]|0;
  13558. $13 = (($h) + 28|0);
  13559. $14 = HEAP32[$13>>2]|0;
  13560. $15 = (($h) + 32|0);
  13561. $16 = HEAP32[$15>>2]|0;
  13562. $17 = (($h) + 36|0);
  13563. $18 = HEAP32[$17>>2]|0;
  13564. $19 = ($18*19)|0;
  13565. $20 = (($19) + 16777216)|0;
  13566. $21 = $20 >> 25;
  13567. $22 = (($21) + ($0))|0;
  13568. $23 = $22 >> 26;
  13569. $24 = (($23) + ($2))|0;
  13570. $25 = $24 >> 25;
  13571. $26 = (($25) + ($4))|0;
  13572. $27 = $26 >> 26;
  13573. $28 = (($27) + ($6))|0;
  13574. $29 = $28 >> 25;
  13575. $30 = (($29) + ($8))|0;
  13576. $31 = $30 >> 26;
  13577. $32 = (($31) + ($10))|0;
  13578. $33 = $32 >> 25;
  13579. $34 = (($33) + ($12))|0;
  13580. $35 = $34 >> 26;
  13581. $36 = (($35) + ($14))|0;
  13582. $37 = $36 >> 25;
  13583. $38 = (($37) + ($16))|0;
  13584. $39 = $38 >> 26;
  13585. $40 = (($39) + ($18))|0;
  13586. $41 = $40 >> 25;
  13587. $42 = ($41*19)|0;
  13588. $43 = (($42) + ($0))|0;
  13589. $44 = $43 >> 26;
  13590. $45 = (($44) + ($2))|0;
  13591. $46 = $44 << 26;
  13592. $47 = (($43) - ($46))|0;
  13593. $48 = $45 >> 25;
  13594. $49 = (($48) + ($4))|0;
  13595. $50 = $48 << 25;
  13596. $51 = (($45) - ($50))|0;
  13597. $52 = $49 >> 26;
  13598. $53 = (($52) + ($6))|0;
  13599. $54 = $52 << 26;
  13600. $55 = (($49) - ($54))|0;
  13601. $56 = $53 >> 25;
  13602. $57 = (($56) + ($8))|0;
  13603. $58 = $56 << 25;
  13604. $59 = (($53) - ($58))|0;
  13605. $60 = $57 >> 26;
  13606. $61 = (($60) + ($10))|0;
  13607. $62 = $60 << 26;
  13608. $63 = (($57) - ($62))|0;
  13609. $64 = $61 >> 25;
  13610. $65 = (($64) + ($12))|0;
  13611. $66 = $64 << 25;
  13612. $67 = (($61) - ($66))|0;
  13613. $68 = $65 >> 26;
  13614. $69 = (($68) + ($14))|0;
  13615. $70 = $68 << 26;
  13616. $71 = (($65) - ($70))|0;
  13617. $72 = $69 >> 25;
  13618. $73 = (($72) + ($16))|0;
  13619. $74 = $72 << 25;
  13620. $75 = (($69) - ($74))|0;
  13621. $76 = $73 >> 26;
  13622. $77 = (($76) + ($18))|0;
  13623. $78 = $76 << 26;
  13624. $79 = (($73) - ($78))|0;
  13625. $80 = $77 & 33554431;
  13626. $81 = $47&255;
  13627. HEAP8[$s>>0] = $81;
  13628. $82 = $47 >>> 8;
  13629. $83 = $82&255;
  13630. $84 = (($s) + 1|0);
  13631. HEAP8[$84>>0] = $83;
  13632. $85 = $47 >>> 16;
  13633. $86 = $85&255;
  13634. $87 = (($s) + 2|0);
  13635. HEAP8[$87>>0] = $86;
  13636. $88 = $47 >>> 24;
  13637. $89 = $51 << 2;
  13638. $90 = $89 | $88;
  13639. $91 = $90&255;
  13640. $92 = (($s) + 3|0);
  13641. HEAP8[$92>>0] = $91;
  13642. $93 = $51 >>> 6;
  13643. $94 = $93&255;
  13644. $95 = (($s) + 4|0);
  13645. HEAP8[$95>>0] = $94;
  13646. $96 = $51 >>> 14;
  13647. $97 = $96&255;
  13648. $98 = (($s) + 5|0);
  13649. HEAP8[$98>>0] = $97;
  13650. $99 = $51 >>> 22;
  13651. $100 = $55 << 3;
  13652. $101 = $100 | $99;
  13653. $102 = $101&255;
  13654. $103 = (($s) + 6|0);
  13655. HEAP8[$103>>0] = $102;
  13656. $104 = $55 >>> 5;
  13657. $105 = $104&255;
  13658. $106 = (($s) + 7|0);
  13659. HEAP8[$106>>0] = $105;
  13660. $107 = $55 >>> 13;
  13661. $108 = $107&255;
  13662. $109 = (($s) + 8|0);
  13663. HEAP8[$109>>0] = $108;
  13664. $110 = $55 >>> 21;
  13665. $111 = $59 << 5;
  13666. $112 = $111 | $110;
  13667. $113 = $112&255;
  13668. $114 = (($s) + 9|0);
  13669. HEAP8[$114>>0] = $113;
  13670. $115 = $59 >>> 3;
  13671. $116 = $115&255;
  13672. $117 = (($s) + 10|0);
  13673. HEAP8[$117>>0] = $116;
  13674. $118 = $59 >>> 11;
  13675. $119 = $118&255;
  13676. $120 = (($s) + 11|0);
  13677. HEAP8[$120>>0] = $119;
  13678. $121 = $59 >>> 19;
  13679. $122 = $63 << 6;
  13680. $123 = $122 | $121;
  13681. $124 = $123&255;
  13682. $125 = (($s) + 12|0);
  13683. HEAP8[$125>>0] = $124;
  13684. $126 = $63 >>> 2;
  13685. $127 = $126&255;
  13686. $128 = (($s) + 13|0);
  13687. HEAP8[$128>>0] = $127;
  13688. $129 = $63 >>> 10;
  13689. $130 = $129&255;
  13690. $131 = (($s) + 14|0);
  13691. HEAP8[$131>>0] = $130;
  13692. $132 = $63 >>> 18;
  13693. $133 = $132&255;
  13694. $134 = (($s) + 15|0);
  13695. HEAP8[$134>>0] = $133;
  13696. $135 = $67&255;
  13697. $136 = (($s) + 16|0);
  13698. HEAP8[$136>>0] = $135;
  13699. $137 = $67 >>> 8;
  13700. $138 = $137&255;
  13701. $139 = (($s) + 17|0);
  13702. HEAP8[$139>>0] = $138;
  13703. $140 = $67 >>> 16;
  13704. $141 = $140&255;
  13705. $142 = (($s) + 18|0);
  13706. HEAP8[$142>>0] = $141;
  13707. $143 = $67 >>> 24;
  13708. $144 = $71 << 1;
  13709. $145 = $144 | $143;
  13710. $146 = $145&255;
  13711. $147 = (($s) + 19|0);
  13712. HEAP8[$147>>0] = $146;
  13713. $148 = $71 >>> 7;
  13714. $149 = $148&255;
  13715. $150 = (($s) + 20|0);
  13716. HEAP8[$150>>0] = $149;
  13717. $151 = $71 >>> 15;
  13718. $152 = $151&255;
  13719. $153 = (($s) + 21|0);
  13720. HEAP8[$153>>0] = $152;
  13721. $154 = $71 >>> 23;
  13722. $155 = $75 << 3;
  13723. $156 = $155 | $154;
  13724. $157 = $156&255;
  13725. $158 = (($s) + 22|0);
  13726. HEAP8[$158>>0] = $157;
  13727. $159 = $75 >>> 5;
  13728. $160 = $159&255;
  13729. $161 = (($s) + 23|0);
  13730. HEAP8[$161>>0] = $160;
  13731. $162 = $75 >>> 13;
  13732. $163 = $162&255;
  13733. $164 = (($s) + 24|0);
  13734. HEAP8[$164>>0] = $163;
  13735. $165 = $75 >>> 21;
  13736. $166 = $79 << 4;
  13737. $167 = $166 | $165;
  13738. $168 = $167&255;
  13739. $169 = (($s) + 25|0);
  13740. HEAP8[$169>>0] = $168;
  13741. $170 = $79 >>> 4;
  13742. $171 = $170&255;
  13743. $172 = (($s) + 26|0);
  13744. HEAP8[$172>>0] = $171;
  13745. $173 = $79 >>> 12;
  13746. $174 = $173&255;
  13747. $175 = (($s) + 27|0);
  13748. HEAP8[$175>>0] = $174;
  13749. $176 = $79 >>> 20;
  13750. $177 = $80 << 6;
  13751. $178 = $176 | $177;
  13752. $179 = $178&255;
  13753. $180 = (($s) + 28|0);
  13754. HEAP8[$180>>0] = $179;
  13755. $181 = $77 >>> 2;
  13756. $182 = $181&255;
  13757. $183 = (($s) + 29|0);
  13758. HEAP8[$183>>0] = $182;
  13759. $184 = $77 >>> 10;
  13760. $185 = $184&255;
  13761. $186 = (($s) + 30|0);
  13762. HEAP8[$186>>0] = $185;
  13763. $187 = $80 >>> 18;
  13764. $188 = $187&255;
  13765. $189 = (($s) + 31|0);
  13766. HEAP8[$189>>0] = $188;
  13767. STACKTOP = sp;return;
  13768. }
  13769. function _crypto_sign_ed25519_ref10_ge_add($r,$p,$q) {
  13770. $r = $r|0;
  13771. $p = $p|0;
  13772. $q = $q|0;
  13773. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $t0 = 0, label = 0, sp = 0;
  13774. sp = STACKTOP;
  13775. STACKTOP = STACKTOP + 48|0;
  13776. $t0 = sp;
  13777. $0 = (($p) + 40|0);
  13778. _crypto_sign_ed25519_ref10_fe_add($r,$0,$p);
  13779. $1 = (($r) + 40|0);
  13780. _crypto_sign_ed25519_ref10_fe_sub($1,$0,$p);
  13781. $2 = (($r) + 80|0);
  13782. _crypto_sign_ed25519_ref10_fe_mul($2,$r,$q);
  13783. $3 = (($q) + 40|0);
  13784. _crypto_sign_ed25519_ref10_fe_mul($1,$1,$3);
  13785. $4 = (($r) + 120|0);
  13786. $5 = (($q) + 120|0);
  13787. $6 = (($p) + 120|0);
  13788. _crypto_sign_ed25519_ref10_fe_mul($4,$5,$6);
  13789. $7 = (($p) + 80|0);
  13790. $8 = (($q) + 80|0);
  13791. _crypto_sign_ed25519_ref10_fe_mul($r,$7,$8);
  13792. _crypto_sign_ed25519_ref10_fe_add($t0,$r,$r);
  13793. _crypto_sign_ed25519_ref10_fe_sub($r,$2,$1);
  13794. _crypto_sign_ed25519_ref10_fe_add($1,$2,$1);
  13795. _crypto_sign_ed25519_ref10_fe_add($2,$t0,$4);
  13796. _crypto_sign_ed25519_ref10_fe_sub($4,$t0,$4);
  13797. STACKTOP = sp;return;
  13798. }
  13799. function _crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime($r,$a,$A,$b) {
  13800. $r = $r|0;
  13801. $a = $a|0;
  13802. $A = $A|0;
  13803. $b = $b|0;
  13804. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  13805. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $5 = 0, $6 = 0, $7 = 0;
  13806. var $8 = 0, $9 = 0, $A2 = 0, $Ai = 0, $aslide = 0, $bslide = 0, $i$0$lcssa = 0, $i$02 = 0, $i$11 = 0, $t = 0, $u = 0, label = 0, sp = 0;
  13807. sp = STACKTOP;
  13808. STACKTOP = STACKTOP + 2272|0;
  13809. $aslide = sp + 2016|0;
  13810. $bslide = sp + 1760|0;
  13811. $Ai = sp + 480|0;
  13812. $t = sp + 320|0;
  13813. $u = sp + 160|0;
  13814. $A2 = sp;
  13815. _slide($aslide,$a);
  13816. _slide($bslide,$b);
  13817. _crypto_sign_ed25519_ref10_ge_p3_to_cached($Ai,$A);
  13818. _crypto_sign_ed25519_ref10_ge_p3_dbl($t,$A);
  13819. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($A2,$t);
  13820. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$Ai);
  13821. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13822. $0 = (($Ai) + 160|0);
  13823. _crypto_sign_ed25519_ref10_ge_p3_to_cached($0,$u);
  13824. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$0);
  13825. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13826. $1 = (($Ai) + 320|0);
  13827. _crypto_sign_ed25519_ref10_ge_p3_to_cached($1,$u);
  13828. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$1);
  13829. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13830. $2 = (($Ai) + 480|0);
  13831. _crypto_sign_ed25519_ref10_ge_p3_to_cached($2,$u);
  13832. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$2);
  13833. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13834. $3 = (($Ai) + 640|0);
  13835. _crypto_sign_ed25519_ref10_ge_p3_to_cached($3,$u);
  13836. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$3);
  13837. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13838. $4 = (($Ai) + 800|0);
  13839. _crypto_sign_ed25519_ref10_ge_p3_to_cached($4,$u);
  13840. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$4);
  13841. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13842. $5 = (($Ai) + 960|0);
  13843. _crypto_sign_ed25519_ref10_ge_p3_to_cached($5,$u);
  13844. _crypto_sign_ed25519_ref10_ge_add($t,$A2,$5);
  13845. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13846. $6 = (($Ai) + 1120|0);
  13847. _crypto_sign_ed25519_ref10_ge_p3_to_cached($6,$u);
  13848. _crypto_sign_ed25519_ref10_ge_p2_0($r);
  13849. $i$02 = 255;
  13850. while(1) {
  13851. $8 = (($aslide) + ($i$02)|0);
  13852. $9 = HEAP8[$8>>0]|0;
  13853. $10 = ($9<<24>>24)==(0);
  13854. if (!($10)) {
  13855. $i$0$lcssa = $i$02;
  13856. break;
  13857. }
  13858. $11 = (($bslide) + ($i$02)|0);
  13859. $12 = HEAP8[$11>>0]|0;
  13860. $13 = ($12<<24>>24)==(0);
  13861. $14 = (($i$02) + -1)|0;
  13862. if (!($13)) {
  13863. $i$0$lcssa = $i$02;
  13864. break;
  13865. }
  13866. $7 = ($i$02|0)>(0);
  13867. if ($7) {
  13868. $i$02 = $14;
  13869. } else {
  13870. $i$0$lcssa = $14;
  13871. break;
  13872. }
  13873. }
  13874. $15 = ($i$0$lcssa|0)>(-1);
  13875. if ($15) {
  13876. $i$11 = $i$0$lcssa;
  13877. } else {
  13878. STACKTOP = sp;return;
  13879. }
  13880. while(1) {
  13881. _crypto_sign_ed25519_ref10_ge_p2_dbl($t,$r);
  13882. $16 = (($aslide) + ($i$11)|0);
  13883. $17 = HEAP8[$16>>0]|0;
  13884. $18 = ($17<<24>>24)>(0);
  13885. if ($18) {
  13886. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13887. $19 = HEAP8[$16>>0]|0;
  13888. $20 = $19 << 24 >> 24;
  13889. $21 = (($20|0) / 2)&-1;
  13890. $22 = (($Ai) + (($21*160)|0)|0);
  13891. _crypto_sign_ed25519_ref10_ge_add($t,$u,$22);
  13892. } else {
  13893. $23 = ($17<<24>>24)<(0);
  13894. if ($23) {
  13895. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13896. $24 = HEAP8[$16>>0]|0;
  13897. $25 = $24 << 24 >> 24;
  13898. $26 = (($25|0) / -2)&-1;
  13899. $27 = (($Ai) + (($26*160)|0)|0);
  13900. _crypto_sign_ed25519_ref10_ge_sub($t,$u,$27);
  13901. }
  13902. }
  13903. $28 = (($bslide) + ($i$11)|0);
  13904. $29 = HEAP8[$28>>0]|0;
  13905. $30 = ($29<<24>>24)>(0);
  13906. if ($30) {
  13907. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13908. $31 = HEAP8[$28>>0]|0;
  13909. $32 = $31 << 24 >> 24;
  13910. $33 = (($32|0) / 2)&-1;
  13911. $34 = (40 + (($33*120)|0)|0);
  13912. _crypto_sign_ed25519_ref10_ge_madd($t,$u,$34);
  13913. } else {
  13914. $35 = ($29<<24>>24)<(0);
  13915. if ($35) {
  13916. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($u,$t);
  13917. $36 = HEAP8[$28>>0]|0;
  13918. $37 = $36 << 24 >> 24;
  13919. $38 = (($37|0) / -2)&-1;
  13920. $39 = (40 + (($38*120)|0)|0);
  13921. _crypto_sign_ed25519_ref10_ge_msub($t,$u,$39);
  13922. }
  13923. }
  13924. _crypto_sign_ed25519_ref10_ge_p1p1_to_p2($r,$t);
  13925. $40 = (($i$11) + -1)|0;
  13926. $41 = ($i$11|0)>(0);
  13927. if ($41) {
  13928. $i$11 = $40;
  13929. } else {
  13930. break;
  13931. }
  13932. }
  13933. STACKTOP = sp;return;
  13934. }
  13935. function _slide($r,$a) {
  13936. $r = $r|0;
  13937. $a = $a|0;
  13938. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  13939. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $b$03 = 0, $exitcond = 0, $exitcond10 = 0;
  13940. var $i$08 = 0, $i$15 = 0, $k$01 = 0, label = 0, sp = 0;
  13941. sp = STACKTOP;
  13942. $i$08 = 0;
  13943. while(1) {
  13944. $0 = $i$08 >> 3;
  13945. $1 = (($a) + ($0)|0);
  13946. $2 = HEAP8[$1>>0]|0;
  13947. $3 = $2&255;
  13948. $4 = $i$08 & 7;
  13949. $5 = $3 >>> $4;
  13950. $6 = $5 & 1;
  13951. $7 = $6&255;
  13952. $8 = (($r) + ($i$08)|0);
  13953. HEAP8[$8>>0] = $7;
  13954. $9 = (($i$08) + 1)|0;
  13955. $exitcond10 = ($9|0)==(256);
  13956. if ($exitcond10) {
  13957. $i$15 = 0;
  13958. break;
  13959. } else {
  13960. $i$08 = $9;
  13961. }
  13962. }
  13963. while(1) {
  13964. $10 = (($r) + ($i$15)|0);
  13965. $11 = HEAP8[$10>>0]|0;
  13966. $12 = ($11<<24>>24)==(0);
  13967. L5: do {
  13968. if (!($12)) {
  13969. $b$03 = 1;
  13970. while(1) {
  13971. $13 = (($b$03) + ($i$15))|0;
  13972. $14 = ($13|0)<(256);
  13973. if (!($14)) {
  13974. break L5;
  13975. }
  13976. $15 = (($r) + ($13)|0);
  13977. $16 = HEAP8[$15>>0]|0;
  13978. $17 = ($16<<24>>24)==(0);
  13979. L9: do {
  13980. if (!($17)) {
  13981. $18 = HEAP8[$10>>0]|0;
  13982. $19 = $18 << 24 >> 24;
  13983. $20 = $16 << 24 >> 24;
  13984. $21 = $20 << $b$03;
  13985. $22 = (($19) + ($21))|0;
  13986. $23 = ($22|0)<(16);
  13987. if ($23) {
  13988. $24 = $22&255;
  13989. HEAP8[$10>>0] = $24;
  13990. HEAP8[$15>>0] = 0;
  13991. break;
  13992. }
  13993. $25 = (($19) - ($21))|0;
  13994. $26 = ($25|0)>(-16);
  13995. if (!($26)) {
  13996. break L5;
  13997. }
  13998. $27 = $25&255;
  13999. HEAP8[$10>>0] = $27;
  14000. $28 = ($13|0)<(256);
  14001. if ($28) {
  14002. $k$01 = $13;
  14003. while(1) {
  14004. $29 = (($r) + ($k$01)|0);
  14005. $30 = HEAP8[$29>>0]|0;
  14006. $31 = ($30<<24>>24)==(0);
  14007. if ($31) {
  14008. break;
  14009. }
  14010. HEAP8[$29>>0] = 0;
  14011. $32 = (($k$01) + 1)|0;
  14012. $33 = ($32|0)<(256);
  14013. if ($33) {
  14014. $k$01 = $32;
  14015. } else {
  14016. break L9;
  14017. }
  14018. }
  14019. HEAP8[$29>>0] = 1;
  14020. }
  14021. }
  14022. } while(0);
  14023. $34 = (($b$03) + 1)|0;
  14024. $35 = ($34|0)<(7);
  14025. if ($35) {
  14026. $b$03 = $34;
  14027. } else {
  14028. break;
  14029. }
  14030. }
  14031. }
  14032. } while(0);
  14033. $36 = (($i$15) + 1)|0;
  14034. $exitcond = ($36|0)==(256);
  14035. if ($exitcond) {
  14036. break;
  14037. } else {
  14038. $i$15 = $36;
  14039. }
  14040. }
  14041. STACKTOP = sp;return;
  14042. }
  14043. function _crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime($h,$s) {
  14044. $h = $h|0;
  14045. $s = $s|0;
  14046. var $$0 = 0, $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $check = 0, $u = 0, $v = 0, $v3 = 0, $vxx = 0, label = 0;
  14047. var sp = 0;
  14048. sp = STACKTOP;
  14049. STACKTOP = STACKTOP + 208|0;
  14050. $u = sp + 160|0;
  14051. $v = sp + 120|0;
  14052. $v3 = sp + 80|0;
  14053. $vxx = sp + 40|0;
  14054. $check = sp;
  14055. $0 = (($h) + 40|0);
  14056. _crypto_sign_ed25519_ref10_fe_frombytes($0,$s);
  14057. $1 = (($h) + 80|0);
  14058. _crypto_sign_ed25519_ref10_fe_1($1);
  14059. _crypto_sign_ed25519_ref10_fe_sq($u,$0);
  14060. _crypto_sign_ed25519_ref10_fe_mul($v,$u,1000);
  14061. _crypto_sign_ed25519_ref10_fe_sub($u,$u,$1);
  14062. _crypto_sign_ed25519_ref10_fe_add($v,$v,$1);
  14063. _crypto_sign_ed25519_ref10_fe_sq($v3,$v);
  14064. _crypto_sign_ed25519_ref10_fe_mul($v3,$v3,$v);
  14065. _crypto_sign_ed25519_ref10_fe_sq($h,$v3);
  14066. _crypto_sign_ed25519_ref10_fe_mul($h,$h,$v);
  14067. _crypto_sign_ed25519_ref10_fe_mul($h,$h,$u);
  14068. _crypto_sign_ed25519_ref10_fe_pow22523($h,$h);
  14069. _crypto_sign_ed25519_ref10_fe_mul($h,$h,$v3);
  14070. _crypto_sign_ed25519_ref10_fe_mul($h,$h,$u);
  14071. _crypto_sign_ed25519_ref10_fe_sq($vxx,$h);
  14072. _crypto_sign_ed25519_ref10_fe_mul($vxx,$vxx,$v);
  14073. _crypto_sign_ed25519_ref10_fe_sub($check,$vxx,$u);
  14074. $2 = (_crypto_sign_ed25519_ref10_fe_isnonzero($check)|0);
  14075. $3 = ($2|0)==(0);
  14076. do {
  14077. if (!($3)) {
  14078. _crypto_sign_ed25519_ref10_fe_add($check,$vxx,$u);
  14079. $4 = (_crypto_sign_ed25519_ref10_fe_isnonzero($check)|0);
  14080. $5 = ($4|0)==(0);
  14081. if ($5) {
  14082. _crypto_sign_ed25519_ref10_fe_mul($h,$h,1040);
  14083. break;
  14084. } else {
  14085. $$0 = -1;
  14086. STACKTOP = sp;return ($$0|0);
  14087. }
  14088. }
  14089. } while(0);
  14090. $6 = (_crypto_sign_ed25519_ref10_fe_isnegative($h)|0);
  14091. $7 = (($s) + 31|0);
  14092. $8 = HEAP8[$7>>0]|0;
  14093. $9 = $8&255;
  14094. $10 = $9 >>> 7;
  14095. $11 = ($6|0)==($10|0);
  14096. if ($11) {
  14097. _crypto_sign_ed25519_ref10_fe_neg($h,$h);
  14098. }
  14099. $12 = (($h) + 120|0);
  14100. _crypto_sign_ed25519_ref10_fe_mul($12,$h,$0);
  14101. $$0 = 0;
  14102. STACKTOP = sp;return ($$0|0);
  14103. }
  14104. function _crypto_sign_ed25519_ref10_ge_madd($r,$p,$q) {
  14105. $r = $r|0;
  14106. $p = $p|0;
  14107. $q = $q|0;
  14108. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $t0 = 0, label = 0, sp = 0;
  14109. sp = STACKTOP;
  14110. STACKTOP = STACKTOP + 48|0;
  14111. $t0 = sp;
  14112. $0 = (($p) + 40|0);
  14113. _crypto_sign_ed25519_ref10_fe_add($r,$0,$p);
  14114. $1 = (($r) + 40|0);
  14115. _crypto_sign_ed25519_ref10_fe_sub($1,$0,$p);
  14116. $2 = (($r) + 80|0);
  14117. _crypto_sign_ed25519_ref10_fe_mul($2,$r,$q);
  14118. $3 = (($q) + 40|0);
  14119. _crypto_sign_ed25519_ref10_fe_mul($1,$1,$3);
  14120. $4 = (($r) + 120|0);
  14121. $5 = (($q) + 80|0);
  14122. $6 = (($p) + 120|0);
  14123. _crypto_sign_ed25519_ref10_fe_mul($4,$5,$6);
  14124. $7 = (($p) + 80|0);
  14125. _crypto_sign_ed25519_ref10_fe_add($t0,$7,$7);
  14126. _crypto_sign_ed25519_ref10_fe_sub($r,$2,$1);
  14127. _crypto_sign_ed25519_ref10_fe_add($1,$2,$1);
  14128. _crypto_sign_ed25519_ref10_fe_add($2,$t0,$4);
  14129. _crypto_sign_ed25519_ref10_fe_sub($4,$t0,$4);
  14130. STACKTOP = sp;return;
  14131. }
  14132. function _crypto_sign_ed25519_ref10_ge_msub($r,$p,$q) {
  14133. $r = $r|0;
  14134. $p = $p|0;
  14135. $q = $q|0;
  14136. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $t0 = 0, label = 0, sp = 0;
  14137. sp = STACKTOP;
  14138. STACKTOP = STACKTOP + 48|0;
  14139. $t0 = sp;
  14140. $0 = (($p) + 40|0);
  14141. _crypto_sign_ed25519_ref10_fe_add($r,$0,$p);
  14142. $1 = (($r) + 40|0);
  14143. _crypto_sign_ed25519_ref10_fe_sub($1,$0,$p);
  14144. $2 = (($r) + 80|0);
  14145. $3 = (($q) + 40|0);
  14146. _crypto_sign_ed25519_ref10_fe_mul($2,$r,$3);
  14147. _crypto_sign_ed25519_ref10_fe_mul($1,$1,$q);
  14148. $4 = (($r) + 120|0);
  14149. $5 = (($q) + 80|0);
  14150. $6 = (($p) + 120|0);
  14151. _crypto_sign_ed25519_ref10_fe_mul($4,$5,$6);
  14152. $7 = (($p) + 80|0);
  14153. _crypto_sign_ed25519_ref10_fe_add($t0,$7,$7);
  14154. _crypto_sign_ed25519_ref10_fe_sub($r,$2,$1);
  14155. _crypto_sign_ed25519_ref10_fe_add($1,$2,$1);
  14156. _crypto_sign_ed25519_ref10_fe_sub($2,$t0,$4);
  14157. _crypto_sign_ed25519_ref10_fe_add($4,$t0,$4);
  14158. STACKTOP = sp;return;
  14159. }
  14160. function _crypto_sign_ed25519_ref10_ge_p1p1_to_p2($r,$p) {
  14161. $r = $r|0;
  14162. $p = $p|0;
  14163. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, label = 0, sp = 0;
  14164. sp = STACKTOP;
  14165. $0 = (($p) + 120|0);
  14166. _crypto_sign_ed25519_ref10_fe_mul($r,$p,$0);
  14167. $1 = (($r) + 40|0);
  14168. $2 = (($p) + 40|0);
  14169. $3 = (($p) + 80|0);
  14170. _crypto_sign_ed25519_ref10_fe_mul($1,$2,$3);
  14171. $4 = (($r) + 80|0);
  14172. _crypto_sign_ed25519_ref10_fe_mul($4,$3,$0);
  14173. STACKTOP = sp;return;
  14174. }
  14175. function _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($r,$p) {
  14176. $r = $r|0;
  14177. $p = $p|0;
  14178. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, label = 0, sp = 0;
  14179. sp = STACKTOP;
  14180. $0 = (($p) + 120|0);
  14181. _crypto_sign_ed25519_ref10_fe_mul($r,$p,$0);
  14182. $1 = (($r) + 40|0);
  14183. $2 = (($p) + 40|0);
  14184. $3 = (($p) + 80|0);
  14185. _crypto_sign_ed25519_ref10_fe_mul($1,$2,$3);
  14186. $4 = (($r) + 80|0);
  14187. _crypto_sign_ed25519_ref10_fe_mul($4,$3,$0);
  14188. $5 = (($r) + 120|0);
  14189. _crypto_sign_ed25519_ref10_fe_mul($5,$p,$2);
  14190. STACKTOP = sp;return;
  14191. }
  14192. function _crypto_sign_ed25519_ref10_ge_p2_0($h) {
  14193. $h = $h|0;
  14194. var $0 = 0, $1 = 0, label = 0, sp = 0;
  14195. sp = STACKTOP;
  14196. _crypto_sign_ed25519_ref10_fe_0($h);
  14197. $0 = (($h) + 40|0);
  14198. _crypto_sign_ed25519_ref10_fe_1($0);
  14199. $1 = (($h) + 80|0);
  14200. _crypto_sign_ed25519_ref10_fe_1($1);
  14201. STACKTOP = sp;return;
  14202. }
  14203. function _crypto_sign_ed25519_ref10_ge_p2_dbl($r,$p) {
  14204. $r = $r|0;
  14205. $p = $p|0;
  14206. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $t0 = 0, label = 0, sp = 0;
  14207. sp = STACKTOP;
  14208. STACKTOP = STACKTOP + 48|0;
  14209. $t0 = sp;
  14210. _crypto_sign_ed25519_ref10_fe_sq($r,$p);
  14211. $0 = (($r) + 80|0);
  14212. $1 = (($p) + 40|0);
  14213. _crypto_sign_ed25519_ref10_fe_sq($0,$1);
  14214. $2 = (($r) + 120|0);
  14215. $3 = (($p) + 80|0);
  14216. _crypto_sign_ed25519_ref10_fe_sq2($2,$3);
  14217. $4 = (($r) + 40|0);
  14218. _crypto_sign_ed25519_ref10_fe_add($4,$p,$1);
  14219. _crypto_sign_ed25519_ref10_fe_sq($t0,$4);
  14220. _crypto_sign_ed25519_ref10_fe_add($4,$0,$r);
  14221. _crypto_sign_ed25519_ref10_fe_sub($0,$0,$r);
  14222. _crypto_sign_ed25519_ref10_fe_sub($r,$t0,$4);
  14223. _crypto_sign_ed25519_ref10_fe_sub($2,$2,$0);
  14224. STACKTOP = sp;return;
  14225. }
  14226. function _crypto_sign_ed25519_ref10_ge_p3_0($h) {
  14227. $h = $h|0;
  14228. var $0 = 0, $1 = 0, $2 = 0, label = 0, sp = 0;
  14229. sp = STACKTOP;
  14230. _crypto_sign_ed25519_ref10_fe_0($h);
  14231. $0 = (($h) + 40|0);
  14232. _crypto_sign_ed25519_ref10_fe_1($0);
  14233. $1 = (($h) + 80|0);
  14234. _crypto_sign_ed25519_ref10_fe_1($1);
  14235. $2 = (($h) + 120|0);
  14236. _crypto_sign_ed25519_ref10_fe_0($2);
  14237. STACKTOP = sp;return;
  14238. }
  14239. function _crypto_sign_ed25519_ref10_ge_p3_dbl($r,$p) {
  14240. $r = $r|0;
  14241. $p = $p|0;
  14242. var $q = 0, label = 0, sp = 0;
  14243. sp = STACKTOP;
  14244. STACKTOP = STACKTOP + 128|0;
  14245. $q = sp;
  14246. _crypto_sign_ed25519_ref10_ge_p3_to_p2($q,$p);
  14247. _crypto_sign_ed25519_ref10_ge_p2_dbl($r,$q);
  14248. STACKTOP = sp;return;
  14249. }
  14250. function _crypto_sign_ed25519_ref10_ge_p3_to_cached($r,$p) {
  14251. $r = $r|0;
  14252. $p = $p|0;
  14253. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, label = 0, sp = 0;
  14254. sp = STACKTOP;
  14255. $0 = (($p) + 40|0);
  14256. _crypto_sign_ed25519_ref10_fe_add($r,$0,$p);
  14257. $1 = (($r) + 40|0);
  14258. _crypto_sign_ed25519_ref10_fe_sub($1,$0,$p);
  14259. $2 = (($r) + 80|0);
  14260. $3 = (($p) + 80|0);
  14261. _crypto_sign_ed25519_ref10_fe_copy($2,$3);
  14262. $4 = (($r) + 120|0);
  14263. $5 = (($p) + 120|0);
  14264. _crypto_sign_ed25519_ref10_fe_mul($4,$5,1080);
  14265. STACKTOP = sp;return;
  14266. }
  14267. function _crypto_sign_ed25519_ref10_ge_p3_to_p2($r,$p) {
  14268. $r = $r|0;
  14269. $p = $p|0;
  14270. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, label = 0, sp = 0;
  14271. sp = STACKTOP;
  14272. _crypto_sign_ed25519_ref10_fe_copy($r,$p);
  14273. $0 = (($r) + 40|0);
  14274. $1 = (($p) + 40|0);
  14275. _crypto_sign_ed25519_ref10_fe_copy($0,$1);
  14276. $2 = (($r) + 80|0);
  14277. $3 = (($p) + 80|0);
  14278. _crypto_sign_ed25519_ref10_fe_copy($2,$3);
  14279. STACKTOP = sp;return;
  14280. }
  14281. function _crypto_sign_ed25519_ref10_ge_p3_tobytes($s,$h) {
  14282. $s = $s|0;
  14283. $h = $h|0;
  14284. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $recip = 0, $x = 0, $y = 0, label = 0, sp = 0;
  14285. sp = STACKTOP;
  14286. STACKTOP = STACKTOP + 128|0;
  14287. $recip = sp + 80|0;
  14288. $x = sp + 40|0;
  14289. $y = sp;
  14290. $0 = (($h) + 80|0);
  14291. _crypto_sign_ed25519_ref10_fe_invert($recip,$0);
  14292. _crypto_sign_ed25519_ref10_fe_mul($x,$h,$recip);
  14293. $1 = (($h) + 40|0);
  14294. _crypto_sign_ed25519_ref10_fe_mul($y,$1,$recip);
  14295. _crypto_sign_ed25519_ref10_fe_tobytes($s,$y);
  14296. $2 = (_crypto_sign_ed25519_ref10_fe_isnegative($x)|0);
  14297. $3 = $2 << 7;
  14298. $4 = (($s) + 31|0);
  14299. $5 = HEAP8[$4>>0]|0;
  14300. $6 = $5&255;
  14301. $7 = $6 ^ $3;
  14302. $8 = $7&255;
  14303. HEAP8[$4>>0] = $8;
  14304. STACKTOP = sp;return;
  14305. }
  14306. function _crypto_sign_ed25519_ref10_ge_precomp_0($h) {
  14307. $h = $h|0;
  14308. var $0 = 0, $1 = 0, label = 0, sp = 0;
  14309. sp = STACKTOP;
  14310. _crypto_sign_ed25519_ref10_fe_1($h);
  14311. $0 = (($h) + 40|0);
  14312. _crypto_sign_ed25519_ref10_fe_1($0);
  14313. $1 = (($h) + 80|0);
  14314. _crypto_sign_ed25519_ref10_fe_0($1);
  14315. STACKTOP = sp;return;
  14316. }
  14317. function _crypto_sign_ed25519_ref10_ge_scalarmult_base($h,$a) {
  14318. $h = $h|0;
  14319. $a = $a|0;
  14320. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  14321. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $carry$04 = 0, $e = 0, $exitcond = 0, $exitcond7 = 0;
  14322. var $i$06 = 0, $i$15 = 0, $i$23 = 0, $i$32 = 0, $r = 0, $s = 0, $sext = 0, $sext1 = 0, $t = 0, label = 0, sp = 0;
  14323. sp = STACKTOP;
  14324. STACKTOP = STACKTOP + 464|0;
  14325. $e = sp + 400|0;
  14326. $r = sp + 240|0;
  14327. $s = sp + 120|0;
  14328. $t = sp;
  14329. $i$06 = 0;
  14330. while(1) {
  14331. $0 = (($a) + ($i$06)|0);
  14332. $1 = HEAP8[$0>>0]|0;
  14333. $2 = $1&255;
  14334. $3 = $2 & 15;
  14335. $4 = $3&255;
  14336. $5 = $i$06 << 1;
  14337. $6 = (($e) + ($5)|0);
  14338. HEAP8[$6>>0] = $4;
  14339. $7 = HEAP8[$0>>0]|0;
  14340. $8 = ($7&255) >>> 4;
  14341. $9 = $5 | 1;
  14342. $10 = (($e) + ($9)|0);
  14343. HEAP8[$10>>0] = $8;
  14344. $11 = (($i$06) + 1)|0;
  14345. $exitcond7 = ($11|0)==(32);
  14346. if ($exitcond7) {
  14347. $carry$04 = 0;$i$15 = 0;
  14348. break;
  14349. } else {
  14350. $i$06 = $11;
  14351. }
  14352. }
  14353. while(1) {
  14354. $12 = (($e) + ($i$15)|0);
  14355. $13 = HEAP8[$12>>0]|0;
  14356. $14 = $13&255;
  14357. $15 = (($14) + ($carry$04))|0;
  14358. $sext = $15 << 24;
  14359. $sext1 = (($sext) + 134217728)|0;
  14360. $16 = $sext1 >> 28;
  14361. $17 = $16 << 4;
  14362. $18 = (($15) - ($17))|0;
  14363. $19 = $18&255;
  14364. HEAP8[$12>>0] = $19;
  14365. $20 = (($i$15) + 1)|0;
  14366. $exitcond = ($20|0)==(63);
  14367. if ($exitcond) {
  14368. break;
  14369. } else {
  14370. $carry$04 = $16;$i$15 = $20;
  14371. }
  14372. }
  14373. $21 = (($e) + 63|0);
  14374. $22 = HEAP8[$21>>0]|0;
  14375. $23 = $22&255;
  14376. $24 = (($23) + ($16))|0;
  14377. $25 = $24&255;
  14378. HEAP8[$21>>0] = $25;
  14379. _crypto_sign_ed25519_ref10_ge_p3_0($h);
  14380. $i$23 = 1;
  14381. while(1) {
  14382. $26 = (($i$23|0) / 2)&-1;
  14383. $27 = (($e) + ($i$23)|0);
  14384. $28 = HEAP8[$27>>0]|0;
  14385. _select($t,$26,$28);
  14386. _crypto_sign_ed25519_ref10_ge_madd($r,$h,$t);
  14387. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($h,$r);
  14388. $29 = (($i$23) + 2)|0;
  14389. $30 = ($29|0)<(64);
  14390. if ($30) {
  14391. $i$23 = $29;
  14392. } else {
  14393. break;
  14394. }
  14395. }
  14396. _crypto_sign_ed25519_ref10_ge_p3_dbl($r,$h);
  14397. _crypto_sign_ed25519_ref10_ge_p1p1_to_p2($s,$r);
  14398. _crypto_sign_ed25519_ref10_ge_p2_dbl($r,$s);
  14399. _crypto_sign_ed25519_ref10_ge_p1p1_to_p2($s,$r);
  14400. _crypto_sign_ed25519_ref10_ge_p2_dbl($r,$s);
  14401. _crypto_sign_ed25519_ref10_ge_p1p1_to_p2($s,$r);
  14402. _crypto_sign_ed25519_ref10_ge_p2_dbl($r,$s);
  14403. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($h,$r);
  14404. $i$32 = 0;
  14405. while(1) {
  14406. $31 = (($i$32|0) / 2)&-1;
  14407. $32 = (($e) + ($i$32)|0);
  14408. $33 = HEAP8[$32>>0]|0;
  14409. _select($t,$31,$33);
  14410. _crypto_sign_ed25519_ref10_ge_madd($r,$h,$t);
  14411. _crypto_sign_ed25519_ref10_ge_p1p1_to_p3($h,$r);
  14412. $34 = (($i$32) + 2)|0;
  14413. $35 = ($34|0)<(64);
  14414. if ($35) {
  14415. $i$32 = $34;
  14416. } else {
  14417. break;
  14418. }
  14419. }
  14420. STACKTOP = sp;return;
  14421. }
  14422. function _select($t,$pos,$b) {
  14423. $t = $t|0;
  14424. $pos = $pos|0;
  14425. $b = $b|0;
  14426. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  14427. var $27 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $minust = 0, label = 0, sp = 0;
  14428. sp = STACKTOP;
  14429. STACKTOP = STACKTOP + 128|0;
  14430. $minust = sp;
  14431. $0 = (_negative($b)|0);
  14432. $1 = $b << 24 >> 24;
  14433. $2 = $0&255;
  14434. $3 = (0 - ($2))|0;
  14435. $4 = $1 & $3;
  14436. $5 = $4 << 1;
  14437. $6 = (($1) - ($5))|0;
  14438. $7 = $6&255;
  14439. _crypto_sign_ed25519_ref10_ge_precomp_0($t);
  14440. $8 = (1120 + (($pos*960)|0)|0);
  14441. $9 = (_equal($7,1)|0);
  14442. _cmov($t,$8,$9);
  14443. $10 = ((1120 + (($pos*960)|0)|0) + 120|0);
  14444. $11 = (_equal($7,2)|0);
  14445. _cmov($t,$10,$11);
  14446. $12 = ((1120 + (($pos*960)|0)|0) + 240|0);
  14447. $13 = (_equal($7,3)|0);
  14448. _cmov($t,$12,$13);
  14449. $14 = ((1120 + (($pos*960)|0)|0) + 360|0);
  14450. $15 = (_equal($7,4)|0);
  14451. _cmov($t,$14,$15);
  14452. $16 = ((1120 + (($pos*960)|0)|0) + 480|0);
  14453. $17 = (_equal($7,5)|0);
  14454. _cmov($t,$16,$17);
  14455. $18 = ((1120 + (($pos*960)|0)|0) + 600|0);
  14456. $19 = (_equal($7,6)|0);
  14457. _cmov($t,$18,$19);
  14458. $20 = ((1120 + (($pos*960)|0)|0) + 720|0);
  14459. $21 = (_equal($7,7)|0);
  14460. _cmov($t,$20,$21);
  14461. $22 = ((1120 + (($pos*960)|0)|0) + 840|0);
  14462. $23 = (_equal($7,8)|0);
  14463. _cmov($t,$22,$23);
  14464. $24 = (($t) + 40|0);
  14465. _crypto_sign_ed25519_ref10_fe_copy($minust,$24);
  14466. $25 = (($minust) + 40|0);
  14467. _crypto_sign_ed25519_ref10_fe_copy($25,$t);
  14468. $26 = (($minust) + 80|0);
  14469. $27 = (($t) + 80|0);
  14470. _crypto_sign_ed25519_ref10_fe_neg($26,$27);
  14471. _cmov($t,$minust,$0);
  14472. STACKTOP = sp;return;
  14473. }
  14474. function _negative($b) {
  14475. $b = $b|0;
  14476. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, label = 0, sp = 0;
  14477. sp = STACKTOP;
  14478. $0 = $b << 24 >> 24;
  14479. $1 = ($0|0)<(0);
  14480. $2 = $1 << 31 >> 31;
  14481. $3 = (_bitshift64Lshr(($0|0),($2|0),63)|0);
  14482. $4 = tempRet0;
  14483. $5 = $3&255;
  14484. STACKTOP = sp;return ($5|0);
  14485. }
  14486. function _equal($b,$c) {
  14487. $b = $b|0;
  14488. $c = $c|0;
  14489. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, label = 0, sp = 0;
  14490. sp = STACKTOP;
  14491. $0 = $c ^ $b;
  14492. $1 = $0&255;
  14493. $2 = (($1) + -1)|0;
  14494. $3 = $2 >>> 31;
  14495. $4 = $3&255;
  14496. STACKTOP = sp;return ($4|0);
  14497. }
  14498. function _cmov($t,$u,$b) {
  14499. $t = $t|0;
  14500. $u = $u|0;
  14501. $b = $b|0;
  14502. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, label = 0, sp = 0;
  14503. sp = STACKTOP;
  14504. $0 = $b&255;
  14505. _crypto_sign_ed25519_ref10_fe_cmov($t,$u,$0);
  14506. $1 = (($t) + 40|0);
  14507. $2 = (($u) + 40|0);
  14508. _crypto_sign_ed25519_ref10_fe_cmov($1,$2,$0);
  14509. $3 = (($t) + 80|0);
  14510. $4 = (($u) + 80|0);
  14511. _crypto_sign_ed25519_ref10_fe_cmov($3,$4,$0);
  14512. STACKTOP = sp;return;
  14513. }
  14514. function _crypto_sign_ed25519_ref10_ge_sub($r,$p,$q) {
  14515. $r = $r|0;
  14516. $p = $p|0;
  14517. $q = $q|0;
  14518. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $t0 = 0, label = 0, sp = 0;
  14519. sp = STACKTOP;
  14520. STACKTOP = STACKTOP + 48|0;
  14521. $t0 = sp;
  14522. $0 = (($p) + 40|0);
  14523. _crypto_sign_ed25519_ref10_fe_add($r,$0,$p);
  14524. $1 = (($r) + 40|0);
  14525. _crypto_sign_ed25519_ref10_fe_sub($1,$0,$p);
  14526. $2 = (($r) + 80|0);
  14527. $3 = (($q) + 40|0);
  14528. _crypto_sign_ed25519_ref10_fe_mul($2,$r,$3);
  14529. _crypto_sign_ed25519_ref10_fe_mul($1,$1,$q);
  14530. $4 = (($r) + 120|0);
  14531. $5 = (($q) + 120|0);
  14532. $6 = (($p) + 120|0);
  14533. _crypto_sign_ed25519_ref10_fe_mul($4,$5,$6);
  14534. $7 = (($p) + 80|0);
  14535. $8 = (($q) + 80|0);
  14536. _crypto_sign_ed25519_ref10_fe_mul($r,$7,$8);
  14537. _crypto_sign_ed25519_ref10_fe_add($t0,$r,$r);
  14538. _crypto_sign_ed25519_ref10_fe_sub($r,$2,$1);
  14539. _crypto_sign_ed25519_ref10_fe_add($1,$2,$1);
  14540. _crypto_sign_ed25519_ref10_fe_sub($2,$t0,$4);
  14541. _crypto_sign_ed25519_ref10_fe_add($4,$t0,$4);
  14542. STACKTOP = sp;return;
  14543. }
  14544. function _crypto_sign_ed25519_ref10_ge_tobytes($s,$h) {
  14545. $s = $s|0;
  14546. $h = $h|0;
  14547. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $recip = 0, $x = 0, $y = 0, label = 0, sp = 0;
  14548. sp = STACKTOP;
  14549. STACKTOP = STACKTOP + 128|0;
  14550. $recip = sp + 80|0;
  14551. $x = sp + 40|0;
  14552. $y = sp;
  14553. $0 = (($h) + 80|0);
  14554. _crypto_sign_ed25519_ref10_fe_invert($recip,$0);
  14555. _crypto_sign_ed25519_ref10_fe_mul($x,$h,$recip);
  14556. $1 = (($h) + 40|0);
  14557. _crypto_sign_ed25519_ref10_fe_mul($y,$1,$recip);
  14558. _crypto_sign_ed25519_ref10_fe_tobytes($s,$y);
  14559. $2 = (_crypto_sign_ed25519_ref10_fe_isnegative($x)|0);
  14560. $3 = $2 << 7;
  14561. $4 = (($s) + 31|0);
  14562. $5 = HEAP8[$4>>0]|0;
  14563. $6 = $5&255;
  14564. $7 = $6 ^ $3;
  14565. $8 = $7&255;
  14566. HEAP8[$4>>0] = $8;
  14567. STACKTOP = sp;return;
  14568. }
  14569. function _crypto_sign_edwards25519sha512batch_ref10_open($m,$mlen,$sm,$0,$1,$pk) {
  14570. $m = $m|0;
  14571. $mlen = $mlen|0;
  14572. $sm = $sm|0;
  14573. $0 = $0|0;
  14574. $1 = $1|0;
  14575. $pk = $pk|0;
  14576. var $$0 = 0, $$sum = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  14577. var $27 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $A = 0, $R = 0, $h = 0, $pkcopy1 = 0, $rcheck = 0, $rcopy = 0, $scopy = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  14578. sp = STACKTOP;
  14579. STACKTOP = STACKTOP + 480|0;
  14580. $pkcopy1 = sp + 440|0;
  14581. $rcopy = sp + 408|0;
  14582. $scopy = sp + 376|0;
  14583. $h = sp + 312|0;
  14584. $rcheck = sp + 280|0;
  14585. $A = sp + 120|0;
  14586. $R = sp;
  14587. $2 = ($1>>>0)<(0);
  14588. $3 = ($0>>>0)<(64);
  14589. $4 = ($1|0)==(0);
  14590. $5 = $4 & $3;
  14591. $6 = $2 | $5;
  14592. if (!($6)) {
  14593. $7 = (($sm) + 63|0);
  14594. $8 = HEAP8[$7>>0]|0;
  14595. $9 = ($8&255)>(31);
  14596. if (!($9)) {
  14597. $10 = (_crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime($A,$pk)|0);
  14598. $11 = ($10|0)==(0);
  14599. if ($11) {
  14600. dest=$pkcopy1+0|0; src=$pk+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  14601. dest=$rcopy+0|0; src=$sm+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  14602. $12 = (($sm) + 32|0);
  14603. dest=$scopy+0|0; src=$12+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  14604. _memmove(($m|0),($sm|0),($0|0))|0;
  14605. $13 = (($m) + 32|0);
  14606. dest=$13+0|0; src=$pkcopy1+0|0; stop=dest+32|0; do { HEAP8[dest>>0]=HEAP8[src>>0]|0; dest=dest+1|0; src=src+1|0; } while ((dest|0) < (stop|0));
  14607. (_crypto_hash_sha512_ref($h,$m,$0,$1)|0);
  14608. _crypto_sign_ed25519_ref10_sc_reduce($h);
  14609. _crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime($R,$h,$A,$scopy);
  14610. _crypto_sign_ed25519_ref10_ge_tobytes($rcheck,$R);
  14611. $14 = (_crypto_verify_32_ref($rcheck,$rcopy)|0);
  14612. $15 = ($14|0)==(0);
  14613. if ($15) {
  14614. $16 = (($m) + 64|0);
  14615. $17 = (_i64Add(($0|0),($1|0),-64,-1)|0);
  14616. $18 = tempRet0;
  14617. _memmove(($m|0),($16|0),($17|0))|0;
  14618. $$sum = (($0) + -64)|0;
  14619. $19 = (($m) + ($$sum)|0);
  14620. dest=$19+0|0; stop=dest+64|0; do { HEAP8[dest>>0]=0|0; dest=dest+1|0; } while ((dest|0) < (stop|0));
  14621. $20 = $mlen;
  14622. $21 = $20;
  14623. HEAP32[$21>>2] = $17;
  14624. $22 = (($20) + 4)|0;
  14625. $23 = $22;
  14626. HEAP32[$23>>2] = $18;
  14627. $$0 = 0;
  14628. STACKTOP = sp;return ($$0|0);
  14629. }
  14630. }
  14631. }
  14632. }
  14633. $24 = $mlen;
  14634. $25 = $24;
  14635. HEAP32[$25>>2] = -1;
  14636. $26 = (($24) + 4)|0;
  14637. $27 = $26;
  14638. HEAP32[$27>>2] = -1;
  14639. _memset(($m|0),0,($0|0))|0;
  14640. $$0 = -1;
  14641. STACKTOP = sp;return ($$0|0);
  14642. }
  14643. function _crypto_sign_ed25519_ref10_sc_muladd($s,$a,$b,$c) {
  14644. $s = $s|0;
  14645. $a = $a|0;
  14646. $b = $b|0;
  14647. $c = $c|0;
  14648. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0, $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0;
  14649. var $1015 = 0, $1016 = 0, $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0, $1021 = 0, $1022 = 0, $1023 = 0, $1024 = 0, $1025 = 0, $1026 = 0, $1027 = 0, $1028 = 0, $1029 = 0, $103 = 0, $1030 = 0, $1031 = 0, $1032 = 0;
  14650. var $1033 = 0, $1034 = 0, $1035 = 0, $1036 = 0, $1037 = 0, $1038 = 0, $1039 = 0, $104 = 0, $1040 = 0, $1041 = 0, $1042 = 0, $1043 = 0, $1044 = 0, $1045 = 0, $1046 = 0, $1047 = 0, $1048 = 0, $1049 = 0, $105 = 0, $1050 = 0;
  14651. var $1051 = 0, $1052 = 0, $1053 = 0, $1054 = 0, $1055 = 0, $1056 = 0, $1057 = 0, $1058 = 0, $1059 = 0, $106 = 0, $1060 = 0, $1061 = 0, $1062 = 0, $1063 = 0, $1064 = 0, $1065 = 0, $1066 = 0, $1067 = 0, $1068 = 0, $1069 = 0;
  14652. var $107 = 0, $1070 = 0, $1071 = 0, $1072 = 0, $1073 = 0, $1074 = 0, $1075 = 0, $1076 = 0, $1077 = 0, $1078 = 0, $1079 = 0, $108 = 0, $1080 = 0, $1081 = 0, $1082 = 0, $1083 = 0, $1084 = 0, $1085 = 0, $1086 = 0, $1087 = 0;
  14653. var $1088 = 0, $1089 = 0, $109 = 0, $1090 = 0, $1091 = 0, $1092 = 0, $1093 = 0, $1094 = 0, $1095 = 0, $1096 = 0, $1097 = 0, $1098 = 0, $1099 = 0, $11 = 0, $110 = 0, $1100 = 0, $1101 = 0, $1102 = 0, $1103 = 0, $1104 = 0;
  14654. var $1105 = 0, $1106 = 0, $1107 = 0, $1108 = 0, $1109 = 0, $111 = 0, $1110 = 0, $1111 = 0, $1112 = 0, $1113 = 0, $1114 = 0, $1115 = 0, $1116 = 0, $1117 = 0, $1118 = 0, $1119 = 0, $112 = 0, $1120 = 0, $1121 = 0, $1122 = 0;
  14655. var $1123 = 0, $1124 = 0, $1125 = 0, $1126 = 0, $1127 = 0, $1128 = 0, $1129 = 0, $113 = 0, $1130 = 0, $1131 = 0, $1132 = 0, $1133 = 0, $1134 = 0, $1135 = 0, $1136 = 0, $1137 = 0, $1138 = 0, $1139 = 0, $114 = 0, $1140 = 0;
  14656. var $1141 = 0, $1142 = 0, $1143 = 0, $1144 = 0, $1145 = 0, $1146 = 0, $1147 = 0, $1148 = 0, $1149 = 0, $115 = 0, $1150 = 0, $1151 = 0, $1152 = 0, $1153 = 0, $1154 = 0, $1155 = 0, $1156 = 0, $1157 = 0, $1158 = 0, $1159 = 0;
  14657. var $116 = 0, $1160 = 0, $1161 = 0, $1162 = 0, $1163 = 0, $1164 = 0, $1165 = 0, $1166 = 0, $1167 = 0, $1168 = 0, $1169 = 0, $117 = 0, $1170 = 0, $1171 = 0, $1172 = 0, $1173 = 0, $1174 = 0, $1175 = 0, $1176 = 0, $1177 = 0;
  14658. var $1178 = 0, $1179 = 0, $118 = 0, $1180 = 0, $1181 = 0, $1182 = 0, $1183 = 0, $1184 = 0, $1185 = 0, $1186 = 0, $1187 = 0, $1188 = 0, $1189 = 0, $119 = 0, $1190 = 0, $1191 = 0, $1192 = 0, $1193 = 0, $1194 = 0, $1195 = 0;
  14659. var $1196 = 0, $1197 = 0, $1198 = 0, $1199 = 0, $12 = 0, $120 = 0, $1200 = 0, $1201 = 0, $1202 = 0, $1203 = 0, $1204 = 0, $1205 = 0, $1206 = 0, $1207 = 0, $1208 = 0, $1209 = 0, $121 = 0, $1210 = 0, $1211 = 0, $1212 = 0;
  14660. var $1213 = 0, $1214 = 0, $1215 = 0, $1216 = 0, $1217 = 0, $1218 = 0, $1219 = 0, $122 = 0, $1220 = 0, $1221 = 0, $1222 = 0, $1223 = 0, $1224 = 0, $1225 = 0, $1226 = 0, $1227 = 0, $1228 = 0, $1229 = 0, $123 = 0, $1230 = 0;
  14661. var $1231 = 0, $1232 = 0, $1233 = 0, $1234 = 0, $1235 = 0, $1236 = 0, $1237 = 0, $1238 = 0, $1239 = 0, $124 = 0, $1240 = 0, $1241 = 0, $1242 = 0, $1243 = 0, $1244 = 0, $1245 = 0, $1246 = 0, $1247 = 0, $1248 = 0, $1249 = 0;
  14662. var $125 = 0, $1250 = 0, $1251 = 0, $1252 = 0, $1253 = 0, $1254 = 0, $1255 = 0, $1256 = 0, $1257 = 0, $1258 = 0, $1259 = 0, $126 = 0, $1260 = 0, $1261 = 0, $1262 = 0, $1263 = 0, $1264 = 0, $1265 = 0, $1266 = 0, $1267 = 0;
  14663. var $1268 = 0, $1269 = 0, $127 = 0, $1270 = 0, $1271 = 0, $1272 = 0, $1273 = 0, $1274 = 0, $1275 = 0, $1276 = 0, $1277 = 0, $1278 = 0, $1279 = 0, $128 = 0, $1280 = 0, $1281 = 0, $1282 = 0, $1283 = 0, $1284 = 0, $1285 = 0;
  14664. var $1286 = 0, $1287 = 0, $1288 = 0, $1289 = 0, $129 = 0, $1290 = 0, $1291 = 0, $1292 = 0, $1293 = 0, $1294 = 0, $1295 = 0, $1296 = 0, $1297 = 0, $1298 = 0, $1299 = 0, $13 = 0, $130 = 0, $1300 = 0, $1301 = 0, $1302 = 0;
  14665. var $1303 = 0, $1304 = 0, $1305 = 0, $1306 = 0, $1307 = 0, $1308 = 0, $1309 = 0, $131 = 0, $1310 = 0, $1311 = 0, $1312 = 0, $1313 = 0, $1314 = 0, $1315 = 0, $1316 = 0, $1317 = 0, $1318 = 0, $1319 = 0, $132 = 0, $1320 = 0;
  14666. var $1321 = 0, $1322 = 0, $1323 = 0, $1324 = 0, $1325 = 0, $1326 = 0, $1327 = 0, $1328 = 0, $1329 = 0, $133 = 0, $1330 = 0, $1331 = 0, $1332 = 0, $1333 = 0, $1334 = 0, $1335 = 0, $1336 = 0, $1337 = 0, $1338 = 0, $1339 = 0;
  14667. var $134 = 0, $1340 = 0, $1341 = 0, $1342 = 0, $1343 = 0, $1344 = 0, $1345 = 0, $1346 = 0, $1347 = 0, $1348 = 0, $1349 = 0, $135 = 0, $1350 = 0, $1351 = 0, $1352 = 0, $1353 = 0, $1354 = 0, $1355 = 0, $1356 = 0, $1357 = 0;
  14668. var $1358 = 0, $1359 = 0, $136 = 0, $1360 = 0, $1361 = 0, $1362 = 0, $1363 = 0, $1364 = 0, $1365 = 0, $1366 = 0, $1367 = 0, $1368 = 0, $1369 = 0, $137 = 0, $1370 = 0, $1371 = 0, $1372 = 0, $1373 = 0, $1374 = 0, $1375 = 0;
  14669. var $1376 = 0, $1377 = 0, $1378 = 0, $1379 = 0, $138 = 0, $1380 = 0, $1381 = 0, $1382 = 0, $1383 = 0, $1384 = 0, $1385 = 0, $1386 = 0, $1387 = 0, $1388 = 0, $1389 = 0, $139 = 0, $1390 = 0, $1391 = 0, $1392 = 0, $1393 = 0;
  14670. var $1394 = 0, $1395 = 0, $1396 = 0, $1397 = 0, $1398 = 0, $1399 = 0, $14 = 0, $140 = 0, $1400 = 0, $1401 = 0, $1402 = 0, $1403 = 0, $1404 = 0, $1405 = 0, $1406 = 0, $1407 = 0, $1408 = 0, $1409 = 0, $141 = 0, $1410 = 0;
  14671. var $1411 = 0, $1412 = 0, $1413 = 0, $1414 = 0, $1415 = 0, $1416 = 0, $1417 = 0, $1418 = 0, $1419 = 0, $142 = 0, $1420 = 0, $1421 = 0, $1422 = 0, $1423 = 0, $1424 = 0, $1425 = 0, $1426 = 0, $1427 = 0, $1428 = 0, $1429 = 0;
  14672. var $143 = 0, $1430 = 0, $1431 = 0, $1432 = 0, $1433 = 0, $1434 = 0, $1435 = 0, $1436 = 0, $1437 = 0, $1438 = 0, $1439 = 0, $144 = 0, $1440 = 0, $1441 = 0, $1442 = 0, $1443 = 0, $1444 = 0, $1445 = 0, $1446 = 0, $1447 = 0;
  14673. var $1448 = 0, $1449 = 0, $145 = 0, $1450 = 0, $1451 = 0, $1452 = 0, $1453 = 0, $1454 = 0, $1455 = 0, $1456 = 0, $1457 = 0, $1458 = 0, $1459 = 0, $146 = 0, $1460 = 0, $1461 = 0, $1462 = 0, $1463 = 0, $1464 = 0, $1465 = 0;
  14674. var $1466 = 0, $1467 = 0, $1468 = 0, $1469 = 0, $147 = 0, $1470 = 0, $1471 = 0, $1472 = 0, $1473 = 0, $1474 = 0, $1475 = 0, $1476 = 0, $1477 = 0, $1478 = 0, $1479 = 0, $148 = 0, $1480 = 0, $1481 = 0, $1482 = 0, $1483 = 0;
  14675. var $1484 = 0, $1485 = 0, $1486 = 0, $1487 = 0, $1488 = 0, $1489 = 0, $149 = 0, $1490 = 0, $1491 = 0, $1492 = 0, $1493 = 0, $1494 = 0, $1495 = 0, $1496 = 0, $1497 = 0, $1498 = 0, $1499 = 0, $15 = 0, $150 = 0, $1500 = 0;
  14676. var $1501 = 0, $1502 = 0, $1503 = 0, $1504 = 0, $1505 = 0, $1506 = 0, $1507 = 0, $1508 = 0, $1509 = 0, $151 = 0, $1510 = 0, $1511 = 0, $1512 = 0, $1513 = 0, $1514 = 0, $1515 = 0, $1516 = 0, $1517 = 0, $1518 = 0, $1519 = 0;
  14677. var $152 = 0, $1520 = 0, $1521 = 0, $1522 = 0, $1523 = 0, $1524 = 0, $1525 = 0, $1526 = 0, $1527 = 0, $1528 = 0, $1529 = 0, $153 = 0, $1530 = 0, $1531 = 0, $1532 = 0, $1533 = 0, $1534 = 0, $1535 = 0, $1536 = 0, $1537 = 0;
  14678. var $1538 = 0, $1539 = 0, $154 = 0, $1540 = 0, $1541 = 0, $1542 = 0, $1543 = 0, $1544 = 0, $1545 = 0, $1546 = 0, $1547 = 0, $1548 = 0, $1549 = 0, $155 = 0, $1550 = 0, $1551 = 0, $1552 = 0, $1553 = 0, $1554 = 0, $1555 = 0;
  14679. var $1556 = 0, $1557 = 0, $1558 = 0, $1559 = 0, $156 = 0, $1560 = 0, $1561 = 0, $1562 = 0, $1563 = 0, $1564 = 0, $1565 = 0, $1566 = 0, $1567 = 0, $1568 = 0, $1569 = 0, $157 = 0, $1570 = 0, $1571 = 0, $1572 = 0, $1573 = 0;
  14680. var $1574 = 0, $1575 = 0, $1576 = 0, $1577 = 0, $1578 = 0, $1579 = 0, $158 = 0, $1580 = 0, $1581 = 0, $1582 = 0, $1583 = 0, $1584 = 0, $1585 = 0, $1586 = 0, $1587 = 0, $1588 = 0, $1589 = 0, $159 = 0, $1590 = 0, $1591 = 0;
  14681. var $1592 = 0, $1593 = 0, $1594 = 0, $1595 = 0, $1596 = 0, $1597 = 0, $1598 = 0, $1599 = 0, $16 = 0, $160 = 0, $1600 = 0, $1601 = 0, $1602 = 0, $1603 = 0, $1604 = 0, $1605 = 0, $1606 = 0, $1607 = 0, $1608 = 0, $1609 = 0;
  14682. var $161 = 0, $1610 = 0, $1611 = 0, $1612 = 0, $1613 = 0, $1614 = 0, $1615 = 0, $1616 = 0, $1617 = 0, $1618 = 0, $1619 = 0, $162 = 0, $1620 = 0, $1621 = 0, $1622 = 0, $1623 = 0, $1624 = 0, $1625 = 0, $1626 = 0, $1627 = 0;
  14683. var $1628 = 0, $1629 = 0, $163 = 0, $1630 = 0, $1631 = 0, $1632 = 0, $1633 = 0, $1634 = 0, $1635 = 0, $1636 = 0, $1637 = 0, $1638 = 0, $1639 = 0, $164 = 0, $1640 = 0, $1641 = 0, $1642 = 0, $1643 = 0, $1644 = 0, $1645 = 0;
  14684. var $1646 = 0, $1647 = 0, $1648 = 0, $1649 = 0, $165 = 0, $1650 = 0, $1651 = 0, $1652 = 0, $1653 = 0, $1654 = 0, $1655 = 0, $1656 = 0, $1657 = 0, $1658 = 0, $1659 = 0, $166 = 0, $1660 = 0, $1661 = 0, $1662 = 0, $1663 = 0;
  14685. var $1664 = 0, $1665 = 0, $1666 = 0, $1667 = 0, $1668 = 0, $1669 = 0, $167 = 0, $1670 = 0, $1671 = 0, $1672 = 0, $1673 = 0, $1674 = 0, $1675 = 0, $1676 = 0, $1677 = 0, $1678 = 0, $1679 = 0, $168 = 0, $1680 = 0, $1681 = 0;
  14686. var $1682 = 0, $1683 = 0, $1684 = 0, $1685 = 0, $1686 = 0, $1687 = 0, $1688 = 0, $1689 = 0, $169 = 0, $1690 = 0, $1691 = 0, $1692 = 0, $1693 = 0, $1694 = 0, $1695 = 0, $1696 = 0, $1697 = 0, $1698 = 0, $1699 = 0, $17 = 0;
  14687. var $170 = 0, $1700 = 0, $1701 = 0, $1702 = 0, $1703 = 0, $1704 = 0, $1705 = 0, $1706 = 0, $1707 = 0, $1708 = 0, $1709 = 0, $171 = 0, $1710 = 0, $1711 = 0, $1712 = 0, $1713 = 0, $1714 = 0, $1715 = 0, $1716 = 0, $1717 = 0;
  14688. var $1718 = 0, $1719 = 0, $172 = 0, $1720 = 0, $1721 = 0, $1722 = 0, $1723 = 0, $1724 = 0, $1725 = 0, $1726 = 0, $1727 = 0, $1728 = 0, $1729 = 0, $173 = 0, $1730 = 0, $1731 = 0, $1732 = 0, $1733 = 0, $1734 = 0, $1735 = 0;
  14689. var $1736 = 0, $1737 = 0, $1738 = 0, $1739 = 0, $174 = 0, $1740 = 0, $1741 = 0, $1742 = 0, $1743 = 0, $1744 = 0, $1745 = 0, $1746 = 0, $1747 = 0, $1748 = 0, $1749 = 0, $175 = 0, $1750 = 0, $1751 = 0, $1752 = 0, $1753 = 0;
  14690. var $1754 = 0, $1755 = 0, $1756 = 0, $1757 = 0, $1758 = 0, $1759 = 0, $176 = 0, $1760 = 0, $1761 = 0, $1762 = 0, $1763 = 0, $1764 = 0, $1765 = 0, $1766 = 0, $1767 = 0, $1768 = 0, $1769 = 0, $177 = 0, $1770 = 0, $1771 = 0;
  14691. var $1772 = 0, $1773 = 0, $1774 = 0, $1775 = 0, $1776 = 0, $1777 = 0, $1778 = 0, $1779 = 0, $178 = 0, $1780 = 0, $1781 = 0, $1782 = 0, $1783 = 0, $1784 = 0, $1785 = 0, $1786 = 0, $1787 = 0, $1788 = 0, $1789 = 0, $179 = 0;
  14692. var $1790 = 0, $1791 = 0, $1792 = 0, $1793 = 0, $1794 = 0, $1795 = 0, $1796 = 0, $1797 = 0, $1798 = 0, $1799 = 0, $18 = 0, $180 = 0, $1800 = 0, $1801 = 0, $1802 = 0, $1803 = 0, $1804 = 0, $1805 = 0, $1806 = 0, $1807 = 0;
  14693. var $1808 = 0, $1809 = 0, $181 = 0, $1810 = 0, $1811 = 0, $1812 = 0, $1813 = 0, $1814 = 0, $1815 = 0, $1816 = 0, $1817 = 0, $1818 = 0, $1819 = 0, $182 = 0, $1820 = 0, $1821 = 0, $1822 = 0, $1823 = 0, $1824 = 0, $1825 = 0;
  14694. var $1826 = 0, $1827 = 0, $1828 = 0, $1829 = 0, $183 = 0, $1830 = 0, $1831 = 0, $1832 = 0, $1833 = 0, $1834 = 0, $1835 = 0, $1836 = 0, $1837 = 0, $1838 = 0, $1839 = 0, $184 = 0, $1840 = 0, $1841 = 0, $1842 = 0, $1843 = 0;
  14695. var $1844 = 0, $1845 = 0, $1846 = 0, $1847 = 0, $1848 = 0, $1849 = 0, $185 = 0, $1850 = 0, $1851 = 0, $1852 = 0, $1853 = 0, $1854 = 0, $1855 = 0, $1856 = 0, $1857 = 0, $1858 = 0, $1859 = 0, $186 = 0, $1860 = 0, $1861 = 0;
  14696. var $1862 = 0, $1863 = 0, $1864 = 0, $1865 = 0, $1866 = 0, $1867 = 0, $1868 = 0, $1869 = 0, $187 = 0, $1870 = 0, $1871 = 0, $1872 = 0, $1873 = 0, $1874 = 0, $1875 = 0, $1876 = 0, $1877 = 0, $1878 = 0, $188 = 0, $189 = 0;
  14697. var $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0;
  14698. var $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0;
  14699. var $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0;
  14700. var $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0;
  14701. var $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0;
  14702. var $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0;
  14703. var $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0;
  14704. var $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0;
  14705. var $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0;
  14706. var $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0;
  14707. var $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0;
  14708. var $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0, $404 = 0;
  14709. var $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0, $422 = 0;
  14710. var $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0;
  14711. var $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0, $459 = 0;
  14712. var $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0;
  14713. var $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0, $495 = 0;
  14714. var $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0;
  14715. var $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0;
  14716. var $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0;
  14717. var $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0;
  14718. var $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0;
  14719. var $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0;
  14720. var $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0;
  14721. var $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0;
  14722. var $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0;
  14723. var $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0;
  14724. var $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0;
  14725. var $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0;
  14726. var $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0;
  14727. var $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0;
  14728. var $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0;
  14729. var $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0;
  14730. var $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0;
  14731. var $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0, $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0, $819 = 0;
  14732. var $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0, $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0, $837 = 0;
  14733. var $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0, $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0, $855 = 0;
  14734. var $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0, $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0, $873 = 0;
  14735. var $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0, $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0, $891 = 0;
  14736. var $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0, $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0, $909 = 0;
  14737. var $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0, $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0, $927 = 0;
  14738. var $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0, $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0, $945 = 0;
  14739. var $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0, $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0, $960 = 0, $961 = 0, $962 = 0, $963 = 0;
  14740. var $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0, $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0, $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0, $979 = 0, $98 = 0, $980 = 0, $981 = 0;
  14741. var $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0, $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0, $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0, $997 = 0, $998 = 0, $999 = 0, label = 0;
  14742. var sp = 0;
  14743. sp = STACKTOP;
  14744. $0 = (_load_347($a)|0);
  14745. $1 = tempRet0;
  14746. $2 = $0 & 2097151;
  14747. $3 = (($a) + 2|0);
  14748. $4 = (_load_448($3)|0);
  14749. $5 = tempRet0;
  14750. $6 = (_bitshift64Lshr(($4|0),($5|0),5)|0);
  14751. $7 = tempRet0;
  14752. $8 = $6 & 2097151;
  14753. $9 = (($a) + 5|0);
  14754. $10 = (_load_347($9)|0);
  14755. $11 = tempRet0;
  14756. $12 = (_bitshift64Lshr(($10|0),($11|0),2)|0);
  14757. $13 = tempRet0;
  14758. $14 = $12 & 2097151;
  14759. $15 = (($a) + 7|0);
  14760. $16 = (_load_448($15)|0);
  14761. $17 = tempRet0;
  14762. $18 = (_bitshift64Lshr(($16|0),($17|0),7)|0);
  14763. $19 = tempRet0;
  14764. $20 = $18 & 2097151;
  14765. $21 = (($a) + 10|0);
  14766. $22 = (_load_448($21)|0);
  14767. $23 = tempRet0;
  14768. $24 = (_bitshift64Lshr(($22|0),($23|0),4)|0);
  14769. $25 = tempRet0;
  14770. $26 = $24 & 2097151;
  14771. $27 = (($a) + 13|0);
  14772. $28 = (_load_347($27)|0);
  14773. $29 = tempRet0;
  14774. $30 = (_bitshift64Lshr(($28|0),($29|0),1)|0);
  14775. $31 = tempRet0;
  14776. $32 = $30 & 2097151;
  14777. $33 = (($a) + 15|0);
  14778. $34 = (_load_448($33)|0);
  14779. $35 = tempRet0;
  14780. $36 = (_bitshift64Lshr(($34|0),($35|0),6)|0);
  14781. $37 = tempRet0;
  14782. $38 = $36 & 2097151;
  14783. $39 = (($a) + 18|0);
  14784. $40 = (_load_347($39)|0);
  14785. $41 = tempRet0;
  14786. $42 = (_bitshift64Lshr(($40|0),($41|0),3)|0);
  14787. $43 = tempRet0;
  14788. $44 = $42 & 2097151;
  14789. $45 = (($a) + 21|0);
  14790. $46 = (_load_347($45)|0);
  14791. $47 = tempRet0;
  14792. $48 = $46 & 2097151;
  14793. $49 = (($a) + 23|0);
  14794. $50 = (_load_448($49)|0);
  14795. $51 = tempRet0;
  14796. $52 = (_bitshift64Lshr(($50|0),($51|0),5)|0);
  14797. $53 = tempRet0;
  14798. $54 = $52 & 2097151;
  14799. $55 = (($a) + 26|0);
  14800. $56 = (_load_347($55)|0);
  14801. $57 = tempRet0;
  14802. $58 = (_bitshift64Lshr(($56|0),($57|0),2)|0);
  14803. $59 = tempRet0;
  14804. $60 = $58 & 2097151;
  14805. $61 = (($a) + 28|0);
  14806. $62 = (_load_448($61)|0);
  14807. $63 = tempRet0;
  14808. $64 = (_bitshift64Lshr(($62|0),($63|0),7)|0);
  14809. $65 = tempRet0;
  14810. $66 = (_load_347($b)|0);
  14811. $67 = tempRet0;
  14812. $68 = $66 & 2097151;
  14813. $69 = (($b) + 2|0);
  14814. $70 = (_load_448($69)|0);
  14815. $71 = tempRet0;
  14816. $72 = (_bitshift64Lshr(($70|0),($71|0),5)|0);
  14817. $73 = tempRet0;
  14818. $74 = $72 & 2097151;
  14819. $75 = (($b) + 5|0);
  14820. $76 = (_load_347($75)|0);
  14821. $77 = tempRet0;
  14822. $78 = (_bitshift64Lshr(($76|0),($77|0),2)|0);
  14823. $79 = tempRet0;
  14824. $80 = $78 & 2097151;
  14825. $81 = (($b) + 7|0);
  14826. $82 = (_load_448($81)|0);
  14827. $83 = tempRet0;
  14828. $84 = (_bitshift64Lshr(($82|0),($83|0),7)|0);
  14829. $85 = tempRet0;
  14830. $86 = $84 & 2097151;
  14831. $87 = (($b) + 10|0);
  14832. $88 = (_load_448($87)|0);
  14833. $89 = tempRet0;
  14834. $90 = (_bitshift64Lshr(($88|0),($89|0),4)|0);
  14835. $91 = tempRet0;
  14836. $92 = $90 & 2097151;
  14837. $93 = (($b) + 13|0);
  14838. $94 = (_load_347($93)|0);
  14839. $95 = tempRet0;
  14840. $96 = (_bitshift64Lshr(($94|0),($95|0),1)|0);
  14841. $97 = tempRet0;
  14842. $98 = $96 & 2097151;
  14843. $99 = (($b) + 15|0);
  14844. $100 = (_load_448($99)|0);
  14845. $101 = tempRet0;
  14846. $102 = (_bitshift64Lshr(($100|0),($101|0),6)|0);
  14847. $103 = tempRet0;
  14848. $104 = $102 & 2097151;
  14849. $105 = (($b) + 18|0);
  14850. $106 = (_load_347($105)|0);
  14851. $107 = tempRet0;
  14852. $108 = (_bitshift64Lshr(($106|0),($107|0),3)|0);
  14853. $109 = tempRet0;
  14854. $110 = $108 & 2097151;
  14855. $111 = (($b) + 21|0);
  14856. $112 = (_load_347($111)|0);
  14857. $113 = tempRet0;
  14858. $114 = $112 & 2097151;
  14859. $115 = (($b) + 23|0);
  14860. $116 = (_load_448($115)|0);
  14861. $117 = tempRet0;
  14862. $118 = (_bitshift64Lshr(($116|0),($117|0),5)|0);
  14863. $119 = tempRet0;
  14864. $120 = $118 & 2097151;
  14865. $121 = (($b) + 26|0);
  14866. $122 = (_load_347($121)|0);
  14867. $123 = tempRet0;
  14868. $124 = (_bitshift64Lshr(($122|0),($123|0),2)|0);
  14869. $125 = tempRet0;
  14870. $126 = $124 & 2097151;
  14871. $127 = (($b) + 28|0);
  14872. $128 = (_load_448($127)|0);
  14873. $129 = tempRet0;
  14874. $130 = (_bitshift64Lshr(($128|0),($129|0),7)|0);
  14875. $131 = tempRet0;
  14876. $132 = (_load_347($c)|0);
  14877. $133 = tempRet0;
  14878. $134 = $132 & 2097151;
  14879. $135 = (($c) + 2|0);
  14880. $136 = (_load_448($135)|0);
  14881. $137 = tempRet0;
  14882. $138 = (_bitshift64Lshr(($136|0),($137|0),5)|0);
  14883. $139 = tempRet0;
  14884. $140 = $138 & 2097151;
  14885. $141 = (($c) + 5|0);
  14886. $142 = (_load_347($141)|0);
  14887. $143 = tempRet0;
  14888. $144 = (_bitshift64Lshr(($142|0),($143|0),2)|0);
  14889. $145 = tempRet0;
  14890. $146 = $144 & 2097151;
  14891. $147 = (($c) + 7|0);
  14892. $148 = (_load_448($147)|0);
  14893. $149 = tempRet0;
  14894. $150 = (_bitshift64Lshr(($148|0),($149|0),7)|0);
  14895. $151 = tempRet0;
  14896. $152 = $150 & 2097151;
  14897. $153 = (($c) + 10|0);
  14898. $154 = (_load_448($153)|0);
  14899. $155 = tempRet0;
  14900. $156 = (_bitshift64Lshr(($154|0),($155|0),4)|0);
  14901. $157 = tempRet0;
  14902. $158 = $156 & 2097151;
  14903. $159 = (($c) + 13|0);
  14904. $160 = (_load_347($159)|0);
  14905. $161 = tempRet0;
  14906. $162 = (_bitshift64Lshr(($160|0),($161|0),1)|0);
  14907. $163 = tempRet0;
  14908. $164 = $162 & 2097151;
  14909. $165 = (($c) + 15|0);
  14910. $166 = (_load_448($165)|0);
  14911. $167 = tempRet0;
  14912. $168 = (_bitshift64Lshr(($166|0),($167|0),6)|0);
  14913. $169 = tempRet0;
  14914. $170 = $168 & 2097151;
  14915. $171 = (($c) + 18|0);
  14916. $172 = (_load_347($171)|0);
  14917. $173 = tempRet0;
  14918. $174 = (_bitshift64Lshr(($172|0),($173|0),3)|0);
  14919. $175 = tempRet0;
  14920. $176 = $174 & 2097151;
  14921. $177 = (($c) + 21|0);
  14922. $178 = (_load_347($177)|0);
  14923. $179 = tempRet0;
  14924. $180 = $178 & 2097151;
  14925. $181 = (($c) + 23|0);
  14926. $182 = (_load_448($181)|0);
  14927. $183 = tempRet0;
  14928. $184 = (_bitshift64Lshr(($182|0),($183|0),5)|0);
  14929. $185 = tempRet0;
  14930. $186 = $184 & 2097151;
  14931. $187 = (($c) + 26|0);
  14932. $188 = (_load_347($187)|0);
  14933. $189 = tempRet0;
  14934. $190 = (_bitshift64Lshr(($188|0),($189|0),2)|0);
  14935. $191 = tempRet0;
  14936. $192 = $190 & 2097151;
  14937. $193 = (($c) + 28|0);
  14938. $194 = (_load_448($193)|0);
  14939. $195 = tempRet0;
  14940. $196 = (_bitshift64Lshr(($194|0),($195|0),7)|0);
  14941. $197 = tempRet0;
  14942. $198 = (___muldi3(($68|0),0,($2|0),0)|0);
  14943. $199 = tempRet0;
  14944. $200 = (_i64Add(($134|0),0,($198|0),($199|0))|0);
  14945. $201 = tempRet0;
  14946. $202 = (___muldi3(($74|0),0,($2|0),0)|0);
  14947. $203 = tempRet0;
  14948. $204 = (___muldi3(($68|0),0,($8|0),0)|0);
  14949. $205 = tempRet0;
  14950. $206 = (___muldi3(($80|0),0,($2|0),0)|0);
  14951. $207 = tempRet0;
  14952. $208 = (___muldi3(($74|0),0,($8|0),0)|0);
  14953. $209 = tempRet0;
  14954. $210 = (___muldi3(($68|0),0,($14|0),0)|0);
  14955. $211 = tempRet0;
  14956. $212 = (_i64Add(($208|0),($209|0),($210|0),($211|0))|0);
  14957. $213 = tempRet0;
  14958. $214 = (_i64Add(($212|0),($213|0),($206|0),($207|0))|0);
  14959. $215 = tempRet0;
  14960. $216 = (_i64Add(($214|0),($215|0),($146|0),0)|0);
  14961. $217 = tempRet0;
  14962. $218 = (___muldi3(($86|0),0,($2|0),0)|0);
  14963. $219 = tempRet0;
  14964. $220 = (___muldi3(($80|0),0,($8|0),0)|0);
  14965. $221 = tempRet0;
  14966. $222 = (___muldi3(($74|0),0,($14|0),0)|0);
  14967. $223 = tempRet0;
  14968. $224 = (___muldi3(($68|0),0,($20|0),0)|0);
  14969. $225 = tempRet0;
  14970. $226 = (___muldi3(($92|0),0,($2|0),0)|0);
  14971. $227 = tempRet0;
  14972. $228 = (___muldi3(($86|0),0,($8|0),0)|0);
  14973. $229 = tempRet0;
  14974. $230 = (___muldi3(($80|0),0,($14|0),0)|0);
  14975. $231 = tempRet0;
  14976. $232 = (___muldi3(($74|0),0,($20|0),0)|0);
  14977. $233 = tempRet0;
  14978. $234 = (___muldi3(($68|0),0,($26|0),0)|0);
  14979. $235 = tempRet0;
  14980. $236 = (_i64Add(($232|0),($233|0),($234|0),($235|0))|0);
  14981. $237 = tempRet0;
  14982. $238 = (_i64Add(($236|0),($237|0),($230|0),($231|0))|0);
  14983. $239 = tempRet0;
  14984. $240 = (_i64Add(($238|0),($239|0),($228|0),($229|0))|0);
  14985. $241 = tempRet0;
  14986. $242 = (_i64Add(($240|0),($241|0),($226|0),($227|0))|0);
  14987. $243 = tempRet0;
  14988. $244 = (_i64Add(($242|0),($243|0),($158|0),0)|0);
  14989. $245 = tempRet0;
  14990. $246 = (___muldi3(($98|0),0,($2|0),0)|0);
  14991. $247 = tempRet0;
  14992. $248 = (___muldi3(($92|0),0,($8|0),0)|0);
  14993. $249 = tempRet0;
  14994. $250 = (___muldi3(($86|0),0,($14|0),0)|0);
  14995. $251 = tempRet0;
  14996. $252 = (___muldi3(($80|0),0,($20|0),0)|0);
  14997. $253 = tempRet0;
  14998. $254 = (___muldi3(($74|0),0,($26|0),0)|0);
  14999. $255 = tempRet0;
  15000. $256 = (___muldi3(($68|0),0,($32|0),0)|0);
  15001. $257 = tempRet0;
  15002. $258 = (___muldi3(($104|0),0,($2|0),0)|0);
  15003. $259 = tempRet0;
  15004. $260 = (___muldi3(($98|0),0,($8|0),0)|0);
  15005. $261 = tempRet0;
  15006. $262 = (___muldi3(($92|0),0,($14|0),0)|0);
  15007. $263 = tempRet0;
  15008. $264 = (___muldi3(($86|0),0,($20|0),0)|0);
  15009. $265 = tempRet0;
  15010. $266 = (___muldi3(($80|0),0,($26|0),0)|0);
  15011. $267 = tempRet0;
  15012. $268 = (___muldi3(($74|0),0,($32|0),0)|0);
  15013. $269 = tempRet0;
  15014. $270 = (___muldi3(($68|0),0,($38|0),0)|0);
  15015. $271 = tempRet0;
  15016. $272 = (_i64Add(($268|0),($269|0),($270|0),($271|0))|0);
  15017. $273 = tempRet0;
  15018. $274 = (_i64Add(($272|0),($273|0),($266|0),($267|0))|0);
  15019. $275 = tempRet0;
  15020. $276 = (_i64Add(($274|0),($275|0),($264|0),($265|0))|0);
  15021. $277 = tempRet0;
  15022. $278 = (_i64Add(($276|0),($277|0),($262|0),($263|0))|0);
  15023. $279 = tempRet0;
  15024. $280 = (_i64Add(($278|0),($279|0),($260|0),($261|0))|0);
  15025. $281 = tempRet0;
  15026. $282 = (_i64Add(($280|0),($281|0),($258|0),($259|0))|0);
  15027. $283 = tempRet0;
  15028. $284 = (_i64Add(($282|0),($283|0),($170|0),0)|0);
  15029. $285 = tempRet0;
  15030. $286 = (___muldi3(($110|0),0,($2|0),0)|0);
  15031. $287 = tempRet0;
  15032. $288 = (___muldi3(($104|0),0,($8|0),0)|0);
  15033. $289 = tempRet0;
  15034. $290 = (___muldi3(($98|0),0,($14|0),0)|0);
  15035. $291 = tempRet0;
  15036. $292 = (___muldi3(($92|0),0,($20|0),0)|0);
  15037. $293 = tempRet0;
  15038. $294 = (___muldi3(($86|0),0,($26|0),0)|0);
  15039. $295 = tempRet0;
  15040. $296 = (___muldi3(($80|0),0,($32|0),0)|0);
  15041. $297 = tempRet0;
  15042. $298 = (___muldi3(($74|0),0,($38|0),0)|0);
  15043. $299 = tempRet0;
  15044. $300 = (___muldi3(($68|0),0,($44|0),0)|0);
  15045. $301 = tempRet0;
  15046. $302 = (___muldi3(($114|0),0,($2|0),0)|0);
  15047. $303 = tempRet0;
  15048. $304 = (___muldi3(($110|0),0,($8|0),0)|0);
  15049. $305 = tempRet0;
  15050. $306 = (___muldi3(($104|0),0,($14|0),0)|0);
  15051. $307 = tempRet0;
  15052. $308 = (___muldi3(($98|0),0,($20|0),0)|0);
  15053. $309 = tempRet0;
  15054. $310 = (___muldi3(($92|0),0,($26|0),0)|0);
  15055. $311 = tempRet0;
  15056. $312 = (___muldi3(($86|0),0,($32|0),0)|0);
  15057. $313 = tempRet0;
  15058. $314 = (___muldi3(($80|0),0,($38|0),0)|0);
  15059. $315 = tempRet0;
  15060. $316 = (___muldi3(($74|0),0,($44|0),0)|0);
  15061. $317 = tempRet0;
  15062. $318 = (___muldi3(($68|0),0,($48|0),0)|0);
  15063. $319 = tempRet0;
  15064. $320 = (_i64Add(($316|0),($317|0),($318|0),($319|0))|0);
  15065. $321 = tempRet0;
  15066. $322 = (_i64Add(($320|0),($321|0),($314|0),($315|0))|0);
  15067. $323 = tempRet0;
  15068. $324 = (_i64Add(($322|0),($323|0),($312|0),($313|0))|0);
  15069. $325 = tempRet0;
  15070. $326 = (_i64Add(($324|0),($325|0),($310|0),($311|0))|0);
  15071. $327 = tempRet0;
  15072. $328 = (_i64Add(($326|0),($327|0),($308|0),($309|0))|0);
  15073. $329 = tempRet0;
  15074. $330 = (_i64Add(($328|0),($329|0),($306|0),($307|0))|0);
  15075. $331 = tempRet0;
  15076. $332 = (_i64Add(($330|0),($331|0),($302|0),($303|0))|0);
  15077. $333 = tempRet0;
  15078. $334 = (_i64Add(($332|0),($333|0),($304|0),($305|0))|0);
  15079. $335 = tempRet0;
  15080. $336 = (_i64Add(($334|0),($335|0),($180|0),0)|0);
  15081. $337 = tempRet0;
  15082. $338 = (___muldi3(($120|0),0,($2|0),0)|0);
  15083. $339 = tempRet0;
  15084. $340 = (___muldi3(($114|0),0,($8|0),0)|0);
  15085. $341 = tempRet0;
  15086. $342 = (___muldi3(($110|0),0,($14|0),0)|0);
  15087. $343 = tempRet0;
  15088. $344 = (___muldi3(($104|0),0,($20|0),0)|0);
  15089. $345 = tempRet0;
  15090. $346 = (___muldi3(($98|0),0,($26|0),0)|0);
  15091. $347 = tempRet0;
  15092. $348 = (___muldi3(($92|0),0,($32|0),0)|0);
  15093. $349 = tempRet0;
  15094. $350 = (___muldi3(($86|0),0,($38|0),0)|0);
  15095. $351 = tempRet0;
  15096. $352 = (___muldi3(($80|0),0,($44|0),0)|0);
  15097. $353 = tempRet0;
  15098. $354 = (___muldi3(($74|0),0,($48|0),0)|0);
  15099. $355 = tempRet0;
  15100. $356 = (___muldi3(($68|0),0,($54|0),0)|0);
  15101. $357 = tempRet0;
  15102. $358 = (___muldi3(($126|0),0,($2|0),0)|0);
  15103. $359 = tempRet0;
  15104. $360 = (___muldi3(($120|0),0,($8|0),0)|0);
  15105. $361 = tempRet0;
  15106. $362 = (___muldi3(($114|0),0,($14|0),0)|0);
  15107. $363 = tempRet0;
  15108. $364 = (___muldi3(($110|0),0,($20|0),0)|0);
  15109. $365 = tempRet0;
  15110. $366 = (___muldi3(($104|0),0,($26|0),0)|0);
  15111. $367 = tempRet0;
  15112. $368 = (___muldi3(($98|0),0,($32|0),0)|0);
  15113. $369 = tempRet0;
  15114. $370 = (___muldi3(($92|0),0,($38|0),0)|0);
  15115. $371 = tempRet0;
  15116. $372 = (___muldi3(($86|0),0,($44|0),0)|0);
  15117. $373 = tempRet0;
  15118. $374 = (___muldi3(($80|0),0,($48|0),0)|0);
  15119. $375 = tempRet0;
  15120. $376 = (___muldi3(($74|0),0,($54|0),0)|0);
  15121. $377 = tempRet0;
  15122. $378 = (___muldi3(($68|0),0,($60|0),0)|0);
  15123. $379 = tempRet0;
  15124. $380 = (_i64Add(($376|0),($377|0),($378|0),($379|0))|0);
  15125. $381 = tempRet0;
  15126. $382 = (_i64Add(($380|0),($381|0),($374|0),($375|0))|0);
  15127. $383 = tempRet0;
  15128. $384 = (_i64Add(($382|0),($383|0),($372|0),($373|0))|0);
  15129. $385 = tempRet0;
  15130. $386 = (_i64Add(($384|0),($385|0),($370|0),($371|0))|0);
  15131. $387 = tempRet0;
  15132. $388 = (_i64Add(($386|0),($387|0),($368|0),($369|0))|0);
  15133. $389 = tempRet0;
  15134. $390 = (_i64Add(($388|0),($389|0),($366|0),($367|0))|0);
  15135. $391 = tempRet0;
  15136. $392 = (_i64Add(($390|0),($391|0),($362|0),($363|0))|0);
  15137. $393 = tempRet0;
  15138. $394 = (_i64Add(($392|0),($393|0),($364|0),($365|0))|0);
  15139. $395 = tempRet0;
  15140. $396 = (_i64Add(($394|0),($395|0),($360|0),($361|0))|0);
  15141. $397 = tempRet0;
  15142. $398 = (_i64Add(($396|0),($397|0),($358|0),($359|0))|0);
  15143. $399 = tempRet0;
  15144. $400 = (_i64Add(($398|0),($399|0),($192|0),0)|0);
  15145. $401 = tempRet0;
  15146. $402 = (___muldi3(($130|0),($131|0),($2|0),0)|0);
  15147. $403 = tempRet0;
  15148. $404 = (___muldi3(($126|0),0,($8|0),0)|0);
  15149. $405 = tempRet0;
  15150. $406 = (___muldi3(($120|0),0,($14|0),0)|0);
  15151. $407 = tempRet0;
  15152. $408 = (___muldi3(($114|0),0,($20|0),0)|0);
  15153. $409 = tempRet0;
  15154. $410 = (___muldi3(($110|0),0,($26|0),0)|0);
  15155. $411 = tempRet0;
  15156. $412 = (___muldi3(($104|0),0,($32|0),0)|0);
  15157. $413 = tempRet0;
  15158. $414 = (___muldi3(($98|0),0,($38|0),0)|0);
  15159. $415 = tempRet0;
  15160. $416 = (___muldi3(($92|0),0,($44|0),0)|0);
  15161. $417 = tempRet0;
  15162. $418 = (___muldi3(($86|0),0,($48|0),0)|0);
  15163. $419 = tempRet0;
  15164. $420 = (___muldi3(($80|0),0,($54|0),0)|0);
  15165. $421 = tempRet0;
  15166. $422 = (___muldi3(($74|0),0,($60|0),0)|0);
  15167. $423 = tempRet0;
  15168. $424 = (___muldi3(($68|0),0,($64|0),($65|0))|0);
  15169. $425 = tempRet0;
  15170. $426 = (___muldi3(($130|0),($131|0),($8|0),0)|0);
  15171. $427 = tempRet0;
  15172. $428 = (___muldi3(($126|0),0,($14|0),0)|0);
  15173. $429 = tempRet0;
  15174. $430 = (___muldi3(($120|0),0,($20|0),0)|0);
  15175. $431 = tempRet0;
  15176. $432 = (___muldi3(($114|0),0,($26|0),0)|0);
  15177. $433 = tempRet0;
  15178. $434 = (___muldi3(($110|0),0,($32|0),0)|0);
  15179. $435 = tempRet0;
  15180. $436 = (___muldi3(($104|0),0,($38|0),0)|0);
  15181. $437 = tempRet0;
  15182. $438 = (___muldi3(($98|0),0,($44|0),0)|0);
  15183. $439 = tempRet0;
  15184. $440 = (___muldi3(($92|0),0,($48|0),0)|0);
  15185. $441 = tempRet0;
  15186. $442 = (___muldi3(($86|0),0,($54|0),0)|0);
  15187. $443 = tempRet0;
  15188. $444 = (___muldi3(($80|0),0,($60|0),0)|0);
  15189. $445 = tempRet0;
  15190. $446 = (___muldi3(($74|0),0,($64|0),($65|0))|0);
  15191. $447 = tempRet0;
  15192. $448 = (_i64Add(($444|0),($445|0),($446|0),($447|0))|0);
  15193. $449 = tempRet0;
  15194. $450 = (_i64Add(($448|0),($449|0),($442|0),($443|0))|0);
  15195. $451 = tempRet0;
  15196. $452 = (_i64Add(($450|0),($451|0),($440|0),($441|0))|0);
  15197. $453 = tempRet0;
  15198. $454 = (_i64Add(($452|0),($453|0),($438|0),($439|0))|0);
  15199. $455 = tempRet0;
  15200. $456 = (_i64Add(($454|0),($455|0),($436|0),($437|0))|0);
  15201. $457 = tempRet0;
  15202. $458 = (_i64Add(($456|0),($457|0),($432|0),($433|0))|0);
  15203. $459 = tempRet0;
  15204. $460 = (_i64Add(($458|0),($459|0),($434|0),($435|0))|0);
  15205. $461 = tempRet0;
  15206. $462 = (_i64Add(($460|0),($461|0),($430|0),($431|0))|0);
  15207. $463 = tempRet0;
  15208. $464 = (_i64Add(($462|0),($463|0),($428|0),($429|0))|0);
  15209. $465 = tempRet0;
  15210. $466 = (_i64Add(($464|0),($465|0),($426|0),($427|0))|0);
  15211. $467 = tempRet0;
  15212. $468 = (___muldi3(($130|0),($131|0),($14|0),0)|0);
  15213. $469 = tempRet0;
  15214. $470 = (___muldi3(($126|0),0,($20|0),0)|0);
  15215. $471 = tempRet0;
  15216. $472 = (___muldi3(($120|0),0,($26|0),0)|0);
  15217. $473 = tempRet0;
  15218. $474 = (___muldi3(($114|0),0,($32|0),0)|0);
  15219. $475 = tempRet0;
  15220. $476 = (___muldi3(($110|0),0,($38|0),0)|0);
  15221. $477 = tempRet0;
  15222. $478 = (___muldi3(($104|0),0,($44|0),0)|0);
  15223. $479 = tempRet0;
  15224. $480 = (___muldi3(($98|0),0,($48|0),0)|0);
  15225. $481 = tempRet0;
  15226. $482 = (___muldi3(($92|0),0,($54|0),0)|0);
  15227. $483 = tempRet0;
  15228. $484 = (___muldi3(($86|0),0,($60|0),0)|0);
  15229. $485 = tempRet0;
  15230. $486 = (___muldi3(($80|0),0,($64|0),($65|0))|0);
  15231. $487 = tempRet0;
  15232. $488 = (___muldi3(($130|0),($131|0),($20|0),0)|0);
  15233. $489 = tempRet0;
  15234. $490 = (___muldi3(($126|0),0,($26|0),0)|0);
  15235. $491 = tempRet0;
  15236. $492 = (___muldi3(($120|0),0,($32|0),0)|0);
  15237. $493 = tempRet0;
  15238. $494 = (___muldi3(($114|0),0,($38|0),0)|0);
  15239. $495 = tempRet0;
  15240. $496 = (___muldi3(($110|0),0,($44|0),0)|0);
  15241. $497 = tempRet0;
  15242. $498 = (___muldi3(($104|0),0,($48|0),0)|0);
  15243. $499 = tempRet0;
  15244. $500 = (___muldi3(($98|0),0,($54|0),0)|0);
  15245. $501 = tempRet0;
  15246. $502 = (___muldi3(($92|0),0,($60|0),0)|0);
  15247. $503 = tempRet0;
  15248. $504 = (___muldi3(($86|0),0,($64|0),($65|0))|0);
  15249. $505 = tempRet0;
  15250. $506 = (_i64Add(($502|0),($503|0),($504|0),($505|0))|0);
  15251. $507 = tempRet0;
  15252. $508 = (_i64Add(($506|0),($507|0),($500|0),($501|0))|0);
  15253. $509 = tempRet0;
  15254. $510 = (_i64Add(($508|0),($509|0),($498|0),($499|0))|0);
  15255. $511 = tempRet0;
  15256. $512 = (_i64Add(($510|0),($511|0),($494|0),($495|0))|0);
  15257. $513 = tempRet0;
  15258. $514 = (_i64Add(($512|0),($513|0),($496|0),($497|0))|0);
  15259. $515 = tempRet0;
  15260. $516 = (_i64Add(($514|0),($515|0),($492|0),($493|0))|0);
  15261. $517 = tempRet0;
  15262. $518 = (_i64Add(($516|0),($517|0),($490|0),($491|0))|0);
  15263. $519 = tempRet0;
  15264. $520 = (_i64Add(($518|0),($519|0),($488|0),($489|0))|0);
  15265. $521 = tempRet0;
  15266. $522 = (___muldi3(($130|0),($131|0),($26|0),0)|0);
  15267. $523 = tempRet0;
  15268. $524 = (___muldi3(($126|0),0,($32|0),0)|0);
  15269. $525 = tempRet0;
  15270. $526 = (___muldi3(($120|0),0,($38|0),0)|0);
  15271. $527 = tempRet0;
  15272. $528 = (___muldi3(($114|0),0,($44|0),0)|0);
  15273. $529 = tempRet0;
  15274. $530 = (___muldi3(($110|0),0,($48|0),0)|0);
  15275. $531 = tempRet0;
  15276. $532 = (___muldi3(($104|0),0,($54|0),0)|0);
  15277. $533 = tempRet0;
  15278. $534 = (___muldi3(($98|0),0,($60|0),0)|0);
  15279. $535 = tempRet0;
  15280. $536 = (___muldi3(($92|0),0,($64|0),($65|0))|0);
  15281. $537 = tempRet0;
  15282. $538 = (___muldi3(($130|0),($131|0),($32|0),0)|0);
  15283. $539 = tempRet0;
  15284. $540 = (___muldi3(($126|0),0,($38|0),0)|0);
  15285. $541 = tempRet0;
  15286. $542 = (___muldi3(($120|0),0,($44|0),0)|0);
  15287. $543 = tempRet0;
  15288. $544 = (___muldi3(($114|0),0,($48|0),0)|0);
  15289. $545 = tempRet0;
  15290. $546 = (___muldi3(($110|0),0,($54|0),0)|0);
  15291. $547 = tempRet0;
  15292. $548 = (___muldi3(($104|0),0,($60|0),0)|0);
  15293. $549 = tempRet0;
  15294. $550 = (___muldi3(($98|0),0,($64|0),($65|0))|0);
  15295. $551 = tempRet0;
  15296. $552 = (_i64Add(($548|0),($549|0),($550|0),($551|0))|0);
  15297. $553 = tempRet0;
  15298. $554 = (_i64Add(($552|0),($553|0),($544|0),($545|0))|0);
  15299. $555 = tempRet0;
  15300. $556 = (_i64Add(($554|0),($555|0),($546|0),($547|0))|0);
  15301. $557 = tempRet0;
  15302. $558 = (_i64Add(($556|0),($557|0),($542|0),($543|0))|0);
  15303. $559 = tempRet0;
  15304. $560 = (_i64Add(($558|0),($559|0),($540|0),($541|0))|0);
  15305. $561 = tempRet0;
  15306. $562 = (_i64Add(($560|0),($561|0),($538|0),($539|0))|0);
  15307. $563 = tempRet0;
  15308. $564 = (___muldi3(($130|0),($131|0),($38|0),0)|0);
  15309. $565 = tempRet0;
  15310. $566 = (___muldi3(($126|0),0,($44|0),0)|0);
  15311. $567 = tempRet0;
  15312. $568 = (___muldi3(($120|0),0,($48|0),0)|0);
  15313. $569 = tempRet0;
  15314. $570 = (___muldi3(($114|0),0,($54|0),0)|0);
  15315. $571 = tempRet0;
  15316. $572 = (___muldi3(($110|0),0,($60|0),0)|0);
  15317. $573 = tempRet0;
  15318. $574 = (___muldi3(($104|0),0,($64|0),($65|0))|0);
  15319. $575 = tempRet0;
  15320. $576 = (___muldi3(($130|0),($131|0),($44|0),0)|0);
  15321. $577 = tempRet0;
  15322. $578 = (___muldi3(($126|0),0,($48|0),0)|0);
  15323. $579 = tempRet0;
  15324. $580 = (___muldi3(($120|0),0,($54|0),0)|0);
  15325. $581 = tempRet0;
  15326. $582 = (___muldi3(($114|0),0,($60|0),0)|0);
  15327. $583 = tempRet0;
  15328. $584 = (___muldi3(($110|0),0,($64|0),($65|0))|0);
  15329. $585 = tempRet0;
  15330. $586 = (_i64Add(($584|0),($585|0),($582|0),($583|0))|0);
  15331. $587 = tempRet0;
  15332. $588 = (_i64Add(($586|0),($587|0),($580|0),($581|0))|0);
  15333. $589 = tempRet0;
  15334. $590 = (_i64Add(($588|0),($589|0),($578|0),($579|0))|0);
  15335. $591 = tempRet0;
  15336. $592 = (_i64Add(($590|0),($591|0),($576|0),($577|0))|0);
  15337. $593 = tempRet0;
  15338. $594 = (___muldi3(($130|0),($131|0),($48|0),0)|0);
  15339. $595 = tempRet0;
  15340. $596 = (___muldi3(($126|0),0,($54|0),0)|0);
  15341. $597 = tempRet0;
  15342. $598 = (___muldi3(($120|0),0,($60|0),0)|0);
  15343. $599 = tempRet0;
  15344. $600 = (___muldi3(($114|0),0,($64|0),($65|0))|0);
  15345. $601 = tempRet0;
  15346. $602 = (___muldi3(($130|0),($131|0),($54|0),0)|0);
  15347. $603 = tempRet0;
  15348. $604 = (___muldi3(($126|0),0,($60|0),0)|0);
  15349. $605 = tempRet0;
  15350. $606 = (___muldi3(($120|0),0,($64|0),($65|0))|0);
  15351. $607 = tempRet0;
  15352. $608 = (_i64Add(($604|0),($605|0),($606|0),($607|0))|0);
  15353. $609 = tempRet0;
  15354. $610 = (_i64Add(($608|0),($609|0),($602|0),($603|0))|0);
  15355. $611 = tempRet0;
  15356. $612 = (___muldi3(($130|0),($131|0),($60|0),0)|0);
  15357. $613 = tempRet0;
  15358. $614 = (___muldi3(($126|0),0,($64|0),($65|0))|0);
  15359. $615 = tempRet0;
  15360. $616 = (_i64Add(($612|0),($613|0),($614|0),($615|0))|0);
  15361. $617 = tempRet0;
  15362. $618 = (___muldi3(($130|0),($131|0),($64|0),($65|0))|0);
  15363. $619 = tempRet0;
  15364. $620 = (_i64Add(($200|0),($201|0),1048576,0)|0);
  15365. $621 = tempRet0;
  15366. $622 = (_bitshift64Lshr(($620|0),($621|0),21)|0);
  15367. $623 = tempRet0;
  15368. $624 = (_i64Add(($202|0),($203|0),($204|0),($205|0))|0);
  15369. $625 = tempRet0;
  15370. $626 = (_i64Add(($624|0),($625|0),($140|0),0)|0);
  15371. $627 = tempRet0;
  15372. $628 = (_i64Add(($626|0),($627|0),($622|0),($623|0))|0);
  15373. $629 = tempRet0;
  15374. $630 = (_bitshift64Shl(($622|0),($623|0),21)|0);
  15375. $631 = tempRet0;
  15376. $632 = (_i64Subtract(($200|0),($201|0),($630|0),($631|0))|0);
  15377. $633 = tempRet0;
  15378. $634 = (_i64Add(($216|0),($217|0),1048576,0)|0);
  15379. $635 = tempRet0;
  15380. $636 = (_bitshift64Lshr(($634|0),($635|0),21)|0);
  15381. $637 = tempRet0;
  15382. $638 = (_i64Add(($222|0),($223|0),($224|0),($225|0))|0);
  15383. $639 = tempRet0;
  15384. $640 = (_i64Add(($638|0),($639|0),($220|0),($221|0))|0);
  15385. $641 = tempRet0;
  15386. $642 = (_i64Add(($640|0),($641|0),($218|0),($219|0))|0);
  15387. $643 = tempRet0;
  15388. $644 = (_i64Add(($642|0),($643|0),($152|0),0)|0);
  15389. $645 = tempRet0;
  15390. $646 = (_i64Add(($644|0),($645|0),($636|0),($637|0))|0);
  15391. $647 = tempRet0;
  15392. $648 = (_bitshift64Shl(($636|0),($637|0),21)|0);
  15393. $649 = tempRet0;
  15394. $650 = (_i64Add(($244|0),($245|0),1048576,0)|0);
  15395. $651 = tempRet0;
  15396. $652 = (_bitshift64Ashr(($650|0),($651|0),21)|0);
  15397. $653 = tempRet0;
  15398. $654 = (_i64Add(($254|0),($255|0),($256|0),($257|0))|0);
  15399. $655 = tempRet0;
  15400. $656 = (_i64Add(($654|0),($655|0),($252|0),($253|0))|0);
  15401. $657 = tempRet0;
  15402. $658 = (_i64Add(($656|0),($657|0),($250|0),($251|0))|0);
  15403. $659 = tempRet0;
  15404. $660 = (_i64Add(($658|0),($659|0),($248|0),($249|0))|0);
  15405. $661 = tempRet0;
  15406. $662 = (_i64Add(($660|0),($661|0),($246|0),($247|0))|0);
  15407. $663 = tempRet0;
  15408. $664 = (_i64Add(($662|0),($663|0),($164|0),0)|0);
  15409. $665 = tempRet0;
  15410. $666 = (_i64Add(($664|0),($665|0),($652|0),($653|0))|0);
  15411. $667 = tempRet0;
  15412. $668 = (_bitshift64Shl(($652|0),($653|0),21)|0);
  15413. $669 = tempRet0;
  15414. $670 = (_i64Subtract(($244|0),($245|0),($668|0),($669|0))|0);
  15415. $671 = tempRet0;
  15416. $672 = (_i64Add(($284|0),($285|0),1048576,0)|0);
  15417. $673 = tempRet0;
  15418. $674 = (_bitshift64Ashr(($672|0),($673|0),21)|0);
  15419. $675 = tempRet0;
  15420. $676 = (_i64Add(($298|0),($299|0),($300|0),($301|0))|0);
  15421. $677 = tempRet0;
  15422. $678 = (_i64Add(($676|0),($677|0),($296|0),($297|0))|0);
  15423. $679 = tempRet0;
  15424. $680 = (_i64Add(($678|0),($679|0),($294|0),($295|0))|0);
  15425. $681 = tempRet0;
  15426. $682 = (_i64Add(($680|0),($681|0),($292|0),($293|0))|0);
  15427. $683 = tempRet0;
  15428. $684 = (_i64Add(($682|0),($683|0),($290|0),($291|0))|0);
  15429. $685 = tempRet0;
  15430. $686 = (_i64Add(($684|0),($685|0),($288|0),($289|0))|0);
  15431. $687 = tempRet0;
  15432. $688 = (_i64Add(($686|0),($687|0),($286|0),($287|0))|0);
  15433. $689 = tempRet0;
  15434. $690 = (_i64Add(($688|0),($689|0),($176|0),0)|0);
  15435. $691 = tempRet0;
  15436. $692 = (_i64Add(($690|0),($691|0),($674|0),($675|0))|0);
  15437. $693 = tempRet0;
  15438. $694 = (_bitshift64Shl(($674|0),($675|0),21)|0);
  15439. $695 = tempRet0;
  15440. $696 = (_i64Add(($336|0),($337|0),1048576,0)|0);
  15441. $697 = tempRet0;
  15442. $698 = (_bitshift64Ashr(($696|0),($697|0),21)|0);
  15443. $699 = tempRet0;
  15444. $700 = (_i64Add(($354|0),($355|0),($356|0),($357|0))|0);
  15445. $701 = tempRet0;
  15446. $702 = (_i64Add(($700|0),($701|0),($352|0),($353|0))|0);
  15447. $703 = tempRet0;
  15448. $704 = (_i64Add(($702|0),($703|0),($350|0),($351|0))|0);
  15449. $705 = tempRet0;
  15450. $706 = (_i64Add(($704|0),($705|0),($348|0),($349|0))|0);
  15451. $707 = tempRet0;
  15452. $708 = (_i64Add(($706|0),($707|0),($346|0),($347|0))|0);
  15453. $709 = tempRet0;
  15454. $710 = (_i64Add(($708|0),($709|0),($344|0),($345|0))|0);
  15455. $711 = tempRet0;
  15456. $712 = (_i64Add(($710|0),($711|0),($340|0),($341|0))|0);
  15457. $713 = tempRet0;
  15458. $714 = (_i64Add(($712|0),($713|0),($342|0),($343|0))|0);
  15459. $715 = tempRet0;
  15460. $716 = (_i64Add(($714|0),($715|0),($338|0),($339|0))|0);
  15461. $717 = tempRet0;
  15462. $718 = (_i64Add(($716|0),($717|0),($186|0),0)|0);
  15463. $719 = tempRet0;
  15464. $720 = (_i64Add(($718|0),($719|0),($698|0),($699|0))|0);
  15465. $721 = tempRet0;
  15466. $722 = (_bitshift64Shl(($698|0),($699|0),21)|0);
  15467. $723 = tempRet0;
  15468. $724 = (_i64Add(($400|0),($401|0),1048576,0)|0);
  15469. $725 = tempRet0;
  15470. $726 = (_bitshift64Ashr(($724|0),($725|0),21)|0);
  15471. $727 = tempRet0;
  15472. $728 = (_i64Add(($422|0),($423|0),($424|0),($425|0))|0);
  15473. $729 = tempRet0;
  15474. $730 = (_i64Add(($728|0),($729|0),($420|0),($421|0))|0);
  15475. $731 = tempRet0;
  15476. $732 = (_i64Add(($730|0),($731|0),($418|0),($419|0))|0);
  15477. $733 = tempRet0;
  15478. $734 = (_i64Add(($732|0),($733|0),($416|0),($417|0))|0);
  15479. $735 = tempRet0;
  15480. $736 = (_i64Add(($734|0),($735|0),($414|0),($415|0))|0);
  15481. $737 = tempRet0;
  15482. $738 = (_i64Add(($736|0),($737|0),($412|0),($413|0))|0);
  15483. $739 = tempRet0;
  15484. $740 = (_i64Add(($738|0),($739|0),($408|0),($409|0))|0);
  15485. $741 = tempRet0;
  15486. $742 = (_i64Add(($740|0),($741|0),($410|0),($411|0))|0);
  15487. $743 = tempRet0;
  15488. $744 = (_i64Add(($742|0),($743|0),($406|0),($407|0))|0);
  15489. $745 = tempRet0;
  15490. $746 = (_i64Add(($744|0),($745|0),($402|0),($403|0))|0);
  15491. $747 = tempRet0;
  15492. $748 = (_i64Add(($746|0),($747|0),($404|0),($405|0))|0);
  15493. $749 = tempRet0;
  15494. $750 = (_i64Add(($748|0),($749|0),($196|0),($197|0))|0);
  15495. $751 = tempRet0;
  15496. $752 = (_i64Add(($750|0),($751|0),($726|0),($727|0))|0);
  15497. $753 = tempRet0;
  15498. $754 = (_bitshift64Shl(($726|0),($727|0),21)|0);
  15499. $755 = tempRet0;
  15500. $756 = (_i64Add(($466|0),($467|0),1048576,0)|0);
  15501. $757 = tempRet0;
  15502. $758 = (_bitshift64Ashr(($756|0),($757|0),21)|0);
  15503. $759 = tempRet0;
  15504. $760 = (_i64Add(($484|0),($485|0),($486|0),($487|0))|0);
  15505. $761 = tempRet0;
  15506. $762 = (_i64Add(($760|0),($761|0),($482|0),($483|0))|0);
  15507. $763 = tempRet0;
  15508. $764 = (_i64Add(($762|0),($763|0),($480|0),($481|0))|0);
  15509. $765 = tempRet0;
  15510. $766 = (_i64Add(($764|0),($765|0),($478|0),($479|0))|0);
  15511. $767 = tempRet0;
  15512. $768 = (_i64Add(($766|0),($767|0),($474|0),($475|0))|0);
  15513. $769 = tempRet0;
  15514. $770 = (_i64Add(($768|0),($769|0),($476|0),($477|0))|0);
  15515. $771 = tempRet0;
  15516. $772 = (_i64Add(($770|0),($771|0),($472|0),($473|0))|0);
  15517. $773 = tempRet0;
  15518. $774 = (_i64Add(($772|0),($773|0),($470|0),($471|0))|0);
  15519. $775 = tempRet0;
  15520. $776 = (_i64Add(($774|0),($775|0),($468|0),($469|0))|0);
  15521. $777 = tempRet0;
  15522. $778 = (_i64Add(($776|0),($777|0),($758|0),($759|0))|0);
  15523. $779 = tempRet0;
  15524. $780 = (_bitshift64Shl(($758|0),($759|0),21)|0);
  15525. $781 = tempRet0;
  15526. $782 = (_i64Add(($520|0),($521|0),1048576,0)|0);
  15527. $783 = tempRet0;
  15528. $784 = (_bitshift64Ashr(($782|0),($783|0),21)|0);
  15529. $785 = tempRet0;
  15530. $786 = (_i64Add(($534|0),($535|0),($536|0),($537|0))|0);
  15531. $787 = tempRet0;
  15532. $788 = (_i64Add(($786|0),($787|0),($532|0),($533|0))|0);
  15533. $789 = tempRet0;
  15534. $790 = (_i64Add(($788|0),($789|0),($528|0),($529|0))|0);
  15535. $791 = tempRet0;
  15536. $792 = (_i64Add(($790|0),($791|0),($530|0),($531|0))|0);
  15537. $793 = tempRet0;
  15538. $794 = (_i64Add(($792|0),($793|0),($526|0),($527|0))|0);
  15539. $795 = tempRet0;
  15540. $796 = (_i64Add(($794|0),($795|0),($524|0),($525|0))|0);
  15541. $797 = tempRet0;
  15542. $798 = (_i64Add(($796|0),($797|0),($522|0),($523|0))|0);
  15543. $799 = tempRet0;
  15544. $800 = (_i64Add(($798|0),($799|0),($784|0),($785|0))|0);
  15545. $801 = tempRet0;
  15546. $802 = (_bitshift64Shl(($784|0),($785|0),21)|0);
  15547. $803 = tempRet0;
  15548. $804 = (_i64Add(($562|0),($563|0),1048576,0)|0);
  15549. $805 = tempRet0;
  15550. $806 = (_bitshift64Ashr(($804|0),($805|0),21)|0);
  15551. $807 = tempRet0;
  15552. $808 = (_i64Add(($570|0),($571|0),($574|0),($575|0))|0);
  15553. $809 = tempRet0;
  15554. $810 = (_i64Add(($808|0),($809|0),($572|0),($573|0))|0);
  15555. $811 = tempRet0;
  15556. $812 = (_i64Add(($810|0),($811|0),($568|0),($569|0))|0);
  15557. $813 = tempRet0;
  15558. $814 = (_i64Add(($812|0),($813|0),($566|0),($567|0))|0);
  15559. $815 = tempRet0;
  15560. $816 = (_i64Add(($814|0),($815|0),($564|0),($565|0))|0);
  15561. $817 = tempRet0;
  15562. $818 = (_i64Add(($816|0),($817|0),($806|0),($807|0))|0);
  15563. $819 = tempRet0;
  15564. $820 = (_bitshift64Shl(($806|0),($807|0),21)|0);
  15565. $821 = tempRet0;
  15566. $822 = (_i64Add(($592|0),($593|0),1048576,0)|0);
  15567. $823 = tempRet0;
  15568. $824 = (_bitshift64Ashr(($822|0),($823|0),21)|0);
  15569. $825 = tempRet0;
  15570. $826 = (_i64Add(($598|0),($599|0),($600|0),($601|0))|0);
  15571. $827 = tempRet0;
  15572. $828 = (_i64Add(($826|0),($827|0),($596|0),($597|0))|0);
  15573. $829 = tempRet0;
  15574. $830 = (_i64Add(($828|0),($829|0),($594|0),($595|0))|0);
  15575. $831 = tempRet0;
  15576. $832 = (_i64Add(($830|0),($831|0),($824|0),($825|0))|0);
  15577. $833 = tempRet0;
  15578. $834 = (_bitshift64Shl(($824|0),($825|0),21)|0);
  15579. $835 = tempRet0;
  15580. $836 = (_i64Subtract(($592|0),($593|0),($834|0),($835|0))|0);
  15581. $837 = tempRet0;
  15582. $838 = (_i64Add(($610|0),($611|0),1048576,0)|0);
  15583. $839 = tempRet0;
  15584. $840 = (_bitshift64Lshr(($838|0),($839|0),21)|0);
  15585. $841 = tempRet0;
  15586. $842 = (_i64Add(($616|0),($617|0),($840|0),($841|0))|0);
  15587. $843 = tempRet0;
  15588. $844 = (_bitshift64Shl(($840|0),($841|0),21)|0);
  15589. $845 = tempRet0;
  15590. $846 = (_i64Subtract(($610|0),($611|0),($844|0),($845|0))|0);
  15591. $847 = tempRet0;
  15592. $848 = (_i64Add(($618|0),($619|0),1048576,0)|0);
  15593. $849 = tempRet0;
  15594. $850 = (_bitshift64Lshr(($848|0),($849|0),21)|0);
  15595. $851 = tempRet0;
  15596. $852 = (_bitshift64Shl(($850|0),($851|0),21)|0);
  15597. $853 = tempRet0;
  15598. $854 = (_i64Subtract(($618|0),($619|0),($852|0),($853|0))|0);
  15599. $855 = tempRet0;
  15600. $856 = (_i64Add(($628|0),($629|0),1048576,0)|0);
  15601. $857 = tempRet0;
  15602. $858 = (_bitshift64Lshr(($856|0),($857|0),21)|0);
  15603. $859 = tempRet0;
  15604. $860 = (_bitshift64Shl(($858|0),($859|0),21)|0);
  15605. $861 = tempRet0;
  15606. $862 = (_i64Subtract(($628|0),($629|0),($860|0),($861|0))|0);
  15607. $863 = tempRet0;
  15608. $864 = (_i64Add(($646|0),($647|0),1048576,0)|0);
  15609. $865 = tempRet0;
  15610. $866 = (_bitshift64Ashr(($864|0),($865|0),21)|0);
  15611. $867 = tempRet0;
  15612. $868 = (_i64Add(($670|0),($671|0),($866|0),($867|0))|0);
  15613. $869 = tempRet0;
  15614. $870 = (_bitshift64Shl(($866|0),($867|0),21)|0);
  15615. $871 = tempRet0;
  15616. $872 = (_i64Subtract(($646|0),($647|0),($870|0),($871|0))|0);
  15617. $873 = tempRet0;
  15618. $874 = (_i64Add(($666|0),($667|0),1048576,0)|0);
  15619. $875 = tempRet0;
  15620. $876 = (_bitshift64Ashr(($874|0),($875|0),21)|0);
  15621. $877 = tempRet0;
  15622. $878 = (_bitshift64Shl(($876|0),($877|0),21)|0);
  15623. $879 = tempRet0;
  15624. $880 = (_i64Subtract(($666|0),($667|0),($878|0),($879|0))|0);
  15625. $881 = tempRet0;
  15626. $882 = (_i64Add(($692|0),($693|0),1048576,0)|0);
  15627. $883 = tempRet0;
  15628. $884 = (_bitshift64Ashr(($882|0),($883|0),21)|0);
  15629. $885 = tempRet0;
  15630. $886 = (_bitshift64Shl(($884|0),($885|0),21)|0);
  15631. $887 = tempRet0;
  15632. $888 = (_i64Add(($720|0),($721|0),1048576,0)|0);
  15633. $889 = tempRet0;
  15634. $890 = (_bitshift64Ashr(($888|0),($889|0),21)|0);
  15635. $891 = tempRet0;
  15636. $892 = (_bitshift64Shl(($890|0),($891|0),21)|0);
  15637. $893 = tempRet0;
  15638. $894 = (_i64Add(($752|0),($753|0),1048576,0)|0);
  15639. $895 = tempRet0;
  15640. $896 = (_bitshift64Ashr(($894|0),($895|0),21)|0);
  15641. $897 = tempRet0;
  15642. $898 = (_bitshift64Shl(($896|0),($897|0),21)|0);
  15643. $899 = tempRet0;
  15644. $900 = (_i64Add(($778|0),($779|0),1048576,0)|0);
  15645. $901 = tempRet0;
  15646. $902 = (_bitshift64Ashr(($900|0),($901|0),21)|0);
  15647. $903 = tempRet0;
  15648. $904 = (_bitshift64Shl(($902|0),($903|0),21)|0);
  15649. $905 = tempRet0;
  15650. $906 = (_i64Add(($800|0),($801|0),1048576,0)|0);
  15651. $907 = tempRet0;
  15652. $908 = (_bitshift64Ashr(($906|0),($907|0),21)|0);
  15653. $909 = tempRet0;
  15654. $910 = (_bitshift64Shl(($908|0),($909|0),21)|0);
  15655. $911 = tempRet0;
  15656. $912 = (_i64Add(($818|0),($819|0),1048576,0)|0);
  15657. $913 = tempRet0;
  15658. $914 = (_bitshift64Ashr(($912|0),($913|0),21)|0);
  15659. $915 = tempRet0;
  15660. $916 = (_i64Add(($914|0),($915|0),($836|0),($837|0))|0);
  15661. $917 = tempRet0;
  15662. $918 = (_bitshift64Shl(($914|0),($915|0),21)|0);
  15663. $919 = tempRet0;
  15664. $920 = (_i64Subtract(($818|0),($819|0),($918|0),($919|0))|0);
  15665. $921 = tempRet0;
  15666. $922 = (_i64Add(($832|0),($833|0),1048576,0)|0);
  15667. $923 = tempRet0;
  15668. $924 = (_bitshift64Ashr(($922|0),($923|0),21)|0);
  15669. $925 = tempRet0;
  15670. $926 = (_i64Add(($924|0),($925|0),($846|0),($847|0))|0);
  15671. $927 = tempRet0;
  15672. $928 = (_bitshift64Shl(($924|0),($925|0),21)|0);
  15673. $929 = tempRet0;
  15674. $930 = (_i64Subtract(($832|0),($833|0),($928|0),($929|0))|0);
  15675. $931 = tempRet0;
  15676. $932 = (_i64Add(($842|0),($843|0),1048576,0)|0);
  15677. $933 = tempRet0;
  15678. $934 = (_bitshift64Lshr(($932|0),($933|0),21)|0);
  15679. $935 = tempRet0;
  15680. $936 = (_i64Add(($934|0),($935|0),($854|0),($855|0))|0);
  15681. $937 = tempRet0;
  15682. $938 = (_bitshift64Shl(($934|0),($935|0),21)|0);
  15683. $939 = tempRet0;
  15684. $940 = (_i64Subtract(($842|0),($843|0),($938|0),($939|0))|0);
  15685. $941 = tempRet0;
  15686. $942 = (___muldi3(($850|0),($851|0),666643,0)|0);
  15687. $943 = tempRet0;
  15688. $944 = (___muldi3(($850|0),($851|0),470296,0)|0);
  15689. $945 = tempRet0;
  15690. $946 = (___muldi3(($850|0),($851|0),654183,0)|0);
  15691. $947 = tempRet0;
  15692. $948 = (___muldi3(($850|0),($851|0),-997805,-1)|0);
  15693. $949 = tempRet0;
  15694. $950 = (___muldi3(($850|0),($851|0),136657,0)|0);
  15695. $951 = tempRet0;
  15696. $952 = (___muldi3(($850|0),($851|0),-683901,-1)|0);
  15697. $953 = tempRet0;
  15698. $954 = (_i64Add(($952|0),($953|0),($562|0),($563|0))|0);
  15699. $955 = tempRet0;
  15700. $956 = (_i64Subtract(($954|0),($955|0),($820|0),($821|0))|0);
  15701. $957 = tempRet0;
  15702. $958 = (_i64Add(($956|0),($957|0),($908|0),($909|0))|0);
  15703. $959 = tempRet0;
  15704. $960 = (___muldi3(($936|0),($937|0),666643,0)|0);
  15705. $961 = tempRet0;
  15706. $962 = (___muldi3(($936|0),($937|0),470296,0)|0);
  15707. $963 = tempRet0;
  15708. $964 = (___muldi3(($936|0),($937|0),654183,0)|0);
  15709. $965 = tempRet0;
  15710. $966 = (___muldi3(($936|0),($937|0),-997805,-1)|0);
  15711. $967 = tempRet0;
  15712. $968 = (___muldi3(($936|0),($937|0),136657,0)|0);
  15713. $969 = tempRet0;
  15714. $970 = (___muldi3(($936|0),($937|0),-683901,-1)|0);
  15715. $971 = tempRet0;
  15716. $972 = (___muldi3(($940|0),($941|0),666643,0)|0);
  15717. $973 = tempRet0;
  15718. $974 = (___muldi3(($940|0),($941|0),470296,0)|0);
  15719. $975 = tempRet0;
  15720. $976 = (___muldi3(($940|0),($941|0),654183,0)|0);
  15721. $977 = tempRet0;
  15722. $978 = (___muldi3(($940|0),($941|0),-997805,-1)|0);
  15723. $979 = tempRet0;
  15724. $980 = (___muldi3(($940|0),($941|0),136657,0)|0);
  15725. $981 = tempRet0;
  15726. $982 = (___muldi3(($940|0),($941|0),-683901,-1)|0);
  15727. $983 = tempRet0;
  15728. $984 = (_i64Add(($948|0),($949|0),($520|0),($521|0))|0);
  15729. $985 = tempRet0;
  15730. $986 = (_i64Subtract(($984|0),($985|0),($802|0),($803|0))|0);
  15731. $987 = tempRet0;
  15732. $988 = (_i64Add(($986|0),($987|0),($902|0),($903|0))|0);
  15733. $989 = tempRet0;
  15734. $990 = (_i64Add(($988|0),($989|0),($968|0),($969|0))|0);
  15735. $991 = tempRet0;
  15736. $992 = (_i64Add(($990|0),($991|0),($982|0),($983|0))|0);
  15737. $993 = tempRet0;
  15738. $994 = (___muldi3(($926|0),($927|0),666643,0)|0);
  15739. $995 = tempRet0;
  15740. $996 = (___muldi3(($926|0),($927|0),470296,0)|0);
  15741. $997 = tempRet0;
  15742. $998 = (___muldi3(($926|0),($927|0),654183,0)|0);
  15743. $999 = tempRet0;
  15744. $1000 = (___muldi3(($926|0),($927|0),-997805,-1)|0);
  15745. $1001 = tempRet0;
  15746. $1002 = (___muldi3(($926|0),($927|0),136657,0)|0);
  15747. $1003 = tempRet0;
  15748. $1004 = (___muldi3(($926|0),($927|0),-683901,-1)|0);
  15749. $1005 = tempRet0;
  15750. $1006 = (___muldi3(($930|0),($931|0),666643,0)|0);
  15751. $1007 = tempRet0;
  15752. $1008 = (___muldi3(($930|0),($931|0),470296,0)|0);
  15753. $1009 = tempRet0;
  15754. $1010 = (___muldi3(($930|0),($931|0),654183,0)|0);
  15755. $1011 = tempRet0;
  15756. $1012 = (___muldi3(($930|0),($931|0),-997805,-1)|0);
  15757. $1013 = tempRet0;
  15758. $1014 = (___muldi3(($930|0),($931|0),136657,0)|0);
  15759. $1015 = tempRet0;
  15760. $1016 = (___muldi3(($930|0),($931|0),-683901,-1)|0);
  15761. $1017 = tempRet0;
  15762. $1018 = (_i64Add(($944|0),($945|0),($466|0),($467|0))|0);
  15763. $1019 = tempRet0;
  15764. $1020 = (_i64Subtract(($1018|0),($1019|0),($780|0),($781|0))|0);
  15765. $1021 = tempRet0;
  15766. $1022 = (_i64Add(($1020|0),($1021|0),($964|0),($965|0))|0);
  15767. $1023 = tempRet0;
  15768. $1024 = (_i64Add(($1022|0),($1023|0),($1002|0),($1003|0))|0);
  15769. $1025 = tempRet0;
  15770. $1026 = (_i64Add(($1024|0),($1025|0),($978|0),($979|0))|0);
  15771. $1027 = tempRet0;
  15772. $1028 = (_i64Add(($1026|0),($1027|0),($1016|0),($1017|0))|0);
  15773. $1029 = tempRet0;
  15774. $1030 = (_i64Add(($1028|0),($1029|0),($896|0),($897|0))|0);
  15775. $1031 = tempRet0;
  15776. $1032 = (___muldi3(($916|0),($917|0),666643,0)|0);
  15777. $1033 = tempRet0;
  15778. $1034 = (_i64Add(($1032|0),($1033|0),($284|0),($285|0))|0);
  15779. $1035 = tempRet0;
  15780. $1036 = (_i64Subtract(($1034|0),($1035|0),($694|0),($695|0))|0);
  15781. $1037 = tempRet0;
  15782. $1038 = (_i64Add(($1036|0),($1037|0),($876|0),($877|0))|0);
  15783. $1039 = tempRet0;
  15784. $1040 = (___muldi3(($916|0),($917|0),470296,0)|0);
  15785. $1041 = tempRet0;
  15786. $1042 = (___muldi3(($916|0),($917|0),654183,0)|0);
  15787. $1043 = tempRet0;
  15788. $1044 = (_i64Add(($994|0),($995|0),($336|0),($337|0))|0);
  15789. $1045 = tempRet0;
  15790. $1046 = (_i64Add(($1044|0),($1045|0),($1042|0),($1043|0))|0);
  15791. $1047 = tempRet0;
  15792. $1048 = (_i64Add(($1046|0),($1047|0),($1008|0),($1009|0))|0);
  15793. $1049 = tempRet0;
  15794. $1050 = (_i64Subtract(($1048|0),($1049|0),($722|0),($723|0))|0);
  15795. $1051 = tempRet0;
  15796. $1052 = (_i64Add(($1050|0),($1051|0),($884|0),($885|0))|0);
  15797. $1053 = tempRet0;
  15798. $1054 = (___muldi3(($916|0),($917|0),-997805,-1)|0);
  15799. $1055 = tempRet0;
  15800. $1056 = (___muldi3(($916|0),($917|0),136657,0)|0);
  15801. $1057 = tempRet0;
  15802. $1058 = (_i64Add(($998|0),($999|0),($960|0),($961|0))|0);
  15803. $1059 = tempRet0;
  15804. $1060 = (_i64Add(($1058|0),($1059|0),($1056|0),($1057|0))|0);
  15805. $1061 = tempRet0;
  15806. $1062 = (_i64Add(($1060|0),($1061|0),($974|0),($975|0))|0);
  15807. $1063 = tempRet0;
  15808. $1064 = (_i64Add(($1062|0),($1063|0),($1012|0),($1013|0))|0);
  15809. $1065 = tempRet0;
  15810. $1066 = (_i64Add(($1064|0),($1065|0),($400|0),($401|0))|0);
  15811. $1067 = tempRet0;
  15812. $1068 = (_i64Add(($1066|0),($1067|0),($890|0),($891|0))|0);
  15813. $1069 = tempRet0;
  15814. $1070 = (_i64Subtract(($1068|0),($1069|0),($754|0),($755|0))|0);
  15815. $1071 = tempRet0;
  15816. $1072 = (___muldi3(($916|0),($917|0),-683901,-1)|0);
  15817. $1073 = tempRet0;
  15818. $1074 = (_i64Add(($1038|0),($1039|0),1048576,0)|0);
  15819. $1075 = tempRet0;
  15820. $1076 = (_bitshift64Ashr(($1074|0),($1075|0),21)|0);
  15821. $1077 = tempRet0;
  15822. $1078 = (_i64Add(($1006|0),($1007|0),($1040|0),($1041|0))|0);
  15823. $1079 = tempRet0;
  15824. $1080 = (_i64Add(($1078|0),($1079|0),($692|0),($693|0))|0);
  15825. $1081 = tempRet0;
  15826. $1082 = (_i64Subtract(($1080|0),($1081|0),($886|0),($887|0))|0);
  15827. $1083 = tempRet0;
  15828. $1084 = (_i64Add(($1082|0),($1083|0),($1076|0),($1077|0))|0);
  15829. $1085 = tempRet0;
  15830. $1086 = (_bitshift64Shl(($1076|0),($1077|0),21)|0);
  15831. $1087 = tempRet0;
  15832. $1088 = (_i64Add(($1052|0),($1053|0),1048576,0)|0);
  15833. $1089 = tempRet0;
  15834. $1090 = (_bitshift64Ashr(($1088|0),($1089|0),21)|0);
  15835. $1091 = tempRet0;
  15836. $1092 = (_i64Add(($1054|0),($1055|0),($996|0),($997|0))|0);
  15837. $1093 = tempRet0;
  15838. $1094 = (_i64Add(($1092|0),($1093|0),($972|0),($973|0))|0);
  15839. $1095 = tempRet0;
  15840. $1096 = (_i64Add(($1094|0),($1095|0),($1010|0),($1011|0))|0);
  15841. $1097 = tempRet0;
  15842. $1098 = (_i64Add(($1096|0),($1097|0),($720|0),($721|0))|0);
  15843. $1099 = tempRet0;
  15844. $1100 = (_i64Subtract(($1098|0),($1099|0),($892|0),($893|0))|0);
  15845. $1101 = tempRet0;
  15846. $1102 = (_i64Add(($1100|0),($1101|0),($1090|0),($1091|0))|0);
  15847. $1103 = tempRet0;
  15848. $1104 = (_bitshift64Shl(($1090|0),($1091|0),21)|0);
  15849. $1105 = tempRet0;
  15850. $1106 = (_i64Add(($1070|0),($1071|0),1048576,0)|0);
  15851. $1107 = tempRet0;
  15852. $1108 = (_bitshift64Ashr(($1106|0),($1107|0),21)|0);
  15853. $1109 = tempRet0;
  15854. $1110 = (_i64Add(($962|0),($963|0),($942|0),($943|0))|0);
  15855. $1111 = tempRet0;
  15856. $1112 = (_i64Add(($1110|0),($1111|0),($1000|0),($1001|0))|0);
  15857. $1113 = tempRet0;
  15858. $1114 = (_i64Add(($1112|0),($1113|0),($1072|0),($1073|0))|0);
  15859. $1115 = tempRet0;
  15860. $1116 = (_i64Add(($1114|0),($1115|0),($976|0),($977|0))|0);
  15861. $1117 = tempRet0;
  15862. $1118 = (_i64Add(($1116|0),($1117|0),($1014|0),($1015|0))|0);
  15863. $1119 = tempRet0;
  15864. $1120 = (_i64Add(($1118|0),($1119|0),($752|0),($753|0))|0);
  15865. $1121 = tempRet0;
  15866. $1122 = (_i64Subtract(($1120|0),($1121|0),($898|0),($899|0))|0);
  15867. $1123 = tempRet0;
  15868. $1124 = (_i64Add(($1122|0),($1123|0),($1108|0),($1109|0))|0);
  15869. $1125 = tempRet0;
  15870. $1126 = (_bitshift64Shl(($1108|0),($1109|0),21)|0);
  15871. $1127 = tempRet0;
  15872. $1128 = (_i64Add(($1030|0),($1031|0),1048576,0)|0);
  15873. $1129 = tempRet0;
  15874. $1130 = (_bitshift64Ashr(($1128|0),($1129|0),21)|0);
  15875. $1131 = tempRet0;
  15876. $1132 = (_i64Add(($778|0),($779|0),($946|0),($947|0))|0);
  15877. $1133 = tempRet0;
  15878. $1134 = (_i64Subtract(($1132|0),($1133|0),($904|0),($905|0))|0);
  15879. $1135 = tempRet0;
  15880. $1136 = (_i64Add(($1134|0),($1135|0),($966|0),($967|0))|0);
  15881. $1137 = tempRet0;
  15882. $1138 = (_i64Add(($1136|0),($1137|0),($1004|0),($1005|0))|0);
  15883. $1139 = tempRet0;
  15884. $1140 = (_i64Add(($1138|0),($1139|0),($980|0),($981|0))|0);
  15885. $1141 = tempRet0;
  15886. $1142 = (_i64Add(($1140|0),($1141|0),($1130|0),($1131|0))|0);
  15887. $1143 = tempRet0;
  15888. $1144 = (_bitshift64Shl(($1130|0),($1131|0),21)|0);
  15889. $1145 = tempRet0;
  15890. $1146 = (_i64Subtract(($1030|0),($1031|0),($1144|0),($1145|0))|0);
  15891. $1147 = tempRet0;
  15892. $1148 = (_i64Add(($992|0),($993|0),1048576,0)|0);
  15893. $1149 = tempRet0;
  15894. $1150 = (_bitshift64Ashr(($1148|0),($1149|0),21)|0);
  15895. $1151 = tempRet0;
  15896. $1152 = (_i64Add(($800|0),($801|0),($950|0),($951|0))|0);
  15897. $1153 = tempRet0;
  15898. $1154 = (_i64Subtract(($1152|0),($1153|0),($910|0),($911|0))|0);
  15899. $1155 = tempRet0;
  15900. $1156 = (_i64Add(($1154|0),($1155|0),($970|0),($971|0))|0);
  15901. $1157 = tempRet0;
  15902. $1158 = (_i64Add(($1156|0),($1157|0),($1150|0),($1151|0))|0);
  15903. $1159 = tempRet0;
  15904. $1160 = (_bitshift64Shl(($1150|0),($1151|0),21)|0);
  15905. $1161 = tempRet0;
  15906. $1162 = (_i64Subtract(($992|0),($993|0),($1160|0),($1161|0))|0);
  15907. $1163 = tempRet0;
  15908. $1164 = (_i64Add(($958|0),($959|0),1048576,0)|0);
  15909. $1165 = tempRet0;
  15910. $1166 = (_bitshift64Ashr(($1164|0),($1165|0),21)|0);
  15911. $1167 = tempRet0;
  15912. $1168 = (_i64Add(($1166|0),($1167|0),($920|0),($921|0))|0);
  15913. $1169 = tempRet0;
  15914. $1170 = (_bitshift64Shl(($1166|0),($1167|0),21)|0);
  15915. $1171 = tempRet0;
  15916. $1172 = (_i64Subtract(($958|0),($959|0),($1170|0),($1171|0))|0);
  15917. $1173 = tempRet0;
  15918. $1174 = (_i64Add(($1084|0),($1085|0),1048576,0)|0);
  15919. $1175 = tempRet0;
  15920. $1176 = (_bitshift64Ashr(($1174|0),($1175|0),21)|0);
  15921. $1177 = tempRet0;
  15922. $1178 = (_bitshift64Shl(($1176|0),($1177|0),21)|0);
  15923. $1179 = tempRet0;
  15924. $1180 = (_i64Add(($1102|0),($1103|0),1048576,0)|0);
  15925. $1181 = tempRet0;
  15926. $1182 = (_bitshift64Ashr(($1180|0),($1181|0),21)|0);
  15927. $1183 = tempRet0;
  15928. $1184 = (_bitshift64Shl(($1182|0),($1183|0),21)|0);
  15929. $1185 = tempRet0;
  15930. $1186 = (_i64Add(($1124|0),($1125|0),1048576,0)|0);
  15931. $1187 = tempRet0;
  15932. $1188 = (_bitshift64Ashr(($1186|0),($1187|0),21)|0);
  15933. $1189 = tempRet0;
  15934. $1190 = (_i64Add(($1146|0),($1147|0),($1188|0),($1189|0))|0);
  15935. $1191 = tempRet0;
  15936. $1192 = (_bitshift64Shl(($1188|0),($1189|0),21)|0);
  15937. $1193 = tempRet0;
  15938. $1194 = (_i64Subtract(($1124|0),($1125|0),($1192|0),($1193|0))|0);
  15939. $1195 = tempRet0;
  15940. $1196 = (_i64Add(($1142|0),($1143|0),1048576,0)|0);
  15941. $1197 = tempRet0;
  15942. $1198 = (_bitshift64Ashr(($1196|0),($1197|0),21)|0);
  15943. $1199 = tempRet0;
  15944. $1200 = (_i64Add(($1198|0),($1199|0),($1162|0),($1163|0))|0);
  15945. $1201 = tempRet0;
  15946. $1202 = (_bitshift64Shl(($1198|0),($1199|0),21)|0);
  15947. $1203 = tempRet0;
  15948. $1204 = (_i64Subtract(($1142|0),($1143|0),($1202|0),($1203|0))|0);
  15949. $1205 = tempRet0;
  15950. $1206 = (_i64Add(($1158|0),($1159|0),1048576,0)|0);
  15951. $1207 = tempRet0;
  15952. $1208 = (_bitshift64Ashr(($1206|0),($1207|0),21)|0);
  15953. $1209 = tempRet0;
  15954. $1210 = (_i64Add(($1208|0),($1209|0),($1172|0),($1173|0))|0);
  15955. $1211 = tempRet0;
  15956. $1212 = (_bitshift64Shl(($1208|0),($1209|0),21)|0);
  15957. $1213 = tempRet0;
  15958. $1214 = (_i64Subtract(($1158|0),($1159|0),($1212|0),($1213|0))|0);
  15959. $1215 = tempRet0;
  15960. $1216 = (___muldi3(($1168|0),($1169|0),666643,0)|0);
  15961. $1217 = tempRet0;
  15962. $1218 = (_i64Add(($880|0),($881|0),($1216|0),($1217|0))|0);
  15963. $1219 = tempRet0;
  15964. $1220 = (___muldi3(($1168|0),($1169|0),470296,0)|0);
  15965. $1221 = tempRet0;
  15966. $1222 = (___muldi3(($1168|0),($1169|0),654183,0)|0);
  15967. $1223 = tempRet0;
  15968. $1224 = (___muldi3(($1168|0),($1169|0),-997805,-1)|0);
  15969. $1225 = tempRet0;
  15970. $1226 = (___muldi3(($1168|0),($1169|0),136657,0)|0);
  15971. $1227 = tempRet0;
  15972. $1228 = (___muldi3(($1168|0),($1169|0),-683901,-1)|0);
  15973. $1229 = tempRet0;
  15974. $1230 = (_i64Add(($1070|0),($1071|0),($1228|0),($1229|0))|0);
  15975. $1231 = tempRet0;
  15976. $1232 = (_i64Subtract(($1230|0),($1231|0),($1126|0),($1127|0))|0);
  15977. $1233 = tempRet0;
  15978. $1234 = (_i64Add(($1232|0),($1233|0),($1182|0),($1183|0))|0);
  15979. $1235 = tempRet0;
  15980. $1236 = (___muldi3(($1210|0),($1211|0),666643,0)|0);
  15981. $1237 = tempRet0;
  15982. $1238 = (_i64Add(($868|0),($869|0),($1236|0),($1237|0))|0);
  15983. $1239 = tempRet0;
  15984. $1240 = (___muldi3(($1210|0),($1211|0),470296,0)|0);
  15985. $1241 = tempRet0;
  15986. $1242 = (_i64Add(($1218|0),($1219|0),($1240|0),($1241|0))|0);
  15987. $1243 = tempRet0;
  15988. $1244 = (___muldi3(($1210|0),($1211|0),654183,0)|0);
  15989. $1245 = tempRet0;
  15990. $1246 = (___muldi3(($1210|0),($1211|0),-997805,-1)|0);
  15991. $1247 = tempRet0;
  15992. $1248 = (___muldi3(($1210|0),($1211|0),136657,0)|0);
  15993. $1249 = tempRet0;
  15994. $1250 = (___muldi3(($1210|0),($1211|0),-683901,-1)|0);
  15995. $1251 = tempRet0;
  15996. $1252 = (___muldi3(($1214|0),($1215|0),666643,0)|0);
  15997. $1253 = tempRet0;
  15998. $1254 = (_i64Add(($872|0),($873|0),($1252|0),($1253|0))|0);
  15999. $1255 = tempRet0;
  16000. $1256 = (___muldi3(($1214|0),($1215|0),470296,0)|0);
  16001. $1257 = tempRet0;
  16002. $1258 = (_i64Add(($1238|0),($1239|0),($1256|0),($1257|0))|0);
  16003. $1259 = tempRet0;
  16004. $1260 = (___muldi3(($1214|0),($1215|0),654183,0)|0);
  16005. $1261 = tempRet0;
  16006. $1262 = (_i64Add(($1242|0),($1243|0),($1260|0),($1261|0))|0);
  16007. $1263 = tempRet0;
  16008. $1264 = (___muldi3(($1214|0),($1215|0),-997805,-1)|0);
  16009. $1265 = tempRet0;
  16010. $1266 = (___muldi3(($1214|0),($1215|0),136657,0)|0);
  16011. $1267 = tempRet0;
  16012. $1268 = (___muldi3(($1214|0),($1215|0),-683901,-1)|0);
  16013. $1269 = tempRet0;
  16014. $1270 = (_i64Add(($1052|0),($1053|0),($1224|0),($1225|0))|0);
  16015. $1271 = tempRet0;
  16016. $1272 = (_i64Subtract(($1270|0),($1271|0),($1104|0),($1105|0))|0);
  16017. $1273 = tempRet0;
  16018. $1274 = (_i64Add(($1272|0),($1273|0),($1176|0),($1177|0))|0);
  16019. $1275 = tempRet0;
  16020. $1276 = (_i64Add(($1274|0),($1275|0),($1248|0),($1249|0))|0);
  16021. $1277 = tempRet0;
  16022. $1278 = (_i64Add(($1276|0),($1277|0),($1268|0),($1269|0))|0);
  16023. $1279 = tempRet0;
  16024. $1280 = (___muldi3(($1200|0),($1201|0),666643,0)|0);
  16025. $1281 = tempRet0;
  16026. $1282 = (___muldi3(($1200|0),($1201|0),470296,0)|0);
  16027. $1283 = tempRet0;
  16028. $1284 = (___muldi3(($1200|0),($1201|0),654183,0)|0);
  16029. $1285 = tempRet0;
  16030. $1286 = (___muldi3(($1200|0),($1201|0),-997805,-1)|0);
  16031. $1287 = tempRet0;
  16032. $1288 = (___muldi3(($1200|0),($1201|0),136657,0)|0);
  16033. $1289 = tempRet0;
  16034. $1290 = (___muldi3(($1200|0),($1201|0),-683901,-1)|0);
  16035. $1291 = tempRet0;
  16036. $1292 = (___muldi3(($1204|0),($1205|0),666643,0)|0);
  16037. $1293 = tempRet0;
  16038. $1294 = (___muldi3(($1204|0),($1205|0),470296,0)|0);
  16039. $1295 = tempRet0;
  16040. $1296 = (___muldi3(($1204|0),($1205|0),654183,0)|0);
  16041. $1297 = tempRet0;
  16042. $1298 = (___muldi3(($1204|0),($1205|0),-997805,-1)|0);
  16043. $1299 = tempRet0;
  16044. $1300 = (___muldi3(($1204|0),($1205|0),136657,0)|0);
  16045. $1301 = tempRet0;
  16046. $1302 = (___muldi3(($1204|0),($1205|0),-683901,-1)|0);
  16047. $1303 = tempRet0;
  16048. $1304 = (_i64Add(($1038|0),($1039|0),($1220|0),($1221|0))|0);
  16049. $1305 = tempRet0;
  16050. $1306 = (_i64Subtract(($1304|0),($1305|0),($1086|0),($1087|0))|0);
  16051. $1307 = tempRet0;
  16052. $1308 = (_i64Add(($1306|0),($1307|0),($1244|0),($1245|0))|0);
  16053. $1309 = tempRet0;
  16054. $1310 = (_i64Add(($1308|0),($1309|0),($1264|0),($1265|0))|0);
  16055. $1311 = tempRet0;
  16056. $1312 = (_i64Add(($1310|0),($1311|0),($1288|0),($1289|0))|0);
  16057. $1313 = tempRet0;
  16058. $1314 = (_i64Add(($1312|0),($1313|0),($1302|0),($1303|0))|0);
  16059. $1315 = tempRet0;
  16060. $1316 = (___muldi3(($1190|0),($1191|0),666643,0)|0);
  16061. $1317 = tempRet0;
  16062. $1318 = (_i64Add(($1316|0),($1317|0),($632|0),($633|0))|0);
  16063. $1319 = tempRet0;
  16064. $1320 = (___muldi3(($1190|0),($1191|0),470296,0)|0);
  16065. $1321 = tempRet0;
  16066. $1322 = (___muldi3(($1190|0),($1191|0),654183,0)|0);
  16067. $1323 = tempRet0;
  16068. $1324 = (_i64Add(($858|0),($859|0),($216|0),($217|0))|0);
  16069. $1325 = tempRet0;
  16070. $1326 = (_i64Subtract(($1324|0),($1325|0),($648|0),($649|0))|0);
  16071. $1327 = tempRet0;
  16072. $1328 = (_i64Add(($1326|0),($1327|0),($1322|0),($1323|0))|0);
  16073. $1329 = tempRet0;
  16074. $1330 = (_i64Add(($1328|0),($1329|0),($1280|0),($1281|0))|0);
  16075. $1331 = tempRet0;
  16076. $1332 = (_i64Add(($1330|0),($1331|0),($1294|0),($1295|0))|0);
  16077. $1333 = tempRet0;
  16078. $1334 = (___muldi3(($1190|0),($1191|0),-997805,-1)|0);
  16079. $1335 = tempRet0;
  16080. $1336 = (___muldi3(($1190|0),($1191|0),136657,0)|0);
  16081. $1337 = tempRet0;
  16082. $1338 = (_i64Add(($1258|0),($1259|0),($1336|0),($1337|0))|0);
  16083. $1339 = tempRet0;
  16084. $1340 = (_i64Add(($1338|0),($1339|0),($1284|0),($1285|0))|0);
  16085. $1341 = tempRet0;
  16086. $1342 = (_i64Add(($1340|0),($1341|0),($1298|0),($1299|0))|0);
  16087. $1343 = tempRet0;
  16088. $1344 = (___muldi3(($1190|0),($1191|0),-683901,-1)|0);
  16089. $1345 = tempRet0;
  16090. $1346 = (_i64Add(($1318|0),($1319|0),1048576,0)|0);
  16091. $1347 = tempRet0;
  16092. $1348 = (_bitshift64Ashr(($1346|0),($1347|0),21)|0);
  16093. $1349 = tempRet0;
  16094. $1350 = (_i64Add(($862|0),($863|0),($1320|0),($1321|0))|0);
  16095. $1351 = tempRet0;
  16096. $1352 = (_i64Add(($1350|0),($1351|0),($1292|0),($1293|0))|0);
  16097. $1353 = tempRet0;
  16098. $1354 = (_i64Add(($1352|0),($1353|0),($1348|0),($1349|0))|0);
  16099. $1355 = tempRet0;
  16100. $1356 = (_bitshift64Shl(($1348|0),($1349|0),21)|0);
  16101. $1357 = tempRet0;
  16102. $1358 = (_i64Subtract(($1318|0),($1319|0),($1356|0),($1357|0))|0);
  16103. $1359 = tempRet0;
  16104. $1360 = (_i64Add(($1332|0),($1333|0),1048576,0)|0);
  16105. $1361 = tempRet0;
  16106. $1362 = (_bitshift64Ashr(($1360|0),($1361|0),21)|0);
  16107. $1363 = tempRet0;
  16108. $1364 = (_i64Add(($1254|0),($1255|0),($1334|0),($1335|0))|0);
  16109. $1365 = tempRet0;
  16110. $1366 = (_i64Add(($1364|0),($1365|0),($1282|0),($1283|0))|0);
  16111. $1367 = tempRet0;
  16112. $1368 = (_i64Add(($1366|0),($1367|0),($1296|0),($1297|0))|0);
  16113. $1369 = tempRet0;
  16114. $1370 = (_i64Add(($1368|0),($1369|0),($1362|0),($1363|0))|0);
  16115. $1371 = tempRet0;
  16116. $1372 = (_bitshift64Shl(($1362|0),($1363|0),21)|0);
  16117. $1373 = tempRet0;
  16118. $1374 = (_i64Add(($1342|0),($1343|0),1048576,0)|0);
  16119. $1375 = tempRet0;
  16120. $1376 = (_bitshift64Ashr(($1374|0),($1375|0),21)|0);
  16121. $1377 = tempRet0;
  16122. $1378 = (_i64Add(($1262|0),($1263|0),($1344|0),($1345|0))|0);
  16123. $1379 = tempRet0;
  16124. $1380 = (_i64Add(($1378|0),($1379|0),($1286|0),($1287|0))|0);
  16125. $1381 = tempRet0;
  16126. $1382 = (_i64Add(($1380|0),($1381|0),($1300|0),($1301|0))|0);
  16127. $1383 = tempRet0;
  16128. $1384 = (_i64Add(($1382|0),($1383|0),($1376|0),($1377|0))|0);
  16129. $1385 = tempRet0;
  16130. $1386 = (_bitshift64Shl(($1376|0),($1377|0),21)|0);
  16131. $1387 = tempRet0;
  16132. $1388 = (_i64Add(($1314|0),($1315|0),1048576,0)|0);
  16133. $1389 = tempRet0;
  16134. $1390 = (_bitshift64Ashr(($1388|0),($1389|0),21)|0);
  16135. $1391 = tempRet0;
  16136. $1392 = (_i64Add(($1084|0),($1085|0),($1222|0),($1223|0))|0);
  16137. $1393 = tempRet0;
  16138. $1394 = (_i64Add(($1392|0),($1393|0),($1246|0),($1247|0))|0);
  16139. $1395 = tempRet0;
  16140. $1396 = (_i64Subtract(($1394|0),($1395|0),($1178|0),($1179|0))|0);
  16141. $1397 = tempRet0;
  16142. $1398 = (_i64Add(($1396|0),($1397|0),($1266|0),($1267|0))|0);
  16143. $1399 = tempRet0;
  16144. $1400 = (_i64Add(($1398|0),($1399|0),($1290|0),($1291|0))|0);
  16145. $1401 = tempRet0;
  16146. $1402 = (_i64Add(($1400|0),($1401|0),($1390|0),($1391|0))|0);
  16147. $1403 = tempRet0;
  16148. $1404 = (_bitshift64Shl(($1390|0),($1391|0),21)|0);
  16149. $1405 = tempRet0;
  16150. $1406 = (_i64Subtract(($1314|0),($1315|0),($1404|0),($1405|0))|0);
  16151. $1407 = tempRet0;
  16152. $1408 = (_i64Add(($1278|0),($1279|0),1048576,0)|0);
  16153. $1409 = tempRet0;
  16154. $1410 = (_bitshift64Ashr(($1408|0),($1409|0),21)|0);
  16155. $1411 = tempRet0;
  16156. $1412 = (_i64Add(($1102|0),($1103|0),($1226|0),($1227|0))|0);
  16157. $1413 = tempRet0;
  16158. $1414 = (_i64Add(($1412|0),($1413|0),($1250|0),($1251|0))|0);
  16159. $1415 = tempRet0;
  16160. $1416 = (_i64Subtract(($1414|0),($1415|0),($1184|0),($1185|0))|0);
  16161. $1417 = tempRet0;
  16162. $1418 = (_i64Add(($1416|0),($1417|0),($1410|0),($1411|0))|0);
  16163. $1419 = tempRet0;
  16164. $1420 = (_bitshift64Shl(($1410|0),($1411|0),21)|0);
  16165. $1421 = tempRet0;
  16166. $1422 = (_i64Subtract(($1278|0),($1279|0),($1420|0),($1421|0))|0);
  16167. $1423 = tempRet0;
  16168. $1424 = (_i64Add(($1234|0),($1235|0),1048576,0)|0);
  16169. $1425 = tempRet0;
  16170. $1426 = (_bitshift64Ashr(($1424|0),($1425|0),21)|0);
  16171. $1427 = tempRet0;
  16172. $1428 = (_i64Add(($1194|0),($1195|0),($1426|0),($1427|0))|0);
  16173. $1429 = tempRet0;
  16174. $1430 = (_bitshift64Shl(($1426|0),($1427|0),21)|0);
  16175. $1431 = tempRet0;
  16176. $1432 = (_i64Subtract(($1234|0),($1235|0),($1430|0),($1431|0))|0);
  16177. $1433 = tempRet0;
  16178. $1434 = (_i64Add(($1354|0),($1355|0),1048576,0)|0);
  16179. $1435 = tempRet0;
  16180. $1436 = (_bitshift64Ashr(($1434|0),($1435|0),21)|0);
  16181. $1437 = tempRet0;
  16182. $1438 = (_bitshift64Shl(($1436|0),($1437|0),21)|0);
  16183. $1439 = tempRet0;
  16184. $1440 = (_i64Add(($1370|0),($1371|0),1048576,0)|0);
  16185. $1441 = tempRet0;
  16186. $1442 = (_bitshift64Ashr(($1440|0),($1441|0),21)|0);
  16187. $1443 = tempRet0;
  16188. $1444 = (_bitshift64Shl(($1442|0),($1443|0),21)|0);
  16189. $1445 = tempRet0;
  16190. $1446 = (_i64Add(($1384|0),($1385|0),1048576,0)|0);
  16191. $1447 = tempRet0;
  16192. $1448 = (_bitshift64Ashr(($1446|0),($1447|0),21)|0);
  16193. $1449 = tempRet0;
  16194. $1450 = (_i64Add(($1406|0),($1407|0),($1448|0),($1449|0))|0);
  16195. $1451 = tempRet0;
  16196. $1452 = (_bitshift64Shl(($1448|0),($1449|0),21)|0);
  16197. $1453 = tempRet0;
  16198. $1454 = (_i64Add(($1402|0),($1403|0),1048576,0)|0);
  16199. $1455 = tempRet0;
  16200. $1456 = (_bitshift64Ashr(($1454|0),($1455|0),21)|0);
  16201. $1457 = tempRet0;
  16202. $1458 = (_i64Add(($1422|0),($1423|0),($1456|0),($1457|0))|0);
  16203. $1459 = tempRet0;
  16204. $1460 = (_bitshift64Shl(($1456|0),($1457|0),21)|0);
  16205. $1461 = tempRet0;
  16206. $1462 = (_i64Subtract(($1402|0),($1403|0),($1460|0),($1461|0))|0);
  16207. $1463 = tempRet0;
  16208. $1464 = (_i64Add(($1418|0),($1419|0),1048576,0)|0);
  16209. $1465 = tempRet0;
  16210. $1466 = (_bitshift64Ashr(($1464|0),($1465|0),21)|0);
  16211. $1467 = tempRet0;
  16212. $1468 = (_i64Add(($1432|0),($1433|0),($1466|0),($1467|0))|0);
  16213. $1469 = tempRet0;
  16214. $1470 = (_bitshift64Shl(($1466|0),($1467|0),21)|0);
  16215. $1471 = tempRet0;
  16216. $1472 = (_i64Subtract(($1418|0),($1419|0),($1470|0),($1471|0))|0);
  16217. $1473 = tempRet0;
  16218. $1474 = (_i64Add(($1428|0),($1429|0),1048576,0)|0);
  16219. $1475 = tempRet0;
  16220. $1476 = (_bitshift64Ashr(($1474|0),($1475|0),21)|0);
  16221. $1477 = tempRet0;
  16222. $1478 = (_bitshift64Shl(($1476|0),($1477|0),21)|0);
  16223. $1479 = tempRet0;
  16224. $1480 = (_i64Subtract(($1428|0),($1429|0),($1478|0),($1479|0))|0);
  16225. $1481 = tempRet0;
  16226. $1482 = (___muldi3(($1476|0),($1477|0),666643,0)|0);
  16227. $1483 = tempRet0;
  16228. $1484 = (_i64Add(($1358|0),($1359|0),($1482|0),($1483|0))|0);
  16229. $1485 = tempRet0;
  16230. $1486 = (___muldi3(($1476|0),($1477|0),470296,0)|0);
  16231. $1487 = tempRet0;
  16232. $1488 = (___muldi3(($1476|0),($1477|0),654183,0)|0);
  16233. $1489 = tempRet0;
  16234. $1490 = (___muldi3(($1476|0),($1477|0),-997805,-1)|0);
  16235. $1491 = tempRet0;
  16236. $1492 = (___muldi3(($1476|0),($1477|0),136657,0)|0);
  16237. $1493 = tempRet0;
  16238. $1494 = (___muldi3(($1476|0),($1477|0),-683901,-1)|0);
  16239. $1495 = tempRet0;
  16240. $1496 = (_bitshift64Ashr(($1484|0),($1485|0),21)|0);
  16241. $1497 = tempRet0;
  16242. $1498 = (_i64Add(($1486|0),($1487|0),($1354|0),($1355|0))|0);
  16243. $1499 = tempRet0;
  16244. $1500 = (_i64Subtract(($1498|0),($1499|0),($1438|0),($1439|0))|0);
  16245. $1501 = tempRet0;
  16246. $1502 = (_i64Add(($1500|0),($1501|0),($1496|0),($1497|0))|0);
  16247. $1503 = tempRet0;
  16248. $1504 = (_bitshift64Shl(($1496|0),($1497|0),21)|0);
  16249. $1505 = tempRet0;
  16250. $1506 = (_i64Subtract(($1484|0),($1485|0),($1504|0),($1505|0))|0);
  16251. $1507 = tempRet0;
  16252. $1508 = (_bitshift64Ashr(($1502|0),($1503|0),21)|0);
  16253. $1509 = tempRet0;
  16254. $1510 = (_i64Add(($1488|0),($1489|0),($1332|0),($1333|0))|0);
  16255. $1511 = tempRet0;
  16256. $1512 = (_i64Subtract(($1510|0),($1511|0),($1372|0),($1373|0))|0);
  16257. $1513 = tempRet0;
  16258. $1514 = (_i64Add(($1512|0),($1513|0),($1436|0),($1437|0))|0);
  16259. $1515 = tempRet0;
  16260. $1516 = (_i64Add(($1514|0),($1515|0),($1508|0),($1509|0))|0);
  16261. $1517 = tempRet0;
  16262. $1518 = (_bitshift64Shl(($1508|0),($1509|0),21)|0);
  16263. $1519 = tempRet0;
  16264. $1520 = (_i64Subtract(($1502|0),($1503|0),($1518|0),($1519|0))|0);
  16265. $1521 = tempRet0;
  16266. $1522 = (_bitshift64Ashr(($1516|0),($1517|0),21)|0);
  16267. $1523 = tempRet0;
  16268. $1524 = (_i64Add(($1370|0),($1371|0),($1490|0),($1491|0))|0);
  16269. $1525 = tempRet0;
  16270. $1526 = (_i64Subtract(($1524|0),($1525|0),($1444|0),($1445|0))|0);
  16271. $1527 = tempRet0;
  16272. $1528 = (_i64Add(($1526|0),($1527|0),($1522|0),($1523|0))|0);
  16273. $1529 = tempRet0;
  16274. $1530 = (_bitshift64Shl(($1522|0),($1523|0),21)|0);
  16275. $1531 = tempRet0;
  16276. $1532 = (_i64Subtract(($1516|0),($1517|0),($1530|0),($1531|0))|0);
  16277. $1533 = tempRet0;
  16278. $1534 = (_bitshift64Ashr(($1528|0),($1529|0),21)|0);
  16279. $1535 = tempRet0;
  16280. $1536 = (_i64Add(($1492|0),($1493|0),($1342|0),($1343|0))|0);
  16281. $1537 = tempRet0;
  16282. $1538 = (_i64Subtract(($1536|0),($1537|0),($1386|0),($1387|0))|0);
  16283. $1539 = tempRet0;
  16284. $1540 = (_i64Add(($1538|0),($1539|0),($1442|0),($1443|0))|0);
  16285. $1541 = tempRet0;
  16286. $1542 = (_i64Add(($1540|0),($1541|0),($1534|0),($1535|0))|0);
  16287. $1543 = tempRet0;
  16288. $1544 = (_bitshift64Shl(($1534|0),($1535|0),21)|0);
  16289. $1545 = tempRet0;
  16290. $1546 = (_i64Subtract(($1528|0),($1529|0),($1544|0),($1545|0))|0);
  16291. $1547 = tempRet0;
  16292. $1548 = (_bitshift64Ashr(($1542|0),($1543|0),21)|0);
  16293. $1549 = tempRet0;
  16294. $1550 = (_i64Add(($1384|0),($1385|0),($1494|0),($1495|0))|0);
  16295. $1551 = tempRet0;
  16296. $1552 = (_i64Subtract(($1550|0),($1551|0),($1452|0),($1453|0))|0);
  16297. $1553 = tempRet0;
  16298. $1554 = (_i64Add(($1552|0),($1553|0),($1548|0),($1549|0))|0);
  16299. $1555 = tempRet0;
  16300. $1556 = (_bitshift64Shl(($1548|0),($1549|0),21)|0);
  16301. $1557 = tempRet0;
  16302. $1558 = (_i64Subtract(($1542|0),($1543|0),($1556|0),($1557|0))|0);
  16303. $1559 = tempRet0;
  16304. $1560 = (_bitshift64Ashr(($1554|0),($1555|0),21)|0);
  16305. $1561 = tempRet0;
  16306. $1562 = (_i64Add(($1450|0),($1451|0),($1560|0),($1561|0))|0);
  16307. $1563 = tempRet0;
  16308. $1564 = (_bitshift64Shl(($1560|0),($1561|0),21)|0);
  16309. $1565 = tempRet0;
  16310. $1566 = (_i64Subtract(($1554|0),($1555|0),($1564|0),($1565|0))|0);
  16311. $1567 = tempRet0;
  16312. $1568 = (_bitshift64Ashr(($1562|0),($1563|0),21)|0);
  16313. $1569 = tempRet0;
  16314. $1570 = (_i64Add(($1568|0),($1569|0),($1462|0),($1463|0))|0);
  16315. $1571 = tempRet0;
  16316. $1572 = (_bitshift64Shl(($1568|0),($1569|0),21)|0);
  16317. $1573 = tempRet0;
  16318. $1574 = (_i64Subtract(($1562|0),($1563|0),($1572|0),($1573|0))|0);
  16319. $1575 = tempRet0;
  16320. $1576 = (_bitshift64Ashr(($1570|0),($1571|0),21)|0);
  16321. $1577 = tempRet0;
  16322. $1578 = (_i64Add(($1458|0),($1459|0),($1576|0),($1577|0))|0);
  16323. $1579 = tempRet0;
  16324. $1580 = (_bitshift64Shl(($1576|0),($1577|0),21)|0);
  16325. $1581 = tempRet0;
  16326. $1582 = (_i64Subtract(($1570|0),($1571|0),($1580|0),($1581|0))|0);
  16327. $1583 = tempRet0;
  16328. $1584 = (_bitshift64Ashr(($1578|0),($1579|0),21)|0);
  16329. $1585 = tempRet0;
  16330. $1586 = (_i64Add(($1584|0),($1585|0),($1472|0),($1473|0))|0);
  16331. $1587 = tempRet0;
  16332. $1588 = (_bitshift64Shl(($1584|0),($1585|0),21)|0);
  16333. $1589 = tempRet0;
  16334. $1590 = (_i64Subtract(($1578|0),($1579|0),($1588|0),($1589|0))|0);
  16335. $1591 = tempRet0;
  16336. $1592 = (_bitshift64Ashr(($1586|0),($1587|0),21)|0);
  16337. $1593 = tempRet0;
  16338. $1594 = (_i64Add(($1468|0),($1469|0),($1592|0),($1593|0))|0);
  16339. $1595 = tempRet0;
  16340. $1596 = (_bitshift64Shl(($1592|0),($1593|0),21)|0);
  16341. $1597 = tempRet0;
  16342. $1598 = (_i64Subtract(($1586|0),($1587|0),($1596|0),($1597|0))|0);
  16343. $1599 = tempRet0;
  16344. $1600 = (_bitshift64Ashr(($1594|0),($1595|0),21)|0);
  16345. $1601 = tempRet0;
  16346. $1602 = (_i64Add(($1600|0),($1601|0),($1480|0),($1481|0))|0);
  16347. $1603 = tempRet0;
  16348. $1604 = (_bitshift64Shl(($1600|0),($1601|0),21)|0);
  16349. $1605 = tempRet0;
  16350. $1606 = (_i64Subtract(($1594|0),($1595|0),($1604|0),($1605|0))|0);
  16351. $1607 = tempRet0;
  16352. $1608 = (_bitshift64Ashr(($1602|0),($1603|0),21)|0);
  16353. $1609 = tempRet0;
  16354. $1610 = (_bitshift64Shl(($1608|0),($1609|0),21)|0);
  16355. $1611 = tempRet0;
  16356. $1612 = (_i64Subtract(($1602|0),($1603|0),($1610|0),($1611|0))|0);
  16357. $1613 = tempRet0;
  16358. $1614 = (___muldi3(($1608|0),($1609|0),666643,0)|0);
  16359. $1615 = tempRet0;
  16360. $1616 = (_i64Add(($1614|0),($1615|0),($1506|0),($1507|0))|0);
  16361. $1617 = tempRet0;
  16362. $1618 = (___muldi3(($1608|0),($1609|0),470296,0)|0);
  16363. $1619 = tempRet0;
  16364. $1620 = (_i64Add(($1520|0),($1521|0),($1618|0),($1619|0))|0);
  16365. $1621 = tempRet0;
  16366. $1622 = (___muldi3(($1608|0),($1609|0),654183,0)|0);
  16367. $1623 = tempRet0;
  16368. $1624 = (_i64Add(($1532|0),($1533|0),($1622|0),($1623|0))|0);
  16369. $1625 = tempRet0;
  16370. $1626 = (___muldi3(($1608|0),($1609|0),-997805,-1)|0);
  16371. $1627 = tempRet0;
  16372. $1628 = (_i64Add(($1546|0),($1547|0),($1626|0),($1627|0))|0);
  16373. $1629 = tempRet0;
  16374. $1630 = (___muldi3(($1608|0),($1609|0),136657,0)|0);
  16375. $1631 = tempRet0;
  16376. $1632 = (_i64Add(($1558|0),($1559|0),($1630|0),($1631|0))|0);
  16377. $1633 = tempRet0;
  16378. $1634 = (___muldi3(($1608|0),($1609|0),-683901,-1)|0);
  16379. $1635 = tempRet0;
  16380. $1636 = (_i64Add(($1566|0),($1567|0),($1634|0),($1635|0))|0);
  16381. $1637 = tempRet0;
  16382. $1638 = (_bitshift64Ashr(($1616|0),($1617|0),21)|0);
  16383. $1639 = tempRet0;
  16384. $1640 = (_i64Add(($1620|0),($1621|0),($1638|0),($1639|0))|0);
  16385. $1641 = tempRet0;
  16386. $1642 = (_bitshift64Shl(($1638|0),($1639|0),21)|0);
  16387. $1643 = tempRet0;
  16388. $1644 = (_i64Subtract(($1616|0),($1617|0),($1642|0),($1643|0))|0);
  16389. $1645 = tempRet0;
  16390. $1646 = (_bitshift64Ashr(($1640|0),($1641|0),21)|0);
  16391. $1647 = tempRet0;
  16392. $1648 = (_i64Add(($1624|0),($1625|0),($1646|0),($1647|0))|0);
  16393. $1649 = tempRet0;
  16394. $1650 = (_bitshift64Shl(($1646|0),($1647|0),21)|0);
  16395. $1651 = tempRet0;
  16396. $1652 = (_i64Subtract(($1640|0),($1641|0),($1650|0),($1651|0))|0);
  16397. $1653 = tempRet0;
  16398. $1654 = (_bitshift64Ashr(($1648|0),($1649|0),21)|0);
  16399. $1655 = tempRet0;
  16400. $1656 = (_i64Add(($1628|0),($1629|0),($1654|0),($1655|0))|0);
  16401. $1657 = tempRet0;
  16402. $1658 = (_bitshift64Shl(($1654|0),($1655|0),21)|0);
  16403. $1659 = tempRet0;
  16404. $1660 = (_i64Subtract(($1648|0),($1649|0),($1658|0),($1659|0))|0);
  16405. $1661 = tempRet0;
  16406. $1662 = (_bitshift64Ashr(($1656|0),($1657|0),21)|0);
  16407. $1663 = tempRet0;
  16408. $1664 = (_i64Add(($1632|0),($1633|0),($1662|0),($1663|0))|0);
  16409. $1665 = tempRet0;
  16410. $1666 = (_bitshift64Shl(($1662|0),($1663|0),21)|0);
  16411. $1667 = tempRet0;
  16412. $1668 = (_i64Subtract(($1656|0),($1657|0),($1666|0),($1667|0))|0);
  16413. $1669 = tempRet0;
  16414. $1670 = (_bitshift64Ashr(($1664|0),($1665|0),21)|0);
  16415. $1671 = tempRet0;
  16416. $1672 = (_i64Add(($1636|0),($1637|0),($1670|0),($1671|0))|0);
  16417. $1673 = tempRet0;
  16418. $1674 = (_bitshift64Shl(($1670|0),($1671|0),21)|0);
  16419. $1675 = tempRet0;
  16420. $1676 = (_i64Subtract(($1664|0),($1665|0),($1674|0),($1675|0))|0);
  16421. $1677 = tempRet0;
  16422. $1678 = (_bitshift64Ashr(($1672|0),($1673|0),21)|0);
  16423. $1679 = tempRet0;
  16424. $1680 = (_i64Add(($1678|0),($1679|0),($1574|0),($1575|0))|0);
  16425. $1681 = tempRet0;
  16426. $1682 = (_bitshift64Shl(($1678|0),($1679|0),21)|0);
  16427. $1683 = tempRet0;
  16428. $1684 = (_i64Subtract(($1672|0),($1673|0),($1682|0),($1683|0))|0);
  16429. $1685 = tempRet0;
  16430. $1686 = (_bitshift64Ashr(($1680|0),($1681|0),21)|0);
  16431. $1687 = tempRet0;
  16432. $1688 = (_i64Add(($1686|0),($1687|0),($1582|0),($1583|0))|0);
  16433. $1689 = tempRet0;
  16434. $1690 = (_bitshift64Shl(($1686|0),($1687|0),21)|0);
  16435. $1691 = tempRet0;
  16436. $1692 = (_i64Subtract(($1680|0),($1681|0),($1690|0),($1691|0))|0);
  16437. $1693 = tempRet0;
  16438. $1694 = (_bitshift64Ashr(($1688|0),($1689|0),21)|0);
  16439. $1695 = tempRet0;
  16440. $1696 = (_i64Add(($1694|0),($1695|0),($1590|0),($1591|0))|0);
  16441. $1697 = tempRet0;
  16442. $1698 = (_bitshift64Shl(($1694|0),($1695|0),21)|0);
  16443. $1699 = tempRet0;
  16444. $1700 = (_i64Subtract(($1688|0),($1689|0),($1698|0),($1699|0))|0);
  16445. $1701 = tempRet0;
  16446. $1702 = (_bitshift64Ashr(($1696|0),($1697|0),21)|0);
  16447. $1703 = tempRet0;
  16448. $1704 = (_i64Add(($1702|0),($1703|0),($1598|0),($1599|0))|0);
  16449. $1705 = tempRet0;
  16450. $1706 = (_bitshift64Shl(($1702|0),($1703|0),21)|0);
  16451. $1707 = tempRet0;
  16452. $1708 = (_i64Subtract(($1696|0),($1697|0),($1706|0),($1707|0))|0);
  16453. $1709 = tempRet0;
  16454. $1710 = (_bitshift64Ashr(($1704|0),($1705|0),21)|0);
  16455. $1711 = tempRet0;
  16456. $1712 = (_i64Add(($1710|0),($1711|0),($1606|0),($1607|0))|0);
  16457. $1713 = tempRet0;
  16458. $1714 = (_bitshift64Shl(($1710|0),($1711|0),21)|0);
  16459. $1715 = tempRet0;
  16460. $1716 = (_i64Subtract(($1704|0),($1705|0),($1714|0),($1715|0))|0);
  16461. $1717 = tempRet0;
  16462. $1718 = (_bitshift64Ashr(($1712|0),($1713|0),21)|0);
  16463. $1719 = tempRet0;
  16464. $1720 = (_i64Add(($1718|0),($1719|0),($1612|0),($1613|0))|0);
  16465. $1721 = tempRet0;
  16466. $1722 = (_bitshift64Shl(($1718|0),($1719|0),21)|0);
  16467. $1723 = tempRet0;
  16468. $1724 = (_i64Subtract(($1712|0),($1713|0),($1722|0),($1723|0))|0);
  16469. $1725 = tempRet0;
  16470. $1726 = $1644&255;
  16471. HEAP8[$s>>0] = $1726;
  16472. $1727 = (_bitshift64Lshr(($1644|0),($1645|0),8)|0);
  16473. $1728 = tempRet0;
  16474. $1729 = $1727&255;
  16475. $1730 = (($s) + 1|0);
  16476. HEAP8[$1730>>0] = $1729;
  16477. $1731 = (_bitshift64Lshr(($1644|0),($1645|0),16)|0);
  16478. $1732 = tempRet0;
  16479. $1733 = (_bitshift64Shl(($1652|0),($1653|0),5)|0);
  16480. $1734 = tempRet0;
  16481. $1735 = $1733 | $1731;
  16482. $1734 | $1732;
  16483. $1736 = $1735&255;
  16484. $1737 = (($s) + 2|0);
  16485. HEAP8[$1737>>0] = $1736;
  16486. $1738 = (_bitshift64Lshr(($1652|0),($1653|0),3)|0);
  16487. $1739 = tempRet0;
  16488. $1740 = $1738&255;
  16489. $1741 = (($s) + 3|0);
  16490. HEAP8[$1741>>0] = $1740;
  16491. $1742 = (_bitshift64Lshr(($1652|0),($1653|0),11)|0);
  16492. $1743 = tempRet0;
  16493. $1744 = $1742&255;
  16494. $1745 = (($s) + 4|0);
  16495. HEAP8[$1745>>0] = $1744;
  16496. $1746 = (_bitshift64Lshr(($1652|0),($1653|0),19)|0);
  16497. $1747 = tempRet0;
  16498. $1748 = (_bitshift64Shl(($1660|0),($1661|0),2)|0);
  16499. $1749 = tempRet0;
  16500. $1750 = $1748 | $1746;
  16501. $1749 | $1747;
  16502. $1751 = $1750&255;
  16503. $1752 = (($s) + 5|0);
  16504. HEAP8[$1752>>0] = $1751;
  16505. $1753 = (_bitshift64Lshr(($1660|0),($1661|0),6)|0);
  16506. $1754 = tempRet0;
  16507. $1755 = $1753&255;
  16508. $1756 = (($s) + 6|0);
  16509. HEAP8[$1756>>0] = $1755;
  16510. $1757 = (_bitshift64Lshr(($1660|0),($1661|0),14)|0);
  16511. $1758 = tempRet0;
  16512. $1759 = (_bitshift64Shl(($1668|0),($1669|0),7)|0);
  16513. $1760 = tempRet0;
  16514. $1761 = $1759 | $1757;
  16515. $1760 | $1758;
  16516. $1762 = $1761&255;
  16517. $1763 = (($s) + 7|0);
  16518. HEAP8[$1763>>0] = $1762;
  16519. $1764 = (_bitshift64Lshr(($1668|0),($1669|0),1)|0);
  16520. $1765 = tempRet0;
  16521. $1766 = $1764&255;
  16522. $1767 = (($s) + 8|0);
  16523. HEAP8[$1767>>0] = $1766;
  16524. $1768 = (_bitshift64Lshr(($1668|0),($1669|0),9)|0);
  16525. $1769 = tempRet0;
  16526. $1770 = $1768&255;
  16527. $1771 = (($s) + 9|0);
  16528. HEAP8[$1771>>0] = $1770;
  16529. $1772 = (_bitshift64Lshr(($1668|0),($1669|0),17)|0);
  16530. $1773 = tempRet0;
  16531. $1774 = (_bitshift64Shl(($1676|0),($1677|0),4)|0);
  16532. $1775 = tempRet0;
  16533. $1776 = $1774 | $1772;
  16534. $1775 | $1773;
  16535. $1777 = $1776&255;
  16536. $1778 = (($s) + 10|0);
  16537. HEAP8[$1778>>0] = $1777;
  16538. $1779 = (_bitshift64Lshr(($1676|0),($1677|0),4)|0);
  16539. $1780 = tempRet0;
  16540. $1781 = $1779&255;
  16541. $1782 = (($s) + 11|0);
  16542. HEAP8[$1782>>0] = $1781;
  16543. $1783 = (_bitshift64Lshr(($1676|0),($1677|0),12)|0);
  16544. $1784 = tempRet0;
  16545. $1785 = $1783&255;
  16546. $1786 = (($s) + 12|0);
  16547. HEAP8[$1786>>0] = $1785;
  16548. $1787 = (_bitshift64Lshr(($1676|0),($1677|0),20)|0);
  16549. $1788 = tempRet0;
  16550. $1789 = (_bitshift64Shl(($1684|0),($1685|0),1)|0);
  16551. $1790 = tempRet0;
  16552. $1791 = $1789 | $1787;
  16553. $1790 | $1788;
  16554. $1792 = $1791&255;
  16555. $1793 = (($s) + 13|0);
  16556. HEAP8[$1793>>0] = $1792;
  16557. $1794 = (_bitshift64Lshr(($1684|0),($1685|0),7)|0);
  16558. $1795 = tempRet0;
  16559. $1796 = $1794&255;
  16560. $1797 = (($s) + 14|0);
  16561. HEAP8[$1797>>0] = $1796;
  16562. $1798 = (_bitshift64Lshr(($1684|0),($1685|0),15)|0);
  16563. $1799 = tempRet0;
  16564. $1800 = (_bitshift64Shl(($1692|0),($1693|0),6)|0);
  16565. $1801 = tempRet0;
  16566. $1802 = $1800 | $1798;
  16567. $1801 | $1799;
  16568. $1803 = $1802&255;
  16569. $1804 = (($s) + 15|0);
  16570. HEAP8[$1804>>0] = $1803;
  16571. $1805 = (_bitshift64Lshr(($1692|0),($1693|0),2)|0);
  16572. $1806 = tempRet0;
  16573. $1807 = $1805&255;
  16574. $1808 = (($s) + 16|0);
  16575. HEAP8[$1808>>0] = $1807;
  16576. $1809 = (_bitshift64Lshr(($1692|0),($1693|0),10)|0);
  16577. $1810 = tempRet0;
  16578. $1811 = $1809&255;
  16579. $1812 = (($s) + 17|0);
  16580. HEAP8[$1812>>0] = $1811;
  16581. $1813 = (_bitshift64Lshr(($1692|0),($1693|0),18)|0);
  16582. $1814 = tempRet0;
  16583. $1815 = (_bitshift64Shl(($1700|0),($1701|0),3)|0);
  16584. $1816 = tempRet0;
  16585. $1817 = $1815 | $1813;
  16586. $1816 | $1814;
  16587. $1818 = $1817&255;
  16588. $1819 = (($s) + 18|0);
  16589. HEAP8[$1819>>0] = $1818;
  16590. $1820 = (_bitshift64Lshr(($1700|0),($1701|0),5)|0);
  16591. $1821 = tempRet0;
  16592. $1822 = $1820&255;
  16593. $1823 = (($s) + 19|0);
  16594. HEAP8[$1823>>0] = $1822;
  16595. $1824 = (_bitshift64Lshr(($1700|0),($1701|0),13)|0);
  16596. $1825 = tempRet0;
  16597. $1826 = $1824&255;
  16598. $1827 = (($s) + 20|0);
  16599. HEAP8[$1827>>0] = $1826;
  16600. $1828 = $1708&255;
  16601. $1829 = (($s) + 21|0);
  16602. HEAP8[$1829>>0] = $1828;
  16603. $1830 = (_bitshift64Lshr(($1708|0),($1709|0),8)|0);
  16604. $1831 = tempRet0;
  16605. $1832 = $1830&255;
  16606. $1833 = (($s) + 22|0);
  16607. HEAP8[$1833>>0] = $1832;
  16608. $1834 = (_bitshift64Lshr(($1708|0),($1709|0),16)|0);
  16609. $1835 = tempRet0;
  16610. $1836 = (_bitshift64Shl(($1716|0),($1717|0),5)|0);
  16611. $1837 = tempRet0;
  16612. $1838 = $1836 | $1834;
  16613. $1837 | $1835;
  16614. $1839 = $1838&255;
  16615. $1840 = (($s) + 23|0);
  16616. HEAP8[$1840>>0] = $1839;
  16617. $1841 = (_bitshift64Lshr(($1716|0),($1717|0),3)|0);
  16618. $1842 = tempRet0;
  16619. $1843 = $1841&255;
  16620. $1844 = (($s) + 24|0);
  16621. HEAP8[$1844>>0] = $1843;
  16622. $1845 = (_bitshift64Lshr(($1716|0),($1717|0),11)|0);
  16623. $1846 = tempRet0;
  16624. $1847 = $1845&255;
  16625. $1848 = (($s) + 25|0);
  16626. HEAP8[$1848>>0] = $1847;
  16627. $1849 = (_bitshift64Lshr(($1716|0),($1717|0),19)|0);
  16628. $1850 = tempRet0;
  16629. $1851 = (_bitshift64Shl(($1724|0),($1725|0),2)|0);
  16630. $1852 = tempRet0;
  16631. $1853 = $1851 | $1849;
  16632. $1852 | $1850;
  16633. $1854 = $1853&255;
  16634. $1855 = (($s) + 26|0);
  16635. HEAP8[$1855>>0] = $1854;
  16636. $1856 = (_bitshift64Lshr(($1724|0),($1725|0),6)|0);
  16637. $1857 = tempRet0;
  16638. $1858 = $1856&255;
  16639. $1859 = (($s) + 27|0);
  16640. HEAP8[$1859>>0] = $1858;
  16641. $1860 = (_bitshift64Lshr(($1724|0),($1725|0),14)|0);
  16642. $1861 = tempRet0;
  16643. $1862 = (_bitshift64Shl(($1720|0),($1721|0),7)|0);
  16644. $1863 = tempRet0;
  16645. $1864 = $1860 | $1862;
  16646. $1861 | $1863;
  16647. $1865 = $1864&255;
  16648. $1866 = (($s) + 28|0);
  16649. HEAP8[$1866>>0] = $1865;
  16650. $1867 = (_bitshift64Lshr(($1720|0),($1721|0),1)|0);
  16651. $1868 = tempRet0;
  16652. $1869 = $1867&255;
  16653. $1870 = (($s) + 29|0);
  16654. HEAP8[$1870>>0] = $1869;
  16655. $1871 = (_bitshift64Lshr(($1720|0),($1721|0),9)|0);
  16656. $1872 = tempRet0;
  16657. $1873 = $1871&255;
  16658. $1874 = (($s) + 30|0);
  16659. HEAP8[$1874>>0] = $1873;
  16660. $1875 = (_bitshift64Lshr(($1720|0),($1721|0),17)|0);
  16661. $1876 = tempRet0;
  16662. $1877 = $1875&255;
  16663. $1878 = (($s) + 31|0);
  16664. HEAP8[$1878>>0] = $1877;
  16665. STACKTOP = sp;return;
  16666. }
  16667. function _load_347($in) {
  16668. $in = $in|0;
  16669. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  16670. sp = STACKTOP;
  16671. $0 = HEAP8[$in>>0]|0;
  16672. $1 = $0&255;
  16673. $2 = (($in) + 1|0);
  16674. $3 = HEAP8[$2>>0]|0;
  16675. $4 = $3&255;
  16676. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  16677. $6 = tempRet0;
  16678. $7 = $5 | $1;
  16679. $8 = (($in) + 2|0);
  16680. $9 = HEAP8[$8>>0]|0;
  16681. $10 = $9&255;
  16682. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  16683. $12 = tempRet0;
  16684. $13 = $7 | $11;
  16685. $14 = $6 | $12;
  16686. tempRet0 = $14;
  16687. STACKTOP = sp;return ($13|0);
  16688. }
  16689. function _load_448($in) {
  16690. $in = $in|0;
  16691. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
  16692. var $8 = 0, $9 = 0, label = 0, sp = 0;
  16693. sp = STACKTOP;
  16694. $0 = HEAP8[$in>>0]|0;
  16695. $1 = $0&255;
  16696. $2 = (($in) + 1|0);
  16697. $3 = HEAP8[$2>>0]|0;
  16698. $4 = $3&255;
  16699. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  16700. $6 = tempRet0;
  16701. $7 = $5 | $1;
  16702. $8 = (($in) + 2|0);
  16703. $9 = HEAP8[$8>>0]|0;
  16704. $10 = $9&255;
  16705. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  16706. $12 = tempRet0;
  16707. $13 = $7 | $11;
  16708. $14 = $6 | $12;
  16709. $15 = (($in) + 3|0);
  16710. $16 = HEAP8[$15>>0]|0;
  16711. $17 = $16&255;
  16712. $18 = (_bitshift64Shl(($17|0),0,24)|0);
  16713. $19 = tempRet0;
  16714. $20 = $13 | $18;
  16715. $21 = $14 | $19;
  16716. tempRet0 = $21;
  16717. STACKTOP = sp;return ($20|0);
  16718. }
  16719. function _crypto_sign_ed25519_ref10_sc_reduce($s) {
  16720. $s = $s|0;
  16721. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0, $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0;
  16722. var $1015 = 0, $1016 = 0, $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0, $1021 = 0, $1022 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0;
  16723. var $113 = 0, $114 = 0, $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0;
  16724. var $131 = 0, $132 = 0, $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0;
  16725. var $15 = 0, $150 = 0, $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0;
  16726. var $168 = 0, $169 = 0, $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0;
  16727. var $186 = 0, $187 = 0, $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0;
  16728. var $203 = 0, $204 = 0, $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0;
  16729. var $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0;
  16730. var $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0;
  16731. var $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0;
  16732. var $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0;
  16733. var $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0;
  16734. var $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0;
  16735. var $33 = 0, $330 = 0, $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0;
  16736. var $348 = 0, $349 = 0, $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0;
  16737. var $366 = 0, $367 = 0, $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0;
  16738. var $384 = 0, $385 = 0, $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0;
  16739. var $401 = 0, $402 = 0, $403 = 0, $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0;
  16740. var $42 = 0, $420 = 0, $421 = 0, $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0;
  16741. var $438 = 0, $439 = 0, $44 = 0, $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0;
  16742. var $456 = 0, $457 = 0, $458 = 0, $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0;
  16743. var $474 = 0, $475 = 0, $476 = 0, $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0;
  16744. var $492 = 0, $493 = 0, $494 = 0, $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0;
  16745. var $51 = 0, $510 = 0, $511 = 0, $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0;
  16746. var $528 = 0, $529 = 0, $53 = 0, $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0;
  16747. var $546 = 0, $547 = 0, $548 = 0, $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0;
  16748. var $564 = 0, $565 = 0, $566 = 0, $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0;
  16749. var $582 = 0, $583 = 0, $584 = 0, $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0;
  16750. var $60 = 0, $600 = 0, $601 = 0, $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0;
  16751. var $618 = 0, $619 = 0, $62 = 0, $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0;
  16752. var $636 = 0, $637 = 0, $638 = 0, $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0;
  16753. var $654 = 0, $655 = 0, $656 = 0, $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0;
  16754. var $672 = 0, $673 = 0, $674 = 0, $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0;
  16755. var $690 = 0, $691 = 0, $692 = 0, $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0;
  16756. var $708 = 0, $709 = 0, $71 = 0, $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0;
  16757. var $726 = 0, $727 = 0, $728 = 0, $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0;
  16758. var $744 = 0, $745 = 0, $746 = 0, $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0;
  16759. var $762 = 0, $763 = 0, $764 = 0, $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0;
  16760. var $780 = 0, $781 = 0, $782 = 0, $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0;
  16761. var $799 = 0, $8 = 0, $80 = 0, $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0, $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0;
  16762. var $816 = 0, $817 = 0, $818 = 0, $819 = 0, $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0, $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0;
  16763. var $834 = 0, $835 = 0, $836 = 0, $837 = 0, $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0, $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0;
  16764. var $852 = 0, $853 = 0, $854 = 0, $855 = 0, $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0, $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0;
  16765. var $870 = 0, $871 = 0, $872 = 0, $873 = 0, $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0, $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0;
  16766. var $889 = 0, $89 = 0, $890 = 0, $891 = 0, $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0, $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0;
  16767. var $906 = 0, $907 = 0, $908 = 0, $909 = 0, $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0, $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0;
  16768. var $924 = 0, $925 = 0, $926 = 0, $927 = 0, $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0, $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0;
  16769. var $942 = 0, $943 = 0, $944 = 0, $945 = 0, $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0, $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0;
  16770. var $960 = 0, $961 = 0, $962 = 0, $963 = 0, $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0, $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0, $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0;
  16771. var $979 = 0, $98 = 0, $980 = 0, $981 = 0, $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0, $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0, $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0;
  16772. var $997 = 0, $998 = 0, $999 = 0, label = 0, sp = 0;
  16773. sp = STACKTOP;
  16774. $0 = (_load_351($s)|0);
  16775. $1 = tempRet0;
  16776. $2 = $0 & 2097151;
  16777. $3 = (($s) + 2|0);
  16778. $4 = (_load_452($3)|0);
  16779. $5 = tempRet0;
  16780. $6 = (_bitshift64Lshr(($4|0),($5|0),5)|0);
  16781. $7 = tempRet0;
  16782. $8 = $6 & 2097151;
  16783. $9 = (($s) + 5|0);
  16784. $10 = (_load_351($9)|0);
  16785. $11 = tempRet0;
  16786. $12 = (_bitshift64Lshr(($10|0),($11|0),2)|0);
  16787. $13 = tempRet0;
  16788. $14 = $12 & 2097151;
  16789. $15 = (($s) + 7|0);
  16790. $16 = (_load_452($15)|0);
  16791. $17 = tempRet0;
  16792. $18 = (_bitshift64Lshr(($16|0),($17|0),7)|0);
  16793. $19 = tempRet0;
  16794. $20 = $18 & 2097151;
  16795. $21 = (($s) + 10|0);
  16796. $22 = (_load_452($21)|0);
  16797. $23 = tempRet0;
  16798. $24 = (_bitshift64Lshr(($22|0),($23|0),4)|0);
  16799. $25 = tempRet0;
  16800. $26 = $24 & 2097151;
  16801. $27 = (($s) + 13|0);
  16802. $28 = (_load_351($27)|0);
  16803. $29 = tempRet0;
  16804. $30 = (_bitshift64Lshr(($28|0),($29|0),1)|0);
  16805. $31 = tempRet0;
  16806. $32 = $30 & 2097151;
  16807. $33 = (($s) + 15|0);
  16808. $34 = (_load_452($33)|0);
  16809. $35 = tempRet0;
  16810. $36 = (_bitshift64Lshr(($34|0),($35|0),6)|0);
  16811. $37 = tempRet0;
  16812. $38 = $36 & 2097151;
  16813. $39 = (($s) + 18|0);
  16814. $40 = (_load_351($39)|0);
  16815. $41 = tempRet0;
  16816. $42 = (_bitshift64Lshr(($40|0),($41|0),3)|0);
  16817. $43 = tempRet0;
  16818. $44 = $42 & 2097151;
  16819. $45 = (($s) + 21|0);
  16820. $46 = (_load_351($45)|0);
  16821. $47 = tempRet0;
  16822. $48 = $46 & 2097151;
  16823. $49 = (($s) + 23|0);
  16824. $50 = (_load_452($49)|0);
  16825. $51 = tempRet0;
  16826. $52 = (_bitshift64Lshr(($50|0),($51|0),5)|0);
  16827. $53 = tempRet0;
  16828. $54 = $52 & 2097151;
  16829. $55 = (($s) + 26|0);
  16830. $56 = (_load_351($55)|0);
  16831. $57 = tempRet0;
  16832. $58 = (_bitshift64Lshr(($56|0),($57|0),2)|0);
  16833. $59 = tempRet0;
  16834. $60 = $58 & 2097151;
  16835. $61 = (($s) + 28|0);
  16836. $62 = (_load_452($61)|0);
  16837. $63 = tempRet0;
  16838. $64 = (_bitshift64Lshr(($62|0),($63|0),7)|0);
  16839. $65 = tempRet0;
  16840. $66 = $64 & 2097151;
  16841. $67 = (($s) + 31|0);
  16842. $68 = (_load_452($67)|0);
  16843. $69 = tempRet0;
  16844. $70 = (_bitshift64Lshr(($68|0),($69|0),4)|0);
  16845. $71 = tempRet0;
  16846. $72 = $70 & 2097151;
  16847. $73 = (($s) + 34|0);
  16848. $74 = (_load_351($73)|0);
  16849. $75 = tempRet0;
  16850. $76 = (_bitshift64Lshr(($74|0),($75|0),1)|0);
  16851. $77 = tempRet0;
  16852. $78 = $76 & 2097151;
  16853. $79 = (($s) + 36|0);
  16854. $80 = (_load_452($79)|0);
  16855. $81 = tempRet0;
  16856. $82 = (_bitshift64Lshr(($80|0),($81|0),6)|0);
  16857. $83 = tempRet0;
  16858. $84 = $82 & 2097151;
  16859. $85 = (($s) + 39|0);
  16860. $86 = (_load_351($85)|0);
  16861. $87 = tempRet0;
  16862. $88 = (_bitshift64Lshr(($86|0),($87|0),3)|0);
  16863. $89 = tempRet0;
  16864. $90 = $88 & 2097151;
  16865. $91 = (($s) + 42|0);
  16866. $92 = (_load_351($91)|0);
  16867. $93 = tempRet0;
  16868. $94 = $92 & 2097151;
  16869. $95 = (($s) + 44|0);
  16870. $96 = (_load_452($95)|0);
  16871. $97 = tempRet0;
  16872. $98 = (_bitshift64Lshr(($96|0),($97|0),5)|0);
  16873. $99 = tempRet0;
  16874. $100 = $98 & 2097151;
  16875. $101 = (($s) + 47|0);
  16876. $102 = (_load_351($101)|0);
  16877. $103 = tempRet0;
  16878. $104 = (_bitshift64Lshr(($102|0),($103|0),2)|0);
  16879. $105 = tempRet0;
  16880. $106 = $104 & 2097151;
  16881. $107 = (($s) + 49|0);
  16882. $108 = (_load_452($107)|0);
  16883. $109 = tempRet0;
  16884. $110 = (_bitshift64Lshr(($108|0),($109|0),7)|0);
  16885. $111 = tempRet0;
  16886. $112 = $110 & 2097151;
  16887. $113 = (($s) + 52|0);
  16888. $114 = (_load_452($113)|0);
  16889. $115 = tempRet0;
  16890. $116 = (_bitshift64Lshr(($114|0),($115|0),4)|0);
  16891. $117 = tempRet0;
  16892. $118 = $116 & 2097151;
  16893. $119 = (($s) + 55|0);
  16894. $120 = (_load_351($119)|0);
  16895. $121 = tempRet0;
  16896. $122 = (_bitshift64Lshr(($120|0),($121|0),1)|0);
  16897. $123 = tempRet0;
  16898. $124 = $122 & 2097151;
  16899. $125 = (($s) + 57|0);
  16900. $126 = (_load_452($125)|0);
  16901. $127 = tempRet0;
  16902. $128 = (_bitshift64Lshr(($126|0),($127|0),6)|0);
  16903. $129 = tempRet0;
  16904. $130 = $128 & 2097151;
  16905. $131 = (($s) + 60|0);
  16906. $132 = (_load_452($131)|0);
  16907. $133 = tempRet0;
  16908. $134 = (_bitshift64Lshr(($132|0),($133|0),3)|0);
  16909. $135 = tempRet0;
  16910. $136 = (___muldi3(($134|0),($135|0),666643,0)|0);
  16911. $137 = tempRet0;
  16912. $138 = (___muldi3(($134|0),($135|0),470296,0)|0);
  16913. $139 = tempRet0;
  16914. $140 = (___muldi3(($134|0),($135|0),654183,0)|0);
  16915. $141 = tempRet0;
  16916. $142 = (___muldi3(($134|0),($135|0),-997805,-1)|0);
  16917. $143 = tempRet0;
  16918. $144 = (___muldi3(($134|0),($135|0),136657,0)|0);
  16919. $145 = tempRet0;
  16920. $146 = (_i64Add(($144|0),($145|0),($90|0),0)|0);
  16921. $147 = tempRet0;
  16922. $148 = (___muldi3(($134|0),($135|0),-683901,-1)|0);
  16923. $149 = tempRet0;
  16924. $150 = (_i64Add(($148|0),($149|0),($94|0),0)|0);
  16925. $151 = tempRet0;
  16926. $152 = (___muldi3(($130|0),0,666643,0)|0);
  16927. $153 = tempRet0;
  16928. $154 = (___muldi3(($130|0),0,470296,0)|0);
  16929. $155 = tempRet0;
  16930. $156 = (___muldi3(($130|0),0,654183,0)|0);
  16931. $157 = tempRet0;
  16932. $158 = (___muldi3(($130|0),0,-997805,-1)|0);
  16933. $159 = tempRet0;
  16934. $160 = (___muldi3(($130|0),0,136657,0)|0);
  16935. $161 = tempRet0;
  16936. $162 = (___muldi3(($130|0),0,-683901,-1)|0);
  16937. $163 = tempRet0;
  16938. $164 = (_i64Add(($146|0),($147|0),($162|0),($163|0))|0);
  16939. $165 = tempRet0;
  16940. $166 = (___muldi3(($124|0),0,666643,0)|0);
  16941. $167 = tempRet0;
  16942. $168 = (___muldi3(($124|0),0,470296,0)|0);
  16943. $169 = tempRet0;
  16944. $170 = (___muldi3(($124|0),0,654183,0)|0);
  16945. $171 = tempRet0;
  16946. $172 = (___muldi3(($124|0),0,-997805,-1)|0);
  16947. $173 = tempRet0;
  16948. $174 = (___muldi3(($124|0),0,136657,0)|0);
  16949. $175 = tempRet0;
  16950. $176 = (___muldi3(($124|0),0,-683901,-1)|0);
  16951. $177 = tempRet0;
  16952. $178 = (_i64Add(($176|0),($177|0),($84|0),0)|0);
  16953. $179 = tempRet0;
  16954. $180 = (_i64Add(($178|0),($179|0),($142|0),($143|0))|0);
  16955. $181 = tempRet0;
  16956. $182 = (_i64Add(($180|0),($181|0),($160|0),($161|0))|0);
  16957. $183 = tempRet0;
  16958. $184 = (___muldi3(($118|0),0,666643,0)|0);
  16959. $185 = tempRet0;
  16960. $186 = (___muldi3(($118|0),0,470296,0)|0);
  16961. $187 = tempRet0;
  16962. $188 = (___muldi3(($118|0),0,654183,0)|0);
  16963. $189 = tempRet0;
  16964. $190 = (___muldi3(($118|0),0,-997805,-1)|0);
  16965. $191 = tempRet0;
  16966. $192 = (___muldi3(($118|0),0,136657,0)|0);
  16967. $193 = tempRet0;
  16968. $194 = (___muldi3(($118|0),0,-683901,-1)|0);
  16969. $195 = tempRet0;
  16970. $196 = (___muldi3(($112|0),0,666643,0)|0);
  16971. $197 = tempRet0;
  16972. $198 = (___muldi3(($112|0),0,470296,0)|0);
  16973. $199 = tempRet0;
  16974. $200 = (___muldi3(($112|0),0,654183,0)|0);
  16975. $201 = tempRet0;
  16976. $202 = (___muldi3(($112|0),0,-997805,-1)|0);
  16977. $203 = tempRet0;
  16978. $204 = (___muldi3(($112|0),0,136657,0)|0);
  16979. $205 = tempRet0;
  16980. $206 = (___muldi3(($112|0),0,-683901,-1)|0);
  16981. $207 = tempRet0;
  16982. $208 = (_i64Add(($206|0),($207|0),($72|0),0)|0);
  16983. $209 = tempRet0;
  16984. $210 = (_i64Add(($208|0),($209|0),($192|0),($193|0))|0);
  16985. $211 = tempRet0;
  16986. $212 = (_i64Add(($210|0),($211|0),($172|0),($173|0))|0);
  16987. $213 = tempRet0;
  16988. $214 = (_i64Add(($212|0),($213|0),($138|0),($139|0))|0);
  16989. $215 = tempRet0;
  16990. $216 = (_i64Add(($214|0),($215|0),($156|0),($157|0))|0);
  16991. $217 = tempRet0;
  16992. $218 = (___muldi3(($106|0),0,666643,0)|0);
  16993. $219 = tempRet0;
  16994. $220 = (_i64Add(($218|0),($219|0),($38|0),0)|0);
  16995. $221 = tempRet0;
  16996. $222 = (___muldi3(($106|0),0,470296,0)|0);
  16997. $223 = tempRet0;
  16998. $224 = (___muldi3(($106|0),0,654183,0)|0);
  16999. $225 = tempRet0;
  17000. $226 = (_i64Add(($224|0),($225|0),($48|0),0)|0);
  17001. $227 = tempRet0;
  17002. $228 = (_i64Add(($226|0),($227|0),($198|0),($199|0))|0);
  17003. $229 = tempRet0;
  17004. $230 = (_i64Add(($228|0),($229|0),($184|0),($185|0))|0);
  17005. $231 = tempRet0;
  17006. $232 = (___muldi3(($106|0),0,-997805,-1)|0);
  17007. $233 = tempRet0;
  17008. $234 = (___muldi3(($106|0),0,136657,0)|0);
  17009. $235 = tempRet0;
  17010. $236 = (_i64Add(($234|0),($235|0),($60|0),0)|0);
  17011. $237 = tempRet0;
  17012. $238 = (_i64Add(($236|0),($237|0),($202|0),($203|0))|0);
  17013. $239 = tempRet0;
  17014. $240 = (_i64Add(($238|0),($239|0),($188|0),($189|0))|0);
  17015. $241 = tempRet0;
  17016. $242 = (_i64Add(($240|0),($241|0),($168|0),($169|0))|0);
  17017. $243 = tempRet0;
  17018. $244 = (_i64Add(($242|0),($243|0),($152|0),($153|0))|0);
  17019. $245 = tempRet0;
  17020. $246 = (___muldi3(($106|0),0,-683901,-1)|0);
  17021. $247 = tempRet0;
  17022. $248 = (_i64Add(($220|0),($221|0),1048576,0)|0);
  17023. $249 = tempRet0;
  17024. $250 = (_bitshift64Lshr(($248|0),($249|0),21)|0);
  17025. $251 = tempRet0;
  17026. $252 = (_i64Add(($222|0),($223|0),($44|0),0)|0);
  17027. $253 = tempRet0;
  17028. $254 = (_i64Add(($252|0),($253|0),($196|0),($197|0))|0);
  17029. $255 = tempRet0;
  17030. $256 = (_i64Add(($254|0),($255|0),($250|0),($251|0))|0);
  17031. $257 = tempRet0;
  17032. $258 = (_bitshift64Shl(($250|0),($251|0),21)|0);
  17033. $259 = tempRet0;
  17034. $260 = (_i64Subtract(($220|0),($221|0),($258|0),($259|0))|0);
  17035. $261 = tempRet0;
  17036. $262 = (_i64Add(($230|0),($231|0),1048576,0)|0);
  17037. $263 = tempRet0;
  17038. $264 = (_bitshift64Lshr(($262|0),($263|0),21)|0);
  17039. $265 = tempRet0;
  17040. $266 = (_i64Add(($232|0),($233|0),($54|0),0)|0);
  17041. $267 = tempRet0;
  17042. $268 = (_i64Add(($266|0),($267|0),($200|0),($201|0))|0);
  17043. $269 = tempRet0;
  17044. $270 = (_i64Add(($268|0),($269|0),($186|0),($187|0))|0);
  17045. $271 = tempRet0;
  17046. $272 = (_i64Add(($270|0),($271|0),($166|0),($167|0))|0);
  17047. $273 = tempRet0;
  17048. $274 = (_i64Add(($272|0),($273|0),($264|0),($265|0))|0);
  17049. $275 = tempRet0;
  17050. $276 = (_bitshift64Shl(($264|0),($265|0),21)|0);
  17051. $277 = tempRet0;
  17052. $278 = (_i64Subtract(($230|0),($231|0),($276|0),($277|0))|0);
  17053. $279 = tempRet0;
  17054. $280 = (_i64Add(($244|0),($245|0),1048576,0)|0);
  17055. $281 = tempRet0;
  17056. $282 = (_bitshift64Ashr(($280|0),($281|0),21)|0);
  17057. $283 = tempRet0;
  17058. $284 = (_i64Add(($246|0),($247|0),($66|0),0)|0);
  17059. $285 = tempRet0;
  17060. $286 = (_i64Add(($284|0),($285|0),($204|0),($205|0))|0);
  17061. $287 = tempRet0;
  17062. $288 = (_i64Add(($286|0),($287|0),($190|0),($191|0))|0);
  17063. $289 = tempRet0;
  17064. $290 = (_i64Add(($288|0),($289|0),($170|0),($171|0))|0);
  17065. $291 = tempRet0;
  17066. $292 = (_i64Add(($290|0),($291|0),($136|0),($137|0))|0);
  17067. $293 = tempRet0;
  17068. $294 = (_i64Add(($292|0),($293|0),($154|0),($155|0))|0);
  17069. $295 = tempRet0;
  17070. $296 = (_i64Add(($294|0),($295|0),($282|0),($283|0))|0);
  17071. $297 = tempRet0;
  17072. $298 = (_bitshift64Shl(($282|0),($283|0),21)|0);
  17073. $299 = tempRet0;
  17074. $300 = (_i64Subtract(($244|0),($245|0),($298|0),($299|0))|0);
  17075. $301 = tempRet0;
  17076. $302 = (_i64Add(($216|0),($217|0),1048576,0)|0);
  17077. $303 = tempRet0;
  17078. $304 = (_bitshift64Ashr(($302|0),($303|0),21)|0);
  17079. $305 = tempRet0;
  17080. $306 = (_i64Add(($194|0),($195|0),($78|0),0)|0);
  17081. $307 = tempRet0;
  17082. $308 = (_i64Add(($306|0),($307|0),($174|0),($175|0))|0);
  17083. $309 = tempRet0;
  17084. $310 = (_i64Add(($308|0),($309|0),($140|0),($141|0))|0);
  17085. $311 = tempRet0;
  17086. $312 = (_i64Add(($310|0),($311|0),($158|0),($159|0))|0);
  17087. $313 = tempRet0;
  17088. $314 = (_i64Add(($312|0),($313|0),($304|0),($305|0))|0);
  17089. $315 = tempRet0;
  17090. $316 = (_bitshift64Shl(($304|0),($305|0),21)|0);
  17091. $317 = tempRet0;
  17092. $318 = (_i64Subtract(($216|0),($217|0),($316|0),($317|0))|0);
  17093. $319 = tempRet0;
  17094. $320 = (_i64Add(($182|0),($183|0),1048576,0)|0);
  17095. $321 = tempRet0;
  17096. $322 = (_bitshift64Ashr(($320|0),($321|0),21)|0);
  17097. $323 = tempRet0;
  17098. $324 = (_i64Add(($164|0),($165|0),($322|0),($323|0))|0);
  17099. $325 = tempRet0;
  17100. $326 = (_bitshift64Shl(($322|0),($323|0),21)|0);
  17101. $327 = tempRet0;
  17102. $328 = (_i64Subtract(($182|0),($183|0),($326|0),($327|0))|0);
  17103. $329 = tempRet0;
  17104. $330 = (_i64Add(($150|0),($151|0),1048576,0)|0);
  17105. $331 = tempRet0;
  17106. $332 = (_bitshift64Ashr(($330|0),($331|0),21)|0);
  17107. $333 = tempRet0;
  17108. $334 = (_i64Add(($332|0),($333|0),($100|0),0)|0);
  17109. $335 = tempRet0;
  17110. $336 = (_bitshift64Shl(($332|0),($333|0),21)|0);
  17111. $337 = tempRet0;
  17112. $338 = (_i64Subtract(($150|0),($151|0),($336|0),($337|0))|0);
  17113. $339 = tempRet0;
  17114. $340 = (_i64Add(($256|0),($257|0),1048576,0)|0);
  17115. $341 = tempRet0;
  17116. $342 = (_bitshift64Lshr(($340|0),($341|0),21)|0);
  17117. $343 = tempRet0;
  17118. $344 = (_i64Add(($278|0),($279|0),($342|0),($343|0))|0);
  17119. $345 = tempRet0;
  17120. $346 = (_bitshift64Shl(($342|0),($343|0),21)|0);
  17121. $347 = tempRet0;
  17122. $348 = (_i64Subtract(($256|0),($257|0),($346|0),($347|0))|0);
  17123. $349 = tempRet0;
  17124. $350 = (_i64Add(($274|0),($275|0),1048576,0)|0);
  17125. $351 = tempRet0;
  17126. $352 = (_bitshift64Ashr(($350|0),($351|0),21)|0);
  17127. $353 = tempRet0;
  17128. $354 = (_i64Add(($300|0),($301|0),($352|0),($353|0))|0);
  17129. $355 = tempRet0;
  17130. $356 = (_bitshift64Shl(($352|0),($353|0),21)|0);
  17131. $357 = tempRet0;
  17132. $358 = (_i64Subtract(($274|0),($275|0),($356|0),($357|0))|0);
  17133. $359 = tempRet0;
  17134. $360 = (_i64Add(($296|0),($297|0),1048576,0)|0);
  17135. $361 = tempRet0;
  17136. $362 = (_bitshift64Ashr(($360|0),($361|0),21)|0);
  17137. $363 = tempRet0;
  17138. $364 = (_i64Add(($318|0),($319|0),($362|0),($363|0))|0);
  17139. $365 = tempRet0;
  17140. $366 = (_bitshift64Shl(($362|0),($363|0),21)|0);
  17141. $367 = tempRet0;
  17142. $368 = (_i64Subtract(($296|0),($297|0),($366|0),($367|0))|0);
  17143. $369 = tempRet0;
  17144. $370 = (_i64Add(($314|0),($315|0),1048576,0)|0);
  17145. $371 = tempRet0;
  17146. $372 = (_bitshift64Ashr(($370|0),($371|0),21)|0);
  17147. $373 = tempRet0;
  17148. $374 = (_i64Add(($372|0),($373|0),($328|0),($329|0))|0);
  17149. $375 = tempRet0;
  17150. $376 = (_bitshift64Shl(($372|0),($373|0),21)|0);
  17151. $377 = tempRet0;
  17152. $378 = (_i64Subtract(($314|0),($315|0),($376|0),($377|0))|0);
  17153. $379 = tempRet0;
  17154. $380 = (_i64Add(($324|0),($325|0),1048576,0)|0);
  17155. $381 = tempRet0;
  17156. $382 = (_bitshift64Ashr(($380|0),($381|0),21)|0);
  17157. $383 = tempRet0;
  17158. $384 = (_i64Add(($382|0),($383|0),($338|0),($339|0))|0);
  17159. $385 = tempRet0;
  17160. $386 = (_bitshift64Shl(($382|0),($383|0),21)|0);
  17161. $387 = tempRet0;
  17162. $388 = (_i64Subtract(($324|0),($325|0),($386|0),($387|0))|0);
  17163. $389 = tempRet0;
  17164. $390 = (___muldi3(($334|0),($335|0),666643,0)|0);
  17165. $391 = tempRet0;
  17166. $392 = (_i64Add(($390|0),($391|0),($32|0),0)|0);
  17167. $393 = tempRet0;
  17168. $394 = (___muldi3(($334|0),($335|0),470296,0)|0);
  17169. $395 = tempRet0;
  17170. $396 = (_i64Add(($260|0),($261|0),($394|0),($395|0))|0);
  17171. $397 = tempRet0;
  17172. $398 = (___muldi3(($334|0),($335|0),654183,0)|0);
  17173. $399 = tempRet0;
  17174. $400 = (_i64Add(($348|0),($349|0),($398|0),($399|0))|0);
  17175. $401 = tempRet0;
  17176. $402 = (___muldi3(($334|0),($335|0),-997805,-1)|0);
  17177. $403 = tempRet0;
  17178. $404 = (_i64Add(($344|0),($345|0),($402|0),($403|0))|0);
  17179. $405 = tempRet0;
  17180. $406 = (___muldi3(($334|0),($335|0),136657,0)|0);
  17181. $407 = tempRet0;
  17182. $408 = (_i64Add(($358|0),($359|0),($406|0),($407|0))|0);
  17183. $409 = tempRet0;
  17184. $410 = (___muldi3(($334|0),($335|0),-683901,-1)|0);
  17185. $411 = tempRet0;
  17186. $412 = (_i64Add(($354|0),($355|0),($410|0),($411|0))|0);
  17187. $413 = tempRet0;
  17188. $414 = (___muldi3(($384|0),($385|0),666643,0)|0);
  17189. $415 = tempRet0;
  17190. $416 = (___muldi3(($384|0),($385|0),470296,0)|0);
  17191. $417 = tempRet0;
  17192. $418 = (___muldi3(($384|0),($385|0),654183,0)|0);
  17193. $419 = tempRet0;
  17194. $420 = (_i64Add(($396|0),($397|0),($418|0),($419|0))|0);
  17195. $421 = tempRet0;
  17196. $422 = (___muldi3(($384|0),($385|0),-997805,-1)|0);
  17197. $423 = tempRet0;
  17198. $424 = (_i64Add(($400|0),($401|0),($422|0),($423|0))|0);
  17199. $425 = tempRet0;
  17200. $426 = (___muldi3(($384|0),($385|0),136657,0)|0);
  17201. $427 = tempRet0;
  17202. $428 = (_i64Add(($404|0),($405|0),($426|0),($427|0))|0);
  17203. $429 = tempRet0;
  17204. $430 = (___muldi3(($384|0),($385|0),-683901,-1)|0);
  17205. $431 = tempRet0;
  17206. $432 = (_i64Add(($408|0),($409|0),($430|0),($431|0))|0);
  17207. $433 = tempRet0;
  17208. $434 = (___muldi3(($388|0),($389|0),666643,0)|0);
  17209. $435 = tempRet0;
  17210. $436 = (___muldi3(($388|0),($389|0),470296,0)|0);
  17211. $437 = tempRet0;
  17212. $438 = (___muldi3(($388|0),($389|0),654183,0)|0);
  17213. $439 = tempRet0;
  17214. $440 = (___muldi3(($388|0),($389|0),-997805,-1)|0);
  17215. $441 = tempRet0;
  17216. $442 = (___muldi3(($388|0),($389|0),136657,0)|0);
  17217. $443 = tempRet0;
  17218. $444 = (___muldi3(($388|0),($389|0),-683901,-1)|0);
  17219. $445 = tempRet0;
  17220. $446 = (_i64Add(($428|0),($429|0),($444|0),($445|0))|0);
  17221. $447 = tempRet0;
  17222. $448 = (___muldi3(($374|0),($375|0),666643,0)|0);
  17223. $449 = tempRet0;
  17224. $450 = (___muldi3(($374|0),($375|0),470296,0)|0);
  17225. $451 = tempRet0;
  17226. $452 = (___muldi3(($374|0),($375|0),654183,0)|0);
  17227. $453 = tempRet0;
  17228. $454 = (___muldi3(($374|0),($375|0),-997805,-1)|0);
  17229. $455 = tempRet0;
  17230. $456 = (___muldi3(($374|0),($375|0),136657,0)|0);
  17231. $457 = tempRet0;
  17232. $458 = (___muldi3(($374|0),($375|0),-683901,-1)|0);
  17233. $459 = tempRet0;
  17234. $460 = (___muldi3(($378|0),($379|0),666643,0)|0);
  17235. $461 = tempRet0;
  17236. $462 = (___muldi3(($378|0),($379|0),470296,0)|0);
  17237. $463 = tempRet0;
  17238. $464 = (___muldi3(($378|0),($379|0),654183,0)|0);
  17239. $465 = tempRet0;
  17240. $466 = (___muldi3(($378|0),($379|0),-997805,-1)|0);
  17241. $467 = tempRet0;
  17242. $468 = (___muldi3(($378|0),($379|0),136657,0)|0);
  17243. $469 = tempRet0;
  17244. $470 = (___muldi3(($378|0),($379|0),-683901,-1)|0);
  17245. $471 = tempRet0;
  17246. $472 = (_i64Add(($420|0),($421|0),($456|0),($457|0))|0);
  17247. $473 = tempRet0;
  17248. $474 = (_i64Add(($472|0),($473|0),($440|0),($441|0))|0);
  17249. $475 = tempRet0;
  17250. $476 = (_i64Add(($474|0),($475|0),($470|0),($471|0))|0);
  17251. $477 = tempRet0;
  17252. $478 = (___muldi3(($364|0),($365|0),666643,0)|0);
  17253. $479 = tempRet0;
  17254. $480 = (_i64Add(($478|0),($479|0),($2|0),0)|0);
  17255. $481 = tempRet0;
  17256. $482 = (___muldi3(($364|0),($365|0),470296,0)|0);
  17257. $483 = tempRet0;
  17258. $484 = (___muldi3(($364|0),($365|0),654183,0)|0);
  17259. $485 = tempRet0;
  17260. $486 = (_i64Add(($484|0),($485|0),($14|0),0)|0);
  17261. $487 = tempRet0;
  17262. $488 = (_i64Add(($486|0),($487|0),($448|0),($449|0))|0);
  17263. $489 = tempRet0;
  17264. $490 = (_i64Add(($488|0),($489|0),($462|0),($463|0))|0);
  17265. $491 = tempRet0;
  17266. $492 = (___muldi3(($364|0),($365|0),-997805,-1)|0);
  17267. $493 = tempRet0;
  17268. $494 = (___muldi3(($364|0),($365|0),136657,0)|0);
  17269. $495 = tempRet0;
  17270. $496 = (_i64Add(($494|0),($495|0),($26|0),0)|0);
  17271. $497 = tempRet0;
  17272. $498 = (_i64Add(($496|0),($497|0),($414|0),($415|0))|0);
  17273. $499 = tempRet0;
  17274. $500 = (_i64Add(($498|0),($499|0),($452|0),($453|0))|0);
  17275. $501 = tempRet0;
  17276. $502 = (_i64Add(($500|0),($501|0),($436|0),($437|0))|0);
  17277. $503 = tempRet0;
  17278. $504 = (_i64Add(($502|0),($503|0),($466|0),($467|0))|0);
  17279. $505 = tempRet0;
  17280. $506 = (___muldi3(($364|0),($365|0),-683901,-1)|0);
  17281. $507 = tempRet0;
  17282. $508 = (_i64Add(($480|0),($481|0),1048576,0)|0);
  17283. $509 = tempRet0;
  17284. $510 = (_bitshift64Ashr(($508|0),($509|0),21)|0);
  17285. $511 = tempRet0;
  17286. $512 = (_i64Add(($482|0),($483|0),($8|0),0)|0);
  17287. $513 = tempRet0;
  17288. $514 = (_i64Add(($512|0),($513|0),($460|0),($461|0))|0);
  17289. $515 = tempRet0;
  17290. $516 = (_i64Add(($514|0),($515|0),($510|0),($511|0))|0);
  17291. $517 = tempRet0;
  17292. $518 = (_bitshift64Shl(($510|0),($511|0),21)|0);
  17293. $519 = tempRet0;
  17294. $520 = (_i64Subtract(($480|0),($481|0),($518|0),($519|0))|0);
  17295. $521 = tempRet0;
  17296. $522 = (_i64Add(($490|0),($491|0),1048576,0)|0);
  17297. $523 = tempRet0;
  17298. $524 = (_bitshift64Ashr(($522|0),($523|0),21)|0);
  17299. $525 = tempRet0;
  17300. $526 = (_i64Add(($492|0),($493|0),($20|0),0)|0);
  17301. $527 = tempRet0;
  17302. $528 = (_i64Add(($526|0),($527|0),($450|0),($451|0))|0);
  17303. $529 = tempRet0;
  17304. $530 = (_i64Add(($528|0),($529|0),($434|0),($435|0))|0);
  17305. $531 = tempRet0;
  17306. $532 = (_i64Add(($530|0),($531|0),($464|0),($465|0))|0);
  17307. $533 = tempRet0;
  17308. $534 = (_i64Add(($532|0),($533|0),($524|0),($525|0))|0);
  17309. $535 = tempRet0;
  17310. $536 = (_bitshift64Shl(($524|0),($525|0),21)|0);
  17311. $537 = tempRet0;
  17312. $538 = (_i64Add(($504|0),($505|0),1048576,0)|0);
  17313. $539 = tempRet0;
  17314. $540 = (_bitshift64Ashr(($538|0),($539|0),21)|0);
  17315. $541 = tempRet0;
  17316. $542 = (_i64Add(($392|0),($393|0),($506|0),($507|0))|0);
  17317. $543 = tempRet0;
  17318. $544 = (_i64Add(($542|0),($543|0),($416|0),($417|0))|0);
  17319. $545 = tempRet0;
  17320. $546 = (_i64Add(($544|0),($545|0),($454|0),($455|0))|0);
  17321. $547 = tempRet0;
  17322. $548 = (_i64Add(($546|0),($547|0),($438|0),($439|0))|0);
  17323. $549 = tempRet0;
  17324. $550 = (_i64Add(($548|0),($549|0),($468|0),($469|0))|0);
  17325. $551 = tempRet0;
  17326. $552 = (_i64Add(($550|0),($551|0),($540|0),($541|0))|0);
  17327. $553 = tempRet0;
  17328. $554 = (_bitshift64Shl(($540|0),($541|0),21)|0);
  17329. $555 = tempRet0;
  17330. $556 = (_i64Add(($476|0),($477|0),1048576,0)|0);
  17331. $557 = tempRet0;
  17332. $558 = (_bitshift64Ashr(($556|0),($557|0),21)|0);
  17333. $559 = tempRet0;
  17334. $560 = (_i64Add(($424|0),($425|0),($458|0),($459|0))|0);
  17335. $561 = tempRet0;
  17336. $562 = (_i64Add(($560|0),($561|0),($442|0),($443|0))|0);
  17337. $563 = tempRet0;
  17338. $564 = (_i64Add(($562|0),($563|0),($558|0),($559|0))|0);
  17339. $565 = tempRet0;
  17340. $566 = (_bitshift64Shl(($558|0),($559|0),21)|0);
  17341. $567 = tempRet0;
  17342. $568 = (_i64Subtract(($476|0),($477|0),($566|0),($567|0))|0);
  17343. $569 = tempRet0;
  17344. $570 = (_i64Add(($446|0),($447|0),1048576,0)|0);
  17345. $571 = tempRet0;
  17346. $572 = (_bitshift64Ashr(($570|0),($571|0),21)|0);
  17347. $573 = tempRet0;
  17348. $574 = (_i64Add(($432|0),($433|0),($572|0),($573|0))|0);
  17349. $575 = tempRet0;
  17350. $576 = (_bitshift64Shl(($572|0),($573|0),21)|0);
  17351. $577 = tempRet0;
  17352. $578 = (_i64Subtract(($446|0),($447|0),($576|0),($577|0))|0);
  17353. $579 = tempRet0;
  17354. $580 = (_i64Add(($412|0),($413|0),1048576,0)|0);
  17355. $581 = tempRet0;
  17356. $582 = (_bitshift64Ashr(($580|0),($581|0),21)|0);
  17357. $583 = tempRet0;
  17358. $584 = (_i64Add(($582|0),($583|0),($368|0),($369|0))|0);
  17359. $585 = tempRet0;
  17360. $586 = (_bitshift64Shl(($582|0),($583|0),21)|0);
  17361. $587 = tempRet0;
  17362. $588 = (_i64Subtract(($412|0),($413|0),($586|0),($587|0))|0);
  17363. $589 = tempRet0;
  17364. $590 = (_i64Add(($516|0),($517|0),1048576,0)|0);
  17365. $591 = tempRet0;
  17366. $592 = (_bitshift64Ashr(($590|0),($591|0),21)|0);
  17367. $593 = tempRet0;
  17368. $594 = (_bitshift64Shl(($592|0),($593|0),21)|0);
  17369. $595 = tempRet0;
  17370. $596 = (_i64Add(($534|0),($535|0),1048576,0)|0);
  17371. $597 = tempRet0;
  17372. $598 = (_bitshift64Ashr(($596|0),($597|0),21)|0);
  17373. $599 = tempRet0;
  17374. $600 = (_bitshift64Shl(($598|0),($599|0),21)|0);
  17375. $601 = tempRet0;
  17376. $602 = (_i64Add(($552|0),($553|0),1048576,0)|0);
  17377. $603 = tempRet0;
  17378. $604 = (_bitshift64Ashr(($602|0),($603|0),21)|0);
  17379. $605 = tempRet0;
  17380. $606 = (_i64Add(($568|0),($569|0),($604|0),($605|0))|0);
  17381. $607 = tempRet0;
  17382. $608 = (_bitshift64Shl(($604|0),($605|0),21)|0);
  17383. $609 = tempRet0;
  17384. $610 = (_i64Add(($564|0),($565|0),1048576,0)|0);
  17385. $611 = tempRet0;
  17386. $612 = (_bitshift64Ashr(($610|0),($611|0),21)|0);
  17387. $613 = tempRet0;
  17388. $614 = (_i64Add(($578|0),($579|0),($612|0),($613|0))|0);
  17389. $615 = tempRet0;
  17390. $616 = (_bitshift64Shl(($612|0),($613|0),21)|0);
  17391. $617 = tempRet0;
  17392. $618 = (_i64Subtract(($564|0),($565|0),($616|0),($617|0))|0);
  17393. $619 = tempRet0;
  17394. $620 = (_i64Add(($574|0),($575|0),1048576,0)|0);
  17395. $621 = tempRet0;
  17396. $622 = (_bitshift64Ashr(($620|0),($621|0),21)|0);
  17397. $623 = tempRet0;
  17398. $624 = (_i64Add(($588|0),($589|0),($622|0),($623|0))|0);
  17399. $625 = tempRet0;
  17400. $626 = (_bitshift64Shl(($622|0),($623|0),21)|0);
  17401. $627 = tempRet0;
  17402. $628 = (_i64Subtract(($574|0),($575|0),($626|0),($627|0))|0);
  17403. $629 = tempRet0;
  17404. $630 = (_i64Add(($584|0),($585|0),1048576,0)|0);
  17405. $631 = tempRet0;
  17406. $632 = (_bitshift64Ashr(($630|0),($631|0),21)|0);
  17407. $633 = tempRet0;
  17408. $634 = (_bitshift64Shl(($632|0),($633|0),21)|0);
  17409. $635 = tempRet0;
  17410. $636 = (_i64Subtract(($584|0),($585|0),($634|0),($635|0))|0);
  17411. $637 = tempRet0;
  17412. $638 = (___muldi3(($632|0),($633|0),666643,0)|0);
  17413. $639 = tempRet0;
  17414. $640 = (_i64Add(($520|0),($521|0),($638|0),($639|0))|0);
  17415. $641 = tempRet0;
  17416. $642 = (___muldi3(($632|0),($633|0),470296,0)|0);
  17417. $643 = tempRet0;
  17418. $644 = (___muldi3(($632|0),($633|0),654183,0)|0);
  17419. $645 = tempRet0;
  17420. $646 = (___muldi3(($632|0),($633|0),-997805,-1)|0);
  17421. $647 = tempRet0;
  17422. $648 = (___muldi3(($632|0),($633|0),136657,0)|0);
  17423. $649 = tempRet0;
  17424. $650 = (___muldi3(($632|0),($633|0),-683901,-1)|0);
  17425. $651 = tempRet0;
  17426. $652 = (_bitshift64Ashr(($640|0),($641|0),21)|0);
  17427. $653 = tempRet0;
  17428. $654 = (_i64Add(($642|0),($643|0),($516|0),($517|0))|0);
  17429. $655 = tempRet0;
  17430. $656 = (_i64Subtract(($654|0),($655|0),($594|0),($595|0))|0);
  17431. $657 = tempRet0;
  17432. $658 = (_i64Add(($656|0),($657|0),($652|0),($653|0))|0);
  17433. $659 = tempRet0;
  17434. $660 = (_bitshift64Shl(($652|0),($653|0),21)|0);
  17435. $661 = tempRet0;
  17436. $662 = (_i64Subtract(($640|0),($641|0),($660|0),($661|0))|0);
  17437. $663 = tempRet0;
  17438. $664 = (_bitshift64Ashr(($658|0),($659|0),21)|0);
  17439. $665 = tempRet0;
  17440. $666 = (_i64Add(($644|0),($645|0),($490|0),($491|0))|0);
  17441. $667 = tempRet0;
  17442. $668 = (_i64Subtract(($666|0),($667|0),($536|0),($537|0))|0);
  17443. $669 = tempRet0;
  17444. $670 = (_i64Add(($668|0),($669|0),($592|0),($593|0))|0);
  17445. $671 = tempRet0;
  17446. $672 = (_i64Add(($670|0),($671|0),($664|0),($665|0))|0);
  17447. $673 = tempRet0;
  17448. $674 = (_bitshift64Shl(($664|0),($665|0),21)|0);
  17449. $675 = tempRet0;
  17450. $676 = (_i64Subtract(($658|0),($659|0),($674|0),($675|0))|0);
  17451. $677 = tempRet0;
  17452. $678 = (_bitshift64Ashr(($672|0),($673|0),21)|0);
  17453. $679 = tempRet0;
  17454. $680 = (_i64Add(($534|0),($535|0),($646|0),($647|0))|0);
  17455. $681 = tempRet0;
  17456. $682 = (_i64Subtract(($680|0),($681|0),($600|0),($601|0))|0);
  17457. $683 = tempRet0;
  17458. $684 = (_i64Add(($682|0),($683|0),($678|0),($679|0))|0);
  17459. $685 = tempRet0;
  17460. $686 = (_bitshift64Shl(($678|0),($679|0),21)|0);
  17461. $687 = tempRet0;
  17462. $688 = (_i64Subtract(($672|0),($673|0),($686|0),($687|0))|0);
  17463. $689 = tempRet0;
  17464. $690 = (_bitshift64Ashr(($684|0),($685|0),21)|0);
  17465. $691 = tempRet0;
  17466. $692 = (_i64Add(($648|0),($649|0),($504|0),($505|0))|0);
  17467. $693 = tempRet0;
  17468. $694 = (_i64Subtract(($692|0),($693|0),($554|0),($555|0))|0);
  17469. $695 = tempRet0;
  17470. $696 = (_i64Add(($694|0),($695|0),($598|0),($599|0))|0);
  17471. $697 = tempRet0;
  17472. $698 = (_i64Add(($696|0),($697|0),($690|0),($691|0))|0);
  17473. $699 = tempRet0;
  17474. $700 = (_bitshift64Shl(($690|0),($691|0),21)|0);
  17475. $701 = tempRet0;
  17476. $702 = (_i64Subtract(($684|0),($685|0),($700|0),($701|0))|0);
  17477. $703 = tempRet0;
  17478. $704 = (_bitshift64Ashr(($698|0),($699|0),21)|0);
  17479. $705 = tempRet0;
  17480. $706 = (_i64Add(($552|0),($553|0),($650|0),($651|0))|0);
  17481. $707 = tempRet0;
  17482. $708 = (_i64Subtract(($706|0),($707|0),($608|0),($609|0))|0);
  17483. $709 = tempRet0;
  17484. $710 = (_i64Add(($708|0),($709|0),($704|0),($705|0))|0);
  17485. $711 = tempRet0;
  17486. $712 = (_bitshift64Shl(($704|0),($705|0),21)|0);
  17487. $713 = tempRet0;
  17488. $714 = (_i64Subtract(($698|0),($699|0),($712|0),($713|0))|0);
  17489. $715 = tempRet0;
  17490. $716 = (_bitshift64Ashr(($710|0),($711|0),21)|0);
  17491. $717 = tempRet0;
  17492. $718 = (_i64Add(($606|0),($607|0),($716|0),($717|0))|0);
  17493. $719 = tempRet0;
  17494. $720 = (_bitshift64Shl(($716|0),($717|0),21)|0);
  17495. $721 = tempRet0;
  17496. $722 = (_i64Subtract(($710|0),($711|0),($720|0),($721|0))|0);
  17497. $723 = tempRet0;
  17498. $724 = (_bitshift64Ashr(($718|0),($719|0),21)|0);
  17499. $725 = tempRet0;
  17500. $726 = (_i64Add(($724|0),($725|0),($618|0),($619|0))|0);
  17501. $727 = tempRet0;
  17502. $728 = (_bitshift64Shl(($724|0),($725|0),21)|0);
  17503. $729 = tempRet0;
  17504. $730 = (_i64Subtract(($718|0),($719|0),($728|0),($729|0))|0);
  17505. $731 = tempRet0;
  17506. $732 = (_bitshift64Ashr(($726|0),($727|0),21)|0);
  17507. $733 = tempRet0;
  17508. $734 = (_i64Add(($614|0),($615|0),($732|0),($733|0))|0);
  17509. $735 = tempRet0;
  17510. $736 = (_bitshift64Shl(($732|0),($733|0),21)|0);
  17511. $737 = tempRet0;
  17512. $738 = (_i64Subtract(($726|0),($727|0),($736|0),($737|0))|0);
  17513. $739 = tempRet0;
  17514. $740 = (_bitshift64Ashr(($734|0),($735|0),21)|0);
  17515. $741 = tempRet0;
  17516. $742 = (_i64Add(($740|0),($741|0),($628|0),($629|0))|0);
  17517. $743 = tempRet0;
  17518. $744 = (_bitshift64Shl(($740|0),($741|0),21)|0);
  17519. $745 = tempRet0;
  17520. $746 = (_i64Subtract(($734|0),($735|0),($744|0),($745|0))|0);
  17521. $747 = tempRet0;
  17522. $748 = (_bitshift64Ashr(($742|0),($743|0),21)|0);
  17523. $749 = tempRet0;
  17524. $750 = (_i64Add(($624|0),($625|0),($748|0),($749|0))|0);
  17525. $751 = tempRet0;
  17526. $752 = (_bitshift64Shl(($748|0),($749|0),21)|0);
  17527. $753 = tempRet0;
  17528. $754 = (_i64Subtract(($742|0),($743|0),($752|0),($753|0))|0);
  17529. $755 = tempRet0;
  17530. $756 = (_bitshift64Ashr(($750|0),($751|0),21)|0);
  17531. $757 = tempRet0;
  17532. $758 = (_i64Add(($756|0),($757|0),($636|0),($637|0))|0);
  17533. $759 = tempRet0;
  17534. $760 = (_bitshift64Shl(($756|0),($757|0),21)|0);
  17535. $761 = tempRet0;
  17536. $762 = (_i64Subtract(($750|0),($751|0),($760|0),($761|0))|0);
  17537. $763 = tempRet0;
  17538. $764 = (_bitshift64Ashr(($758|0),($759|0),21)|0);
  17539. $765 = tempRet0;
  17540. $766 = (_bitshift64Shl(($764|0),($765|0),21)|0);
  17541. $767 = tempRet0;
  17542. $768 = (_i64Subtract(($758|0),($759|0),($766|0),($767|0))|0);
  17543. $769 = tempRet0;
  17544. $770 = (___muldi3(($764|0),($765|0),666643,0)|0);
  17545. $771 = tempRet0;
  17546. $772 = (_i64Add(($770|0),($771|0),($662|0),($663|0))|0);
  17547. $773 = tempRet0;
  17548. $774 = (___muldi3(($764|0),($765|0),470296,0)|0);
  17549. $775 = tempRet0;
  17550. $776 = (_i64Add(($676|0),($677|0),($774|0),($775|0))|0);
  17551. $777 = tempRet0;
  17552. $778 = (___muldi3(($764|0),($765|0),654183,0)|0);
  17553. $779 = tempRet0;
  17554. $780 = (_i64Add(($688|0),($689|0),($778|0),($779|0))|0);
  17555. $781 = tempRet0;
  17556. $782 = (___muldi3(($764|0),($765|0),-997805,-1)|0);
  17557. $783 = tempRet0;
  17558. $784 = (_i64Add(($702|0),($703|0),($782|0),($783|0))|0);
  17559. $785 = tempRet0;
  17560. $786 = (___muldi3(($764|0),($765|0),136657,0)|0);
  17561. $787 = tempRet0;
  17562. $788 = (_i64Add(($714|0),($715|0),($786|0),($787|0))|0);
  17563. $789 = tempRet0;
  17564. $790 = (___muldi3(($764|0),($765|0),-683901,-1)|0);
  17565. $791 = tempRet0;
  17566. $792 = (_i64Add(($722|0),($723|0),($790|0),($791|0))|0);
  17567. $793 = tempRet0;
  17568. $794 = (_bitshift64Ashr(($772|0),($773|0),21)|0);
  17569. $795 = tempRet0;
  17570. $796 = (_i64Add(($776|0),($777|0),($794|0),($795|0))|0);
  17571. $797 = tempRet0;
  17572. $798 = (_bitshift64Shl(($794|0),($795|0),21)|0);
  17573. $799 = tempRet0;
  17574. $800 = (_i64Subtract(($772|0),($773|0),($798|0),($799|0))|0);
  17575. $801 = tempRet0;
  17576. $802 = (_bitshift64Ashr(($796|0),($797|0),21)|0);
  17577. $803 = tempRet0;
  17578. $804 = (_i64Add(($780|0),($781|0),($802|0),($803|0))|0);
  17579. $805 = tempRet0;
  17580. $806 = (_bitshift64Shl(($802|0),($803|0),21)|0);
  17581. $807 = tempRet0;
  17582. $808 = (_i64Subtract(($796|0),($797|0),($806|0),($807|0))|0);
  17583. $809 = tempRet0;
  17584. $810 = (_bitshift64Ashr(($804|0),($805|0),21)|0);
  17585. $811 = tempRet0;
  17586. $812 = (_i64Add(($784|0),($785|0),($810|0),($811|0))|0);
  17587. $813 = tempRet0;
  17588. $814 = (_bitshift64Shl(($810|0),($811|0),21)|0);
  17589. $815 = tempRet0;
  17590. $816 = (_i64Subtract(($804|0),($805|0),($814|0),($815|0))|0);
  17591. $817 = tempRet0;
  17592. $818 = (_bitshift64Ashr(($812|0),($813|0),21)|0);
  17593. $819 = tempRet0;
  17594. $820 = (_i64Add(($788|0),($789|0),($818|0),($819|0))|0);
  17595. $821 = tempRet0;
  17596. $822 = (_bitshift64Shl(($818|0),($819|0),21)|0);
  17597. $823 = tempRet0;
  17598. $824 = (_i64Subtract(($812|0),($813|0),($822|0),($823|0))|0);
  17599. $825 = tempRet0;
  17600. $826 = (_bitshift64Ashr(($820|0),($821|0),21)|0);
  17601. $827 = tempRet0;
  17602. $828 = (_i64Add(($792|0),($793|0),($826|0),($827|0))|0);
  17603. $829 = tempRet0;
  17604. $830 = (_bitshift64Shl(($826|0),($827|0),21)|0);
  17605. $831 = tempRet0;
  17606. $832 = (_i64Subtract(($820|0),($821|0),($830|0),($831|0))|0);
  17607. $833 = tempRet0;
  17608. $834 = (_bitshift64Ashr(($828|0),($829|0),21)|0);
  17609. $835 = tempRet0;
  17610. $836 = (_i64Add(($834|0),($835|0),($730|0),($731|0))|0);
  17611. $837 = tempRet0;
  17612. $838 = (_bitshift64Shl(($834|0),($835|0),21)|0);
  17613. $839 = tempRet0;
  17614. $840 = (_i64Subtract(($828|0),($829|0),($838|0),($839|0))|0);
  17615. $841 = tempRet0;
  17616. $842 = (_bitshift64Ashr(($836|0),($837|0),21)|0);
  17617. $843 = tempRet0;
  17618. $844 = (_i64Add(($842|0),($843|0),($738|0),($739|0))|0);
  17619. $845 = tempRet0;
  17620. $846 = (_bitshift64Shl(($842|0),($843|0),21)|0);
  17621. $847 = tempRet0;
  17622. $848 = (_i64Subtract(($836|0),($837|0),($846|0),($847|0))|0);
  17623. $849 = tempRet0;
  17624. $850 = (_bitshift64Ashr(($844|0),($845|0),21)|0);
  17625. $851 = tempRet0;
  17626. $852 = (_i64Add(($850|0),($851|0),($746|0),($747|0))|0);
  17627. $853 = tempRet0;
  17628. $854 = (_bitshift64Shl(($850|0),($851|0),21)|0);
  17629. $855 = tempRet0;
  17630. $856 = (_i64Subtract(($844|0),($845|0),($854|0),($855|0))|0);
  17631. $857 = tempRet0;
  17632. $858 = (_bitshift64Ashr(($852|0),($853|0),21)|0);
  17633. $859 = tempRet0;
  17634. $860 = (_i64Add(($858|0),($859|0),($754|0),($755|0))|0);
  17635. $861 = tempRet0;
  17636. $862 = (_bitshift64Shl(($858|0),($859|0),21)|0);
  17637. $863 = tempRet0;
  17638. $864 = (_i64Subtract(($852|0),($853|0),($862|0),($863|0))|0);
  17639. $865 = tempRet0;
  17640. $866 = (_bitshift64Ashr(($860|0),($861|0),21)|0);
  17641. $867 = tempRet0;
  17642. $868 = (_i64Add(($866|0),($867|0),($762|0),($763|0))|0);
  17643. $869 = tempRet0;
  17644. $870 = (_bitshift64Shl(($866|0),($867|0),21)|0);
  17645. $871 = tempRet0;
  17646. $872 = (_i64Subtract(($860|0),($861|0),($870|0),($871|0))|0);
  17647. $873 = tempRet0;
  17648. $874 = (_bitshift64Ashr(($868|0),($869|0),21)|0);
  17649. $875 = tempRet0;
  17650. $876 = (_i64Add(($874|0),($875|0),($768|0),($769|0))|0);
  17651. $877 = tempRet0;
  17652. $878 = (_bitshift64Shl(($874|0),($875|0),21)|0);
  17653. $879 = tempRet0;
  17654. $880 = (_i64Subtract(($868|0),($869|0),($878|0),($879|0))|0);
  17655. $881 = tempRet0;
  17656. $882 = $800&255;
  17657. HEAP8[$s>>0] = $882;
  17658. $883 = (_bitshift64Lshr(($800|0),($801|0),8)|0);
  17659. $884 = tempRet0;
  17660. $885 = $883&255;
  17661. $886 = (($s) + 1|0);
  17662. HEAP8[$886>>0] = $885;
  17663. $887 = (_bitshift64Lshr(($800|0),($801|0),16)|0);
  17664. $888 = tempRet0;
  17665. $889 = (_bitshift64Shl(($808|0),($809|0),5)|0);
  17666. $890 = tempRet0;
  17667. $891 = $889 | $887;
  17668. $890 | $888;
  17669. $892 = $891&255;
  17670. HEAP8[$3>>0] = $892;
  17671. $893 = (_bitshift64Lshr(($808|0),($809|0),3)|0);
  17672. $894 = tempRet0;
  17673. $895 = $893&255;
  17674. $896 = (($s) + 3|0);
  17675. HEAP8[$896>>0] = $895;
  17676. $897 = (_bitshift64Lshr(($808|0),($809|0),11)|0);
  17677. $898 = tempRet0;
  17678. $899 = $897&255;
  17679. $900 = (($s) + 4|0);
  17680. HEAP8[$900>>0] = $899;
  17681. $901 = (_bitshift64Lshr(($808|0),($809|0),19)|0);
  17682. $902 = tempRet0;
  17683. $903 = (_bitshift64Shl(($816|0),($817|0),2)|0);
  17684. $904 = tempRet0;
  17685. $905 = $903 | $901;
  17686. $904 | $902;
  17687. $906 = $905&255;
  17688. HEAP8[$9>>0] = $906;
  17689. $907 = (_bitshift64Lshr(($816|0),($817|0),6)|0);
  17690. $908 = tempRet0;
  17691. $909 = $907&255;
  17692. $910 = (($s) + 6|0);
  17693. HEAP8[$910>>0] = $909;
  17694. $911 = (_bitshift64Lshr(($816|0),($817|0),14)|0);
  17695. $912 = tempRet0;
  17696. $913 = (_bitshift64Shl(($824|0),($825|0),7)|0);
  17697. $914 = tempRet0;
  17698. $915 = $913 | $911;
  17699. $914 | $912;
  17700. $916 = $915&255;
  17701. HEAP8[$15>>0] = $916;
  17702. $917 = (_bitshift64Lshr(($824|0),($825|0),1)|0);
  17703. $918 = tempRet0;
  17704. $919 = $917&255;
  17705. $920 = (($s) + 8|0);
  17706. HEAP8[$920>>0] = $919;
  17707. $921 = (_bitshift64Lshr(($824|0),($825|0),9)|0);
  17708. $922 = tempRet0;
  17709. $923 = $921&255;
  17710. $924 = (($s) + 9|0);
  17711. HEAP8[$924>>0] = $923;
  17712. $925 = (_bitshift64Lshr(($824|0),($825|0),17)|0);
  17713. $926 = tempRet0;
  17714. $927 = (_bitshift64Shl(($832|0),($833|0),4)|0);
  17715. $928 = tempRet0;
  17716. $929 = $927 | $925;
  17717. $928 | $926;
  17718. $930 = $929&255;
  17719. HEAP8[$21>>0] = $930;
  17720. $931 = (_bitshift64Lshr(($832|0),($833|0),4)|0);
  17721. $932 = tempRet0;
  17722. $933 = $931&255;
  17723. $934 = (($s) + 11|0);
  17724. HEAP8[$934>>0] = $933;
  17725. $935 = (_bitshift64Lshr(($832|0),($833|0),12)|0);
  17726. $936 = tempRet0;
  17727. $937 = $935&255;
  17728. $938 = (($s) + 12|0);
  17729. HEAP8[$938>>0] = $937;
  17730. $939 = (_bitshift64Lshr(($832|0),($833|0),20)|0);
  17731. $940 = tempRet0;
  17732. $941 = (_bitshift64Shl(($840|0),($841|0),1)|0);
  17733. $942 = tempRet0;
  17734. $943 = $941 | $939;
  17735. $942 | $940;
  17736. $944 = $943&255;
  17737. HEAP8[$27>>0] = $944;
  17738. $945 = (_bitshift64Lshr(($840|0),($841|0),7)|0);
  17739. $946 = tempRet0;
  17740. $947 = $945&255;
  17741. $948 = (($s) + 14|0);
  17742. HEAP8[$948>>0] = $947;
  17743. $949 = (_bitshift64Lshr(($840|0),($841|0),15)|0);
  17744. $950 = tempRet0;
  17745. $951 = (_bitshift64Shl(($848|0),($849|0),6)|0);
  17746. $952 = tempRet0;
  17747. $953 = $951 | $949;
  17748. $952 | $950;
  17749. $954 = $953&255;
  17750. HEAP8[$33>>0] = $954;
  17751. $955 = (_bitshift64Lshr(($848|0),($849|0),2)|0);
  17752. $956 = tempRet0;
  17753. $957 = $955&255;
  17754. $958 = (($s) + 16|0);
  17755. HEAP8[$958>>0] = $957;
  17756. $959 = (_bitshift64Lshr(($848|0),($849|0),10)|0);
  17757. $960 = tempRet0;
  17758. $961 = $959&255;
  17759. $962 = (($s) + 17|0);
  17760. HEAP8[$962>>0] = $961;
  17761. $963 = (_bitshift64Lshr(($848|0),($849|0),18)|0);
  17762. $964 = tempRet0;
  17763. $965 = (_bitshift64Shl(($856|0),($857|0),3)|0);
  17764. $966 = tempRet0;
  17765. $967 = $965 | $963;
  17766. $966 | $964;
  17767. $968 = $967&255;
  17768. HEAP8[$39>>0] = $968;
  17769. $969 = (_bitshift64Lshr(($856|0),($857|0),5)|0);
  17770. $970 = tempRet0;
  17771. $971 = $969&255;
  17772. $972 = (($s) + 19|0);
  17773. HEAP8[$972>>0] = $971;
  17774. $973 = (_bitshift64Lshr(($856|0),($857|0),13)|0);
  17775. $974 = tempRet0;
  17776. $975 = $973&255;
  17777. $976 = (($s) + 20|0);
  17778. HEAP8[$976>>0] = $975;
  17779. $977 = $864&255;
  17780. HEAP8[$45>>0] = $977;
  17781. $978 = (_bitshift64Lshr(($864|0),($865|0),8)|0);
  17782. $979 = tempRet0;
  17783. $980 = $978&255;
  17784. $981 = (($s) + 22|0);
  17785. HEAP8[$981>>0] = $980;
  17786. $982 = (_bitshift64Lshr(($864|0),($865|0),16)|0);
  17787. $983 = tempRet0;
  17788. $984 = (_bitshift64Shl(($872|0),($873|0),5)|0);
  17789. $985 = tempRet0;
  17790. $986 = $984 | $982;
  17791. $985 | $983;
  17792. $987 = $986&255;
  17793. HEAP8[$49>>0] = $987;
  17794. $988 = (_bitshift64Lshr(($872|0),($873|0),3)|0);
  17795. $989 = tempRet0;
  17796. $990 = $988&255;
  17797. $991 = (($s) + 24|0);
  17798. HEAP8[$991>>0] = $990;
  17799. $992 = (_bitshift64Lshr(($872|0),($873|0),11)|0);
  17800. $993 = tempRet0;
  17801. $994 = $992&255;
  17802. $995 = (($s) + 25|0);
  17803. HEAP8[$995>>0] = $994;
  17804. $996 = (_bitshift64Lshr(($872|0),($873|0),19)|0);
  17805. $997 = tempRet0;
  17806. $998 = (_bitshift64Shl(($880|0),($881|0),2)|0);
  17807. $999 = tempRet0;
  17808. $1000 = $998 | $996;
  17809. $999 | $997;
  17810. $1001 = $1000&255;
  17811. HEAP8[$55>>0] = $1001;
  17812. $1002 = (_bitshift64Lshr(($880|0),($881|0),6)|0);
  17813. $1003 = tempRet0;
  17814. $1004 = $1002&255;
  17815. $1005 = (($s) + 27|0);
  17816. HEAP8[$1005>>0] = $1004;
  17817. $1006 = (_bitshift64Lshr(($880|0),($881|0),14)|0);
  17818. $1007 = tempRet0;
  17819. $1008 = (_bitshift64Shl(($876|0),($877|0),7)|0);
  17820. $1009 = tempRet0;
  17821. $1010 = $1006 | $1008;
  17822. $1007 | $1009;
  17823. $1011 = $1010&255;
  17824. HEAP8[$61>>0] = $1011;
  17825. $1012 = (_bitshift64Lshr(($876|0),($877|0),1)|0);
  17826. $1013 = tempRet0;
  17827. $1014 = $1012&255;
  17828. $1015 = (($s) + 29|0);
  17829. HEAP8[$1015>>0] = $1014;
  17830. $1016 = (_bitshift64Lshr(($876|0),($877|0),9)|0);
  17831. $1017 = tempRet0;
  17832. $1018 = $1016&255;
  17833. $1019 = (($s) + 30|0);
  17834. HEAP8[$1019>>0] = $1018;
  17835. $1020 = (_bitshift64Lshr(($876|0),($877|0),17)|0);
  17836. $1021 = tempRet0;
  17837. $1022 = $1020&255;
  17838. HEAP8[$67>>0] = $1022;
  17839. STACKTOP = sp;return;
  17840. }
  17841. function _load_351($in) {
  17842. $in = $in|0;
  17843. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  17844. sp = STACKTOP;
  17845. $0 = HEAP8[$in>>0]|0;
  17846. $1 = $0&255;
  17847. $2 = (($in) + 1|0);
  17848. $3 = HEAP8[$2>>0]|0;
  17849. $4 = $3&255;
  17850. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  17851. $6 = tempRet0;
  17852. $7 = $5 | $1;
  17853. $8 = (($in) + 2|0);
  17854. $9 = HEAP8[$8>>0]|0;
  17855. $10 = $9&255;
  17856. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  17857. $12 = tempRet0;
  17858. $13 = $7 | $11;
  17859. $14 = $6 | $12;
  17860. tempRet0 = $14;
  17861. STACKTOP = sp;return ($13|0);
  17862. }
  17863. function _load_452($in) {
  17864. $in = $in|0;
  17865. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
  17866. var $8 = 0, $9 = 0, label = 0, sp = 0;
  17867. sp = STACKTOP;
  17868. $0 = HEAP8[$in>>0]|0;
  17869. $1 = $0&255;
  17870. $2 = (($in) + 1|0);
  17871. $3 = HEAP8[$2>>0]|0;
  17872. $4 = $3&255;
  17873. $5 = (_bitshift64Shl(($4|0),0,8)|0);
  17874. $6 = tempRet0;
  17875. $7 = $5 | $1;
  17876. $8 = (($in) + 2|0);
  17877. $9 = HEAP8[$8>>0]|0;
  17878. $10 = $9&255;
  17879. $11 = (_bitshift64Shl(($10|0),0,16)|0);
  17880. $12 = tempRet0;
  17881. $13 = $7 | $11;
  17882. $14 = $6 | $12;
  17883. $15 = (($in) + 3|0);
  17884. $16 = HEAP8[$15>>0]|0;
  17885. $17 = $16&255;
  17886. $18 = (_bitshift64Shl(($17|0),0,24)|0);
  17887. $19 = tempRet0;
  17888. $20 = $13 | $18;
  17889. $21 = $14 | $19;
  17890. tempRet0 = $21;
  17891. STACKTOP = sp;return ($20|0);
  17892. }
  17893. function _sph_sha512_init($cc) {
  17894. $cc = $cc|0;
  17895. var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
  17896. sp = STACKTOP;
  17897. $0 = (($cc) + 128|0);
  17898. dest=$0+0|0; src=31840+0|0; stop=dest+64|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
  17899. $1 = (($cc) + 192|0);
  17900. $2 = $1;
  17901. $3 = $2;
  17902. HEAP32[$3>>2] = 0;
  17903. $4 = (($2) + 4)|0;
  17904. $5 = $4;
  17905. HEAP32[$5>>2] = 0;
  17906. STACKTOP = sp;return;
  17907. }
  17908. function _sph_sha384($cc,$data,$len) {
  17909. $cc = $cc|0;
  17910. $data = $data|0;
  17911. $len = $len|0;
  17912. var $$01$ = 0, $$012 = 0, $$03 = 0, $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0;
  17913. var $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $current$04 = 0, $current$1 = 0, label = 0, sp = 0;
  17914. sp = STACKTOP;
  17915. $0 = (($cc) + 192|0);
  17916. $1 = ($len|0)==(0);
  17917. if ($1) {
  17918. STACKTOP = sp;return;
  17919. }
  17920. $2 = $0;
  17921. $3 = $2;
  17922. $4 = HEAP32[$3>>2]|0;
  17923. $5 = (($2) + 4)|0;
  17924. $6 = $5;
  17925. $7 = HEAP32[$6>>2]|0;
  17926. $8 = $4 & 127;
  17927. $9 = (($cc) + 128|0);
  17928. $$012 = $len;$$03 = $data;$current$04 = $8;
  17929. while(1) {
  17930. $10 = (128 - ($current$04))|0;
  17931. $11 = ($10>>>0)>($$012>>>0);
  17932. $$01$ = $11 ? $$012 : $10;
  17933. $12 = (($cc) + ($current$04)|0);
  17934. _memcpy(($12|0),($$03|0),($$01$|0))|0;
  17935. $13 = (($$03) + ($$01$)|0);
  17936. $14 = (($$01$) + ($current$04))|0;
  17937. $15 = (($$012) - ($$01$))|0;
  17938. $16 = ($14|0)==(128);
  17939. if ($16) {
  17940. _sha3_round($cc,$9);
  17941. $current$1 = 0;
  17942. } else {
  17943. $current$1 = $14;
  17944. }
  17945. $17 = $0;
  17946. $18 = $17;
  17947. $19 = HEAP32[$18>>2]|0;
  17948. $20 = (($17) + 4)|0;
  17949. $21 = $20;
  17950. $22 = HEAP32[$21>>2]|0;
  17951. $23 = (_i64Add(($19|0),($22|0),($$01$|0),0)|0);
  17952. $24 = tempRet0;
  17953. $25 = $0;
  17954. $26 = $25;
  17955. HEAP32[$26>>2] = $23;
  17956. $27 = (($25) + 4)|0;
  17957. $28 = $27;
  17958. HEAP32[$28>>2] = $24;
  17959. $29 = ($$012|0)==($$01$|0);
  17960. if ($29) {
  17961. break;
  17962. } else {
  17963. $$012 = $15;$$03 = $13;$current$04 = $current$1;
  17964. }
  17965. }
  17966. STACKTOP = sp;return;
  17967. }
  17968. function _sph_sha512_close($cc,$dst) {
  17969. $cc = $cc|0;
  17970. $dst = $dst|0;
  17971. var label = 0, sp = 0;
  17972. sp = STACKTOP;
  17973. _sha384_close($cc,$dst,8);
  17974. _sph_sha512_init($cc);
  17975. STACKTOP = sp;return;
  17976. }
  17977. function _sha3_round($data,$r) {
  17978. $data = $data|0;
  17979. $r = $r|0;
  17980. var $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  17981. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  17982. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  17983. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  17984. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  17985. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  17986. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  17987. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  17988. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  17989. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  17990. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  17991. var $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0;
  17992. var $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0;
  17993. var $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0;
  17994. var $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0;
  17995. var $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0;
  17996. var $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0;
  17997. var $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0;
  17998. var $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0;
  17999. var $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0;
  18000. var $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0;
  18001. var $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0;
  18002. var $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0;
  18003. var $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0;
  18004. var $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0;
  18005. var $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0;
  18006. var $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0;
  18007. var $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0;
  18008. var $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0;
  18009. var $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0;
  18010. var $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0;
  18011. var $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0;
  18012. var $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0;
  18013. var $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0;
  18014. var $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0;
  18015. var $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0;
  18016. var $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0;
  18017. var $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0;
  18018. var $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0;
  18019. var $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0, $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0;
  18020. var $819 = 0, $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0, $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0;
  18021. var $837 = 0, $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0, $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0;
  18022. var $855 = 0, $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0, $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0;
  18023. var $873 = 0, $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0, $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0;
  18024. var $891 = 0, $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0, $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0;
  18025. var $909 = 0, $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0, $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0;
  18026. var $927 = 0, $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0, $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0;
  18027. var $945 = 0, $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, $W = 0, $exitcond = 0, $exitcond19 = 0, $i$011 = 0, $i$110 = 0, $i$29 = 0;
  18028. var label = 0, sp = 0;
  18029. sp = STACKTOP;
  18030. STACKTOP = STACKTOP + 640|0;
  18031. $W = sp;
  18032. $i$011 = 0;
  18033. while(1) {
  18034. $0 = $i$011 << 3;
  18035. $1 = (($data) + ($0)|0);
  18036. $2 = (_sph_dec64be_aligned($1)|0);
  18037. $3 = tempRet0;
  18038. $4 = (($W) + ($i$011<<3)|0);
  18039. $5 = $4;
  18040. $6 = $5;
  18041. HEAP32[$6>>2] = $2;
  18042. $7 = (($5) + 4)|0;
  18043. $8 = $7;
  18044. HEAP32[$8>>2] = $3;
  18045. $9 = (($i$011) + 1)|0;
  18046. $exitcond19 = ($9|0)==(16);
  18047. if ($exitcond19) {
  18048. $i$110 = 16;
  18049. break;
  18050. } else {
  18051. $i$011 = $9;
  18052. }
  18053. }
  18054. while(1) {
  18055. $10 = (($i$110) + -2)|0;
  18056. $11 = (($W) + ($10<<3)|0);
  18057. $12 = $11;
  18058. $13 = $12;
  18059. $14 = HEAP32[$13>>2]|0;
  18060. $15 = (($12) + 4)|0;
  18061. $16 = $15;
  18062. $17 = HEAP32[$16>>2]|0;
  18063. $18 = (_bitshift64Shl(($14|0),($17|0),45)|0);
  18064. $19 = tempRet0;
  18065. $20 = (_bitshift64Lshr(($14|0),($17|0),19)|0);
  18066. $21 = tempRet0;
  18067. $22 = $18 | $20;
  18068. $23 = $19 | $21;
  18069. $24 = (_bitshift64Shl(($14|0),($17|0),3)|0);
  18070. $25 = tempRet0;
  18071. $26 = (_bitshift64Lshr(($14|0),($17|0),61)|0);
  18072. $27 = tempRet0;
  18073. $28 = $24 | $26;
  18074. $29 = $25 | $27;
  18075. $30 = (_bitshift64Lshr(($14|0),($17|0),6)|0);
  18076. $31 = tempRet0;
  18077. $32 = $28 ^ $30;
  18078. $33 = $29 ^ $31;
  18079. $34 = $32 ^ $22;
  18080. $35 = $33 ^ $23;
  18081. $36 = (($i$110) + -7)|0;
  18082. $37 = (($W) + ($36<<3)|0);
  18083. $38 = $37;
  18084. $39 = $38;
  18085. $40 = HEAP32[$39>>2]|0;
  18086. $41 = (($38) + 4)|0;
  18087. $42 = $41;
  18088. $43 = HEAP32[$42>>2]|0;
  18089. $44 = (($i$110) + -15)|0;
  18090. $45 = (($W) + ($44<<3)|0);
  18091. $46 = $45;
  18092. $47 = $46;
  18093. $48 = HEAP32[$47>>2]|0;
  18094. $49 = (($46) + 4)|0;
  18095. $50 = $49;
  18096. $51 = HEAP32[$50>>2]|0;
  18097. $52 = (_bitshift64Shl(($48|0),($51|0),63)|0);
  18098. $53 = tempRet0;
  18099. $54 = (_bitshift64Lshr(($48|0),($51|0),1)|0);
  18100. $55 = tempRet0;
  18101. $56 = $52 | $54;
  18102. $57 = $53 | $55;
  18103. $58 = (_bitshift64Shl(($48|0),($51|0),56)|0);
  18104. $59 = tempRet0;
  18105. $60 = (_bitshift64Lshr(($48|0),($51|0),8)|0);
  18106. $61 = tempRet0;
  18107. $62 = $58 | $60;
  18108. $63 = $59 | $61;
  18109. $64 = (_bitshift64Lshr(($48|0),($51|0),7)|0);
  18110. $65 = tempRet0;
  18111. $66 = $62 ^ $64;
  18112. $67 = $63 ^ $65;
  18113. $68 = $66 ^ $56;
  18114. $69 = $67 ^ $57;
  18115. $70 = (($i$110) + -16)|0;
  18116. $71 = (($W) + ($70<<3)|0);
  18117. $72 = $71;
  18118. $73 = $72;
  18119. $74 = HEAP32[$73>>2]|0;
  18120. $75 = (($72) + 4)|0;
  18121. $76 = $75;
  18122. $77 = HEAP32[$76>>2]|0;
  18123. $78 = (_i64Add(($74|0),($77|0),($40|0),($43|0))|0);
  18124. $79 = tempRet0;
  18125. $80 = (_i64Add(($78|0),($79|0),($34|0),($35|0))|0);
  18126. $81 = tempRet0;
  18127. $82 = (_i64Add(($80|0),($81|0),($68|0),($69|0))|0);
  18128. $83 = tempRet0;
  18129. $84 = (($W) + ($i$110<<3)|0);
  18130. $85 = $84;
  18131. $86 = $85;
  18132. HEAP32[$86>>2] = $82;
  18133. $87 = (($85) + 4)|0;
  18134. $88 = $87;
  18135. HEAP32[$88>>2] = $83;
  18136. $89 = (($i$110) + 1)|0;
  18137. $exitcond = ($89|0)==(80);
  18138. if ($exitcond) {
  18139. break;
  18140. } else {
  18141. $i$110 = $89;
  18142. }
  18143. }
  18144. $90 = $r;
  18145. $91 = $90;
  18146. $92 = HEAP32[$91>>2]|0;
  18147. $93 = (($90) + 4)|0;
  18148. $94 = $93;
  18149. $95 = HEAP32[$94>>2]|0;
  18150. $96 = (($r) + 8|0);
  18151. $97 = $96;
  18152. $98 = $97;
  18153. $99 = HEAP32[$98>>2]|0;
  18154. $100 = (($97) + 4)|0;
  18155. $101 = $100;
  18156. $102 = HEAP32[$101>>2]|0;
  18157. $103 = (($r) + 16|0);
  18158. $104 = $103;
  18159. $105 = $104;
  18160. $106 = HEAP32[$105>>2]|0;
  18161. $107 = (($104) + 4)|0;
  18162. $108 = $107;
  18163. $109 = HEAP32[$108>>2]|0;
  18164. $110 = (($r) + 24|0);
  18165. $111 = $110;
  18166. $112 = $111;
  18167. $113 = HEAP32[$112>>2]|0;
  18168. $114 = (($111) + 4)|0;
  18169. $115 = $114;
  18170. $116 = HEAP32[$115>>2]|0;
  18171. $117 = (($r) + 32|0);
  18172. $118 = $117;
  18173. $119 = $118;
  18174. $120 = HEAP32[$119>>2]|0;
  18175. $121 = (($118) + 4)|0;
  18176. $122 = $121;
  18177. $123 = HEAP32[$122>>2]|0;
  18178. $124 = (($r) + 40|0);
  18179. $125 = $124;
  18180. $126 = $125;
  18181. $127 = HEAP32[$126>>2]|0;
  18182. $128 = (($125) + 4)|0;
  18183. $129 = $128;
  18184. $130 = HEAP32[$129>>2]|0;
  18185. $131 = (($r) + 48|0);
  18186. $132 = $131;
  18187. $133 = $132;
  18188. $134 = HEAP32[$133>>2]|0;
  18189. $135 = (($132) + 4)|0;
  18190. $136 = $135;
  18191. $137 = HEAP32[$136>>2]|0;
  18192. $138 = (($r) + 56|0);
  18193. $139 = $138;
  18194. $140 = $139;
  18195. $141 = HEAP32[$140>>2]|0;
  18196. $142 = (($139) + 4)|0;
  18197. $143 = $142;
  18198. $144 = HEAP32[$143>>2]|0;
  18199. $145 = $120;$146 = $123;$170 = $134;$171 = $127;$173 = $137;$174 = $130;$193 = $141;$194 = $144;$203 = $92;$204 = $95;$228 = $99;$230 = $102;$234 = $106;$236 = $109;$241 = $113;$242 = $116;$i$29 = 0;
  18200. while(1) {
  18201. $147 = (_bitshift64Shl(($145|0),($146|0),50)|0);
  18202. $148 = tempRet0;
  18203. $149 = (_bitshift64Lshr(($145|0),($146|0),14)|0);
  18204. $150 = tempRet0;
  18205. $151 = $147 | $149;
  18206. $152 = $148 | $150;
  18207. $153 = (_bitshift64Shl(($145|0),($146|0),46)|0);
  18208. $154 = tempRet0;
  18209. $155 = (_bitshift64Lshr(($145|0),($146|0),18)|0);
  18210. $156 = tempRet0;
  18211. $157 = $153 | $155;
  18212. $158 = $154 | $156;
  18213. $159 = $151 ^ $157;
  18214. $160 = $152 ^ $158;
  18215. $161 = (_bitshift64Shl(($145|0),($146|0),23)|0);
  18216. $162 = tempRet0;
  18217. $163 = (_bitshift64Lshr(($145|0),($146|0),41)|0);
  18218. $164 = tempRet0;
  18219. $165 = $161 | $163;
  18220. $166 = $162 | $164;
  18221. $167 = $159 ^ $165;
  18222. $168 = $160 ^ $166;
  18223. $169 = $171 ^ $170;
  18224. $172 = $174 ^ $173;
  18225. $175 = $169 & $145;
  18226. $176 = $172 & $146;
  18227. $177 = $175 ^ $170;
  18228. $178 = $176 ^ $173;
  18229. $179 = (31904 + ($i$29<<3)|0);
  18230. $180 = $179;
  18231. $181 = $180;
  18232. $182 = HEAP32[$181>>2]|0;
  18233. $183 = (($180) + 4)|0;
  18234. $184 = $183;
  18235. $185 = HEAP32[$184>>2]|0;
  18236. $186 = (($W) + ($i$29<<3)|0);
  18237. $187 = $186;
  18238. $188 = $187;
  18239. $189 = HEAP32[$188>>2]|0;
  18240. $190 = (($187) + 4)|0;
  18241. $191 = $190;
  18242. $192 = HEAP32[$191>>2]|0;
  18243. $195 = (_i64Add(($177|0),($178|0),($193|0),($194|0))|0);
  18244. $196 = tempRet0;
  18245. $197 = (_i64Add(($195|0),($196|0),($167|0),($168|0))|0);
  18246. $198 = tempRet0;
  18247. $199 = (_i64Add(($197|0),($198|0),($182|0),($185|0))|0);
  18248. $200 = tempRet0;
  18249. $201 = (_i64Add(($199|0),($200|0),($189|0),($192|0))|0);
  18250. $202 = tempRet0;
  18251. $205 = (_bitshift64Shl(($203|0),($204|0),36)|0);
  18252. $206 = tempRet0;
  18253. $207 = (_bitshift64Lshr(($203|0),($204|0),28)|0);
  18254. $208 = tempRet0;
  18255. $209 = $205 | $207;
  18256. $210 = $206 | $208;
  18257. $211 = (_bitshift64Shl(($203|0),($204|0),30)|0);
  18258. $212 = tempRet0;
  18259. $213 = (_bitshift64Lshr(($203|0),($204|0),34)|0);
  18260. $214 = tempRet0;
  18261. $215 = $211 | $213;
  18262. $216 = $212 | $214;
  18263. $217 = $209 ^ $215;
  18264. $218 = $210 ^ $216;
  18265. $219 = (_bitshift64Shl(($203|0),($204|0),25)|0);
  18266. $220 = tempRet0;
  18267. $221 = (_bitshift64Lshr(($203|0),($204|0),39)|0);
  18268. $222 = tempRet0;
  18269. $223 = $219 | $221;
  18270. $224 = $220 | $222;
  18271. $225 = $217 ^ $223;
  18272. $226 = $218 ^ $224;
  18273. $227 = $203 & $228;
  18274. $229 = $204 & $230;
  18275. $231 = $203 | $228;
  18276. $232 = $204 | $230;
  18277. $233 = $231 & $234;
  18278. $235 = $232 & $236;
  18279. $237 = $233 | $227;
  18280. $238 = $235 | $229;
  18281. $239 = (_i64Add(($225|0),($226|0),($237|0),($238|0))|0);
  18282. $240 = tempRet0;
  18283. $243 = (_i64Add(($201|0),($202|0),($241|0),($242|0))|0);
  18284. $244 = tempRet0;
  18285. $245 = (_i64Add(($239|0),($240|0),($201|0),($202|0))|0);
  18286. $246 = tempRet0;
  18287. $247 = (_bitshift64Shl(($243|0),($244|0),50)|0);
  18288. $248 = tempRet0;
  18289. $249 = (_bitshift64Lshr(($243|0),($244|0),14)|0);
  18290. $250 = tempRet0;
  18291. $251 = $247 | $249;
  18292. $252 = $248 | $250;
  18293. $253 = (_bitshift64Shl(($243|0),($244|0),46)|0);
  18294. $254 = tempRet0;
  18295. $255 = (_bitshift64Lshr(($243|0),($244|0),18)|0);
  18296. $256 = tempRet0;
  18297. $257 = $253 | $255;
  18298. $258 = $254 | $256;
  18299. $259 = $251 ^ $257;
  18300. $260 = $252 ^ $258;
  18301. $261 = (_bitshift64Shl(($243|0),($244|0),23)|0);
  18302. $262 = tempRet0;
  18303. $263 = (_bitshift64Lshr(($243|0),($244|0),41)|0);
  18304. $264 = tempRet0;
  18305. $265 = $261 | $263;
  18306. $266 = $262 | $264;
  18307. $267 = $259 ^ $265;
  18308. $268 = $260 ^ $266;
  18309. $269 = $145 ^ $171;
  18310. $270 = $146 ^ $174;
  18311. $271 = $243 & $269;
  18312. $272 = $244 & $270;
  18313. $273 = $271 ^ $171;
  18314. $274 = $272 ^ $174;
  18315. $275 = $i$29 | 1;
  18316. $276 = (31904 + ($275<<3)|0);
  18317. $277 = $276;
  18318. $278 = $277;
  18319. $279 = HEAP32[$278>>2]|0;
  18320. $280 = (($277) + 4)|0;
  18321. $281 = $280;
  18322. $282 = HEAP32[$281>>2]|0;
  18323. $283 = (($W) + ($275<<3)|0);
  18324. $284 = $283;
  18325. $285 = $284;
  18326. $286 = HEAP32[$285>>2]|0;
  18327. $287 = (($284) + 4)|0;
  18328. $288 = $287;
  18329. $289 = HEAP32[$288>>2]|0;
  18330. $290 = (_i64Add(($279|0),($282|0),($170|0),($173|0))|0);
  18331. $291 = tempRet0;
  18332. $292 = (_i64Add(($290|0),($291|0),($286|0),($289|0))|0);
  18333. $293 = tempRet0;
  18334. $294 = (_i64Add(($292|0),($293|0),($273|0),($274|0))|0);
  18335. $295 = tempRet0;
  18336. $296 = (_i64Add(($294|0),($295|0),($267|0),($268|0))|0);
  18337. $297 = tempRet0;
  18338. $298 = (_bitshift64Shl(($245|0),($246|0),36)|0);
  18339. $299 = tempRet0;
  18340. $300 = (_bitshift64Lshr(($245|0),($246|0),28)|0);
  18341. $301 = tempRet0;
  18342. $302 = $298 | $300;
  18343. $303 = $299 | $301;
  18344. $304 = (_bitshift64Shl(($245|0),($246|0),30)|0);
  18345. $305 = tempRet0;
  18346. $306 = (_bitshift64Lshr(($245|0),($246|0),34)|0);
  18347. $307 = tempRet0;
  18348. $308 = $304 | $306;
  18349. $309 = $305 | $307;
  18350. $310 = $302 ^ $308;
  18351. $311 = $303 ^ $309;
  18352. $312 = (_bitshift64Shl(($245|0),($246|0),25)|0);
  18353. $313 = tempRet0;
  18354. $314 = (_bitshift64Lshr(($245|0),($246|0),39)|0);
  18355. $315 = tempRet0;
  18356. $316 = $312 | $314;
  18357. $317 = $313 | $315;
  18358. $318 = $310 ^ $316;
  18359. $319 = $311 ^ $317;
  18360. $320 = $245 & $203;
  18361. $321 = $246 & $204;
  18362. $322 = $245 | $203;
  18363. $323 = $246 | $204;
  18364. $324 = $322 & $228;
  18365. $325 = $323 & $230;
  18366. $326 = $324 | $320;
  18367. $327 = $325 | $321;
  18368. $328 = (_i64Add(($318|0),($319|0),($326|0),($327|0))|0);
  18369. $329 = tempRet0;
  18370. $330 = (_i64Add(($296|0),($297|0),($234|0),($236|0))|0);
  18371. $331 = tempRet0;
  18372. $332 = (_i64Add(($328|0),($329|0),($296|0),($297|0))|0);
  18373. $333 = tempRet0;
  18374. $334 = (_bitshift64Shl(($330|0),($331|0),50)|0);
  18375. $335 = tempRet0;
  18376. $336 = (_bitshift64Lshr(($330|0),($331|0),14)|0);
  18377. $337 = tempRet0;
  18378. $338 = $334 | $336;
  18379. $339 = $335 | $337;
  18380. $340 = (_bitshift64Shl(($330|0),($331|0),46)|0);
  18381. $341 = tempRet0;
  18382. $342 = (_bitshift64Lshr(($330|0),($331|0),18)|0);
  18383. $343 = tempRet0;
  18384. $344 = $340 | $342;
  18385. $345 = $341 | $343;
  18386. $346 = $338 ^ $344;
  18387. $347 = $339 ^ $345;
  18388. $348 = (_bitshift64Shl(($330|0),($331|0),23)|0);
  18389. $349 = tempRet0;
  18390. $350 = (_bitshift64Lshr(($330|0),($331|0),41)|0);
  18391. $351 = tempRet0;
  18392. $352 = $348 | $350;
  18393. $353 = $349 | $351;
  18394. $354 = $346 ^ $352;
  18395. $355 = $347 ^ $353;
  18396. $356 = $243 ^ $145;
  18397. $357 = $244 ^ $146;
  18398. $358 = $330 & $356;
  18399. $359 = $331 & $357;
  18400. $360 = $358 ^ $145;
  18401. $361 = $359 ^ $146;
  18402. $362 = $i$29 | 2;
  18403. $363 = (31904 + ($362<<3)|0);
  18404. $364 = $363;
  18405. $365 = $364;
  18406. $366 = HEAP32[$365>>2]|0;
  18407. $367 = (($364) + 4)|0;
  18408. $368 = $367;
  18409. $369 = HEAP32[$368>>2]|0;
  18410. $370 = (($W) + ($362<<3)|0);
  18411. $371 = $370;
  18412. $372 = $371;
  18413. $373 = HEAP32[$372>>2]|0;
  18414. $374 = (($371) + 4)|0;
  18415. $375 = $374;
  18416. $376 = HEAP32[$375>>2]|0;
  18417. $377 = (_i64Add(($366|0),($369|0),($171|0),($174|0))|0);
  18418. $378 = tempRet0;
  18419. $379 = (_i64Add(($377|0),($378|0),($373|0),($376|0))|0);
  18420. $380 = tempRet0;
  18421. $381 = (_i64Add(($379|0),($380|0),($360|0),($361|0))|0);
  18422. $382 = tempRet0;
  18423. $383 = (_i64Add(($381|0),($382|0),($354|0),($355|0))|0);
  18424. $384 = tempRet0;
  18425. $385 = (_bitshift64Shl(($332|0),($333|0),36)|0);
  18426. $386 = tempRet0;
  18427. $387 = (_bitshift64Lshr(($332|0),($333|0),28)|0);
  18428. $388 = tempRet0;
  18429. $389 = $385 | $387;
  18430. $390 = $386 | $388;
  18431. $391 = (_bitshift64Shl(($332|0),($333|0),30)|0);
  18432. $392 = tempRet0;
  18433. $393 = (_bitshift64Lshr(($332|0),($333|0),34)|0);
  18434. $394 = tempRet0;
  18435. $395 = $391 | $393;
  18436. $396 = $392 | $394;
  18437. $397 = $389 ^ $395;
  18438. $398 = $390 ^ $396;
  18439. $399 = (_bitshift64Shl(($332|0),($333|0),25)|0);
  18440. $400 = tempRet0;
  18441. $401 = (_bitshift64Lshr(($332|0),($333|0),39)|0);
  18442. $402 = tempRet0;
  18443. $403 = $399 | $401;
  18444. $404 = $400 | $402;
  18445. $405 = $397 ^ $403;
  18446. $406 = $398 ^ $404;
  18447. $407 = $332 & $245;
  18448. $408 = $333 & $246;
  18449. $409 = $332 | $245;
  18450. $410 = $333 | $246;
  18451. $411 = $409 & $203;
  18452. $412 = $410 & $204;
  18453. $413 = $411 | $407;
  18454. $414 = $412 | $408;
  18455. $415 = (_i64Add(($405|0),($406|0),($413|0),($414|0))|0);
  18456. $416 = tempRet0;
  18457. $417 = (_i64Add(($383|0),($384|0),($228|0),($230|0))|0);
  18458. $418 = tempRet0;
  18459. $419 = (_i64Add(($415|0),($416|0),($383|0),($384|0))|0);
  18460. $420 = tempRet0;
  18461. $421 = (_bitshift64Shl(($417|0),($418|0),50)|0);
  18462. $422 = tempRet0;
  18463. $423 = (_bitshift64Lshr(($417|0),($418|0),14)|0);
  18464. $424 = tempRet0;
  18465. $425 = $421 | $423;
  18466. $426 = $422 | $424;
  18467. $427 = (_bitshift64Shl(($417|0),($418|0),46)|0);
  18468. $428 = tempRet0;
  18469. $429 = (_bitshift64Lshr(($417|0),($418|0),18)|0);
  18470. $430 = tempRet0;
  18471. $431 = $427 | $429;
  18472. $432 = $428 | $430;
  18473. $433 = $425 ^ $431;
  18474. $434 = $426 ^ $432;
  18475. $435 = (_bitshift64Shl(($417|0),($418|0),23)|0);
  18476. $436 = tempRet0;
  18477. $437 = (_bitshift64Lshr(($417|0),($418|0),41)|0);
  18478. $438 = tempRet0;
  18479. $439 = $435 | $437;
  18480. $440 = $436 | $438;
  18481. $441 = $433 ^ $439;
  18482. $442 = $434 ^ $440;
  18483. $443 = $330 ^ $243;
  18484. $444 = $331 ^ $244;
  18485. $445 = $417 & $443;
  18486. $446 = $418 & $444;
  18487. $447 = $445 ^ $243;
  18488. $448 = $446 ^ $244;
  18489. $449 = $i$29 | 3;
  18490. $450 = (31904 + ($449<<3)|0);
  18491. $451 = $450;
  18492. $452 = $451;
  18493. $453 = HEAP32[$452>>2]|0;
  18494. $454 = (($451) + 4)|0;
  18495. $455 = $454;
  18496. $456 = HEAP32[$455>>2]|0;
  18497. $457 = (($W) + ($449<<3)|0);
  18498. $458 = $457;
  18499. $459 = $458;
  18500. $460 = HEAP32[$459>>2]|0;
  18501. $461 = (($458) + 4)|0;
  18502. $462 = $461;
  18503. $463 = HEAP32[$462>>2]|0;
  18504. $464 = (_i64Add(($453|0),($456|0),($145|0),($146|0))|0);
  18505. $465 = tempRet0;
  18506. $466 = (_i64Add(($464|0),($465|0),($460|0),($463|0))|0);
  18507. $467 = tempRet0;
  18508. $468 = (_i64Add(($466|0),($467|0),($447|0),($448|0))|0);
  18509. $469 = tempRet0;
  18510. $470 = (_i64Add(($468|0),($469|0),($441|0),($442|0))|0);
  18511. $471 = tempRet0;
  18512. $472 = (_bitshift64Shl(($419|0),($420|0),36)|0);
  18513. $473 = tempRet0;
  18514. $474 = (_bitshift64Lshr(($419|0),($420|0),28)|0);
  18515. $475 = tempRet0;
  18516. $476 = $472 | $474;
  18517. $477 = $473 | $475;
  18518. $478 = (_bitshift64Shl(($419|0),($420|0),30)|0);
  18519. $479 = tempRet0;
  18520. $480 = (_bitshift64Lshr(($419|0),($420|0),34)|0);
  18521. $481 = tempRet0;
  18522. $482 = $478 | $480;
  18523. $483 = $479 | $481;
  18524. $484 = $476 ^ $482;
  18525. $485 = $477 ^ $483;
  18526. $486 = (_bitshift64Shl(($419|0),($420|0),25)|0);
  18527. $487 = tempRet0;
  18528. $488 = (_bitshift64Lshr(($419|0),($420|0),39)|0);
  18529. $489 = tempRet0;
  18530. $490 = $486 | $488;
  18531. $491 = $487 | $489;
  18532. $492 = $484 ^ $490;
  18533. $493 = $485 ^ $491;
  18534. $494 = $419 & $332;
  18535. $495 = $420 & $333;
  18536. $496 = $419 | $332;
  18537. $497 = $420 | $333;
  18538. $498 = $496 & $245;
  18539. $499 = $497 & $246;
  18540. $500 = $498 | $494;
  18541. $501 = $499 | $495;
  18542. $502 = (_i64Add(($492|0),($493|0),($500|0),($501|0))|0);
  18543. $503 = tempRet0;
  18544. $504 = (_i64Add(($470|0),($471|0),($203|0),($204|0))|0);
  18545. $505 = tempRet0;
  18546. $506 = (_i64Add(($502|0),($503|0),($470|0),($471|0))|0);
  18547. $507 = tempRet0;
  18548. $508 = (_bitshift64Shl(($504|0),($505|0),50)|0);
  18549. $509 = tempRet0;
  18550. $510 = (_bitshift64Lshr(($504|0),($505|0),14)|0);
  18551. $511 = tempRet0;
  18552. $512 = $508 | $510;
  18553. $513 = $509 | $511;
  18554. $514 = (_bitshift64Shl(($504|0),($505|0),46)|0);
  18555. $515 = tempRet0;
  18556. $516 = (_bitshift64Lshr(($504|0),($505|0),18)|0);
  18557. $517 = tempRet0;
  18558. $518 = $514 | $516;
  18559. $519 = $515 | $517;
  18560. $520 = $512 ^ $518;
  18561. $521 = $513 ^ $519;
  18562. $522 = (_bitshift64Shl(($504|0),($505|0),23)|0);
  18563. $523 = tempRet0;
  18564. $524 = (_bitshift64Lshr(($504|0),($505|0),41)|0);
  18565. $525 = tempRet0;
  18566. $526 = $522 | $524;
  18567. $527 = $523 | $525;
  18568. $528 = $520 ^ $526;
  18569. $529 = $521 ^ $527;
  18570. $530 = $417 ^ $330;
  18571. $531 = $418 ^ $331;
  18572. $532 = $504 & $530;
  18573. $533 = $505 & $531;
  18574. $534 = $532 ^ $330;
  18575. $535 = $533 ^ $331;
  18576. $536 = $i$29 | 4;
  18577. $537 = (31904 + ($536<<3)|0);
  18578. $538 = $537;
  18579. $539 = $538;
  18580. $540 = HEAP32[$539>>2]|0;
  18581. $541 = (($538) + 4)|0;
  18582. $542 = $541;
  18583. $543 = HEAP32[$542>>2]|0;
  18584. $544 = (($W) + ($536<<3)|0);
  18585. $545 = $544;
  18586. $546 = $545;
  18587. $547 = HEAP32[$546>>2]|0;
  18588. $548 = (($545) + 4)|0;
  18589. $549 = $548;
  18590. $550 = HEAP32[$549>>2]|0;
  18591. $551 = (_i64Add(($540|0),($543|0),($243|0),($244|0))|0);
  18592. $552 = tempRet0;
  18593. $553 = (_i64Add(($551|0),($552|0),($547|0),($550|0))|0);
  18594. $554 = tempRet0;
  18595. $555 = (_i64Add(($553|0),($554|0),($534|0),($535|0))|0);
  18596. $556 = tempRet0;
  18597. $557 = (_i64Add(($555|0),($556|0),($528|0),($529|0))|0);
  18598. $558 = tempRet0;
  18599. $559 = (_bitshift64Shl(($506|0),($507|0),36)|0);
  18600. $560 = tempRet0;
  18601. $561 = (_bitshift64Lshr(($506|0),($507|0),28)|0);
  18602. $562 = tempRet0;
  18603. $563 = $559 | $561;
  18604. $564 = $560 | $562;
  18605. $565 = (_bitshift64Shl(($506|0),($507|0),30)|0);
  18606. $566 = tempRet0;
  18607. $567 = (_bitshift64Lshr(($506|0),($507|0),34)|0);
  18608. $568 = tempRet0;
  18609. $569 = $565 | $567;
  18610. $570 = $566 | $568;
  18611. $571 = $563 ^ $569;
  18612. $572 = $564 ^ $570;
  18613. $573 = (_bitshift64Shl(($506|0),($507|0),25)|0);
  18614. $574 = tempRet0;
  18615. $575 = (_bitshift64Lshr(($506|0),($507|0),39)|0);
  18616. $576 = tempRet0;
  18617. $577 = $573 | $575;
  18618. $578 = $574 | $576;
  18619. $579 = $571 ^ $577;
  18620. $580 = $572 ^ $578;
  18621. $581 = $506 & $419;
  18622. $582 = $507 & $420;
  18623. $583 = $506 | $419;
  18624. $584 = $507 | $420;
  18625. $585 = $583 & $332;
  18626. $586 = $584 & $333;
  18627. $587 = $585 | $581;
  18628. $588 = $586 | $582;
  18629. $589 = (_i64Add(($579|0),($580|0),($587|0),($588|0))|0);
  18630. $590 = tempRet0;
  18631. $591 = (_i64Add(($557|0),($558|0),($245|0),($246|0))|0);
  18632. $592 = tempRet0;
  18633. $593 = (_i64Add(($589|0),($590|0),($557|0),($558|0))|0);
  18634. $594 = tempRet0;
  18635. $595 = (_bitshift64Shl(($591|0),($592|0),50)|0);
  18636. $596 = tempRet0;
  18637. $597 = (_bitshift64Lshr(($591|0),($592|0),14)|0);
  18638. $598 = tempRet0;
  18639. $599 = $595 | $597;
  18640. $600 = $596 | $598;
  18641. $601 = (_bitshift64Shl(($591|0),($592|0),46)|0);
  18642. $602 = tempRet0;
  18643. $603 = (_bitshift64Lshr(($591|0),($592|0),18)|0);
  18644. $604 = tempRet0;
  18645. $605 = $601 | $603;
  18646. $606 = $602 | $604;
  18647. $607 = $599 ^ $605;
  18648. $608 = $600 ^ $606;
  18649. $609 = (_bitshift64Shl(($591|0),($592|0),23)|0);
  18650. $610 = tempRet0;
  18651. $611 = (_bitshift64Lshr(($591|0),($592|0),41)|0);
  18652. $612 = tempRet0;
  18653. $613 = $609 | $611;
  18654. $614 = $610 | $612;
  18655. $615 = $607 ^ $613;
  18656. $616 = $608 ^ $614;
  18657. $617 = $504 ^ $417;
  18658. $618 = $505 ^ $418;
  18659. $619 = $591 & $617;
  18660. $620 = $592 & $618;
  18661. $621 = $619 ^ $417;
  18662. $622 = $620 ^ $418;
  18663. $623 = $i$29 | 5;
  18664. $624 = (31904 + ($623<<3)|0);
  18665. $625 = $624;
  18666. $626 = $625;
  18667. $627 = HEAP32[$626>>2]|0;
  18668. $628 = (($625) + 4)|0;
  18669. $629 = $628;
  18670. $630 = HEAP32[$629>>2]|0;
  18671. $631 = (($W) + ($623<<3)|0);
  18672. $632 = $631;
  18673. $633 = $632;
  18674. $634 = HEAP32[$633>>2]|0;
  18675. $635 = (($632) + 4)|0;
  18676. $636 = $635;
  18677. $637 = HEAP32[$636>>2]|0;
  18678. $638 = (_i64Add(($627|0),($630|0),($330|0),($331|0))|0);
  18679. $639 = tempRet0;
  18680. $640 = (_i64Add(($638|0),($639|0),($634|0),($637|0))|0);
  18681. $641 = tempRet0;
  18682. $642 = (_i64Add(($640|0),($641|0),($621|0),($622|0))|0);
  18683. $643 = tempRet0;
  18684. $644 = (_i64Add(($642|0),($643|0),($615|0),($616|0))|0);
  18685. $645 = tempRet0;
  18686. $646 = (_bitshift64Shl(($593|0),($594|0),36)|0);
  18687. $647 = tempRet0;
  18688. $648 = (_bitshift64Lshr(($593|0),($594|0),28)|0);
  18689. $649 = tempRet0;
  18690. $650 = $646 | $648;
  18691. $651 = $647 | $649;
  18692. $652 = (_bitshift64Shl(($593|0),($594|0),30)|0);
  18693. $653 = tempRet0;
  18694. $654 = (_bitshift64Lshr(($593|0),($594|0),34)|0);
  18695. $655 = tempRet0;
  18696. $656 = $652 | $654;
  18697. $657 = $653 | $655;
  18698. $658 = $650 ^ $656;
  18699. $659 = $651 ^ $657;
  18700. $660 = (_bitshift64Shl(($593|0),($594|0),25)|0);
  18701. $661 = tempRet0;
  18702. $662 = (_bitshift64Lshr(($593|0),($594|0),39)|0);
  18703. $663 = tempRet0;
  18704. $664 = $660 | $662;
  18705. $665 = $661 | $663;
  18706. $666 = $658 ^ $664;
  18707. $667 = $659 ^ $665;
  18708. $668 = $593 & $506;
  18709. $669 = $594 & $507;
  18710. $670 = $593 | $506;
  18711. $671 = $594 | $507;
  18712. $672 = $670 & $419;
  18713. $673 = $671 & $420;
  18714. $674 = $672 | $668;
  18715. $675 = $673 | $669;
  18716. $676 = (_i64Add(($666|0),($667|0),($674|0),($675|0))|0);
  18717. $677 = tempRet0;
  18718. $678 = (_i64Add(($644|0),($645|0),($332|0),($333|0))|0);
  18719. $679 = tempRet0;
  18720. $680 = (_i64Add(($676|0),($677|0),($644|0),($645|0))|0);
  18721. $681 = tempRet0;
  18722. $682 = (_bitshift64Shl(($678|0),($679|0),50)|0);
  18723. $683 = tempRet0;
  18724. $684 = (_bitshift64Lshr(($678|0),($679|0),14)|0);
  18725. $685 = tempRet0;
  18726. $686 = $682 | $684;
  18727. $687 = $683 | $685;
  18728. $688 = (_bitshift64Shl(($678|0),($679|0),46)|0);
  18729. $689 = tempRet0;
  18730. $690 = (_bitshift64Lshr(($678|0),($679|0),18)|0);
  18731. $691 = tempRet0;
  18732. $692 = $688 | $690;
  18733. $693 = $689 | $691;
  18734. $694 = $686 ^ $692;
  18735. $695 = $687 ^ $693;
  18736. $696 = (_bitshift64Shl(($678|0),($679|0),23)|0);
  18737. $697 = tempRet0;
  18738. $698 = (_bitshift64Lshr(($678|0),($679|0),41)|0);
  18739. $699 = tempRet0;
  18740. $700 = $696 | $698;
  18741. $701 = $697 | $699;
  18742. $702 = $694 ^ $700;
  18743. $703 = $695 ^ $701;
  18744. $704 = $591 ^ $504;
  18745. $705 = $592 ^ $505;
  18746. $706 = $678 & $704;
  18747. $707 = $679 & $705;
  18748. $708 = $706 ^ $504;
  18749. $709 = $707 ^ $505;
  18750. $710 = $i$29 | 6;
  18751. $711 = (31904 + ($710<<3)|0);
  18752. $712 = $711;
  18753. $713 = $712;
  18754. $714 = HEAP32[$713>>2]|0;
  18755. $715 = (($712) + 4)|0;
  18756. $716 = $715;
  18757. $717 = HEAP32[$716>>2]|0;
  18758. $718 = (($W) + ($710<<3)|0);
  18759. $719 = $718;
  18760. $720 = $719;
  18761. $721 = HEAP32[$720>>2]|0;
  18762. $722 = (($719) + 4)|0;
  18763. $723 = $722;
  18764. $724 = HEAP32[$723>>2]|0;
  18765. $725 = (_i64Add(($721|0),($724|0),($714|0),($717|0))|0);
  18766. $726 = tempRet0;
  18767. $727 = (_i64Add(($725|0),($726|0),($417|0),($418|0))|0);
  18768. $728 = tempRet0;
  18769. $729 = (_i64Add(($727|0),($728|0),($708|0),($709|0))|0);
  18770. $730 = tempRet0;
  18771. $731 = (_i64Add(($729|0),($730|0),($702|0),($703|0))|0);
  18772. $732 = tempRet0;
  18773. $733 = (_bitshift64Shl(($680|0),($681|0),36)|0);
  18774. $734 = tempRet0;
  18775. $735 = (_bitshift64Lshr(($680|0),($681|0),28)|0);
  18776. $736 = tempRet0;
  18777. $737 = $733 | $735;
  18778. $738 = $734 | $736;
  18779. $739 = (_bitshift64Shl(($680|0),($681|0),30)|0);
  18780. $740 = tempRet0;
  18781. $741 = (_bitshift64Lshr(($680|0),($681|0),34)|0);
  18782. $742 = tempRet0;
  18783. $743 = $739 | $741;
  18784. $744 = $740 | $742;
  18785. $745 = $737 ^ $743;
  18786. $746 = $738 ^ $744;
  18787. $747 = (_bitshift64Shl(($680|0),($681|0),25)|0);
  18788. $748 = tempRet0;
  18789. $749 = (_bitshift64Lshr(($680|0),($681|0),39)|0);
  18790. $750 = tempRet0;
  18791. $751 = $747 | $749;
  18792. $752 = $748 | $750;
  18793. $753 = $745 ^ $751;
  18794. $754 = $746 ^ $752;
  18795. $755 = $680 & $593;
  18796. $756 = $681 & $594;
  18797. $757 = $680 | $593;
  18798. $758 = $681 | $594;
  18799. $759 = $757 & $506;
  18800. $760 = $758 & $507;
  18801. $761 = $759 | $755;
  18802. $762 = $760 | $756;
  18803. $763 = (_i64Add(($753|0),($754|0),($761|0),($762|0))|0);
  18804. $764 = tempRet0;
  18805. $765 = (_i64Add(($731|0),($732|0),($419|0),($420|0))|0);
  18806. $766 = tempRet0;
  18807. $767 = (_i64Add(($763|0),($764|0),($731|0),($732|0))|0);
  18808. $768 = tempRet0;
  18809. $769 = (_bitshift64Shl(($765|0),($766|0),50)|0);
  18810. $770 = tempRet0;
  18811. $771 = (_bitshift64Lshr(($765|0),($766|0),14)|0);
  18812. $772 = tempRet0;
  18813. $773 = $769 | $771;
  18814. $774 = $770 | $772;
  18815. $775 = (_bitshift64Shl(($765|0),($766|0),46)|0);
  18816. $776 = tempRet0;
  18817. $777 = (_bitshift64Lshr(($765|0),($766|0),18)|0);
  18818. $778 = tempRet0;
  18819. $779 = $775 | $777;
  18820. $780 = $776 | $778;
  18821. $781 = $773 ^ $779;
  18822. $782 = $774 ^ $780;
  18823. $783 = (_bitshift64Shl(($765|0),($766|0),23)|0);
  18824. $784 = tempRet0;
  18825. $785 = (_bitshift64Lshr(($765|0),($766|0),41)|0);
  18826. $786 = tempRet0;
  18827. $787 = $783 | $785;
  18828. $788 = $784 | $786;
  18829. $789 = $781 ^ $787;
  18830. $790 = $782 ^ $788;
  18831. $791 = $678 ^ $591;
  18832. $792 = $679 ^ $592;
  18833. $793 = $765 & $791;
  18834. $794 = $766 & $792;
  18835. $795 = $793 ^ $591;
  18836. $796 = $794 ^ $592;
  18837. $797 = $i$29 | 7;
  18838. $798 = (31904 + ($797<<3)|0);
  18839. $799 = $798;
  18840. $800 = $799;
  18841. $801 = HEAP32[$800>>2]|0;
  18842. $802 = (($799) + 4)|0;
  18843. $803 = $802;
  18844. $804 = HEAP32[$803>>2]|0;
  18845. $805 = (($W) + ($797<<3)|0);
  18846. $806 = $805;
  18847. $807 = $806;
  18848. $808 = HEAP32[$807>>2]|0;
  18849. $809 = (($806) + 4)|0;
  18850. $810 = $809;
  18851. $811 = HEAP32[$810>>2]|0;
  18852. $812 = (_i64Add(($808|0),($811|0),($801|0),($804|0))|0);
  18853. $813 = tempRet0;
  18854. $814 = (_i64Add(($812|0),($813|0),($504|0),($505|0))|0);
  18855. $815 = tempRet0;
  18856. $816 = (_i64Add(($814|0),($815|0),($795|0),($796|0))|0);
  18857. $817 = tempRet0;
  18858. $818 = (_i64Add(($816|0),($817|0),($789|0),($790|0))|0);
  18859. $819 = tempRet0;
  18860. $820 = (_bitshift64Shl(($767|0),($768|0),36)|0);
  18861. $821 = tempRet0;
  18862. $822 = (_bitshift64Lshr(($767|0),($768|0),28)|0);
  18863. $823 = tempRet0;
  18864. $824 = $820 | $822;
  18865. $825 = $821 | $823;
  18866. $826 = (_bitshift64Shl(($767|0),($768|0),30)|0);
  18867. $827 = tempRet0;
  18868. $828 = (_bitshift64Lshr(($767|0),($768|0),34)|0);
  18869. $829 = tempRet0;
  18870. $830 = $826 | $828;
  18871. $831 = $827 | $829;
  18872. $832 = $824 ^ $830;
  18873. $833 = $825 ^ $831;
  18874. $834 = (_bitshift64Shl(($767|0),($768|0),25)|0);
  18875. $835 = tempRet0;
  18876. $836 = (_bitshift64Lshr(($767|0),($768|0),39)|0);
  18877. $837 = tempRet0;
  18878. $838 = $834 | $836;
  18879. $839 = $835 | $837;
  18880. $840 = $832 ^ $838;
  18881. $841 = $833 ^ $839;
  18882. $842 = $767 & $680;
  18883. $843 = $768 & $681;
  18884. $844 = $767 | $680;
  18885. $845 = $768 | $681;
  18886. $846 = $844 & $593;
  18887. $847 = $845 & $594;
  18888. $848 = $846 | $842;
  18889. $849 = $847 | $843;
  18890. $850 = (_i64Add(($840|0),($841|0),($848|0),($849|0))|0);
  18891. $851 = tempRet0;
  18892. $852 = (_i64Add(($818|0),($819|0),($506|0),($507|0))|0);
  18893. $853 = tempRet0;
  18894. $854 = (_i64Add(($850|0),($851|0),($818|0),($819|0))|0);
  18895. $855 = tempRet0;
  18896. $856 = (($i$29) + 8)|0;
  18897. $857 = ($856|0)<(80);
  18898. if ($857) {
  18899. $145 = $852;$146 = $853;$170 = $678;$171 = $765;$173 = $679;$174 = $766;$193 = $591;$194 = $592;$203 = $854;$204 = $855;$228 = $767;$230 = $768;$234 = $680;$236 = $681;$241 = $593;$242 = $594;$i$29 = $856;
  18900. } else {
  18901. break;
  18902. }
  18903. }
  18904. $858 = $r;
  18905. $859 = $858;
  18906. $860 = HEAP32[$859>>2]|0;
  18907. $861 = (($858) + 4)|0;
  18908. $862 = $861;
  18909. $863 = HEAP32[$862>>2]|0;
  18910. $864 = (_i64Add(($860|0),($863|0),($854|0),($855|0))|0);
  18911. $865 = tempRet0;
  18912. $866 = $r;
  18913. $867 = $866;
  18914. HEAP32[$867>>2] = $864;
  18915. $868 = (($866) + 4)|0;
  18916. $869 = $868;
  18917. HEAP32[$869>>2] = $865;
  18918. $870 = $96;
  18919. $871 = $870;
  18920. $872 = HEAP32[$871>>2]|0;
  18921. $873 = (($870) + 4)|0;
  18922. $874 = $873;
  18923. $875 = HEAP32[$874>>2]|0;
  18924. $876 = (_i64Add(($872|0),($875|0),($767|0),($768|0))|0);
  18925. $877 = tempRet0;
  18926. $878 = $96;
  18927. $879 = $878;
  18928. HEAP32[$879>>2] = $876;
  18929. $880 = (($878) + 4)|0;
  18930. $881 = $880;
  18931. HEAP32[$881>>2] = $877;
  18932. $882 = $103;
  18933. $883 = $882;
  18934. $884 = HEAP32[$883>>2]|0;
  18935. $885 = (($882) + 4)|0;
  18936. $886 = $885;
  18937. $887 = HEAP32[$886>>2]|0;
  18938. $888 = (_i64Add(($884|0),($887|0),($680|0),($681|0))|0);
  18939. $889 = tempRet0;
  18940. $890 = $103;
  18941. $891 = $890;
  18942. HEAP32[$891>>2] = $888;
  18943. $892 = (($890) + 4)|0;
  18944. $893 = $892;
  18945. HEAP32[$893>>2] = $889;
  18946. $894 = $110;
  18947. $895 = $894;
  18948. $896 = HEAP32[$895>>2]|0;
  18949. $897 = (($894) + 4)|0;
  18950. $898 = $897;
  18951. $899 = HEAP32[$898>>2]|0;
  18952. $900 = (_i64Add(($896|0),($899|0),($593|0),($594|0))|0);
  18953. $901 = tempRet0;
  18954. $902 = $110;
  18955. $903 = $902;
  18956. HEAP32[$903>>2] = $900;
  18957. $904 = (($902) + 4)|0;
  18958. $905 = $904;
  18959. HEAP32[$905>>2] = $901;
  18960. $906 = $117;
  18961. $907 = $906;
  18962. $908 = HEAP32[$907>>2]|0;
  18963. $909 = (($906) + 4)|0;
  18964. $910 = $909;
  18965. $911 = HEAP32[$910>>2]|0;
  18966. $912 = (_i64Add(($908|0),($911|0),($852|0),($853|0))|0);
  18967. $913 = tempRet0;
  18968. $914 = $117;
  18969. $915 = $914;
  18970. HEAP32[$915>>2] = $912;
  18971. $916 = (($914) + 4)|0;
  18972. $917 = $916;
  18973. HEAP32[$917>>2] = $913;
  18974. $918 = $124;
  18975. $919 = $918;
  18976. $920 = HEAP32[$919>>2]|0;
  18977. $921 = (($918) + 4)|0;
  18978. $922 = $921;
  18979. $923 = HEAP32[$922>>2]|0;
  18980. $924 = (_i64Add(($920|0),($923|0),($765|0),($766|0))|0);
  18981. $925 = tempRet0;
  18982. $926 = $124;
  18983. $927 = $926;
  18984. HEAP32[$927>>2] = $924;
  18985. $928 = (($926) + 4)|0;
  18986. $929 = $928;
  18987. HEAP32[$929>>2] = $925;
  18988. $930 = $131;
  18989. $931 = $930;
  18990. $932 = HEAP32[$931>>2]|0;
  18991. $933 = (($930) + 4)|0;
  18992. $934 = $933;
  18993. $935 = HEAP32[$934>>2]|0;
  18994. $936 = (_i64Add(($932|0),($935|0),($678|0),($679|0))|0);
  18995. $937 = tempRet0;
  18996. $938 = $131;
  18997. $939 = $938;
  18998. HEAP32[$939>>2] = $936;
  18999. $940 = (($938) + 4)|0;
  19000. $941 = $940;
  19001. HEAP32[$941>>2] = $937;
  19002. $942 = $138;
  19003. $943 = $942;
  19004. $944 = HEAP32[$943>>2]|0;
  19005. $945 = (($942) + 4)|0;
  19006. $946 = $945;
  19007. $947 = HEAP32[$946>>2]|0;
  19008. $948 = (_i64Add(($944|0),($947|0),($591|0),($592|0))|0);
  19009. $949 = tempRet0;
  19010. $950 = $138;
  19011. $951 = $950;
  19012. HEAP32[$951>>2] = $948;
  19013. $952 = (($950) + 4)|0;
  19014. $953 = $952;
  19015. HEAP32[$953>>2] = $949;
  19016. STACKTOP = sp;return;
  19017. }
  19018. function _sha384_close($cc,$dst,$rnum) {
  19019. $cc = $cc|0;
  19020. $dst = $dst|0;
  19021. $rnum = $rnum|0;
  19022. var label = 0, sp = 0;
  19023. sp = STACKTOP;
  19024. _sha384_addbits_and_close($cc,0,0,$dst,$rnum);
  19025. STACKTOP = sp;return;
  19026. }
  19027. function _sha384_addbits_and_close($cc,$ub,$n,$dst,$rnum) {
  19028. $cc = $cc|0;
  19029. $ub = $ub|0;
  19030. $n = $n|0;
  19031. $dst = $dst|0;
  19032. $rnum = $rnum|0;
  19033. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  19034. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0;
  19035. var $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $exitcond = 0, $u$01 = 0, dest = 0, label = 0, sp = 0, stop = 0;
  19036. sp = STACKTOP;
  19037. $0 = (($cc) + 192|0);
  19038. $1 = $0;
  19039. $2 = $1;
  19040. $3 = HEAP32[$2>>2]|0;
  19041. $4 = (($1) + 4)|0;
  19042. $5 = $4;
  19043. $6 = HEAP32[$5>>2]|0;
  19044. $7 = $3 & 127;
  19045. $8 = 128 >>> $n;
  19046. $9 = (0 - ($8))|0;
  19047. $10 = $9 & $ub;
  19048. $11 = $10 | $8;
  19049. $12 = $11&255;
  19050. $13 = (($7) + 1)|0;
  19051. $14 = (($cc) + ($7)|0);
  19052. HEAP8[$14>>0] = $12;
  19053. $15 = ($13>>>0)>(112);
  19054. $16 = (($cc) + ($13)|0);
  19055. if ($15) {
  19056. $17 = $7 ^ 127;
  19057. _memset(($16|0),0,($17|0))|0;
  19058. $18 = (($cc) + 128|0);
  19059. _sha3_round($cc,$18);
  19060. dest=$cc+0|0; stop=dest+112|0; do { HEAP8[dest>>0]=0|0; dest=dest+1|0; } while ((dest|0) < (stop|0));
  19061. } else {
  19062. $19 = (111 - ($7))|0;
  19063. _memset(($16|0),0,($19|0))|0;
  19064. }
  19065. $20 = (($cc) + 112|0);
  19066. $21 = $0;
  19067. $22 = $21;
  19068. $23 = HEAP32[$22>>2]|0;
  19069. $24 = (($21) + 4)|0;
  19070. $25 = $24;
  19071. $26 = HEAP32[$25>>2]|0;
  19072. $27 = (_bitshift64Lshr(($23|0),($26|0),61)|0);
  19073. $28 = tempRet0;
  19074. _sph_enc64be_aligned($20,$27,$28);
  19075. $29 = (($cc) + 120|0);
  19076. $30 = $0;
  19077. $31 = $30;
  19078. $32 = HEAP32[$31>>2]|0;
  19079. $33 = (($30) + 4)|0;
  19080. $34 = $33;
  19081. $35 = HEAP32[$34>>2]|0;
  19082. $36 = (_bitshift64Shl(($32|0),($35|0),3)|0);
  19083. $37 = tempRet0;
  19084. $38 = (_i64Add(($36|0),($37|0),($n|0),0)|0);
  19085. $39 = tempRet0;
  19086. _sph_enc64be_aligned($29,$38,$39);
  19087. $40 = (($cc) + 128|0);
  19088. _sha3_round($cc,$40);
  19089. $41 = ($rnum|0)==(0);
  19090. if ($41) {
  19091. STACKTOP = sp;return;
  19092. } else {
  19093. $u$01 = 0;
  19094. }
  19095. while(1) {
  19096. $42 = $u$01 << 3;
  19097. $43 = (($dst) + ($42)|0);
  19098. $44 = (($40) + ($u$01<<3)|0);
  19099. $45 = $44;
  19100. $46 = $45;
  19101. $47 = HEAP32[$46>>2]|0;
  19102. $48 = (($45) + 4)|0;
  19103. $49 = $48;
  19104. $50 = HEAP32[$49>>2]|0;
  19105. _sph_enc64be($43,$47,$50);
  19106. $51 = (($u$01) + 1)|0;
  19107. $exitcond = ($51|0)==($rnum|0);
  19108. if ($exitcond) {
  19109. break;
  19110. } else {
  19111. $u$01 = $51;
  19112. }
  19113. }
  19114. STACKTOP = sp;return;
  19115. }
  19116. function _sph_dec64be_aligned($src) {
  19117. $src = $src|0;
  19118. var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0;
  19119. var $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0;
  19120. var $45 = 0, $46 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  19121. sp = STACKTOP;
  19122. $0 = HEAP8[$src>>0]|0;
  19123. $1 = $0&255;
  19124. $2 = (_bitshift64Shl(($1|0),0,56)|0);
  19125. $3 = tempRet0;
  19126. $4 = (($src) + 1|0);
  19127. $5 = HEAP8[$4>>0]|0;
  19128. $6 = $5&255;
  19129. $7 = (_bitshift64Shl(($6|0),0,48)|0);
  19130. $8 = tempRet0;
  19131. $9 = $7 | $2;
  19132. $10 = $8 | $3;
  19133. $11 = (($src) + 2|0);
  19134. $12 = HEAP8[$11>>0]|0;
  19135. $13 = $12&255;
  19136. $14 = (_bitshift64Shl(($13|0),0,40)|0);
  19137. $15 = tempRet0;
  19138. $16 = $9 | $14;
  19139. $17 = $10 | $15;
  19140. $18 = (($src) + 3|0);
  19141. $19 = HEAP8[$18>>0]|0;
  19142. $20 = $19&255;
  19143. $21 = $17 | $20;
  19144. $22 = (($src) + 4|0);
  19145. $23 = HEAP8[$22>>0]|0;
  19146. $24 = $23&255;
  19147. $25 = (_bitshift64Shl(($24|0),0,24)|0);
  19148. $26 = tempRet0;
  19149. $27 = $16 | $25;
  19150. $28 = $21 | $26;
  19151. $29 = (($src) + 5|0);
  19152. $30 = HEAP8[$29>>0]|0;
  19153. $31 = $30&255;
  19154. $32 = (_bitshift64Shl(($31|0),0,16)|0);
  19155. $33 = tempRet0;
  19156. $34 = $27 | $32;
  19157. $35 = $28 | $33;
  19158. $36 = (($src) + 6|0);
  19159. $37 = HEAP8[$36>>0]|0;
  19160. $38 = $37&255;
  19161. $39 = (_bitshift64Shl(($38|0),0,8)|0);
  19162. $40 = tempRet0;
  19163. $41 = $34 | $39;
  19164. $42 = $35 | $40;
  19165. $43 = (($src) + 7|0);
  19166. $44 = HEAP8[$43>>0]|0;
  19167. $45 = $44&255;
  19168. $46 = $41 | $45;
  19169. tempRet0 = $42;
  19170. STACKTOP = sp;return ($46|0);
  19171. }
  19172. function _sph_enc64be_aligned($dst,$0,$1) {
  19173. $dst = $dst|0;
  19174. $0 = $0|0;
  19175. $1 = $1|0;
  19176. var $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  19177. var $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  19178. sp = STACKTOP;
  19179. $2 = (_bitshift64Lshr(($0|0),($1|0),56)|0);
  19180. $3 = tempRet0;
  19181. $4 = $2&255;
  19182. HEAP8[$dst>>0] = $4;
  19183. $5 = (_bitshift64Lshr(($0|0),($1|0),48)|0);
  19184. $6 = tempRet0;
  19185. $7 = $5&255;
  19186. $8 = (($dst) + 1|0);
  19187. HEAP8[$8>>0] = $7;
  19188. $9 = (_bitshift64Lshr(($0|0),($1|0),40)|0);
  19189. $10 = tempRet0;
  19190. $11 = $9&255;
  19191. $12 = (($dst) + 2|0);
  19192. HEAP8[$12>>0] = $11;
  19193. $13 = $1&255;
  19194. $14 = (($dst) + 3|0);
  19195. HEAP8[$14>>0] = $13;
  19196. $15 = (_bitshift64Lshr(($0|0),($1|0),24)|0);
  19197. $16 = tempRet0;
  19198. $17 = $15&255;
  19199. $18 = (($dst) + 4|0);
  19200. HEAP8[$18>>0] = $17;
  19201. $19 = (_bitshift64Lshr(($0|0),($1|0),16)|0);
  19202. $20 = tempRet0;
  19203. $21 = $19&255;
  19204. $22 = (($dst) + 5|0);
  19205. HEAP8[$22>>0] = $21;
  19206. $23 = (_bitshift64Lshr(($0|0),($1|0),8)|0);
  19207. $24 = tempRet0;
  19208. $25 = $23&255;
  19209. $26 = (($dst) + 6|0);
  19210. HEAP8[$26>>0] = $25;
  19211. $27 = $0&255;
  19212. $28 = (($dst) + 7|0);
  19213. HEAP8[$28>>0] = $27;
  19214. STACKTOP = sp;return;
  19215. }
  19216. function _sph_enc64be($dst,$0,$1) {
  19217. $dst = $dst|0;
  19218. $0 = $0|0;
  19219. $1 = $1|0;
  19220. var $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  19221. var $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  19222. sp = STACKTOP;
  19223. $2 = (_bitshift64Lshr(($0|0),($1|0),56)|0);
  19224. $3 = tempRet0;
  19225. $4 = $2&255;
  19226. HEAP8[$dst>>0] = $4;
  19227. $5 = (_bitshift64Lshr(($0|0),($1|0),48)|0);
  19228. $6 = tempRet0;
  19229. $7 = $5&255;
  19230. $8 = (($dst) + 1|0);
  19231. HEAP8[$8>>0] = $7;
  19232. $9 = (_bitshift64Lshr(($0|0),($1|0),40)|0);
  19233. $10 = tempRet0;
  19234. $11 = $9&255;
  19235. $12 = (($dst) + 2|0);
  19236. HEAP8[$12>>0] = $11;
  19237. $13 = $1&255;
  19238. $14 = (($dst) + 3|0);
  19239. HEAP8[$14>>0] = $13;
  19240. $15 = (_bitshift64Lshr(($0|0),($1|0),24)|0);
  19241. $16 = tempRet0;
  19242. $17 = $15&255;
  19243. $18 = (($dst) + 4|0);
  19244. HEAP8[$18>>0] = $17;
  19245. $19 = (_bitshift64Lshr(($0|0),($1|0),16)|0);
  19246. $20 = tempRet0;
  19247. $21 = $19&255;
  19248. $22 = (($dst) + 5|0);
  19249. HEAP8[$22>>0] = $21;
  19250. $23 = (_bitshift64Lshr(($0|0),($1|0),8)|0);
  19251. $24 = tempRet0;
  19252. $25 = $23&255;
  19253. $26 = (($dst) + 6|0);
  19254. HEAP8[$26>>0] = $25;
  19255. $27 = $0&255;
  19256. $28 = (($dst) + 7|0);
  19257. HEAP8[$28>>0] = $27;
  19258. STACKTOP = sp;return;
  19259. }
  19260. function _malloc($bytes) {
  19261. $bytes = $bytes|0;
  19262. var $$pre = 0, $$pre$i = 0, $$pre$i$i = 0, $$pre$i23$i = 0, $$pre$i25 = 0, $$pre$phi$i$iZ2D = 0, $$pre$phi$i24$iZ2D = 0, $$pre$phi$i26Z2D = 0, $$pre$phi$iZ2D = 0, $$pre$phi59$i$iZ2D = 0, $$pre$phiZ2D = 0, $$pre105 = 0, $$pre58$i$i = 0, $$rsize$0$i = 0, $$rsize$3$i = 0, $$sum = 0, $$sum$i$i = 0, $$sum$i$i$i = 0, $$sum$i12$i = 0, $$sum$i13$i = 0;
  19263. var $$sum$i16$i = 0, $$sum$i19$i = 0, $$sum$i2338 = 0, $$sum$i32 = 0, $$sum$i39 = 0, $$sum1 = 0, $$sum1$i = 0, $$sum1$i$i = 0, $$sum1$i14$i = 0, $$sum1$i20$i = 0, $$sum1$i24 = 0, $$sum10 = 0, $$sum10$i = 0, $$sum10$i$i = 0, $$sum10$pre$i$i = 0, $$sum102$i = 0, $$sum103$i = 0, $$sum104$i = 0, $$sum105$i = 0, $$sum106$i = 0;
  19264. var $$sum107$i = 0, $$sum108$i = 0, $$sum109$i = 0, $$sum11$i = 0, $$sum11$i$i = 0, $$sum11$i22$i = 0, $$sum110$i = 0, $$sum111$i = 0, $$sum1112 = 0, $$sum112$i = 0, $$sum113$i = 0, $$sum114$i = 0, $$sum115$i = 0, $$sum12$i = 0, $$sum12$i$i = 0, $$sum13$i = 0, $$sum13$i$i = 0, $$sum14$i$i = 0, $$sum14$pre$i = 0, $$sum15$i = 0;
  19265. var $$sum15$i$i = 0, $$sum16$i = 0, $$sum16$i$i = 0, $$sum17$i = 0, $$sum17$i$i = 0, $$sum18$i = 0, $$sum1819$i$i = 0, $$sum2 = 0, $$sum2$i = 0, $$sum2$i$i = 0, $$sum2$i$i$i = 0, $$sum2$i15$i = 0, $$sum2$i17$i = 0, $$sum2$i21$i = 0, $$sum2$pre$i = 0, $$sum20$i$i = 0, $$sum21$i$i = 0, $$sum22$i$i = 0, $$sum23$i$i = 0, $$sum24$i$i = 0;
  19266. var $$sum25$i$i = 0, $$sum26$pre$i$i = 0, $$sum27$i$i = 0, $$sum28$i$i = 0, $$sum29$i$i = 0, $$sum3$i = 0, $$sum3$i$i = 0, $$sum3$i27 = 0, $$sum30$i$i = 0, $$sum3132$i$i = 0, $$sum34$i$i = 0, $$sum3536$i$i = 0, $$sum3738$i$i = 0, $$sum39$i$i = 0, $$sum4 = 0, $$sum4$i = 0, $$sum4$i28 = 0, $$sum40$i$i = 0, $$sum41$i$i = 0, $$sum42$i$i = 0;
  19267. var $$sum5$i = 0, $$sum5$i$i = 0, $$sum56 = 0, $$sum6$i = 0, $$sum67$i$i = 0, $$sum7$i = 0, $$sum8$i = 0, $$sum8$pre = 0, $$sum9 = 0, $$sum9$i = 0, $$sum9$i$i = 0, $$tsize$1$i = 0, $$v$0$i = 0, $0 = 0, $1 = 0, $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0;
  19268. var $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0, $1015 = 0, $1016 = 0, $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0;
  19269. var $1021 = 0, $1022 = 0, $1023 = 0, $1024 = 0, $1025 = 0, $1026 = 0, $1027 = 0, $1028 = 0, $1029 = 0, $103 = 0, $1030 = 0, $1031 = 0, $1032 = 0, $1033 = 0, $1034 = 0, $1035 = 0, $1036 = 0, $1037 = 0, $1038 = 0, $1039 = 0;
  19270. var $104 = 0, $1040 = 0, $1041 = 0, $1042 = 0, $1043 = 0, $1044 = 0, $1045 = 0, $1046 = 0, $1047 = 0, $1048 = 0, $1049 = 0, $105 = 0, $1050 = 0, $1051 = 0, $1052 = 0, $1053 = 0, $1054 = 0, $1055 = 0, $1056 = 0, $1057 = 0;
  19271. var $1058 = 0, $1059 = 0, $106 = 0, $1060 = 0, $1061 = 0, $1062 = 0, $1063 = 0, $1064 = 0, $1065 = 0, $1066 = 0, $1067 = 0, $1068 = 0, $1069 = 0, $107 = 0, $1070 = 0, $1071 = 0, $1072 = 0, $1073 = 0, $1074 = 0, $108 = 0;
  19272. var $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0;
  19273. var $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0;
  19274. var $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0;
  19275. var $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0;
  19276. var $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0;
  19277. var $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0;
  19278. var $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0;
  19279. var $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0;
  19280. var $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0;
  19281. var $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0;
  19282. var $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0;
  19283. var $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0;
  19284. var $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0;
  19285. var $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0;
  19286. var $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0, $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0;
  19287. var $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0;
  19288. var $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0, $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0;
  19289. var $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0, $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0, $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0;
  19290. var $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0;
  19291. var $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0, $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0;
  19292. var $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0;
  19293. var $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0, $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0;
  19294. var $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0;
  19295. var $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0;
  19296. var $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0;
  19297. var $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0;
  19298. var $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0;
  19299. var $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0, $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0;
  19300. var $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0;
  19301. var $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0;
  19302. var $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0;
  19303. var $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0;
  19304. var $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0;
  19305. var $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0;
  19306. var $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0;
  19307. var $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0;
  19308. var $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0;
  19309. var $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0;
  19310. var $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0;
  19311. var $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0, $819 = 0, $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0, $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0;
  19312. var $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0, $837 = 0, $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0, $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0;
  19313. var $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0, $855 = 0, $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0, $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0;
  19314. var $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0, $873 = 0, $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0, $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0;
  19315. var $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0, $891 = 0, $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0, $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0;
  19316. var $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0, $909 = 0, $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0, $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0;
  19317. var $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0, $927 = 0, $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0, $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0;
  19318. var $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0, $945 = 0, $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0, $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0;
  19319. var $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0, $960 = 0, $961 = 0, $962 = 0, $963 = 0, $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0, $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0;
  19320. var $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0, $979 = 0, $98 = 0, $980 = 0, $981 = 0, $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0, $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0;
  19321. var $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0, $997 = 0, $998 = 0, $999 = 0, $F$0$i$i = 0, $F1$0$i = 0, $F4$0 = 0, $F4$0$i$i = 0, $F5$0$i = 0, $I1$0$c$i$i = 0, $I1$0$i$i = 0, $I7$0$i = 0, $I7$0$i$i = 0, $K12$027$i = 0, $K2$015$i$i = 0, $K8$053$i$i = 0;
  19322. var $R$0$i = 0, $R$0$i$i = 0, $R$0$i18 = 0, $R$1$i = 0, $R$1$i$i = 0, $R$1$i20 = 0, $RP$0$i = 0, $RP$0$i$i = 0, $RP$0$i17 = 0, $T$0$lcssa$i = 0, $T$0$lcssa$i$i = 0, $T$0$lcssa$i26$i = 0, $T$014$i$i = 0, $T$026$i = 0, $T$052$i$i = 0, $br$0$i = 0, $br$030$i = 0, $cond$i = 0, $cond$i$i = 0, $cond$i21 = 0;
  19323. var $exitcond$i$i = 0, $i$02$i$i = 0, $idx$0$i = 0, $mem$0 = 0, $nb$0 = 0, $oldfirst$0$i$i = 0, $or$cond$i = 0, $or$cond$i$i = 0, $or$cond$i27$i = 0, $or$cond$i29 = 0, $or$cond1$i = 0, $or$cond19$i = 0, $or$cond2$i = 0, $or$cond24$i = 0, $or$cond3$i = 0, $or$cond4$i = 0, $or$cond47$i = 0, $or$cond5$i = 0, $or$cond6$i = 0, $or$cond8$i = 0;
  19324. var $qsize$0$i$i = 0, $rsize$0$i = 0, $rsize$0$i15 = 0, $rsize$1$i = 0, $rsize$2$i = 0, $rsize$3$lcssa$i = 0, $rsize$331$i = 0, $rst$0$i = 0, $rst$1$i = 0, $sizebits$0$i = 0, $sp$0$i$i = 0, $sp$0$i$i$i = 0, $sp$073$i = 0, $sp$166$i = 0, $ssize$0$i = 0, $ssize$1$i = 0, $ssize$129$i = 0, $ssize$2$i = 0, $t$0$i = 0, $t$0$i14 = 0;
  19325. var $t$1$i = 0, $t$2$ph$i = 0, $t$2$v$3$i = 0, $t$230$i = 0, $tbase$245$i = 0, $tsize$03141$i = 0, $tsize$1$i = 0, $tsize$244$i = 0, $v$0$i = 0, $v$0$i16 = 0, $v$1$i = 0, $v$2$i = 0, $v$3$lcssa$i = 0, $v$332$i = 0, label = 0, sp = 0;
  19326. sp = STACKTOP;
  19327. $0 = ($bytes>>>0)<(245);
  19328. do {
  19329. if ($0) {
  19330. $1 = ($bytes>>>0)<(11);
  19331. if ($1) {
  19332. $5 = 16;
  19333. } else {
  19334. $2 = (($bytes) + 11)|0;
  19335. $3 = $2 & -8;
  19336. $5 = $3;
  19337. }
  19338. $4 = $5 >>> 3;
  19339. $6 = HEAP32[32544>>2]|0;
  19340. $7 = $6 >>> $4;
  19341. $8 = $7 & 3;
  19342. $9 = ($8|0)==(0);
  19343. if (!($9)) {
  19344. $10 = $7 & 1;
  19345. $11 = $10 ^ 1;
  19346. $12 = (($11) + ($4))|0;
  19347. $13 = $12 << 1;
  19348. $14 = ((32544 + ($13<<2)|0) + 40|0);
  19349. $$sum10 = (($13) + 2)|0;
  19350. $15 = ((32544 + ($$sum10<<2)|0) + 40|0);
  19351. $16 = HEAP32[$15>>2]|0;
  19352. $17 = (($16) + 8|0);
  19353. $18 = HEAP32[$17>>2]|0;
  19354. $19 = ($14|0)==($18|0);
  19355. do {
  19356. if ($19) {
  19357. $20 = 1 << $12;
  19358. $21 = $20 ^ -1;
  19359. $22 = $6 & $21;
  19360. HEAP32[32544>>2] = $22;
  19361. } else {
  19362. $23 = HEAP32[((32544 + 16|0))>>2]|0;
  19363. $24 = ($18>>>0)<($23>>>0);
  19364. if ($24) {
  19365. _abort();
  19366. // unreachable;
  19367. }
  19368. $25 = (($18) + 12|0);
  19369. $26 = HEAP32[$25>>2]|0;
  19370. $27 = ($26|0)==($16|0);
  19371. if ($27) {
  19372. HEAP32[$25>>2] = $14;
  19373. HEAP32[$15>>2] = $18;
  19374. break;
  19375. } else {
  19376. _abort();
  19377. // unreachable;
  19378. }
  19379. }
  19380. } while(0);
  19381. $28 = $12 << 3;
  19382. $29 = $28 | 3;
  19383. $30 = (($16) + 4|0);
  19384. HEAP32[$30>>2] = $29;
  19385. $$sum1112 = $28 | 4;
  19386. $31 = (($16) + ($$sum1112)|0);
  19387. $32 = HEAP32[$31>>2]|0;
  19388. $33 = $32 | 1;
  19389. HEAP32[$31>>2] = $33;
  19390. $mem$0 = $17;
  19391. STACKTOP = sp;return ($mem$0|0);
  19392. }
  19393. $34 = HEAP32[((32544 + 8|0))>>2]|0;
  19394. $35 = ($5>>>0)>($34>>>0);
  19395. if ($35) {
  19396. $36 = ($7|0)==(0);
  19397. if (!($36)) {
  19398. $37 = $7 << $4;
  19399. $38 = 2 << $4;
  19400. $39 = (0 - ($38))|0;
  19401. $40 = $38 | $39;
  19402. $41 = $37 & $40;
  19403. $42 = (0 - ($41))|0;
  19404. $43 = $41 & $42;
  19405. $44 = (($43) + -1)|0;
  19406. $45 = $44 >>> 12;
  19407. $46 = $45 & 16;
  19408. $47 = $44 >>> $46;
  19409. $48 = $47 >>> 5;
  19410. $49 = $48 & 8;
  19411. $50 = $49 | $46;
  19412. $51 = $47 >>> $49;
  19413. $52 = $51 >>> 2;
  19414. $53 = $52 & 4;
  19415. $54 = $50 | $53;
  19416. $55 = $51 >>> $53;
  19417. $56 = $55 >>> 1;
  19418. $57 = $56 & 2;
  19419. $58 = $54 | $57;
  19420. $59 = $55 >>> $57;
  19421. $60 = $59 >>> 1;
  19422. $61 = $60 & 1;
  19423. $62 = $58 | $61;
  19424. $63 = $59 >>> $61;
  19425. $64 = (($62) + ($63))|0;
  19426. $65 = $64 << 1;
  19427. $66 = ((32544 + ($65<<2)|0) + 40|0);
  19428. $$sum4 = (($65) + 2)|0;
  19429. $67 = ((32544 + ($$sum4<<2)|0) + 40|0);
  19430. $68 = HEAP32[$67>>2]|0;
  19431. $69 = (($68) + 8|0);
  19432. $70 = HEAP32[$69>>2]|0;
  19433. $71 = ($66|0)==($70|0);
  19434. do {
  19435. if ($71) {
  19436. $72 = 1 << $64;
  19437. $73 = $72 ^ -1;
  19438. $74 = $6 & $73;
  19439. HEAP32[32544>>2] = $74;
  19440. $88 = $34;
  19441. } else {
  19442. $75 = HEAP32[((32544 + 16|0))>>2]|0;
  19443. $76 = ($70>>>0)<($75>>>0);
  19444. if ($76) {
  19445. _abort();
  19446. // unreachable;
  19447. }
  19448. $77 = (($70) + 12|0);
  19449. $78 = HEAP32[$77>>2]|0;
  19450. $79 = ($78|0)==($68|0);
  19451. if ($79) {
  19452. HEAP32[$77>>2] = $66;
  19453. HEAP32[$67>>2] = $70;
  19454. $$pre = HEAP32[((32544 + 8|0))>>2]|0;
  19455. $88 = $$pre;
  19456. break;
  19457. } else {
  19458. _abort();
  19459. // unreachable;
  19460. }
  19461. }
  19462. } while(0);
  19463. $80 = $64 << 3;
  19464. $81 = (($80) - ($5))|0;
  19465. $82 = $5 | 3;
  19466. $83 = (($68) + 4|0);
  19467. HEAP32[$83>>2] = $82;
  19468. $84 = (($68) + ($5)|0);
  19469. $85 = $81 | 1;
  19470. $$sum56 = $5 | 4;
  19471. $86 = (($68) + ($$sum56)|0);
  19472. HEAP32[$86>>2] = $85;
  19473. $87 = (($68) + ($80)|0);
  19474. HEAP32[$87>>2] = $81;
  19475. $89 = ($88|0)==(0);
  19476. if (!($89)) {
  19477. $90 = HEAP32[((32544 + 20|0))>>2]|0;
  19478. $91 = $88 >>> 3;
  19479. $92 = $91 << 1;
  19480. $93 = ((32544 + ($92<<2)|0) + 40|0);
  19481. $94 = HEAP32[32544>>2]|0;
  19482. $95 = 1 << $91;
  19483. $96 = $94 & $95;
  19484. $97 = ($96|0)==(0);
  19485. if ($97) {
  19486. $98 = $94 | $95;
  19487. HEAP32[32544>>2] = $98;
  19488. $$sum8$pre = (($92) + 2)|0;
  19489. $$pre105 = ((32544 + ($$sum8$pre<<2)|0) + 40|0);
  19490. $$pre$phiZ2D = $$pre105;$F4$0 = $93;
  19491. } else {
  19492. $$sum9 = (($92) + 2)|0;
  19493. $99 = ((32544 + ($$sum9<<2)|0) + 40|0);
  19494. $100 = HEAP32[$99>>2]|0;
  19495. $101 = HEAP32[((32544 + 16|0))>>2]|0;
  19496. $102 = ($100>>>0)<($101>>>0);
  19497. if ($102) {
  19498. _abort();
  19499. // unreachable;
  19500. } else {
  19501. $$pre$phiZ2D = $99;$F4$0 = $100;
  19502. }
  19503. }
  19504. HEAP32[$$pre$phiZ2D>>2] = $90;
  19505. $103 = (($F4$0) + 12|0);
  19506. HEAP32[$103>>2] = $90;
  19507. $104 = (($90) + 8|0);
  19508. HEAP32[$104>>2] = $F4$0;
  19509. $105 = (($90) + 12|0);
  19510. HEAP32[$105>>2] = $93;
  19511. }
  19512. HEAP32[((32544 + 8|0))>>2] = $81;
  19513. HEAP32[((32544 + 20|0))>>2] = $84;
  19514. $mem$0 = $69;
  19515. STACKTOP = sp;return ($mem$0|0);
  19516. }
  19517. $106 = HEAP32[((32544 + 4|0))>>2]|0;
  19518. $107 = ($106|0)==(0);
  19519. if ($107) {
  19520. $nb$0 = $5;
  19521. } else {
  19522. $108 = (0 - ($106))|0;
  19523. $109 = $106 & $108;
  19524. $110 = (($109) + -1)|0;
  19525. $111 = $110 >>> 12;
  19526. $112 = $111 & 16;
  19527. $113 = $110 >>> $112;
  19528. $114 = $113 >>> 5;
  19529. $115 = $114 & 8;
  19530. $116 = $115 | $112;
  19531. $117 = $113 >>> $115;
  19532. $118 = $117 >>> 2;
  19533. $119 = $118 & 4;
  19534. $120 = $116 | $119;
  19535. $121 = $117 >>> $119;
  19536. $122 = $121 >>> 1;
  19537. $123 = $122 & 2;
  19538. $124 = $120 | $123;
  19539. $125 = $121 >>> $123;
  19540. $126 = $125 >>> 1;
  19541. $127 = $126 & 1;
  19542. $128 = $124 | $127;
  19543. $129 = $125 >>> $127;
  19544. $130 = (($128) + ($129))|0;
  19545. $131 = ((32544 + ($130<<2)|0) + 304|0);
  19546. $132 = HEAP32[$131>>2]|0;
  19547. $133 = (($132) + 4|0);
  19548. $134 = HEAP32[$133>>2]|0;
  19549. $135 = $134 & -8;
  19550. $136 = (($135) - ($5))|0;
  19551. $rsize$0$i = $136;$t$0$i = $132;$v$0$i = $132;
  19552. while(1) {
  19553. $137 = (($t$0$i) + 16|0);
  19554. $138 = HEAP32[$137>>2]|0;
  19555. $139 = ($138|0)==(0|0);
  19556. if ($139) {
  19557. $140 = (($t$0$i) + 20|0);
  19558. $141 = HEAP32[$140>>2]|0;
  19559. $142 = ($141|0)==(0|0);
  19560. if ($142) {
  19561. break;
  19562. } else {
  19563. $144 = $141;
  19564. }
  19565. } else {
  19566. $144 = $138;
  19567. }
  19568. $143 = (($144) + 4|0);
  19569. $145 = HEAP32[$143>>2]|0;
  19570. $146 = $145 & -8;
  19571. $147 = (($146) - ($5))|0;
  19572. $148 = ($147>>>0)<($rsize$0$i>>>0);
  19573. $$rsize$0$i = $148 ? $147 : $rsize$0$i;
  19574. $$v$0$i = $148 ? $144 : $v$0$i;
  19575. $rsize$0$i = $$rsize$0$i;$t$0$i = $144;$v$0$i = $$v$0$i;
  19576. }
  19577. $149 = HEAP32[((32544 + 16|0))>>2]|0;
  19578. $150 = ($v$0$i>>>0)<($149>>>0);
  19579. if ($150) {
  19580. _abort();
  19581. // unreachable;
  19582. }
  19583. $151 = (($v$0$i) + ($5)|0);
  19584. $152 = ($v$0$i>>>0)<($151>>>0);
  19585. if (!($152)) {
  19586. _abort();
  19587. // unreachable;
  19588. }
  19589. $153 = (($v$0$i) + 24|0);
  19590. $154 = HEAP32[$153>>2]|0;
  19591. $155 = (($v$0$i) + 12|0);
  19592. $156 = HEAP32[$155>>2]|0;
  19593. $157 = ($156|0)==($v$0$i|0);
  19594. do {
  19595. if ($157) {
  19596. $167 = (($v$0$i) + 20|0);
  19597. $168 = HEAP32[$167>>2]|0;
  19598. $169 = ($168|0)==(0|0);
  19599. if ($169) {
  19600. $170 = (($v$0$i) + 16|0);
  19601. $171 = HEAP32[$170>>2]|0;
  19602. $172 = ($171|0)==(0|0);
  19603. if ($172) {
  19604. $R$1$i = 0;
  19605. break;
  19606. } else {
  19607. $R$0$i = $171;$RP$0$i = $170;
  19608. }
  19609. } else {
  19610. $R$0$i = $168;$RP$0$i = $167;
  19611. }
  19612. while(1) {
  19613. $173 = (($R$0$i) + 20|0);
  19614. $174 = HEAP32[$173>>2]|0;
  19615. $175 = ($174|0)==(0|0);
  19616. if (!($175)) {
  19617. $R$0$i = $174;$RP$0$i = $173;
  19618. continue;
  19619. }
  19620. $176 = (($R$0$i) + 16|0);
  19621. $177 = HEAP32[$176>>2]|0;
  19622. $178 = ($177|0)==(0|0);
  19623. if ($178) {
  19624. break;
  19625. } else {
  19626. $R$0$i = $177;$RP$0$i = $176;
  19627. }
  19628. }
  19629. $179 = ($RP$0$i>>>0)<($149>>>0);
  19630. if ($179) {
  19631. _abort();
  19632. // unreachable;
  19633. } else {
  19634. HEAP32[$RP$0$i>>2] = 0;
  19635. $R$1$i = $R$0$i;
  19636. break;
  19637. }
  19638. } else {
  19639. $158 = (($v$0$i) + 8|0);
  19640. $159 = HEAP32[$158>>2]|0;
  19641. $160 = ($159>>>0)<($149>>>0);
  19642. if ($160) {
  19643. _abort();
  19644. // unreachable;
  19645. }
  19646. $161 = (($159) + 12|0);
  19647. $162 = HEAP32[$161>>2]|0;
  19648. $163 = ($162|0)==($v$0$i|0);
  19649. if (!($163)) {
  19650. _abort();
  19651. // unreachable;
  19652. }
  19653. $164 = (($156) + 8|0);
  19654. $165 = HEAP32[$164>>2]|0;
  19655. $166 = ($165|0)==($v$0$i|0);
  19656. if ($166) {
  19657. HEAP32[$161>>2] = $156;
  19658. HEAP32[$164>>2] = $159;
  19659. $R$1$i = $156;
  19660. break;
  19661. } else {
  19662. _abort();
  19663. // unreachable;
  19664. }
  19665. }
  19666. } while(0);
  19667. $180 = ($154|0)==(0|0);
  19668. do {
  19669. if (!($180)) {
  19670. $181 = (($v$0$i) + 28|0);
  19671. $182 = HEAP32[$181>>2]|0;
  19672. $183 = ((32544 + ($182<<2)|0) + 304|0);
  19673. $184 = HEAP32[$183>>2]|0;
  19674. $185 = ($v$0$i|0)==($184|0);
  19675. if ($185) {
  19676. HEAP32[$183>>2] = $R$1$i;
  19677. $cond$i = ($R$1$i|0)==(0|0);
  19678. if ($cond$i) {
  19679. $186 = 1 << $182;
  19680. $187 = $186 ^ -1;
  19681. $188 = HEAP32[((32544 + 4|0))>>2]|0;
  19682. $189 = $188 & $187;
  19683. HEAP32[((32544 + 4|0))>>2] = $189;
  19684. break;
  19685. }
  19686. } else {
  19687. $190 = HEAP32[((32544 + 16|0))>>2]|0;
  19688. $191 = ($154>>>0)<($190>>>0);
  19689. if ($191) {
  19690. _abort();
  19691. // unreachable;
  19692. }
  19693. $192 = (($154) + 16|0);
  19694. $193 = HEAP32[$192>>2]|0;
  19695. $194 = ($193|0)==($v$0$i|0);
  19696. if ($194) {
  19697. HEAP32[$192>>2] = $R$1$i;
  19698. } else {
  19699. $195 = (($154) + 20|0);
  19700. HEAP32[$195>>2] = $R$1$i;
  19701. }
  19702. $196 = ($R$1$i|0)==(0|0);
  19703. if ($196) {
  19704. break;
  19705. }
  19706. }
  19707. $197 = HEAP32[((32544 + 16|0))>>2]|0;
  19708. $198 = ($R$1$i>>>0)<($197>>>0);
  19709. if ($198) {
  19710. _abort();
  19711. // unreachable;
  19712. }
  19713. $199 = (($R$1$i) + 24|0);
  19714. HEAP32[$199>>2] = $154;
  19715. $200 = (($v$0$i) + 16|0);
  19716. $201 = HEAP32[$200>>2]|0;
  19717. $202 = ($201|0)==(0|0);
  19718. do {
  19719. if (!($202)) {
  19720. $203 = ($201>>>0)<($197>>>0);
  19721. if ($203) {
  19722. _abort();
  19723. // unreachable;
  19724. } else {
  19725. $204 = (($R$1$i) + 16|0);
  19726. HEAP32[$204>>2] = $201;
  19727. $205 = (($201) + 24|0);
  19728. HEAP32[$205>>2] = $R$1$i;
  19729. break;
  19730. }
  19731. }
  19732. } while(0);
  19733. $206 = (($v$0$i) + 20|0);
  19734. $207 = HEAP32[$206>>2]|0;
  19735. $208 = ($207|0)==(0|0);
  19736. if (!($208)) {
  19737. $209 = HEAP32[((32544 + 16|0))>>2]|0;
  19738. $210 = ($207>>>0)<($209>>>0);
  19739. if ($210) {
  19740. _abort();
  19741. // unreachable;
  19742. } else {
  19743. $211 = (($R$1$i) + 20|0);
  19744. HEAP32[$211>>2] = $207;
  19745. $212 = (($207) + 24|0);
  19746. HEAP32[$212>>2] = $R$1$i;
  19747. break;
  19748. }
  19749. }
  19750. }
  19751. } while(0);
  19752. $213 = ($rsize$0$i>>>0)<(16);
  19753. if ($213) {
  19754. $214 = (($rsize$0$i) + ($5))|0;
  19755. $215 = $214 | 3;
  19756. $216 = (($v$0$i) + 4|0);
  19757. HEAP32[$216>>2] = $215;
  19758. $$sum4$i = (($214) + 4)|0;
  19759. $217 = (($v$0$i) + ($$sum4$i)|0);
  19760. $218 = HEAP32[$217>>2]|0;
  19761. $219 = $218 | 1;
  19762. HEAP32[$217>>2] = $219;
  19763. } else {
  19764. $220 = $5 | 3;
  19765. $221 = (($v$0$i) + 4|0);
  19766. HEAP32[$221>>2] = $220;
  19767. $222 = $rsize$0$i | 1;
  19768. $$sum$i39 = $5 | 4;
  19769. $223 = (($v$0$i) + ($$sum$i39)|0);
  19770. HEAP32[$223>>2] = $222;
  19771. $$sum1$i = (($rsize$0$i) + ($5))|0;
  19772. $224 = (($v$0$i) + ($$sum1$i)|0);
  19773. HEAP32[$224>>2] = $rsize$0$i;
  19774. $225 = HEAP32[((32544 + 8|0))>>2]|0;
  19775. $226 = ($225|0)==(0);
  19776. if (!($226)) {
  19777. $227 = HEAP32[((32544 + 20|0))>>2]|0;
  19778. $228 = $225 >>> 3;
  19779. $229 = $228 << 1;
  19780. $230 = ((32544 + ($229<<2)|0) + 40|0);
  19781. $231 = HEAP32[32544>>2]|0;
  19782. $232 = 1 << $228;
  19783. $233 = $231 & $232;
  19784. $234 = ($233|0)==(0);
  19785. if ($234) {
  19786. $235 = $231 | $232;
  19787. HEAP32[32544>>2] = $235;
  19788. $$sum2$pre$i = (($229) + 2)|0;
  19789. $$pre$i = ((32544 + ($$sum2$pre$i<<2)|0) + 40|0);
  19790. $$pre$phi$iZ2D = $$pre$i;$F1$0$i = $230;
  19791. } else {
  19792. $$sum3$i = (($229) + 2)|0;
  19793. $236 = ((32544 + ($$sum3$i<<2)|0) + 40|0);
  19794. $237 = HEAP32[$236>>2]|0;
  19795. $238 = HEAP32[((32544 + 16|0))>>2]|0;
  19796. $239 = ($237>>>0)<($238>>>0);
  19797. if ($239) {
  19798. _abort();
  19799. // unreachable;
  19800. } else {
  19801. $$pre$phi$iZ2D = $236;$F1$0$i = $237;
  19802. }
  19803. }
  19804. HEAP32[$$pre$phi$iZ2D>>2] = $227;
  19805. $240 = (($F1$0$i) + 12|0);
  19806. HEAP32[$240>>2] = $227;
  19807. $241 = (($227) + 8|0);
  19808. HEAP32[$241>>2] = $F1$0$i;
  19809. $242 = (($227) + 12|0);
  19810. HEAP32[$242>>2] = $230;
  19811. }
  19812. HEAP32[((32544 + 8|0))>>2] = $rsize$0$i;
  19813. HEAP32[((32544 + 20|0))>>2] = $151;
  19814. }
  19815. $243 = (($v$0$i) + 8|0);
  19816. $mem$0 = $243;
  19817. STACKTOP = sp;return ($mem$0|0);
  19818. }
  19819. } else {
  19820. $nb$0 = $5;
  19821. }
  19822. } else {
  19823. $244 = ($bytes>>>0)>(4294967231);
  19824. if ($244) {
  19825. $nb$0 = -1;
  19826. } else {
  19827. $245 = (($bytes) + 11)|0;
  19828. $246 = $245 & -8;
  19829. $247 = HEAP32[((32544 + 4|0))>>2]|0;
  19830. $248 = ($247|0)==(0);
  19831. if ($248) {
  19832. $nb$0 = $246;
  19833. } else {
  19834. $249 = (0 - ($246))|0;
  19835. $250 = $245 >>> 8;
  19836. $251 = ($250|0)==(0);
  19837. if ($251) {
  19838. $idx$0$i = 0;
  19839. } else {
  19840. $252 = ($246>>>0)>(16777215);
  19841. if ($252) {
  19842. $idx$0$i = 31;
  19843. } else {
  19844. $253 = (($250) + 1048320)|0;
  19845. $254 = $253 >>> 16;
  19846. $255 = $254 & 8;
  19847. $256 = $250 << $255;
  19848. $257 = (($256) + 520192)|0;
  19849. $258 = $257 >>> 16;
  19850. $259 = $258 & 4;
  19851. $260 = $259 | $255;
  19852. $261 = $256 << $259;
  19853. $262 = (($261) + 245760)|0;
  19854. $263 = $262 >>> 16;
  19855. $264 = $263 & 2;
  19856. $265 = $260 | $264;
  19857. $266 = (14 - ($265))|0;
  19858. $267 = $261 << $264;
  19859. $268 = $267 >>> 15;
  19860. $269 = (($266) + ($268))|0;
  19861. $270 = $269 << 1;
  19862. $271 = (($269) + 7)|0;
  19863. $272 = $246 >>> $271;
  19864. $273 = $272 & 1;
  19865. $274 = $273 | $270;
  19866. $idx$0$i = $274;
  19867. }
  19868. }
  19869. $275 = ((32544 + ($idx$0$i<<2)|0) + 304|0);
  19870. $276 = HEAP32[$275>>2]|0;
  19871. $277 = ($276|0)==(0|0);
  19872. L126: do {
  19873. if ($277) {
  19874. $rsize$2$i = $249;$t$1$i = 0;$v$2$i = 0;
  19875. } else {
  19876. $278 = ($idx$0$i|0)==(31);
  19877. if ($278) {
  19878. $282 = 0;
  19879. } else {
  19880. $279 = $idx$0$i >>> 1;
  19881. $280 = (25 - ($279))|0;
  19882. $282 = $280;
  19883. }
  19884. $281 = $246 << $282;
  19885. $rsize$0$i15 = $249;$rst$0$i = 0;$sizebits$0$i = $281;$t$0$i14 = $276;$v$0$i16 = 0;
  19886. while(1) {
  19887. $283 = (($t$0$i14) + 4|0);
  19888. $284 = HEAP32[$283>>2]|0;
  19889. $285 = $284 & -8;
  19890. $286 = (($285) - ($246))|0;
  19891. $287 = ($286>>>0)<($rsize$0$i15>>>0);
  19892. if ($287) {
  19893. $288 = ($285|0)==($246|0);
  19894. if ($288) {
  19895. $rsize$2$i = $286;$t$1$i = $t$0$i14;$v$2$i = $t$0$i14;
  19896. break L126;
  19897. } else {
  19898. $rsize$1$i = $286;$v$1$i = $t$0$i14;
  19899. }
  19900. } else {
  19901. $rsize$1$i = $rsize$0$i15;$v$1$i = $v$0$i16;
  19902. }
  19903. $289 = (($t$0$i14) + 20|0);
  19904. $290 = HEAP32[$289>>2]|0;
  19905. $291 = $sizebits$0$i >>> 31;
  19906. $292 = ((($t$0$i14) + ($291<<2)|0) + 16|0);
  19907. $293 = HEAP32[$292>>2]|0;
  19908. $294 = ($290|0)==(0|0);
  19909. $295 = ($290|0)==($293|0);
  19910. $or$cond19$i = $294 | $295;
  19911. $rst$1$i = $or$cond19$i ? $rst$0$i : $290;
  19912. $296 = ($293|0)==(0|0);
  19913. $297 = $sizebits$0$i << 1;
  19914. if ($296) {
  19915. $rsize$2$i = $rsize$1$i;$t$1$i = $rst$1$i;$v$2$i = $v$1$i;
  19916. break;
  19917. } else {
  19918. $rsize$0$i15 = $rsize$1$i;$rst$0$i = $rst$1$i;$sizebits$0$i = $297;$t$0$i14 = $293;$v$0$i16 = $v$1$i;
  19919. }
  19920. }
  19921. }
  19922. } while(0);
  19923. $298 = ($t$1$i|0)==(0|0);
  19924. $299 = ($v$2$i|0)==(0|0);
  19925. $or$cond$i = $298 & $299;
  19926. if ($or$cond$i) {
  19927. $300 = 2 << $idx$0$i;
  19928. $301 = (0 - ($300))|0;
  19929. $302 = $300 | $301;
  19930. $303 = $247 & $302;
  19931. $304 = ($303|0)==(0);
  19932. if ($304) {
  19933. $nb$0 = $246;
  19934. break;
  19935. }
  19936. $305 = (0 - ($303))|0;
  19937. $306 = $303 & $305;
  19938. $307 = (($306) + -1)|0;
  19939. $308 = $307 >>> 12;
  19940. $309 = $308 & 16;
  19941. $310 = $307 >>> $309;
  19942. $311 = $310 >>> 5;
  19943. $312 = $311 & 8;
  19944. $313 = $312 | $309;
  19945. $314 = $310 >>> $312;
  19946. $315 = $314 >>> 2;
  19947. $316 = $315 & 4;
  19948. $317 = $313 | $316;
  19949. $318 = $314 >>> $316;
  19950. $319 = $318 >>> 1;
  19951. $320 = $319 & 2;
  19952. $321 = $317 | $320;
  19953. $322 = $318 >>> $320;
  19954. $323 = $322 >>> 1;
  19955. $324 = $323 & 1;
  19956. $325 = $321 | $324;
  19957. $326 = $322 >>> $324;
  19958. $327 = (($325) + ($326))|0;
  19959. $328 = ((32544 + ($327<<2)|0) + 304|0);
  19960. $329 = HEAP32[$328>>2]|0;
  19961. $t$2$ph$i = $329;
  19962. } else {
  19963. $t$2$ph$i = $t$1$i;
  19964. }
  19965. $330 = ($t$2$ph$i|0)==(0|0);
  19966. if ($330) {
  19967. $rsize$3$lcssa$i = $rsize$2$i;$v$3$lcssa$i = $v$2$i;
  19968. } else {
  19969. $rsize$331$i = $rsize$2$i;$t$230$i = $t$2$ph$i;$v$332$i = $v$2$i;
  19970. while(1) {
  19971. $331 = (($t$230$i) + 4|0);
  19972. $332 = HEAP32[$331>>2]|0;
  19973. $333 = $332 & -8;
  19974. $334 = (($333) - ($246))|0;
  19975. $335 = ($334>>>0)<($rsize$331$i>>>0);
  19976. $$rsize$3$i = $335 ? $334 : $rsize$331$i;
  19977. $t$2$v$3$i = $335 ? $t$230$i : $v$332$i;
  19978. $336 = (($t$230$i) + 16|0);
  19979. $337 = HEAP32[$336>>2]|0;
  19980. $338 = ($337|0)==(0|0);
  19981. if (!($338)) {
  19982. $rsize$331$i = $$rsize$3$i;$t$230$i = $337;$v$332$i = $t$2$v$3$i;
  19983. continue;
  19984. }
  19985. $339 = (($t$230$i) + 20|0);
  19986. $340 = HEAP32[$339>>2]|0;
  19987. $341 = ($340|0)==(0|0);
  19988. if ($341) {
  19989. $rsize$3$lcssa$i = $$rsize$3$i;$v$3$lcssa$i = $t$2$v$3$i;
  19990. break;
  19991. } else {
  19992. $rsize$331$i = $$rsize$3$i;$t$230$i = $340;$v$332$i = $t$2$v$3$i;
  19993. }
  19994. }
  19995. }
  19996. $342 = ($v$3$lcssa$i|0)==(0|0);
  19997. if ($342) {
  19998. $nb$0 = $246;
  19999. } else {
  20000. $343 = HEAP32[((32544 + 8|0))>>2]|0;
  20001. $344 = (($343) - ($246))|0;
  20002. $345 = ($rsize$3$lcssa$i>>>0)<($344>>>0);
  20003. if ($345) {
  20004. $346 = HEAP32[((32544 + 16|0))>>2]|0;
  20005. $347 = ($v$3$lcssa$i>>>0)<($346>>>0);
  20006. if ($347) {
  20007. _abort();
  20008. // unreachable;
  20009. }
  20010. $348 = (($v$3$lcssa$i) + ($246)|0);
  20011. $349 = ($v$3$lcssa$i>>>0)<($348>>>0);
  20012. if (!($349)) {
  20013. _abort();
  20014. // unreachable;
  20015. }
  20016. $350 = (($v$3$lcssa$i) + 24|0);
  20017. $351 = HEAP32[$350>>2]|0;
  20018. $352 = (($v$3$lcssa$i) + 12|0);
  20019. $353 = HEAP32[$352>>2]|0;
  20020. $354 = ($353|0)==($v$3$lcssa$i|0);
  20021. do {
  20022. if ($354) {
  20023. $364 = (($v$3$lcssa$i) + 20|0);
  20024. $365 = HEAP32[$364>>2]|0;
  20025. $366 = ($365|0)==(0|0);
  20026. if ($366) {
  20027. $367 = (($v$3$lcssa$i) + 16|0);
  20028. $368 = HEAP32[$367>>2]|0;
  20029. $369 = ($368|0)==(0|0);
  20030. if ($369) {
  20031. $R$1$i20 = 0;
  20032. break;
  20033. } else {
  20034. $R$0$i18 = $368;$RP$0$i17 = $367;
  20035. }
  20036. } else {
  20037. $R$0$i18 = $365;$RP$0$i17 = $364;
  20038. }
  20039. while(1) {
  20040. $370 = (($R$0$i18) + 20|0);
  20041. $371 = HEAP32[$370>>2]|0;
  20042. $372 = ($371|0)==(0|0);
  20043. if (!($372)) {
  20044. $R$0$i18 = $371;$RP$0$i17 = $370;
  20045. continue;
  20046. }
  20047. $373 = (($R$0$i18) + 16|0);
  20048. $374 = HEAP32[$373>>2]|0;
  20049. $375 = ($374|0)==(0|0);
  20050. if ($375) {
  20051. break;
  20052. } else {
  20053. $R$0$i18 = $374;$RP$0$i17 = $373;
  20054. }
  20055. }
  20056. $376 = ($RP$0$i17>>>0)<($346>>>0);
  20057. if ($376) {
  20058. _abort();
  20059. // unreachable;
  20060. } else {
  20061. HEAP32[$RP$0$i17>>2] = 0;
  20062. $R$1$i20 = $R$0$i18;
  20063. break;
  20064. }
  20065. } else {
  20066. $355 = (($v$3$lcssa$i) + 8|0);
  20067. $356 = HEAP32[$355>>2]|0;
  20068. $357 = ($356>>>0)<($346>>>0);
  20069. if ($357) {
  20070. _abort();
  20071. // unreachable;
  20072. }
  20073. $358 = (($356) + 12|0);
  20074. $359 = HEAP32[$358>>2]|0;
  20075. $360 = ($359|0)==($v$3$lcssa$i|0);
  20076. if (!($360)) {
  20077. _abort();
  20078. // unreachable;
  20079. }
  20080. $361 = (($353) + 8|0);
  20081. $362 = HEAP32[$361>>2]|0;
  20082. $363 = ($362|0)==($v$3$lcssa$i|0);
  20083. if ($363) {
  20084. HEAP32[$358>>2] = $353;
  20085. HEAP32[$361>>2] = $356;
  20086. $R$1$i20 = $353;
  20087. break;
  20088. } else {
  20089. _abort();
  20090. // unreachable;
  20091. }
  20092. }
  20093. } while(0);
  20094. $377 = ($351|0)==(0|0);
  20095. do {
  20096. if (!($377)) {
  20097. $378 = (($v$3$lcssa$i) + 28|0);
  20098. $379 = HEAP32[$378>>2]|0;
  20099. $380 = ((32544 + ($379<<2)|0) + 304|0);
  20100. $381 = HEAP32[$380>>2]|0;
  20101. $382 = ($v$3$lcssa$i|0)==($381|0);
  20102. if ($382) {
  20103. HEAP32[$380>>2] = $R$1$i20;
  20104. $cond$i21 = ($R$1$i20|0)==(0|0);
  20105. if ($cond$i21) {
  20106. $383 = 1 << $379;
  20107. $384 = $383 ^ -1;
  20108. $385 = HEAP32[((32544 + 4|0))>>2]|0;
  20109. $386 = $385 & $384;
  20110. HEAP32[((32544 + 4|0))>>2] = $386;
  20111. break;
  20112. }
  20113. } else {
  20114. $387 = HEAP32[((32544 + 16|0))>>2]|0;
  20115. $388 = ($351>>>0)<($387>>>0);
  20116. if ($388) {
  20117. _abort();
  20118. // unreachable;
  20119. }
  20120. $389 = (($351) + 16|0);
  20121. $390 = HEAP32[$389>>2]|0;
  20122. $391 = ($390|0)==($v$3$lcssa$i|0);
  20123. if ($391) {
  20124. HEAP32[$389>>2] = $R$1$i20;
  20125. } else {
  20126. $392 = (($351) + 20|0);
  20127. HEAP32[$392>>2] = $R$1$i20;
  20128. }
  20129. $393 = ($R$1$i20|0)==(0|0);
  20130. if ($393) {
  20131. break;
  20132. }
  20133. }
  20134. $394 = HEAP32[((32544 + 16|0))>>2]|0;
  20135. $395 = ($R$1$i20>>>0)<($394>>>0);
  20136. if ($395) {
  20137. _abort();
  20138. // unreachable;
  20139. }
  20140. $396 = (($R$1$i20) + 24|0);
  20141. HEAP32[$396>>2] = $351;
  20142. $397 = (($v$3$lcssa$i) + 16|0);
  20143. $398 = HEAP32[$397>>2]|0;
  20144. $399 = ($398|0)==(0|0);
  20145. do {
  20146. if (!($399)) {
  20147. $400 = ($398>>>0)<($394>>>0);
  20148. if ($400) {
  20149. _abort();
  20150. // unreachable;
  20151. } else {
  20152. $401 = (($R$1$i20) + 16|0);
  20153. HEAP32[$401>>2] = $398;
  20154. $402 = (($398) + 24|0);
  20155. HEAP32[$402>>2] = $R$1$i20;
  20156. break;
  20157. }
  20158. }
  20159. } while(0);
  20160. $403 = (($v$3$lcssa$i) + 20|0);
  20161. $404 = HEAP32[$403>>2]|0;
  20162. $405 = ($404|0)==(0|0);
  20163. if (!($405)) {
  20164. $406 = HEAP32[((32544 + 16|0))>>2]|0;
  20165. $407 = ($404>>>0)<($406>>>0);
  20166. if ($407) {
  20167. _abort();
  20168. // unreachable;
  20169. } else {
  20170. $408 = (($R$1$i20) + 20|0);
  20171. HEAP32[$408>>2] = $404;
  20172. $409 = (($404) + 24|0);
  20173. HEAP32[$409>>2] = $R$1$i20;
  20174. break;
  20175. }
  20176. }
  20177. }
  20178. } while(0);
  20179. $410 = ($rsize$3$lcssa$i>>>0)<(16);
  20180. L204: do {
  20181. if ($410) {
  20182. $411 = (($rsize$3$lcssa$i) + ($246))|0;
  20183. $412 = $411 | 3;
  20184. $413 = (($v$3$lcssa$i) + 4|0);
  20185. HEAP32[$413>>2] = $412;
  20186. $$sum18$i = (($411) + 4)|0;
  20187. $414 = (($v$3$lcssa$i) + ($$sum18$i)|0);
  20188. $415 = HEAP32[$414>>2]|0;
  20189. $416 = $415 | 1;
  20190. HEAP32[$414>>2] = $416;
  20191. } else {
  20192. $417 = $246 | 3;
  20193. $418 = (($v$3$lcssa$i) + 4|0);
  20194. HEAP32[$418>>2] = $417;
  20195. $419 = $rsize$3$lcssa$i | 1;
  20196. $$sum$i2338 = $246 | 4;
  20197. $420 = (($v$3$lcssa$i) + ($$sum$i2338)|0);
  20198. HEAP32[$420>>2] = $419;
  20199. $$sum1$i24 = (($rsize$3$lcssa$i) + ($246))|0;
  20200. $421 = (($v$3$lcssa$i) + ($$sum1$i24)|0);
  20201. HEAP32[$421>>2] = $rsize$3$lcssa$i;
  20202. $422 = $rsize$3$lcssa$i >>> 3;
  20203. $423 = ($rsize$3$lcssa$i>>>0)<(256);
  20204. if ($423) {
  20205. $424 = $422 << 1;
  20206. $425 = ((32544 + ($424<<2)|0) + 40|0);
  20207. $426 = HEAP32[32544>>2]|0;
  20208. $427 = 1 << $422;
  20209. $428 = $426 & $427;
  20210. $429 = ($428|0)==(0);
  20211. do {
  20212. if ($429) {
  20213. $430 = $426 | $427;
  20214. HEAP32[32544>>2] = $430;
  20215. $$sum14$pre$i = (($424) + 2)|0;
  20216. $$pre$i25 = ((32544 + ($$sum14$pre$i<<2)|0) + 40|0);
  20217. $$pre$phi$i26Z2D = $$pre$i25;$F5$0$i = $425;
  20218. } else {
  20219. $$sum17$i = (($424) + 2)|0;
  20220. $431 = ((32544 + ($$sum17$i<<2)|0) + 40|0);
  20221. $432 = HEAP32[$431>>2]|0;
  20222. $433 = HEAP32[((32544 + 16|0))>>2]|0;
  20223. $434 = ($432>>>0)<($433>>>0);
  20224. if (!($434)) {
  20225. $$pre$phi$i26Z2D = $431;$F5$0$i = $432;
  20226. break;
  20227. }
  20228. _abort();
  20229. // unreachable;
  20230. }
  20231. } while(0);
  20232. HEAP32[$$pre$phi$i26Z2D>>2] = $348;
  20233. $435 = (($F5$0$i) + 12|0);
  20234. HEAP32[$435>>2] = $348;
  20235. $$sum15$i = (($246) + 8)|0;
  20236. $436 = (($v$3$lcssa$i) + ($$sum15$i)|0);
  20237. HEAP32[$436>>2] = $F5$0$i;
  20238. $$sum16$i = (($246) + 12)|0;
  20239. $437 = (($v$3$lcssa$i) + ($$sum16$i)|0);
  20240. HEAP32[$437>>2] = $425;
  20241. break;
  20242. }
  20243. $438 = $rsize$3$lcssa$i >>> 8;
  20244. $439 = ($438|0)==(0);
  20245. if ($439) {
  20246. $I7$0$i = 0;
  20247. } else {
  20248. $440 = ($rsize$3$lcssa$i>>>0)>(16777215);
  20249. if ($440) {
  20250. $I7$0$i = 31;
  20251. } else {
  20252. $441 = (($438) + 1048320)|0;
  20253. $442 = $441 >>> 16;
  20254. $443 = $442 & 8;
  20255. $444 = $438 << $443;
  20256. $445 = (($444) + 520192)|0;
  20257. $446 = $445 >>> 16;
  20258. $447 = $446 & 4;
  20259. $448 = $447 | $443;
  20260. $449 = $444 << $447;
  20261. $450 = (($449) + 245760)|0;
  20262. $451 = $450 >>> 16;
  20263. $452 = $451 & 2;
  20264. $453 = $448 | $452;
  20265. $454 = (14 - ($453))|0;
  20266. $455 = $449 << $452;
  20267. $456 = $455 >>> 15;
  20268. $457 = (($454) + ($456))|0;
  20269. $458 = $457 << 1;
  20270. $459 = (($457) + 7)|0;
  20271. $460 = $rsize$3$lcssa$i >>> $459;
  20272. $461 = $460 & 1;
  20273. $462 = $461 | $458;
  20274. $I7$0$i = $462;
  20275. }
  20276. }
  20277. $463 = ((32544 + ($I7$0$i<<2)|0) + 304|0);
  20278. $$sum2$i = (($246) + 28)|0;
  20279. $464 = (($v$3$lcssa$i) + ($$sum2$i)|0);
  20280. HEAP32[$464>>2] = $I7$0$i;
  20281. $$sum3$i27 = (($246) + 16)|0;
  20282. $465 = (($v$3$lcssa$i) + ($$sum3$i27)|0);
  20283. $$sum4$i28 = (($246) + 20)|0;
  20284. $466 = (($v$3$lcssa$i) + ($$sum4$i28)|0);
  20285. HEAP32[$466>>2] = 0;
  20286. HEAP32[$465>>2] = 0;
  20287. $467 = HEAP32[((32544 + 4|0))>>2]|0;
  20288. $468 = 1 << $I7$0$i;
  20289. $469 = $467 & $468;
  20290. $470 = ($469|0)==(0);
  20291. if ($470) {
  20292. $471 = $467 | $468;
  20293. HEAP32[((32544 + 4|0))>>2] = $471;
  20294. HEAP32[$463>>2] = $348;
  20295. $$sum5$i = (($246) + 24)|0;
  20296. $472 = (($v$3$lcssa$i) + ($$sum5$i)|0);
  20297. HEAP32[$472>>2] = $463;
  20298. $$sum6$i = (($246) + 12)|0;
  20299. $473 = (($v$3$lcssa$i) + ($$sum6$i)|0);
  20300. HEAP32[$473>>2] = $348;
  20301. $$sum7$i = (($246) + 8)|0;
  20302. $474 = (($v$3$lcssa$i) + ($$sum7$i)|0);
  20303. HEAP32[$474>>2] = $348;
  20304. break;
  20305. }
  20306. $475 = HEAP32[$463>>2]|0;
  20307. $476 = ($I7$0$i|0)==(31);
  20308. if ($476) {
  20309. $484 = 0;
  20310. } else {
  20311. $477 = $I7$0$i >>> 1;
  20312. $478 = (25 - ($477))|0;
  20313. $484 = $478;
  20314. }
  20315. $479 = (($475) + 4|0);
  20316. $480 = HEAP32[$479>>2]|0;
  20317. $481 = $480 & -8;
  20318. $482 = ($481|0)==($rsize$3$lcssa$i|0);
  20319. L225: do {
  20320. if ($482) {
  20321. $T$0$lcssa$i = $475;
  20322. } else {
  20323. $483 = $rsize$3$lcssa$i << $484;
  20324. $K12$027$i = $483;$T$026$i = $475;
  20325. while(1) {
  20326. $491 = $K12$027$i >>> 31;
  20327. $492 = ((($T$026$i) + ($491<<2)|0) + 16|0);
  20328. $487 = HEAP32[$492>>2]|0;
  20329. $493 = ($487|0)==(0|0);
  20330. if ($493) {
  20331. break;
  20332. }
  20333. $485 = $K12$027$i << 1;
  20334. $486 = (($487) + 4|0);
  20335. $488 = HEAP32[$486>>2]|0;
  20336. $489 = $488 & -8;
  20337. $490 = ($489|0)==($rsize$3$lcssa$i|0);
  20338. if ($490) {
  20339. $T$0$lcssa$i = $487;
  20340. break L225;
  20341. } else {
  20342. $K12$027$i = $485;$T$026$i = $487;
  20343. }
  20344. }
  20345. $494 = HEAP32[((32544 + 16|0))>>2]|0;
  20346. $495 = ($492>>>0)<($494>>>0);
  20347. if ($495) {
  20348. _abort();
  20349. // unreachable;
  20350. } else {
  20351. HEAP32[$492>>2] = $348;
  20352. $$sum11$i = (($246) + 24)|0;
  20353. $496 = (($v$3$lcssa$i) + ($$sum11$i)|0);
  20354. HEAP32[$496>>2] = $T$026$i;
  20355. $$sum12$i = (($246) + 12)|0;
  20356. $497 = (($v$3$lcssa$i) + ($$sum12$i)|0);
  20357. HEAP32[$497>>2] = $348;
  20358. $$sum13$i = (($246) + 8)|0;
  20359. $498 = (($v$3$lcssa$i) + ($$sum13$i)|0);
  20360. HEAP32[$498>>2] = $348;
  20361. break L204;
  20362. }
  20363. }
  20364. } while(0);
  20365. $499 = (($T$0$lcssa$i) + 8|0);
  20366. $500 = HEAP32[$499>>2]|0;
  20367. $501 = HEAP32[((32544 + 16|0))>>2]|0;
  20368. $502 = ($T$0$lcssa$i>>>0)>=($501>>>0);
  20369. $503 = ($500>>>0)>=($501>>>0);
  20370. $or$cond24$i = $502 & $503;
  20371. if ($or$cond24$i) {
  20372. $504 = (($500) + 12|0);
  20373. HEAP32[$504>>2] = $348;
  20374. HEAP32[$499>>2] = $348;
  20375. $$sum8$i = (($246) + 8)|0;
  20376. $505 = (($v$3$lcssa$i) + ($$sum8$i)|0);
  20377. HEAP32[$505>>2] = $500;
  20378. $$sum9$i = (($246) + 12)|0;
  20379. $506 = (($v$3$lcssa$i) + ($$sum9$i)|0);
  20380. HEAP32[$506>>2] = $T$0$lcssa$i;
  20381. $$sum10$i = (($246) + 24)|0;
  20382. $507 = (($v$3$lcssa$i) + ($$sum10$i)|0);
  20383. HEAP32[$507>>2] = 0;
  20384. break;
  20385. } else {
  20386. _abort();
  20387. // unreachable;
  20388. }
  20389. }
  20390. } while(0);
  20391. $508 = (($v$3$lcssa$i) + 8|0);
  20392. $mem$0 = $508;
  20393. STACKTOP = sp;return ($mem$0|0);
  20394. } else {
  20395. $nb$0 = $246;
  20396. }
  20397. }
  20398. }
  20399. }
  20400. }
  20401. } while(0);
  20402. $509 = HEAP32[((32544 + 8|0))>>2]|0;
  20403. $510 = ($509>>>0)<($nb$0>>>0);
  20404. if (!($510)) {
  20405. $511 = (($509) - ($nb$0))|0;
  20406. $512 = HEAP32[((32544 + 20|0))>>2]|0;
  20407. $513 = ($511>>>0)>(15);
  20408. if ($513) {
  20409. $514 = (($512) + ($nb$0)|0);
  20410. HEAP32[((32544 + 20|0))>>2] = $514;
  20411. HEAP32[((32544 + 8|0))>>2] = $511;
  20412. $515 = $511 | 1;
  20413. $$sum2 = (($nb$0) + 4)|0;
  20414. $516 = (($512) + ($$sum2)|0);
  20415. HEAP32[$516>>2] = $515;
  20416. $517 = (($512) + ($509)|0);
  20417. HEAP32[$517>>2] = $511;
  20418. $518 = $nb$0 | 3;
  20419. $519 = (($512) + 4|0);
  20420. HEAP32[$519>>2] = $518;
  20421. } else {
  20422. HEAP32[((32544 + 8|0))>>2] = 0;
  20423. HEAP32[((32544 + 20|0))>>2] = 0;
  20424. $520 = $509 | 3;
  20425. $521 = (($512) + 4|0);
  20426. HEAP32[$521>>2] = $520;
  20427. $$sum1 = (($509) + 4)|0;
  20428. $522 = (($512) + ($$sum1)|0);
  20429. $523 = HEAP32[$522>>2]|0;
  20430. $524 = $523 | 1;
  20431. HEAP32[$522>>2] = $524;
  20432. }
  20433. $525 = (($512) + 8|0);
  20434. $mem$0 = $525;
  20435. STACKTOP = sp;return ($mem$0|0);
  20436. }
  20437. $526 = HEAP32[((32544 + 12|0))>>2]|0;
  20438. $527 = ($526>>>0)>($nb$0>>>0);
  20439. if ($527) {
  20440. $528 = (($526) - ($nb$0))|0;
  20441. HEAP32[((32544 + 12|0))>>2] = $528;
  20442. $529 = HEAP32[((32544 + 24|0))>>2]|0;
  20443. $530 = (($529) + ($nb$0)|0);
  20444. HEAP32[((32544 + 24|0))>>2] = $530;
  20445. $531 = $528 | 1;
  20446. $$sum = (($nb$0) + 4)|0;
  20447. $532 = (($529) + ($$sum)|0);
  20448. HEAP32[$532>>2] = $531;
  20449. $533 = $nb$0 | 3;
  20450. $534 = (($529) + 4|0);
  20451. HEAP32[$534>>2] = $533;
  20452. $535 = (($529) + 8|0);
  20453. $mem$0 = $535;
  20454. STACKTOP = sp;return ($mem$0|0);
  20455. }
  20456. $536 = HEAP32[33016>>2]|0;
  20457. $537 = ($536|0)==(0);
  20458. do {
  20459. if ($537) {
  20460. $538 = (_sysconf(30)|0);
  20461. $539 = (($538) + -1)|0;
  20462. $540 = $539 & $538;
  20463. $541 = ($540|0)==(0);
  20464. if ($541) {
  20465. HEAP32[((33016 + 8|0))>>2] = $538;
  20466. HEAP32[((33016 + 4|0))>>2] = $538;
  20467. HEAP32[((33016 + 12|0))>>2] = -1;
  20468. HEAP32[((33016 + 16|0))>>2] = -1;
  20469. HEAP32[((33016 + 20|0))>>2] = 0;
  20470. HEAP32[((32544 + 444|0))>>2] = 0;
  20471. $542 = (_time((0|0))|0);
  20472. $543 = $542 & -16;
  20473. $544 = $543 ^ 1431655768;
  20474. HEAP32[33016>>2] = $544;
  20475. break;
  20476. } else {
  20477. _abort();
  20478. // unreachable;
  20479. }
  20480. }
  20481. } while(0);
  20482. $545 = (($nb$0) + 48)|0;
  20483. $546 = HEAP32[((33016 + 8|0))>>2]|0;
  20484. $547 = (($nb$0) + 47)|0;
  20485. $548 = (($546) + ($547))|0;
  20486. $549 = (0 - ($546))|0;
  20487. $550 = $548 & $549;
  20488. $551 = ($550>>>0)>($nb$0>>>0);
  20489. if (!($551)) {
  20490. $mem$0 = 0;
  20491. STACKTOP = sp;return ($mem$0|0);
  20492. }
  20493. $552 = HEAP32[((32544 + 440|0))>>2]|0;
  20494. $553 = ($552|0)==(0);
  20495. if (!($553)) {
  20496. $554 = HEAP32[((32544 + 432|0))>>2]|0;
  20497. $555 = (($554) + ($550))|0;
  20498. $556 = ($555>>>0)<=($554>>>0);
  20499. $557 = ($555>>>0)>($552>>>0);
  20500. $or$cond1$i = $556 | $557;
  20501. if ($or$cond1$i) {
  20502. $mem$0 = 0;
  20503. STACKTOP = sp;return ($mem$0|0);
  20504. }
  20505. }
  20506. $558 = HEAP32[((32544 + 444|0))>>2]|0;
  20507. $559 = $558 & 4;
  20508. $560 = ($559|0)==(0);
  20509. L266: do {
  20510. if ($560) {
  20511. $561 = HEAP32[((32544 + 24|0))>>2]|0;
  20512. $562 = ($561|0)==(0|0);
  20513. L268: do {
  20514. if ($562) {
  20515. label = 181;
  20516. } else {
  20517. $sp$0$i$i = ((32544 + 448|0));
  20518. while(1) {
  20519. $563 = HEAP32[$sp$0$i$i>>2]|0;
  20520. $564 = ($563>>>0)>($561>>>0);
  20521. if (!($564)) {
  20522. $565 = (($sp$0$i$i) + 4|0);
  20523. $566 = HEAP32[$565>>2]|0;
  20524. $567 = (($563) + ($566)|0);
  20525. $568 = ($567>>>0)>($561>>>0);
  20526. if ($568) {
  20527. break;
  20528. }
  20529. }
  20530. $569 = (($sp$0$i$i) + 8|0);
  20531. $570 = HEAP32[$569>>2]|0;
  20532. $571 = ($570|0)==(0|0);
  20533. if ($571) {
  20534. label = 181;
  20535. break L268;
  20536. } else {
  20537. $sp$0$i$i = $570;
  20538. }
  20539. }
  20540. $572 = ($sp$0$i$i|0)==(0|0);
  20541. if ($572) {
  20542. label = 181;
  20543. } else {
  20544. $595 = HEAP32[((32544 + 12|0))>>2]|0;
  20545. $596 = (($548) - ($595))|0;
  20546. $597 = $596 & $549;
  20547. $598 = ($597>>>0)<(2147483647);
  20548. if ($598) {
  20549. $599 = (_sbrk(($597|0))|0);
  20550. $600 = HEAP32[$sp$0$i$i>>2]|0;
  20551. $601 = HEAP32[$565>>2]|0;
  20552. $602 = (($600) + ($601)|0);
  20553. $603 = ($599|0)==($602|0);
  20554. if ($603) {
  20555. $br$0$i = $599;$ssize$1$i = $597;
  20556. label = 190;
  20557. } else {
  20558. $br$030$i = $599;$ssize$129$i = $597;
  20559. label = 191;
  20560. }
  20561. } else {
  20562. $tsize$03141$i = 0;
  20563. }
  20564. }
  20565. }
  20566. } while(0);
  20567. do {
  20568. if ((label|0) == 181) {
  20569. $573 = (_sbrk(0)|0);
  20570. $574 = ($573|0)==((-1)|0);
  20571. if ($574) {
  20572. $tsize$03141$i = 0;
  20573. } else {
  20574. $575 = $573;
  20575. $576 = HEAP32[((33016 + 4|0))>>2]|0;
  20576. $577 = (($576) + -1)|0;
  20577. $578 = $577 & $575;
  20578. $579 = ($578|0)==(0);
  20579. if ($579) {
  20580. $ssize$0$i = $550;
  20581. } else {
  20582. $580 = (($577) + ($575))|0;
  20583. $581 = (0 - ($576))|0;
  20584. $582 = $580 & $581;
  20585. $583 = (($550) - ($575))|0;
  20586. $584 = (($583) + ($582))|0;
  20587. $ssize$0$i = $584;
  20588. }
  20589. $585 = HEAP32[((32544 + 432|0))>>2]|0;
  20590. $586 = (($585) + ($ssize$0$i))|0;
  20591. $587 = ($ssize$0$i>>>0)>($nb$0>>>0);
  20592. $588 = ($ssize$0$i>>>0)<(2147483647);
  20593. $or$cond$i29 = $587 & $588;
  20594. if ($or$cond$i29) {
  20595. $589 = HEAP32[((32544 + 440|0))>>2]|0;
  20596. $590 = ($589|0)==(0);
  20597. if (!($590)) {
  20598. $591 = ($586>>>0)<=($585>>>0);
  20599. $592 = ($586>>>0)>($589>>>0);
  20600. $or$cond2$i = $591 | $592;
  20601. if ($or$cond2$i) {
  20602. $tsize$03141$i = 0;
  20603. break;
  20604. }
  20605. }
  20606. $593 = (_sbrk(($ssize$0$i|0))|0);
  20607. $594 = ($593|0)==($573|0);
  20608. if ($594) {
  20609. $br$0$i = $573;$ssize$1$i = $ssize$0$i;
  20610. label = 190;
  20611. } else {
  20612. $br$030$i = $593;$ssize$129$i = $ssize$0$i;
  20613. label = 191;
  20614. }
  20615. } else {
  20616. $tsize$03141$i = 0;
  20617. }
  20618. }
  20619. }
  20620. } while(0);
  20621. L288: do {
  20622. if ((label|0) == 190) {
  20623. $604 = ($br$0$i|0)==((-1)|0);
  20624. if ($604) {
  20625. $tsize$03141$i = $ssize$1$i;
  20626. } else {
  20627. $tbase$245$i = $br$0$i;$tsize$244$i = $ssize$1$i;
  20628. label = 201;
  20629. break L266;
  20630. }
  20631. }
  20632. else if ((label|0) == 191) {
  20633. $605 = (0 - ($ssize$129$i))|0;
  20634. $606 = ($br$030$i|0)!=((-1)|0);
  20635. $607 = ($ssize$129$i>>>0)<(2147483647);
  20636. $or$cond5$i = $606 & $607;
  20637. $608 = ($545>>>0)>($ssize$129$i>>>0);
  20638. $or$cond4$i = $or$cond5$i & $608;
  20639. do {
  20640. if ($or$cond4$i) {
  20641. $609 = HEAP32[((33016 + 8|0))>>2]|0;
  20642. $610 = (($547) - ($ssize$129$i))|0;
  20643. $611 = (($610) + ($609))|0;
  20644. $612 = (0 - ($609))|0;
  20645. $613 = $611 & $612;
  20646. $614 = ($613>>>0)<(2147483647);
  20647. if ($614) {
  20648. $615 = (_sbrk(($613|0))|0);
  20649. $616 = ($615|0)==((-1)|0);
  20650. if ($616) {
  20651. (_sbrk(($605|0))|0);
  20652. $tsize$03141$i = 0;
  20653. break L288;
  20654. } else {
  20655. $617 = (($613) + ($ssize$129$i))|0;
  20656. $ssize$2$i = $617;
  20657. break;
  20658. }
  20659. } else {
  20660. $ssize$2$i = $ssize$129$i;
  20661. }
  20662. } else {
  20663. $ssize$2$i = $ssize$129$i;
  20664. }
  20665. } while(0);
  20666. $618 = ($br$030$i|0)==((-1)|0);
  20667. if ($618) {
  20668. $tsize$03141$i = 0;
  20669. } else {
  20670. $tbase$245$i = $br$030$i;$tsize$244$i = $ssize$2$i;
  20671. label = 201;
  20672. break L266;
  20673. }
  20674. }
  20675. } while(0);
  20676. $619 = HEAP32[((32544 + 444|0))>>2]|0;
  20677. $620 = $619 | 4;
  20678. HEAP32[((32544 + 444|0))>>2] = $620;
  20679. $tsize$1$i = $tsize$03141$i;
  20680. label = 198;
  20681. } else {
  20682. $tsize$1$i = 0;
  20683. label = 198;
  20684. }
  20685. } while(0);
  20686. if ((label|0) == 198) {
  20687. $621 = ($550>>>0)<(2147483647);
  20688. if ($621) {
  20689. $622 = (_sbrk(($550|0))|0);
  20690. $623 = (_sbrk(0)|0);
  20691. $624 = ($622|0)!=((-1)|0);
  20692. $625 = ($623|0)!=((-1)|0);
  20693. $or$cond3$i = $624 & $625;
  20694. $626 = ($622>>>0)<($623>>>0);
  20695. $or$cond6$i = $or$cond3$i & $626;
  20696. if ($or$cond6$i) {
  20697. $627 = $623;
  20698. $628 = $622;
  20699. $629 = (($627) - ($628))|0;
  20700. $630 = (($nb$0) + 40)|0;
  20701. $631 = ($629>>>0)>($630>>>0);
  20702. $$tsize$1$i = $631 ? $629 : $tsize$1$i;
  20703. if ($631) {
  20704. $tbase$245$i = $622;$tsize$244$i = $$tsize$1$i;
  20705. label = 201;
  20706. }
  20707. }
  20708. }
  20709. }
  20710. if ((label|0) == 201) {
  20711. $632 = HEAP32[((32544 + 432|0))>>2]|0;
  20712. $633 = (($632) + ($tsize$244$i))|0;
  20713. HEAP32[((32544 + 432|0))>>2] = $633;
  20714. $634 = HEAP32[((32544 + 436|0))>>2]|0;
  20715. $635 = ($633>>>0)>($634>>>0);
  20716. if ($635) {
  20717. HEAP32[((32544 + 436|0))>>2] = $633;
  20718. }
  20719. $636 = HEAP32[((32544 + 24|0))>>2]|0;
  20720. $637 = ($636|0)==(0|0);
  20721. L308: do {
  20722. if ($637) {
  20723. $638 = HEAP32[((32544 + 16|0))>>2]|0;
  20724. $639 = ($638|0)==(0|0);
  20725. $640 = ($tbase$245$i>>>0)<($638>>>0);
  20726. $or$cond8$i = $639 | $640;
  20727. if ($or$cond8$i) {
  20728. HEAP32[((32544 + 16|0))>>2] = $tbase$245$i;
  20729. }
  20730. HEAP32[((32544 + 448|0))>>2] = $tbase$245$i;
  20731. HEAP32[((32544 + 452|0))>>2] = $tsize$244$i;
  20732. HEAP32[((32544 + 460|0))>>2] = 0;
  20733. $641 = HEAP32[33016>>2]|0;
  20734. HEAP32[((32544 + 36|0))>>2] = $641;
  20735. HEAP32[((32544 + 32|0))>>2] = -1;
  20736. $i$02$i$i = 0;
  20737. while(1) {
  20738. $642 = $i$02$i$i << 1;
  20739. $643 = ((32544 + ($642<<2)|0) + 40|0);
  20740. $$sum$i$i = (($642) + 3)|0;
  20741. $644 = ((32544 + ($$sum$i$i<<2)|0) + 40|0);
  20742. HEAP32[$644>>2] = $643;
  20743. $$sum1$i$i = (($642) + 2)|0;
  20744. $645 = ((32544 + ($$sum1$i$i<<2)|0) + 40|0);
  20745. HEAP32[$645>>2] = $643;
  20746. $646 = (($i$02$i$i) + 1)|0;
  20747. $exitcond$i$i = ($646|0)==(32);
  20748. if ($exitcond$i$i) {
  20749. break;
  20750. } else {
  20751. $i$02$i$i = $646;
  20752. }
  20753. }
  20754. $647 = (($tsize$244$i) + -40)|0;
  20755. $648 = (($tbase$245$i) + 8|0);
  20756. $649 = $648;
  20757. $650 = $649 & 7;
  20758. $651 = ($650|0)==(0);
  20759. if ($651) {
  20760. $655 = 0;
  20761. } else {
  20762. $652 = (0 - ($649))|0;
  20763. $653 = $652 & 7;
  20764. $655 = $653;
  20765. }
  20766. $654 = (($tbase$245$i) + ($655)|0);
  20767. $656 = (($647) - ($655))|0;
  20768. HEAP32[((32544 + 24|0))>>2] = $654;
  20769. HEAP32[((32544 + 12|0))>>2] = $656;
  20770. $657 = $656 | 1;
  20771. $$sum$i12$i = (($655) + 4)|0;
  20772. $658 = (($tbase$245$i) + ($$sum$i12$i)|0);
  20773. HEAP32[$658>>2] = $657;
  20774. $$sum2$i$i = (($tsize$244$i) + -36)|0;
  20775. $659 = (($tbase$245$i) + ($$sum2$i$i)|0);
  20776. HEAP32[$659>>2] = 40;
  20777. $660 = HEAP32[((33016 + 16|0))>>2]|0;
  20778. HEAP32[((32544 + 28|0))>>2] = $660;
  20779. } else {
  20780. $sp$073$i = ((32544 + 448|0));
  20781. while(1) {
  20782. $661 = HEAP32[$sp$073$i>>2]|0;
  20783. $662 = (($sp$073$i) + 4|0);
  20784. $663 = HEAP32[$662>>2]|0;
  20785. $664 = (($661) + ($663)|0);
  20786. $665 = ($tbase$245$i|0)==($664|0);
  20787. if ($665) {
  20788. label = 213;
  20789. break;
  20790. }
  20791. $666 = (($sp$073$i) + 8|0);
  20792. $667 = HEAP32[$666>>2]|0;
  20793. $668 = ($667|0)==(0|0);
  20794. if ($668) {
  20795. break;
  20796. } else {
  20797. $sp$073$i = $667;
  20798. }
  20799. }
  20800. if ((label|0) == 213) {
  20801. $669 = (($sp$073$i) + 12|0);
  20802. $670 = HEAP32[$669>>2]|0;
  20803. $671 = $670 & 8;
  20804. $672 = ($671|0)==(0);
  20805. if ($672) {
  20806. $673 = ($636>>>0)>=($661>>>0);
  20807. $674 = ($636>>>0)<($tbase$245$i>>>0);
  20808. $or$cond47$i = $673 & $674;
  20809. if ($or$cond47$i) {
  20810. $675 = (($663) + ($tsize$244$i))|0;
  20811. HEAP32[$662>>2] = $675;
  20812. $676 = HEAP32[((32544 + 12|0))>>2]|0;
  20813. $677 = (($676) + ($tsize$244$i))|0;
  20814. $678 = (($636) + 8|0);
  20815. $679 = $678;
  20816. $680 = $679 & 7;
  20817. $681 = ($680|0)==(0);
  20818. if ($681) {
  20819. $685 = 0;
  20820. } else {
  20821. $682 = (0 - ($679))|0;
  20822. $683 = $682 & 7;
  20823. $685 = $683;
  20824. }
  20825. $684 = (($636) + ($685)|0);
  20826. $686 = (($677) - ($685))|0;
  20827. HEAP32[((32544 + 24|0))>>2] = $684;
  20828. HEAP32[((32544 + 12|0))>>2] = $686;
  20829. $687 = $686 | 1;
  20830. $$sum$i16$i = (($685) + 4)|0;
  20831. $688 = (($636) + ($$sum$i16$i)|0);
  20832. HEAP32[$688>>2] = $687;
  20833. $$sum2$i17$i = (($677) + 4)|0;
  20834. $689 = (($636) + ($$sum2$i17$i)|0);
  20835. HEAP32[$689>>2] = 40;
  20836. $690 = HEAP32[((33016 + 16|0))>>2]|0;
  20837. HEAP32[((32544 + 28|0))>>2] = $690;
  20838. break;
  20839. }
  20840. }
  20841. }
  20842. $691 = HEAP32[((32544 + 16|0))>>2]|0;
  20843. $692 = ($tbase$245$i>>>0)<($691>>>0);
  20844. if ($692) {
  20845. HEAP32[((32544 + 16|0))>>2] = $tbase$245$i;
  20846. $756 = $tbase$245$i;
  20847. } else {
  20848. $756 = $691;
  20849. }
  20850. $693 = (($tbase$245$i) + ($tsize$244$i)|0);
  20851. $sp$166$i = ((32544 + 448|0));
  20852. while(1) {
  20853. $694 = HEAP32[$sp$166$i>>2]|0;
  20854. $695 = ($694|0)==($693|0);
  20855. if ($695) {
  20856. label = 223;
  20857. break;
  20858. }
  20859. $696 = (($sp$166$i) + 8|0);
  20860. $697 = HEAP32[$696>>2]|0;
  20861. $698 = ($697|0)==(0|0);
  20862. if ($698) {
  20863. break;
  20864. } else {
  20865. $sp$166$i = $697;
  20866. }
  20867. }
  20868. if ((label|0) == 223) {
  20869. $699 = (($sp$166$i) + 12|0);
  20870. $700 = HEAP32[$699>>2]|0;
  20871. $701 = $700 & 8;
  20872. $702 = ($701|0)==(0);
  20873. if ($702) {
  20874. HEAP32[$sp$166$i>>2] = $tbase$245$i;
  20875. $703 = (($sp$166$i) + 4|0);
  20876. $704 = HEAP32[$703>>2]|0;
  20877. $705 = (($704) + ($tsize$244$i))|0;
  20878. HEAP32[$703>>2] = $705;
  20879. $706 = (($tbase$245$i) + 8|0);
  20880. $707 = $706;
  20881. $708 = $707 & 7;
  20882. $709 = ($708|0)==(0);
  20883. if ($709) {
  20884. $713 = 0;
  20885. } else {
  20886. $710 = (0 - ($707))|0;
  20887. $711 = $710 & 7;
  20888. $713 = $711;
  20889. }
  20890. $712 = (($tbase$245$i) + ($713)|0);
  20891. $$sum102$i = (($tsize$244$i) + 8)|0;
  20892. $714 = (($tbase$245$i) + ($$sum102$i)|0);
  20893. $715 = $714;
  20894. $716 = $715 & 7;
  20895. $717 = ($716|0)==(0);
  20896. if ($717) {
  20897. $720 = 0;
  20898. } else {
  20899. $718 = (0 - ($715))|0;
  20900. $719 = $718 & 7;
  20901. $720 = $719;
  20902. }
  20903. $$sum103$i = (($720) + ($tsize$244$i))|0;
  20904. $721 = (($tbase$245$i) + ($$sum103$i)|0);
  20905. $722 = $721;
  20906. $723 = $712;
  20907. $724 = (($722) - ($723))|0;
  20908. $$sum$i19$i = (($713) + ($nb$0))|0;
  20909. $725 = (($tbase$245$i) + ($$sum$i19$i)|0);
  20910. $726 = (($724) - ($nb$0))|0;
  20911. $727 = $nb$0 | 3;
  20912. $$sum1$i20$i = (($713) + 4)|0;
  20913. $728 = (($tbase$245$i) + ($$sum1$i20$i)|0);
  20914. HEAP32[$728>>2] = $727;
  20915. $729 = ($721|0)==($636|0);
  20916. L345: do {
  20917. if ($729) {
  20918. $730 = HEAP32[((32544 + 12|0))>>2]|0;
  20919. $731 = (($730) + ($726))|0;
  20920. HEAP32[((32544 + 12|0))>>2] = $731;
  20921. HEAP32[((32544 + 24|0))>>2] = $725;
  20922. $732 = $731 | 1;
  20923. $$sum42$i$i = (($$sum$i19$i) + 4)|0;
  20924. $733 = (($tbase$245$i) + ($$sum42$i$i)|0);
  20925. HEAP32[$733>>2] = $732;
  20926. } else {
  20927. $734 = HEAP32[((32544 + 20|0))>>2]|0;
  20928. $735 = ($721|0)==($734|0);
  20929. if ($735) {
  20930. $736 = HEAP32[((32544 + 8|0))>>2]|0;
  20931. $737 = (($736) + ($726))|0;
  20932. HEAP32[((32544 + 8|0))>>2] = $737;
  20933. HEAP32[((32544 + 20|0))>>2] = $725;
  20934. $738 = $737 | 1;
  20935. $$sum40$i$i = (($$sum$i19$i) + 4)|0;
  20936. $739 = (($tbase$245$i) + ($$sum40$i$i)|0);
  20937. HEAP32[$739>>2] = $738;
  20938. $$sum41$i$i = (($737) + ($$sum$i19$i))|0;
  20939. $740 = (($tbase$245$i) + ($$sum41$i$i)|0);
  20940. HEAP32[$740>>2] = $737;
  20941. break;
  20942. }
  20943. $$sum2$i21$i = (($tsize$244$i) + 4)|0;
  20944. $$sum104$i = (($$sum2$i21$i) + ($720))|0;
  20945. $741 = (($tbase$245$i) + ($$sum104$i)|0);
  20946. $742 = HEAP32[$741>>2]|0;
  20947. $743 = $742 & 3;
  20948. $744 = ($743|0)==(1);
  20949. if ($744) {
  20950. $745 = $742 & -8;
  20951. $746 = $742 >>> 3;
  20952. $747 = ($742>>>0)<(256);
  20953. L353: do {
  20954. if ($747) {
  20955. $$sum3738$i$i = $720 | 8;
  20956. $$sum114$i = (($$sum3738$i$i) + ($tsize$244$i))|0;
  20957. $748 = (($tbase$245$i) + ($$sum114$i)|0);
  20958. $749 = HEAP32[$748>>2]|0;
  20959. $$sum39$i$i = (($tsize$244$i) + 12)|0;
  20960. $$sum115$i = (($$sum39$i$i) + ($720))|0;
  20961. $750 = (($tbase$245$i) + ($$sum115$i)|0);
  20962. $751 = HEAP32[$750>>2]|0;
  20963. $752 = $746 << 1;
  20964. $753 = ((32544 + ($752<<2)|0) + 40|0);
  20965. $754 = ($749|0)==($753|0);
  20966. do {
  20967. if (!($754)) {
  20968. $755 = ($749>>>0)<($756>>>0);
  20969. if ($755) {
  20970. _abort();
  20971. // unreachable;
  20972. }
  20973. $757 = (($749) + 12|0);
  20974. $758 = HEAP32[$757>>2]|0;
  20975. $759 = ($758|0)==($721|0);
  20976. if ($759) {
  20977. break;
  20978. }
  20979. _abort();
  20980. // unreachable;
  20981. }
  20982. } while(0);
  20983. $760 = ($751|0)==($749|0);
  20984. if ($760) {
  20985. $761 = 1 << $746;
  20986. $762 = $761 ^ -1;
  20987. $763 = HEAP32[32544>>2]|0;
  20988. $764 = $763 & $762;
  20989. HEAP32[32544>>2] = $764;
  20990. break;
  20991. }
  20992. $765 = ($751|0)==($753|0);
  20993. do {
  20994. if ($765) {
  20995. $$pre58$i$i = (($751) + 8|0);
  20996. $$pre$phi59$i$iZ2D = $$pre58$i$i;
  20997. } else {
  20998. $766 = ($751>>>0)<($756>>>0);
  20999. if ($766) {
  21000. _abort();
  21001. // unreachable;
  21002. }
  21003. $767 = (($751) + 8|0);
  21004. $768 = HEAP32[$767>>2]|0;
  21005. $769 = ($768|0)==($721|0);
  21006. if ($769) {
  21007. $$pre$phi59$i$iZ2D = $767;
  21008. break;
  21009. }
  21010. _abort();
  21011. // unreachable;
  21012. }
  21013. } while(0);
  21014. $770 = (($749) + 12|0);
  21015. HEAP32[$770>>2] = $751;
  21016. HEAP32[$$pre$phi59$i$iZ2D>>2] = $749;
  21017. } else {
  21018. $$sum34$i$i = $720 | 24;
  21019. $$sum105$i = (($$sum34$i$i) + ($tsize$244$i))|0;
  21020. $771 = (($tbase$245$i) + ($$sum105$i)|0);
  21021. $772 = HEAP32[$771>>2]|0;
  21022. $$sum5$i$i = (($tsize$244$i) + 12)|0;
  21023. $$sum106$i = (($$sum5$i$i) + ($720))|0;
  21024. $773 = (($tbase$245$i) + ($$sum106$i)|0);
  21025. $774 = HEAP32[$773>>2]|0;
  21026. $775 = ($774|0)==($721|0);
  21027. do {
  21028. if ($775) {
  21029. $$sum67$i$i = $720 | 16;
  21030. $$sum112$i = (($$sum2$i21$i) + ($$sum67$i$i))|0;
  21031. $785 = (($tbase$245$i) + ($$sum112$i)|0);
  21032. $786 = HEAP32[$785>>2]|0;
  21033. $787 = ($786|0)==(0|0);
  21034. if ($787) {
  21035. $$sum113$i = (($$sum67$i$i) + ($tsize$244$i))|0;
  21036. $788 = (($tbase$245$i) + ($$sum113$i)|0);
  21037. $789 = HEAP32[$788>>2]|0;
  21038. $790 = ($789|0)==(0|0);
  21039. if ($790) {
  21040. $R$1$i$i = 0;
  21041. break;
  21042. } else {
  21043. $R$0$i$i = $789;$RP$0$i$i = $788;
  21044. }
  21045. } else {
  21046. $R$0$i$i = $786;$RP$0$i$i = $785;
  21047. }
  21048. while(1) {
  21049. $791 = (($R$0$i$i) + 20|0);
  21050. $792 = HEAP32[$791>>2]|0;
  21051. $793 = ($792|0)==(0|0);
  21052. if (!($793)) {
  21053. $R$0$i$i = $792;$RP$0$i$i = $791;
  21054. continue;
  21055. }
  21056. $794 = (($R$0$i$i) + 16|0);
  21057. $795 = HEAP32[$794>>2]|0;
  21058. $796 = ($795|0)==(0|0);
  21059. if ($796) {
  21060. break;
  21061. } else {
  21062. $R$0$i$i = $795;$RP$0$i$i = $794;
  21063. }
  21064. }
  21065. $797 = ($RP$0$i$i>>>0)<($756>>>0);
  21066. if ($797) {
  21067. _abort();
  21068. // unreachable;
  21069. } else {
  21070. HEAP32[$RP$0$i$i>>2] = 0;
  21071. $R$1$i$i = $R$0$i$i;
  21072. break;
  21073. }
  21074. } else {
  21075. $$sum3536$i$i = $720 | 8;
  21076. $$sum107$i = (($$sum3536$i$i) + ($tsize$244$i))|0;
  21077. $776 = (($tbase$245$i) + ($$sum107$i)|0);
  21078. $777 = HEAP32[$776>>2]|0;
  21079. $778 = ($777>>>0)<($756>>>0);
  21080. if ($778) {
  21081. _abort();
  21082. // unreachable;
  21083. }
  21084. $779 = (($777) + 12|0);
  21085. $780 = HEAP32[$779>>2]|0;
  21086. $781 = ($780|0)==($721|0);
  21087. if (!($781)) {
  21088. _abort();
  21089. // unreachable;
  21090. }
  21091. $782 = (($774) + 8|0);
  21092. $783 = HEAP32[$782>>2]|0;
  21093. $784 = ($783|0)==($721|0);
  21094. if ($784) {
  21095. HEAP32[$779>>2] = $774;
  21096. HEAP32[$782>>2] = $777;
  21097. $R$1$i$i = $774;
  21098. break;
  21099. } else {
  21100. _abort();
  21101. // unreachable;
  21102. }
  21103. }
  21104. } while(0);
  21105. $798 = ($772|0)==(0|0);
  21106. if ($798) {
  21107. break;
  21108. }
  21109. $$sum30$i$i = (($tsize$244$i) + 28)|0;
  21110. $$sum108$i = (($$sum30$i$i) + ($720))|0;
  21111. $799 = (($tbase$245$i) + ($$sum108$i)|0);
  21112. $800 = HEAP32[$799>>2]|0;
  21113. $801 = ((32544 + ($800<<2)|0) + 304|0);
  21114. $802 = HEAP32[$801>>2]|0;
  21115. $803 = ($721|0)==($802|0);
  21116. do {
  21117. if ($803) {
  21118. HEAP32[$801>>2] = $R$1$i$i;
  21119. $cond$i$i = ($R$1$i$i|0)==(0|0);
  21120. if (!($cond$i$i)) {
  21121. break;
  21122. }
  21123. $804 = 1 << $800;
  21124. $805 = $804 ^ -1;
  21125. $806 = HEAP32[((32544 + 4|0))>>2]|0;
  21126. $807 = $806 & $805;
  21127. HEAP32[((32544 + 4|0))>>2] = $807;
  21128. break L353;
  21129. } else {
  21130. $808 = HEAP32[((32544 + 16|0))>>2]|0;
  21131. $809 = ($772>>>0)<($808>>>0);
  21132. if ($809) {
  21133. _abort();
  21134. // unreachable;
  21135. }
  21136. $810 = (($772) + 16|0);
  21137. $811 = HEAP32[$810>>2]|0;
  21138. $812 = ($811|0)==($721|0);
  21139. if ($812) {
  21140. HEAP32[$810>>2] = $R$1$i$i;
  21141. } else {
  21142. $813 = (($772) + 20|0);
  21143. HEAP32[$813>>2] = $R$1$i$i;
  21144. }
  21145. $814 = ($R$1$i$i|0)==(0|0);
  21146. if ($814) {
  21147. break L353;
  21148. }
  21149. }
  21150. } while(0);
  21151. $815 = HEAP32[((32544 + 16|0))>>2]|0;
  21152. $816 = ($R$1$i$i>>>0)<($815>>>0);
  21153. if ($816) {
  21154. _abort();
  21155. // unreachable;
  21156. }
  21157. $817 = (($R$1$i$i) + 24|0);
  21158. HEAP32[$817>>2] = $772;
  21159. $$sum3132$i$i = $720 | 16;
  21160. $$sum109$i = (($$sum3132$i$i) + ($tsize$244$i))|0;
  21161. $818 = (($tbase$245$i) + ($$sum109$i)|0);
  21162. $819 = HEAP32[$818>>2]|0;
  21163. $820 = ($819|0)==(0|0);
  21164. do {
  21165. if (!($820)) {
  21166. $821 = ($819>>>0)<($815>>>0);
  21167. if ($821) {
  21168. _abort();
  21169. // unreachable;
  21170. } else {
  21171. $822 = (($R$1$i$i) + 16|0);
  21172. HEAP32[$822>>2] = $819;
  21173. $823 = (($819) + 24|0);
  21174. HEAP32[$823>>2] = $R$1$i$i;
  21175. break;
  21176. }
  21177. }
  21178. } while(0);
  21179. $$sum110$i = (($$sum2$i21$i) + ($$sum3132$i$i))|0;
  21180. $824 = (($tbase$245$i) + ($$sum110$i)|0);
  21181. $825 = HEAP32[$824>>2]|0;
  21182. $826 = ($825|0)==(0|0);
  21183. if ($826) {
  21184. break;
  21185. }
  21186. $827 = HEAP32[((32544 + 16|0))>>2]|0;
  21187. $828 = ($825>>>0)<($827>>>0);
  21188. if ($828) {
  21189. _abort();
  21190. // unreachable;
  21191. } else {
  21192. $829 = (($R$1$i$i) + 20|0);
  21193. HEAP32[$829>>2] = $825;
  21194. $830 = (($825) + 24|0);
  21195. HEAP32[$830>>2] = $R$1$i$i;
  21196. break;
  21197. }
  21198. }
  21199. } while(0);
  21200. $$sum9$i$i = $745 | $720;
  21201. $$sum111$i = (($$sum9$i$i) + ($tsize$244$i))|0;
  21202. $831 = (($tbase$245$i) + ($$sum111$i)|0);
  21203. $832 = (($745) + ($726))|0;
  21204. $oldfirst$0$i$i = $831;$qsize$0$i$i = $832;
  21205. } else {
  21206. $oldfirst$0$i$i = $721;$qsize$0$i$i = $726;
  21207. }
  21208. $833 = (($oldfirst$0$i$i) + 4|0);
  21209. $834 = HEAP32[$833>>2]|0;
  21210. $835 = $834 & -2;
  21211. HEAP32[$833>>2] = $835;
  21212. $836 = $qsize$0$i$i | 1;
  21213. $$sum10$i$i = (($$sum$i19$i) + 4)|0;
  21214. $837 = (($tbase$245$i) + ($$sum10$i$i)|0);
  21215. HEAP32[$837>>2] = $836;
  21216. $$sum11$i22$i = (($qsize$0$i$i) + ($$sum$i19$i))|0;
  21217. $838 = (($tbase$245$i) + ($$sum11$i22$i)|0);
  21218. HEAP32[$838>>2] = $qsize$0$i$i;
  21219. $839 = $qsize$0$i$i >>> 3;
  21220. $840 = ($qsize$0$i$i>>>0)<(256);
  21221. if ($840) {
  21222. $841 = $839 << 1;
  21223. $842 = ((32544 + ($841<<2)|0) + 40|0);
  21224. $843 = HEAP32[32544>>2]|0;
  21225. $844 = 1 << $839;
  21226. $845 = $843 & $844;
  21227. $846 = ($845|0)==(0);
  21228. do {
  21229. if ($846) {
  21230. $847 = $843 | $844;
  21231. HEAP32[32544>>2] = $847;
  21232. $$sum26$pre$i$i = (($841) + 2)|0;
  21233. $$pre$i23$i = ((32544 + ($$sum26$pre$i$i<<2)|0) + 40|0);
  21234. $$pre$phi$i24$iZ2D = $$pre$i23$i;$F4$0$i$i = $842;
  21235. } else {
  21236. $$sum29$i$i = (($841) + 2)|0;
  21237. $848 = ((32544 + ($$sum29$i$i<<2)|0) + 40|0);
  21238. $849 = HEAP32[$848>>2]|0;
  21239. $850 = HEAP32[((32544 + 16|0))>>2]|0;
  21240. $851 = ($849>>>0)<($850>>>0);
  21241. if (!($851)) {
  21242. $$pre$phi$i24$iZ2D = $848;$F4$0$i$i = $849;
  21243. break;
  21244. }
  21245. _abort();
  21246. // unreachable;
  21247. }
  21248. } while(0);
  21249. HEAP32[$$pre$phi$i24$iZ2D>>2] = $725;
  21250. $852 = (($F4$0$i$i) + 12|0);
  21251. HEAP32[$852>>2] = $725;
  21252. $$sum27$i$i = (($$sum$i19$i) + 8)|0;
  21253. $853 = (($tbase$245$i) + ($$sum27$i$i)|0);
  21254. HEAP32[$853>>2] = $F4$0$i$i;
  21255. $$sum28$i$i = (($$sum$i19$i) + 12)|0;
  21256. $854 = (($tbase$245$i) + ($$sum28$i$i)|0);
  21257. HEAP32[$854>>2] = $842;
  21258. break;
  21259. }
  21260. $855 = $qsize$0$i$i >>> 8;
  21261. $856 = ($855|0)==(0);
  21262. do {
  21263. if ($856) {
  21264. $I7$0$i$i = 0;
  21265. } else {
  21266. $857 = ($qsize$0$i$i>>>0)>(16777215);
  21267. if ($857) {
  21268. $I7$0$i$i = 31;
  21269. break;
  21270. }
  21271. $858 = (($855) + 1048320)|0;
  21272. $859 = $858 >>> 16;
  21273. $860 = $859 & 8;
  21274. $861 = $855 << $860;
  21275. $862 = (($861) + 520192)|0;
  21276. $863 = $862 >>> 16;
  21277. $864 = $863 & 4;
  21278. $865 = $864 | $860;
  21279. $866 = $861 << $864;
  21280. $867 = (($866) + 245760)|0;
  21281. $868 = $867 >>> 16;
  21282. $869 = $868 & 2;
  21283. $870 = $865 | $869;
  21284. $871 = (14 - ($870))|0;
  21285. $872 = $866 << $869;
  21286. $873 = $872 >>> 15;
  21287. $874 = (($871) + ($873))|0;
  21288. $875 = $874 << 1;
  21289. $876 = (($874) + 7)|0;
  21290. $877 = $qsize$0$i$i >>> $876;
  21291. $878 = $877 & 1;
  21292. $879 = $878 | $875;
  21293. $I7$0$i$i = $879;
  21294. }
  21295. } while(0);
  21296. $880 = ((32544 + ($I7$0$i$i<<2)|0) + 304|0);
  21297. $$sum12$i$i = (($$sum$i19$i) + 28)|0;
  21298. $881 = (($tbase$245$i) + ($$sum12$i$i)|0);
  21299. HEAP32[$881>>2] = $I7$0$i$i;
  21300. $$sum13$i$i = (($$sum$i19$i) + 16)|0;
  21301. $882 = (($tbase$245$i) + ($$sum13$i$i)|0);
  21302. $$sum14$i$i = (($$sum$i19$i) + 20)|0;
  21303. $883 = (($tbase$245$i) + ($$sum14$i$i)|0);
  21304. HEAP32[$883>>2] = 0;
  21305. HEAP32[$882>>2] = 0;
  21306. $884 = HEAP32[((32544 + 4|0))>>2]|0;
  21307. $885 = 1 << $I7$0$i$i;
  21308. $886 = $884 & $885;
  21309. $887 = ($886|0)==(0);
  21310. if ($887) {
  21311. $888 = $884 | $885;
  21312. HEAP32[((32544 + 4|0))>>2] = $888;
  21313. HEAP32[$880>>2] = $725;
  21314. $$sum15$i$i = (($$sum$i19$i) + 24)|0;
  21315. $889 = (($tbase$245$i) + ($$sum15$i$i)|0);
  21316. HEAP32[$889>>2] = $880;
  21317. $$sum16$i$i = (($$sum$i19$i) + 12)|0;
  21318. $890 = (($tbase$245$i) + ($$sum16$i$i)|0);
  21319. HEAP32[$890>>2] = $725;
  21320. $$sum17$i$i = (($$sum$i19$i) + 8)|0;
  21321. $891 = (($tbase$245$i) + ($$sum17$i$i)|0);
  21322. HEAP32[$891>>2] = $725;
  21323. break;
  21324. }
  21325. $892 = HEAP32[$880>>2]|0;
  21326. $893 = ($I7$0$i$i|0)==(31);
  21327. if ($893) {
  21328. $901 = 0;
  21329. } else {
  21330. $894 = $I7$0$i$i >>> 1;
  21331. $895 = (25 - ($894))|0;
  21332. $901 = $895;
  21333. }
  21334. $896 = (($892) + 4|0);
  21335. $897 = HEAP32[$896>>2]|0;
  21336. $898 = $897 & -8;
  21337. $899 = ($898|0)==($qsize$0$i$i|0);
  21338. L442: do {
  21339. if ($899) {
  21340. $T$0$lcssa$i26$i = $892;
  21341. } else {
  21342. $900 = $qsize$0$i$i << $901;
  21343. $K8$053$i$i = $900;$T$052$i$i = $892;
  21344. while(1) {
  21345. $908 = $K8$053$i$i >>> 31;
  21346. $909 = ((($T$052$i$i) + ($908<<2)|0) + 16|0);
  21347. $904 = HEAP32[$909>>2]|0;
  21348. $910 = ($904|0)==(0|0);
  21349. if ($910) {
  21350. break;
  21351. }
  21352. $902 = $K8$053$i$i << 1;
  21353. $903 = (($904) + 4|0);
  21354. $905 = HEAP32[$903>>2]|0;
  21355. $906 = $905 & -8;
  21356. $907 = ($906|0)==($qsize$0$i$i|0);
  21357. if ($907) {
  21358. $T$0$lcssa$i26$i = $904;
  21359. break L442;
  21360. } else {
  21361. $K8$053$i$i = $902;$T$052$i$i = $904;
  21362. }
  21363. }
  21364. $911 = HEAP32[((32544 + 16|0))>>2]|0;
  21365. $912 = ($909>>>0)<($911>>>0);
  21366. if ($912) {
  21367. _abort();
  21368. // unreachable;
  21369. } else {
  21370. HEAP32[$909>>2] = $725;
  21371. $$sum23$i$i = (($$sum$i19$i) + 24)|0;
  21372. $913 = (($tbase$245$i) + ($$sum23$i$i)|0);
  21373. HEAP32[$913>>2] = $T$052$i$i;
  21374. $$sum24$i$i = (($$sum$i19$i) + 12)|0;
  21375. $914 = (($tbase$245$i) + ($$sum24$i$i)|0);
  21376. HEAP32[$914>>2] = $725;
  21377. $$sum25$i$i = (($$sum$i19$i) + 8)|0;
  21378. $915 = (($tbase$245$i) + ($$sum25$i$i)|0);
  21379. HEAP32[$915>>2] = $725;
  21380. break L345;
  21381. }
  21382. }
  21383. } while(0);
  21384. $916 = (($T$0$lcssa$i26$i) + 8|0);
  21385. $917 = HEAP32[$916>>2]|0;
  21386. $918 = HEAP32[((32544 + 16|0))>>2]|0;
  21387. $919 = ($T$0$lcssa$i26$i>>>0)>=($918>>>0);
  21388. $920 = ($917>>>0)>=($918>>>0);
  21389. $or$cond$i27$i = $919 & $920;
  21390. if ($or$cond$i27$i) {
  21391. $921 = (($917) + 12|0);
  21392. HEAP32[$921>>2] = $725;
  21393. HEAP32[$916>>2] = $725;
  21394. $$sum20$i$i = (($$sum$i19$i) + 8)|0;
  21395. $922 = (($tbase$245$i) + ($$sum20$i$i)|0);
  21396. HEAP32[$922>>2] = $917;
  21397. $$sum21$i$i = (($$sum$i19$i) + 12)|0;
  21398. $923 = (($tbase$245$i) + ($$sum21$i$i)|0);
  21399. HEAP32[$923>>2] = $T$0$lcssa$i26$i;
  21400. $$sum22$i$i = (($$sum$i19$i) + 24)|0;
  21401. $924 = (($tbase$245$i) + ($$sum22$i$i)|0);
  21402. HEAP32[$924>>2] = 0;
  21403. break;
  21404. } else {
  21405. _abort();
  21406. // unreachable;
  21407. }
  21408. }
  21409. } while(0);
  21410. $$sum1819$i$i = $713 | 8;
  21411. $925 = (($tbase$245$i) + ($$sum1819$i$i)|0);
  21412. $mem$0 = $925;
  21413. STACKTOP = sp;return ($mem$0|0);
  21414. }
  21415. }
  21416. $sp$0$i$i$i = ((32544 + 448|0));
  21417. while(1) {
  21418. $926 = HEAP32[$sp$0$i$i$i>>2]|0;
  21419. $927 = ($926>>>0)>($636>>>0);
  21420. if (!($927)) {
  21421. $928 = (($sp$0$i$i$i) + 4|0);
  21422. $929 = HEAP32[$928>>2]|0;
  21423. $930 = (($926) + ($929)|0);
  21424. $931 = ($930>>>0)>($636>>>0);
  21425. if ($931) {
  21426. break;
  21427. }
  21428. }
  21429. $932 = (($sp$0$i$i$i) + 8|0);
  21430. $933 = HEAP32[$932>>2]|0;
  21431. $sp$0$i$i$i = $933;
  21432. }
  21433. $$sum$i13$i = (($929) + -47)|0;
  21434. $$sum1$i14$i = (($929) + -39)|0;
  21435. $934 = (($926) + ($$sum1$i14$i)|0);
  21436. $935 = $934;
  21437. $936 = $935 & 7;
  21438. $937 = ($936|0)==(0);
  21439. if ($937) {
  21440. $940 = 0;
  21441. } else {
  21442. $938 = (0 - ($935))|0;
  21443. $939 = $938 & 7;
  21444. $940 = $939;
  21445. }
  21446. $$sum2$i15$i = (($$sum$i13$i) + ($940))|0;
  21447. $941 = (($926) + ($$sum2$i15$i)|0);
  21448. $942 = (($636) + 16|0);
  21449. $943 = ($941>>>0)<($942>>>0);
  21450. $944 = $943 ? $636 : $941;
  21451. $945 = (($944) + 8|0);
  21452. $946 = (($tsize$244$i) + -40)|0;
  21453. $947 = (($tbase$245$i) + 8|0);
  21454. $948 = $947;
  21455. $949 = $948 & 7;
  21456. $950 = ($949|0)==(0);
  21457. if ($950) {
  21458. $954 = 0;
  21459. } else {
  21460. $951 = (0 - ($948))|0;
  21461. $952 = $951 & 7;
  21462. $954 = $952;
  21463. }
  21464. $953 = (($tbase$245$i) + ($954)|0);
  21465. $955 = (($946) - ($954))|0;
  21466. HEAP32[((32544 + 24|0))>>2] = $953;
  21467. HEAP32[((32544 + 12|0))>>2] = $955;
  21468. $956 = $955 | 1;
  21469. $$sum$i$i$i = (($954) + 4)|0;
  21470. $957 = (($tbase$245$i) + ($$sum$i$i$i)|0);
  21471. HEAP32[$957>>2] = $956;
  21472. $$sum2$i$i$i = (($tsize$244$i) + -36)|0;
  21473. $958 = (($tbase$245$i) + ($$sum2$i$i$i)|0);
  21474. HEAP32[$958>>2] = 40;
  21475. $959 = HEAP32[((33016 + 16|0))>>2]|0;
  21476. HEAP32[((32544 + 28|0))>>2] = $959;
  21477. $960 = (($944) + 4|0);
  21478. HEAP32[$960>>2] = 27;
  21479. ;HEAP32[$945+0>>2]=HEAP32[((32544 + 448|0))+0>>2]|0;HEAP32[$945+4>>2]=HEAP32[((32544 + 448|0))+4>>2]|0;HEAP32[$945+8>>2]=HEAP32[((32544 + 448|0))+8>>2]|0;HEAP32[$945+12>>2]=HEAP32[((32544 + 448|0))+12>>2]|0;
  21480. HEAP32[((32544 + 448|0))>>2] = $tbase$245$i;
  21481. HEAP32[((32544 + 452|0))>>2] = $tsize$244$i;
  21482. HEAP32[((32544 + 460|0))>>2] = 0;
  21483. HEAP32[((32544 + 456|0))>>2] = $945;
  21484. $961 = (($944) + 28|0);
  21485. HEAP32[$961>>2] = 7;
  21486. $962 = (($944) + 32|0);
  21487. $963 = ($962>>>0)<($930>>>0);
  21488. if ($963) {
  21489. $965 = $961;
  21490. while(1) {
  21491. $964 = (($965) + 4|0);
  21492. HEAP32[$964>>2] = 7;
  21493. $966 = (($965) + 8|0);
  21494. $967 = ($966>>>0)<($930>>>0);
  21495. if ($967) {
  21496. $965 = $964;
  21497. } else {
  21498. break;
  21499. }
  21500. }
  21501. }
  21502. $968 = ($944|0)==($636|0);
  21503. if (!($968)) {
  21504. $969 = $944;
  21505. $970 = $636;
  21506. $971 = (($969) - ($970))|0;
  21507. $972 = (($636) + ($971)|0);
  21508. $$sum3$i$i = (($971) + 4)|0;
  21509. $973 = (($636) + ($$sum3$i$i)|0);
  21510. $974 = HEAP32[$973>>2]|0;
  21511. $975 = $974 & -2;
  21512. HEAP32[$973>>2] = $975;
  21513. $976 = $971 | 1;
  21514. $977 = (($636) + 4|0);
  21515. HEAP32[$977>>2] = $976;
  21516. HEAP32[$972>>2] = $971;
  21517. $978 = $971 >>> 3;
  21518. $979 = ($971>>>0)<(256);
  21519. if ($979) {
  21520. $980 = $978 << 1;
  21521. $981 = ((32544 + ($980<<2)|0) + 40|0);
  21522. $982 = HEAP32[32544>>2]|0;
  21523. $983 = 1 << $978;
  21524. $984 = $982 & $983;
  21525. $985 = ($984|0)==(0);
  21526. do {
  21527. if ($985) {
  21528. $986 = $982 | $983;
  21529. HEAP32[32544>>2] = $986;
  21530. $$sum10$pre$i$i = (($980) + 2)|0;
  21531. $$pre$i$i = ((32544 + ($$sum10$pre$i$i<<2)|0) + 40|0);
  21532. $$pre$phi$i$iZ2D = $$pre$i$i;$F$0$i$i = $981;
  21533. } else {
  21534. $$sum11$i$i = (($980) + 2)|0;
  21535. $987 = ((32544 + ($$sum11$i$i<<2)|0) + 40|0);
  21536. $988 = HEAP32[$987>>2]|0;
  21537. $989 = HEAP32[((32544 + 16|0))>>2]|0;
  21538. $990 = ($988>>>0)<($989>>>0);
  21539. if (!($990)) {
  21540. $$pre$phi$i$iZ2D = $987;$F$0$i$i = $988;
  21541. break;
  21542. }
  21543. _abort();
  21544. // unreachable;
  21545. }
  21546. } while(0);
  21547. HEAP32[$$pre$phi$i$iZ2D>>2] = $636;
  21548. $991 = (($F$0$i$i) + 12|0);
  21549. HEAP32[$991>>2] = $636;
  21550. $992 = (($636) + 8|0);
  21551. HEAP32[$992>>2] = $F$0$i$i;
  21552. $993 = (($636) + 12|0);
  21553. HEAP32[$993>>2] = $981;
  21554. break;
  21555. }
  21556. $994 = $971 >>> 8;
  21557. $995 = ($994|0)==(0);
  21558. if ($995) {
  21559. $I1$0$i$i = 0;
  21560. } else {
  21561. $996 = ($971>>>0)>(16777215);
  21562. if ($996) {
  21563. $I1$0$i$i = 31;
  21564. } else {
  21565. $997 = (($994) + 1048320)|0;
  21566. $998 = $997 >>> 16;
  21567. $999 = $998 & 8;
  21568. $1000 = $994 << $999;
  21569. $1001 = (($1000) + 520192)|0;
  21570. $1002 = $1001 >>> 16;
  21571. $1003 = $1002 & 4;
  21572. $1004 = $1003 | $999;
  21573. $1005 = $1000 << $1003;
  21574. $1006 = (($1005) + 245760)|0;
  21575. $1007 = $1006 >>> 16;
  21576. $1008 = $1007 & 2;
  21577. $1009 = $1004 | $1008;
  21578. $1010 = (14 - ($1009))|0;
  21579. $1011 = $1005 << $1008;
  21580. $1012 = $1011 >>> 15;
  21581. $1013 = (($1010) + ($1012))|0;
  21582. $1014 = $1013 << 1;
  21583. $1015 = (($1013) + 7)|0;
  21584. $1016 = $971 >>> $1015;
  21585. $1017 = $1016 & 1;
  21586. $1018 = $1017 | $1014;
  21587. $I1$0$i$i = $1018;
  21588. }
  21589. }
  21590. $1019 = ((32544 + ($I1$0$i$i<<2)|0) + 304|0);
  21591. $1020 = (($636) + 28|0);
  21592. $I1$0$c$i$i = $I1$0$i$i;
  21593. HEAP32[$1020>>2] = $I1$0$c$i$i;
  21594. $1021 = (($636) + 20|0);
  21595. HEAP32[$1021>>2] = 0;
  21596. $1022 = (($636) + 16|0);
  21597. HEAP32[$1022>>2] = 0;
  21598. $1023 = HEAP32[((32544 + 4|0))>>2]|0;
  21599. $1024 = 1 << $I1$0$i$i;
  21600. $1025 = $1023 & $1024;
  21601. $1026 = ($1025|0)==(0);
  21602. if ($1026) {
  21603. $1027 = $1023 | $1024;
  21604. HEAP32[((32544 + 4|0))>>2] = $1027;
  21605. HEAP32[$1019>>2] = $636;
  21606. $1028 = (($636) + 24|0);
  21607. HEAP32[$1028>>2] = $1019;
  21608. $1029 = (($636) + 12|0);
  21609. HEAP32[$1029>>2] = $636;
  21610. $1030 = (($636) + 8|0);
  21611. HEAP32[$1030>>2] = $636;
  21612. break;
  21613. }
  21614. $1031 = HEAP32[$1019>>2]|0;
  21615. $1032 = ($I1$0$i$i|0)==(31);
  21616. if ($1032) {
  21617. $1040 = 0;
  21618. } else {
  21619. $1033 = $I1$0$i$i >>> 1;
  21620. $1034 = (25 - ($1033))|0;
  21621. $1040 = $1034;
  21622. }
  21623. $1035 = (($1031) + 4|0);
  21624. $1036 = HEAP32[$1035>>2]|0;
  21625. $1037 = $1036 & -8;
  21626. $1038 = ($1037|0)==($971|0);
  21627. L493: do {
  21628. if ($1038) {
  21629. $T$0$lcssa$i$i = $1031;
  21630. } else {
  21631. $1039 = $971 << $1040;
  21632. $K2$015$i$i = $1039;$T$014$i$i = $1031;
  21633. while(1) {
  21634. $1047 = $K2$015$i$i >>> 31;
  21635. $1048 = ((($T$014$i$i) + ($1047<<2)|0) + 16|0);
  21636. $1043 = HEAP32[$1048>>2]|0;
  21637. $1049 = ($1043|0)==(0|0);
  21638. if ($1049) {
  21639. break;
  21640. }
  21641. $1041 = $K2$015$i$i << 1;
  21642. $1042 = (($1043) + 4|0);
  21643. $1044 = HEAP32[$1042>>2]|0;
  21644. $1045 = $1044 & -8;
  21645. $1046 = ($1045|0)==($971|0);
  21646. if ($1046) {
  21647. $T$0$lcssa$i$i = $1043;
  21648. break L493;
  21649. } else {
  21650. $K2$015$i$i = $1041;$T$014$i$i = $1043;
  21651. }
  21652. }
  21653. $1050 = HEAP32[((32544 + 16|0))>>2]|0;
  21654. $1051 = ($1048>>>0)<($1050>>>0);
  21655. if ($1051) {
  21656. _abort();
  21657. // unreachable;
  21658. } else {
  21659. HEAP32[$1048>>2] = $636;
  21660. $1052 = (($636) + 24|0);
  21661. HEAP32[$1052>>2] = $T$014$i$i;
  21662. $1053 = (($636) + 12|0);
  21663. HEAP32[$1053>>2] = $636;
  21664. $1054 = (($636) + 8|0);
  21665. HEAP32[$1054>>2] = $636;
  21666. break L308;
  21667. }
  21668. }
  21669. } while(0);
  21670. $1055 = (($T$0$lcssa$i$i) + 8|0);
  21671. $1056 = HEAP32[$1055>>2]|0;
  21672. $1057 = HEAP32[((32544 + 16|0))>>2]|0;
  21673. $1058 = ($T$0$lcssa$i$i>>>0)>=($1057>>>0);
  21674. $1059 = ($1056>>>0)>=($1057>>>0);
  21675. $or$cond$i$i = $1058 & $1059;
  21676. if ($or$cond$i$i) {
  21677. $1060 = (($1056) + 12|0);
  21678. HEAP32[$1060>>2] = $636;
  21679. HEAP32[$1055>>2] = $636;
  21680. $1061 = (($636) + 8|0);
  21681. HEAP32[$1061>>2] = $1056;
  21682. $1062 = (($636) + 12|0);
  21683. HEAP32[$1062>>2] = $T$0$lcssa$i$i;
  21684. $1063 = (($636) + 24|0);
  21685. HEAP32[$1063>>2] = 0;
  21686. break;
  21687. } else {
  21688. _abort();
  21689. // unreachable;
  21690. }
  21691. }
  21692. }
  21693. } while(0);
  21694. $1064 = HEAP32[((32544 + 12|0))>>2]|0;
  21695. $1065 = ($1064>>>0)>($nb$0>>>0);
  21696. if ($1065) {
  21697. $1066 = (($1064) - ($nb$0))|0;
  21698. HEAP32[((32544 + 12|0))>>2] = $1066;
  21699. $1067 = HEAP32[((32544 + 24|0))>>2]|0;
  21700. $1068 = (($1067) + ($nb$0)|0);
  21701. HEAP32[((32544 + 24|0))>>2] = $1068;
  21702. $1069 = $1066 | 1;
  21703. $$sum$i32 = (($nb$0) + 4)|0;
  21704. $1070 = (($1067) + ($$sum$i32)|0);
  21705. HEAP32[$1070>>2] = $1069;
  21706. $1071 = $nb$0 | 3;
  21707. $1072 = (($1067) + 4|0);
  21708. HEAP32[$1072>>2] = $1071;
  21709. $1073 = (($1067) + 8|0);
  21710. $mem$0 = $1073;
  21711. STACKTOP = sp;return ($mem$0|0);
  21712. }
  21713. }
  21714. $1074 = (___errno_location()|0);
  21715. HEAP32[$1074>>2] = 12;
  21716. $mem$0 = 0;
  21717. STACKTOP = sp;return ($mem$0|0);
  21718. }
  21719. function _free($mem) {
  21720. $mem = $mem|0;
  21721. var $$pre = 0, $$pre$phi66Z2D = 0, $$pre$phi68Z2D = 0, $$pre$phiZ2D = 0, $$pre65 = 0, $$pre67 = 0, $$sum = 0, $$sum16$pre = 0, $$sum17 = 0, $$sum18 = 0, $$sum19 = 0, $$sum2 = 0, $$sum20 = 0, $$sum2324 = 0, $$sum25 = 0, $$sum26 = 0, $$sum28 = 0, $$sum29 = 0, $$sum3 = 0, $$sum30 = 0;
  21722. var $$sum31 = 0, $$sum32 = 0, $$sum33 = 0, $$sum34 = 0, $$sum35 = 0, $$sum36 = 0, $$sum37 = 0, $$sum5 = 0, $$sum67 = 0, $$sum8 = 0, $$sum9 = 0, $0 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0;
  21723. var $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0;
  21724. var $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0;
  21725. var $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0;
  21726. var $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0;
  21727. var $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0;
  21728. var $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0;
  21729. var $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0;
  21730. var $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0;
  21731. var $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0;
  21732. var $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0;
  21733. var $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0;
  21734. var $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $321 = 0;
  21735. var $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0;
  21736. var $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0;
  21737. var $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0;
  21738. var $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, $F16$0 = 0, $I18$0 = 0, $I18$0$c = 0, $K19$058 = 0, $R$0 = 0, $R$1 = 0, $R7$0 = 0;
  21739. var $R7$1 = 0, $RP$0 = 0, $RP9$0 = 0, $T$0$lcssa = 0, $T$057 = 0, $cond = 0, $cond54 = 0, $or$cond = 0, $p$0 = 0, $psize$0 = 0, $psize$1 = 0, $sp$0$i = 0, $sp$0$in$i = 0, label = 0, sp = 0;
  21740. sp = STACKTOP;
  21741. $0 = ($mem|0)==(0|0);
  21742. if ($0) {
  21743. STACKTOP = sp;return;
  21744. }
  21745. $1 = (($mem) + -8|0);
  21746. $2 = HEAP32[((32544 + 16|0))>>2]|0;
  21747. $3 = ($1>>>0)<($2>>>0);
  21748. if ($3) {
  21749. _abort();
  21750. // unreachable;
  21751. }
  21752. $4 = (($mem) + -4|0);
  21753. $5 = HEAP32[$4>>2]|0;
  21754. $6 = $5 & 3;
  21755. $7 = ($6|0)==(1);
  21756. if ($7) {
  21757. _abort();
  21758. // unreachable;
  21759. }
  21760. $8 = $5 & -8;
  21761. $$sum = (($8) + -8)|0;
  21762. $9 = (($mem) + ($$sum)|0);
  21763. $10 = $5 & 1;
  21764. $11 = ($10|0)==(0);
  21765. do {
  21766. if ($11) {
  21767. $12 = HEAP32[$1>>2]|0;
  21768. $13 = ($6|0)==(0);
  21769. if ($13) {
  21770. STACKTOP = sp;return;
  21771. }
  21772. $$sum2 = (-8 - ($12))|0;
  21773. $14 = (($mem) + ($$sum2)|0);
  21774. $15 = (($12) + ($8))|0;
  21775. $16 = ($14>>>0)<($2>>>0);
  21776. if ($16) {
  21777. _abort();
  21778. // unreachable;
  21779. }
  21780. $17 = HEAP32[((32544 + 20|0))>>2]|0;
  21781. $18 = ($14|0)==($17|0);
  21782. if ($18) {
  21783. $$sum3 = (($8) + -4)|0;
  21784. $103 = (($mem) + ($$sum3)|0);
  21785. $104 = HEAP32[$103>>2]|0;
  21786. $105 = $104 & 3;
  21787. $106 = ($105|0)==(3);
  21788. if (!($106)) {
  21789. $p$0 = $14;$psize$0 = $15;
  21790. break;
  21791. }
  21792. HEAP32[((32544 + 8|0))>>2] = $15;
  21793. $107 = $104 & -2;
  21794. HEAP32[$103>>2] = $107;
  21795. $108 = $15 | 1;
  21796. $$sum26 = (($$sum2) + 4)|0;
  21797. $109 = (($mem) + ($$sum26)|0);
  21798. HEAP32[$109>>2] = $108;
  21799. HEAP32[$9>>2] = $15;
  21800. STACKTOP = sp;return;
  21801. }
  21802. $19 = $12 >>> 3;
  21803. $20 = ($12>>>0)<(256);
  21804. if ($20) {
  21805. $$sum36 = (($$sum2) + 8)|0;
  21806. $21 = (($mem) + ($$sum36)|0);
  21807. $22 = HEAP32[$21>>2]|0;
  21808. $$sum37 = (($$sum2) + 12)|0;
  21809. $23 = (($mem) + ($$sum37)|0);
  21810. $24 = HEAP32[$23>>2]|0;
  21811. $25 = $19 << 1;
  21812. $26 = ((32544 + ($25<<2)|0) + 40|0);
  21813. $27 = ($22|0)==($26|0);
  21814. if (!($27)) {
  21815. $28 = ($22>>>0)<($2>>>0);
  21816. if ($28) {
  21817. _abort();
  21818. // unreachable;
  21819. }
  21820. $29 = (($22) + 12|0);
  21821. $30 = HEAP32[$29>>2]|0;
  21822. $31 = ($30|0)==($14|0);
  21823. if (!($31)) {
  21824. _abort();
  21825. // unreachable;
  21826. }
  21827. }
  21828. $32 = ($24|0)==($22|0);
  21829. if ($32) {
  21830. $33 = 1 << $19;
  21831. $34 = $33 ^ -1;
  21832. $35 = HEAP32[32544>>2]|0;
  21833. $36 = $35 & $34;
  21834. HEAP32[32544>>2] = $36;
  21835. $p$0 = $14;$psize$0 = $15;
  21836. break;
  21837. }
  21838. $37 = ($24|0)==($26|0);
  21839. if ($37) {
  21840. $$pre67 = (($24) + 8|0);
  21841. $$pre$phi68Z2D = $$pre67;
  21842. } else {
  21843. $38 = ($24>>>0)<($2>>>0);
  21844. if ($38) {
  21845. _abort();
  21846. // unreachable;
  21847. }
  21848. $39 = (($24) + 8|0);
  21849. $40 = HEAP32[$39>>2]|0;
  21850. $41 = ($40|0)==($14|0);
  21851. if ($41) {
  21852. $$pre$phi68Z2D = $39;
  21853. } else {
  21854. _abort();
  21855. // unreachable;
  21856. }
  21857. }
  21858. $42 = (($22) + 12|0);
  21859. HEAP32[$42>>2] = $24;
  21860. HEAP32[$$pre$phi68Z2D>>2] = $22;
  21861. $p$0 = $14;$psize$0 = $15;
  21862. break;
  21863. }
  21864. $$sum28 = (($$sum2) + 24)|0;
  21865. $43 = (($mem) + ($$sum28)|0);
  21866. $44 = HEAP32[$43>>2]|0;
  21867. $$sum29 = (($$sum2) + 12)|0;
  21868. $45 = (($mem) + ($$sum29)|0);
  21869. $46 = HEAP32[$45>>2]|0;
  21870. $47 = ($46|0)==($14|0);
  21871. do {
  21872. if ($47) {
  21873. $$sum31 = (($$sum2) + 20)|0;
  21874. $57 = (($mem) + ($$sum31)|0);
  21875. $58 = HEAP32[$57>>2]|0;
  21876. $59 = ($58|0)==(0|0);
  21877. if ($59) {
  21878. $$sum30 = (($$sum2) + 16)|0;
  21879. $60 = (($mem) + ($$sum30)|0);
  21880. $61 = HEAP32[$60>>2]|0;
  21881. $62 = ($61|0)==(0|0);
  21882. if ($62) {
  21883. $R$1 = 0;
  21884. break;
  21885. } else {
  21886. $R$0 = $61;$RP$0 = $60;
  21887. }
  21888. } else {
  21889. $R$0 = $58;$RP$0 = $57;
  21890. }
  21891. while(1) {
  21892. $63 = (($R$0) + 20|0);
  21893. $64 = HEAP32[$63>>2]|0;
  21894. $65 = ($64|0)==(0|0);
  21895. if (!($65)) {
  21896. $R$0 = $64;$RP$0 = $63;
  21897. continue;
  21898. }
  21899. $66 = (($R$0) + 16|0);
  21900. $67 = HEAP32[$66>>2]|0;
  21901. $68 = ($67|0)==(0|0);
  21902. if ($68) {
  21903. break;
  21904. } else {
  21905. $R$0 = $67;$RP$0 = $66;
  21906. }
  21907. }
  21908. $69 = ($RP$0>>>0)<($2>>>0);
  21909. if ($69) {
  21910. _abort();
  21911. // unreachable;
  21912. } else {
  21913. HEAP32[$RP$0>>2] = 0;
  21914. $R$1 = $R$0;
  21915. break;
  21916. }
  21917. } else {
  21918. $$sum35 = (($$sum2) + 8)|0;
  21919. $48 = (($mem) + ($$sum35)|0);
  21920. $49 = HEAP32[$48>>2]|0;
  21921. $50 = ($49>>>0)<($2>>>0);
  21922. if ($50) {
  21923. _abort();
  21924. // unreachable;
  21925. }
  21926. $51 = (($49) + 12|0);
  21927. $52 = HEAP32[$51>>2]|0;
  21928. $53 = ($52|0)==($14|0);
  21929. if (!($53)) {
  21930. _abort();
  21931. // unreachable;
  21932. }
  21933. $54 = (($46) + 8|0);
  21934. $55 = HEAP32[$54>>2]|0;
  21935. $56 = ($55|0)==($14|0);
  21936. if ($56) {
  21937. HEAP32[$51>>2] = $46;
  21938. HEAP32[$54>>2] = $49;
  21939. $R$1 = $46;
  21940. break;
  21941. } else {
  21942. _abort();
  21943. // unreachable;
  21944. }
  21945. }
  21946. } while(0);
  21947. $70 = ($44|0)==(0|0);
  21948. if ($70) {
  21949. $p$0 = $14;$psize$0 = $15;
  21950. } else {
  21951. $$sum32 = (($$sum2) + 28)|0;
  21952. $71 = (($mem) + ($$sum32)|0);
  21953. $72 = HEAP32[$71>>2]|0;
  21954. $73 = ((32544 + ($72<<2)|0) + 304|0);
  21955. $74 = HEAP32[$73>>2]|0;
  21956. $75 = ($14|0)==($74|0);
  21957. if ($75) {
  21958. HEAP32[$73>>2] = $R$1;
  21959. $cond = ($R$1|0)==(0|0);
  21960. if ($cond) {
  21961. $76 = 1 << $72;
  21962. $77 = $76 ^ -1;
  21963. $78 = HEAP32[((32544 + 4|0))>>2]|0;
  21964. $79 = $78 & $77;
  21965. HEAP32[((32544 + 4|0))>>2] = $79;
  21966. $p$0 = $14;$psize$0 = $15;
  21967. break;
  21968. }
  21969. } else {
  21970. $80 = HEAP32[((32544 + 16|0))>>2]|0;
  21971. $81 = ($44>>>0)<($80>>>0);
  21972. if ($81) {
  21973. _abort();
  21974. // unreachable;
  21975. }
  21976. $82 = (($44) + 16|0);
  21977. $83 = HEAP32[$82>>2]|0;
  21978. $84 = ($83|0)==($14|0);
  21979. if ($84) {
  21980. HEAP32[$82>>2] = $R$1;
  21981. } else {
  21982. $85 = (($44) + 20|0);
  21983. HEAP32[$85>>2] = $R$1;
  21984. }
  21985. $86 = ($R$1|0)==(0|0);
  21986. if ($86) {
  21987. $p$0 = $14;$psize$0 = $15;
  21988. break;
  21989. }
  21990. }
  21991. $87 = HEAP32[((32544 + 16|0))>>2]|0;
  21992. $88 = ($R$1>>>0)<($87>>>0);
  21993. if ($88) {
  21994. _abort();
  21995. // unreachable;
  21996. }
  21997. $89 = (($R$1) + 24|0);
  21998. HEAP32[$89>>2] = $44;
  21999. $$sum33 = (($$sum2) + 16)|0;
  22000. $90 = (($mem) + ($$sum33)|0);
  22001. $91 = HEAP32[$90>>2]|0;
  22002. $92 = ($91|0)==(0|0);
  22003. do {
  22004. if (!($92)) {
  22005. $93 = ($91>>>0)<($87>>>0);
  22006. if ($93) {
  22007. _abort();
  22008. // unreachable;
  22009. } else {
  22010. $94 = (($R$1) + 16|0);
  22011. HEAP32[$94>>2] = $91;
  22012. $95 = (($91) + 24|0);
  22013. HEAP32[$95>>2] = $R$1;
  22014. break;
  22015. }
  22016. }
  22017. } while(0);
  22018. $$sum34 = (($$sum2) + 20)|0;
  22019. $96 = (($mem) + ($$sum34)|0);
  22020. $97 = HEAP32[$96>>2]|0;
  22021. $98 = ($97|0)==(0|0);
  22022. if ($98) {
  22023. $p$0 = $14;$psize$0 = $15;
  22024. } else {
  22025. $99 = HEAP32[((32544 + 16|0))>>2]|0;
  22026. $100 = ($97>>>0)<($99>>>0);
  22027. if ($100) {
  22028. _abort();
  22029. // unreachable;
  22030. } else {
  22031. $101 = (($R$1) + 20|0);
  22032. HEAP32[$101>>2] = $97;
  22033. $102 = (($97) + 24|0);
  22034. HEAP32[$102>>2] = $R$1;
  22035. $p$0 = $14;$psize$0 = $15;
  22036. break;
  22037. }
  22038. }
  22039. }
  22040. } else {
  22041. $p$0 = $1;$psize$0 = $8;
  22042. }
  22043. } while(0);
  22044. $110 = ($p$0>>>0)<($9>>>0);
  22045. if (!($110)) {
  22046. _abort();
  22047. // unreachable;
  22048. }
  22049. $$sum25 = (($8) + -4)|0;
  22050. $111 = (($mem) + ($$sum25)|0);
  22051. $112 = HEAP32[$111>>2]|0;
  22052. $113 = $112 & 1;
  22053. $114 = ($113|0)==(0);
  22054. if ($114) {
  22055. _abort();
  22056. // unreachable;
  22057. }
  22058. $115 = $112 & 2;
  22059. $116 = ($115|0)==(0);
  22060. if ($116) {
  22061. $117 = HEAP32[((32544 + 24|0))>>2]|0;
  22062. $118 = ($9|0)==($117|0);
  22063. if ($118) {
  22064. $119 = HEAP32[((32544 + 12|0))>>2]|0;
  22065. $120 = (($119) + ($psize$0))|0;
  22066. HEAP32[((32544 + 12|0))>>2] = $120;
  22067. HEAP32[((32544 + 24|0))>>2] = $p$0;
  22068. $121 = $120 | 1;
  22069. $122 = (($p$0) + 4|0);
  22070. HEAP32[$122>>2] = $121;
  22071. $123 = HEAP32[((32544 + 20|0))>>2]|0;
  22072. $124 = ($p$0|0)==($123|0);
  22073. if (!($124)) {
  22074. STACKTOP = sp;return;
  22075. }
  22076. HEAP32[((32544 + 20|0))>>2] = 0;
  22077. HEAP32[((32544 + 8|0))>>2] = 0;
  22078. STACKTOP = sp;return;
  22079. }
  22080. $125 = HEAP32[((32544 + 20|0))>>2]|0;
  22081. $126 = ($9|0)==($125|0);
  22082. if ($126) {
  22083. $127 = HEAP32[((32544 + 8|0))>>2]|0;
  22084. $128 = (($127) + ($psize$0))|0;
  22085. HEAP32[((32544 + 8|0))>>2] = $128;
  22086. HEAP32[((32544 + 20|0))>>2] = $p$0;
  22087. $129 = $128 | 1;
  22088. $130 = (($p$0) + 4|0);
  22089. HEAP32[$130>>2] = $129;
  22090. $131 = (($p$0) + ($128)|0);
  22091. HEAP32[$131>>2] = $128;
  22092. STACKTOP = sp;return;
  22093. }
  22094. $132 = $112 & -8;
  22095. $133 = (($132) + ($psize$0))|0;
  22096. $134 = $112 >>> 3;
  22097. $135 = ($112>>>0)<(256);
  22098. do {
  22099. if ($135) {
  22100. $136 = (($mem) + ($8)|0);
  22101. $137 = HEAP32[$136>>2]|0;
  22102. $$sum2324 = $8 | 4;
  22103. $138 = (($mem) + ($$sum2324)|0);
  22104. $139 = HEAP32[$138>>2]|0;
  22105. $140 = $134 << 1;
  22106. $141 = ((32544 + ($140<<2)|0) + 40|0);
  22107. $142 = ($137|0)==($141|0);
  22108. if (!($142)) {
  22109. $143 = HEAP32[((32544 + 16|0))>>2]|0;
  22110. $144 = ($137>>>0)<($143>>>0);
  22111. if ($144) {
  22112. _abort();
  22113. // unreachable;
  22114. }
  22115. $145 = (($137) + 12|0);
  22116. $146 = HEAP32[$145>>2]|0;
  22117. $147 = ($146|0)==($9|0);
  22118. if (!($147)) {
  22119. _abort();
  22120. // unreachable;
  22121. }
  22122. }
  22123. $148 = ($139|0)==($137|0);
  22124. if ($148) {
  22125. $149 = 1 << $134;
  22126. $150 = $149 ^ -1;
  22127. $151 = HEAP32[32544>>2]|0;
  22128. $152 = $151 & $150;
  22129. HEAP32[32544>>2] = $152;
  22130. break;
  22131. }
  22132. $153 = ($139|0)==($141|0);
  22133. if ($153) {
  22134. $$pre65 = (($139) + 8|0);
  22135. $$pre$phi66Z2D = $$pre65;
  22136. } else {
  22137. $154 = HEAP32[((32544 + 16|0))>>2]|0;
  22138. $155 = ($139>>>0)<($154>>>0);
  22139. if ($155) {
  22140. _abort();
  22141. // unreachable;
  22142. }
  22143. $156 = (($139) + 8|0);
  22144. $157 = HEAP32[$156>>2]|0;
  22145. $158 = ($157|0)==($9|0);
  22146. if ($158) {
  22147. $$pre$phi66Z2D = $156;
  22148. } else {
  22149. _abort();
  22150. // unreachable;
  22151. }
  22152. }
  22153. $159 = (($137) + 12|0);
  22154. HEAP32[$159>>2] = $139;
  22155. HEAP32[$$pre$phi66Z2D>>2] = $137;
  22156. } else {
  22157. $$sum5 = (($8) + 16)|0;
  22158. $160 = (($mem) + ($$sum5)|0);
  22159. $161 = HEAP32[$160>>2]|0;
  22160. $$sum67 = $8 | 4;
  22161. $162 = (($mem) + ($$sum67)|0);
  22162. $163 = HEAP32[$162>>2]|0;
  22163. $164 = ($163|0)==($9|0);
  22164. do {
  22165. if ($164) {
  22166. $$sum9 = (($8) + 12)|0;
  22167. $175 = (($mem) + ($$sum9)|0);
  22168. $176 = HEAP32[$175>>2]|0;
  22169. $177 = ($176|0)==(0|0);
  22170. if ($177) {
  22171. $$sum8 = (($8) + 8)|0;
  22172. $178 = (($mem) + ($$sum8)|0);
  22173. $179 = HEAP32[$178>>2]|0;
  22174. $180 = ($179|0)==(0|0);
  22175. if ($180) {
  22176. $R7$1 = 0;
  22177. break;
  22178. } else {
  22179. $R7$0 = $179;$RP9$0 = $178;
  22180. }
  22181. } else {
  22182. $R7$0 = $176;$RP9$0 = $175;
  22183. }
  22184. while(1) {
  22185. $181 = (($R7$0) + 20|0);
  22186. $182 = HEAP32[$181>>2]|0;
  22187. $183 = ($182|0)==(0|0);
  22188. if (!($183)) {
  22189. $R7$0 = $182;$RP9$0 = $181;
  22190. continue;
  22191. }
  22192. $184 = (($R7$0) + 16|0);
  22193. $185 = HEAP32[$184>>2]|0;
  22194. $186 = ($185|0)==(0|0);
  22195. if ($186) {
  22196. break;
  22197. } else {
  22198. $R7$0 = $185;$RP9$0 = $184;
  22199. }
  22200. }
  22201. $187 = HEAP32[((32544 + 16|0))>>2]|0;
  22202. $188 = ($RP9$0>>>0)<($187>>>0);
  22203. if ($188) {
  22204. _abort();
  22205. // unreachable;
  22206. } else {
  22207. HEAP32[$RP9$0>>2] = 0;
  22208. $R7$1 = $R7$0;
  22209. break;
  22210. }
  22211. } else {
  22212. $165 = (($mem) + ($8)|0);
  22213. $166 = HEAP32[$165>>2]|0;
  22214. $167 = HEAP32[((32544 + 16|0))>>2]|0;
  22215. $168 = ($166>>>0)<($167>>>0);
  22216. if ($168) {
  22217. _abort();
  22218. // unreachable;
  22219. }
  22220. $169 = (($166) + 12|0);
  22221. $170 = HEAP32[$169>>2]|0;
  22222. $171 = ($170|0)==($9|0);
  22223. if (!($171)) {
  22224. _abort();
  22225. // unreachable;
  22226. }
  22227. $172 = (($163) + 8|0);
  22228. $173 = HEAP32[$172>>2]|0;
  22229. $174 = ($173|0)==($9|0);
  22230. if ($174) {
  22231. HEAP32[$169>>2] = $163;
  22232. HEAP32[$172>>2] = $166;
  22233. $R7$1 = $163;
  22234. break;
  22235. } else {
  22236. _abort();
  22237. // unreachable;
  22238. }
  22239. }
  22240. } while(0);
  22241. $189 = ($161|0)==(0|0);
  22242. if (!($189)) {
  22243. $$sum18 = (($8) + 20)|0;
  22244. $190 = (($mem) + ($$sum18)|0);
  22245. $191 = HEAP32[$190>>2]|0;
  22246. $192 = ((32544 + ($191<<2)|0) + 304|0);
  22247. $193 = HEAP32[$192>>2]|0;
  22248. $194 = ($9|0)==($193|0);
  22249. if ($194) {
  22250. HEAP32[$192>>2] = $R7$1;
  22251. $cond54 = ($R7$1|0)==(0|0);
  22252. if ($cond54) {
  22253. $195 = 1 << $191;
  22254. $196 = $195 ^ -1;
  22255. $197 = HEAP32[((32544 + 4|0))>>2]|0;
  22256. $198 = $197 & $196;
  22257. HEAP32[((32544 + 4|0))>>2] = $198;
  22258. break;
  22259. }
  22260. } else {
  22261. $199 = HEAP32[((32544 + 16|0))>>2]|0;
  22262. $200 = ($161>>>0)<($199>>>0);
  22263. if ($200) {
  22264. _abort();
  22265. // unreachable;
  22266. }
  22267. $201 = (($161) + 16|0);
  22268. $202 = HEAP32[$201>>2]|0;
  22269. $203 = ($202|0)==($9|0);
  22270. if ($203) {
  22271. HEAP32[$201>>2] = $R7$1;
  22272. } else {
  22273. $204 = (($161) + 20|0);
  22274. HEAP32[$204>>2] = $R7$1;
  22275. }
  22276. $205 = ($R7$1|0)==(0|0);
  22277. if ($205) {
  22278. break;
  22279. }
  22280. }
  22281. $206 = HEAP32[((32544 + 16|0))>>2]|0;
  22282. $207 = ($R7$1>>>0)<($206>>>0);
  22283. if ($207) {
  22284. _abort();
  22285. // unreachable;
  22286. }
  22287. $208 = (($R7$1) + 24|0);
  22288. HEAP32[$208>>2] = $161;
  22289. $$sum19 = (($8) + 8)|0;
  22290. $209 = (($mem) + ($$sum19)|0);
  22291. $210 = HEAP32[$209>>2]|0;
  22292. $211 = ($210|0)==(0|0);
  22293. do {
  22294. if (!($211)) {
  22295. $212 = ($210>>>0)<($206>>>0);
  22296. if ($212) {
  22297. _abort();
  22298. // unreachable;
  22299. } else {
  22300. $213 = (($R7$1) + 16|0);
  22301. HEAP32[$213>>2] = $210;
  22302. $214 = (($210) + 24|0);
  22303. HEAP32[$214>>2] = $R7$1;
  22304. break;
  22305. }
  22306. }
  22307. } while(0);
  22308. $$sum20 = (($8) + 12)|0;
  22309. $215 = (($mem) + ($$sum20)|0);
  22310. $216 = HEAP32[$215>>2]|0;
  22311. $217 = ($216|0)==(0|0);
  22312. if (!($217)) {
  22313. $218 = HEAP32[((32544 + 16|0))>>2]|0;
  22314. $219 = ($216>>>0)<($218>>>0);
  22315. if ($219) {
  22316. _abort();
  22317. // unreachable;
  22318. } else {
  22319. $220 = (($R7$1) + 20|0);
  22320. HEAP32[$220>>2] = $216;
  22321. $221 = (($216) + 24|0);
  22322. HEAP32[$221>>2] = $R7$1;
  22323. break;
  22324. }
  22325. }
  22326. }
  22327. }
  22328. } while(0);
  22329. $222 = $133 | 1;
  22330. $223 = (($p$0) + 4|0);
  22331. HEAP32[$223>>2] = $222;
  22332. $224 = (($p$0) + ($133)|0);
  22333. HEAP32[$224>>2] = $133;
  22334. $225 = HEAP32[((32544 + 20|0))>>2]|0;
  22335. $226 = ($p$0|0)==($225|0);
  22336. if ($226) {
  22337. HEAP32[((32544 + 8|0))>>2] = $133;
  22338. STACKTOP = sp;return;
  22339. } else {
  22340. $psize$1 = $133;
  22341. }
  22342. } else {
  22343. $227 = $112 & -2;
  22344. HEAP32[$111>>2] = $227;
  22345. $228 = $psize$0 | 1;
  22346. $229 = (($p$0) + 4|0);
  22347. HEAP32[$229>>2] = $228;
  22348. $230 = (($p$0) + ($psize$0)|0);
  22349. HEAP32[$230>>2] = $psize$0;
  22350. $psize$1 = $psize$0;
  22351. }
  22352. $231 = $psize$1 >>> 3;
  22353. $232 = ($psize$1>>>0)<(256);
  22354. if ($232) {
  22355. $233 = $231 << 1;
  22356. $234 = ((32544 + ($233<<2)|0) + 40|0);
  22357. $235 = HEAP32[32544>>2]|0;
  22358. $236 = 1 << $231;
  22359. $237 = $235 & $236;
  22360. $238 = ($237|0)==(0);
  22361. if ($238) {
  22362. $239 = $235 | $236;
  22363. HEAP32[32544>>2] = $239;
  22364. $$sum16$pre = (($233) + 2)|0;
  22365. $$pre = ((32544 + ($$sum16$pre<<2)|0) + 40|0);
  22366. $$pre$phiZ2D = $$pre;$F16$0 = $234;
  22367. } else {
  22368. $$sum17 = (($233) + 2)|0;
  22369. $240 = ((32544 + ($$sum17<<2)|0) + 40|0);
  22370. $241 = HEAP32[$240>>2]|0;
  22371. $242 = HEAP32[((32544 + 16|0))>>2]|0;
  22372. $243 = ($241>>>0)<($242>>>0);
  22373. if ($243) {
  22374. _abort();
  22375. // unreachable;
  22376. } else {
  22377. $$pre$phiZ2D = $240;$F16$0 = $241;
  22378. }
  22379. }
  22380. HEAP32[$$pre$phiZ2D>>2] = $p$0;
  22381. $244 = (($F16$0) + 12|0);
  22382. HEAP32[$244>>2] = $p$0;
  22383. $245 = (($p$0) + 8|0);
  22384. HEAP32[$245>>2] = $F16$0;
  22385. $246 = (($p$0) + 12|0);
  22386. HEAP32[$246>>2] = $234;
  22387. STACKTOP = sp;return;
  22388. }
  22389. $247 = $psize$1 >>> 8;
  22390. $248 = ($247|0)==(0);
  22391. if ($248) {
  22392. $I18$0 = 0;
  22393. } else {
  22394. $249 = ($psize$1>>>0)>(16777215);
  22395. if ($249) {
  22396. $I18$0 = 31;
  22397. } else {
  22398. $250 = (($247) + 1048320)|0;
  22399. $251 = $250 >>> 16;
  22400. $252 = $251 & 8;
  22401. $253 = $247 << $252;
  22402. $254 = (($253) + 520192)|0;
  22403. $255 = $254 >>> 16;
  22404. $256 = $255 & 4;
  22405. $257 = $256 | $252;
  22406. $258 = $253 << $256;
  22407. $259 = (($258) + 245760)|0;
  22408. $260 = $259 >>> 16;
  22409. $261 = $260 & 2;
  22410. $262 = $257 | $261;
  22411. $263 = (14 - ($262))|0;
  22412. $264 = $258 << $261;
  22413. $265 = $264 >>> 15;
  22414. $266 = (($263) + ($265))|0;
  22415. $267 = $266 << 1;
  22416. $268 = (($266) + 7)|0;
  22417. $269 = $psize$1 >>> $268;
  22418. $270 = $269 & 1;
  22419. $271 = $270 | $267;
  22420. $I18$0 = $271;
  22421. }
  22422. }
  22423. $272 = ((32544 + ($I18$0<<2)|0) + 304|0);
  22424. $273 = (($p$0) + 28|0);
  22425. $I18$0$c = $I18$0;
  22426. HEAP32[$273>>2] = $I18$0$c;
  22427. $274 = (($p$0) + 20|0);
  22428. HEAP32[$274>>2] = 0;
  22429. $275 = (($p$0) + 16|0);
  22430. HEAP32[$275>>2] = 0;
  22431. $276 = HEAP32[((32544 + 4|0))>>2]|0;
  22432. $277 = 1 << $I18$0;
  22433. $278 = $276 & $277;
  22434. $279 = ($278|0)==(0);
  22435. L199: do {
  22436. if ($279) {
  22437. $280 = $276 | $277;
  22438. HEAP32[((32544 + 4|0))>>2] = $280;
  22439. HEAP32[$272>>2] = $p$0;
  22440. $281 = (($p$0) + 24|0);
  22441. HEAP32[$281>>2] = $272;
  22442. $282 = (($p$0) + 12|0);
  22443. HEAP32[$282>>2] = $p$0;
  22444. $283 = (($p$0) + 8|0);
  22445. HEAP32[$283>>2] = $p$0;
  22446. } else {
  22447. $284 = HEAP32[$272>>2]|0;
  22448. $285 = ($I18$0|0)==(31);
  22449. if ($285) {
  22450. $293 = 0;
  22451. } else {
  22452. $286 = $I18$0 >>> 1;
  22453. $287 = (25 - ($286))|0;
  22454. $293 = $287;
  22455. }
  22456. $288 = (($284) + 4|0);
  22457. $289 = HEAP32[$288>>2]|0;
  22458. $290 = $289 & -8;
  22459. $291 = ($290|0)==($psize$1|0);
  22460. L205: do {
  22461. if ($291) {
  22462. $T$0$lcssa = $284;
  22463. } else {
  22464. $292 = $psize$1 << $293;
  22465. $K19$058 = $292;$T$057 = $284;
  22466. while(1) {
  22467. $300 = $K19$058 >>> 31;
  22468. $301 = ((($T$057) + ($300<<2)|0) + 16|0);
  22469. $296 = HEAP32[$301>>2]|0;
  22470. $302 = ($296|0)==(0|0);
  22471. if ($302) {
  22472. break;
  22473. }
  22474. $294 = $K19$058 << 1;
  22475. $295 = (($296) + 4|0);
  22476. $297 = HEAP32[$295>>2]|0;
  22477. $298 = $297 & -8;
  22478. $299 = ($298|0)==($psize$1|0);
  22479. if ($299) {
  22480. $T$0$lcssa = $296;
  22481. break L205;
  22482. } else {
  22483. $K19$058 = $294;$T$057 = $296;
  22484. }
  22485. }
  22486. $303 = HEAP32[((32544 + 16|0))>>2]|0;
  22487. $304 = ($301>>>0)<($303>>>0);
  22488. if ($304) {
  22489. _abort();
  22490. // unreachable;
  22491. } else {
  22492. HEAP32[$301>>2] = $p$0;
  22493. $305 = (($p$0) + 24|0);
  22494. HEAP32[$305>>2] = $T$057;
  22495. $306 = (($p$0) + 12|0);
  22496. HEAP32[$306>>2] = $p$0;
  22497. $307 = (($p$0) + 8|0);
  22498. HEAP32[$307>>2] = $p$0;
  22499. break L199;
  22500. }
  22501. }
  22502. } while(0);
  22503. $308 = (($T$0$lcssa) + 8|0);
  22504. $309 = HEAP32[$308>>2]|0;
  22505. $310 = HEAP32[((32544 + 16|0))>>2]|0;
  22506. $311 = ($T$0$lcssa>>>0)>=($310>>>0);
  22507. $312 = ($309>>>0)>=($310>>>0);
  22508. $or$cond = $311 & $312;
  22509. if ($or$cond) {
  22510. $313 = (($309) + 12|0);
  22511. HEAP32[$313>>2] = $p$0;
  22512. HEAP32[$308>>2] = $p$0;
  22513. $314 = (($p$0) + 8|0);
  22514. HEAP32[$314>>2] = $309;
  22515. $315 = (($p$0) + 12|0);
  22516. HEAP32[$315>>2] = $T$0$lcssa;
  22517. $316 = (($p$0) + 24|0);
  22518. HEAP32[$316>>2] = 0;
  22519. break;
  22520. } else {
  22521. _abort();
  22522. // unreachable;
  22523. }
  22524. }
  22525. } while(0);
  22526. $317 = HEAP32[((32544 + 32|0))>>2]|0;
  22527. $318 = (($317) + -1)|0;
  22528. HEAP32[((32544 + 32|0))>>2] = $318;
  22529. $319 = ($318|0)==(0);
  22530. if ($319) {
  22531. $sp$0$in$i = ((32544 + 456|0));
  22532. } else {
  22533. STACKTOP = sp;return;
  22534. }
  22535. while(1) {
  22536. $sp$0$i = HEAP32[$sp$0$in$i>>2]|0;
  22537. $320 = ($sp$0$i|0)==(0|0);
  22538. $321 = (($sp$0$i) + 8|0);
  22539. if ($320) {
  22540. break;
  22541. } else {
  22542. $sp$0$in$i = $321;
  22543. }
  22544. }
  22545. HEAP32[((32544 + 32|0))>>2] = -1;
  22546. STACKTOP = sp;return;
  22547. }
  22548. function runPostSets() {
  22549. }
  22550. function _bitshift64Ashr(low, high, bits) {
  22551. low = low|0; high = high|0; bits = bits|0;
  22552. var ander = 0;
  22553. if ((bits|0) < 32) {
  22554. ander = ((1 << bits) - 1)|0;
  22555. tempRet0 = high >> bits;
  22556. return (low >>> bits) | ((high&ander) << (32 - bits));
  22557. }
  22558. tempRet0 = (high|0) < 0 ? -1 : 0;
  22559. return (high >> (bits - 32))|0;
  22560. }
  22561. function _i64Subtract(a, b, c, d) {
  22562. a = a|0; b = b|0; c = c|0; d = d|0;
  22563. var l = 0, h = 0;
  22564. l = (a - c)>>>0;
  22565. h = (b - d)>>>0;
  22566. h = (b - d - (((c>>>0) > (a>>>0))|0))>>>0; // Borrow one from high word to low word on underflow.
  22567. return ((tempRet0 = h,l|0)|0);
  22568. }
  22569. function _i64Add(a, b, c, d) {
  22570. /*
  22571. x = a + b*2^32
  22572. y = c + d*2^32
  22573. result = l + h*2^32
  22574. */
  22575. a = a|0; b = b|0; c = c|0; d = d|0;
  22576. var l = 0, h = 0;
  22577. l = (a + c)>>>0;
  22578. h = (b + d + (((l>>>0) < (a>>>0))|0))>>>0; // Add carry from low word to high word on overflow.
  22579. return ((tempRet0 = h,l|0)|0);
  22580. }
  22581. function _memset(ptr, value, num) {
  22582. ptr = ptr|0; value = value|0; num = num|0;
  22583. var stop = 0, value4 = 0, stop4 = 0, unaligned = 0;
  22584. stop = (ptr + num)|0;
  22585. if ((num|0) >= 20) {
  22586. // This is unaligned, but quite large, so work hard to get to aligned settings
  22587. value = value & 0xff;
  22588. unaligned = ptr & 3;
  22589. value4 = value | (value << 8) | (value << 16) | (value << 24);
  22590. stop4 = stop & ~3;
  22591. if (unaligned) {
  22592. unaligned = (ptr + 4 - unaligned)|0;
  22593. while ((ptr|0) < (unaligned|0)) { // no need to check for stop, since we have large num
  22594. HEAP8[((ptr)>>0)]=value;
  22595. ptr = (ptr+1)|0;
  22596. }
  22597. }
  22598. while ((ptr|0) < (stop4|0)) {
  22599. HEAP32[((ptr)>>2)]=value4;
  22600. ptr = (ptr+4)|0;
  22601. }
  22602. }
  22603. while ((ptr|0) < (stop|0)) {
  22604. HEAP8[((ptr)>>0)]=value;
  22605. ptr = (ptr+1)|0;
  22606. }
  22607. return (ptr-num)|0;
  22608. }
  22609. function _bitshift64Lshr(low, high, bits) {
  22610. low = low|0; high = high|0; bits = bits|0;
  22611. var ander = 0;
  22612. if ((bits|0) < 32) {
  22613. ander = ((1 << bits) - 1)|0;
  22614. tempRet0 = high >>> bits;
  22615. return (low >>> bits) | ((high&ander) << (32 - bits));
  22616. }
  22617. tempRet0 = 0;
  22618. return (high >>> (bits - 32))|0;
  22619. }
  22620. function _bitshift64Shl(low, high, bits) {
  22621. low = low|0; high = high|0; bits = bits|0;
  22622. var ander = 0;
  22623. if ((bits|0) < 32) {
  22624. ander = ((1 << bits) - 1)|0;
  22625. tempRet0 = (high << bits) | ((low&(ander << (32 - bits))) >>> (32 - bits));
  22626. return low << bits;
  22627. }
  22628. tempRet0 = low << (bits - 32);
  22629. return 0;
  22630. }
  22631. function _strlen(ptr) {
  22632. ptr = ptr|0;
  22633. var curr = 0;
  22634. curr = ptr;
  22635. while (((HEAP8[((curr)>>0)])|0)) {
  22636. curr = (curr + 1)|0;
  22637. }
  22638. return (curr - ptr)|0;
  22639. }
  22640. function _memcpy(dest, src, num) {
  22641. dest = dest|0; src = src|0; num = num|0;
  22642. var ret = 0;
  22643. if ((num|0) >= 4096) return _emscripten_memcpy_big(dest|0, src|0, num|0)|0;
  22644. ret = dest|0;
  22645. if ((dest&3) == (src&3)) {
  22646. while (dest & 3) {
  22647. if ((num|0) == 0) return ret|0;
  22648. HEAP8[((dest)>>0)]=((HEAP8[((src)>>0)])|0);
  22649. dest = (dest+1)|0;
  22650. src = (src+1)|0;
  22651. num = (num-1)|0;
  22652. }
  22653. while ((num|0) >= 4) {
  22654. HEAP32[((dest)>>2)]=((HEAP32[((src)>>2)])|0);
  22655. dest = (dest+4)|0;
  22656. src = (src+4)|0;
  22657. num = (num-4)|0;
  22658. }
  22659. }
  22660. while ((num|0) > 0) {
  22661. HEAP8[((dest)>>0)]=((HEAP8[((src)>>0)])|0);
  22662. dest = (dest+1)|0;
  22663. src = (src+1)|0;
  22664. num = (num-1)|0;
  22665. }
  22666. return ret|0;
  22667. }
  22668. function _memmove(dest, src, num) {
  22669. dest = dest|0; src = src|0; num = num|0;
  22670. var ret = 0;
  22671. if (((src|0) < (dest|0)) & ((dest|0) < ((src + num)|0))) {
  22672. // Unlikely case: Copy backwards in a safe manner
  22673. ret = dest;
  22674. src = (src + num)|0;
  22675. dest = (dest + num)|0;
  22676. while ((num|0) > 0) {
  22677. dest = (dest - 1)|0;
  22678. src = (src - 1)|0;
  22679. num = (num - 1)|0;
  22680. HEAP8[((dest)>>0)]=((HEAP8[((src)>>0)])|0);
  22681. }
  22682. dest = ret;
  22683. } else {
  22684. _memcpy(dest, src, num) | 0;
  22685. }
  22686. return dest | 0;
  22687. }
  22688. function _llvm_ctlz_i32(x) {
  22689. x = x|0;
  22690. var ret = 0;
  22691. ret = ((HEAP8[(((ctlz_i8)+(x >>> 24))>>0)])|0);
  22692. if ((ret|0) < 8) return ret|0;
  22693. ret = ((HEAP8[(((ctlz_i8)+((x >> 16)&0xff))>>0)])|0);
  22694. if ((ret|0) < 8) return (ret + 8)|0;
  22695. ret = ((HEAP8[(((ctlz_i8)+((x >> 8)&0xff))>>0)])|0);
  22696. if ((ret|0) < 8) return (ret + 16)|0;
  22697. return (((HEAP8[(((ctlz_i8)+(x&0xff))>>0)])|0) + 24)|0;
  22698. }
  22699. function _llvm_cttz_i32(x) {
  22700. x = x|0;
  22701. var ret = 0;
  22702. ret = ((HEAP8[(((cttz_i8)+(x & 0xff))>>0)])|0);
  22703. if ((ret|0) < 8) return ret|0;
  22704. ret = ((HEAP8[(((cttz_i8)+((x >> 8)&0xff))>>0)])|0);
  22705. if ((ret|0) < 8) return (ret + 8)|0;
  22706. ret = ((HEAP8[(((cttz_i8)+((x >> 16)&0xff))>>0)])|0);
  22707. if ((ret|0) < 8) return (ret + 16)|0;
  22708. return (((HEAP8[(((cttz_i8)+(x >>> 24))>>0)])|0) + 24)|0;
  22709. }
  22710. // ======== compiled code from system/lib/compiler-rt , see readme therein
  22711. function ___muldsi3($a, $b) {
  22712. $a = $a | 0;
  22713. $b = $b | 0;
  22714. var $1 = 0, $2 = 0, $3 = 0, $6 = 0, $8 = 0, $11 = 0, $12 = 0;
  22715. $1 = $a & 65535;
  22716. $2 = $b & 65535;
  22717. $3 = Math_imul($2, $1) | 0;
  22718. $6 = $a >>> 16;
  22719. $8 = ($3 >>> 16) + (Math_imul($2, $6) | 0) | 0;
  22720. $11 = $b >>> 16;
  22721. $12 = Math_imul($11, $1) | 0;
  22722. return (tempRet0 = (($8 >>> 16) + (Math_imul($11, $6) | 0) | 0) + ((($8 & 65535) + $12 | 0) >>> 16) | 0, 0 | ($8 + $12 << 16 | $3 & 65535)) | 0;
  22723. }
  22724. function ___divdi3($a$0, $a$1, $b$0, $b$1) {
  22725. $a$0 = $a$0 | 0;
  22726. $a$1 = $a$1 | 0;
  22727. $b$0 = $b$0 | 0;
  22728. $b$1 = $b$1 | 0;
  22729. var $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $7$0 = 0, $7$1 = 0, $8$0 = 0, $10$0 = 0;
  22730. $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
  22731. $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
  22732. $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
  22733. $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
  22734. $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
  22735. $4$1 = tempRet0;
  22736. $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
  22737. $7$0 = $2$0 ^ $1$0;
  22738. $7$1 = $2$1 ^ $1$1;
  22739. $8$0 = ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, 0) | 0;
  22740. $10$0 = _i64Subtract($8$0 ^ $7$0, tempRet0 ^ $7$1, $7$0, $7$1) | 0;
  22741. return (tempRet0 = tempRet0, $10$0) | 0;
  22742. }
  22743. function ___remdi3($a$0, $a$1, $b$0, $b$1) {
  22744. $a$0 = $a$0 | 0;
  22745. $a$1 = $a$1 | 0;
  22746. $b$0 = $b$0 | 0;
  22747. $b$1 = $b$1 | 0;
  22748. var $rem = 0, $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $10$0 = 0, $10$1 = 0, __stackBase__ = 0;
  22749. __stackBase__ = STACKTOP;
  22750. STACKTOP = STACKTOP + 8 | 0;
  22751. $rem = __stackBase__ | 0;
  22752. $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
  22753. $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
  22754. $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
  22755. $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
  22756. $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
  22757. $4$1 = tempRet0;
  22758. $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
  22759. ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, $rem) | 0;
  22760. $10$0 = _i64Subtract(HEAP32[$rem >> 2] ^ $1$0, HEAP32[$rem + 4 >> 2] ^ $1$1, $1$0, $1$1) | 0;
  22761. $10$1 = tempRet0;
  22762. STACKTOP = __stackBase__;
  22763. return (tempRet0 = $10$1, $10$0) | 0;
  22764. }
  22765. function ___muldi3($a$0, $a$1, $b$0, $b$1) {
  22766. $a$0 = $a$0 | 0;
  22767. $a$1 = $a$1 | 0;
  22768. $b$0 = $b$0 | 0;
  22769. $b$1 = $b$1 | 0;
  22770. var $x_sroa_0_0_extract_trunc = 0, $y_sroa_0_0_extract_trunc = 0, $1$0 = 0, $1$1 = 0, $2 = 0;
  22771. $x_sroa_0_0_extract_trunc = $a$0;
  22772. $y_sroa_0_0_extract_trunc = $b$0;
  22773. $1$0 = ___muldsi3($x_sroa_0_0_extract_trunc, $y_sroa_0_0_extract_trunc) | 0;
  22774. $1$1 = tempRet0;
  22775. $2 = Math_imul($a$1, $y_sroa_0_0_extract_trunc) | 0;
  22776. return (tempRet0 = ((Math_imul($b$1, $x_sroa_0_0_extract_trunc) | 0) + $2 | 0) + $1$1 | $1$1 & 0, 0 | $1$0 & -1) | 0;
  22777. }
  22778. function ___udivdi3($a$0, $a$1, $b$0, $b$1) {
  22779. $a$0 = $a$0 | 0;
  22780. $a$1 = $a$1 | 0;
  22781. $b$0 = $b$0 | 0;
  22782. $b$1 = $b$1 | 0;
  22783. var $1$0 = 0;
  22784. $1$0 = ___udivmoddi4($a$0, $a$1, $b$0, $b$1, 0) | 0;
  22785. return (tempRet0 = tempRet0, $1$0) | 0;
  22786. }
  22787. function ___uremdi3($a$0, $a$1, $b$0, $b$1) {
  22788. $a$0 = $a$0 | 0;
  22789. $a$1 = $a$1 | 0;
  22790. $b$0 = $b$0 | 0;
  22791. $b$1 = $b$1 | 0;
  22792. var $rem = 0, __stackBase__ = 0;
  22793. __stackBase__ = STACKTOP;
  22794. STACKTOP = STACKTOP + 8 | 0;
  22795. $rem = __stackBase__ | 0;
  22796. ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) | 0;
  22797. STACKTOP = __stackBase__;
  22798. return (tempRet0 = HEAP32[$rem + 4 >> 2] | 0, HEAP32[$rem >> 2] | 0) | 0;
  22799. }
  22800. function ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) {
  22801. $a$0 = $a$0 | 0;
  22802. $a$1 = $a$1 | 0;
  22803. $b$0 = $b$0 | 0;
  22804. $b$1 = $b$1 | 0;
  22805. $rem = $rem | 0;
  22806. var $n_sroa_0_0_extract_trunc = 0, $n_sroa_1_4_extract_shift$0 = 0, $n_sroa_1_4_extract_trunc = 0, $d_sroa_0_0_extract_trunc = 0, $d_sroa_1_4_extract_shift$0 = 0, $d_sroa_1_4_extract_trunc = 0, $4 = 0, $17 = 0, $37 = 0, $49 = 0, $51 = 0, $57 = 0, $58 = 0, $66 = 0, $78 = 0, $86 = 0, $88 = 0, $89 = 0, $91 = 0, $92 = 0, $95 = 0, $105 = 0, $117 = 0, $119 = 0, $125 = 0, $126 = 0, $130 = 0, $q_sroa_1_1_ph = 0, $q_sroa_0_1_ph = 0, $r_sroa_1_1_ph = 0, $r_sroa_0_1_ph = 0, $sr_1_ph = 0, $d_sroa_0_0_insert_insert99$0 = 0, $d_sroa_0_0_insert_insert99$1 = 0, $137$0 = 0, $137$1 = 0, $carry_0203 = 0, $sr_1202 = 0, $r_sroa_0_1201 = 0, $r_sroa_1_1200 = 0, $q_sroa_0_1199 = 0, $q_sroa_1_1198 = 0, $147 = 0, $149 = 0, $r_sroa_0_0_insert_insert42$0 = 0, $r_sroa_0_0_insert_insert42$1 = 0, $150$1 = 0, $151$0 = 0, $152 = 0, $154$0 = 0, $r_sroa_0_0_extract_trunc = 0, $r_sroa_1_4_extract_trunc = 0, $155 = 0, $carry_0_lcssa$0 = 0, $carry_0_lcssa$1 = 0, $r_sroa_0_1_lcssa = 0, $r_sroa_1_1_lcssa = 0, $q_sroa_0_1_lcssa = 0, $q_sroa_1_1_lcssa = 0, $q_sroa_0_0_insert_ext75$0 = 0, $q_sroa_0_0_insert_ext75$1 = 0, $q_sroa_0_0_insert_insert77$1 = 0, $_0$0 = 0, $_0$1 = 0;
  22807. $n_sroa_0_0_extract_trunc = $a$0;
  22808. $n_sroa_1_4_extract_shift$0 = $a$1;
  22809. $n_sroa_1_4_extract_trunc = $n_sroa_1_4_extract_shift$0;
  22810. $d_sroa_0_0_extract_trunc = $b$0;
  22811. $d_sroa_1_4_extract_shift$0 = $b$1;
  22812. $d_sroa_1_4_extract_trunc = $d_sroa_1_4_extract_shift$0;
  22813. if (($n_sroa_1_4_extract_trunc | 0) == 0) {
  22814. $4 = ($rem | 0) != 0;
  22815. if (($d_sroa_1_4_extract_trunc | 0) == 0) {
  22816. if ($4) {
  22817. HEAP32[$rem >> 2] = ($n_sroa_0_0_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
  22818. HEAP32[$rem + 4 >> 2] = 0;
  22819. }
  22820. $_0$1 = 0;
  22821. $_0$0 = ($n_sroa_0_0_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
  22822. return (tempRet0 = $_0$1, $_0$0) | 0;
  22823. } else {
  22824. if (!$4) {
  22825. $_0$1 = 0;
  22826. $_0$0 = 0;
  22827. return (tempRet0 = $_0$1, $_0$0) | 0;
  22828. }
  22829. HEAP32[$rem >> 2] = $a$0 & -1;
  22830. HEAP32[$rem + 4 >> 2] = $a$1 & 0;
  22831. $_0$1 = 0;
  22832. $_0$0 = 0;
  22833. return (tempRet0 = $_0$1, $_0$0) | 0;
  22834. }
  22835. }
  22836. $17 = ($d_sroa_1_4_extract_trunc | 0) == 0;
  22837. do {
  22838. if (($d_sroa_0_0_extract_trunc | 0) == 0) {
  22839. if ($17) {
  22840. if (($rem | 0) != 0) {
  22841. HEAP32[$rem >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
  22842. HEAP32[$rem + 4 >> 2] = 0;
  22843. }
  22844. $_0$1 = 0;
  22845. $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
  22846. return (tempRet0 = $_0$1, $_0$0) | 0;
  22847. }
  22848. if (($n_sroa_0_0_extract_trunc | 0) == 0) {
  22849. if (($rem | 0) != 0) {
  22850. HEAP32[$rem >> 2] = 0;
  22851. HEAP32[$rem + 4 >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_1_4_extract_trunc >>> 0);
  22852. }
  22853. $_0$1 = 0;
  22854. $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_1_4_extract_trunc >>> 0) >>> 0;
  22855. return (tempRet0 = $_0$1, $_0$0) | 0;
  22856. }
  22857. $37 = $d_sroa_1_4_extract_trunc - 1 | 0;
  22858. if (($37 & $d_sroa_1_4_extract_trunc | 0) == 0) {
  22859. if (($rem | 0) != 0) {
  22860. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  22861. HEAP32[$rem + 4 >> 2] = $37 & $n_sroa_1_4_extract_trunc | $a$1 & 0;
  22862. }
  22863. $_0$1 = 0;
  22864. $_0$0 = $n_sroa_1_4_extract_trunc >>> ((_llvm_cttz_i32($d_sroa_1_4_extract_trunc | 0) | 0) >>> 0);
  22865. return (tempRet0 = $_0$1, $_0$0) | 0;
  22866. }
  22867. $49 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
  22868. $51 = $49 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  22869. if ($51 >>> 0 <= 30) {
  22870. $57 = $51 + 1 | 0;
  22871. $58 = 31 - $51 | 0;
  22872. $sr_1_ph = $57;
  22873. $r_sroa_0_1_ph = $n_sroa_1_4_extract_trunc << $58 | $n_sroa_0_0_extract_trunc >>> ($57 >>> 0);
  22874. $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($57 >>> 0);
  22875. $q_sroa_0_1_ph = 0;
  22876. $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $58;
  22877. break;
  22878. }
  22879. if (($rem | 0) == 0) {
  22880. $_0$1 = 0;
  22881. $_0$0 = 0;
  22882. return (tempRet0 = $_0$1, $_0$0) | 0;
  22883. }
  22884. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  22885. HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  22886. $_0$1 = 0;
  22887. $_0$0 = 0;
  22888. return (tempRet0 = $_0$1, $_0$0) | 0;
  22889. } else {
  22890. if (!$17) {
  22891. $117 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
  22892. $119 = $117 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  22893. if ($119 >>> 0 <= 31) {
  22894. $125 = $119 + 1 | 0;
  22895. $126 = 31 - $119 | 0;
  22896. $130 = $119 - 31 >> 31;
  22897. $sr_1_ph = $125;
  22898. $r_sroa_0_1_ph = $n_sroa_0_0_extract_trunc >>> ($125 >>> 0) & $130 | $n_sroa_1_4_extract_trunc << $126;
  22899. $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($125 >>> 0) & $130;
  22900. $q_sroa_0_1_ph = 0;
  22901. $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $126;
  22902. break;
  22903. }
  22904. if (($rem | 0) == 0) {
  22905. $_0$1 = 0;
  22906. $_0$0 = 0;
  22907. return (tempRet0 = $_0$1, $_0$0) | 0;
  22908. }
  22909. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  22910. HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  22911. $_0$1 = 0;
  22912. $_0$0 = 0;
  22913. return (tempRet0 = $_0$1, $_0$0) | 0;
  22914. }
  22915. $66 = $d_sroa_0_0_extract_trunc - 1 | 0;
  22916. if (($66 & $d_sroa_0_0_extract_trunc | 0) != 0) {
  22917. $86 = (_llvm_ctlz_i32($d_sroa_0_0_extract_trunc | 0) | 0) + 33 | 0;
  22918. $88 = $86 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  22919. $89 = 64 - $88 | 0;
  22920. $91 = 32 - $88 | 0;
  22921. $92 = $91 >> 31;
  22922. $95 = $88 - 32 | 0;
  22923. $105 = $95 >> 31;
  22924. $sr_1_ph = $88;
  22925. $r_sroa_0_1_ph = $91 - 1 >> 31 & $n_sroa_1_4_extract_trunc >>> ($95 >>> 0) | ($n_sroa_1_4_extract_trunc << $91 | $n_sroa_0_0_extract_trunc >>> ($88 >>> 0)) & $105;
  22926. $r_sroa_1_1_ph = $105 & $n_sroa_1_4_extract_trunc >>> ($88 >>> 0);
  22927. $q_sroa_0_1_ph = $n_sroa_0_0_extract_trunc << $89 & $92;
  22928. $q_sroa_1_1_ph = ($n_sroa_1_4_extract_trunc << $89 | $n_sroa_0_0_extract_trunc >>> ($95 >>> 0)) & $92 | $n_sroa_0_0_extract_trunc << $91 & $88 - 33 >> 31;
  22929. break;
  22930. }
  22931. if (($rem | 0) != 0) {
  22932. HEAP32[$rem >> 2] = $66 & $n_sroa_0_0_extract_trunc;
  22933. HEAP32[$rem + 4 >> 2] = 0;
  22934. }
  22935. if (($d_sroa_0_0_extract_trunc | 0) == 1) {
  22936. $_0$1 = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  22937. $_0$0 = 0 | $a$0 & -1;
  22938. return (tempRet0 = $_0$1, $_0$0) | 0;
  22939. } else {
  22940. $78 = _llvm_cttz_i32($d_sroa_0_0_extract_trunc | 0) | 0;
  22941. $_0$1 = 0 | $n_sroa_1_4_extract_trunc >>> ($78 >>> 0);
  22942. $_0$0 = $n_sroa_1_4_extract_trunc << 32 - $78 | $n_sroa_0_0_extract_trunc >>> ($78 >>> 0) | 0;
  22943. return (tempRet0 = $_0$1, $_0$0) | 0;
  22944. }
  22945. }
  22946. } while (0);
  22947. if (($sr_1_ph | 0) == 0) {
  22948. $q_sroa_1_1_lcssa = $q_sroa_1_1_ph;
  22949. $q_sroa_0_1_lcssa = $q_sroa_0_1_ph;
  22950. $r_sroa_1_1_lcssa = $r_sroa_1_1_ph;
  22951. $r_sroa_0_1_lcssa = $r_sroa_0_1_ph;
  22952. $carry_0_lcssa$1 = 0;
  22953. $carry_0_lcssa$0 = 0;
  22954. } else {
  22955. $d_sroa_0_0_insert_insert99$0 = 0 | $b$0 & -1;
  22956. $d_sroa_0_0_insert_insert99$1 = $d_sroa_1_4_extract_shift$0 | $b$1 & 0;
  22957. $137$0 = _i64Add($d_sroa_0_0_insert_insert99$0, $d_sroa_0_0_insert_insert99$1, -1, -1) | 0;
  22958. $137$1 = tempRet0;
  22959. $q_sroa_1_1198 = $q_sroa_1_1_ph;
  22960. $q_sroa_0_1199 = $q_sroa_0_1_ph;
  22961. $r_sroa_1_1200 = $r_sroa_1_1_ph;
  22962. $r_sroa_0_1201 = $r_sroa_0_1_ph;
  22963. $sr_1202 = $sr_1_ph;
  22964. $carry_0203 = 0;
  22965. while (1) {
  22966. $147 = $q_sroa_0_1199 >>> 31 | $q_sroa_1_1198 << 1;
  22967. $149 = $carry_0203 | $q_sroa_0_1199 << 1;
  22968. $r_sroa_0_0_insert_insert42$0 = 0 | ($r_sroa_0_1201 << 1 | $q_sroa_1_1198 >>> 31);
  22969. $r_sroa_0_0_insert_insert42$1 = $r_sroa_0_1201 >>> 31 | $r_sroa_1_1200 << 1 | 0;
  22970. _i64Subtract($137$0, $137$1, $r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1) | 0;
  22971. $150$1 = tempRet0;
  22972. $151$0 = $150$1 >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1;
  22973. $152 = $151$0 & 1;
  22974. $154$0 = _i64Subtract($r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1, $151$0 & $d_sroa_0_0_insert_insert99$0, ((($150$1 | 0) < 0 ? -1 : 0) >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1) & $d_sroa_0_0_insert_insert99$1) | 0;
  22975. $r_sroa_0_0_extract_trunc = $154$0;
  22976. $r_sroa_1_4_extract_trunc = tempRet0;
  22977. $155 = $sr_1202 - 1 | 0;
  22978. if (($155 | 0) == 0) {
  22979. break;
  22980. } else {
  22981. $q_sroa_1_1198 = $147;
  22982. $q_sroa_0_1199 = $149;
  22983. $r_sroa_1_1200 = $r_sroa_1_4_extract_trunc;
  22984. $r_sroa_0_1201 = $r_sroa_0_0_extract_trunc;
  22985. $sr_1202 = $155;
  22986. $carry_0203 = $152;
  22987. }
  22988. }
  22989. $q_sroa_1_1_lcssa = $147;
  22990. $q_sroa_0_1_lcssa = $149;
  22991. $r_sroa_1_1_lcssa = $r_sroa_1_4_extract_trunc;
  22992. $r_sroa_0_1_lcssa = $r_sroa_0_0_extract_trunc;
  22993. $carry_0_lcssa$1 = 0;
  22994. $carry_0_lcssa$0 = $152;
  22995. }
  22996. $q_sroa_0_0_insert_ext75$0 = $q_sroa_0_1_lcssa;
  22997. $q_sroa_0_0_insert_ext75$1 = 0;
  22998. $q_sroa_0_0_insert_insert77$1 = $q_sroa_1_1_lcssa | $q_sroa_0_0_insert_ext75$1;
  22999. if (($rem | 0) != 0) {
  23000. HEAP32[$rem >> 2] = 0 | $r_sroa_0_1_lcssa;
  23001. HEAP32[$rem + 4 >> 2] = $r_sroa_1_1_lcssa | 0;
  23002. }
  23003. $_0$1 = (0 | $q_sroa_0_0_insert_ext75$0) >>> 31 | $q_sroa_0_0_insert_insert77$1 << 1 | ($q_sroa_0_0_insert_ext75$1 << 1 | $q_sroa_0_0_insert_ext75$0 >>> 31) & 0 | $carry_0_lcssa$1;
  23004. $_0$0 = ($q_sroa_0_0_insert_ext75$0 << 1 | 0 >>> 31) & -2 | $carry_0_lcssa$0;
  23005. return (tempRet0 = $_0$1, $_0$0) | 0;
  23006. }
  23007. // =======================================================================
  23008. // EMSCRIPTEN_END_FUNCS
  23009. // EMSCRIPTEN_END_FUNCS
  23010. return { _curve25519_verify: _curve25519_verify, _crypto_sign_ed25519_ref10_ge_scalarmult_base: _crypto_sign_ed25519_ref10_ge_scalarmult_base, _curve25519_sign: _curve25519_sign, _free: _free, _i64Add: _i64Add, _memmove: _memmove, _bitshift64Ashr: _bitshift64Ashr, _sph_sha512_init: _sph_sha512_init, _curve25519_donna: _curve25519_donna, _memset: _memset, _malloc: _malloc, _memcpy: _memcpy, _strlen: _strlen, _bitshift64Lshr: _bitshift64Lshr, _i64Subtract: _i64Subtract, _bitshift64Shl: _bitshift64Shl, runPostSets: runPostSets, stackAlloc: stackAlloc, stackSave: stackSave, stackRestore: stackRestore, setThrew: setThrew, setTempRet0: setTempRet0, getTempRet0: getTempRet0 };
  23011. })
  23012. // EMSCRIPTEN_END_ASM
  23013. (Module.asmGlobalArg, Module.asmLibraryArg, buffer);
  23014. var _curve25519_verify = Module["_curve25519_verify"] = asm["_curve25519_verify"];
  23015. var _crypto_sign_ed25519_ref10_ge_scalarmult_base = Module["_crypto_sign_ed25519_ref10_ge_scalarmult_base"] = asm["_crypto_sign_ed25519_ref10_ge_scalarmult_base"];
  23016. var _curve25519_sign = Module["_curve25519_sign"] = asm["_curve25519_sign"];
  23017. var _free = Module["_free"] = asm["_free"];
  23018. var _i64Add = Module["_i64Add"] = asm["_i64Add"];
  23019. var _memmove = Module["_memmove"] = asm["_memmove"];
  23020. var _bitshift64Ashr = Module["_bitshift64Ashr"] = asm["_bitshift64Ashr"];
  23021. var _sph_sha512_init = Module["_sph_sha512_init"] = asm["_sph_sha512_init"];
  23022. var _curve25519_donna = Module["_curve25519_donna"] = asm["_curve25519_donna"];
  23023. var _memset = Module["_memset"] = asm["_memset"];
  23024. var _malloc = Module["_malloc"] = asm["_malloc"];
  23025. var _memcpy = Module["_memcpy"] = asm["_memcpy"];
  23026. var _strlen = Module["_strlen"] = asm["_strlen"];
  23027. var _bitshift64Lshr = Module["_bitshift64Lshr"] = asm["_bitshift64Lshr"];
  23028. var _i64Subtract = Module["_i64Subtract"] = asm["_i64Subtract"];
  23029. var _bitshift64Shl = Module["_bitshift64Shl"] = asm["_bitshift64Shl"];
  23030. var runPostSets = Module["runPostSets"] = asm["runPostSets"];
  23031. Runtime.stackAlloc = asm['stackAlloc'];
  23032. Runtime.stackSave = asm['stackSave'];
  23033. Runtime.stackRestore = asm['stackRestore'];
  23034. Runtime.setTempRet0 = asm['setTempRet0'];
  23035. Runtime.getTempRet0 = asm['getTempRet0'];
  23036. // TODO: strip out parts of this we do not need
  23037. //======= begin closure i64 code =======
  23038. // Copyright 2009 The Closure Library Authors. All Rights Reserved.
  23039. //
  23040. // Licensed under the Apache License, Version 2.0 (the "License");
  23041. // you may not use this file except in compliance with the License.
  23042. // You may obtain a copy of the License at
  23043. //
  23044. // http://www.apache.org/licenses/LICENSE-2.0
  23045. //
  23046. // Unless required by applicable law or agreed to in writing, software
  23047. // distributed under the License is distributed on an "AS-IS" BASIS,
  23048. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23049. // See the License for the specific language governing permissions and
  23050. // limitations under the License.
  23051. /**
  23052. * @fileoverview Defines a Long class for representing a 64-bit two's-complement
  23053. * integer value, which faithfully simulates the behavior of a Java "long". This
  23054. * implementation is derived from LongLib in GWT.
  23055. *
  23056. */
  23057. var i64Math = (function() { // Emscripten wrapper
  23058. var goog = { math: {} };
  23059. /**
  23060. * Constructs a 64-bit two's-complement integer, given its low and high 32-bit
  23061. * values as *signed* integers. See the from* functions below for more
  23062. * convenient ways of constructing Longs.
  23063. *
  23064. * The internal representation of a long is the two given signed, 32-bit values.
  23065. * We use 32-bit pieces because these are the size of integers on which
  23066. * Javascript performs bit-operations. For operations like addition and
  23067. * multiplication, we split each number into 16-bit pieces, which can easily be
  23068. * multiplied within Javascript's floating-point representation without overflow
  23069. * or change in sign.
  23070. *
  23071. * In the algorithms below, we frequently reduce the negative case to the
  23072. * positive case by negating the input(s) and then post-processing the result.
  23073. * Note that we must ALWAYS check specially whether those values are MIN_VALUE
  23074. * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
  23075. * a positive number, it overflows back into a negative). Not handling this
  23076. * case would often result in infinite recursion.
  23077. *
  23078. * @param {number} low The low (signed) 32 bits of the long.
  23079. * @param {number} high The high (signed) 32 bits of the long.
  23080. * @constructor
  23081. */
  23082. goog.math.Long = function(low, high) {
  23083. /**
  23084. * @type {number}
  23085. * @private
  23086. */
  23087. this.low_ = low | 0; // force into 32 signed bits.
  23088. /**
  23089. * @type {number}
  23090. * @private
  23091. */
  23092. this.high_ = high | 0; // force into 32 signed bits.
  23093. };
  23094. // NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the
  23095. // from* methods on which they depend.
  23096. /**
  23097. * A cache of the Long representations of small integer values.
  23098. * @type {!Object}
  23099. * @private
  23100. */
  23101. goog.math.Long.IntCache_ = {};
  23102. /**
  23103. * Returns a Long representing the given (32-bit) integer value.
  23104. * @param {number} value The 32-bit integer in question.
  23105. * @return {!goog.math.Long} The corresponding Long value.
  23106. */
  23107. goog.math.Long.fromInt = function(value) {
  23108. if (-128 <= value && value < 128) {
  23109. var cachedObj = goog.math.Long.IntCache_[value];
  23110. if (cachedObj) {
  23111. return cachedObj;
  23112. }
  23113. }
  23114. var obj = new goog.math.Long(value | 0, value < 0 ? -1 : 0);
  23115. if (-128 <= value && value < 128) {
  23116. goog.math.Long.IntCache_[value] = obj;
  23117. }
  23118. return obj;
  23119. };
  23120. /**
  23121. * Returns a Long representing the given value, provided that it is a finite
  23122. * number. Otherwise, zero is returned.
  23123. * @param {number} value The number in question.
  23124. * @return {!goog.math.Long} The corresponding Long value.
  23125. */
  23126. goog.math.Long.fromNumber = function(value) {
  23127. if (isNaN(value) || !isFinite(value)) {
  23128. return goog.math.Long.ZERO;
  23129. } else if (value <= -goog.math.Long.TWO_PWR_63_DBL_) {
  23130. return goog.math.Long.MIN_VALUE;
  23131. } else if (value + 1 >= goog.math.Long.TWO_PWR_63_DBL_) {
  23132. return goog.math.Long.MAX_VALUE;
  23133. } else if (value < 0) {
  23134. return goog.math.Long.fromNumber(-value).negate();
  23135. } else {
  23136. return new goog.math.Long(
  23137. (value % goog.math.Long.TWO_PWR_32_DBL_) | 0,
  23138. (value / goog.math.Long.TWO_PWR_32_DBL_) | 0);
  23139. }
  23140. };
  23141. /**
  23142. * Returns a Long representing the 64-bit integer that comes by concatenating
  23143. * the given high and low bits. Each is assumed to use 32 bits.
  23144. * @param {number} lowBits The low 32-bits.
  23145. * @param {number} highBits The high 32-bits.
  23146. * @return {!goog.math.Long} The corresponding Long value.
  23147. */
  23148. goog.math.Long.fromBits = function(lowBits, highBits) {
  23149. return new goog.math.Long(lowBits, highBits);
  23150. };
  23151. /**
  23152. * Returns a Long representation of the given string, written using the given
  23153. * radix.
  23154. * @param {string} str The textual representation of the Long.
  23155. * @param {number=} opt_radix The radix in which the text is written.
  23156. * @return {!goog.math.Long} The corresponding Long value.
  23157. */
  23158. goog.math.Long.fromString = function(str, opt_radix) {
  23159. if (str.length == 0) {
  23160. throw Error('number format error: empty string');
  23161. }
  23162. var radix = opt_radix || 10;
  23163. if (radix < 2 || 36 < radix) {
  23164. throw Error('radix out of range: ' + radix);
  23165. }
  23166. if (str.charAt(0) == '-') {
  23167. return goog.math.Long.fromString(str.substring(1), radix).negate();
  23168. } else if (str.indexOf('-') >= 0) {
  23169. throw Error('number format error: interior "-" character: ' + str);
  23170. }
  23171. // Do several (8) digits each time through the loop, so as to
  23172. // minimize the calls to the very expensive emulated div.
  23173. var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 8));
  23174. var result = goog.math.Long.ZERO;
  23175. for (var i = 0; i < str.length; i += 8) {
  23176. var size = Math.min(8, str.length - i);
  23177. var value = parseInt(str.substring(i, i + size), radix);
  23178. if (size < 8) {
  23179. var power = goog.math.Long.fromNumber(Math.pow(radix, size));
  23180. result = result.multiply(power).add(goog.math.Long.fromNumber(value));
  23181. } else {
  23182. result = result.multiply(radixToPower);
  23183. result = result.add(goog.math.Long.fromNumber(value));
  23184. }
  23185. }
  23186. return result;
  23187. };
  23188. // NOTE: the compiler should inline these constant values below and then remove
  23189. // these variables, so there should be no runtime penalty for these.
  23190. /**
  23191. * Number used repeated below in calculations. This must appear before the
  23192. * first call to any from* function below.
  23193. * @type {number}
  23194. * @private
  23195. */
  23196. goog.math.Long.TWO_PWR_16_DBL_ = 1 << 16;
  23197. /**
  23198. * @type {number}
  23199. * @private
  23200. */
  23201. goog.math.Long.TWO_PWR_24_DBL_ = 1 << 24;
  23202. /**
  23203. * @type {number}
  23204. * @private
  23205. */
  23206. goog.math.Long.TWO_PWR_32_DBL_ =
  23207. goog.math.Long.TWO_PWR_16_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
  23208. /**
  23209. * @type {number}
  23210. * @private
  23211. */
  23212. goog.math.Long.TWO_PWR_31_DBL_ =
  23213. goog.math.Long.TWO_PWR_32_DBL_ / 2;
  23214. /**
  23215. * @type {number}
  23216. * @private
  23217. */
  23218. goog.math.Long.TWO_PWR_48_DBL_ =
  23219. goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
  23220. /**
  23221. * @type {number}
  23222. * @private
  23223. */
  23224. goog.math.Long.TWO_PWR_64_DBL_ =
  23225. goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_32_DBL_;
  23226. /**
  23227. * @type {number}
  23228. * @private
  23229. */
  23230. goog.math.Long.TWO_PWR_63_DBL_ =
  23231. goog.math.Long.TWO_PWR_64_DBL_ / 2;
  23232. /** @type {!goog.math.Long} */
  23233. goog.math.Long.ZERO = goog.math.Long.fromInt(0);
  23234. /** @type {!goog.math.Long} */
  23235. goog.math.Long.ONE = goog.math.Long.fromInt(1);
  23236. /** @type {!goog.math.Long} */
  23237. goog.math.Long.NEG_ONE = goog.math.Long.fromInt(-1);
  23238. /** @type {!goog.math.Long} */
  23239. goog.math.Long.MAX_VALUE =
  23240. goog.math.Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);
  23241. /** @type {!goog.math.Long} */
  23242. goog.math.Long.MIN_VALUE = goog.math.Long.fromBits(0, 0x80000000 | 0);
  23243. /**
  23244. * @type {!goog.math.Long}
  23245. * @private
  23246. */
  23247. goog.math.Long.TWO_PWR_24_ = goog.math.Long.fromInt(1 << 24);
  23248. /** @return {number} The value, assuming it is a 32-bit integer. */
  23249. goog.math.Long.prototype.toInt = function() {
  23250. return this.low_;
  23251. };
  23252. /** @return {number} The closest floating-point representation to this value. */
  23253. goog.math.Long.prototype.toNumber = function() {
  23254. return this.high_ * goog.math.Long.TWO_PWR_32_DBL_ +
  23255. this.getLowBitsUnsigned();
  23256. };
  23257. /**
  23258. * @param {number=} opt_radix The radix in which the text should be written.
  23259. * @return {string} The textual representation of this value.
  23260. */
  23261. goog.math.Long.prototype.toString = function(opt_radix) {
  23262. var radix = opt_radix || 10;
  23263. if (radix < 2 || 36 < radix) {
  23264. throw Error('radix out of range: ' + radix);
  23265. }
  23266. if (this.isZero()) {
  23267. return '0';
  23268. }
  23269. if (this.isNegative()) {
  23270. if (this.equals(goog.math.Long.MIN_VALUE)) {
  23271. // We need to change the Long value before it can be negated, so we remove
  23272. // the bottom-most digit in this base and then recurse to do the rest.
  23273. var radixLong = goog.math.Long.fromNumber(radix);
  23274. var div = this.div(radixLong);
  23275. var rem = div.multiply(radixLong).subtract(this);
  23276. return div.toString(radix) + rem.toInt().toString(radix);
  23277. } else {
  23278. return '-' + this.negate().toString(radix);
  23279. }
  23280. }
  23281. // Do several (6) digits each time through the loop, so as to
  23282. // minimize the calls to the very expensive emulated div.
  23283. var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 6));
  23284. var rem = this;
  23285. var result = '';
  23286. while (true) {
  23287. var remDiv = rem.div(radixToPower);
  23288. var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();
  23289. var digits = intval.toString(radix);
  23290. rem = remDiv;
  23291. if (rem.isZero()) {
  23292. return digits + result;
  23293. } else {
  23294. while (digits.length < 6) {
  23295. digits = '0' + digits;
  23296. }
  23297. result = '' + digits + result;
  23298. }
  23299. }
  23300. };
  23301. /** @return {number} The high 32-bits as a signed value. */
  23302. goog.math.Long.prototype.getHighBits = function() {
  23303. return this.high_;
  23304. };
  23305. /** @return {number} The low 32-bits as a signed value. */
  23306. goog.math.Long.prototype.getLowBits = function() {
  23307. return this.low_;
  23308. };
  23309. /** @return {number} The low 32-bits as an unsigned value. */
  23310. goog.math.Long.prototype.getLowBitsUnsigned = function() {
  23311. return (this.low_ >= 0) ?
  23312. this.low_ : goog.math.Long.TWO_PWR_32_DBL_ + this.low_;
  23313. };
  23314. /**
  23315. * @return {number} Returns the number of bits needed to represent the absolute
  23316. * value of this Long.
  23317. */
  23318. goog.math.Long.prototype.getNumBitsAbs = function() {
  23319. if (this.isNegative()) {
  23320. if (this.equals(goog.math.Long.MIN_VALUE)) {
  23321. return 64;
  23322. } else {
  23323. return this.negate().getNumBitsAbs();
  23324. }
  23325. } else {
  23326. var val = this.high_ != 0 ? this.high_ : this.low_;
  23327. for (var bit = 31; bit > 0; bit--) {
  23328. if ((val & (1 << bit)) != 0) {
  23329. break;
  23330. }
  23331. }
  23332. return this.high_ != 0 ? bit + 33 : bit + 1;
  23333. }
  23334. };
  23335. /** @return {boolean} Whether this value is zero. */
  23336. goog.math.Long.prototype.isZero = function() {
  23337. return this.high_ == 0 && this.low_ == 0;
  23338. };
  23339. /** @return {boolean} Whether this value is negative. */
  23340. goog.math.Long.prototype.isNegative = function() {
  23341. return this.high_ < 0;
  23342. };
  23343. /** @return {boolean} Whether this value is odd. */
  23344. goog.math.Long.prototype.isOdd = function() {
  23345. return (this.low_ & 1) == 1;
  23346. };
  23347. /**
  23348. * @param {goog.math.Long} other Long to compare against.
  23349. * @return {boolean} Whether this Long equals the other.
  23350. */
  23351. goog.math.Long.prototype.equals = function(other) {
  23352. return (this.high_ == other.high_) && (this.low_ == other.low_);
  23353. };
  23354. /**
  23355. * @param {goog.math.Long} other Long to compare against.
  23356. * @return {boolean} Whether this Long does not equal the other.
  23357. */
  23358. goog.math.Long.prototype.notEquals = function(other) {
  23359. return (this.high_ != other.high_) || (this.low_ != other.low_);
  23360. };
  23361. /**
  23362. * @param {goog.math.Long} other Long to compare against.
  23363. * @return {boolean} Whether this Long is less than the other.
  23364. */
  23365. goog.math.Long.prototype.lessThan = function(other) {
  23366. return this.compare(other) < 0;
  23367. };
  23368. /**
  23369. * @param {goog.math.Long} other Long to compare against.
  23370. * @return {boolean} Whether this Long is less than or equal to the other.
  23371. */
  23372. goog.math.Long.prototype.lessThanOrEqual = function(other) {
  23373. return this.compare(other) <= 0;
  23374. };
  23375. /**
  23376. * @param {goog.math.Long} other Long to compare against.
  23377. * @return {boolean} Whether this Long is greater than the other.
  23378. */
  23379. goog.math.Long.prototype.greaterThan = function(other) {
  23380. return this.compare(other) > 0;
  23381. };
  23382. /**
  23383. * @param {goog.math.Long} other Long to compare against.
  23384. * @return {boolean} Whether this Long is greater than or equal to the other.
  23385. */
  23386. goog.math.Long.prototype.greaterThanOrEqual = function(other) {
  23387. return this.compare(other) >= 0;
  23388. };
  23389. /**
  23390. * Compares this Long with the given one.
  23391. * @param {goog.math.Long} other Long to compare against.
  23392. * @return {number} 0 if they are the same, 1 if the this is greater, and -1
  23393. * if the given one is greater.
  23394. */
  23395. goog.math.Long.prototype.compare = function(other) {
  23396. if (this.equals(other)) {
  23397. return 0;
  23398. }
  23399. var thisNeg = this.isNegative();
  23400. var otherNeg = other.isNegative();
  23401. if (thisNeg && !otherNeg) {
  23402. return -1;
  23403. }
  23404. if (!thisNeg && otherNeg) {
  23405. return 1;
  23406. }
  23407. // at this point, the signs are the same, so subtraction will not overflow
  23408. if (this.subtract(other).isNegative()) {
  23409. return -1;
  23410. } else {
  23411. return 1;
  23412. }
  23413. };
  23414. /** @return {!goog.math.Long} The negation of this value. */
  23415. goog.math.Long.prototype.negate = function() {
  23416. if (this.equals(goog.math.Long.MIN_VALUE)) {
  23417. return goog.math.Long.MIN_VALUE;
  23418. } else {
  23419. return this.not().add(goog.math.Long.ONE);
  23420. }
  23421. };
  23422. /**
  23423. * Returns the sum of this and the given Long.
  23424. * @param {goog.math.Long} other Long to add to this one.
  23425. * @return {!goog.math.Long} The sum of this and the given Long.
  23426. */
  23427. goog.math.Long.prototype.add = function(other) {
  23428. // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
  23429. var a48 = this.high_ >>> 16;
  23430. var a32 = this.high_ & 0xFFFF;
  23431. var a16 = this.low_ >>> 16;
  23432. var a00 = this.low_ & 0xFFFF;
  23433. var b48 = other.high_ >>> 16;
  23434. var b32 = other.high_ & 0xFFFF;
  23435. var b16 = other.low_ >>> 16;
  23436. var b00 = other.low_ & 0xFFFF;
  23437. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  23438. c00 += a00 + b00;
  23439. c16 += c00 >>> 16;
  23440. c00 &= 0xFFFF;
  23441. c16 += a16 + b16;
  23442. c32 += c16 >>> 16;
  23443. c16 &= 0xFFFF;
  23444. c32 += a32 + b32;
  23445. c48 += c32 >>> 16;
  23446. c32 &= 0xFFFF;
  23447. c48 += a48 + b48;
  23448. c48 &= 0xFFFF;
  23449. return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
  23450. };
  23451. /**
  23452. * Returns the difference of this and the given Long.
  23453. * @param {goog.math.Long} other Long to subtract from this.
  23454. * @return {!goog.math.Long} The difference of this and the given Long.
  23455. */
  23456. goog.math.Long.prototype.subtract = function(other) {
  23457. return this.add(other.negate());
  23458. };
  23459. /**
  23460. * Returns the product of this and the given long.
  23461. * @param {goog.math.Long} other Long to multiply with this.
  23462. * @return {!goog.math.Long} The product of this and the other.
  23463. */
  23464. goog.math.Long.prototype.multiply = function(other) {
  23465. if (this.isZero()) {
  23466. return goog.math.Long.ZERO;
  23467. } else if (other.isZero()) {
  23468. return goog.math.Long.ZERO;
  23469. }
  23470. if (this.equals(goog.math.Long.MIN_VALUE)) {
  23471. return other.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
  23472. } else if (other.equals(goog.math.Long.MIN_VALUE)) {
  23473. return this.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
  23474. }
  23475. if (this.isNegative()) {
  23476. if (other.isNegative()) {
  23477. return this.negate().multiply(other.negate());
  23478. } else {
  23479. return this.negate().multiply(other).negate();
  23480. }
  23481. } else if (other.isNegative()) {
  23482. return this.multiply(other.negate()).negate();
  23483. }
  23484. // If both longs are small, use float multiplication
  23485. if (this.lessThan(goog.math.Long.TWO_PWR_24_) &&
  23486. other.lessThan(goog.math.Long.TWO_PWR_24_)) {
  23487. return goog.math.Long.fromNumber(this.toNumber() * other.toNumber());
  23488. }
  23489. // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
  23490. // We can skip products that would overflow.
  23491. var a48 = this.high_ >>> 16;
  23492. var a32 = this.high_ & 0xFFFF;
  23493. var a16 = this.low_ >>> 16;
  23494. var a00 = this.low_ & 0xFFFF;
  23495. var b48 = other.high_ >>> 16;
  23496. var b32 = other.high_ & 0xFFFF;
  23497. var b16 = other.low_ >>> 16;
  23498. var b00 = other.low_ & 0xFFFF;
  23499. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  23500. c00 += a00 * b00;
  23501. c16 += c00 >>> 16;
  23502. c00 &= 0xFFFF;
  23503. c16 += a16 * b00;
  23504. c32 += c16 >>> 16;
  23505. c16 &= 0xFFFF;
  23506. c16 += a00 * b16;
  23507. c32 += c16 >>> 16;
  23508. c16 &= 0xFFFF;
  23509. c32 += a32 * b00;
  23510. c48 += c32 >>> 16;
  23511. c32 &= 0xFFFF;
  23512. c32 += a16 * b16;
  23513. c48 += c32 >>> 16;
  23514. c32 &= 0xFFFF;
  23515. c32 += a00 * b32;
  23516. c48 += c32 >>> 16;
  23517. c32 &= 0xFFFF;
  23518. c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
  23519. c48 &= 0xFFFF;
  23520. return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
  23521. };
  23522. /**
  23523. * Returns this Long divided by the given one.
  23524. * @param {goog.math.Long} other Long by which to divide.
  23525. * @return {!goog.math.Long} This Long divided by the given one.
  23526. */
  23527. goog.math.Long.prototype.div = function(other) {
  23528. if (other.isZero()) {
  23529. throw Error('division by zero');
  23530. } else if (this.isZero()) {
  23531. return goog.math.Long.ZERO;
  23532. }
  23533. if (this.equals(goog.math.Long.MIN_VALUE)) {
  23534. if (other.equals(goog.math.Long.ONE) ||
  23535. other.equals(goog.math.Long.NEG_ONE)) {
  23536. return goog.math.Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
  23537. } else if (other.equals(goog.math.Long.MIN_VALUE)) {
  23538. return goog.math.Long.ONE;
  23539. } else {
  23540. // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
  23541. var halfThis = this.shiftRight(1);
  23542. var approx = halfThis.div(other).shiftLeft(1);
  23543. if (approx.equals(goog.math.Long.ZERO)) {
  23544. return other.isNegative() ? goog.math.Long.ONE : goog.math.Long.NEG_ONE;
  23545. } else {
  23546. var rem = this.subtract(other.multiply(approx));
  23547. var result = approx.add(rem.div(other));
  23548. return result;
  23549. }
  23550. }
  23551. } else if (other.equals(goog.math.Long.MIN_VALUE)) {
  23552. return goog.math.Long.ZERO;
  23553. }
  23554. if (this.isNegative()) {
  23555. if (other.isNegative()) {
  23556. return this.negate().div(other.negate());
  23557. } else {
  23558. return this.negate().div(other).negate();
  23559. }
  23560. } else if (other.isNegative()) {
  23561. return this.div(other.negate()).negate();
  23562. }
  23563. // Repeat the following until the remainder is less than other: find a
  23564. // floating-point that approximates remainder / other *from below*, add this
  23565. // into the result, and subtract it from the remainder. It is critical that
  23566. // the approximate value is less than or equal to the real value so that the
  23567. // remainder never becomes negative.
  23568. var res = goog.math.Long.ZERO;
  23569. var rem = this;
  23570. while (rem.greaterThanOrEqual(other)) {
  23571. // Approximate the result of division. This may be a little greater or
  23572. // smaller than the actual value.
  23573. var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));
  23574. // We will tweak the approximate result by changing it in the 48-th digit or
  23575. // the smallest non-fractional digit, whichever is larger.
  23576. var log2 = Math.ceil(Math.log(approx) / Math.LN2);
  23577. var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);
  23578. // Decrease the approximation until it is smaller than the remainder. Note
  23579. // that if it is too large, the product overflows and is negative.
  23580. var approxRes = goog.math.Long.fromNumber(approx);
  23581. var approxRem = approxRes.multiply(other);
  23582. while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
  23583. approx -= delta;
  23584. approxRes = goog.math.Long.fromNumber(approx);
  23585. approxRem = approxRes.multiply(other);
  23586. }
  23587. // We know the answer can't be zero... and actually, zero would cause
  23588. // infinite recursion since we would make no progress.
  23589. if (approxRes.isZero()) {
  23590. approxRes = goog.math.Long.ONE;
  23591. }
  23592. res = res.add(approxRes);
  23593. rem = rem.subtract(approxRem);
  23594. }
  23595. return res;
  23596. };
  23597. /**
  23598. * Returns this Long modulo the given one.
  23599. * @param {goog.math.Long} other Long by which to mod.
  23600. * @return {!goog.math.Long} This Long modulo the given one.
  23601. */
  23602. goog.math.Long.prototype.modulo = function(other) {
  23603. return this.subtract(this.div(other).multiply(other));
  23604. };
  23605. /** @return {!goog.math.Long} The bitwise-NOT of this value. */
  23606. goog.math.Long.prototype.not = function() {
  23607. return goog.math.Long.fromBits(~this.low_, ~this.high_);
  23608. };
  23609. /**
  23610. * Returns the bitwise-AND of this Long and the given one.
  23611. * @param {goog.math.Long} other The Long with which to AND.
  23612. * @return {!goog.math.Long} The bitwise-AND of this and the other.
  23613. */
  23614. goog.math.Long.prototype.and = function(other) {
  23615. return goog.math.Long.fromBits(this.low_ & other.low_,
  23616. this.high_ & other.high_);
  23617. };
  23618. /**
  23619. * Returns the bitwise-OR of this Long and the given one.
  23620. * @param {goog.math.Long} other The Long with which to OR.
  23621. * @return {!goog.math.Long} The bitwise-OR of this and the other.
  23622. */
  23623. goog.math.Long.prototype.or = function(other) {
  23624. return goog.math.Long.fromBits(this.low_ | other.low_,
  23625. this.high_ | other.high_);
  23626. };
  23627. /**
  23628. * Returns the bitwise-XOR of this Long and the given one.
  23629. * @param {goog.math.Long} other The Long with which to XOR.
  23630. * @return {!goog.math.Long} The bitwise-XOR of this and the other.
  23631. */
  23632. goog.math.Long.prototype.xor = function(other) {
  23633. return goog.math.Long.fromBits(this.low_ ^ other.low_,
  23634. this.high_ ^ other.high_);
  23635. };
  23636. /**
  23637. * Returns this Long with bits shifted to the left by the given amount.
  23638. * @param {number} numBits The number of bits by which to shift.
  23639. * @return {!goog.math.Long} This shifted to the left by the given amount.
  23640. */
  23641. goog.math.Long.prototype.shiftLeft = function(numBits) {
  23642. numBits &= 63;
  23643. if (numBits == 0) {
  23644. return this;
  23645. } else {
  23646. var low = this.low_;
  23647. if (numBits < 32) {
  23648. var high = this.high_;
  23649. return goog.math.Long.fromBits(
  23650. low << numBits,
  23651. (high << numBits) | (low >>> (32 - numBits)));
  23652. } else {
  23653. return goog.math.Long.fromBits(0, low << (numBits - 32));
  23654. }
  23655. }
  23656. };
  23657. /**
  23658. * Returns this Long with bits shifted to the right by the given amount.
  23659. * @param {number} numBits The number of bits by which to shift.
  23660. * @return {!goog.math.Long} This shifted to the right by the given amount.
  23661. */
  23662. goog.math.Long.prototype.shiftRight = function(numBits) {
  23663. numBits &= 63;
  23664. if (numBits == 0) {
  23665. return this;
  23666. } else {
  23667. var high = this.high_;
  23668. if (numBits < 32) {
  23669. var low = this.low_;
  23670. return goog.math.Long.fromBits(
  23671. (low >>> numBits) | (high << (32 - numBits)),
  23672. high >> numBits);
  23673. } else {
  23674. return goog.math.Long.fromBits(
  23675. high >> (numBits - 32),
  23676. high >= 0 ? 0 : -1);
  23677. }
  23678. }
  23679. };
  23680. /**
  23681. * Returns this Long with bits shifted to the right by the given amount, with
  23682. * the new top bits matching the current sign bit.
  23683. * @param {number} numBits The number of bits by which to shift.
  23684. * @return {!goog.math.Long} This shifted to the right by the given amount, with
  23685. * zeros placed into the new leading bits.
  23686. */
  23687. goog.math.Long.prototype.shiftRightUnsigned = function(numBits) {
  23688. numBits &= 63;
  23689. if (numBits == 0) {
  23690. return this;
  23691. } else {
  23692. var high = this.high_;
  23693. if (numBits < 32) {
  23694. var low = this.low_;
  23695. return goog.math.Long.fromBits(
  23696. (low >>> numBits) | (high << (32 - numBits)),
  23697. high >>> numBits);
  23698. } else if (numBits == 32) {
  23699. return goog.math.Long.fromBits(high, 0);
  23700. } else {
  23701. return goog.math.Long.fromBits(high >>> (numBits - 32), 0);
  23702. }
  23703. }
  23704. };
  23705. //======= begin jsbn =======
  23706. var navigator = { appName: 'Modern Browser' }; // polyfill a little
  23707. // Copyright (c) 2005 Tom Wu
  23708. // All Rights Reserved.
  23709. // http://www-cs-students.stanford.edu/~tjw/jsbn/
  23710. /*
  23711. * Copyright (c) 2003-2005 Tom Wu
  23712. * All Rights Reserved.
  23713. *
  23714. * Permission is hereby granted, free of charge, to any person obtaining
  23715. * a copy of this software and associated documentation files (the
  23716. * "Software"), to deal in the Software without restriction, including
  23717. * without limitation the rights to use, copy, modify, merge, publish,
  23718. * distribute, sublicense, and/or sell copies of the Software, and to
  23719. * permit persons to whom the Software is furnished to do so, subject to
  23720. * the following conditions:
  23721. *
  23722. * The above copyright notice and this permission notice shall be
  23723. * included in all copies or substantial portions of the Software.
  23724. *
  23725. * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  23726. * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  23727. * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  23728. *
  23729. * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  23730. * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
  23731. * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
  23732. * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
  23733. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  23734. *
  23735. * In addition, the following condition applies:
  23736. *
  23737. * All redistributions must retain an intact copy of this copyright notice
  23738. * and disclaimer.
  23739. */
  23740. // Basic JavaScript BN library - subset useful for RSA encryption.
  23741. // Bits per digit
  23742. var dbits;
  23743. // JavaScript engine analysis
  23744. var canary = 0xdeadbeefcafe;
  23745. var j_lm = ((canary&0xffffff)==0xefcafe);
  23746. // (public) Constructor
  23747. function BigInteger(a,b,c) {
  23748. if(a != null)
  23749. if("number" == typeof a) this.fromNumber(a,b,c);
  23750. else if(b == null && "string" != typeof a) this.fromString(a,256);
  23751. else this.fromString(a,b);
  23752. }
  23753. // return new, unset BigInteger
  23754. function nbi() { return new BigInteger(null); }
  23755. // am: Compute w_j += (x*this_i), propagate carries,
  23756. // c is initial carry, returns final carry.
  23757. // c < 3*dvalue, x < 2*dvalue, this_i < dvalue
  23758. // We need to select the fastest one that works in this environment.
  23759. // am1: use a single mult and divide to get the high bits,
  23760. // max digit bits should be 26 because
  23761. // max internal value = 2*dvalue^2-2*dvalue (< 2^53)
  23762. function am1(i,x,w,j,c,n) {
  23763. while(--n >= 0) {
  23764. var v = x*this[i++]+w[j]+c;
  23765. c = Math.floor(v/0x4000000);
  23766. w[j++] = v&0x3ffffff;
  23767. }
  23768. return c;
  23769. }
  23770. // am2 avoids a big mult-and-extract completely.
  23771. // Max digit bits should be <= 30 because we do bitwise ops
  23772. // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
  23773. function am2(i,x,w,j,c,n) {
  23774. var xl = x&0x7fff, xh = x>>15;
  23775. while(--n >= 0) {
  23776. var l = this[i]&0x7fff;
  23777. var h = this[i++]>>15;
  23778. var m = xh*l+h*xl;
  23779. l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
  23780. c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
  23781. w[j++] = l&0x3fffffff;
  23782. }
  23783. return c;
  23784. }
  23785. // Alternately, set max digit bits to 28 since some
  23786. // browsers slow down when dealing with 32-bit numbers.
  23787. function am3(i,x,w,j,c,n) {
  23788. var xl = x&0x3fff, xh = x>>14;
  23789. while(--n >= 0) {
  23790. var l = this[i]&0x3fff;
  23791. var h = this[i++]>>14;
  23792. var m = xh*l+h*xl;
  23793. l = xl*l+((m&0x3fff)<<14)+w[j]+c;
  23794. c = (l>>28)+(m>>14)+xh*h;
  23795. w[j++] = l&0xfffffff;
  23796. }
  23797. return c;
  23798. }
  23799. if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
  23800. BigInteger.prototype.am = am2;
  23801. dbits = 30;
  23802. }
  23803. else if(j_lm && (navigator.appName != "Netscape")) {
  23804. BigInteger.prototype.am = am1;
  23805. dbits = 26;
  23806. }
  23807. else { // Mozilla/Netscape seems to prefer am3
  23808. BigInteger.prototype.am = am3;
  23809. dbits = 28;
  23810. }
  23811. BigInteger.prototype.DB = dbits;
  23812. BigInteger.prototype.DM = ((1<<dbits)-1);
  23813. BigInteger.prototype.DV = (1<<dbits);
  23814. var BI_FP = 52;
  23815. BigInteger.prototype.FV = Math.pow(2,BI_FP);
  23816. BigInteger.prototype.F1 = BI_FP-dbits;
  23817. BigInteger.prototype.F2 = 2*dbits-BI_FP;
  23818. // Digit conversions
  23819. var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
  23820. var BI_RC = new Array();
  23821. var rr,vv;
  23822. rr = "0".charCodeAt(0);
  23823. for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
  23824. rr = "a".charCodeAt(0);
  23825. for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
  23826. rr = "A".charCodeAt(0);
  23827. for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
  23828. function int2char(n) { return BI_RM.charAt(n); }
  23829. function intAt(s,i) {
  23830. var c = BI_RC[s.charCodeAt(i)];
  23831. return (c==null)?-1:c;
  23832. }
  23833. // (protected) copy this to r
  23834. function bnpCopyTo(r) {
  23835. for(var i = this.t-1; i >= 0; --i) r[i] = this[i];
  23836. r.t = this.t;
  23837. r.s = this.s;
  23838. }
  23839. // (protected) set from integer value x, -DV <= x < DV
  23840. function bnpFromInt(x) {
  23841. this.t = 1;
  23842. this.s = (x<0)?-1:0;
  23843. if(x > 0) this[0] = x;
  23844. else if(x < -1) this[0] = x+DV;
  23845. else this.t = 0;
  23846. }
  23847. // return bigint initialized to value
  23848. function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
  23849. // (protected) set from string and radix
  23850. function bnpFromString(s,b) {
  23851. var k;
  23852. if(b == 16) k = 4;
  23853. else if(b == 8) k = 3;
  23854. else if(b == 256) k = 8; // byte array
  23855. else if(b == 2) k = 1;
  23856. else if(b == 32) k = 5;
  23857. else if(b == 4) k = 2;
  23858. else { this.fromRadix(s,b); return; }
  23859. this.t = 0;
  23860. this.s = 0;
  23861. var i = s.length, mi = false, sh = 0;
  23862. while(--i >= 0) {
  23863. var x = (k==8)?s[i]&0xff:intAt(s,i);
  23864. if(x < 0) {
  23865. if(s.charAt(i) == "-") mi = true;
  23866. continue;
  23867. }
  23868. mi = false;
  23869. if(sh == 0)
  23870. this[this.t++] = x;
  23871. else if(sh+k > this.DB) {
  23872. this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
  23873. this[this.t++] = (x>>(this.DB-sh));
  23874. }
  23875. else
  23876. this[this.t-1] |= x<<sh;
  23877. sh += k;
  23878. if(sh >= this.DB) sh -= this.DB;
  23879. }
  23880. if(k == 8 && (s[0]&0x80) != 0) {
  23881. this.s = -1;
  23882. if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
  23883. }
  23884. this.clamp();
  23885. if(mi) BigInteger.ZERO.subTo(this,this);
  23886. }
  23887. // (protected) clamp off excess high words
  23888. function bnpClamp() {
  23889. var c = this.s&this.DM;
  23890. while(this.t > 0 && this[this.t-1] == c) --this.t;
  23891. }
  23892. // (public) return string representation in given radix
  23893. function bnToString(b) {
  23894. if(this.s < 0) return "-"+this.negate().toString(b);
  23895. var k;
  23896. if(b == 16) k = 4;
  23897. else if(b == 8) k = 3;
  23898. else if(b == 2) k = 1;
  23899. else if(b == 32) k = 5;
  23900. else if(b == 4) k = 2;
  23901. else return this.toRadix(b);
  23902. var km = (1<<k)-1, d, m = false, r = "", i = this.t;
  23903. var p = this.DB-(i*this.DB)%k;
  23904. if(i-- > 0) {
  23905. if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
  23906. while(i >= 0) {
  23907. if(p < k) {
  23908. d = (this[i]&((1<<p)-1))<<(k-p);
  23909. d |= this[--i]>>(p+=this.DB-k);
  23910. }
  23911. else {
  23912. d = (this[i]>>(p-=k))&km;
  23913. if(p <= 0) { p += this.DB; --i; }
  23914. }
  23915. if(d > 0) m = true;
  23916. if(m) r += int2char(d);
  23917. }
  23918. }
  23919. return m?r:"0";
  23920. }
  23921. // (public) -this
  23922. function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
  23923. // (public) |this|
  23924. function bnAbs() { return (this.s<0)?this.negate():this; }
  23925. // (public) return + if this > a, - if this < a, 0 if equal
  23926. function bnCompareTo(a) {
  23927. var r = this.s-a.s;
  23928. if(r != 0) return r;
  23929. var i = this.t;
  23930. r = i-a.t;
  23931. if(r != 0) return (this.s<0)?-r:r;
  23932. while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
  23933. return 0;
  23934. }
  23935. // returns bit length of the integer x
  23936. function nbits(x) {
  23937. var r = 1, t;
  23938. if((t=x>>>16) != 0) { x = t; r += 16; }
  23939. if((t=x>>8) != 0) { x = t; r += 8; }
  23940. if((t=x>>4) != 0) { x = t; r += 4; }
  23941. if((t=x>>2) != 0) { x = t; r += 2; }
  23942. if((t=x>>1) != 0) { x = t; r += 1; }
  23943. return r;
  23944. }
  23945. // (public) return the number of bits in "this"
  23946. function bnBitLength() {
  23947. if(this.t <= 0) return 0;
  23948. return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
  23949. }
  23950. // (protected) r = this << n*DB
  23951. function bnpDLShiftTo(n,r) {
  23952. var i;
  23953. for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
  23954. for(i = n-1; i >= 0; --i) r[i] = 0;
  23955. r.t = this.t+n;
  23956. r.s = this.s;
  23957. }
  23958. // (protected) r = this >> n*DB
  23959. function bnpDRShiftTo(n,r) {
  23960. for(var i = n; i < this.t; ++i) r[i-n] = this[i];
  23961. r.t = Math.max(this.t-n,0);
  23962. r.s = this.s;
  23963. }
  23964. // (protected) r = this << n
  23965. function bnpLShiftTo(n,r) {
  23966. var bs = n%this.DB;
  23967. var cbs = this.DB-bs;
  23968. var bm = (1<<cbs)-1;
  23969. var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
  23970. for(i = this.t-1; i >= 0; --i) {
  23971. r[i+ds+1] = (this[i]>>cbs)|c;
  23972. c = (this[i]&bm)<<bs;
  23973. }
  23974. for(i = ds-1; i >= 0; --i) r[i] = 0;
  23975. r[ds] = c;
  23976. r.t = this.t+ds+1;
  23977. r.s = this.s;
  23978. r.clamp();
  23979. }
  23980. // (protected) r = this >> n
  23981. function bnpRShiftTo(n,r) {
  23982. r.s = this.s;
  23983. var ds = Math.floor(n/this.DB);
  23984. if(ds >= this.t) { r.t = 0; return; }
  23985. var bs = n%this.DB;
  23986. var cbs = this.DB-bs;
  23987. var bm = (1<<bs)-1;
  23988. r[0] = this[ds]>>bs;
  23989. for(var i = ds+1; i < this.t; ++i) {
  23990. r[i-ds-1] |= (this[i]&bm)<<cbs;
  23991. r[i-ds] = this[i]>>bs;
  23992. }
  23993. if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs;
  23994. r.t = this.t-ds;
  23995. r.clamp();
  23996. }
  23997. // (protected) r = this - a
  23998. function bnpSubTo(a,r) {
  23999. var i = 0, c = 0, m = Math.min(a.t,this.t);
  24000. while(i < m) {
  24001. c += this[i]-a[i];
  24002. r[i++] = c&this.DM;
  24003. c >>= this.DB;
  24004. }
  24005. if(a.t < this.t) {
  24006. c -= a.s;
  24007. while(i < this.t) {
  24008. c += this[i];
  24009. r[i++] = c&this.DM;
  24010. c >>= this.DB;
  24011. }
  24012. c += this.s;
  24013. }
  24014. else {
  24015. c += this.s;
  24016. while(i < a.t) {
  24017. c -= a[i];
  24018. r[i++] = c&this.DM;
  24019. c >>= this.DB;
  24020. }
  24021. c -= a.s;
  24022. }
  24023. r.s = (c<0)?-1:0;
  24024. if(c < -1) r[i++] = this.DV+c;
  24025. else if(c > 0) r[i++] = c;
  24026. r.t = i;
  24027. r.clamp();
  24028. }
  24029. // (protected) r = this * a, r != this,a (HAC 14.12)
  24030. // "this" should be the larger one if appropriate.
  24031. function bnpMultiplyTo(a,r) {
  24032. var x = this.abs(), y = a.abs();
  24033. var i = x.t;
  24034. r.t = i+y.t;
  24035. while(--i >= 0) r[i] = 0;
  24036. for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
  24037. r.s = 0;
  24038. r.clamp();
  24039. if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
  24040. }
  24041. // (protected) r = this^2, r != this (HAC 14.16)
  24042. function bnpSquareTo(r) {
  24043. var x = this.abs();
  24044. var i = r.t = 2*x.t;
  24045. while(--i >= 0) r[i] = 0;
  24046. for(i = 0; i < x.t-1; ++i) {
  24047. var c = x.am(i,x[i],r,2*i,0,1);
  24048. if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
  24049. r[i+x.t] -= x.DV;
  24050. r[i+x.t+1] = 1;
  24051. }
  24052. }
  24053. if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
  24054. r.s = 0;
  24055. r.clamp();
  24056. }
  24057. // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
  24058. // r != q, this != m. q or r may be null.
  24059. function bnpDivRemTo(m,q,r) {
  24060. var pm = m.abs();
  24061. if(pm.t <= 0) return;
  24062. var pt = this.abs();
  24063. if(pt.t < pm.t) {
  24064. if(q != null) q.fromInt(0);
  24065. if(r != null) this.copyTo(r);
  24066. return;
  24067. }
  24068. if(r == null) r = nbi();
  24069. var y = nbi(), ts = this.s, ms = m.s;
  24070. var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
  24071. if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
  24072. else { pm.copyTo(y); pt.copyTo(r); }
  24073. var ys = y.t;
  24074. var y0 = y[ys-1];
  24075. if(y0 == 0) return;
  24076. var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0);
  24077. var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
  24078. var i = r.t, j = i-ys, t = (q==null)?nbi():q;
  24079. y.dlShiftTo(j,t);
  24080. if(r.compareTo(t) >= 0) {
  24081. r[r.t++] = 1;
  24082. r.subTo(t,r);
  24083. }
  24084. BigInteger.ONE.dlShiftTo(ys,t);
  24085. t.subTo(y,y); // "negative" y so we can replace sub with am later
  24086. while(y.t < ys) y[y.t++] = 0;
  24087. while(--j >= 0) {
  24088. // Estimate quotient digit
  24089. var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
  24090. if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
  24091. y.dlShiftTo(j,t);
  24092. r.subTo(t,r);
  24093. while(r[i] < --qd) r.subTo(t,r);
  24094. }
  24095. }
  24096. if(q != null) {
  24097. r.drShiftTo(ys,q);
  24098. if(ts != ms) BigInteger.ZERO.subTo(q,q);
  24099. }
  24100. r.t = ys;
  24101. r.clamp();
  24102. if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
  24103. if(ts < 0) BigInteger.ZERO.subTo(r,r);
  24104. }
  24105. // (public) this mod a
  24106. function bnMod(a) {
  24107. var r = nbi();
  24108. this.abs().divRemTo(a,null,r);
  24109. if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
  24110. return r;
  24111. }
  24112. // Modular reduction using "classic" algorithm
  24113. function Classic(m) { this.m = m; }
  24114. function cConvert(x) {
  24115. if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
  24116. else return x;
  24117. }
  24118. function cRevert(x) { return x; }
  24119. function cReduce(x) { x.divRemTo(this.m,null,x); }
  24120. function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
  24121. function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
  24122. Classic.prototype.convert = cConvert;
  24123. Classic.prototype.revert = cRevert;
  24124. Classic.prototype.reduce = cReduce;
  24125. Classic.prototype.mulTo = cMulTo;
  24126. Classic.prototype.sqrTo = cSqrTo;
  24127. // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
  24128. // justification:
  24129. // xy == 1 (mod m)
  24130. // xy = 1+km
  24131. // xy(2-xy) = (1+km)(1-km)
  24132. // x[y(2-xy)] = 1-k^2m^2
  24133. // x[y(2-xy)] == 1 (mod m^2)
  24134. // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
  24135. // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
  24136. // JS multiply "overflows" differently from C/C++, so care is needed here.
  24137. function bnpInvDigit() {
  24138. if(this.t < 1) return 0;
  24139. var x = this[0];
  24140. if((x&1) == 0) return 0;
  24141. var y = x&3; // y == 1/x mod 2^2
  24142. y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
  24143. y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
  24144. y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
  24145. // last step - calculate inverse mod DV directly;
  24146. // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
  24147. y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
  24148. // we really want the negative inverse, and -DV < y < DV
  24149. return (y>0)?this.DV-y:-y;
  24150. }
  24151. // Montgomery reduction
  24152. function Montgomery(m) {
  24153. this.m = m;
  24154. this.mp = m.invDigit();
  24155. this.mpl = this.mp&0x7fff;
  24156. this.mph = this.mp>>15;
  24157. this.um = (1<<(m.DB-15))-1;
  24158. this.mt2 = 2*m.t;
  24159. }
  24160. // xR mod m
  24161. function montConvert(x) {
  24162. var r = nbi();
  24163. x.abs().dlShiftTo(this.m.t,r);
  24164. r.divRemTo(this.m,null,r);
  24165. if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
  24166. return r;
  24167. }
  24168. // x/R mod m
  24169. function montRevert(x) {
  24170. var r = nbi();
  24171. x.copyTo(r);
  24172. this.reduce(r);
  24173. return r;
  24174. }
  24175. // x = x/R mod m (HAC 14.32)
  24176. function montReduce(x) {
  24177. while(x.t <= this.mt2) // pad x so am has enough room later
  24178. x[x.t++] = 0;
  24179. for(var i = 0; i < this.m.t; ++i) {
  24180. // faster way of calculating u0 = x[i]*mp mod DV
  24181. var j = x[i]&0x7fff;
  24182. var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
  24183. // use am to combine the multiply-shift-add into one call
  24184. j = i+this.m.t;
  24185. x[j] += this.m.am(0,u0,x,i,0,this.m.t);
  24186. // propagate carry
  24187. while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
  24188. }
  24189. x.clamp();
  24190. x.drShiftTo(this.m.t,x);
  24191. if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
  24192. }
  24193. // r = "x^2/R mod m"; x != r
  24194. function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
  24195. // r = "xy/R mod m"; x,y != r
  24196. function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
  24197. Montgomery.prototype.convert = montConvert;
  24198. Montgomery.prototype.revert = montRevert;
  24199. Montgomery.prototype.reduce = montReduce;
  24200. Montgomery.prototype.mulTo = montMulTo;
  24201. Montgomery.prototype.sqrTo = montSqrTo;
  24202. // (protected) true iff this is even
  24203. function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
  24204. // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
  24205. function bnpExp(e,z) {
  24206. if(e > 0xffffffff || e < 1) return BigInteger.ONE;
  24207. var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
  24208. g.copyTo(r);
  24209. while(--i >= 0) {
  24210. z.sqrTo(r,r2);
  24211. if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
  24212. else { var t = r; r = r2; r2 = t; }
  24213. }
  24214. return z.revert(r);
  24215. }
  24216. // (public) this^e % m, 0 <= e < 2^32
  24217. function bnModPowInt(e,m) {
  24218. var z;
  24219. if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
  24220. return this.exp(e,z);
  24221. }
  24222. // protected
  24223. BigInteger.prototype.copyTo = bnpCopyTo;
  24224. BigInteger.prototype.fromInt = bnpFromInt;
  24225. BigInteger.prototype.fromString = bnpFromString;
  24226. BigInteger.prototype.clamp = bnpClamp;
  24227. BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
  24228. BigInteger.prototype.drShiftTo = bnpDRShiftTo;
  24229. BigInteger.prototype.lShiftTo = bnpLShiftTo;
  24230. BigInteger.prototype.rShiftTo = bnpRShiftTo;
  24231. BigInteger.prototype.subTo = bnpSubTo;
  24232. BigInteger.prototype.multiplyTo = bnpMultiplyTo;
  24233. BigInteger.prototype.squareTo = bnpSquareTo;
  24234. BigInteger.prototype.divRemTo = bnpDivRemTo;
  24235. BigInteger.prototype.invDigit = bnpInvDigit;
  24236. BigInteger.prototype.isEven = bnpIsEven;
  24237. BigInteger.prototype.exp = bnpExp;
  24238. // public
  24239. BigInteger.prototype.toString = bnToString;
  24240. BigInteger.prototype.negate = bnNegate;
  24241. BigInteger.prototype.abs = bnAbs;
  24242. BigInteger.prototype.compareTo = bnCompareTo;
  24243. BigInteger.prototype.bitLength = bnBitLength;
  24244. BigInteger.prototype.mod = bnMod;
  24245. BigInteger.prototype.modPowInt = bnModPowInt;
  24246. // "constants"
  24247. BigInteger.ZERO = nbv(0);
  24248. BigInteger.ONE = nbv(1);
  24249. // jsbn2 stuff
  24250. // (protected) convert from radix string
  24251. function bnpFromRadix(s,b) {
  24252. this.fromInt(0);
  24253. if(b == null) b = 10;
  24254. var cs = this.chunkSize(b);
  24255. var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
  24256. for(var i = 0; i < s.length; ++i) {
  24257. var x = intAt(s,i);
  24258. if(x < 0) {
  24259. if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
  24260. continue;
  24261. }
  24262. w = b*w+x;
  24263. if(++j >= cs) {
  24264. this.dMultiply(d);
  24265. this.dAddOffset(w,0);
  24266. j = 0;
  24267. w = 0;
  24268. }
  24269. }
  24270. if(j > 0) {
  24271. this.dMultiply(Math.pow(b,j));
  24272. this.dAddOffset(w,0);
  24273. }
  24274. if(mi) BigInteger.ZERO.subTo(this,this);
  24275. }
  24276. // (protected) return x s.t. r^x < DV
  24277. function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
  24278. // (public) 0 if this == 0, 1 if this > 0
  24279. function bnSigNum() {
  24280. if(this.s < 0) return -1;
  24281. else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
  24282. else return 1;
  24283. }
  24284. // (protected) this *= n, this >= 0, 1 < n < DV
  24285. function bnpDMultiply(n) {
  24286. this[this.t] = this.am(0,n-1,this,0,0,this.t);
  24287. ++this.t;
  24288. this.clamp();
  24289. }
  24290. // (protected) this += n << w words, this >= 0
  24291. function bnpDAddOffset(n,w) {
  24292. if(n == 0) return;
  24293. while(this.t <= w) this[this.t++] = 0;
  24294. this[w] += n;
  24295. while(this[w] >= this.DV) {
  24296. this[w] -= this.DV;
  24297. if(++w >= this.t) this[this.t++] = 0;
  24298. ++this[w];
  24299. }
  24300. }
  24301. // (protected) convert to radix string
  24302. function bnpToRadix(b) {
  24303. if(b == null) b = 10;
  24304. if(this.signum() == 0 || b < 2 || b > 36) return "0";
  24305. var cs = this.chunkSize(b);
  24306. var a = Math.pow(b,cs);
  24307. var d = nbv(a), y = nbi(), z = nbi(), r = "";
  24308. this.divRemTo(d,y,z);
  24309. while(y.signum() > 0) {
  24310. r = (a+z.intValue()).toString(b).substr(1) + r;
  24311. y.divRemTo(d,y,z);
  24312. }
  24313. return z.intValue().toString(b) + r;
  24314. }
  24315. // (public) return value as integer
  24316. function bnIntValue() {
  24317. if(this.s < 0) {
  24318. if(this.t == 1) return this[0]-this.DV;
  24319. else if(this.t == 0) return -1;
  24320. }
  24321. else if(this.t == 1) return this[0];
  24322. else if(this.t == 0) return 0;
  24323. // assumes 16 < DB < 32
  24324. return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0];
  24325. }
  24326. // (protected) r = this + a
  24327. function bnpAddTo(a,r) {
  24328. var i = 0, c = 0, m = Math.min(a.t,this.t);
  24329. while(i < m) {
  24330. c += this[i]+a[i];
  24331. r[i++] = c&this.DM;
  24332. c >>= this.DB;
  24333. }
  24334. if(a.t < this.t) {
  24335. c += a.s;
  24336. while(i < this.t) {
  24337. c += this[i];
  24338. r[i++] = c&this.DM;
  24339. c >>= this.DB;
  24340. }
  24341. c += this.s;
  24342. }
  24343. else {
  24344. c += this.s;
  24345. while(i < a.t) {
  24346. c += a[i];
  24347. r[i++] = c&this.DM;
  24348. c >>= this.DB;
  24349. }
  24350. c += a.s;
  24351. }
  24352. r.s = (c<0)?-1:0;
  24353. if(c > 0) r[i++] = c;
  24354. else if(c < -1) r[i++] = this.DV+c;
  24355. r.t = i;
  24356. r.clamp();
  24357. }
  24358. BigInteger.prototype.fromRadix = bnpFromRadix;
  24359. BigInteger.prototype.chunkSize = bnpChunkSize;
  24360. BigInteger.prototype.signum = bnSigNum;
  24361. BigInteger.prototype.dMultiply = bnpDMultiply;
  24362. BigInteger.prototype.dAddOffset = bnpDAddOffset;
  24363. BigInteger.prototype.toRadix = bnpToRadix;
  24364. BigInteger.prototype.intValue = bnIntValue;
  24365. BigInteger.prototype.addTo = bnpAddTo;
  24366. //======= end jsbn =======
  24367. // Emscripten wrapper
  24368. var Wrapper = {
  24369. abs: function(l, h) {
  24370. var x = new goog.math.Long(l, h);
  24371. var ret;
  24372. if (x.isNegative()) {
  24373. ret = x.negate();
  24374. } else {
  24375. ret = x;
  24376. }
  24377. HEAP32[tempDoublePtr>>2] = ret.low_;
  24378. HEAP32[tempDoublePtr+4>>2] = ret.high_;
  24379. },
  24380. ensureTemps: function() {
  24381. if (Wrapper.ensuredTemps) return;
  24382. Wrapper.ensuredTemps = true;
  24383. Wrapper.two32 = new BigInteger();
  24384. Wrapper.two32.fromString('4294967296', 10);
  24385. Wrapper.two64 = new BigInteger();
  24386. Wrapper.two64.fromString('18446744073709551616', 10);
  24387. Wrapper.temp1 = new BigInteger();
  24388. Wrapper.temp2 = new BigInteger();
  24389. },
  24390. lh2bignum: function(l, h) {
  24391. var a = new BigInteger();
  24392. a.fromString(h.toString(), 10);
  24393. var b = new BigInteger();
  24394. a.multiplyTo(Wrapper.two32, b);
  24395. var c = new BigInteger();
  24396. c.fromString(l.toString(), 10);
  24397. var d = new BigInteger();
  24398. c.addTo(b, d);
  24399. return d;
  24400. },
  24401. stringify: function(l, h, unsigned) {
  24402. var ret = new goog.math.Long(l, h).toString();
  24403. if (unsigned && ret[0] == '-') {
  24404. // unsign slowly using jsbn bignums
  24405. Wrapper.ensureTemps();
  24406. var bignum = new BigInteger();
  24407. bignum.fromString(ret, 10);
  24408. ret = new BigInteger();
  24409. Wrapper.two64.addTo(bignum, ret);
  24410. ret = ret.toString(10);
  24411. }
  24412. return ret;
  24413. },
  24414. fromString: function(str, base, min, max, unsigned) {
  24415. Wrapper.ensureTemps();
  24416. var bignum = new BigInteger();
  24417. bignum.fromString(str, base);
  24418. var bigmin = new BigInteger();
  24419. bigmin.fromString(min, 10);
  24420. var bigmax = new BigInteger();
  24421. bigmax.fromString(max, 10);
  24422. if (unsigned && bignum.compareTo(BigInteger.ZERO) < 0) {
  24423. var temp = new BigInteger();
  24424. bignum.addTo(Wrapper.two64, temp);
  24425. bignum = temp;
  24426. }
  24427. var error = false;
  24428. if (bignum.compareTo(bigmin) < 0) {
  24429. bignum = bigmin;
  24430. error = true;
  24431. } else if (bignum.compareTo(bigmax) > 0) {
  24432. bignum = bigmax;
  24433. error = true;
  24434. }
  24435. var ret = goog.math.Long.fromString(bignum.toString()); // min-max checks should have clamped this to a range goog.math.Long can handle well
  24436. HEAP32[tempDoublePtr>>2] = ret.low_;
  24437. HEAP32[tempDoublePtr+4>>2] = ret.high_;
  24438. if (error) throw 'range error';
  24439. }
  24440. };
  24441. return Wrapper;
  24442. })();
  24443. //======= end closure i64 code =======
  24444. // === Auto-generated postamble setup entry stuff ===
  24445. if (memoryInitializer) {
  24446. if (typeof Module['locateFile'] === 'function') {
  24447. memoryInitializer = Module['locateFile'](memoryInitializer);
  24448. } else if (Module['memoryInitializerPrefixURL']) {
  24449. memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer;
  24450. }
  24451. if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
  24452. var data = Module['readBinary'](memoryInitializer);
  24453. HEAPU8.set(data, STATIC_BASE);
  24454. } else {
  24455. addRunDependency('memory initializer');
  24456. Browser.asyncLoad(memoryInitializer, function(data) {
  24457. HEAPU8.set(data, STATIC_BASE);
  24458. removeRunDependency('memory initializer');
  24459. }, function(data) {
  24460. throw 'could not load memory initializer ' + memoryInitializer;
  24461. });
  24462. }
  24463. }
  24464. function ExitStatus(status) {
  24465. this.name = "ExitStatus";
  24466. this.message = "Program terminated with exit(" + status + ")";
  24467. this.status = status;
  24468. };
  24469. ExitStatus.prototype = new Error();
  24470. ExitStatus.prototype.constructor = ExitStatus;
  24471. var initialStackTop;
  24472. var preloadStartTime = null;
  24473. var calledMain = false;
  24474. dependenciesFulfilled = function runCaller() {
  24475. // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
  24476. if (!Module['calledRun'] && shouldRunNow) run();
  24477. if (!Module['calledRun']) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
  24478. }
  24479. Module['callMain'] = Module.callMain = function callMain(args) {
  24480. assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on __ATMAIN__)');
  24481. assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called');
  24482. args = args || [];
  24483. ensureInitRuntime();
  24484. var argc = args.length+1;
  24485. function pad() {
  24486. for (var i = 0; i < 4-1; i++) {
  24487. argv.push(0);
  24488. }
  24489. }
  24490. var argv = [allocate(intArrayFromString(Module['thisProgram']), 'i8', ALLOC_NORMAL) ];
  24491. pad();
  24492. for (var i = 0; i < argc-1; i = i + 1) {
  24493. argv.push(allocate(intArrayFromString(args[i]), 'i8', ALLOC_NORMAL));
  24494. pad();
  24495. }
  24496. argv.push(0);
  24497. argv = allocate(argv, 'i32', ALLOC_NORMAL);
  24498. initialStackTop = STACKTOP;
  24499. try {
  24500. var ret = Module['_main'](argc, argv, 0);
  24501. // if we're not running an evented main loop, it's time to exit
  24502. exit(ret);
  24503. }
  24504. catch(e) {
  24505. if (e instanceof ExitStatus) {
  24506. // exit() throws this once it's done to make sure execution
  24507. // has been stopped completely
  24508. return;
  24509. } else if (e == 'SimulateInfiniteLoop') {
  24510. // running an evented main loop, don't immediately exit
  24511. Module['noExitRuntime'] = true;
  24512. return;
  24513. } else {
  24514. if (e && typeof e === 'object' && e.stack) Module.printErr('exception thrown: ' + [e, e.stack]);
  24515. throw e;
  24516. }
  24517. } finally {
  24518. calledMain = true;
  24519. }
  24520. }
  24521. function run(args) {
  24522. args = args || Module['arguments'];
  24523. if (preloadStartTime === null) preloadStartTime = Date.now();
  24524. if (runDependencies > 0) {
  24525. return;
  24526. }
  24527. preRun();
  24528. if (runDependencies > 0) return; // a preRun added a dependency, run will be called later
  24529. if (Module['calledRun']) return; // run may have just been called through dependencies being fulfilled just in this very frame
  24530. function doRun() {
  24531. if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
  24532. Module['calledRun'] = true;
  24533. if (ABORT) return;
  24534. ensureInitRuntime();
  24535. preMain();
  24536. if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) {
  24537. Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms');
  24538. }
  24539. if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();
  24540. if (Module['_main'] && shouldRunNow) Module['callMain'](args);
  24541. postRun();
  24542. }
  24543. if (Module['setStatus']) {
  24544. Module['setStatus']('Running...');
  24545. setTimeout(function() {
  24546. setTimeout(function() {
  24547. Module['setStatus']('');
  24548. }, 1);
  24549. doRun();
  24550. }, 1);
  24551. } else {
  24552. doRun();
  24553. }
  24554. }
  24555. Module['run'] = Module.run = run;
  24556. function exit(status) {
  24557. if (Module['noExitRuntime']) {
  24558. return;
  24559. }
  24560. ABORT = true;
  24561. EXITSTATUS = status;
  24562. STACKTOP = initialStackTop;
  24563. // exit the runtime
  24564. exitRuntime();
  24565. if (ENVIRONMENT_IS_NODE) {
  24566. // Work around a node.js bug where stdout buffer is not flushed at process exit:
  24567. // Instead of process.exit() directly, wait for stdout flush event.
  24568. // See https://github.com/joyent/node/issues/1669 and https://github.com/kripken/emscripten/issues/2582
  24569. // Workaround is based on https://github.com/RReverser/acorn/commit/50ab143cecc9ed71a2d66f78b4aec3bb2e9844f6
  24570. process['stdout']['once']('drain', function () {
  24571. process['exit'](status);
  24572. });
  24573. console.log(' '); // Make sure to print something to force the drain event to occur, in case the stdout buffer was empty.
  24574. // Work around another node bug where sometimes 'drain' is never fired - make another effort
  24575. // to emit the exit status, after a significant delay (if node hasn't fired drain by then, give up)
  24576. setTimeout(function() {
  24577. process['exit'](status);
  24578. }, 500);
  24579. } else
  24580. if (ENVIRONMENT_IS_SHELL && typeof quit === 'function') {
  24581. quit(status);
  24582. }
  24583. // if we reach here, we must throw an exception to halt the current execution
  24584. throw new ExitStatus(status);
  24585. }
  24586. Module['exit'] = Module.exit = exit;
  24587. function abort(text) {
  24588. if (text) {
  24589. Module.print(text);
  24590. Module.printErr(text);
  24591. }
  24592. ABORT = true;
  24593. EXITSTATUS = 1;
  24594. var extra = '\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.';
  24595. throw 'abort() at ' + stackTrace() + extra;
  24596. }
  24597. Module['abort'] = Module.abort = abort;
  24598. // {{PRE_RUN_ADDITIONS}}
  24599. if (Module['preInit']) {
  24600. if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
  24601. while (Module['preInit'].length > 0) {
  24602. Module['preInit'].pop()();
  24603. }
  24604. }
  24605. // shouldRunNow refers to calling main(), not run().
  24606. var shouldRunNow = true;
  24607. if (Module['noInitialRun']) {
  24608. shouldRunNow = false;
  24609. }
  24610. run();
  24611. // {{POST_RUN_ADDITIONS}}
  24612. // {{MODULE_ADDITIONS}}
  24613. /* vim: ts=4:sw=4:expandtab */
  24614. var Internal = Internal || {};
  24615. (function() {
  24616. 'use strict';
  24617. // Insert some bytes into the emscripten memory and return a pointer
  24618. function _allocate(bytes) {
  24619. var address = Module._malloc(bytes.length);
  24620. Module.HEAPU8.set(bytes, address);
  24621. return address;
  24622. }
  24623. function _readBytes(address, length, array) {
  24624. array.set(Module.HEAPU8.subarray(address, address + length));
  24625. }
  24626. var basepoint = new Uint8Array(32);
  24627. basepoint[0] = 9;
  24628. Internal.curve25519 = {
  24629. keyPair: function(privKey) {
  24630. var priv = new Uint8Array(privKey);
  24631. priv[0] &= 248;
  24632. priv[31] &= 127;
  24633. priv[31] |= 64;
  24634. // Where to store the result
  24635. var publicKey_ptr = Module._malloc(32);
  24636. // Get a pointer to the private key
  24637. var privateKey_ptr = _allocate(priv);
  24638. // The basepoint for generating public keys
  24639. var basepoint_ptr = _allocate(basepoint);
  24640. // The return value is just 0, the operation is done in place
  24641. var err = Module._curve25519_donna(publicKey_ptr,
  24642. privateKey_ptr,
  24643. basepoint_ptr);
  24644. var res = new Uint8Array(32);
  24645. _readBytes(publicKey_ptr, 32, res);
  24646. Module._free(publicKey_ptr);
  24647. Module._free(privateKey_ptr);
  24648. Module._free(basepoint_ptr);
  24649. return { pubKey: res.buffer, privKey: priv.buffer };
  24650. },
  24651. sharedSecret: function(pubKey, privKey) {
  24652. // Where to store the result
  24653. var sharedKey_ptr = Module._malloc(32);
  24654. // Get a pointer to our private key
  24655. var privateKey_ptr = _allocate(new Uint8Array(privKey));
  24656. // Get a pointer to their public key, the basepoint when you're
  24657. // generating a shared secret
  24658. var basepoint_ptr = _allocate(new Uint8Array(pubKey));
  24659. // Return value is 0 here too of course
  24660. var err = Module._curve25519_donna(sharedKey_ptr,
  24661. privateKey_ptr,
  24662. basepoint_ptr);
  24663. var res = new Uint8Array(32);
  24664. _readBytes(sharedKey_ptr, 32, res);
  24665. Module._free(sharedKey_ptr);
  24666. Module._free(privateKey_ptr);
  24667. Module._free(basepoint_ptr);
  24668. return res.buffer;
  24669. },
  24670. sign: function(privKey, message) {
  24671. // Where to store the result
  24672. var signature_ptr = Module._malloc(64);
  24673. // Get a pointer to our private key
  24674. var privateKey_ptr = _allocate(new Uint8Array(privKey));
  24675. // Get a pointer to the message
  24676. var message_ptr = _allocate(new Uint8Array(message));
  24677. var err = Module._curve25519_sign(signature_ptr,
  24678. privateKey_ptr,
  24679. message_ptr,
  24680. message.byteLength);
  24681. var res = new Uint8Array(64);
  24682. _readBytes(signature_ptr, 64, res);
  24683. Module._free(signature_ptr);
  24684. Module._free(privateKey_ptr);
  24685. Module._free(message_ptr);
  24686. return res.buffer;
  24687. },
  24688. verify: function(pubKey, message, sig) {
  24689. // Get a pointer to their public key
  24690. var publicKey_ptr = _allocate(new Uint8Array(pubKey));
  24691. // Get a pointer to the signature
  24692. var signature_ptr = _allocate(new Uint8Array(sig));
  24693. // Get a pointer to the message
  24694. var message_ptr = _allocate(new Uint8Array(message));
  24695. var res = Module._curve25519_verify(signature_ptr,
  24696. publicKey_ptr,
  24697. message_ptr,
  24698. message.byteLength);
  24699. Module._free(publicKey_ptr);
  24700. Module._free(signature_ptr);
  24701. Module._free(message_ptr);
  24702. return res !== 0;
  24703. }
  24704. };
  24705. Internal.curve25519_async = {
  24706. keyPair: function(privKey) {
  24707. return new Promise(function(resolve) {
  24708. resolve(Internal.curve25519.keyPair(privKey));
  24709. });
  24710. },
  24711. sharedSecret: function(pubKey, privKey) {
  24712. return new Promise(function(resolve) {
  24713. resolve(Internal.curve25519.sharedSecret(pubKey, privKey));
  24714. });
  24715. },
  24716. sign: function(privKey, message) {
  24717. return new Promise(function(resolve) {
  24718. resolve(Internal.curve25519.sign(privKey, message));
  24719. });
  24720. },
  24721. verify: function(pubKey, message, sig) {
  24722. return new Promise(function(resolve, reject) {
  24723. if (Internal.curve25519.verify(pubKey, message, sig)) {
  24724. reject(new Error("Invalid signature"));
  24725. } else {
  24726. resolve();
  24727. }
  24728. });
  24729. },
  24730. };
  24731. })();
  24732. ;(function() {
  24733. 'use strict';
  24734. // I am the...workee?
  24735. var origCurve25519 = Internal.curve25519_async;
  24736. Internal.startWorker = function(url) {
  24737. Internal.stopWorker(); // there can be only one
  24738. Internal.curve25519_async = new Curve25519Worker(url);
  24739. };
  24740. Internal.stopWorker = function() {
  24741. if (Internal.curve25519_async instanceof Curve25519Worker) {
  24742. var worker = Internal.curve25519_async.worker;
  24743. Internal.curve25519_async = origCurve25519;
  24744. worker.terminate();
  24745. }
  24746. };
  24747. libsignal.worker = {
  24748. startWorker: Internal.startWorker,
  24749. stopWorker: Internal.stopWorker,
  24750. };
  24751. function Curve25519Worker(url) {
  24752. this.jobs = {};
  24753. this.jobId = 0;
  24754. this.worker = new Worker(url);
  24755. this.worker.onmessage = function(e) {
  24756. var job = this.jobs[e.data.id];
  24757. if (e.data.error && typeof job.onerror === 'function') {
  24758. job.onerror(new Error(e.data.error));
  24759. } else if (typeof job.onsuccess === 'function') {
  24760. job.onsuccess(e.data.result);
  24761. }
  24762. delete this.jobs[e.data.id];
  24763. }.bind(this);
  24764. }
  24765. Curve25519Worker.prototype = {
  24766. constructor: Curve25519Worker,
  24767. postMessage: function(methodName, args, onsuccess, onerror) {
  24768. return new Promise(function(resolve, reject) {
  24769. this.jobs[this.jobId] = { onsuccess: resolve, onerror: reject };
  24770. this.worker.postMessage({ id: this.jobId, methodName: methodName, args: args });
  24771. this.jobId++;
  24772. }.bind(this));
  24773. },
  24774. keyPair: function(privKey) {
  24775. return this.postMessage('keyPair', [privKey]);
  24776. },
  24777. sharedSecret: function(pubKey, privKey) {
  24778. return this.postMessage('sharedSecret', [pubKey, privKey]);
  24779. },
  24780. sign: function(privKey, message) {
  24781. return this.postMessage('sign', [privKey, message]);
  24782. },
  24783. verify: function(pubKey, message, sig) {
  24784. return this.postMessage('verify', [pubKey, message, sig]);
  24785. }
  24786. };
  24787. })();
  24788. /*
  24789. Copyright 2013 Daniel Wirtz <dcode@dcode.io>
  24790. Copyright 2009 The Closure Library Authors. All Rights Reserved.
  24791. Licensed under the Apache License, Version 2.0 (the "License");
  24792. you may not use this file except in compliance with the License.
  24793. You may obtain a copy of the License at
  24794. http://www.apache.org/licenses/LICENSE-2.0
  24795. Unless required by applicable law or agreed to in writing, software
  24796. distributed under the License is distributed on an "AS-IS" BASIS,
  24797. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24798. See the License for the specific language governing permissions and
  24799. limitations under the License.
  24800. */
  24801. /**
  24802. * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
  24803. * Released under the Apache License, Version 2.0
  24804. * see: https://github.com/dcodeIO/long.js for details
  24805. */
  24806. (function(global, factory) {
  24807. /* AMD */ if (typeof define === 'function' && define["amd"])
  24808. define([], factory);
  24809. /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
  24810. module["exports"] = factory();
  24811. /* Global */ else
  24812. (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
  24813. })(this, function() {
  24814. "use strict";
  24815. /**
  24816. * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
  24817. * See the from* functions below for more convenient ways of constructing Longs.
  24818. * @exports Long
  24819. * @class A Long class for representing a 64 bit two's-complement integer value.
  24820. * @param {number} low The low (signed) 32 bits of the long
  24821. * @param {number} high The high (signed) 32 bits of the long
  24822. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  24823. * @constructor
  24824. */
  24825. function Long(low, high, unsigned) {
  24826. /**
  24827. * The low 32 bits as a signed value.
  24828. * @type {number}
  24829. * @expose
  24830. */
  24831. this.low = low | 0;
  24832. /**
  24833. * The high 32 bits as a signed value.
  24834. * @type {number}
  24835. * @expose
  24836. */
  24837. this.high = high | 0;
  24838. /**
  24839. * Whether unsigned or not.
  24840. * @type {boolean}
  24841. * @expose
  24842. */
  24843. this.unsigned = !!unsigned;
  24844. }
  24845. // The internal representation of a long is the two given signed, 32-bit values.
  24846. // We use 32-bit pieces because these are the size of integers on which
  24847. // Javascript performs bit-operations. For operations like addition and
  24848. // multiplication, we split each number into 16 bit pieces, which can easily be
  24849. // multiplied within Javascript's floating-point representation without overflow
  24850. // or change in sign.
  24851. //
  24852. // In the algorithms below, we frequently reduce the negative case to the
  24853. // positive case by negating the input(s) and then post-processing the result.
  24854. // Note that we must ALWAYS check specially whether those values are MIN_VALUE
  24855. // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
  24856. // a positive number, it overflows back into a negative). Not handling this
  24857. // case would often result in infinite recursion.
  24858. //
  24859. // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
  24860. // methods on which they depend.
  24861. /**
  24862. * An indicator used to reliably determine if an object is a Long or not.
  24863. * @type {boolean}
  24864. * @const
  24865. * @expose
  24866. * @private
  24867. */
  24868. Long.__isLong__;
  24869. Object.defineProperty(Long.prototype, "__isLong__", {
  24870. value: true,
  24871. enumerable: false,
  24872. configurable: false
  24873. });
  24874. /**
  24875. * @function
  24876. * @param {*} obj Object
  24877. * @returns {boolean}
  24878. * @inner
  24879. */
  24880. function isLong(obj) {
  24881. return (obj && obj["__isLong__"]) === true;
  24882. }
  24883. /**
  24884. * Tests if the specified object is a Long.
  24885. * @function
  24886. * @param {*} obj Object
  24887. * @returns {boolean}
  24888. * @expose
  24889. */
  24890. Long.isLong = isLong;
  24891. /**
  24892. * A cache of the Long representations of small integer values.
  24893. * @type {!Object}
  24894. * @inner
  24895. */
  24896. var INT_CACHE = {};
  24897. /**
  24898. * A cache of the Long representations of small unsigned integer values.
  24899. * @type {!Object}
  24900. * @inner
  24901. */
  24902. var UINT_CACHE = {};
  24903. /**
  24904. * @param {number} value
  24905. * @param {boolean=} unsigned
  24906. * @returns {!Long}
  24907. * @inner
  24908. */
  24909. function fromInt(value, unsigned) {
  24910. var obj, cachedObj, cache;
  24911. if (unsigned) {
  24912. value >>>= 0;
  24913. if (cache = (0 <= value && value < 256)) {
  24914. cachedObj = UINT_CACHE[value];
  24915. if (cachedObj)
  24916. return cachedObj;
  24917. }
  24918. obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
  24919. if (cache)
  24920. UINT_CACHE[value] = obj;
  24921. return obj;
  24922. } else {
  24923. value |= 0;
  24924. if (cache = (-128 <= value && value < 128)) {
  24925. cachedObj = INT_CACHE[value];
  24926. if (cachedObj)
  24927. return cachedObj;
  24928. }
  24929. obj = fromBits(value, value < 0 ? -1 : 0, false);
  24930. if (cache)
  24931. INT_CACHE[value] = obj;
  24932. return obj;
  24933. }
  24934. }
  24935. /**
  24936. * Returns a Long representing the given 32 bit integer value.
  24937. * @function
  24938. * @param {number} value The 32 bit integer in question
  24939. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  24940. * @returns {!Long} The corresponding Long value
  24941. * @expose
  24942. */
  24943. Long.fromInt = fromInt;
  24944. /**
  24945. * @param {number} value
  24946. * @param {boolean=} unsigned
  24947. * @returns {!Long}
  24948. * @inner
  24949. */
  24950. function fromNumber(value, unsigned) {
  24951. if (isNaN(value) || !isFinite(value))
  24952. return unsigned ? UZERO : ZERO;
  24953. if (unsigned) {
  24954. if (value < 0)
  24955. return UZERO;
  24956. if (value >= TWO_PWR_64_DBL)
  24957. return MAX_UNSIGNED_VALUE;
  24958. } else {
  24959. if (value <= -TWO_PWR_63_DBL)
  24960. return MIN_VALUE;
  24961. if (value + 1 >= TWO_PWR_63_DBL)
  24962. return MAX_VALUE;
  24963. }
  24964. if (value < 0)
  24965. return fromNumber(-value, unsigned).neg();
  24966. return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
  24967. }
  24968. /**
  24969. * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
  24970. * @function
  24971. * @param {number} value The number in question
  24972. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  24973. * @returns {!Long} The corresponding Long value
  24974. * @expose
  24975. */
  24976. Long.fromNumber = fromNumber;
  24977. /**
  24978. * @param {number} lowBits
  24979. * @param {number} highBits
  24980. * @param {boolean=} unsigned
  24981. * @returns {!Long}
  24982. * @inner
  24983. */
  24984. function fromBits(lowBits, highBits, unsigned) {
  24985. return new Long(lowBits, highBits, unsigned);
  24986. }
  24987. /**
  24988. * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
  24989. * assumed to use 32 bits.
  24990. * @function
  24991. * @param {number} lowBits The low 32 bits
  24992. * @param {number} highBits The high 32 bits
  24993. * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
  24994. * @returns {!Long} The corresponding Long value
  24995. * @expose
  24996. */
  24997. Long.fromBits = fromBits;
  24998. /**
  24999. * @function
  25000. * @param {number} base
  25001. * @param {number} exponent
  25002. * @returns {number}
  25003. * @inner
  25004. */
  25005. var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
  25006. /**
  25007. * @param {string} str
  25008. * @param {(boolean|number)=} unsigned
  25009. * @param {number=} radix
  25010. * @returns {!Long}
  25011. * @inner
  25012. */
  25013. function fromString(str, unsigned, radix) {
  25014. if (str.length === 0)
  25015. throw Error('empty string');
  25016. if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
  25017. return ZERO;
  25018. if (typeof unsigned === 'number') {
  25019. // For goog.math.long compatibility
  25020. radix = unsigned,
  25021. unsigned = false;
  25022. } else {
  25023. unsigned = !! unsigned;
  25024. }
  25025. radix = radix || 10;
  25026. if (radix < 2 || 36 < radix)
  25027. throw RangeError('radix');
  25028. var p;
  25029. if ((p = str.indexOf('-')) > 0)
  25030. throw Error('interior hyphen');
  25031. else if (p === 0) {
  25032. return fromString(str.substring(1), unsigned, radix).neg();
  25033. }
  25034. // Do several (8) digits each time through the loop, so as to
  25035. // minimize the calls to the very expensive emulated div.
  25036. var radixToPower = fromNumber(pow_dbl(radix, 8));
  25037. var result = ZERO;
  25038. for (var i = 0; i < str.length; i += 8) {
  25039. var size = Math.min(8, str.length - i),
  25040. value = parseInt(str.substring(i, i + size), radix);
  25041. if (size < 8) {
  25042. var power = fromNumber(pow_dbl(radix, size));
  25043. result = result.mul(power).add(fromNumber(value));
  25044. } else {
  25045. result = result.mul(radixToPower);
  25046. result = result.add(fromNumber(value));
  25047. }
  25048. }
  25049. result.unsigned = unsigned;
  25050. return result;
  25051. }
  25052. /**
  25053. * Returns a Long representation of the given string, written using the specified radix.
  25054. * @function
  25055. * @param {string} str The textual representation of the Long
  25056. * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
  25057. * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
  25058. * @returns {!Long} The corresponding Long value
  25059. * @expose
  25060. */
  25061. Long.fromString = fromString;
  25062. /**
  25063. * @function
  25064. * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
  25065. * @returns {!Long}
  25066. * @inner
  25067. */
  25068. function fromValue(val) {
  25069. if (val /* is compatible */ instanceof Long)
  25070. return val;
  25071. if (typeof val === 'number')
  25072. return fromNumber(val);
  25073. if (typeof val === 'string')
  25074. return fromString(val);
  25075. // Throws for non-objects, converts non-instanceof Long:
  25076. return fromBits(val.low, val.high, val.unsigned);
  25077. }
  25078. /**
  25079. * Converts the specified value to a Long.
  25080. * @function
  25081. * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
  25082. * @returns {!Long}
  25083. * @expose
  25084. */
  25085. Long.fromValue = fromValue;
  25086. // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
  25087. // no runtime penalty for these.
  25088. /**
  25089. * @type {number}
  25090. * @const
  25091. * @inner
  25092. */
  25093. var TWO_PWR_16_DBL = 1 << 16;
  25094. /**
  25095. * @type {number}
  25096. * @const
  25097. * @inner
  25098. */
  25099. var TWO_PWR_24_DBL = 1 << 24;
  25100. /**
  25101. * @type {number}
  25102. * @const
  25103. * @inner
  25104. */
  25105. var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
  25106. /**
  25107. * @type {number}
  25108. * @const
  25109. * @inner
  25110. */
  25111. var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
  25112. /**
  25113. * @type {number}
  25114. * @const
  25115. * @inner
  25116. */
  25117. var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
  25118. /**
  25119. * @type {!Long}
  25120. * @const
  25121. * @inner
  25122. */
  25123. var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
  25124. /**
  25125. * @type {!Long}
  25126. * @inner
  25127. */
  25128. var ZERO = fromInt(0);
  25129. /**
  25130. * Signed zero.
  25131. * @type {!Long}
  25132. * @expose
  25133. */
  25134. Long.ZERO = ZERO;
  25135. /**
  25136. * @type {!Long}
  25137. * @inner
  25138. */
  25139. var UZERO = fromInt(0, true);
  25140. /**
  25141. * Unsigned zero.
  25142. * @type {!Long}
  25143. * @expose
  25144. */
  25145. Long.UZERO = UZERO;
  25146. /**
  25147. * @type {!Long}
  25148. * @inner
  25149. */
  25150. var ONE = fromInt(1);
  25151. /**
  25152. * Signed one.
  25153. * @type {!Long}
  25154. * @expose
  25155. */
  25156. Long.ONE = ONE;
  25157. /**
  25158. * @type {!Long}
  25159. * @inner
  25160. */
  25161. var UONE = fromInt(1, true);
  25162. /**
  25163. * Unsigned one.
  25164. * @type {!Long}
  25165. * @expose
  25166. */
  25167. Long.UONE = UONE;
  25168. /**
  25169. * @type {!Long}
  25170. * @inner
  25171. */
  25172. var NEG_ONE = fromInt(-1);
  25173. /**
  25174. * Signed negative one.
  25175. * @type {!Long}
  25176. * @expose
  25177. */
  25178. Long.NEG_ONE = NEG_ONE;
  25179. /**
  25180. * @type {!Long}
  25181. * @inner
  25182. */
  25183. var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
  25184. /**
  25185. * Maximum signed value.
  25186. * @type {!Long}
  25187. * @expose
  25188. */
  25189. Long.MAX_VALUE = MAX_VALUE;
  25190. /**
  25191. * @type {!Long}
  25192. * @inner
  25193. */
  25194. var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
  25195. /**
  25196. * Maximum unsigned value.
  25197. * @type {!Long}
  25198. * @expose
  25199. */
  25200. Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
  25201. /**
  25202. * @type {!Long}
  25203. * @inner
  25204. */
  25205. var MIN_VALUE = fromBits(0, 0x80000000|0, false);
  25206. /**
  25207. * Minimum signed value.
  25208. * @type {!Long}
  25209. * @expose
  25210. */
  25211. Long.MIN_VALUE = MIN_VALUE;
  25212. /**
  25213. * @alias Long.prototype
  25214. * @inner
  25215. */
  25216. var LongPrototype = Long.prototype;
  25217. /**
  25218. * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
  25219. * @returns {number}
  25220. * @expose
  25221. */
  25222. LongPrototype.toInt = function toInt() {
  25223. return this.unsigned ? this.low >>> 0 : this.low;
  25224. };
  25225. /**
  25226. * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
  25227. * @returns {number}
  25228. * @expose
  25229. */
  25230. LongPrototype.toNumber = function toNumber() {
  25231. if (this.unsigned)
  25232. return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
  25233. return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
  25234. };
  25235. /**
  25236. * Converts the Long to a string written in the specified radix.
  25237. * @param {number=} radix Radix (2-36), defaults to 10
  25238. * @returns {string}
  25239. * @override
  25240. * @throws {RangeError} If `radix` is out of range
  25241. * @expose
  25242. */
  25243. LongPrototype.toString = function toString(radix) {
  25244. radix = radix || 10;
  25245. if (radix < 2 || 36 < radix)
  25246. throw RangeError('radix');
  25247. if (this.isZero())
  25248. return '0';
  25249. if (this.isNegative()) { // Unsigned Longs are never negative
  25250. if (this.eq(MIN_VALUE)) {
  25251. // We need to change the Long value before it can be negated, so we remove
  25252. // the bottom-most digit in this base and then recurse to do the rest.
  25253. var radixLong = fromNumber(radix),
  25254. div = this.div(radixLong),
  25255. rem1 = div.mul(radixLong).sub(this);
  25256. return div.toString(radix) + rem1.toInt().toString(radix);
  25257. } else
  25258. return '-' + this.neg().toString(radix);
  25259. }
  25260. // Do several (6) digits each time through the loop, so as to
  25261. // minimize the calls to the very expensive emulated div.
  25262. var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
  25263. rem = this;
  25264. var result = '';
  25265. while (true) {
  25266. var remDiv = rem.div(radixToPower),
  25267. intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
  25268. digits = intval.toString(radix);
  25269. rem = remDiv;
  25270. if (rem.isZero())
  25271. return digits + result;
  25272. else {
  25273. while (digits.length < 6)
  25274. digits = '0' + digits;
  25275. result = '' + digits + result;
  25276. }
  25277. }
  25278. };
  25279. /**
  25280. * Gets the high 32 bits as a signed integer.
  25281. * @returns {number} Signed high bits
  25282. * @expose
  25283. */
  25284. LongPrototype.getHighBits = function getHighBits() {
  25285. return this.high;
  25286. };
  25287. /**
  25288. * Gets the high 32 bits as an unsigned integer.
  25289. * @returns {number} Unsigned high bits
  25290. * @expose
  25291. */
  25292. LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
  25293. return this.high >>> 0;
  25294. };
  25295. /**
  25296. * Gets the low 32 bits as a signed integer.
  25297. * @returns {number} Signed low bits
  25298. * @expose
  25299. */
  25300. LongPrototype.getLowBits = function getLowBits() {
  25301. return this.low;
  25302. };
  25303. /**
  25304. * Gets the low 32 bits as an unsigned integer.
  25305. * @returns {number} Unsigned low bits
  25306. * @expose
  25307. */
  25308. LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
  25309. return this.low >>> 0;
  25310. };
  25311. /**
  25312. * Gets the number of bits needed to represent the absolute value of this Long.
  25313. * @returns {number}
  25314. * @expose
  25315. */
  25316. LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
  25317. if (this.isNegative()) // Unsigned Longs are never negative
  25318. return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
  25319. var val = this.high != 0 ? this.high : this.low;
  25320. for (var bit = 31; bit > 0; bit--)
  25321. if ((val & (1 << bit)) != 0)
  25322. break;
  25323. return this.high != 0 ? bit + 33 : bit + 1;
  25324. };
  25325. /**
  25326. * Tests if this Long's value equals zero.
  25327. * @returns {boolean}
  25328. * @expose
  25329. */
  25330. LongPrototype.isZero = function isZero() {
  25331. return this.high === 0 && this.low === 0;
  25332. };
  25333. /**
  25334. * Tests if this Long's value is negative.
  25335. * @returns {boolean}
  25336. * @expose
  25337. */
  25338. LongPrototype.isNegative = function isNegative() {
  25339. return !this.unsigned && this.high < 0;
  25340. };
  25341. /**
  25342. * Tests if this Long's value is positive.
  25343. * @returns {boolean}
  25344. * @expose
  25345. */
  25346. LongPrototype.isPositive = function isPositive() {
  25347. return this.unsigned || this.high >= 0;
  25348. };
  25349. /**
  25350. * Tests if this Long's value is odd.
  25351. * @returns {boolean}
  25352. * @expose
  25353. */
  25354. LongPrototype.isOdd = function isOdd() {
  25355. return (this.low & 1) === 1;
  25356. };
  25357. /**
  25358. * Tests if this Long's value is even.
  25359. * @returns {boolean}
  25360. * @expose
  25361. */
  25362. LongPrototype.isEven = function isEven() {
  25363. return (this.low & 1) === 0;
  25364. };
  25365. /**
  25366. * Tests if this Long's value equals the specified's.
  25367. * @param {!Long|number|string} other Other value
  25368. * @returns {boolean}
  25369. * @expose
  25370. */
  25371. LongPrototype.equals = function equals(other) {
  25372. if (!isLong(other))
  25373. other = fromValue(other);
  25374. if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
  25375. return false;
  25376. return this.high === other.high && this.low === other.low;
  25377. };
  25378. /**
  25379. * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
  25380. * @function
  25381. * @param {!Long|number|string} other Other value
  25382. * @returns {boolean}
  25383. * @expose
  25384. */
  25385. LongPrototype.eq = LongPrototype.equals;
  25386. /**
  25387. * Tests if this Long's value differs from the specified's.
  25388. * @param {!Long|number|string} other Other value
  25389. * @returns {boolean}
  25390. * @expose
  25391. */
  25392. LongPrototype.notEquals = function notEquals(other) {
  25393. return !this.eq(/* validates */ other);
  25394. };
  25395. /**
  25396. * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
  25397. * @function
  25398. * @param {!Long|number|string} other Other value
  25399. * @returns {boolean}
  25400. * @expose
  25401. */
  25402. LongPrototype.neq = LongPrototype.notEquals;
  25403. /**
  25404. * Tests if this Long's value is less than the specified's.
  25405. * @param {!Long|number|string} other Other value
  25406. * @returns {boolean}
  25407. * @expose
  25408. */
  25409. LongPrototype.lessThan = function lessThan(other) {
  25410. return this.comp(/* validates */ other) < 0;
  25411. };
  25412. /**
  25413. * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
  25414. * @function
  25415. * @param {!Long|number|string} other Other value
  25416. * @returns {boolean}
  25417. * @expose
  25418. */
  25419. LongPrototype.lt = LongPrototype.lessThan;
  25420. /**
  25421. * Tests if this Long's value is less than or equal the specified's.
  25422. * @param {!Long|number|string} other Other value
  25423. * @returns {boolean}
  25424. * @expose
  25425. */
  25426. LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
  25427. return this.comp(/* validates */ other) <= 0;
  25428. };
  25429. /**
  25430. * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
  25431. * @function
  25432. * @param {!Long|number|string} other Other value
  25433. * @returns {boolean}
  25434. * @expose
  25435. */
  25436. LongPrototype.lte = LongPrototype.lessThanOrEqual;
  25437. /**
  25438. * Tests if this Long's value is greater than the specified's.
  25439. * @param {!Long|number|string} other Other value
  25440. * @returns {boolean}
  25441. * @expose
  25442. */
  25443. LongPrototype.greaterThan = function greaterThan(other) {
  25444. return this.comp(/* validates */ other) > 0;
  25445. };
  25446. /**
  25447. * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
  25448. * @function
  25449. * @param {!Long|number|string} other Other value
  25450. * @returns {boolean}
  25451. * @expose
  25452. */
  25453. LongPrototype.gt = LongPrototype.greaterThan;
  25454. /**
  25455. * Tests if this Long's value is greater than or equal the specified's.
  25456. * @param {!Long|number|string} other Other value
  25457. * @returns {boolean}
  25458. * @expose
  25459. */
  25460. LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
  25461. return this.comp(/* validates */ other) >= 0;
  25462. };
  25463. /**
  25464. * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
  25465. * @function
  25466. * @param {!Long|number|string} other Other value
  25467. * @returns {boolean}
  25468. * @expose
  25469. */
  25470. LongPrototype.gte = LongPrototype.greaterThanOrEqual;
  25471. /**
  25472. * Compares this Long's value with the specified's.
  25473. * @param {!Long|number|string} other Other value
  25474. * @returns {number} 0 if they are the same, 1 if the this is greater and -1
  25475. * if the given one is greater
  25476. * @expose
  25477. */
  25478. LongPrototype.compare = function compare(other) {
  25479. if (!isLong(other))
  25480. other = fromValue(other);
  25481. if (this.eq(other))
  25482. return 0;
  25483. var thisNeg = this.isNegative(),
  25484. otherNeg = other.isNegative();
  25485. if (thisNeg && !otherNeg)
  25486. return -1;
  25487. if (!thisNeg && otherNeg)
  25488. return 1;
  25489. // At this point the sign bits are the same
  25490. if (!this.unsigned)
  25491. return this.sub(other).isNegative() ? -1 : 1;
  25492. // Both are positive if at least one is unsigned
  25493. return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
  25494. };
  25495. /**
  25496. * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
  25497. * @function
  25498. * @param {!Long|number|string} other Other value
  25499. * @returns {number} 0 if they are the same, 1 if the this is greater and -1
  25500. * if the given one is greater
  25501. * @expose
  25502. */
  25503. LongPrototype.comp = LongPrototype.compare;
  25504. /**
  25505. * Negates this Long's value.
  25506. * @returns {!Long} Negated Long
  25507. * @expose
  25508. */
  25509. LongPrototype.negate = function negate() {
  25510. if (!this.unsigned && this.eq(MIN_VALUE))
  25511. return MIN_VALUE;
  25512. return this.not().add(ONE);
  25513. };
  25514. /**
  25515. * Negates this Long's value. This is an alias of {@link Long#negate}.
  25516. * @function
  25517. * @returns {!Long} Negated Long
  25518. * @expose
  25519. */
  25520. LongPrototype.neg = LongPrototype.negate;
  25521. /**
  25522. * Returns the sum of this and the specified Long.
  25523. * @param {!Long|number|string} addend Addend
  25524. * @returns {!Long} Sum
  25525. * @expose
  25526. */
  25527. LongPrototype.add = function add(addend) {
  25528. if (!isLong(addend))
  25529. addend = fromValue(addend);
  25530. // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
  25531. var a48 = this.high >>> 16;
  25532. var a32 = this.high & 0xFFFF;
  25533. var a16 = this.low >>> 16;
  25534. var a00 = this.low & 0xFFFF;
  25535. var b48 = addend.high >>> 16;
  25536. var b32 = addend.high & 0xFFFF;
  25537. var b16 = addend.low >>> 16;
  25538. var b00 = addend.low & 0xFFFF;
  25539. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  25540. c00 += a00 + b00;
  25541. c16 += c00 >>> 16;
  25542. c00 &= 0xFFFF;
  25543. c16 += a16 + b16;
  25544. c32 += c16 >>> 16;
  25545. c16 &= 0xFFFF;
  25546. c32 += a32 + b32;
  25547. c48 += c32 >>> 16;
  25548. c32 &= 0xFFFF;
  25549. c48 += a48 + b48;
  25550. c48 &= 0xFFFF;
  25551. return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
  25552. };
  25553. /**
  25554. * Returns the difference of this and the specified Long.
  25555. * @param {!Long|number|string} subtrahend Subtrahend
  25556. * @returns {!Long} Difference
  25557. * @expose
  25558. */
  25559. LongPrototype.subtract = function subtract(subtrahend) {
  25560. if (!isLong(subtrahend))
  25561. subtrahend = fromValue(subtrahend);
  25562. return this.add(subtrahend.neg());
  25563. };
  25564. /**
  25565. * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
  25566. * @function
  25567. * @param {!Long|number|string} subtrahend Subtrahend
  25568. * @returns {!Long} Difference
  25569. * @expose
  25570. */
  25571. LongPrototype.sub = LongPrototype.subtract;
  25572. /**
  25573. * Returns the product of this and the specified Long.
  25574. * @param {!Long|number|string} multiplier Multiplier
  25575. * @returns {!Long} Product
  25576. * @expose
  25577. */
  25578. LongPrototype.multiply = function multiply(multiplier) {
  25579. if (this.isZero())
  25580. return ZERO;
  25581. if (!isLong(multiplier))
  25582. multiplier = fromValue(multiplier);
  25583. if (multiplier.isZero())
  25584. return ZERO;
  25585. if (this.eq(MIN_VALUE))
  25586. return multiplier.isOdd() ? MIN_VALUE : ZERO;
  25587. if (multiplier.eq(MIN_VALUE))
  25588. return this.isOdd() ? MIN_VALUE : ZERO;
  25589. if (this.isNegative()) {
  25590. if (multiplier.isNegative())
  25591. return this.neg().mul(multiplier.neg());
  25592. else
  25593. return this.neg().mul(multiplier).neg();
  25594. } else if (multiplier.isNegative())
  25595. return this.mul(multiplier.neg()).neg();
  25596. // If both longs are small, use float multiplication
  25597. if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
  25598. return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
  25599. // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
  25600. // We can skip products that would overflow.
  25601. var a48 = this.high >>> 16;
  25602. var a32 = this.high & 0xFFFF;
  25603. var a16 = this.low >>> 16;
  25604. var a00 = this.low & 0xFFFF;
  25605. var b48 = multiplier.high >>> 16;
  25606. var b32 = multiplier.high & 0xFFFF;
  25607. var b16 = multiplier.low >>> 16;
  25608. var b00 = multiplier.low & 0xFFFF;
  25609. var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
  25610. c00 += a00 * b00;
  25611. c16 += c00 >>> 16;
  25612. c00 &= 0xFFFF;
  25613. c16 += a16 * b00;
  25614. c32 += c16 >>> 16;
  25615. c16 &= 0xFFFF;
  25616. c16 += a00 * b16;
  25617. c32 += c16 >>> 16;
  25618. c16 &= 0xFFFF;
  25619. c32 += a32 * b00;
  25620. c48 += c32 >>> 16;
  25621. c32 &= 0xFFFF;
  25622. c32 += a16 * b16;
  25623. c48 += c32 >>> 16;
  25624. c32 &= 0xFFFF;
  25625. c32 += a00 * b32;
  25626. c48 += c32 >>> 16;
  25627. c32 &= 0xFFFF;
  25628. c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
  25629. c48 &= 0xFFFF;
  25630. return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
  25631. };
  25632. /**
  25633. * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
  25634. * @function
  25635. * @param {!Long|number|string} multiplier Multiplier
  25636. * @returns {!Long} Product
  25637. * @expose
  25638. */
  25639. LongPrototype.mul = LongPrototype.multiply;
  25640. /**
  25641. * Returns this Long divided by the specified. The result is signed if this Long is signed or
  25642. * unsigned if this Long is unsigned.
  25643. * @param {!Long|number|string} divisor Divisor
  25644. * @returns {!Long} Quotient
  25645. * @expose
  25646. */
  25647. LongPrototype.divide = function divide(divisor) {
  25648. if (!isLong(divisor))
  25649. divisor = fromValue(divisor);
  25650. if (divisor.isZero())
  25651. throw Error('division by zero');
  25652. if (this.isZero())
  25653. return this.unsigned ? UZERO : ZERO;
  25654. var approx, rem, res;
  25655. if (!this.unsigned) {
  25656. if (this.eq(MIN_VALUE)) {
  25657. if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
  25658. return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
  25659. else if (divisor.eq(MIN_VALUE))
  25660. return ONE;
  25661. else {
  25662. // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
  25663. var halfThis = this.shr(1);
  25664. approx = halfThis.div(divisor).shl(1);
  25665. if (approx.eq(ZERO)) {
  25666. return divisor.isNegative() ? ONE : NEG_ONE;
  25667. } else {
  25668. rem = this.sub(divisor.mul(approx));
  25669. res = approx.add(rem.div(divisor));
  25670. return res;
  25671. }
  25672. }
  25673. } else if (divisor.eq(MIN_VALUE))
  25674. return this.unsigned ? UZERO : ZERO;
  25675. if (this.isNegative()) {
  25676. if (divisor.isNegative())
  25677. return this.neg().div(divisor.neg());
  25678. return this.neg().div(divisor).neg();
  25679. } else if (divisor.isNegative())
  25680. return this.div(divisor.neg()).neg();
  25681. } else if (!divisor.unsigned)
  25682. divisor = divisor.toUnsigned();
  25683. // The algorithm below has not been made for unsigned longs. It's therefore
  25684. // required to take special care of the MSB prior to running it.
  25685. if (this.unsigned) {
  25686. if (divisor.gt(this))
  25687. return UZERO;
  25688. if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
  25689. return UONE;
  25690. res = UZERO;
  25691. } else
  25692. res = ZERO;
  25693. // Repeat the following until the remainder is less than other: find a
  25694. // floating-point that approximates remainder / other *from below*, add this
  25695. // into the result, and subtract it from the remainder. It is critical that
  25696. // the approximate value is less than or equal to the real value so that the
  25697. // remainder never becomes negative.
  25698. rem = this;
  25699. while (rem.gte(divisor)) {
  25700. // Approximate the result of division. This may be a little greater or
  25701. // smaller than the actual value.
  25702. approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
  25703. // We will tweak the approximate result by changing it in the 48-th digit or
  25704. // the smallest non-fractional digit, whichever is larger.
  25705. var log2 = Math.ceil(Math.log(approx) / Math.LN2),
  25706. delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
  25707. // Decrease the approximation until it is smaller than the remainder. Note
  25708. // that if it is too large, the product overflows and is negative.
  25709. approxRes = fromNumber(approx),
  25710. approxRem = approxRes.mul(divisor);
  25711. while (approxRem.isNegative() || approxRem.gt(rem)) {
  25712. approx -= delta;
  25713. approxRes = fromNumber(approx, this.unsigned);
  25714. approxRem = approxRes.mul(divisor);
  25715. }
  25716. // We know the answer can't be zero... and actually, zero would cause
  25717. // infinite recursion since we would make no progress.
  25718. if (approxRes.isZero())
  25719. approxRes = ONE;
  25720. res = res.add(approxRes);
  25721. rem = rem.sub(approxRem);
  25722. }
  25723. return res;
  25724. };
  25725. /**
  25726. * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
  25727. * @function
  25728. * @param {!Long|number|string} divisor Divisor
  25729. * @returns {!Long} Quotient
  25730. * @expose
  25731. */
  25732. LongPrototype.div = LongPrototype.divide;
  25733. /**
  25734. * Returns this Long modulo the specified.
  25735. * @param {!Long|number|string} divisor Divisor
  25736. * @returns {!Long} Remainder
  25737. * @expose
  25738. */
  25739. LongPrototype.modulo = function modulo(divisor) {
  25740. if (!isLong(divisor))
  25741. divisor = fromValue(divisor);
  25742. return this.sub(this.div(divisor).mul(divisor));
  25743. };
  25744. /**
  25745. * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
  25746. * @function
  25747. * @param {!Long|number|string} divisor Divisor
  25748. * @returns {!Long} Remainder
  25749. * @expose
  25750. */
  25751. LongPrototype.mod = LongPrototype.modulo;
  25752. /**
  25753. * Returns the bitwise NOT of this Long.
  25754. * @returns {!Long}
  25755. * @expose
  25756. */
  25757. LongPrototype.not = function not() {
  25758. return fromBits(~this.low, ~this.high, this.unsigned);
  25759. };
  25760. /**
  25761. * Returns the bitwise AND of this Long and the specified.
  25762. * @param {!Long|number|string} other Other Long
  25763. * @returns {!Long}
  25764. * @expose
  25765. */
  25766. LongPrototype.and = function and(other) {
  25767. if (!isLong(other))
  25768. other = fromValue(other);
  25769. return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
  25770. };
  25771. /**
  25772. * Returns the bitwise OR of this Long and the specified.
  25773. * @param {!Long|number|string} other Other Long
  25774. * @returns {!Long}
  25775. * @expose
  25776. */
  25777. LongPrototype.or = function or(other) {
  25778. if (!isLong(other))
  25779. other = fromValue(other);
  25780. return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
  25781. };
  25782. /**
  25783. * Returns the bitwise XOR of this Long and the given one.
  25784. * @param {!Long|number|string} other Other Long
  25785. * @returns {!Long}
  25786. * @expose
  25787. */
  25788. LongPrototype.xor = function xor(other) {
  25789. if (!isLong(other))
  25790. other = fromValue(other);
  25791. return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
  25792. };
  25793. /**
  25794. * Returns this Long with bits shifted to the left by the given amount.
  25795. * @param {number|!Long} numBits Number of bits
  25796. * @returns {!Long} Shifted Long
  25797. * @expose
  25798. */
  25799. LongPrototype.shiftLeft = function shiftLeft(numBits) {
  25800. if (isLong(numBits))
  25801. numBits = numBits.toInt();
  25802. if ((numBits &= 63) === 0)
  25803. return this;
  25804. else if (numBits < 32)
  25805. return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
  25806. else
  25807. return fromBits(0, this.low << (numBits - 32), this.unsigned);
  25808. };
  25809. /**
  25810. * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
  25811. * @function
  25812. * @param {number|!Long} numBits Number of bits
  25813. * @returns {!Long} Shifted Long
  25814. * @expose
  25815. */
  25816. LongPrototype.shl = LongPrototype.shiftLeft;
  25817. /**
  25818. * Returns this Long with bits arithmetically shifted to the right by the given amount.
  25819. * @param {number|!Long} numBits Number of bits
  25820. * @returns {!Long} Shifted Long
  25821. * @expose
  25822. */
  25823. LongPrototype.shiftRight = function shiftRight(numBits) {
  25824. if (isLong(numBits))
  25825. numBits = numBits.toInt();
  25826. if ((numBits &= 63) === 0)
  25827. return this;
  25828. else if (numBits < 32)
  25829. return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
  25830. else
  25831. return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
  25832. };
  25833. /**
  25834. * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
  25835. * @function
  25836. * @param {number|!Long} numBits Number of bits
  25837. * @returns {!Long} Shifted Long
  25838. * @expose
  25839. */
  25840. LongPrototype.shr = LongPrototype.shiftRight;
  25841. /**
  25842. * Returns this Long with bits logically shifted to the right by the given amount.
  25843. * @param {number|!Long} numBits Number of bits
  25844. * @returns {!Long} Shifted Long
  25845. * @expose
  25846. */
  25847. LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
  25848. if (isLong(numBits))
  25849. numBits = numBits.toInt();
  25850. numBits &= 63;
  25851. if (numBits === 0)
  25852. return this;
  25853. else {
  25854. var high = this.high;
  25855. if (numBits < 32) {
  25856. var low = this.low;
  25857. return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
  25858. } else if (numBits === 32)
  25859. return fromBits(high, 0, this.unsigned);
  25860. else
  25861. return fromBits(high >>> (numBits - 32), 0, this.unsigned);
  25862. }
  25863. };
  25864. /**
  25865. * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
  25866. * @function
  25867. * @param {number|!Long} numBits Number of bits
  25868. * @returns {!Long} Shifted Long
  25869. * @expose
  25870. */
  25871. LongPrototype.shru = LongPrototype.shiftRightUnsigned;
  25872. /**
  25873. * Converts this Long to signed.
  25874. * @returns {!Long} Signed long
  25875. * @expose
  25876. */
  25877. LongPrototype.toSigned = function toSigned() {
  25878. if (!this.unsigned)
  25879. return this;
  25880. return fromBits(this.low, this.high, false);
  25881. };
  25882. /**
  25883. * Converts this Long to unsigned.
  25884. * @returns {!Long} Unsigned long
  25885. * @expose
  25886. */
  25887. LongPrototype.toUnsigned = function toUnsigned() {
  25888. if (this.unsigned)
  25889. return this;
  25890. return fromBits(this.low, this.high, true);
  25891. };
  25892. return Long;
  25893. });
  25894. /*
  25895. Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
  25896. Licensed under the Apache License, Version 2.0 (the "License");
  25897. you may not use this file except in compliance with the License.
  25898. You may obtain a copy of the License at
  25899. http://www.apache.org/licenses/LICENSE-2.0
  25900. Unless required by applicable law or agreed to in writing, software
  25901. distributed under the License is distributed on an "AS IS" BASIS,
  25902. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25903. See the License for the specific language governing permissions and
  25904. limitations under the License.
  25905. */
  25906. /**
  25907. * @license ByteBuffer.js (c) 2013-2014 Daniel Wirtz <dcode@dcode.io>
  25908. * This version of ByteBuffer.js uses an ArrayBuffer as its backing buffer which is accessed through a DataView and is
  25909. * compatible with modern browsers.
  25910. * Released under the Apache License, Version 2.0
  25911. * see: https://github.com/dcodeIO/ByteBuffer.js for details
  25912. */ //
  25913. (function(global) {
  25914. "use strict";
  25915. /**
  25916. * @param {function(new: Long, number, number, boolean=)=} Long
  25917. * @returns {function(new: ByteBuffer, number=, boolean=, boolean=)}}
  25918. * @inner
  25919. */
  25920. function loadByteBuffer(Long) {
  25921. /**
  25922. * Constructs a new ByteBuffer.
  25923. * @class The swiss army knife for binary data in JavaScript.
  25924. * @exports ByteBuffer
  25925. * @constructor
  25926. * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
  25927. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  25928. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  25929. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  25930. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  25931. * @expose
  25932. */
  25933. var ByteBuffer = function(capacity, littleEndian, noAssert) {
  25934. if (typeof capacity === 'undefined') capacity = ByteBuffer.DEFAULT_CAPACITY;
  25935. if (typeof littleEndian === 'undefined') littleEndian = ByteBuffer.DEFAULT_ENDIAN;
  25936. if (typeof noAssert === 'undefined') noAssert = ByteBuffer.DEFAULT_NOASSERT;
  25937. if (!noAssert) {
  25938. capacity = capacity | 0;
  25939. if (capacity < 0)
  25940. throw RangeError("Illegal capacity");
  25941. littleEndian = !!littleEndian;
  25942. noAssert = !!noAssert;
  25943. }
  25944. /**
  25945. * Backing buffer.
  25946. * @type {!ArrayBuffer}
  25947. * @expose
  25948. */
  25949. this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
  25950. /**
  25951. * Data view to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
  25952. * @type {?DataView}
  25953. * @expose
  25954. */
  25955. this.view = capacity === 0 ? null : new DataView(this.buffer);
  25956. /**
  25957. * Absolute read/write offset.
  25958. * @type {number}
  25959. * @expose
  25960. * @see ByteBuffer#flip
  25961. * @see ByteBuffer#clear
  25962. */
  25963. this.offset = 0;
  25964. /**
  25965. * Marked offset.
  25966. * @type {number}
  25967. * @expose
  25968. * @see ByteBuffer#mark
  25969. * @see ByteBuffer#reset
  25970. */
  25971. this.markedOffset = -1;
  25972. /**
  25973. * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
  25974. * @type {number}
  25975. * @expose
  25976. * @see ByteBuffer#flip
  25977. * @see ByteBuffer#clear
  25978. */
  25979. this.limit = capacity;
  25980. /**
  25981. * Whether to use little endian byte order, defaults to `false` for big endian.
  25982. * @type {boolean}
  25983. * @expose
  25984. */
  25985. this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : false;
  25986. /**
  25987. * Whether to skip assertions of offsets and values, defaults to `false`.
  25988. * @type {boolean}
  25989. * @expose
  25990. */
  25991. this.noAssert = !!noAssert;
  25992. };
  25993. /**
  25994. * ByteBuffer version.
  25995. * @type {string}
  25996. * @const
  25997. * @expose
  25998. */
  25999. ByteBuffer.VERSION = "3.5.5";
  26000. /**
  26001. * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
  26002. * @type {boolean}
  26003. * @const
  26004. * @expose
  26005. */
  26006. ByteBuffer.LITTLE_ENDIAN = true;
  26007. /**
  26008. * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
  26009. * @type {boolean}
  26010. * @const
  26011. * @expose
  26012. */
  26013. ByteBuffer.BIG_ENDIAN = false;
  26014. /**
  26015. * Default initial capacity of `16`.
  26016. * @type {number}
  26017. * @expose
  26018. */
  26019. ByteBuffer.DEFAULT_CAPACITY = 16;
  26020. /**
  26021. * Default endianess of `false` for big endian.
  26022. * @type {boolean}
  26023. * @expose
  26024. */
  26025. ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
  26026. /**
  26027. * Default no assertions flag of `false`.
  26028. * @type {boolean}
  26029. * @expose
  26030. */
  26031. ByteBuffer.DEFAULT_NOASSERT = false;
  26032. /**
  26033. * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
  26034. * and int64 support is not available.
  26035. * @type {?Long}
  26036. * @const
  26037. * @see https://github.com/dcodeIO/Long.js
  26038. * @expose
  26039. */
  26040. ByteBuffer.Long = Long || null;
  26041. /**
  26042. * @alias ByteBuffer.prototype
  26043. * @inner
  26044. */
  26045. var ByteBufferPrototype = ByteBuffer.prototype;
  26046. // helpers
  26047. /**
  26048. * @type {!ArrayBuffer}
  26049. * @inner
  26050. */
  26051. var EMPTY_BUFFER = new ArrayBuffer(0);
  26052. /**
  26053. * String.fromCharCode reference for compile-time renaming.
  26054. * @type {function(...number):string}
  26055. * @inner
  26056. */
  26057. var stringFromCharCode = String.fromCharCode;
  26058. /**
  26059. * Creates a source function for a string.
  26060. * @param {string} s String to read from
  26061. * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
  26062. * no more characters left.
  26063. * @throws {TypeError} If the argument is invalid
  26064. * @inner
  26065. */
  26066. function stringSource(s) {
  26067. var i=0; return function() {
  26068. return i < s.length ? s.charCodeAt(i++) : null;
  26069. };
  26070. }
  26071. /**
  26072. * Creates a destination function for a string.
  26073. * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
  26074. * Returns the final string when called without arguments.
  26075. * @inner
  26076. */
  26077. function stringDestination() {
  26078. var cs = [], ps = []; return function() {
  26079. if (arguments.length === 0)
  26080. return ps.join('')+stringFromCharCode.apply(String, cs);
  26081. if (cs.length + arguments.length > 1024)
  26082. ps.push(stringFromCharCode.apply(String, cs)),
  26083. cs.length = 0;
  26084. Array.prototype.push.apply(cs, arguments);
  26085. };
  26086. }
  26087. /**
  26088. * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
  26089. * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
  26090. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  26091. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  26092. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  26093. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  26094. * @returns {!ByteBuffer}
  26095. * @expose
  26096. */
  26097. ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
  26098. return new ByteBuffer(capacity, littleEndian, noAssert);
  26099. };
  26100. /**
  26101. * Concatenates multiple ByteBuffers into one.
  26102. * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
  26103. * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
  26104. * defaults to "utf8")
  26105. * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
  26106. * to {@link ByteBuffer.DEFAULT_ENDIAN}.
  26107. * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
  26108. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  26109. * @returns {!ByteBuffer} Concatenated ByteBuffer
  26110. * @expose
  26111. */
  26112. ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
  26113. if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
  26114. noAssert = littleEndian;
  26115. littleEndian = encoding;
  26116. encoding = undefined;
  26117. }
  26118. var capacity = 0;
  26119. for (var i=0, k=buffers.length, length; i<k; ++i) {
  26120. if (!ByteBuffer.isByteBuffer(buffers[i]))
  26121. buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
  26122. length = buffers[i].limit - buffers[i].offset;
  26123. if (length > 0) capacity += length;
  26124. }
  26125. if (capacity === 0)
  26126. return new ByteBuffer(0, littleEndian, noAssert);
  26127. var bb = new ByteBuffer(capacity, littleEndian, noAssert),
  26128. bi;
  26129. var view = new Uint8Array(bb.buffer);
  26130. i=0; while (i<k) {
  26131. bi = buffers[i++];
  26132. length = bi.limit - bi.offset;
  26133. if (length <= 0) continue;
  26134. view.set(new Uint8Array(bi.buffer).subarray(bi.offset, bi.limit), bb.offset);
  26135. bb.offset += length;
  26136. }
  26137. bb.limit = bb.offset;
  26138. bb.offset = 0;
  26139. return bb;
  26140. };
  26141. /**
  26142. * Tests if the specified type is a ByteBuffer.
  26143. * @param {*} bb ByteBuffer to test
  26144. * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
  26145. * @expose
  26146. */
  26147. ByteBuffer.isByteBuffer = function(bb) {
  26148. return (bb && bb instanceof ByteBuffer) === true;
  26149. };
  26150. /**
  26151. * Gets the backing buffer type.
  26152. * @returns {Function} `Buffer` for NB builds, `ArrayBuffer` for AB builds (classes)
  26153. * @expose
  26154. */
  26155. ByteBuffer.type = function() {
  26156. return ArrayBuffer;
  26157. };
  26158. /**
  26159. * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
  26160. * {@link ByteBuffer#limit} to the length of the wrapped data.
  26161. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
  26162. * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
  26163. * "utf8")
  26164. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  26165. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  26166. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  26167. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  26168. * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
  26169. * @expose
  26170. */
  26171. ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
  26172. if (typeof encoding !== 'string') {
  26173. noAssert = littleEndian;
  26174. littleEndian = encoding;
  26175. encoding = undefined;
  26176. }
  26177. if (typeof buffer === 'string') {
  26178. if (typeof encoding === 'undefined')
  26179. encoding = "utf8";
  26180. switch (encoding) {
  26181. case "base64":
  26182. return ByteBuffer.fromBase64(buffer, littleEndian);
  26183. case "hex":
  26184. return ByteBuffer.fromHex(buffer, littleEndian);
  26185. case "binary":
  26186. return ByteBuffer.fromBinary(buffer, littleEndian);
  26187. case "utf8":
  26188. return ByteBuffer.fromUTF8(buffer, littleEndian);
  26189. case "debug":
  26190. return ByteBuffer.fromDebug(buffer, littleEndian);
  26191. default:
  26192. throw Error("Unsupported encoding: "+encoding);
  26193. }
  26194. }
  26195. if (buffer === null || typeof buffer !== 'object')
  26196. throw TypeError("Illegal buffer");
  26197. var bb;
  26198. if (ByteBuffer.isByteBuffer(buffer)) {
  26199. bb = ByteBufferPrototype.clone.call(buffer);
  26200. bb.markedOffset = -1;
  26201. return bb;
  26202. }
  26203. if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
  26204. bb = new ByteBuffer(0, littleEndian, noAssert);
  26205. if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
  26206. bb.buffer = buffer.buffer;
  26207. bb.offset = buffer.byteOffset;
  26208. bb.limit = buffer.byteOffset + buffer.length;
  26209. bb.view = buffer.length > 0 ? new DataView(buffer.buffer) : null;
  26210. }
  26211. } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
  26212. bb = new ByteBuffer(0, littleEndian, noAssert);
  26213. if (buffer.byteLength > 0) {
  26214. bb.buffer = buffer;
  26215. bb.offset = 0;
  26216. bb.limit = buffer.byteLength;
  26217. bb.view = buffer.byteLength > 0 ? new DataView(buffer) : null;
  26218. }
  26219. } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
  26220. bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
  26221. bb.limit = buffer.length;
  26222. for (i=0; i<buffer.length; ++i)
  26223. bb.view.setUint8(i, buffer[i]);
  26224. } else
  26225. throw TypeError("Illegal buffer"); // Otherwise fail
  26226. return bb;
  26227. };
  26228. // types/ints/int8
  26229. /**
  26230. * Writes an 8bit signed integer.
  26231. * @param {number} value Value to write
  26232. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26233. * @returns {!ByteBuffer} this
  26234. * @expose
  26235. */
  26236. ByteBufferPrototype.writeInt8 = function(value, offset) {
  26237. var relative = typeof offset === 'undefined';
  26238. if (relative) offset = this.offset;
  26239. if (!this.noAssert) {
  26240. if (typeof value !== 'number' || value % 1 !== 0)
  26241. throw TypeError("Illegal value: "+value+" (not an integer)");
  26242. value |= 0;
  26243. if (typeof offset !== 'number' || offset % 1 !== 0)
  26244. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26245. offset >>>= 0;
  26246. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26247. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26248. }
  26249. offset += 1;
  26250. var capacity0 = this.buffer.byteLength;
  26251. if (offset > capacity0)
  26252. this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
  26253. offset -= 1;
  26254. this.view.setInt8(offset, value);
  26255. if (relative) this.offset += 1;
  26256. return this;
  26257. };
  26258. /**
  26259. * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
  26260. * @function
  26261. * @param {number} value Value to write
  26262. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26263. * @returns {!ByteBuffer} this
  26264. * @expose
  26265. */
  26266. ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
  26267. /**
  26268. * Reads an 8bit signed integer.
  26269. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26270. * @returns {number} Value read
  26271. * @expose
  26272. */
  26273. ByteBufferPrototype.readInt8 = function(offset) {
  26274. var relative = typeof offset === 'undefined';
  26275. if (relative) offset = this.offset;
  26276. if (!this.noAssert) {
  26277. if (typeof offset !== 'number' || offset % 1 !== 0)
  26278. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26279. offset >>>= 0;
  26280. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  26281. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  26282. }
  26283. var value = this.view.getInt8(offset);
  26284. if (relative) this.offset += 1;
  26285. return value;
  26286. };
  26287. /**
  26288. * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
  26289. * @function
  26290. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26291. * @returns {number} Value read
  26292. * @expose
  26293. */
  26294. ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
  26295. /**
  26296. * Writes an 8bit unsigned integer.
  26297. * @param {number} value Value to write
  26298. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26299. * @returns {!ByteBuffer} this
  26300. * @expose
  26301. */
  26302. ByteBufferPrototype.writeUint8 = function(value, offset) {
  26303. var relative = typeof offset === 'undefined';
  26304. if (relative) offset = this.offset;
  26305. if (!this.noAssert) {
  26306. if (typeof value !== 'number' || value % 1 !== 0)
  26307. throw TypeError("Illegal value: "+value+" (not an integer)");
  26308. value >>>= 0;
  26309. if (typeof offset !== 'number' || offset % 1 !== 0)
  26310. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26311. offset >>>= 0;
  26312. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26313. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26314. }
  26315. offset += 1;
  26316. var capacity1 = this.buffer.byteLength;
  26317. if (offset > capacity1)
  26318. this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
  26319. offset -= 1;
  26320. this.view.setUint8(offset, value);
  26321. if (relative) this.offset += 1;
  26322. return this;
  26323. };
  26324. /**
  26325. * Reads an 8bit unsigned integer.
  26326. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
  26327. * @returns {number} Value read
  26328. * @expose
  26329. */
  26330. ByteBufferPrototype.readUint8 = function(offset) {
  26331. var relative = typeof offset === 'undefined';
  26332. if (relative) offset = this.offset;
  26333. if (!this.noAssert) {
  26334. if (typeof offset !== 'number' || offset % 1 !== 0)
  26335. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26336. offset >>>= 0;
  26337. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  26338. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  26339. }
  26340. var value = this.view.getUint8(offset);
  26341. if (relative) this.offset += 1;
  26342. return value;
  26343. };
  26344. // types/ints/int16
  26345. /**
  26346. * Writes a 16bit signed integer.
  26347. * @param {number} value Value to write
  26348. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26349. * @throws {TypeError} If `offset` or `value` is not a valid number
  26350. * @throws {RangeError} If `offset` is out of bounds
  26351. * @expose
  26352. */
  26353. ByteBufferPrototype.writeInt16 = function(value, offset) {
  26354. var relative = typeof offset === 'undefined';
  26355. if (relative) offset = this.offset;
  26356. if (!this.noAssert) {
  26357. if (typeof value !== 'number' || value % 1 !== 0)
  26358. throw TypeError("Illegal value: "+value+" (not an integer)");
  26359. value |= 0;
  26360. if (typeof offset !== 'number' || offset % 1 !== 0)
  26361. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26362. offset >>>= 0;
  26363. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26364. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26365. }
  26366. offset += 2;
  26367. var capacity2 = this.buffer.byteLength;
  26368. if (offset > capacity2)
  26369. this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
  26370. offset -= 2;
  26371. this.view.setInt16(offset, value, this.littleEndian);
  26372. if (relative) this.offset += 2;
  26373. return this;
  26374. };
  26375. /**
  26376. * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
  26377. * @function
  26378. * @param {number} value Value to write
  26379. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26380. * @throws {TypeError} If `offset` or `value` is not a valid number
  26381. * @throws {RangeError} If `offset` is out of bounds
  26382. * @expose
  26383. */
  26384. ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
  26385. /**
  26386. * Reads a 16bit signed integer.
  26387. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26388. * @returns {number} Value read
  26389. * @throws {TypeError} If `offset` is not a valid number
  26390. * @throws {RangeError} If `offset` is out of bounds
  26391. * @expose
  26392. */
  26393. ByteBufferPrototype.readInt16 = function(offset) {
  26394. var relative = typeof offset === 'undefined';
  26395. if (relative) offset = this.offset;
  26396. if (!this.noAssert) {
  26397. if (typeof offset !== 'number' || offset % 1 !== 0)
  26398. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26399. offset >>>= 0;
  26400. if (offset < 0 || offset + 2 > this.buffer.byteLength)
  26401. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
  26402. }
  26403. var value = this.view.getInt16(offset, this.littleEndian);
  26404. if (relative) this.offset += 2;
  26405. return value;
  26406. };
  26407. /**
  26408. * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
  26409. * @function
  26410. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26411. * @returns {number} Value read
  26412. * @throws {TypeError} If `offset` is not a valid number
  26413. * @throws {RangeError} If `offset` is out of bounds
  26414. * @expose
  26415. */
  26416. ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
  26417. /**
  26418. * Writes a 16bit unsigned integer.
  26419. * @param {number} value Value to write
  26420. * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26421. * @throws {TypeError} If `offset` or `value` is not a valid number
  26422. * @throws {RangeError} If `offset` is out of bounds
  26423. * @expose
  26424. */
  26425. ByteBufferPrototype.writeUint16 = function(value, offset) {
  26426. var relative = typeof offset === 'undefined';
  26427. if (relative) offset = this.offset;
  26428. if (!this.noAssert) {
  26429. if (typeof value !== 'number' || value % 1 !== 0)
  26430. throw TypeError("Illegal value: "+value+" (not an integer)");
  26431. value >>>= 0;
  26432. if (typeof offset !== 'number' || offset % 1 !== 0)
  26433. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26434. offset >>>= 0;
  26435. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26436. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26437. }
  26438. offset += 2;
  26439. var capacity3 = this.buffer.byteLength;
  26440. if (offset > capacity3)
  26441. this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
  26442. offset -= 2;
  26443. this.view.setUint16(offset, value, this.littleEndian);
  26444. if (relative) this.offset += 2;
  26445. return this;
  26446. };
  26447. /**
  26448. * Reads a 16bit unsigned integer.
  26449. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
  26450. * @returns {number} Value read
  26451. * @throws {TypeError} If `offset` is not a valid number
  26452. * @throws {RangeError} If `offset` is out of bounds
  26453. * @expose
  26454. */
  26455. ByteBufferPrototype.readUint16 = function(offset) {
  26456. var relative = typeof offset === 'undefined';
  26457. if (relative) offset = this.offset;
  26458. if (!this.noAssert) {
  26459. if (typeof offset !== 'number' || offset % 1 !== 0)
  26460. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26461. offset >>>= 0;
  26462. if (offset < 0 || offset + 2 > this.buffer.byteLength)
  26463. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
  26464. }
  26465. var value = this.view.getUint16(offset, this.littleEndian);
  26466. if (relative) this.offset += 2;
  26467. return value;
  26468. };
  26469. // types/ints/int32
  26470. /**
  26471. * Writes a 32bit signed integer.
  26472. * @param {number} value Value to write
  26473. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26474. * @expose
  26475. */
  26476. ByteBufferPrototype.writeInt32 = function(value, offset) {
  26477. var relative = typeof offset === 'undefined';
  26478. if (relative) offset = this.offset;
  26479. if (!this.noAssert) {
  26480. if (typeof value !== 'number' || value % 1 !== 0)
  26481. throw TypeError("Illegal value: "+value+" (not an integer)");
  26482. value |= 0;
  26483. if (typeof offset !== 'number' || offset % 1 !== 0)
  26484. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26485. offset >>>= 0;
  26486. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26487. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26488. }
  26489. offset += 4;
  26490. var capacity4 = this.buffer.byteLength;
  26491. if (offset > capacity4)
  26492. this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
  26493. offset -= 4;
  26494. this.view.setInt32(offset, value, this.littleEndian);
  26495. if (relative) this.offset += 4;
  26496. return this;
  26497. };
  26498. /**
  26499. * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
  26500. * @param {number} value Value to write
  26501. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26502. * @expose
  26503. */
  26504. ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
  26505. /**
  26506. * Reads a 32bit signed integer.
  26507. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26508. * @returns {number} Value read
  26509. * @expose
  26510. */
  26511. ByteBufferPrototype.readInt32 = function(offset) {
  26512. var relative = typeof offset === 'undefined';
  26513. if (relative) offset = this.offset;
  26514. if (!this.noAssert) {
  26515. if (typeof offset !== 'number' || offset % 1 !== 0)
  26516. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26517. offset >>>= 0;
  26518. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  26519. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  26520. }
  26521. var value = this.view.getInt32(offset, this.littleEndian);
  26522. if (relative) this.offset += 4;
  26523. return value;
  26524. };
  26525. /**
  26526. * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
  26527. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
  26528. * @returns {number} Value read
  26529. * @expose
  26530. */
  26531. ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
  26532. /**
  26533. * Writes a 32bit unsigned integer.
  26534. * @param {number} value Value to write
  26535. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26536. * @expose
  26537. */
  26538. ByteBufferPrototype.writeUint32 = function(value, offset) {
  26539. var relative = typeof offset === 'undefined';
  26540. if (relative) offset = this.offset;
  26541. if (!this.noAssert) {
  26542. if (typeof value !== 'number' || value % 1 !== 0)
  26543. throw TypeError("Illegal value: "+value+" (not an integer)");
  26544. value >>>= 0;
  26545. if (typeof offset !== 'number' || offset % 1 !== 0)
  26546. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26547. offset >>>= 0;
  26548. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26549. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26550. }
  26551. offset += 4;
  26552. var capacity5 = this.buffer.byteLength;
  26553. if (offset > capacity5)
  26554. this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
  26555. offset -= 4;
  26556. this.view.setUint32(offset, value, this.littleEndian);
  26557. if (relative) this.offset += 4;
  26558. return this;
  26559. };
  26560. /**
  26561. * Reads a 32bit unsigned integer.
  26562. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26563. * @returns {number} Value read
  26564. * @expose
  26565. */
  26566. ByteBufferPrototype.readUint32 = function(offset) {
  26567. var relative = typeof offset === 'undefined';
  26568. if (relative) offset = this.offset;
  26569. if (!this.noAssert) {
  26570. if (typeof offset !== 'number' || offset % 1 !== 0)
  26571. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26572. offset >>>= 0;
  26573. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  26574. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  26575. }
  26576. var value = this.view.getUint32(offset, this.littleEndian);
  26577. if (relative) this.offset += 4;
  26578. return value;
  26579. };
  26580. // types/ints/int64
  26581. if (Long) {
  26582. /**
  26583. * Writes a 64bit signed integer.
  26584. * @param {number|!Long} value Value to write
  26585. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26586. * @returns {!ByteBuffer} this
  26587. * @expose
  26588. */
  26589. ByteBufferPrototype.writeInt64 = function(value, offset) {
  26590. var relative = typeof offset === 'undefined';
  26591. if (relative) offset = this.offset;
  26592. if (!this.noAssert) {
  26593. if (typeof value === 'number')
  26594. value = Long.fromNumber(value);
  26595. else if (typeof value === 'string')
  26596. value = Long.fromString(value);
  26597. else if (!(value && value instanceof Long))
  26598. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  26599. if (typeof offset !== 'number' || offset % 1 !== 0)
  26600. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26601. offset >>>= 0;
  26602. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26603. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26604. }
  26605. if (typeof value === 'number')
  26606. value = Long.fromNumber(value);
  26607. else if (typeof value === 'string')
  26608. value = Long.fromString(value);
  26609. offset += 8;
  26610. var capacity6 = this.buffer.byteLength;
  26611. if (offset > capacity6)
  26612. this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
  26613. offset -= 8;
  26614. if (this.littleEndian) {
  26615. this.view.setInt32(offset , value.low , true);
  26616. this.view.setInt32(offset+4, value.high, true);
  26617. } else {
  26618. this.view.setInt32(offset , value.high, false);
  26619. this.view.setInt32(offset+4, value.low , false);
  26620. }
  26621. if (relative) this.offset += 8;
  26622. return this;
  26623. };
  26624. /**
  26625. * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
  26626. * @param {number|!Long} value Value to write
  26627. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26628. * @returns {!ByteBuffer} this
  26629. * @expose
  26630. */
  26631. ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
  26632. /**
  26633. * Reads a 64bit signed integer.
  26634. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26635. * @returns {!Long}
  26636. * @expose
  26637. */
  26638. ByteBufferPrototype.readInt64 = function(offset) {
  26639. var relative = typeof offset === 'undefined';
  26640. if (relative) offset = this.offset;
  26641. if (!this.noAssert) {
  26642. if (typeof offset !== 'number' || offset % 1 !== 0)
  26643. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26644. offset >>>= 0;
  26645. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  26646. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  26647. }
  26648. var value = this.littleEndian
  26649. ? new Long(this.view.getInt32(offset , true ), this.view.getInt32(offset+4, true ), false)
  26650. : new Long(this.view.getInt32(offset+4, false), this.view.getInt32(offset , false), false);
  26651. if (relative) this.offset += 8;
  26652. return value;
  26653. };
  26654. /**
  26655. * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
  26656. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26657. * @returns {!Long}
  26658. * @expose
  26659. */
  26660. ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
  26661. /**
  26662. * Writes a 64bit unsigned integer.
  26663. * @param {number|!Long} value Value to write
  26664. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26665. * @returns {!ByteBuffer} this
  26666. * @expose
  26667. */
  26668. ByteBufferPrototype.writeUint64 = function(value, offset) {
  26669. var relative = typeof offset === 'undefined';
  26670. if (relative) offset = this.offset;
  26671. if (!this.noAssert) {
  26672. if (typeof value === 'number')
  26673. value = Long.fromNumber(value);
  26674. else if (typeof value === 'string')
  26675. value = Long.fromString(value);
  26676. else if (!(value && value instanceof Long))
  26677. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  26678. if (typeof offset !== 'number' || offset % 1 !== 0)
  26679. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26680. offset >>>= 0;
  26681. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26682. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26683. }
  26684. if (typeof value === 'number')
  26685. value = Long.fromNumber(value);
  26686. else if (typeof value === 'string')
  26687. value = Long.fromString(value);
  26688. offset += 8;
  26689. var capacity7 = this.buffer.byteLength;
  26690. if (offset > capacity7)
  26691. this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
  26692. offset -= 8;
  26693. if (this.littleEndian) {
  26694. this.view.setInt32(offset , value.low , true);
  26695. this.view.setInt32(offset+4, value.high, true);
  26696. } else {
  26697. this.view.setInt32(offset , value.high, false);
  26698. this.view.setInt32(offset+4, value.low , false);
  26699. }
  26700. if (relative) this.offset += 8;
  26701. return this;
  26702. };
  26703. /**
  26704. * Reads a 64bit unsigned integer.
  26705. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26706. * @returns {!Long}
  26707. * @expose
  26708. */
  26709. ByteBufferPrototype.readUint64 = function(offset) {
  26710. var relative = typeof offset === 'undefined';
  26711. if (relative) offset = this.offset;
  26712. if (!this.noAssert) {
  26713. if (typeof offset !== 'number' || offset % 1 !== 0)
  26714. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26715. offset >>>= 0;
  26716. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  26717. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  26718. }
  26719. var value = this.littleEndian
  26720. ? new Long(this.view.getInt32(offset , true ), this.view.getInt32(offset+4, true ), true)
  26721. : new Long(this.view.getInt32(offset+4, false), this.view.getInt32(offset , false), true);
  26722. if (relative) this.offset += 8;
  26723. return value;
  26724. };
  26725. } // Long
  26726. // types/floats/float32
  26727. /**
  26728. * Writes a 32bit float.
  26729. * @param {number} value Value to write
  26730. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26731. * @returns {!ByteBuffer} this
  26732. * @expose
  26733. */
  26734. ByteBufferPrototype.writeFloat32 = function(value, offset) {
  26735. var relative = typeof offset === 'undefined';
  26736. if (relative) offset = this.offset;
  26737. if (!this.noAssert) {
  26738. if (typeof value !== 'number')
  26739. throw TypeError("Illegal value: "+value+" (not a number)");
  26740. if (typeof offset !== 'number' || offset % 1 !== 0)
  26741. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26742. offset >>>= 0;
  26743. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26744. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26745. }
  26746. offset += 4;
  26747. var capacity8 = this.buffer.byteLength;
  26748. if (offset > capacity8)
  26749. this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
  26750. offset -= 4;
  26751. this.view.setFloat32(offset, value, this.littleEndian);
  26752. if (relative) this.offset += 4;
  26753. return this;
  26754. };
  26755. /**
  26756. * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
  26757. * @function
  26758. * @param {number} value Value to write
  26759. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26760. * @returns {!ByteBuffer} this
  26761. * @expose
  26762. */
  26763. ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
  26764. /**
  26765. * Reads a 32bit float.
  26766. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26767. * @returns {number}
  26768. * @expose
  26769. */
  26770. ByteBufferPrototype.readFloat32 = function(offset) {
  26771. var relative = typeof offset === 'undefined';
  26772. if (relative) offset = this.offset;
  26773. if (!this.noAssert) {
  26774. if (typeof offset !== 'number' || offset % 1 !== 0)
  26775. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26776. offset >>>= 0;
  26777. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  26778. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  26779. }
  26780. var value = this.view.getFloat32(offset, this.littleEndian);
  26781. if (relative) this.offset += 4;
  26782. return value;
  26783. };
  26784. /**
  26785. * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
  26786. * @function
  26787. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
  26788. * @returns {number}
  26789. * @expose
  26790. */
  26791. ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
  26792. // types/floats/float64
  26793. /**
  26794. * Writes a 64bit float.
  26795. * @param {number} value Value to write
  26796. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26797. * @returns {!ByteBuffer} this
  26798. * @expose
  26799. */
  26800. ByteBufferPrototype.writeFloat64 = function(value, offset) {
  26801. var relative = typeof offset === 'undefined';
  26802. if (relative) offset = this.offset;
  26803. if (!this.noAssert) {
  26804. if (typeof value !== 'number')
  26805. throw TypeError("Illegal value: "+value+" (not a number)");
  26806. if (typeof offset !== 'number' || offset % 1 !== 0)
  26807. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26808. offset >>>= 0;
  26809. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26810. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26811. }
  26812. offset += 8;
  26813. var capacity9 = this.buffer.byteLength;
  26814. if (offset > capacity9)
  26815. this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
  26816. offset -= 8;
  26817. this.view.setFloat64(offset, value, this.littleEndian);
  26818. if (relative) this.offset += 8;
  26819. return this;
  26820. };
  26821. /**
  26822. * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
  26823. * @function
  26824. * @param {number} value Value to write
  26825. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26826. * @returns {!ByteBuffer} this
  26827. * @expose
  26828. */
  26829. ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
  26830. /**
  26831. * Reads a 64bit float.
  26832. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26833. * @returns {number}
  26834. * @expose
  26835. */
  26836. ByteBufferPrototype.readFloat64 = function(offset) {
  26837. var relative = typeof offset === 'undefined';
  26838. if (relative) offset = this.offset;
  26839. if (!this.noAssert) {
  26840. if (typeof offset !== 'number' || offset % 1 !== 0)
  26841. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26842. offset >>>= 0;
  26843. if (offset < 0 || offset + 8 > this.buffer.byteLength)
  26844. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
  26845. }
  26846. var value = this.view.getFloat64(offset, this.littleEndian);
  26847. if (relative) this.offset += 8;
  26848. return value;
  26849. };
  26850. /**
  26851. * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
  26852. * @function
  26853. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
  26854. * @returns {number}
  26855. * @expose
  26856. */
  26857. ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
  26858. // types/varints/varint32
  26859. /**
  26860. * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
  26861. * @type {number}
  26862. * @const
  26863. * @expose
  26864. */
  26865. ByteBuffer.MAX_VARINT32_BYTES = 5;
  26866. /**
  26867. * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
  26868. * @param {number} value Value to encode
  26869. * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
  26870. * @expose
  26871. */
  26872. ByteBuffer.calculateVarint32 = function(value) {
  26873. // ref: src/google/protobuf/io/coded_stream.cc
  26874. value = value >>> 0;
  26875. if (value < 1 << 7 ) return 1;
  26876. else if (value < 1 << 14) return 2;
  26877. else if (value < 1 << 21) return 3;
  26878. else if (value < 1 << 28) return 4;
  26879. else return 5;
  26880. };
  26881. /**
  26882. * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
  26883. * @param {number} n Signed 32bit integer
  26884. * @returns {number} Unsigned zigzag encoded 32bit integer
  26885. * @expose
  26886. */
  26887. ByteBuffer.zigZagEncode32 = function(n) {
  26888. return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
  26889. };
  26890. /**
  26891. * Decodes a zigzag encoded signed 32bit integer.
  26892. * @param {number} n Unsigned zigzag encoded 32bit integer
  26893. * @returns {number} Signed 32bit integer
  26894. * @expose
  26895. */
  26896. ByteBuffer.zigZagDecode32 = function(n) {
  26897. return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
  26898. };
  26899. /**
  26900. * Writes a 32bit base 128 variable-length integer.
  26901. * @param {number} value Value to write
  26902. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  26903. * written if omitted.
  26904. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
  26905. * @expose
  26906. */
  26907. ByteBufferPrototype.writeVarint32 = function(value, offset) {
  26908. var relative = typeof offset === 'undefined';
  26909. if (relative) offset = this.offset;
  26910. if (!this.noAssert) {
  26911. if (typeof value !== 'number' || value % 1 !== 0)
  26912. throw TypeError("Illegal value: "+value+" (not an integer)");
  26913. value |= 0;
  26914. if (typeof offset !== 'number' || offset % 1 !== 0)
  26915. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26916. offset >>>= 0;
  26917. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  26918. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  26919. }
  26920. var size = ByteBuffer.calculateVarint32(value),
  26921. b;
  26922. offset += size;
  26923. var capacity10 = this.buffer.byteLength;
  26924. if (offset > capacity10)
  26925. this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
  26926. offset -= size;
  26927. // ref: http://code.google.com/searchframe#WTeibokF6gE/trunk/src/google/protobuf/io/coded_stream.cc
  26928. this.view.setUint8(offset, b = value | 0x80);
  26929. value >>>= 0;
  26930. if (value >= 1 << 7) {
  26931. b = (value >> 7) | 0x80;
  26932. this.view.setUint8(offset+1, b);
  26933. if (value >= 1 << 14) {
  26934. b = (value >> 14) | 0x80;
  26935. this.view.setUint8(offset+2, b);
  26936. if (value >= 1 << 21) {
  26937. b = (value >> 21) | 0x80;
  26938. this.view.setUint8(offset+3, b);
  26939. if (value >= 1 << 28) {
  26940. this.view.setUint8(offset+4, (value >> 28) & 0x0F);
  26941. size = 5;
  26942. } else {
  26943. this.view.setUint8(offset+3, b & 0x7F);
  26944. size = 4;
  26945. }
  26946. } else {
  26947. this.view.setUint8(offset+2, b & 0x7F);
  26948. size = 3;
  26949. }
  26950. } else {
  26951. this.view.setUint8(offset+1, b & 0x7F);
  26952. size = 2;
  26953. }
  26954. } else {
  26955. this.view.setUint8(offset, b & 0x7F);
  26956. size = 1;
  26957. }
  26958. if (relative) {
  26959. this.offset += size;
  26960. return this;
  26961. }
  26962. return size;
  26963. };
  26964. /**
  26965. * Writes a zig-zag encoded 32bit base 128 variable-length integer.
  26966. * @param {number} value Value to write
  26967. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  26968. * written if omitted.
  26969. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
  26970. * @expose
  26971. */
  26972. ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
  26973. return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
  26974. };
  26975. /**
  26976. * Reads a 32bit base 128 variable-length integer.
  26977. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  26978. * written if omitted.
  26979. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
  26980. * and the actual number of bytes read.
  26981. * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
  26982. * to fully decode the varint.
  26983. * @expose
  26984. */
  26985. ByteBufferPrototype.readVarint32 = function(offset) {
  26986. var relative = typeof offset === 'undefined';
  26987. if (relative) offset = this.offset;
  26988. if (!this.noAssert) {
  26989. if (typeof offset !== 'number' || offset % 1 !== 0)
  26990. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  26991. offset >>>= 0;
  26992. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  26993. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  26994. }
  26995. // ref: src/google/protobuf/io/coded_stream.cc
  26996. var size = 0,
  26997. value = 0 >>> 0,
  26998. temp,
  26999. ioffset;
  27000. do {
  27001. ioffset = offset+size;
  27002. if (!this.noAssert && ioffset > this.limit) {
  27003. var err = Error("Truncated");
  27004. err['truncated'] = true;
  27005. throw err;
  27006. }
  27007. temp = this.view.getUint8(ioffset);
  27008. if (size < 5)
  27009. value |= ((temp&0x7F)<<(7*size)) >>> 0;
  27010. ++size;
  27011. } while ((temp & 0x80) === 0x80);
  27012. value = value | 0; // Make sure to discard the higher order bits
  27013. if (relative) {
  27014. this.offset += size;
  27015. return value;
  27016. }
  27017. return {
  27018. "value": value,
  27019. "length": size
  27020. };
  27021. };
  27022. /**
  27023. * Reads a zig-zag encoded 32bit base 128 variable-length integer.
  27024. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27025. * written if omitted.
  27026. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
  27027. * and the actual number of bytes read.
  27028. * @throws {Error} If it's not a valid varint
  27029. * @expose
  27030. */
  27031. ByteBufferPrototype.readVarint32ZigZag = function(offset) {
  27032. var val = this.readVarint32(offset);
  27033. if (typeof val === 'object')
  27034. val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
  27035. else
  27036. val = ByteBuffer.zigZagDecode32(val);
  27037. return val;
  27038. };
  27039. // types/varints/varint64
  27040. if (Long) {
  27041. /**
  27042. * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
  27043. * @type {number}
  27044. * @const
  27045. * @expose
  27046. */
  27047. ByteBuffer.MAX_VARINT64_BYTES = 10;
  27048. /**
  27049. * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
  27050. * @param {number|!Long} value Value to encode
  27051. * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
  27052. * @expose
  27053. */
  27054. ByteBuffer.calculateVarint64 = function(value) {
  27055. if (typeof value === 'number')
  27056. value = Long.fromNumber(value);
  27057. else if (typeof value === 'string')
  27058. value = Long.fromString(value);
  27059. // ref: src/google/protobuf/io/coded_stream.cc
  27060. var part0 = value.toInt() >>> 0,
  27061. part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
  27062. part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
  27063. if (part2 == 0) {
  27064. if (part1 == 0) {
  27065. if (part0 < 1 << 14)
  27066. return part0 < 1 << 7 ? 1 : 2;
  27067. else
  27068. return part0 < 1 << 21 ? 3 : 4;
  27069. } else {
  27070. if (part1 < 1 << 14)
  27071. return part1 < 1 << 7 ? 5 : 6;
  27072. else
  27073. return part1 < 1 << 21 ? 7 : 8;
  27074. }
  27075. } else
  27076. return part2 < 1 << 7 ? 9 : 10;
  27077. };
  27078. /**
  27079. * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
  27080. * @param {number|!Long} value Signed long
  27081. * @returns {!Long} Unsigned zigzag encoded long
  27082. * @expose
  27083. */
  27084. ByteBuffer.zigZagEncode64 = function(value) {
  27085. if (typeof value === 'number')
  27086. value = Long.fromNumber(value, false);
  27087. else if (typeof value === 'string')
  27088. value = Long.fromString(value, false);
  27089. else if (value.unsigned !== false) value = value.toSigned();
  27090. // ref: src/google/protobuf/wire_format_lite.h
  27091. return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
  27092. };
  27093. /**
  27094. * Decodes a zigzag encoded signed 64bit integer.
  27095. * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
  27096. * @returns {!Long} Signed long
  27097. * @expose
  27098. */
  27099. ByteBuffer.zigZagDecode64 = function(value) {
  27100. if (typeof value === 'number')
  27101. value = Long.fromNumber(value, false);
  27102. else if (typeof value === 'string')
  27103. value = Long.fromString(value, false);
  27104. else if (value.unsigned !== false) value = value.toSigned();
  27105. // ref: src/google/protobuf/wire_format_lite.h
  27106. return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
  27107. };
  27108. /**
  27109. * Writes a 64bit base 128 variable-length integer.
  27110. * @param {number|Long} value Value to write
  27111. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27112. * written if omitted.
  27113. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
  27114. * @expose
  27115. */
  27116. ByteBufferPrototype.writeVarint64 = function(value, offset) {
  27117. var relative = typeof offset === 'undefined';
  27118. if (relative) offset = this.offset;
  27119. if (!this.noAssert) {
  27120. if (typeof value === 'number')
  27121. value = Long.fromNumber(value);
  27122. else if (typeof value === 'string')
  27123. value = Long.fromString(value);
  27124. else if (!(value && value instanceof Long))
  27125. throw TypeError("Illegal value: "+value+" (not an integer or Long)");
  27126. if (typeof offset !== 'number' || offset % 1 !== 0)
  27127. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27128. offset >>>= 0;
  27129. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27130. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27131. }
  27132. if (typeof value === 'number')
  27133. value = Long.fromNumber(value, false);
  27134. else if (typeof value === 'string')
  27135. value = Long.fromString(value, false);
  27136. else if (value.unsigned !== false) value = value.toSigned();
  27137. var size = ByteBuffer.calculateVarint64(value),
  27138. part0 = value.toInt() >>> 0,
  27139. part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
  27140. part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
  27141. offset += size;
  27142. var capacity11 = this.buffer.byteLength;
  27143. if (offset > capacity11)
  27144. this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
  27145. offset -= size;
  27146. switch (size) {
  27147. case 10: this.view.setUint8(offset+9, (part2 >>> 7) & 0x01);
  27148. case 9 : this.view.setUint8(offset+8, size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F);
  27149. case 8 : this.view.setUint8(offset+7, size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F);
  27150. case 7 : this.view.setUint8(offset+6, size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F);
  27151. case 6 : this.view.setUint8(offset+5, size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F);
  27152. case 5 : this.view.setUint8(offset+4, size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F);
  27153. case 4 : this.view.setUint8(offset+3, size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F);
  27154. case 3 : this.view.setUint8(offset+2, size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F);
  27155. case 2 : this.view.setUint8(offset+1, size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F);
  27156. case 1 : this.view.setUint8(offset , size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F);
  27157. }
  27158. if (relative) {
  27159. this.offset += size;
  27160. return this;
  27161. } else {
  27162. return size;
  27163. }
  27164. };
  27165. /**
  27166. * Writes a zig-zag encoded 64bit base 128 variable-length integer.
  27167. * @param {number|Long} value Value to write
  27168. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27169. * written if omitted.
  27170. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
  27171. * @expose
  27172. */
  27173. ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
  27174. return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
  27175. };
  27176. /**
  27177. * Reads a 64bit base 128 variable-length integer. Requires Long.js.
  27178. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27179. * read if omitted.
  27180. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
  27181. * the actual number of bytes read.
  27182. * @throws {Error} If it's not a valid varint
  27183. * @expose
  27184. */
  27185. ByteBufferPrototype.readVarint64 = function(offset) {
  27186. var relative = typeof offset === 'undefined';
  27187. if (relative) offset = this.offset;
  27188. if (!this.noAssert) {
  27189. if (typeof offset !== 'number' || offset % 1 !== 0)
  27190. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27191. offset >>>= 0;
  27192. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  27193. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  27194. }
  27195. // ref: src/google/protobuf/io/coded_stream.cc
  27196. var start = offset,
  27197. part0 = 0,
  27198. part1 = 0,
  27199. part2 = 0,
  27200. b = 0;
  27201. b = this.view.getUint8(offset++); part0 = (b & 0x7F) ; if (b & 0x80) {
  27202. b = this.view.getUint8(offset++); part0 |= (b & 0x7F) << 7; if (b & 0x80) {
  27203. b = this.view.getUint8(offset++); part0 |= (b & 0x7F) << 14; if (b & 0x80) {
  27204. b = this.view.getUint8(offset++); part0 |= (b & 0x7F) << 21; if (b & 0x80) {
  27205. b = this.view.getUint8(offset++); part1 = (b & 0x7F) ; if (b & 0x80) {
  27206. b = this.view.getUint8(offset++); part1 |= (b & 0x7F) << 7; if (b & 0x80) {
  27207. b = this.view.getUint8(offset++); part1 |= (b & 0x7F) << 14; if (b & 0x80) {
  27208. b = this.view.getUint8(offset++); part1 |= (b & 0x7F) << 21; if (b & 0x80) {
  27209. b = this.view.getUint8(offset++); part2 = (b & 0x7F) ; if (b & 0x80) {
  27210. b = this.view.getUint8(offset++); part2 |= (b & 0x7F) << 7; if (b & 0x80) {
  27211. throw Error("Buffer overrun"); }}}}}}}}}}
  27212. var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
  27213. if (relative) {
  27214. this.offset = offset;
  27215. return value;
  27216. } else {
  27217. return {
  27218. 'value': value,
  27219. 'length': offset-start
  27220. };
  27221. }
  27222. };
  27223. /**
  27224. * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
  27225. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27226. * read if omitted.
  27227. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
  27228. * the actual number of bytes read.
  27229. * @throws {Error} If it's not a valid varint
  27230. * @expose
  27231. */
  27232. ByteBufferPrototype.readVarint64ZigZag = function(offset) {
  27233. var val = this.readVarint64(offset);
  27234. if (val && val['value'] instanceof Long)
  27235. val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
  27236. else
  27237. val = ByteBuffer.zigZagDecode64(val);
  27238. return val;
  27239. };
  27240. } // Long
  27241. // types/strings/cstring
  27242. /**
  27243. * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
  27244. * characters itself.
  27245. * @param {string} str String to write
  27246. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27247. * contained in `str` + 1 if omitted.
  27248. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
  27249. * @expose
  27250. */
  27251. ByteBufferPrototype.writeCString = function(str, offset) {
  27252. var relative = typeof offset === 'undefined';
  27253. if (relative) offset = this.offset;
  27254. var i,
  27255. k = str.length;
  27256. if (!this.noAssert) {
  27257. if (typeof str !== 'string')
  27258. throw TypeError("Illegal str: Not a string");
  27259. for (i=0; i<k; ++i) {
  27260. if (str.charCodeAt(i) === 0)
  27261. throw RangeError("Illegal str: Contains NULL-characters");
  27262. }
  27263. if (typeof offset !== 'number' || offset % 1 !== 0)
  27264. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27265. offset >>>= 0;
  27266. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27267. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27268. }
  27269. // UTF8 strings do not contain zero bytes in between except for the zero character, so:
  27270. k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
  27271. offset += k+1;
  27272. var capacity12 = this.buffer.byteLength;
  27273. if (offset > capacity12)
  27274. this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
  27275. offset -= k+1;
  27276. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  27277. this.view.setUint8(offset++, b);
  27278. }.bind(this));
  27279. this.view.setUint8(offset++, 0);
  27280. if (relative) {
  27281. this.offset = offset;
  27282. return this;
  27283. }
  27284. return k;
  27285. };
  27286. /**
  27287. * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
  27288. * itself.
  27289. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27290. * read if omitted.
  27291. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  27292. * read and the actual number of bytes read.
  27293. * @expose
  27294. */
  27295. ByteBufferPrototype.readCString = function(offset) {
  27296. var relative = typeof offset === 'undefined';
  27297. if (relative) offset = this.offset;
  27298. if (!this.noAssert) {
  27299. if (typeof offset !== 'number' || offset % 1 !== 0)
  27300. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27301. offset >>>= 0;
  27302. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  27303. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  27304. }
  27305. var start = offset,
  27306. temp;
  27307. // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
  27308. var sd, b = -1;
  27309. utfx.decodeUTF8toUTF16(function() {
  27310. if (b === 0) return null;
  27311. if (offset >= this.limit)
  27312. throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
  27313. return (b = this.view.getUint8(offset++)) === 0 ? null : b;
  27314. }.bind(this), sd = stringDestination(), true);
  27315. if (relative) {
  27316. this.offset = offset;
  27317. return sd();
  27318. } else {
  27319. return {
  27320. "string": sd(),
  27321. "length": offset - start
  27322. };
  27323. }
  27324. };
  27325. // types/strings/istring
  27326. /**
  27327. * Writes a length as uint32 prefixed UTF8 encoded string.
  27328. * @param {string} str String to write
  27329. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27330. * written if omitted.
  27331. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
  27332. * @expose
  27333. * @see ByteBuffer#writeVarint32
  27334. */
  27335. ByteBufferPrototype.writeIString = function(str, offset) {
  27336. var relative = typeof offset === 'undefined';
  27337. if (relative) offset = this.offset;
  27338. if (!this.noAssert) {
  27339. if (typeof str !== 'string')
  27340. throw TypeError("Illegal str: Not a string");
  27341. if (typeof offset !== 'number' || offset % 1 !== 0)
  27342. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27343. offset >>>= 0;
  27344. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27345. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27346. }
  27347. var start = offset,
  27348. k;
  27349. k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
  27350. offset += 4+k;
  27351. var capacity13 = this.buffer.byteLength;
  27352. if (offset > capacity13)
  27353. this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
  27354. offset -= 4+k;
  27355. this.view.setUint32(offset, k, this.littleEndian);
  27356. offset += 4;
  27357. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  27358. this.view.setUint8(offset++, b);
  27359. }.bind(this));
  27360. if (offset !== start + 4 + k)
  27361. throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
  27362. if (relative) {
  27363. this.offset = offset;
  27364. return this;
  27365. }
  27366. return offset - start;
  27367. };
  27368. /**
  27369. * Reads a length as uint32 prefixed UTF8 encoded string.
  27370. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27371. * read if omitted.
  27372. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  27373. * read and the actual number of bytes read.
  27374. * @expose
  27375. * @see ByteBuffer#readVarint32
  27376. */
  27377. ByteBufferPrototype.readIString = function(offset) {
  27378. var relative = typeof offset === 'undefined';
  27379. if (relative) offset = this.offset;
  27380. if (!this.noAssert) {
  27381. if (typeof offset !== 'number' || offset % 1 !== 0)
  27382. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27383. offset >>>= 0;
  27384. if (offset < 0 || offset + 4 > this.buffer.byteLength)
  27385. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
  27386. }
  27387. var temp = 0,
  27388. start = offset,
  27389. str;
  27390. temp = this.view.getUint32(offset, this.littleEndian);
  27391. offset += 4;
  27392. var k = offset + temp,
  27393. sd;
  27394. utfx.decodeUTF8toUTF16(function() {
  27395. return offset < k ? this.view.getUint8(offset++) : null;
  27396. }.bind(this), sd = stringDestination(), this.noAssert);
  27397. str = sd();
  27398. if (relative) {
  27399. this.offset = offset;
  27400. return str;
  27401. } else {
  27402. return {
  27403. 'string': str,
  27404. 'length': offset - start
  27405. };
  27406. }
  27407. };
  27408. // types/strings/utf8string
  27409. /**
  27410. * Metrics representing number of UTF8 characters. Evaluates to `c`.
  27411. * @type {string}
  27412. * @const
  27413. * @expose
  27414. */
  27415. ByteBuffer.METRICS_CHARS = 'c';
  27416. /**
  27417. * Metrics representing number of bytes. Evaluates to `b`.
  27418. * @type {string}
  27419. * @const
  27420. * @expose
  27421. */
  27422. ByteBuffer.METRICS_BYTES = 'b';
  27423. /**
  27424. * Writes an UTF8 encoded string.
  27425. * @param {string} str String to write
  27426. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
  27427. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
  27428. * @expose
  27429. */
  27430. ByteBufferPrototype.writeUTF8String = function(str, offset) {
  27431. var relative = typeof offset === 'undefined';
  27432. if (relative) offset = this.offset;
  27433. if (!this.noAssert) {
  27434. if (typeof offset !== 'number' || offset % 1 !== 0)
  27435. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27436. offset >>>= 0;
  27437. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27438. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27439. }
  27440. var k;
  27441. var start = offset;
  27442. k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
  27443. offset += k;
  27444. var capacity14 = this.buffer.byteLength;
  27445. if (offset > capacity14)
  27446. this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
  27447. offset -= k;
  27448. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  27449. this.view.setUint8(offset++, b);
  27450. }.bind(this));
  27451. if (relative) {
  27452. this.offset = offset;
  27453. return this;
  27454. }
  27455. return offset - start;
  27456. };
  27457. /**
  27458. * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
  27459. * @function
  27460. * @param {string} str String to write
  27461. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
  27462. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
  27463. * @expose
  27464. */
  27465. ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
  27466. /**
  27467. * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
  27468. * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
  27469. * @function
  27470. * @param {string} str String to calculate
  27471. * @returns {number} Number of UTF8 characters
  27472. * @expose
  27473. */
  27474. ByteBuffer.calculateUTF8Chars = function(str) {
  27475. return utfx.calculateUTF16asUTF8(stringSource(str))[0];
  27476. };
  27477. /**
  27478. * Calculates the number of UTF8 bytes of a string.
  27479. * @function
  27480. * @param {string} str String to calculate
  27481. * @returns {number} Number of UTF8 bytes
  27482. * @expose
  27483. */
  27484. ByteBuffer.calculateUTF8Bytes = function(str) {
  27485. return utfx.calculateUTF16asUTF8(stringSource(str))[1];
  27486. };
  27487. /**
  27488. * Reads an UTF8 encoded string.
  27489. * @param {number} length Number of characters or bytes to read.
  27490. * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
  27491. * {@link ByteBuffer.METRICS_CHARS}.
  27492. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27493. * read if omitted.
  27494. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  27495. * read and the actual number of bytes read.
  27496. * @expose
  27497. */
  27498. ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
  27499. if (typeof metrics === 'number') {
  27500. offset = metrics;
  27501. metrics = undefined;
  27502. }
  27503. var relative = typeof offset === 'undefined';
  27504. if (relative) offset = this.offset;
  27505. if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
  27506. if (!this.noAssert) {
  27507. if (typeof length !== 'number' || length % 1 !== 0)
  27508. throw TypeError("Illegal length: "+length+" (not an integer)");
  27509. length |= 0;
  27510. if (typeof offset !== 'number' || offset % 1 !== 0)
  27511. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27512. offset >>>= 0;
  27513. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27514. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27515. }
  27516. var i = 0,
  27517. start = offset,
  27518. sd;
  27519. if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
  27520. sd = stringDestination();
  27521. utfx.decodeUTF8(function() {
  27522. return i < length && offset < this.limit ? this.view.getUint8(offset++) : null;
  27523. }.bind(this), function(cp) {
  27524. ++i; utfx.UTF8toUTF16(cp, sd);
  27525. }.bind(this));
  27526. if (i !== length)
  27527. throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
  27528. if (relative) {
  27529. this.offset = offset;
  27530. return sd();
  27531. } else {
  27532. return {
  27533. "string": sd(),
  27534. "length": offset - start
  27535. };
  27536. }
  27537. } else if (metrics === ByteBuffer.METRICS_BYTES) {
  27538. if (!this.noAssert) {
  27539. if (typeof offset !== 'number' || offset % 1 !== 0)
  27540. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27541. offset >>>= 0;
  27542. if (offset < 0 || offset + length > this.buffer.byteLength)
  27543. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
  27544. }
  27545. var k = offset + length;
  27546. utfx.decodeUTF8toUTF16(function() {
  27547. return offset < k ? this.view.getUint8(offset++) : null;
  27548. }.bind(this), sd = stringDestination(), this.noAssert);
  27549. if (offset !== k)
  27550. throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
  27551. if (relative) {
  27552. this.offset = offset;
  27553. return sd();
  27554. } else {
  27555. return {
  27556. 'string': sd(),
  27557. 'length': offset - start
  27558. };
  27559. }
  27560. } else
  27561. throw TypeError("Unsupported metrics: "+metrics);
  27562. };
  27563. /**
  27564. * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
  27565. * @function
  27566. * @param {number} length Number of characters or bytes to read
  27567. * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
  27568. * {@link ByteBuffer.METRICS_CHARS}.
  27569. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27570. * read if omitted.
  27571. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  27572. * read and the actual number of bytes read.
  27573. * @expose
  27574. */
  27575. ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
  27576. // types/strings/vstring
  27577. /**
  27578. * Writes a length as varint32 prefixed UTF8 encoded string.
  27579. * @param {string} str String to write
  27580. * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27581. * written if omitted.
  27582. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
  27583. * @expose
  27584. * @see ByteBuffer#writeVarint32
  27585. */
  27586. ByteBufferPrototype.writeVString = function(str, offset) {
  27587. var relative = typeof offset === 'undefined';
  27588. if (relative) offset = this.offset;
  27589. if (!this.noAssert) {
  27590. if (typeof str !== 'string')
  27591. throw TypeError("Illegal str: Not a string");
  27592. if (typeof offset !== 'number' || offset % 1 !== 0)
  27593. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27594. offset >>>= 0;
  27595. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27596. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27597. }
  27598. var start = offset,
  27599. k, l;
  27600. k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
  27601. l = ByteBuffer.calculateVarint32(k);
  27602. offset += l+k;
  27603. var capacity15 = this.buffer.byteLength;
  27604. if (offset > capacity15)
  27605. this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
  27606. offset -= l+k;
  27607. offset += this.writeVarint32(k, offset);
  27608. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  27609. this.view.setUint8(offset++, b);
  27610. }.bind(this));
  27611. if (offset !== start+k+l)
  27612. throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
  27613. if (relative) {
  27614. this.offset = offset;
  27615. return this;
  27616. }
  27617. return offset - start;
  27618. };
  27619. /**
  27620. * Reads a length as varint32 prefixed UTF8 encoded string.
  27621. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27622. * read if omitted.
  27623. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
  27624. * read and the actual number of bytes read.
  27625. * @expose
  27626. * @see ByteBuffer#readVarint32
  27627. */
  27628. ByteBufferPrototype.readVString = function(offset) {
  27629. var relative = typeof offset === 'undefined';
  27630. if (relative) offset = this.offset;
  27631. if (!this.noAssert) {
  27632. if (typeof offset !== 'number' || offset % 1 !== 0)
  27633. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27634. offset >>>= 0;
  27635. if (offset < 0 || offset + 1 > this.buffer.byteLength)
  27636. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
  27637. }
  27638. var temp = this.readVarint32(offset),
  27639. start = offset,
  27640. str;
  27641. offset += temp['length'];
  27642. temp = temp['value'];
  27643. var k = offset + temp,
  27644. sd = stringDestination();
  27645. utfx.decodeUTF8toUTF16(function() {
  27646. return offset < k ? this.view.getUint8(offset++) : null;
  27647. }.bind(this), sd, this.noAssert);
  27648. str = sd();
  27649. if (relative) {
  27650. this.offset = offset;
  27651. return str;
  27652. } else {
  27653. return {
  27654. 'string': str,
  27655. 'length': offset - start
  27656. };
  27657. }
  27658. };
  27659. /**
  27660. * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
  27661. * data's length.
  27662. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
  27663. * will be modified according to the performed read operation.
  27664. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
  27665. * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27666. * read if omitted.
  27667. * @returns {!ByteBuffer} this
  27668. * @expose
  27669. * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
  27670. * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
  27671. */
  27672. ByteBufferPrototype.append = function(source, encoding, offset) {
  27673. if (typeof encoding === 'number' || typeof encoding !== 'string') {
  27674. offset = encoding;
  27675. encoding = undefined;
  27676. }
  27677. var relative = typeof offset === 'undefined';
  27678. if (relative) offset = this.offset;
  27679. if (!this.noAssert) {
  27680. if (typeof offset !== 'number' || offset % 1 !== 0)
  27681. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27682. offset >>>= 0;
  27683. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27684. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27685. }
  27686. if (!(source instanceof ByteBuffer))
  27687. source = ByteBuffer.wrap(source, encoding);
  27688. var length = source.limit - source.offset;
  27689. if (length <= 0) return this; // Nothing to append
  27690. offset += length;
  27691. var capacity16 = this.buffer.byteLength;
  27692. if (offset > capacity16)
  27693. this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
  27694. offset -= length;
  27695. new Uint8Array(this.buffer, offset).set(new Uint8Array(source.buffer).subarray(source.offset, source.limit));
  27696. source.offset += length;
  27697. if (relative) this.offset += length;
  27698. return this;
  27699. };
  27700. /**
  27701. * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
  27702. specified offset up to the length of this ByteBuffer's data.
  27703. * @param {!ByteBuffer} target Target ByteBuffer
  27704. * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27705. * read if omitted.
  27706. * @returns {!ByteBuffer} this
  27707. * @expose
  27708. * @see ByteBuffer#append
  27709. */
  27710. ByteBufferPrototype.appendTo = function(target, offset) {
  27711. target.append(this, offset);
  27712. return this;
  27713. };
  27714. /**
  27715. * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
  27716. * disable them if your code already makes sure that everything is valid.
  27717. * @param {boolean} assert `true` to enable assertions, otherwise `false`
  27718. * @returns {!ByteBuffer} this
  27719. * @expose
  27720. */
  27721. ByteBufferPrototype.assert = function(assert) {
  27722. this.noAssert = !assert;
  27723. return this;
  27724. };
  27725. /**
  27726. * Gets the capacity of this ByteBuffer's backing buffer.
  27727. * @returns {number} Capacity of the backing buffer
  27728. * @expose
  27729. */
  27730. ByteBufferPrototype.capacity = function() {
  27731. return this.buffer.byteLength;
  27732. };
  27733. /**
  27734. * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
  27735. * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
  27736. * @returns {!ByteBuffer} this
  27737. * @expose
  27738. */
  27739. ByteBufferPrototype.clear = function() {
  27740. this.offset = 0;
  27741. this.limit = this.buffer.byteLength;
  27742. this.markedOffset = -1;
  27743. return this;
  27744. };
  27745. /**
  27746. * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
  27747. * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
  27748. * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
  27749. * @returns {!ByteBuffer} Cloned instance
  27750. * @expose
  27751. */
  27752. ByteBufferPrototype.clone = function(copy) {
  27753. var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
  27754. if (copy) {
  27755. var buffer = new ArrayBuffer(this.buffer.byteLength);
  27756. new Uint8Array(buffer).set(this.buffer);
  27757. bb.buffer = buffer;
  27758. bb.view = new DataView(buffer);
  27759. } else {
  27760. bb.buffer = this.buffer;
  27761. bb.view = this.view;
  27762. }
  27763. bb.offset = this.offset;
  27764. bb.markedOffset = this.markedOffset;
  27765. bb.limit = this.limit;
  27766. return bb;
  27767. };
  27768. /**
  27769. * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
  27770. * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
  27771. * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
  27772. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
  27773. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  27774. * @returns {!ByteBuffer} this
  27775. * @expose
  27776. */
  27777. ByteBufferPrototype.compact = function(begin, end) {
  27778. if (typeof begin === 'undefined') begin = this.offset;
  27779. if (typeof end === 'undefined') end = this.limit;
  27780. if (!this.noAssert) {
  27781. if (typeof begin !== 'number' || begin % 1 !== 0)
  27782. throw TypeError("Illegal begin: Not an integer");
  27783. begin >>>= 0;
  27784. if (typeof end !== 'number' || end % 1 !== 0)
  27785. throw TypeError("Illegal end: Not an integer");
  27786. end >>>= 0;
  27787. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  27788. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  27789. }
  27790. if (begin === 0 && end === this.buffer.byteLength)
  27791. return this; // Already compacted
  27792. var len = end - begin;
  27793. if (len === 0) {
  27794. this.buffer = EMPTY_BUFFER;
  27795. this.view = null;
  27796. if (this.markedOffset >= 0) this.markedOffset -= begin;
  27797. this.offset = 0;
  27798. this.limit = 0;
  27799. return this;
  27800. }
  27801. var buffer = new ArrayBuffer(len);
  27802. new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(begin, end));
  27803. this.buffer = buffer;
  27804. this.view = new DataView(buffer);
  27805. if (this.markedOffset >= 0) this.markedOffset -= begin;
  27806. this.offset = 0;
  27807. this.limit = len;
  27808. return this;
  27809. };
  27810. /**
  27811. * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
  27812. * {@link ByteBuffer#limit}.
  27813. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
  27814. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  27815. * @returns {!ByteBuffer} Copy
  27816. * @expose
  27817. */
  27818. ByteBufferPrototype.copy = function(begin, end) {
  27819. if (typeof begin === 'undefined') begin = this.offset;
  27820. if (typeof end === 'undefined') end = this.limit;
  27821. if (!this.noAssert) {
  27822. if (typeof begin !== 'number' || begin % 1 !== 0)
  27823. throw TypeError("Illegal begin: Not an integer");
  27824. begin >>>= 0;
  27825. if (typeof end !== 'number' || end % 1 !== 0)
  27826. throw TypeError("Illegal end: Not an integer");
  27827. end >>>= 0;
  27828. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  27829. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  27830. }
  27831. if (begin === end)
  27832. return new ByteBuffer(0, this.littleEndian, this.noAssert);
  27833. var capacity = end - begin,
  27834. bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
  27835. bb.offset = 0;
  27836. bb.limit = capacity;
  27837. if (bb.markedOffset >= 0) bb.markedOffset -= begin;
  27838. this.copyTo(bb, 0, begin, end);
  27839. return bb;
  27840. };
  27841. /**
  27842. * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
  27843. * {@link ByteBuffer#limit}.
  27844. * @param {!ByteBuffer} target Target ByteBuffer
  27845. * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
  27846. * by the number of bytes copied if omitted.
  27847. * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
  27848. * number of bytes copied if omitted.
  27849. * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
  27850. * @returns {!ByteBuffer} this
  27851. * @expose
  27852. */
  27853. ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
  27854. var relative,
  27855. targetRelative;
  27856. if (!this.noAssert) {
  27857. if (!ByteBuffer.isByteBuffer(target))
  27858. throw TypeError("Illegal target: Not a ByteBuffer");
  27859. }
  27860. targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
  27861. sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
  27862. sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
  27863. if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
  27864. throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
  27865. if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
  27866. throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
  27867. var len = sourceLimit - sourceOffset;
  27868. if (len === 0)
  27869. return target; // Nothing to copy
  27870. target.ensureCapacity(targetOffset + len);
  27871. new Uint8Array(target.buffer).set(new Uint8Array(this.buffer).subarray(sourceOffset, sourceLimit), targetOffset);
  27872. if (relative) this.offset += len;
  27873. if (targetRelative) target.offset += len;
  27874. return this;
  27875. };
  27876. /**
  27877. * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
  27878. * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
  27879. * the required capacity will be used instead.
  27880. * @param {number} capacity Required capacity
  27881. * @returns {!ByteBuffer} this
  27882. * @expose
  27883. */
  27884. ByteBufferPrototype.ensureCapacity = function(capacity) {
  27885. var current = this.buffer.byteLength;
  27886. if (current < capacity)
  27887. return this.resize((current *= 2) > capacity ? current : capacity);
  27888. return this;
  27889. };
  27890. /**
  27891. * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
  27892. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
  27893. * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
  27894. * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
  27895. * written if omitted. defaults to {@link ByteBuffer#offset}.
  27896. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  27897. * @returns {!ByteBuffer} this
  27898. * @expose
  27899. * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
  27900. */
  27901. ByteBufferPrototype.fill = function(value, begin, end) {
  27902. var relative = typeof begin === 'undefined';
  27903. if (relative) begin = this.offset;
  27904. if (typeof value === 'string' && value.length > 0)
  27905. value = value.charCodeAt(0);
  27906. if (typeof begin === 'undefined') begin = this.offset;
  27907. if (typeof end === 'undefined') end = this.limit;
  27908. if (!this.noAssert) {
  27909. if (typeof value !== 'number' || value % 1 !== 0)
  27910. throw TypeError("Illegal value: "+value+" (not an integer)");
  27911. value |= 0;
  27912. if (typeof begin !== 'number' || begin % 1 !== 0)
  27913. throw TypeError("Illegal begin: Not an integer");
  27914. begin >>>= 0;
  27915. if (typeof end !== 'number' || end % 1 !== 0)
  27916. throw TypeError("Illegal end: Not an integer");
  27917. end >>>= 0;
  27918. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  27919. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  27920. }
  27921. if (begin >= end)
  27922. return this; // Nothing to fill
  27923. while (begin < end) this.view.setUint8(begin++, value);
  27924. if (relative) this.offset = begin;
  27925. return this;
  27926. };
  27927. /**
  27928. * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
  27929. * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
  27930. * @returns {!ByteBuffer} this
  27931. * @expose
  27932. */
  27933. ByteBufferPrototype.flip = function() {
  27934. this.limit = this.offset;
  27935. this.offset = 0;
  27936. return this;
  27937. };
  27938. /**
  27939. * Marks an offset on this ByteBuffer to be used later.
  27940. * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
  27941. * @returns {!ByteBuffer} this
  27942. * @throws {TypeError} If `offset` is not a valid number
  27943. * @throws {RangeError} If `offset` is out of bounds
  27944. * @see ByteBuffer#reset
  27945. * @expose
  27946. */
  27947. ByteBufferPrototype.mark = function(offset) {
  27948. offset = typeof offset === 'undefined' ? this.offset : offset;
  27949. if (!this.noAssert) {
  27950. if (typeof offset !== 'number' || offset % 1 !== 0)
  27951. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  27952. offset >>>= 0;
  27953. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  27954. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  27955. }
  27956. this.markedOffset = offset;
  27957. return this;
  27958. };
  27959. /**
  27960. * Sets the byte order.
  27961. * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
  27962. * @returns {!ByteBuffer} this
  27963. * @expose
  27964. */
  27965. ByteBufferPrototype.order = function(littleEndian) {
  27966. if (!this.noAssert) {
  27967. if (typeof littleEndian !== 'boolean')
  27968. throw TypeError("Illegal littleEndian: Not a boolean");
  27969. }
  27970. this.littleEndian = !!littleEndian;
  27971. return this;
  27972. };
  27973. /**
  27974. * Switches (to) little endian byte order.
  27975. * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
  27976. * @returns {!ByteBuffer} this
  27977. * @expose
  27978. */
  27979. ByteBufferPrototype.LE = function(littleEndian) {
  27980. this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
  27981. return this;
  27982. };
  27983. /**
  27984. * Switches (to) big endian byte order.
  27985. * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
  27986. * @returns {!ByteBuffer} this
  27987. * @expose
  27988. */
  27989. ByteBufferPrototype.BE = function(bigEndian) {
  27990. this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
  27991. return this;
  27992. };
  27993. /**
  27994. * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
  27995. * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
  27996. * will be resized and its contents moved accordingly.
  27997. * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
  27998. * modified according to the performed read operation.
  27999. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
  28000. * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
  28001. * prepended if omitted.
  28002. * @returns {!ByteBuffer} this
  28003. * @expose
  28004. * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
  28005. * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
  28006. */
  28007. ByteBufferPrototype.prepend = function(source, encoding, offset) {
  28008. if (typeof encoding === 'number' || typeof encoding !== 'string') {
  28009. offset = encoding;
  28010. encoding = undefined;
  28011. }
  28012. var relative = typeof offset === 'undefined';
  28013. if (relative) offset = this.offset;
  28014. if (!this.noAssert) {
  28015. if (typeof offset !== 'number' || offset % 1 !== 0)
  28016. throw TypeError("Illegal offset: "+offset+" (not an integer)");
  28017. offset >>>= 0;
  28018. if (offset < 0 || offset + 0 > this.buffer.byteLength)
  28019. throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
  28020. }
  28021. if (!(source instanceof ByteBuffer))
  28022. source = ByteBuffer.wrap(source, encoding);
  28023. var len = source.limit - source.offset;
  28024. if (len <= 0) return this; // Nothing to prepend
  28025. var diff = len - offset;
  28026. var arrayView;
  28027. if (diff > 0) { // Not enough space before offset, so resize + move
  28028. var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
  28029. arrayView = new Uint8Array(buffer);
  28030. arrayView.set(new Uint8Array(this.buffer).subarray(offset, this.buffer.byteLength), len);
  28031. this.buffer = buffer;
  28032. this.view = new DataView(buffer);
  28033. this.offset += diff;
  28034. if (this.markedOffset >= 0) this.markedOffset += diff;
  28035. this.limit += diff;
  28036. offset += diff;
  28037. } else {
  28038. arrayView = new Uint8Array(this.buffer);
  28039. }
  28040. arrayView.set(new Uint8Array(source.buffer).subarray(source.offset, source.limit), offset - len);
  28041. source.offset = source.limit;
  28042. if (relative)
  28043. this.offset -= len;
  28044. return this;
  28045. };
  28046. /**
  28047. * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
  28048. * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
  28049. * will be resized and its contents moved accordingly.
  28050. * @param {!ByteBuffer} target Target ByteBuffer
  28051. * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
  28052. * prepended if omitted.
  28053. * @returns {!ByteBuffer} this
  28054. * @expose
  28055. * @see ByteBuffer#prepend
  28056. */
  28057. ByteBufferPrototype.prependTo = function(target, offset) {
  28058. target.prepend(this, offset);
  28059. return this;
  28060. };
  28061. /**
  28062. * Prints debug information about this ByteBuffer's contents.
  28063. * @param {function(string)=} out Output function to call, defaults to console.log
  28064. * @expose
  28065. */
  28066. ByteBufferPrototype.printDebug = function(out) {
  28067. if (typeof out !== 'function') out = console.log.bind(console);
  28068. out(
  28069. this.toString()+"\n"+
  28070. "-------------------------------------------------------------------\n"+
  28071. this.toDebug(/* columns */ true)
  28072. );
  28073. };
  28074. /**
  28075. * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
  28076. * {@link ByteBuffer#limit}, so this returns `limit - offset`.
  28077. * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
  28078. * @expose
  28079. */
  28080. ByteBufferPrototype.remaining = function() {
  28081. return this.limit - this.offset;
  28082. };
  28083. /**
  28084. * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
  28085. * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
  28086. * marked, sets `offset = 0`.
  28087. * @returns {!ByteBuffer} this
  28088. * @see ByteBuffer#mark
  28089. * @expose
  28090. */
  28091. ByteBufferPrototype.reset = function() {
  28092. if (this.markedOffset >= 0) {
  28093. this.offset = this.markedOffset;
  28094. this.markedOffset = -1;
  28095. } else {
  28096. this.offset = 0;
  28097. }
  28098. return this;
  28099. };
  28100. /**
  28101. * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
  28102. * large or larger.
  28103. * @param {number} capacity Capacity required
  28104. * @returns {!ByteBuffer} this
  28105. * @throws {TypeError} If `capacity` is not a number
  28106. * @throws {RangeError} If `capacity < 0`
  28107. * @expose
  28108. */
  28109. ByteBufferPrototype.resize = function(capacity) {
  28110. if (!this.noAssert) {
  28111. if (typeof capacity !== 'number' || capacity % 1 !== 0)
  28112. throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
  28113. capacity |= 0;
  28114. if (capacity < 0)
  28115. throw RangeError("Illegal capacity: 0 <= "+capacity);
  28116. }
  28117. if (this.buffer.byteLength < capacity) {
  28118. var buffer = new ArrayBuffer(capacity);
  28119. new Uint8Array(buffer).set(new Uint8Array(this.buffer));
  28120. this.buffer = buffer;
  28121. this.view = new DataView(buffer);
  28122. }
  28123. return this;
  28124. };
  28125. /**
  28126. * Reverses this ByteBuffer's contents.
  28127. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
  28128. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  28129. * @returns {!ByteBuffer} this
  28130. * @expose
  28131. */
  28132. ByteBufferPrototype.reverse = function(begin, end) {
  28133. if (typeof begin === 'undefined') begin = this.offset;
  28134. if (typeof end === 'undefined') end = this.limit;
  28135. if (!this.noAssert) {
  28136. if (typeof begin !== 'number' || begin % 1 !== 0)
  28137. throw TypeError("Illegal begin: Not an integer");
  28138. begin >>>= 0;
  28139. if (typeof end !== 'number' || end % 1 !== 0)
  28140. throw TypeError("Illegal end: Not an integer");
  28141. end >>>= 0;
  28142. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28143. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28144. }
  28145. if (begin === end)
  28146. return this; // Nothing to reverse
  28147. Array.prototype.reverse.call(new Uint8Array(this.buffer).subarray(begin, end));
  28148. this.view = new DataView(this.buffer); // FIXME: Why exactly is this necessary?
  28149. return this;
  28150. };
  28151. /**
  28152. * Skips the next `length` bytes. This will just advance
  28153. * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
  28154. * @returns {!ByteBuffer} this
  28155. * @expose
  28156. */
  28157. ByteBufferPrototype.skip = function(length) {
  28158. if (!this.noAssert) {
  28159. if (typeof length !== 'number' || length % 1 !== 0)
  28160. throw TypeError("Illegal length: "+length+" (not an integer)");
  28161. length |= 0;
  28162. }
  28163. var offset = this.offset + length;
  28164. if (!this.noAssert) {
  28165. if (offset < 0 || offset > this.buffer.byteLength)
  28166. throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
  28167. }
  28168. this.offset = offset;
  28169. return this;
  28170. };
  28171. /**
  28172. * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
  28173. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
  28174. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
  28175. * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
  28176. * @expose
  28177. */
  28178. ByteBufferPrototype.slice = function(begin, end) {
  28179. if (typeof begin === 'undefined') begin = this.offset;
  28180. if (typeof end === 'undefined') end = this.limit;
  28181. if (!this.noAssert) {
  28182. if (typeof begin !== 'number' || begin % 1 !== 0)
  28183. throw TypeError("Illegal begin: Not an integer");
  28184. begin >>>= 0;
  28185. if (typeof end !== 'number' || end % 1 !== 0)
  28186. throw TypeError("Illegal end: Not an integer");
  28187. end >>>= 0;
  28188. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28189. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28190. }
  28191. var bb = this.clone();
  28192. bb.offset = begin;
  28193. bb.limit = end;
  28194. return bb;
  28195. };
  28196. /**
  28197. * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
  28198. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
  28199. * ByteBuffer if `offset > limit` but the actual offsets remain untouched.
  28200. * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
  28201. * possible. Defaults to `false`
  28202. * @returns {!ArrayBuffer} Contents as an ArrayBuffer
  28203. * @expose
  28204. */
  28205. ByteBufferPrototype.toBuffer = function(forceCopy) {
  28206. var offset = this.offset,
  28207. limit = this.limit;
  28208. if (offset > limit) {
  28209. var t = offset;
  28210. offset = limit;
  28211. limit = t;
  28212. }
  28213. if (!this.noAssert) {
  28214. if (typeof offset !== 'number' || offset % 1 !== 0)
  28215. throw TypeError("Illegal offset: Not an integer");
  28216. offset >>>= 0;
  28217. if (typeof limit !== 'number' || limit % 1 !== 0)
  28218. throw TypeError("Illegal limit: Not an integer");
  28219. limit >>>= 0;
  28220. if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
  28221. throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
  28222. }
  28223. // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
  28224. // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
  28225. if (!forceCopy && offset === 0 && limit === this.buffer.byteLength) {
  28226. return this.buffer;
  28227. }
  28228. if (offset === limit) {
  28229. return EMPTY_BUFFER;
  28230. }
  28231. var buffer = new ArrayBuffer(limit - offset);
  28232. new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
  28233. return buffer;
  28234. };
  28235. /**
  28236. * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
  28237. * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will transparently {@link ByteBuffer#flip} this
  28238. * ByteBuffer if `offset > limit` but the actual offsets remain untouched. This is an alias of
  28239. * {@link ByteBuffer#toBuffer}.
  28240. * @function
  28241. * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
  28242. * Defaults to `false`
  28243. * @returns {!ArrayBuffer} Contents as an ArrayBuffer
  28244. * @expose
  28245. */
  28246. ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
  28247. /**
  28248. * Converts the ByteBuffer's contents to a string.
  28249. * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
  28250. * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
  28251. * highlighted offsets.
  28252. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
  28253. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
  28254. * @returns {string} String representation
  28255. * @throws {Error} If `encoding` is invalid
  28256. * @expose
  28257. */
  28258. ByteBufferPrototype.toString = function(encoding, begin, end) {
  28259. if (typeof encoding === 'undefined')
  28260. return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
  28261. if (typeof encoding === 'number')
  28262. encoding = "utf8",
  28263. begin = encoding,
  28264. end = begin;
  28265. switch (encoding) {
  28266. case "utf8":
  28267. return this.toUTF8(begin, end);
  28268. case "base64":
  28269. return this.toBase64(begin, end);
  28270. case "hex":
  28271. return this.toHex(begin, end);
  28272. case "binary":
  28273. return this.toBinary(begin, end);
  28274. case "debug":
  28275. return this.toDebug();
  28276. case "columns":
  28277. return this.toColumns();
  28278. default:
  28279. throw Error("Unsupported encoding: "+encoding);
  28280. }
  28281. };
  28282. // lxiv-embeddable
  28283. /**
  28284. * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
  28285. * Released under the Apache License, Version 2.0
  28286. * see: https://github.com/dcodeIO/lxiv for details
  28287. */
  28288. var lxiv = function() {
  28289. "use strict";
  28290. /**
  28291. * lxiv namespace.
  28292. * @type {!Object.<string,*>}
  28293. * @exports lxiv
  28294. */
  28295. var lxiv = {};
  28296. /**
  28297. * Character codes for output.
  28298. * @type {!Array.<number>}
  28299. * @inner
  28300. */
  28301. var aout = [
  28302. 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  28303. 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
  28304. 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
  28305. 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
  28306. ];
  28307. /**
  28308. * Character codes for input.
  28309. * @type {!Array.<number>}
  28310. * @inner
  28311. */
  28312. var ain = [];
  28313. for (var i=0, k=aout.length; i<k; ++i)
  28314. ain[aout[i]] = i;
  28315. /**
  28316. * Encodes bytes to base64 char codes.
  28317. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
  28318. * there are no more bytes left.
  28319. * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
  28320. * code.
  28321. */
  28322. lxiv.encode = function(src, dst) {
  28323. var b, t;
  28324. while ((b = src()) !== null) {
  28325. dst(aout[(b>>2)&0x3f]);
  28326. t = (b&0x3)<<4;
  28327. if ((b = src()) !== null) {
  28328. t |= (b>>4)&0xf;
  28329. dst(aout[(t|((b>>4)&0xf))&0x3f]);
  28330. t = (b&0xf)<<2;
  28331. if ((b = src()) !== null)
  28332. dst(aout[(t|((b>>6)&0x3))&0x3f]),
  28333. dst(aout[b&0x3f]);
  28334. else
  28335. dst(aout[t&0x3f]),
  28336. dst(61);
  28337. } else
  28338. dst(aout[t&0x3f]),
  28339. dst(61),
  28340. dst(61);
  28341. }
  28342. };
  28343. /**
  28344. * Decodes base64 char codes to bytes.
  28345. * @param {!function():number|null} src Characters source as a function returning the next char code respectively
  28346. * `null` if there are no more characters left.
  28347. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
  28348. * @throws {Error} If a character code is invalid
  28349. */
  28350. lxiv.decode = function(src, dst) {
  28351. var c, t1, t2;
  28352. function fail(c) {
  28353. throw Error("Illegal character code: "+c);
  28354. }
  28355. while ((c = src()) !== null) {
  28356. t1 = ain[c];
  28357. if (typeof t1 === 'undefined') fail(c);
  28358. if ((c = src()) !== null) {
  28359. t2 = ain[c];
  28360. if (typeof t2 === 'undefined') fail(c);
  28361. dst((t1<<2)>>>0|(t2&0x30)>>4);
  28362. if ((c = src()) !== null) {
  28363. t1 = ain[c];
  28364. if (typeof t1 === 'undefined')
  28365. if (c === 61) break; else fail(c);
  28366. dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
  28367. if ((c = src()) !== null) {
  28368. t2 = ain[c];
  28369. if (typeof t2 === 'undefined')
  28370. if (c === 61) break; else fail(c);
  28371. dst(((t1&0x3)<<6)>>>0|t2);
  28372. }
  28373. }
  28374. }
  28375. }
  28376. };
  28377. /**
  28378. * Tests if a string is valid base64.
  28379. * @param {string} str String to test
  28380. * @returns {boolean} `true` if valid, otherwise `false`
  28381. */
  28382. lxiv.test = function(str) {
  28383. return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
  28384. };
  28385. return lxiv;
  28386. }();
  28387. // encodings/base64
  28388. /**
  28389. * Encodes this ByteBuffer's contents to a base64 encoded string.
  28390. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
  28391. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
  28392. * @returns {string} Base64 encoded string
  28393. * @expose
  28394. */
  28395. ByteBufferPrototype.toBase64 = function(begin, end) {
  28396. if (typeof begin === 'undefined')
  28397. begin = this.offset;
  28398. if (typeof end === 'undefined')
  28399. end = this.limit;
  28400. if (!this.noAssert) {
  28401. if (typeof begin !== 'number' || begin % 1 !== 0)
  28402. throw TypeError("Illegal begin: Not an integer");
  28403. begin >>>= 0;
  28404. if (typeof end !== 'number' || end % 1 !== 0)
  28405. throw TypeError("Illegal end: Not an integer");
  28406. end >>>= 0;
  28407. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28408. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28409. }
  28410. var sd; lxiv.encode(function() {
  28411. return begin < end ? this.view.getUint8(begin++) : null;
  28412. }.bind(this), sd = stringDestination());
  28413. return sd();
  28414. };
  28415. /**
  28416. * Decodes a base64 encoded string to a ByteBuffer.
  28417. * @param {string} str String to decode
  28418. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  28419. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  28420. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  28421. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  28422. * @returns {!ByteBuffer} ByteBuffer
  28423. * @expose
  28424. */
  28425. ByteBuffer.fromBase64 = function(str, littleEndian, noAssert) {
  28426. if (!noAssert) {
  28427. if (typeof str !== 'string')
  28428. throw TypeError("Illegal str: Not a string");
  28429. if (str.length % 4 !== 0)
  28430. throw TypeError("Illegal str: Length not a multiple of 4");
  28431. }
  28432. var bb = new ByteBuffer(str.length/4*3, littleEndian, noAssert),
  28433. i = 0;
  28434. lxiv.decode(stringSource(str), function(b) {
  28435. bb.view.setUint8(i++, b);
  28436. });
  28437. bb.limit = i;
  28438. return bb;
  28439. };
  28440. /**
  28441. * Encodes a binary string to base64 like `window.btoa` does.
  28442. * @param {string} str Binary string
  28443. * @returns {string} Base64 encoded string
  28444. * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
  28445. * @expose
  28446. */
  28447. ByteBuffer.btoa = function(str) {
  28448. return ByteBuffer.fromBinary(str).toBase64();
  28449. };
  28450. /**
  28451. * Decodes a base64 encoded string to binary like `window.atob` does.
  28452. * @param {string} b64 Base64 encoded string
  28453. * @returns {string} Binary string
  28454. * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
  28455. * @expose
  28456. */
  28457. ByteBuffer.atob = function(b64) {
  28458. return ByteBuffer.fromBase64(b64).toBinary();
  28459. };
  28460. // encodings/binary
  28461. /**
  28462. * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
  28463. * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
  28464. * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
  28465. * @returns {string} Binary encoded string
  28466. * @throws {RangeError} If `offset > limit`
  28467. * @expose
  28468. */
  28469. ByteBufferPrototype.toBinary = function(begin, end) {
  28470. begin = typeof begin === 'undefined' ? this.offset : begin;
  28471. end = typeof end === 'undefined' ? this.limit : end;
  28472. if (!this.noAssert) {
  28473. if (typeof begin !== 'number' || begin % 1 !== 0)
  28474. throw TypeError("Illegal begin: Not an integer");
  28475. begin >>>= 0;
  28476. if (typeof end !== 'number' || end % 1 !== 0)
  28477. throw TypeError("Illegal end: Not an integer");
  28478. end >>>= 0;
  28479. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28480. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28481. }
  28482. if (begin === end)
  28483. return "";
  28484. var cc = [], pt = [];
  28485. while (begin < end) {
  28486. cc.push(this.view.getUint8(begin++));
  28487. if (cc.length >= 1024)
  28488. pt.push(String.fromCharCode.apply(String, cc)),
  28489. cc = [];
  28490. }
  28491. return pt.join('') + String.fromCharCode.apply(String, cc);
  28492. };
  28493. /**
  28494. * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
  28495. * @param {string} str String to decode
  28496. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  28497. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  28498. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  28499. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  28500. * @returns {!ByteBuffer} ByteBuffer
  28501. * @expose
  28502. */
  28503. ByteBuffer.fromBinary = function(str, littleEndian, noAssert) {
  28504. if (!noAssert) {
  28505. if (typeof str !== 'string')
  28506. throw TypeError("Illegal str: Not a string");
  28507. }
  28508. var i = 0, k = str.length, charCode,
  28509. bb = new ByteBuffer(k, littleEndian, noAssert);
  28510. while (i<k) {
  28511. charCode = str.charCodeAt(i);
  28512. if (!noAssert && charCode > 255)
  28513. throw RangeError("Illegal charCode at "+i+": 0 <= "+charCode+" <= 255");
  28514. bb.view.setUint8(i++, charCode);
  28515. }
  28516. bb.limit = k;
  28517. return bb;
  28518. };
  28519. // encodings/debug
  28520. /**
  28521. * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
  28522. * * `<` : offset,
  28523. * * `'` : markedOffset,
  28524. * * `>` : limit,
  28525. * * `|` : offset and limit,
  28526. * * `[` : offset and markedOffset,
  28527. * * `]` : markedOffset and limit,
  28528. * * `!` : offset, markedOffset and limit
  28529. * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
  28530. * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
  28531. * @expose
  28532. * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
  28533. * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
  28534. * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
  28535. * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
  28536. */
  28537. ByteBufferPrototype.toDebug = function(columns) {
  28538. var i = -1,
  28539. k = this.buffer.byteLength,
  28540. b,
  28541. hex = "",
  28542. asc = "",
  28543. out = "";
  28544. while (i<k) {
  28545. if (i !== -1) {
  28546. b = this.view.getUint8(i);
  28547. if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
  28548. else hex += b.toString(16).toUpperCase();
  28549. if (columns) {
  28550. asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
  28551. }
  28552. }
  28553. ++i;
  28554. if (columns) {
  28555. if (i > 0 && i % 16 === 0 && i !== k) {
  28556. while (hex.length < 3*16+3) hex += " ";
  28557. out += hex+asc+"\n";
  28558. hex = asc = "";
  28559. }
  28560. }
  28561. if (i === this.offset && i === this.limit)
  28562. hex += i === this.markedOffset ? "!" : "|";
  28563. else if (i === this.offset)
  28564. hex += i === this.markedOffset ? "[" : "<";
  28565. else if (i === this.limit)
  28566. hex += i === this.markedOffset ? "]" : ">";
  28567. else
  28568. hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
  28569. }
  28570. if (columns && hex !== " ") {
  28571. while (hex.length < 3*16+3) hex += " ";
  28572. out += hex+asc+"\n";
  28573. }
  28574. return columns ? out : hex;
  28575. };
  28576. /**
  28577. * Decodes a hex encoded string with marked offsets to a ByteBuffer.
  28578. * @param {string} str Debug string to decode (not be generated with `columns = true`)
  28579. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  28580. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  28581. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  28582. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  28583. * @returns {!ByteBuffer} ByteBuffer
  28584. * @expose
  28585. * @see ByteBuffer#toDebug
  28586. */
  28587. ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
  28588. var k = str.length,
  28589. bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
  28590. var i = 0, j = 0, ch, b,
  28591. rs = false, // Require symbol next
  28592. ho = false, hm = false, hl = false, // Already has offset, markedOffset, limit?
  28593. fail = false;
  28594. while (i<k) {
  28595. switch (ch = str.charAt(i++)) {
  28596. case '!':
  28597. if (!noAssert) {
  28598. if (ho || hm || hl) {
  28599. fail = true; break;
  28600. }
  28601. ho = hm = hl = true;
  28602. }
  28603. bb.offset = bb.markedOffset = bb.limit = j;
  28604. rs = false;
  28605. break;
  28606. case '|':
  28607. if (!noAssert) {
  28608. if (ho || hl) {
  28609. fail = true; break;
  28610. }
  28611. ho = hl = true;
  28612. }
  28613. bb.offset = bb.limit = j;
  28614. rs = false;
  28615. break;
  28616. case '[':
  28617. if (!noAssert) {
  28618. if (ho || hm) {
  28619. fail = true; break;
  28620. }
  28621. ho = hm = true;
  28622. }
  28623. bb.offset = bb.markedOffset = j;
  28624. rs = false;
  28625. break;
  28626. case '<':
  28627. if (!noAssert) {
  28628. if (ho) {
  28629. fail = true; break;
  28630. }
  28631. ho = true;
  28632. }
  28633. bb.offset = j;
  28634. rs = false;
  28635. break;
  28636. case ']':
  28637. if (!noAssert) {
  28638. if (hl || hm) {
  28639. fail = true; break;
  28640. }
  28641. hl = hm = true;
  28642. }
  28643. bb.limit = bb.markedOffset = j;
  28644. rs = false;
  28645. break;
  28646. case '>':
  28647. if (!noAssert) {
  28648. if (hl) {
  28649. fail = true; break;
  28650. }
  28651. hl = true;
  28652. }
  28653. bb.limit = j;
  28654. rs = false;
  28655. break;
  28656. case "'":
  28657. if (!noAssert) {
  28658. if (hm) {
  28659. fail = true; break;
  28660. }
  28661. hm = true;
  28662. }
  28663. bb.markedOffset = j;
  28664. rs = false;
  28665. break;
  28666. case ' ':
  28667. rs = false;
  28668. break;
  28669. default:
  28670. if (!noAssert) {
  28671. if (rs) {
  28672. fail = true; break;
  28673. }
  28674. }
  28675. b = parseInt(ch+str.charAt(i++), 16);
  28676. if (!noAssert) {
  28677. if (isNaN(b) || b < 0 || b > 255)
  28678. throw TypeError("Illegal str: Not a debug encoded string");
  28679. }
  28680. bb.view.setUint8(j++, b);
  28681. rs = true;
  28682. }
  28683. if (fail)
  28684. throw TypeError("Illegal str: Invalid symbol at "+i);
  28685. }
  28686. if (!noAssert) {
  28687. if (!ho || !hl)
  28688. throw TypeError("Illegal str: Missing offset or limit");
  28689. if (j<bb.buffer.byteLength)
  28690. throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
  28691. }
  28692. return bb;
  28693. };
  28694. // encodings/hex
  28695. /**
  28696. * Encodes this ByteBuffer's contents to a hex encoded string.
  28697. * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
  28698. * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
  28699. * @returns {string} Hex encoded string
  28700. * @expose
  28701. */
  28702. ByteBufferPrototype.toHex = function(begin, end) {
  28703. begin = typeof begin === 'undefined' ? this.offset : begin;
  28704. end = typeof end === 'undefined' ? this.limit : end;
  28705. if (!this.noAssert) {
  28706. if (typeof begin !== 'number' || begin % 1 !== 0)
  28707. throw TypeError("Illegal begin: Not an integer");
  28708. begin >>>= 0;
  28709. if (typeof end !== 'number' || end % 1 !== 0)
  28710. throw TypeError("Illegal end: Not an integer");
  28711. end >>>= 0;
  28712. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28713. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28714. }
  28715. var out = new Array(end - begin),
  28716. b;
  28717. while (begin < end) {
  28718. b = this.view.getUint8(begin++);
  28719. if (b < 0x10)
  28720. out.push("0", b.toString(16));
  28721. else out.push(b.toString(16));
  28722. }
  28723. return out.join('');
  28724. };
  28725. /**
  28726. * Decodes a hex encoded string to a ByteBuffer.
  28727. * @param {string} str String to decode
  28728. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  28729. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  28730. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  28731. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  28732. * @returns {!ByteBuffer} ByteBuffer
  28733. * @expose
  28734. */
  28735. ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
  28736. if (!noAssert) {
  28737. if (typeof str !== 'string')
  28738. throw TypeError("Illegal str: Not a string");
  28739. if (str.length % 2 !== 0)
  28740. throw TypeError("Illegal str: Length not a multiple of 2");
  28741. }
  28742. var k = str.length,
  28743. bb = new ByteBuffer((k / 2) | 0, littleEndian),
  28744. b;
  28745. for (var i=0, j=0; i<k; i+=2) {
  28746. b = parseInt(str.substring(i, i+2), 16);
  28747. if (!noAssert)
  28748. if (!isFinite(b) || b < 0 || b > 255)
  28749. throw TypeError("Illegal str: Contains non-hex characters");
  28750. bb.view.setUint8(j++, b);
  28751. }
  28752. bb.limit = j;
  28753. return bb;
  28754. };
  28755. // utfx-embeddable
  28756. /**
  28757. * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
  28758. * Released under the Apache License, Version 2.0
  28759. * see: https://github.com/dcodeIO/utfx for details
  28760. */
  28761. var utfx = function() {
  28762. "use strict";
  28763. /**
  28764. * utfx namespace.
  28765. * @inner
  28766. * @type {!Object.<string,*>}
  28767. */
  28768. var utfx = {};
  28769. /**
  28770. * Maximum valid code point.
  28771. * @type {number}
  28772. * @const
  28773. */
  28774. utfx.MAX_CODEPOINT = 0x10FFFF;
  28775. /**
  28776. * Encodes UTF8 code points to UTF8 bytes.
  28777. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
  28778. * respectively `null` if there are no more code points left or a single numeric code point.
  28779. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
  28780. */
  28781. utfx.encodeUTF8 = function(src, dst) {
  28782. var cp = null;
  28783. if (typeof src === 'number')
  28784. cp = src,
  28785. src = function() { return null; };
  28786. while (cp !== null || (cp = src()) !== null) {
  28787. if (cp < 0x80)
  28788. dst(cp&0x7F);
  28789. else if (cp < 0x800)
  28790. dst(((cp>>6)&0x1F)|0xC0),
  28791. dst((cp&0x3F)|0x80);
  28792. else if (cp < 0x10000)
  28793. dst(((cp>>12)&0x0F)|0xE0),
  28794. dst(((cp>>6)&0x3F)|0x80),
  28795. dst((cp&0x3F)|0x80);
  28796. else
  28797. dst(((cp>>18)&0x07)|0xF0),
  28798. dst(((cp>>12)&0x3F)|0x80),
  28799. dst(((cp>>6)&0x3F)|0x80),
  28800. dst((cp&0x3F)|0x80);
  28801. cp = null;
  28802. }
  28803. };
  28804. /**
  28805. * Decodes UTF8 bytes to UTF8 code points.
  28806. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
  28807. * are no more bytes left.
  28808. * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
  28809. * @throws {RangeError} If a starting byte is invalid in UTF8
  28810. * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
  28811. * remaining bytes.
  28812. */
  28813. utfx.decodeUTF8 = function(src, dst) {
  28814. var a, b, c, d, fail = function(b) {
  28815. b = b.slice(0, b.indexOf(null));
  28816. var err = Error(b.toString());
  28817. err.name = "TruncatedError";
  28818. err['bytes'] = b;
  28819. throw err;
  28820. };
  28821. while ((a = src()) !== null) {
  28822. if ((a&0x80) === 0)
  28823. dst(a);
  28824. else if ((a&0xE0) === 0xC0)
  28825. ((b = src()) === null) && fail([a, b]),
  28826. dst(((a&0x1F)<<6) | (b&0x3F));
  28827. else if ((a&0xF0) === 0xE0)
  28828. ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
  28829. dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
  28830. else if ((a&0xF8) === 0xF0)
  28831. ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
  28832. dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
  28833. else throw RangeError("Illegal starting byte: "+a);
  28834. }
  28835. };
  28836. /**
  28837. * Converts UTF16 characters to UTF8 code points.
  28838. * @param {!function():number|null} src Characters source as a function returning the next char code respectively
  28839. * `null` if there are no more characters left.
  28840. * @param {!function(number)} dst Code points destination as a function successively called with each converted code
  28841. * point.
  28842. */
  28843. utfx.UTF16toUTF8 = function(src, dst) {
  28844. var c1, c2 = null;
  28845. while (true) {
  28846. if ((c1 = c2 !== null ? c2 : src()) === null)
  28847. break;
  28848. if (c1 >= 0xD800 && c1 <= 0xDFFF) {
  28849. if ((c2 = src()) !== null) {
  28850. if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
  28851. dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
  28852. c2 = null; continue;
  28853. }
  28854. }
  28855. }
  28856. dst(c1);
  28857. }
  28858. if (c2 !== null) dst(c2);
  28859. };
  28860. /**
  28861. * Converts UTF8 code points to UTF16 characters.
  28862. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
  28863. * respectively `null` if there are no more code points left or a single numeric code point.
  28864. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
  28865. * @throws {RangeError} If a code point is out of range
  28866. */
  28867. utfx.UTF8toUTF16 = function(src, dst) {
  28868. var cp = null;
  28869. if (typeof src === 'number')
  28870. cp = src, src = function() { return null; };
  28871. while (cp !== null || (cp = src()) !== null) {
  28872. if (cp <= 0xFFFF)
  28873. dst(cp);
  28874. else
  28875. cp -= 0x10000,
  28876. dst((cp>>10)+0xD800),
  28877. dst((cp%0x400)+0xDC00);
  28878. cp = null;
  28879. }
  28880. };
  28881. /**
  28882. * Converts and encodes UTF16 characters to UTF8 bytes.
  28883. * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
  28884. * if there are no more characters left.
  28885. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
  28886. */
  28887. utfx.encodeUTF16toUTF8 = function(src, dst) {
  28888. utfx.UTF16toUTF8(src, function(cp) {
  28889. utfx.encodeUTF8(cp, dst);
  28890. });
  28891. };
  28892. /**
  28893. * Decodes and converts UTF8 bytes to UTF16 characters.
  28894. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
  28895. * are no more bytes left.
  28896. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
  28897. * @throws {RangeError} If a starting byte is invalid in UTF8
  28898. * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
  28899. */
  28900. utfx.decodeUTF8toUTF16 = function(src, dst) {
  28901. utfx.decodeUTF8(src, function(cp) {
  28902. utfx.UTF8toUTF16(cp, dst);
  28903. });
  28904. };
  28905. /**
  28906. * Calculates the byte length of an UTF8 code point.
  28907. * @param {number} cp UTF8 code point
  28908. * @returns {number} Byte length
  28909. */
  28910. utfx.calculateCodePoint = function(cp) {
  28911. return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
  28912. };
  28913. /**
  28914. * Calculates the number of UTF8 bytes required to store UTF8 code points.
  28915. * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
  28916. * `null` if there are no more code points left.
  28917. * @returns {number} The number of UTF8 bytes required
  28918. */
  28919. utfx.calculateUTF8 = function(src) {
  28920. var cp, l=0;
  28921. while ((cp = src()) !== null)
  28922. l += utfx.calculateCodePoint(cp);
  28923. return l;
  28924. };
  28925. /**
  28926. * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
  28927. * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
  28928. * `null` if there are no more characters left.
  28929. * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
  28930. */
  28931. utfx.calculateUTF16asUTF8 = function(src) {
  28932. var n=0, l=0;
  28933. utfx.UTF16toUTF8(src, function(cp) {
  28934. ++n; l += utfx.calculateCodePoint(cp);
  28935. });
  28936. return [n,l];
  28937. };
  28938. return utfx;
  28939. }();
  28940. // encodings/utf8
  28941. /**
  28942. * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
  28943. * string.
  28944. * @returns {string} Hex encoded string
  28945. * @throws {RangeError} If `offset > limit`
  28946. * @expose
  28947. */
  28948. ByteBufferPrototype.toUTF8 = function(begin, end) {
  28949. if (typeof begin === 'undefined') begin = this.offset;
  28950. if (typeof end === 'undefined') end = this.limit;
  28951. if (!this.noAssert) {
  28952. if (typeof begin !== 'number' || begin % 1 !== 0)
  28953. throw TypeError("Illegal begin: Not an integer");
  28954. begin >>>= 0;
  28955. if (typeof end !== 'number' || end % 1 !== 0)
  28956. throw TypeError("Illegal end: Not an integer");
  28957. end >>>= 0;
  28958. if (begin < 0 || begin > end || end > this.buffer.byteLength)
  28959. throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
  28960. }
  28961. var sd; try {
  28962. utfx.decodeUTF8toUTF16(function() {
  28963. return begin < end ? this.view.getUint8(begin++) : null;
  28964. }.bind(this), sd = stringDestination());
  28965. } catch (e) {
  28966. if (begin !== end)
  28967. throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
  28968. }
  28969. return sd();
  28970. };
  28971. /**
  28972. * Decodes an UTF8 encoded string to a ByteBuffer.
  28973. * @param {string} str String to decode
  28974. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
  28975. * {@link ByteBuffer.DEFAULT_ENDIAN}.
  28976. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
  28977. * {@link ByteBuffer.DEFAULT_NOASSERT}.
  28978. * @returns {!ByteBuffer} ByteBuffer
  28979. * @expose
  28980. */
  28981. ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
  28982. if (!noAssert)
  28983. if (typeof str !== 'string')
  28984. throw TypeError("Illegal str: Not a string");
  28985. var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
  28986. i = 0;
  28987. utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
  28988. bb.view.setUint8(i++, b);
  28989. });
  28990. bb.limit = i;
  28991. return bb;
  28992. };
  28993. return ByteBuffer;
  28994. }
  28995. /* CommonJS */ if (typeof require === 'function' && typeof module === 'object' && module && typeof exports === 'object' && exports)
  28996. module['exports'] = (function() {
  28997. var Long; try { Long = require("long"); } catch (e) {}
  28998. return loadByteBuffer(Long);
  28999. })();
  29000. /* AMD */ else if (typeof define === 'function' && define["amd"])
  29001. define("ByteBuffer", ["Long"], function(Long) { return loadByteBuffer(Long); });
  29002. /* Global */ else
  29003. (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = loadByteBuffer(global["dcodeIO"]["Long"]);
  29004. })(this);
  29005. /*
  29006. Copyright 2013 Daniel Wirtz <dcode@dcode.io>
  29007. Licensed under the Apache License, Version 2.0 (the "License");
  29008. you may not use this file except in compliance with the License.
  29009. You may obtain a copy of the License at
  29010. http://www.apache.org/licenses/LICENSE-2.0
  29011. Unless required by applicable law or agreed to in writing, software
  29012. distributed under the License is distributed on an "AS IS" BASIS,
  29013. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  29014. See the License for the specific language governing permissions and
  29015. limitations under the License.
  29016. */
  29017. /**
  29018. * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
  29019. * Released under the Apache License, Version 2.0
  29020. * see: https://github.com/dcodeIO/protobuf.js for details
  29021. */
  29022. (function(global, factory) {
  29023. /* AMD */ if (typeof define === 'function' && define["amd"])
  29024. define(["bytebuffer"], factory);
  29025. /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
  29026. module["exports"] = factory(require("bytebuffer"), true);
  29027. /* Global */ else
  29028. (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
  29029. })(this, function(ByteBuffer, isCommonJS) {
  29030. "use strict";
  29031. /**
  29032. * The ProtoBuf namespace.
  29033. * @exports ProtoBuf
  29034. * @namespace
  29035. * @expose
  29036. */
  29037. var ProtoBuf = {};
  29038. /**
  29039. * @type {!function(new: ByteBuffer, ...[*])}
  29040. * @expose
  29041. */
  29042. ProtoBuf.ByteBuffer = ByteBuffer;
  29043. /**
  29044. * @type {?function(new: Long, ...[*])}
  29045. * @expose
  29046. */
  29047. ProtoBuf.Long = ByteBuffer.Long || null;
  29048. /**
  29049. * ProtoBuf.js version.
  29050. * @type {string}
  29051. * @const
  29052. * @expose
  29053. */
  29054. ProtoBuf.VERSION = "5.0.1";
  29055. /**
  29056. * Wire types.
  29057. * @type {Object.<string,number>}
  29058. * @const
  29059. * @expose
  29060. */
  29061. ProtoBuf.WIRE_TYPES = {};
  29062. /**
  29063. * Varint wire type.
  29064. * @type {number}
  29065. * @expose
  29066. */
  29067. ProtoBuf.WIRE_TYPES.VARINT = 0;
  29068. /**
  29069. * Fixed 64 bits wire type.
  29070. * @type {number}
  29071. * @const
  29072. * @expose
  29073. */
  29074. ProtoBuf.WIRE_TYPES.BITS64 = 1;
  29075. /**
  29076. * Length delimited wire type.
  29077. * @type {number}
  29078. * @const
  29079. * @expose
  29080. */
  29081. ProtoBuf.WIRE_TYPES.LDELIM = 2;
  29082. /**
  29083. * Start group wire type.
  29084. * @type {number}
  29085. * @const
  29086. * @expose
  29087. */
  29088. ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
  29089. /**
  29090. * End group wire type.
  29091. * @type {number}
  29092. * @const
  29093. * @expose
  29094. */
  29095. ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
  29096. /**
  29097. * Fixed 32 bits wire type.
  29098. * @type {number}
  29099. * @const
  29100. * @expose
  29101. */
  29102. ProtoBuf.WIRE_TYPES.BITS32 = 5;
  29103. /**
  29104. * Packable wire types.
  29105. * @type {!Array.<number>}
  29106. * @const
  29107. * @expose
  29108. */
  29109. ProtoBuf.PACKABLE_WIRE_TYPES = [
  29110. ProtoBuf.WIRE_TYPES.VARINT,
  29111. ProtoBuf.WIRE_TYPES.BITS64,
  29112. ProtoBuf.WIRE_TYPES.BITS32
  29113. ];
  29114. /**
  29115. * Types.
  29116. * @dict
  29117. * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
  29118. * @const
  29119. * @expose
  29120. */
  29121. ProtoBuf.TYPES = {
  29122. // According to the protobuf spec.
  29123. "int32": {
  29124. name: "int32",
  29125. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29126. defaultValue: 0
  29127. },
  29128. "uint32": {
  29129. name: "uint32",
  29130. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29131. defaultValue: 0
  29132. },
  29133. "sint32": {
  29134. name: "sint32",
  29135. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29136. defaultValue: 0
  29137. },
  29138. "int64": {
  29139. name: "int64",
  29140. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29141. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  29142. },
  29143. "uint64": {
  29144. name: "uint64",
  29145. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29146. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
  29147. },
  29148. "sint64": {
  29149. name: "sint64",
  29150. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29151. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  29152. },
  29153. "bool": {
  29154. name: "bool",
  29155. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29156. defaultValue: false
  29157. },
  29158. "double": {
  29159. name: "double",
  29160. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  29161. defaultValue: 0
  29162. },
  29163. "string": {
  29164. name: "string",
  29165. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  29166. defaultValue: ""
  29167. },
  29168. "bytes": {
  29169. name: "bytes",
  29170. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  29171. defaultValue: null // overridden in the code, must be a unique instance
  29172. },
  29173. "fixed32": {
  29174. name: "fixed32",
  29175. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  29176. defaultValue: 0
  29177. },
  29178. "sfixed32": {
  29179. name: "sfixed32",
  29180. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  29181. defaultValue: 0
  29182. },
  29183. "fixed64": {
  29184. name: "fixed64",
  29185. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  29186. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
  29187. },
  29188. "sfixed64": {
  29189. name: "sfixed64",
  29190. wireType: ProtoBuf.WIRE_TYPES.BITS64,
  29191. defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
  29192. },
  29193. "float": {
  29194. name: "float",
  29195. wireType: ProtoBuf.WIRE_TYPES.BITS32,
  29196. defaultValue: 0
  29197. },
  29198. "enum": {
  29199. name: "enum",
  29200. wireType: ProtoBuf.WIRE_TYPES.VARINT,
  29201. defaultValue: 0
  29202. },
  29203. "message": {
  29204. name: "message",
  29205. wireType: ProtoBuf.WIRE_TYPES.LDELIM,
  29206. defaultValue: null
  29207. },
  29208. "group": {
  29209. name: "group",
  29210. wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
  29211. defaultValue: null
  29212. }
  29213. };
  29214. /**
  29215. * Valid map key types.
  29216. * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
  29217. * @const
  29218. * @expose
  29219. */
  29220. ProtoBuf.MAP_KEY_TYPES = [
  29221. ProtoBuf.TYPES["int32"],
  29222. ProtoBuf.TYPES["sint32"],
  29223. ProtoBuf.TYPES["sfixed32"],
  29224. ProtoBuf.TYPES["uint32"],
  29225. ProtoBuf.TYPES["fixed32"],
  29226. ProtoBuf.TYPES["int64"],
  29227. ProtoBuf.TYPES["sint64"],
  29228. ProtoBuf.TYPES["sfixed64"],
  29229. ProtoBuf.TYPES["uint64"],
  29230. ProtoBuf.TYPES["fixed64"],
  29231. ProtoBuf.TYPES["bool"],
  29232. ProtoBuf.TYPES["string"],
  29233. ProtoBuf.TYPES["bytes"]
  29234. ];
  29235. /**
  29236. * Minimum field id.
  29237. * @type {number}
  29238. * @const
  29239. * @expose
  29240. */
  29241. ProtoBuf.ID_MIN = 1;
  29242. /**
  29243. * Maximum field id.
  29244. * @type {number}
  29245. * @const
  29246. * @expose
  29247. */
  29248. ProtoBuf.ID_MAX = 0x1FFFFFFF;
  29249. /**
  29250. * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
  29251. * Must be set prior to parsing.
  29252. * @type {boolean}
  29253. * @expose
  29254. */
  29255. ProtoBuf.convertFieldsToCamelCase = false;
  29256. /**
  29257. * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
  29258. * setting this to `false` prior to building messages.
  29259. * @type {boolean}
  29260. * @expose
  29261. */
  29262. ProtoBuf.populateAccessors = true;
  29263. /**
  29264. * By default, messages are populated with default values if a field is not present on the wire. To disable
  29265. * this behavior, set this setting to `false`.
  29266. * @type {boolean}
  29267. * @expose
  29268. */
  29269. ProtoBuf.populateDefaults = true;
  29270. /**
  29271. * @alias ProtoBuf.Util
  29272. * @expose
  29273. */
  29274. ProtoBuf.Util = (function() {
  29275. "use strict";
  29276. /**
  29277. * ProtoBuf utilities.
  29278. * @exports ProtoBuf.Util
  29279. * @namespace
  29280. */
  29281. var Util = {};
  29282. /**
  29283. * Flag if running in node or not.
  29284. * @type {boolean}
  29285. * @const
  29286. * @expose
  29287. */
  29288. Util.IS_NODE = !!(
  29289. typeof process === 'object' && process+'' === '[object process]' && !process['browser']
  29290. );
  29291. /**
  29292. * Constructs a XMLHttpRequest object.
  29293. * @return {XMLHttpRequest}
  29294. * @throws {Error} If XMLHttpRequest is not supported
  29295. * @expose
  29296. */
  29297. Util.XHR = function() {
  29298. // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
  29299. var XMLHttpFactories = [
  29300. function () {return new XMLHttpRequest()},
  29301. function () {return new ActiveXObject("Msxml2.XMLHTTP")},
  29302. function () {return new ActiveXObject("Msxml3.XMLHTTP")},
  29303. function () {return new ActiveXObject("Microsoft.XMLHTTP")}
  29304. ];
  29305. /** @type {?XMLHttpRequest} */
  29306. var xhr = null;
  29307. for (var i=0;i<XMLHttpFactories.length;i++) {
  29308. try { xhr = XMLHttpFactories[i](); }
  29309. catch (e) { continue; }
  29310. break;
  29311. }
  29312. if (!xhr)
  29313. throw Error("XMLHttpRequest is not supported");
  29314. return xhr;
  29315. };
  29316. /**
  29317. * Fetches a resource.
  29318. * @param {string} path Resource path
  29319. * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
  29320. * be fetched synchronously. If the request failed, contents will be null.
  29321. * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
  29322. * @expose
  29323. */
  29324. Util.fetch = function(path, callback) {
  29325. if (callback && typeof callback != 'function')
  29326. callback = null;
  29327. if (Util.IS_NODE) {
  29328. var fs = require("fs");
  29329. if (callback) {
  29330. fs.readFile(path, function(err, data) {
  29331. if (err)
  29332. callback(null);
  29333. else
  29334. callback(""+data);
  29335. });
  29336. } else
  29337. try {
  29338. return fs.readFileSync(path);
  29339. } catch (e) {
  29340. return null;
  29341. }
  29342. } else {
  29343. var xhr = Util.XHR();
  29344. xhr.open('GET', path, callback ? true : false);
  29345. // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
  29346. xhr.setRequestHeader('Accept', 'text/plain');
  29347. if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
  29348. if (callback) {
  29349. xhr.onreadystatechange = function() {
  29350. if (xhr.readyState != 4) return;
  29351. if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
  29352. callback(xhr.responseText);
  29353. else
  29354. callback(null);
  29355. };
  29356. if (xhr.readyState == 4)
  29357. return;
  29358. xhr.send(null);
  29359. } else {
  29360. xhr.send(null);
  29361. if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
  29362. return xhr.responseText;
  29363. return null;
  29364. }
  29365. }
  29366. };
  29367. /**
  29368. * Converts a string to camel case.
  29369. * @param {string} str
  29370. * @returns {string}
  29371. * @expose
  29372. */
  29373. Util.toCamelCase = function(str) {
  29374. return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
  29375. return $1.toUpperCase();
  29376. });
  29377. };
  29378. return Util;
  29379. })();
  29380. /**
  29381. * Language expressions.
  29382. * @type {!Object.<string,!RegExp>}
  29383. * @expose
  29384. */
  29385. ProtoBuf.Lang = {
  29386. // Characters always ending a statement
  29387. DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
  29388. // Field rules
  29389. RULE: /^(?:required|optional|repeated|map)$/,
  29390. // Field types
  29391. TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
  29392. // Names
  29393. NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
  29394. // Type definitions
  29395. TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
  29396. // Type references
  29397. TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,
  29398. // Fully qualified type references
  29399. FQTYPEREF: /^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,
  29400. // All numbers
  29401. NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
  29402. // Decimal numbers
  29403. NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
  29404. // Hexadecimal numbers
  29405. NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
  29406. // Octal numbers
  29407. NUMBER_OCT: /^0[0-7]+$/,
  29408. // Floating point numbers
  29409. NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
  29410. // Booleans
  29411. BOOL: /^(?:true|false)$/i,
  29412. // Id numbers
  29413. ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
  29414. // Negative id numbers (enum values)
  29415. NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
  29416. // Whitespaces
  29417. WHITESPACE: /\s/,
  29418. // All strings
  29419. STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
  29420. // Double quoted strings
  29421. STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
  29422. // Single quoted strings
  29423. STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
  29424. };
  29425. /**
  29426. * @alias ProtoBuf.DotProto
  29427. * @expose
  29428. */
  29429. ProtoBuf.DotProto = (function(ProtoBuf, Lang) {
  29430. "use strict";
  29431. /**
  29432. * Utilities to parse .proto files.
  29433. * @exports ProtoBuf.DotProto
  29434. * @namespace
  29435. */
  29436. var DotProto = {};
  29437. /**
  29438. * Constructs a new Tokenizer.
  29439. * @exports ProtoBuf.DotProto.Tokenizer
  29440. * @class prototype tokenizer
  29441. * @param {string} proto Proto to tokenize
  29442. * @constructor
  29443. */
  29444. var Tokenizer = function(proto) {
  29445. /**
  29446. * Source to parse.
  29447. * @type {string}
  29448. * @expose
  29449. */
  29450. this.source = proto+"";
  29451. /**
  29452. * Current index.
  29453. * @type {number}
  29454. * @expose
  29455. */
  29456. this.index = 0;
  29457. /**
  29458. * Current line.
  29459. * @type {number}
  29460. * @expose
  29461. */
  29462. this.line = 1;
  29463. /**
  29464. * Token stack.
  29465. * @type {!Array.<string>}
  29466. * @expose
  29467. */
  29468. this.stack = [];
  29469. /**
  29470. * Opening character of the current string read, if any.
  29471. * @type {?string}
  29472. * @private
  29473. */
  29474. this._stringOpen = null;
  29475. };
  29476. /**
  29477. * @alias ProtoBuf.DotProto.Tokenizer.prototype
  29478. * @inner
  29479. */
  29480. var TokenizerPrototype = Tokenizer.prototype;
  29481. /**
  29482. * Reads a string beginning at the current index.
  29483. * @return {string}
  29484. * @private
  29485. */
  29486. TokenizerPrototype._readString = function() {
  29487. var re = this._stringOpen === '"'
  29488. ? Lang.STRING_DQ
  29489. : Lang.STRING_SQ;
  29490. re.lastIndex = this.index - 1; // Include the open quote
  29491. var match = re.exec(this.source);
  29492. if (!match)
  29493. throw Error("unterminated string");
  29494. this.index = re.lastIndex;
  29495. this.stack.push(this._stringOpen);
  29496. this._stringOpen = null;
  29497. return match[1];
  29498. };
  29499. /**
  29500. * Gets the next token and advances by one.
  29501. * @return {?string} Token or `null` on EOF
  29502. * @expose
  29503. */
  29504. TokenizerPrototype.next = function() {
  29505. if (this.stack.length > 0)
  29506. return this.stack.shift();
  29507. if (this.index >= this.source.length)
  29508. return null;
  29509. if (this._stringOpen !== null)
  29510. return this._readString();
  29511. var repeat,
  29512. prev,
  29513. next;
  29514. do {
  29515. repeat = false;
  29516. // Strip white spaces
  29517. while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) {
  29518. if (next === '\n')
  29519. ++this.line;
  29520. if (++this.index === this.source.length)
  29521. return null;
  29522. }
  29523. // Strip comments
  29524. if (this.source.charAt(this.index) === '/') {
  29525. ++this.index;
  29526. if (this.source.charAt(this.index) === '/') { // Line
  29527. while (this.source.charAt(++this.index) !== '\n')
  29528. if (this.index == this.source.length)
  29529. return null;
  29530. ++this.index;
  29531. ++this.line;
  29532. repeat = true;
  29533. } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */
  29534. do {
  29535. if (next === '\n')
  29536. ++this.line;
  29537. if (++this.index === this.source.length)
  29538. return null;
  29539. prev = next;
  29540. next = this.source.charAt(this.index);
  29541. } while (prev !== '*' || next !== '/');
  29542. ++this.index;
  29543. repeat = true;
  29544. } else
  29545. return '/';
  29546. }
  29547. } while (repeat);
  29548. if (this.index === this.source.length)
  29549. return null;
  29550. // Read the next token
  29551. var end = this.index;
  29552. Lang.DELIM.lastIndex = 0;
  29553. var delim = Lang.DELIM.test(this.source.charAt(end++));
  29554. if (!delim)
  29555. while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end)))
  29556. ++end;
  29557. var token = this.source.substring(this.index, this.index = end);
  29558. if (token === '"' || token === "'")
  29559. this._stringOpen = token;
  29560. return token;
  29561. };
  29562. /**
  29563. * Peeks for the next token.
  29564. * @return {?string} Token or `null` on EOF
  29565. * @expose
  29566. */
  29567. TokenizerPrototype.peek = function() {
  29568. if (this.stack.length === 0) {
  29569. var token = this.next();
  29570. if (token === null)
  29571. return null;
  29572. this.stack.push(token);
  29573. }
  29574. return this.stack[0];
  29575. };
  29576. /**
  29577. * Skips a specific token and throws if it differs.
  29578. * @param {string} expected Expected token
  29579. * @throws {Error} If the actual token differs
  29580. */
  29581. TokenizerPrototype.skip = function(expected) {
  29582. var actual = this.next();
  29583. if (actual !== expected)
  29584. throw Error("illegal '"+actual+"', '"+expected+"' expected");
  29585. };
  29586. /**
  29587. * Omits an optional token.
  29588. * @param {string} expected Expected optional token
  29589. * @returns {boolean} `true` if the token exists
  29590. */
  29591. TokenizerPrototype.omit = function(expected) {
  29592. if (this.peek() === expected) {
  29593. this.next();
  29594. return true;
  29595. }
  29596. return false;
  29597. };
  29598. /**
  29599. * Returns a string representation of this object.
  29600. * @return {string} String representation as of "Tokenizer(index/length)"
  29601. * @expose
  29602. */
  29603. TokenizerPrototype.toString = function() {
  29604. return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")";
  29605. };
  29606. /**
  29607. * @alias ProtoBuf.DotProto.Tokenizer
  29608. * @expose
  29609. */
  29610. DotProto.Tokenizer = Tokenizer;
  29611. /**
  29612. * Constructs a new Parser.
  29613. * @exports ProtoBuf.DotProto.Parser
  29614. * @class prototype parser
  29615. * @param {string} source Source
  29616. * @constructor
  29617. */
  29618. var Parser = function(source) {
  29619. /**
  29620. * Tokenizer.
  29621. * @type {!ProtoBuf.DotProto.Tokenizer}
  29622. * @expose
  29623. */
  29624. this.tn = new Tokenizer(source);
  29625. /**
  29626. * Whether parsing proto3 or not.
  29627. * @type {boolean}
  29628. */
  29629. this.proto3 = false;
  29630. };
  29631. /**
  29632. * @alias ProtoBuf.DotProto.Parser.prototype
  29633. * @inner
  29634. */
  29635. var ParserPrototype = Parser.prototype;
  29636. /**
  29637. * Parses the source.
  29638. * @returns {!Object}
  29639. * @throws {Error} If the source cannot be parsed
  29640. * @expose
  29641. */
  29642. ParserPrototype.parse = function() {
  29643. var topLevel = {
  29644. "name": "[ROOT]", // temporary
  29645. "package": null,
  29646. "messages": [],
  29647. "enums": [],
  29648. "imports": [],
  29649. "options": {},
  29650. "services": []
  29651. // "syntax": undefined
  29652. };
  29653. var token,
  29654. head = true,
  29655. weak;
  29656. try {
  29657. while (token = this.tn.next()) {
  29658. switch (token) {
  29659. case 'package':
  29660. if (!head || topLevel["package"] !== null)
  29661. throw Error("unexpected 'package'");
  29662. token = this.tn.next();
  29663. if (!Lang.TYPEREF.test(token))
  29664. throw Error("illegal package name: " + token);
  29665. this.tn.skip(";");
  29666. topLevel["package"] = token;
  29667. break;
  29668. case 'import':
  29669. if (!head)
  29670. throw Error("unexpected 'import'");
  29671. token = this.tn.peek();
  29672. if (token === "public" || (weak = token === "weak")) // token ignored
  29673. this.tn.next();
  29674. token = this._readString();
  29675. this.tn.skip(";");
  29676. if (!weak) // import ignored
  29677. topLevel["imports"].push(token);
  29678. break;
  29679. case 'syntax':
  29680. if (!head)
  29681. throw Error("unexpected 'syntax'");
  29682. this.tn.skip("=");
  29683. if ((topLevel["syntax"] = this._readString()) === "proto3")
  29684. this.proto3 = true;
  29685. this.tn.skip(";");
  29686. break;
  29687. case 'message':
  29688. this._parseMessage(topLevel, null);
  29689. head = false;
  29690. break;
  29691. case 'enum':
  29692. this._parseEnum(topLevel);
  29693. head = false;
  29694. break;
  29695. case 'option':
  29696. this._parseOption(topLevel);
  29697. break;
  29698. case 'service':
  29699. this._parseService(topLevel);
  29700. break;
  29701. case 'extend':
  29702. this._parseExtend(topLevel);
  29703. break;
  29704. default:
  29705. throw Error("unexpected '" + token + "'");
  29706. }
  29707. }
  29708. } catch (e) {
  29709. e.message = "Parse error at line "+this.tn.line+": " + e.message;
  29710. throw e;
  29711. }
  29712. delete topLevel["name"];
  29713. return topLevel;
  29714. };
  29715. /**
  29716. * Parses the specified source.
  29717. * @returns {!Object}
  29718. * @throws {Error} If the source cannot be parsed
  29719. * @expose
  29720. */
  29721. Parser.parse = function(source) {
  29722. return new Parser(source).parse();
  29723. };
  29724. // ----- Conversion ------
  29725. /**
  29726. * Converts a numerical string to an id.
  29727. * @param {string} value
  29728. * @param {boolean=} mayBeNegative
  29729. * @returns {number}
  29730. * @inner
  29731. */
  29732. function mkId(value, mayBeNegative) {
  29733. var id = -1,
  29734. sign = 1;
  29735. if (value.charAt(0) == '-') {
  29736. sign = -1;
  29737. value = value.substring(1);
  29738. }
  29739. if (Lang.NUMBER_DEC.test(value))
  29740. id = parseInt(value);
  29741. else if (Lang.NUMBER_HEX.test(value))
  29742. id = parseInt(value.substring(2), 16);
  29743. else if (Lang.NUMBER_OCT.test(value))
  29744. id = parseInt(value.substring(1), 8);
  29745. else
  29746. throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
  29747. id = (sign*id)|0; // Force to 32bit
  29748. if (!mayBeNegative && id < 0)
  29749. throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
  29750. return id;
  29751. }
  29752. /**
  29753. * Converts a numerical string to a number.
  29754. * @param {string} val
  29755. * @returns {number}
  29756. * @inner
  29757. */
  29758. function mkNumber(val) {
  29759. var sign = 1;
  29760. if (val.charAt(0) == '-') {
  29761. sign = -1;
  29762. val = val.substring(1);
  29763. }
  29764. if (Lang.NUMBER_DEC.test(val))
  29765. return sign * parseInt(val, 10);
  29766. else if (Lang.NUMBER_HEX.test(val))
  29767. return sign * parseInt(val.substring(2), 16);
  29768. else if (Lang.NUMBER_OCT.test(val))
  29769. return sign * parseInt(val.substring(1), 8);
  29770. else if (val === 'inf')
  29771. return sign * Infinity;
  29772. else if (val === 'nan')
  29773. return NaN;
  29774. else if (Lang.NUMBER_FLT.test(val))
  29775. return sign * parseFloat(val);
  29776. throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
  29777. }
  29778. // ----- Reading ------
  29779. /**
  29780. * Reads a string.
  29781. * @returns {string}
  29782. * @private
  29783. */
  29784. ParserPrototype._readString = function() {
  29785. var value = "",
  29786. token,
  29787. delim;
  29788. do {
  29789. delim = this.tn.next();
  29790. if (delim !== "'" && delim !== '"')
  29791. throw Error("illegal string delimiter: "+delim);
  29792. value += this.tn.next();
  29793. this.tn.skip(delim);
  29794. token = this.tn.peek();
  29795. } while (token === '"' || token === '"'); // multi line?
  29796. return value;
  29797. };
  29798. /**
  29799. * Reads a value.
  29800. * @param {boolean=} mayBeTypeRef
  29801. * @returns {number|boolean|string}
  29802. * @private
  29803. */
  29804. ParserPrototype._readValue = function(mayBeTypeRef) {
  29805. var token = this.tn.peek(),
  29806. value;
  29807. if (token === '"' || token === "'")
  29808. return this._readString();
  29809. this.tn.next();
  29810. if (Lang.NUMBER.test(token))
  29811. return mkNumber(token);
  29812. if (Lang.BOOL.test(token))
  29813. return (token.toLowerCase() === 'true');
  29814. if (mayBeTypeRef && Lang.TYPEREF.test(token))
  29815. return token;
  29816. throw Error("illegal value: "+token);
  29817. };
  29818. // ----- Parsing constructs -----
  29819. /**
  29820. * Parses a namespace option.
  29821. * @param {!Object} parent Parent definition
  29822. * @param {boolean=} isList
  29823. * @private
  29824. */
  29825. ParserPrototype._parseOption = function(parent, isList) {
  29826. var token = this.tn.next(),
  29827. custom = false;
  29828. if (token === '(') {
  29829. custom = true;
  29830. token = this.tn.next();
  29831. }
  29832. if (!Lang.TYPEREF.test(token))
  29833. // we can allow options of the form google.protobuf.* since they will just get ignored anyways
  29834. // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref?
  29835. throw Error("illegal option name: "+token);
  29836. var name = token;
  29837. if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar
  29838. this.tn.skip(')');
  29839. name = '('+name+')';
  29840. token = this.tn.peek();
  29841. if (Lang.FQTYPEREF.test(token)) {
  29842. name += token;
  29843. this.tn.next();
  29844. }
  29845. }
  29846. this.tn.skip('=');
  29847. this._parseOptionValue(parent, name);
  29848. if (!isList)
  29849. this.tn.skip(";");
  29850. };
  29851. /**
  29852. * Sets an option on the specified options object.
  29853. * @param {!Object.<string,*>} options
  29854. * @param {string} name
  29855. * @param {string|number|boolean} value
  29856. * @inner
  29857. */
  29858. function setOption(options, name, value) {
  29859. if (typeof options[name] === 'undefined')
  29860. options[name] = value;
  29861. else {
  29862. if (!Array.isArray(options[name]))
  29863. options[name] = [ options[name] ];
  29864. options[name].push(value);
  29865. }
  29866. }
  29867. /**
  29868. * Parses an option value.
  29869. * @param {!Object} parent
  29870. * @param {string} name
  29871. * @private
  29872. */
  29873. ParserPrototype._parseOptionValue = function(parent, name) {
  29874. var token = this.tn.peek();
  29875. if (token !== '{') { // Plain value
  29876. setOption(parent["options"], name, this._readValue(true));
  29877. } else { // Aggregate options
  29878. this.tn.skip("{");
  29879. while ((token = this.tn.next()) !== '}') {
  29880. if (!Lang.NAME.test(token))
  29881. throw Error("illegal option name: " + name + "." + token);
  29882. if (this.tn.omit(":"))
  29883. setOption(parent["options"], name + "." + token, this._readValue(true));
  29884. else
  29885. this._parseOptionValue(parent, name + "." + token);
  29886. }
  29887. }
  29888. };
  29889. /**
  29890. * Parses a service definition.
  29891. * @param {!Object} parent Parent definition
  29892. * @private
  29893. */
  29894. ParserPrototype._parseService = function(parent) {
  29895. var token = this.tn.next();
  29896. if (!Lang.NAME.test(token))
  29897. throw Error("illegal service name at line "+this.tn.line+": "+token);
  29898. var name = token;
  29899. var svc = {
  29900. "name": name,
  29901. "rpc": {},
  29902. "options": {}
  29903. };
  29904. this.tn.skip("{");
  29905. while ((token = this.tn.next()) !== '}') {
  29906. if (token === "option")
  29907. this._parseOption(svc);
  29908. else if (token === 'rpc')
  29909. this._parseServiceRPC(svc);
  29910. else
  29911. throw Error("illegal service token: "+token);
  29912. }
  29913. this.tn.omit(";");
  29914. parent["services"].push(svc);
  29915. };
  29916. /**
  29917. * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)].
  29918. * @param {!Object} svc Service definition
  29919. * @private
  29920. */
  29921. ParserPrototype._parseServiceRPC = function(svc) {
  29922. var type = "rpc",
  29923. token = this.tn.next();
  29924. if (!Lang.NAME.test(token))
  29925. throw Error("illegal rpc service method name: "+token);
  29926. var name = token;
  29927. var method = {
  29928. "request": null,
  29929. "response": null,
  29930. "request_stream": false,
  29931. "response_stream": false,
  29932. "options": {}
  29933. };
  29934. this.tn.skip("(");
  29935. token = this.tn.next();
  29936. if (token.toLowerCase() === "stream") {
  29937. method["request_stream"] = true;
  29938. token = this.tn.next();
  29939. }
  29940. if (!Lang.TYPEREF.test(token))
  29941. throw Error("illegal rpc service request type: "+token);
  29942. method["request"] = token;
  29943. this.tn.skip(")");
  29944. token = this.tn.next();
  29945. if (token.toLowerCase() !== "returns")
  29946. throw Error("illegal rpc service request type delimiter: "+token);
  29947. this.tn.skip("(");
  29948. token = this.tn.next();
  29949. if (token.toLowerCase() === "stream") {
  29950. method["response_stream"] = true;
  29951. token = this.tn.next();
  29952. }
  29953. method["response"] = token;
  29954. this.tn.skip(")");
  29955. token = this.tn.peek();
  29956. if (token === '{') {
  29957. this.tn.next();
  29958. while ((token = this.tn.next()) !== '}') {
  29959. if (token === 'option')
  29960. this._parseOption(method);
  29961. else
  29962. throw Error("illegal rpc service token: " + token);
  29963. }
  29964. this.tn.omit(";");
  29965. } else
  29966. this.tn.skip(";");
  29967. if (typeof svc[type] === 'undefined')
  29968. svc[type] = {};
  29969. svc[type][name] = method;
  29970. };
  29971. /**
  29972. * Parses a message definition.
  29973. * @param {!Object} parent Parent definition
  29974. * @param {!Object=} fld Field definition if this is a group
  29975. * @returns {!Object}
  29976. * @private
  29977. */
  29978. ParserPrototype._parseMessage = function(parent, fld) {
  29979. var isGroup = !!fld,
  29980. token = this.tn.next();
  29981. var msg = {
  29982. "name": "",
  29983. "fields": [],
  29984. "enums": [],
  29985. "messages": [],
  29986. "options": {},
  29987. "services": [],
  29988. "oneofs": {}
  29989. // "extensions": undefined
  29990. };
  29991. if (!Lang.NAME.test(token))
  29992. throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token);
  29993. msg["name"] = token;
  29994. if (isGroup) {
  29995. this.tn.skip("=");
  29996. fld["id"] = mkId(this.tn.next());
  29997. msg["isGroup"] = true;
  29998. }
  29999. token = this.tn.peek();
  30000. if (token === '[' && fld)
  30001. this._parseFieldOptions(fld);
  30002. this.tn.skip("{");
  30003. while ((token = this.tn.next()) !== '}') {
  30004. if (Lang.RULE.test(token))
  30005. this._parseMessageField(msg, token);
  30006. else if (token === "oneof")
  30007. this._parseMessageOneOf(msg);
  30008. else if (token === "enum")
  30009. this._parseEnum(msg);
  30010. else if (token === "message")
  30011. this._parseMessage(msg);
  30012. else if (token === "option")
  30013. this._parseOption(msg);
  30014. else if (token === "service")
  30015. this._parseService(msg);
  30016. else if (token === "extensions")
  30017. msg["extensions"] = this._parseExtensionRanges();
  30018. else if (token === "reserved")
  30019. this._parseIgnored(); // TODO
  30020. else if (token === "extend")
  30021. this._parseExtend(msg);
  30022. else if (Lang.TYPEREF.test(token)) {
  30023. if (!this.proto3)
  30024. throw Error("illegal field rule: "+token);
  30025. this._parseMessageField(msg, "optional", token);
  30026. } else
  30027. throw Error("illegal message token: "+token);
  30028. }
  30029. this.tn.omit(";");
  30030. parent["messages"].push(msg);
  30031. return msg;
  30032. };
  30033. /**
  30034. * Parses an ignored statement.
  30035. * @private
  30036. */
  30037. ParserPrototype._parseIgnored = function() {
  30038. while (this.tn.peek() !== ';')
  30039. this.tn.next();
  30040. this.tn.skip(";");
  30041. };
  30042. /**
  30043. * Parses a message field.
  30044. * @param {!Object} msg Message definition
  30045. * @param {string} rule Field rule
  30046. * @param {string=} type Field type if already known (never known for maps)
  30047. * @returns {!Object} Field descriptor
  30048. * @private
  30049. */
  30050. ParserPrototype._parseMessageField = function(msg, rule, type) {
  30051. if (!Lang.RULE.test(rule))
  30052. throw Error("illegal message field rule: "+rule);
  30053. var fld = {
  30054. "rule": rule,
  30055. "type": "",
  30056. "name": "",
  30057. "options": {},
  30058. "id": 0
  30059. };
  30060. var token;
  30061. if (rule === "map") {
  30062. if (type)
  30063. throw Error("illegal type: " + type);
  30064. this.tn.skip('<');
  30065. token = this.tn.next();
  30066. if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
  30067. throw Error("illegal message field type: " + token);
  30068. fld["keytype"] = token;
  30069. this.tn.skip(',');
  30070. token = this.tn.next();
  30071. if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
  30072. throw Error("illegal message field: " + token);
  30073. fld["type"] = token;
  30074. this.tn.skip('>');
  30075. token = this.tn.next();
  30076. if (!Lang.NAME.test(token))
  30077. throw Error("illegal message field name: " + token);
  30078. fld["name"] = token;
  30079. this.tn.skip("=");
  30080. fld["id"] = mkId(this.tn.next());
  30081. token = this.tn.peek();
  30082. if (token === '[')
  30083. this._parseFieldOptions(fld);
  30084. this.tn.skip(";");
  30085. } else {
  30086. type = typeof type !== 'undefined' ? type : this.tn.next();
  30087. if (type === "group") {
  30088. // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your
  30089. // code, you can treat this message just as if it had a Result type field called result (the latter name is
  30090. // converted to lower-case so that it does not conflict with the former)."
  30091. var grp = this._parseMessage(msg, fld);
  30092. if (!/^[A-Z]/.test(grp["name"]))
  30093. throw Error('illegal group name: '+grp["name"]);
  30094. fld["type"] = grp["name"];
  30095. fld["name"] = grp["name"].toLowerCase();
  30096. this.tn.omit(";");
  30097. } else {
  30098. if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type))
  30099. throw Error("illegal message field type: " + type);
  30100. fld["type"] = type;
  30101. token = this.tn.next();
  30102. if (!Lang.NAME.test(token))
  30103. throw Error("illegal message field name: " + token);
  30104. fld["name"] = token;
  30105. this.tn.skip("=");
  30106. fld["id"] = mkId(this.tn.next());
  30107. token = this.tn.peek();
  30108. if (token === "[")
  30109. this._parseFieldOptions(fld);
  30110. this.tn.skip(";");
  30111. }
  30112. }
  30113. msg["fields"].push(fld);
  30114. return fld;
  30115. };
  30116. /**
  30117. * Parses a message oneof.
  30118. * @param {!Object} msg Message definition
  30119. * @private
  30120. */
  30121. ParserPrototype._parseMessageOneOf = function(msg) {
  30122. var token = this.tn.next();
  30123. if (!Lang.NAME.test(token))
  30124. throw Error("illegal oneof name: "+token);
  30125. var name = token,
  30126. fld;
  30127. var fields = [];
  30128. this.tn.skip("{");
  30129. while ((token = this.tn.next()) !== "}") {
  30130. fld = this._parseMessageField(msg, "optional", token);
  30131. fld["oneof"] = name;
  30132. fields.push(fld["id"]);
  30133. }
  30134. this.tn.omit(";");
  30135. msg["oneofs"][name] = fields;
  30136. };
  30137. /**
  30138. * Parses a set of field option definitions.
  30139. * @param {!Object} fld Field definition
  30140. * @private
  30141. */
  30142. ParserPrototype._parseFieldOptions = function(fld) {
  30143. this.tn.skip("[");
  30144. var token,
  30145. first = true;
  30146. while ((token = this.tn.peek()) !== ']') {
  30147. if (!first)
  30148. this.tn.skip(",");
  30149. this._parseOption(fld, true);
  30150. first = false;
  30151. }
  30152. this.tn.next();
  30153. };
  30154. /**
  30155. * Parses an enum.
  30156. * @param {!Object} msg Message definition
  30157. * @private
  30158. */
  30159. ParserPrototype._parseEnum = function(msg) {
  30160. var enm = {
  30161. "name": "",
  30162. "values": [],
  30163. "options": {}
  30164. };
  30165. var token = this.tn.next();
  30166. if (!Lang.NAME.test(token))
  30167. throw Error("illegal name: "+token);
  30168. enm["name"] = token;
  30169. this.tn.skip("{");
  30170. while ((token = this.tn.next()) !== '}') {
  30171. if (token === "option")
  30172. this._parseOption(enm);
  30173. else {
  30174. if (!Lang.NAME.test(token))
  30175. throw Error("illegal name: "+token);
  30176. this.tn.skip("=");
  30177. var val = {
  30178. "name": token,
  30179. "id": mkId(this.tn.next(), true)
  30180. };
  30181. token = this.tn.peek();
  30182. if (token === "[")
  30183. this._parseFieldOptions({ "options": {} });
  30184. this.tn.skip(";");
  30185. enm["values"].push(val);
  30186. }
  30187. }
  30188. this.tn.omit(";");
  30189. msg["enums"].push(enm);
  30190. };
  30191. /**
  30192. * Parses extension / reserved ranges.
  30193. * @returns {!Array.<!Array.<number>>}
  30194. * @private
  30195. */
  30196. ParserPrototype._parseExtensionRanges = function() {
  30197. var ranges = [];
  30198. var token,
  30199. range,
  30200. value;
  30201. do {
  30202. range = [];
  30203. while (true) {
  30204. token = this.tn.next();
  30205. switch (token) {
  30206. case "min":
  30207. value = ProtoBuf.ID_MIN;
  30208. break;
  30209. case "max":
  30210. value = ProtoBuf.ID_MAX;
  30211. break;
  30212. default:
  30213. value = mkNumber(token);
  30214. break;
  30215. }
  30216. range.push(value);
  30217. if (range.length === 2)
  30218. break;
  30219. if (this.tn.peek() !== "to") {
  30220. range.push(value);
  30221. break;
  30222. }
  30223. this.tn.next();
  30224. }
  30225. ranges.push(range);
  30226. } while (this.tn.omit(","));
  30227. this.tn.skip(";");
  30228. return ranges;
  30229. };
  30230. /**
  30231. * Parses an extend block.
  30232. * @param {!Object} parent Parent object
  30233. * @private
  30234. */
  30235. ParserPrototype._parseExtend = function(parent) {
  30236. var token = this.tn.next();
  30237. if (!Lang.TYPEREF.test(token))
  30238. throw Error("illegal extend reference: "+token);
  30239. var ext = {
  30240. "ref": token,
  30241. "fields": []
  30242. };
  30243. this.tn.skip("{");
  30244. while ((token = this.tn.next()) !== '}') {
  30245. if (Lang.RULE.test(token))
  30246. this._parseMessageField(ext, token);
  30247. else if (Lang.TYPEREF.test(token)) {
  30248. if (!this.proto3)
  30249. throw Error("illegal field rule: "+token);
  30250. this._parseMessageField(ext, "optional", token);
  30251. } else
  30252. throw Error("illegal extend token: "+token);
  30253. }
  30254. this.tn.omit(";");
  30255. parent["messages"].push(ext);
  30256. return ext;
  30257. };
  30258. // ----- General -----
  30259. /**
  30260. * Returns a string representation of this parser.
  30261. * @returns {string}
  30262. */
  30263. ParserPrototype.toString = function() {
  30264. return "Parser at line "+this.tn.line;
  30265. };
  30266. /**
  30267. * @alias ProtoBuf.DotProto.Parser
  30268. * @expose
  30269. */
  30270. DotProto.Parser = Parser;
  30271. return DotProto;
  30272. })(ProtoBuf, ProtoBuf.Lang);
  30273. /**
  30274. * @alias ProtoBuf.Reflect
  30275. * @expose
  30276. */
  30277. ProtoBuf.Reflect = (function(ProtoBuf) {
  30278. "use strict";
  30279. /**
  30280. * Reflection types.
  30281. * @exports ProtoBuf.Reflect
  30282. * @namespace
  30283. */
  30284. var Reflect = {};
  30285. /**
  30286. * Constructs a Reflect base class.
  30287. * @exports ProtoBuf.Reflect.T
  30288. * @constructor
  30289. * @abstract
  30290. * @param {!ProtoBuf.Builder} builder Builder reference
  30291. * @param {?ProtoBuf.Reflect.T} parent Parent object
  30292. * @param {string} name Object name
  30293. */
  30294. var T = function(builder, parent, name) {
  30295. /**
  30296. * Builder reference.
  30297. * @type {!ProtoBuf.Builder}
  30298. * @expose
  30299. */
  30300. this.builder = builder;
  30301. /**
  30302. * Parent object.
  30303. * @type {?ProtoBuf.Reflect.T}
  30304. * @expose
  30305. */
  30306. this.parent = parent;
  30307. /**
  30308. * Object name in namespace.
  30309. * @type {string}
  30310. * @expose
  30311. */
  30312. this.name = name;
  30313. /**
  30314. * Fully qualified class name
  30315. * @type {string}
  30316. * @expose
  30317. */
  30318. this.className;
  30319. };
  30320. /**
  30321. * @alias ProtoBuf.Reflect.T.prototype
  30322. * @inner
  30323. */
  30324. var TPrototype = T.prototype;
  30325. /**
  30326. * Returns the fully qualified name of this object.
  30327. * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
  30328. * @expose
  30329. */
  30330. TPrototype.fqn = function() {
  30331. var name = this.name,
  30332. ptr = this;
  30333. do {
  30334. ptr = ptr.parent;
  30335. if (ptr == null)
  30336. break;
  30337. name = ptr.name+"."+name;
  30338. } while (true);
  30339. return name;
  30340. };
  30341. /**
  30342. * Returns a string representation of this Reflect object (its fully qualified name).
  30343. * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
  30344. * @return String representation
  30345. * @expose
  30346. */
  30347. TPrototype.toString = function(includeClass) {
  30348. return (includeClass ? this.className + " " : "") + this.fqn();
  30349. };
  30350. /**
  30351. * Builds this type.
  30352. * @throws {Error} If this type cannot be built directly
  30353. * @expose
  30354. */
  30355. TPrototype.build = function() {
  30356. throw Error(this.toString(true)+" cannot be built directly");
  30357. };
  30358. /**
  30359. * @alias ProtoBuf.Reflect.T
  30360. * @expose
  30361. */
  30362. Reflect.T = T;
  30363. /**
  30364. * Constructs a new Namespace.
  30365. * @exports ProtoBuf.Reflect.Namespace
  30366. * @param {!ProtoBuf.Builder} builder Builder reference
  30367. * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
  30368. * @param {string} name Namespace name
  30369. * @param {Object.<string,*>=} options Namespace options
  30370. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  30371. * @constructor
  30372. * @extends ProtoBuf.Reflect.T
  30373. */
  30374. var Namespace = function(builder, parent, name, options, syntax) {
  30375. T.call(this, builder, parent, name);
  30376. /**
  30377. * @override
  30378. */
  30379. this.className = "Namespace";
  30380. /**
  30381. * Children inside the namespace.
  30382. * @type {!Array.<ProtoBuf.Reflect.T>}
  30383. */
  30384. this.children = [];
  30385. /**
  30386. * Options.
  30387. * @type {!Object.<string, *>}
  30388. */
  30389. this.options = options || {};
  30390. /**
  30391. * Syntax level (e.g., proto2 or proto3).
  30392. * @type {!string}
  30393. */
  30394. this.syntax = syntax || "proto2";
  30395. };
  30396. /**
  30397. * @alias ProtoBuf.Reflect.Namespace.prototype
  30398. * @inner
  30399. */
  30400. var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
  30401. /**
  30402. * Returns an array of the namespace's children.
  30403. * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
  30404. * @return {Array.<ProtoBuf.Reflect.T>}
  30405. * @expose
  30406. */
  30407. NamespacePrototype.getChildren = function(type) {
  30408. type = type || null;
  30409. if (type == null)
  30410. return this.children.slice();
  30411. var children = [];
  30412. for (var i=0, k=this.children.length; i<k; ++i)
  30413. if (this.children[i] instanceof type)
  30414. children.push(this.children[i]);
  30415. return children;
  30416. };
  30417. /**
  30418. * Adds a child to the namespace.
  30419. * @param {ProtoBuf.Reflect.T} child Child
  30420. * @throws {Error} If the child cannot be added (duplicate)
  30421. * @expose
  30422. */
  30423. NamespacePrototype.addChild = function(child) {
  30424. var other;
  30425. if (other = this.getChild(child.name)) {
  30426. // Try to revert camelcase transformation on collision
  30427. if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
  30428. other.name = other.originalName; // Revert previous first (effectively keeps both originals)
  30429. else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
  30430. child.name = child.originalName;
  30431. else
  30432. throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
  30433. }
  30434. this.children.push(child);
  30435. };
  30436. /**
  30437. * Gets a child by its name or id.
  30438. * @param {string|number} nameOrId Child name or id
  30439. * @return {?ProtoBuf.Reflect.T} The child or null if not found
  30440. * @expose
  30441. */
  30442. NamespacePrototype.getChild = function(nameOrId) {
  30443. var key = typeof nameOrId === 'number' ? 'id' : 'name';
  30444. for (var i=0, k=this.children.length; i<k; ++i)
  30445. if (this.children[i][key] === nameOrId)
  30446. return this.children[i];
  30447. return null;
  30448. };
  30449. /**
  30450. * Resolves a reflect object inside of this namespace.
  30451. * @param {string|!Array.<string>} qn Qualified name to resolve
  30452. * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
  30453. * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
  30454. * @expose
  30455. */
  30456. NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
  30457. var part = typeof qn === 'string' ? qn.split(".") : qn,
  30458. ptr = this,
  30459. i = 0;
  30460. if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
  30461. while (ptr.parent !== null)
  30462. ptr = ptr.parent;
  30463. i++;
  30464. }
  30465. var child;
  30466. do {
  30467. do {
  30468. if (!(ptr instanceof Reflect.Namespace)) {
  30469. ptr = null;
  30470. break;
  30471. }
  30472. child = ptr.getChild(part[i]);
  30473. if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
  30474. ptr = null;
  30475. break;
  30476. }
  30477. ptr = child; i++;
  30478. } while (i < part.length);
  30479. if (ptr != null)
  30480. break; // Found
  30481. // Else search the parent
  30482. if (this.parent !== null)
  30483. return this.parent.resolve(qn, excludeNonNamespace);
  30484. } while (ptr != null);
  30485. return ptr;
  30486. };
  30487. /**
  30488. * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
  30489. * @param {!ProtoBuf.Reflect.T} t Reflection type
  30490. * @returns {string} The shortest qualified name or, if there is none, the fqn
  30491. * @expose
  30492. */
  30493. NamespacePrototype.qn = function(t) {
  30494. var part = [], ptr = t;
  30495. do {
  30496. part.unshift(ptr.name);
  30497. ptr = ptr.parent;
  30498. } while (ptr !== null);
  30499. for (var len=1; len <= part.length; len++) {
  30500. var qn = part.slice(part.length-len);
  30501. if (t === this.resolve(qn, t instanceof Reflect.Namespace))
  30502. return qn.join(".");
  30503. }
  30504. return t.fqn();
  30505. };
  30506. /**
  30507. * Builds the namespace and returns the runtime counterpart.
  30508. * @return {Object.<string,Function|Object>} Runtime namespace
  30509. * @expose
  30510. */
  30511. NamespacePrototype.build = function() {
  30512. /** @dict */
  30513. var ns = {};
  30514. var children = this.children;
  30515. for (var i=0, k=children.length, child; i<k; ++i) {
  30516. child = children[i];
  30517. if (child instanceof Namespace)
  30518. ns[child.name] = child.build();
  30519. }
  30520. if (Object.defineProperty)
  30521. Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
  30522. return ns;
  30523. };
  30524. /**
  30525. * Builds the namespace's '$options' property.
  30526. * @return {Object.<string,*>}
  30527. */
  30528. NamespacePrototype.buildOpt = function() {
  30529. var opt = {},
  30530. keys = Object.keys(this.options);
  30531. for (var i=0, k=keys.length; i<k; ++i) {
  30532. var key = keys[i],
  30533. val = this.options[keys[i]];
  30534. // TODO: Options are not resolved, yet.
  30535. // if (val instanceof Namespace) {
  30536. // opt[key] = val.build();
  30537. // } else {
  30538. opt[key] = val;
  30539. // }
  30540. }
  30541. return opt;
  30542. };
  30543. /**
  30544. * Gets the value assigned to the option with the specified name.
  30545. * @param {string=} name Returns the option value if specified, otherwise all options are returned.
  30546. * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
  30547. */
  30548. NamespacePrototype.getOption = function(name) {
  30549. if (typeof name === 'undefined')
  30550. return this.options;
  30551. return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
  30552. };
  30553. /**
  30554. * @alias ProtoBuf.Reflect.Namespace
  30555. * @expose
  30556. */
  30557. Reflect.Namespace = Namespace;
  30558. /**
  30559. * Constructs a new Element implementation that checks and converts values for a
  30560. * particular field type, as appropriate.
  30561. *
  30562. * An Element represents a single value: either the value of a singular field,
  30563. * or a value contained in one entry of a repeated field or map field. This
  30564. * class does not implement these higher-level concepts; it only encapsulates
  30565. * the low-level typechecking and conversion.
  30566. *
  30567. * @exports ProtoBuf.Reflect.Element
  30568. * @param {{name: string, wireType: number}} type Resolved data type
  30569. * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
  30570. * (e.g. submessage field).
  30571. * @param {boolean} isMapKey Is this element a Map key? The value will be
  30572. * converted to string form if so.
  30573. * @param {string} syntax Syntax level of defining message type, e.g.,
  30574. * proto2 or proto3.
  30575. * @constructor
  30576. */
  30577. var Element = function(type, resolvedType, isMapKey, syntax) {
  30578. /**
  30579. * Element type, as a string (e.g., int32).
  30580. * @type {{name: string, wireType: number}}
  30581. */
  30582. this.type = type;
  30583. /**
  30584. * Element type reference to submessage or enum definition, if needed.
  30585. * @type {ProtoBuf.Reflect.T|null}
  30586. */
  30587. this.resolvedType = resolvedType;
  30588. /**
  30589. * Element is a map key.
  30590. * @type {boolean}
  30591. */
  30592. this.isMapKey = isMapKey;
  30593. /**
  30594. * Syntax level of defining message type, e.g., proto2 or proto3.
  30595. * @type {string}
  30596. */
  30597. this.syntax = syntax;
  30598. if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
  30599. throw Error("Invalid map key type: " + type.name);
  30600. };
  30601. var ElementPrototype = Element.prototype;
  30602. /**
  30603. * Obtains a (new) default value for the specified type.
  30604. * @param type {string|{name: string, wireType: number}} Field type
  30605. * @returns {*} Default value
  30606. * @inner
  30607. */
  30608. function mkDefault(type) {
  30609. if (typeof type === 'string')
  30610. type = ProtoBuf.TYPES[type];
  30611. if (typeof type.defaultValue === 'undefined')
  30612. throw Error("default value for type "+type.name+" is not supported");
  30613. if (type == ProtoBuf.TYPES["bytes"])
  30614. return new ByteBuffer(0);
  30615. return type.defaultValue;
  30616. }
  30617. /**
  30618. * Returns the default value for this field in proto3.
  30619. * @function
  30620. * @param type {string|{name: string, wireType: number}} the field type
  30621. * @returns {*} Default value
  30622. */
  30623. Element.defaultFieldValue = mkDefault;
  30624. /**
  30625. * Makes a Long from a value.
  30626. * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
  30627. * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
  30628. * strings and numbers
  30629. * @returns {!Long}
  30630. * @throws {Error} If the value cannot be converted to a Long
  30631. * @inner
  30632. */
  30633. function mkLong(value, unsigned) {
  30634. if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
  30635. && value.low === value.low && value.high === value.high)
  30636. return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
  30637. if (typeof value === 'string')
  30638. return ProtoBuf.Long.fromString(value, unsigned || false, 10);
  30639. if (typeof value === 'number')
  30640. return ProtoBuf.Long.fromNumber(value, unsigned || false);
  30641. throw Error("not convertible to Long");
  30642. }
  30643. /**
  30644. * Checks if the given value can be set for an element of this type (singular
  30645. * field or one element of a repeated field or map).
  30646. * @param {*} value Value to check
  30647. * @return {*} Verified, maybe adjusted, value
  30648. * @throws {Error} If the value cannot be verified for this element slot
  30649. * @expose
  30650. */
  30651. ElementPrototype.verifyValue = function(value) {
  30652. var self = this;
  30653. function fail(val, msg) {
  30654. throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
  30655. }
  30656. switch (this.type) {
  30657. // Signed 32bit
  30658. case ProtoBuf.TYPES["int32"]:
  30659. case ProtoBuf.TYPES["sint32"]:
  30660. case ProtoBuf.TYPES["sfixed32"]:
  30661. // Account for !NaN: value === value
  30662. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  30663. fail(typeof value, "not an integer");
  30664. return value > 4294967295 ? value | 0 : value;
  30665. // Unsigned 32bit
  30666. case ProtoBuf.TYPES["uint32"]:
  30667. case ProtoBuf.TYPES["fixed32"]:
  30668. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  30669. fail(typeof value, "not an integer");
  30670. return value < 0 ? value >>> 0 : value;
  30671. // Signed 64bit
  30672. case ProtoBuf.TYPES["int64"]:
  30673. case ProtoBuf.TYPES["sint64"]:
  30674. case ProtoBuf.TYPES["sfixed64"]: {
  30675. if (ProtoBuf.Long)
  30676. try {
  30677. return mkLong(value, false);
  30678. } catch (e) {
  30679. fail(typeof value, e.message);
  30680. }
  30681. else
  30682. fail(typeof value, "requires Long.js");
  30683. }
  30684. // Unsigned 64bit
  30685. case ProtoBuf.TYPES["uint64"]:
  30686. case ProtoBuf.TYPES["fixed64"]: {
  30687. if (ProtoBuf.Long)
  30688. try {
  30689. return mkLong(value, true);
  30690. } catch (e) {
  30691. fail(typeof value, e.message);
  30692. }
  30693. else
  30694. fail(typeof value, "requires Long.js");
  30695. }
  30696. // Bool
  30697. case ProtoBuf.TYPES["bool"]:
  30698. if (typeof value !== 'boolean')
  30699. fail(typeof value, "not a boolean");
  30700. return value;
  30701. // Float
  30702. case ProtoBuf.TYPES["float"]:
  30703. case ProtoBuf.TYPES["double"]:
  30704. if (typeof value !== 'number')
  30705. fail(typeof value, "not a number");
  30706. return value;
  30707. // Length-delimited string
  30708. case ProtoBuf.TYPES["string"]:
  30709. if (typeof value !== 'string' && !(value && value instanceof String))
  30710. fail(typeof value, "not a string");
  30711. return ""+value; // Convert String object to string
  30712. // Length-delimited bytes
  30713. case ProtoBuf.TYPES["bytes"]:
  30714. if (ByteBuffer.isByteBuffer(value))
  30715. return value;
  30716. return ByteBuffer.wrap(value, "base64");
  30717. // Constant enum value
  30718. case ProtoBuf.TYPES["enum"]: {
  30719. var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
  30720. for (i=0; i<values.length; i++)
  30721. if (values[i].name == value)
  30722. return values[i].id;
  30723. else if (values[i].id == value)
  30724. return values[i].id;
  30725. if (this.syntax === 'proto3') {
  30726. // proto3: just make sure it's an integer.
  30727. if (typeof value !== 'number' || (value === value && value % 1 !== 0))
  30728. fail(typeof value, "not an integer");
  30729. if (value > 4294967295 || value < 0)
  30730. fail(typeof value, "not in range for uint32")
  30731. return value;
  30732. } else {
  30733. // proto2 requires enum values to be valid.
  30734. fail(value, "not a valid enum value");
  30735. }
  30736. }
  30737. // Embedded message
  30738. case ProtoBuf.TYPES["group"]:
  30739. case ProtoBuf.TYPES["message"]: {
  30740. if (!value || typeof value !== 'object')
  30741. fail(typeof value, "object expected");
  30742. if (value instanceof this.resolvedType.clazz)
  30743. return value;
  30744. if (value instanceof ProtoBuf.Builder.Message) {
  30745. // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
  30746. var obj = {};
  30747. for (var i in value)
  30748. if (value.hasOwnProperty(i))
  30749. obj[i] = value[i];
  30750. value = obj;
  30751. }
  30752. // Else let's try to construct one from a key-value object
  30753. return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
  30754. }
  30755. }
  30756. // We should never end here
  30757. throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
  30758. };
  30759. /**
  30760. * Calculates the byte length of an element on the wire.
  30761. * @param {number} id Field number
  30762. * @param {*} value Field value
  30763. * @returns {number} Byte length
  30764. * @throws {Error} If the value cannot be calculated
  30765. * @expose
  30766. */
  30767. ElementPrototype.calculateLength = function(id, value) {
  30768. if (value === null) return 0; // Nothing to encode
  30769. // Tag has already been written
  30770. var n;
  30771. switch (this.type) {
  30772. case ProtoBuf.TYPES["int32"]:
  30773. return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
  30774. case ProtoBuf.TYPES["uint32"]:
  30775. return ByteBuffer.calculateVarint32(value);
  30776. case ProtoBuf.TYPES["sint32"]:
  30777. return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
  30778. case ProtoBuf.TYPES["fixed32"]:
  30779. case ProtoBuf.TYPES["sfixed32"]:
  30780. case ProtoBuf.TYPES["float"]:
  30781. return 4;
  30782. case ProtoBuf.TYPES["int64"]:
  30783. case ProtoBuf.TYPES["uint64"]:
  30784. return ByteBuffer.calculateVarint64(value);
  30785. case ProtoBuf.TYPES["sint64"]:
  30786. return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
  30787. case ProtoBuf.TYPES["fixed64"]:
  30788. case ProtoBuf.TYPES["sfixed64"]:
  30789. return 8;
  30790. case ProtoBuf.TYPES["bool"]:
  30791. return 1;
  30792. case ProtoBuf.TYPES["enum"]:
  30793. return ByteBuffer.calculateVarint32(value);
  30794. case ProtoBuf.TYPES["double"]:
  30795. return 8;
  30796. case ProtoBuf.TYPES["string"]:
  30797. n = ByteBuffer.calculateUTF8Bytes(value);
  30798. return ByteBuffer.calculateVarint32(n) + n;
  30799. case ProtoBuf.TYPES["bytes"]:
  30800. if (value.remaining() < 0)
  30801. throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
  30802. return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
  30803. case ProtoBuf.TYPES["message"]:
  30804. n = this.resolvedType.calculate(value);
  30805. return ByteBuffer.calculateVarint32(n) + n;
  30806. case ProtoBuf.TYPES["group"]:
  30807. n = this.resolvedType.calculate(value);
  30808. return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
  30809. }
  30810. // We should never end here
  30811. throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
  30812. };
  30813. /**
  30814. * Encodes a value to the specified buffer. Does not encode the key.
  30815. * @param {number} id Field number
  30816. * @param {*} value Field value
  30817. * @param {ByteBuffer} buffer ByteBuffer to encode to
  30818. * @return {ByteBuffer} The ByteBuffer for chaining
  30819. * @throws {Error} If the value cannot be encoded
  30820. * @expose
  30821. */
  30822. ElementPrototype.encodeValue = function(id, value, buffer) {
  30823. if (value === null) return buffer; // Nothing to encode
  30824. // Tag has already been written
  30825. switch (this.type) {
  30826. // 32bit signed varint
  30827. case ProtoBuf.TYPES["int32"]:
  30828. // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
  30829. // long – it is, effectively, treated like a very large unsigned integer." (see #122)
  30830. if (value < 0)
  30831. buffer.writeVarint64(value);
  30832. else
  30833. buffer.writeVarint32(value);
  30834. break;
  30835. // 32bit unsigned varint
  30836. case ProtoBuf.TYPES["uint32"]:
  30837. buffer.writeVarint32(value);
  30838. break;
  30839. // 32bit varint zig-zag
  30840. case ProtoBuf.TYPES["sint32"]:
  30841. buffer.writeVarint32ZigZag(value);
  30842. break;
  30843. // Fixed unsigned 32bit
  30844. case ProtoBuf.TYPES["fixed32"]:
  30845. buffer.writeUint32(value);
  30846. break;
  30847. // Fixed signed 32bit
  30848. case ProtoBuf.TYPES["sfixed32"]:
  30849. buffer.writeInt32(value);
  30850. break;
  30851. // 64bit varint as-is
  30852. case ProtoBuf.TYPES["int64"]:
  30853. case ProtoBuf.TYPES["uint64"]:
  30854. buffer.writeVarint64(value); // throws
  30855. break;
  30856. // 64bit varint zig-zag
  30857. case ProtoBuf.TYPES["sint64"]:
  30858. buffer.writeVarint64ZigZag(value); // throws
  30859. break;
  30860. // Fixed unsigned 64bit
  30861. case ProtoBuf.TYPES["fixed64"]:
  30862. buffer.writeUint64(value); // throws
  30863. break;
  30864. // Fixed signed 64bit
  30865. case ProtoBuf.TYPES["sfixed64"]:
  30866. buffer.writeInt64(value); // throws
  30867. break;
  30868. // Bool
  30869. case ProtoBuf.TYPES["bool"]:
  30870. if (typeof value === 'string')
  30871. buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
  30872. else
  30873. buffer.writeVarint32(value ? 1 : 0);
  30874. break;
  30875. // Constant enum value
  30876. case ProtoBuf.TYPES["enum"]:
  30877. buffer.writeVarint32(value);
  30878. break;
  30879. // 32bit float
  30880. case ProtoBuf.TYPES["float"]:
  30881. buffer.writeFloat32(value);
  30882. break;
  30883. // 64bit float
  30884. case ProtoBuf.TYPES["double"]:
  30885. buffer.writeFloat64(value);
  30886. break;
  30887. // Length-delimited string
  30888. case ProtoBuf.TYPES["string"]:
  30889. buffer.writeVString(value);
  30890. break;
  30891. // Length-delimited bytes
  30892. case ProtoBuf.TYPES["bytes"]:
  30893. if (value.remaining() < 0)
  30894. throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
  30895. var prevOffset = value.offset;
  30896. buffer.writeVarint32(value.remaining());
  30897. buffer.append(value);
  30898. value.offset = prevOffset;
  30899. break;
  30900. // Embedded message
  30901. case ProtoBuf.TYPES["message"]:
  30902. var bb = new ByteBuffer().LE();
  30903. this.resolvedType.encode(value, bb);
  30904. buffer.writeVarint32(bb.offset);
  30905. buffer.append(bb.flip());
  30906. break;
  30907. // Legacy group
  30908. case ProtoBuf.TYPES["group"]:
  30909. this.resolvedType.encode(value, buffer);
  30910. buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
  30911. break;
  30912. default:
  30913. // We should never end here
  30914. throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
  30915. }
  30916. return buffer;
  30917. };
  30918. /**
  30919. * Decode one element value from the specified buffer.
  30920. * @param {ByteBuffer} buffer ByteBuffer to decode from
  30921. * @param {number} wireType The field wire type
  30922. * @param {number} id The field number
  30923. * @return {*} Decoded value
  30924. * @throws {Error} If the field cannot be decoded
  30925. * @expose
  30926. */
  30927. ElementPrototype.decode = function(buffer, wireType, id) {
  30928. if (wireType != this.type.wireType)
  30929. throw Error("Unexpected wire type for element");
  30930. var value, nBytes;
  30931. switch (this.type) {
  30932. // 32bit signed varint
  30933. case ProtoBuf.TYPES["int32"]:
  30934. return buffer.readVarint32() | 0;
  30935. // 32bit unsigned varint
  30936. case ProtoBuf.TYPES["uint32"]:
  30937. return buffer.readVarint32() >>> 0;
  30938. // 32bit signed varint zig-zag
  30939. case ProtoBuf.TYPES["sint32"]:
  30940. return buffer.readVarint32ZigZag() | 0;
  30941. // Fixed 32bit unsigned
  30942. case ProtoBuf.TYPES["fixed32"]:
  30943. return buffer.readUint32() >>> 0;
  30944. case ProtoBuf.TYPES["sfixed32"]:
  30945. return buffer.readInt32() | 0;
  30946. // 64bit signed varint
  30947. case ProtoBuf.TYPES["int64"]:
  30948. return buffer.readVarint64();
  30949. // 64bit unsigned varint
  30950. case ProtoBuf.TYPES["uint64"]:
  30951. return buffer.readVarint64().toUnsigned();
  30952. // 64bit signed varint zig-zag
  30953. case ProtoBuf.TYPES["sint64"]:
  30954. return buffer.readVarint64ZigZag();
  30955. // Fixed 64bit unsigned
  30956. case ProtoBuf.TYPES["fixed64"]:
  30957. return buffer.readUint64();
  30958. // Fixed 64bit signed
  30959. case ProtoBuf.TYPES["sfixed64"]:
  30960. return buffer.readInt64();
  30961. // Bool varint
  30962. case ProtoBuf.TYPES["bool"]:
  30963. return !!buffer.readVarint32();
  30964. // Constant enum value (varint)
  30965. case ProtoBuf.TYPES["enum"]:
  30966. // The following Builder.Message#set will already throw
  30967. return buffer.readVarint32();
  30968. // 32bit float
  30969. case ProtoBuf.TYPES["float"]:
  30970. return buffer.readFloat();
  30971. // 64bit float
  30972. case ProtoBuf.TYPES["double"]:
  30973. return buffer.readDouble();
  30974. // Length-delimited string
  30975. case ProtoBuf.TYPES["string"]:
  30976. return buffer.readVString();
  30977. // Length-delimited bytes
  30978. case ProtoBuf.TYPES["bytes"]: {
  30979. nBytes = buffer.readVarint32();
  30980. if (buffer.remaining() < nBytes)
  30981. throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
  30982. value = buffer.clone(); // Offset already set
  30983. value.limit = value.offset+nBytes;
  30984. buffer.offset += nBytes;
  30985. return value;
  30986. }
  30987. // Length-delimited embedded message
  30988. case ProtoBuf.TYPES["message"]: {
  30989. nBytes = buffer.readVarint32();
  30990. return this.resolvedType.decode(buffer, nBytes);
  30991. }
  30992. // Legacy group
  30993. case ProtoBuf.TYPES["group"]:
  30994. return this.resolvedType.decode(buffer, -1, id);
  30995. }
  30996. // We should never end here
  30997. throw Error("[INTERNAL] Illegal decode type");
  30998. };
  30999. /**
  31000. * Converts a value from a string to the canonical element type.
  31001. *
  31002. * Legal only when isMapKey is true.
  31003. *
  31004. * @param {string} str The string value
  31005. * @returns {*} The value
  31006. */
  31007. ElementPrototype.valueFromString = function(str) {
  31008. if (!this.isMapKey) {
  31009. throw Error("valueFromString() called on non-map-key element");
  31010. }
  31011. switch (this.type) {
  31012. case ProtoBuf.TYPES["int32"]:
  31013. case ProtoBuf.TYPES["sint32"]:
  31014. case ProtoBuf.TYPES["sfixed32"]:
  31015. case ProtoBuf.TYPES["uint32"]:
  31016. case ProtoBuf.TYPES["fixed32"]:
  31017. return this.verifyValue(parseInt(str));
  31018. case ProtoBuf.TYPES["int64"]:
  31019. case ProtoBuf.TYPES["sint64"]:
  31020. case ProtoBuf.TYPES["sfixed64"]:
  31021. case ProtoBuf.TYPES["uint64"]:
  31022. case ProtoBuf.TYPES["fixed64"]:
  31023. // Long-based fields support conversions from string already.
  31024. return this.verifyValue(str);
  31025. case ProtoBuf.TYPES["bool"]:
  31026. return str === "true";
  31027. case ProtoBuf.TYPES["string"]:
  31028. return this.verifyValue(str);
  31029. case ProtoBuf.TYPES["bytes"]:
  31030. return ByteBuffer.fromBinary(str);
  31031. }
  31032. };
  31033. /**
  31034. * Converts a value from the canonical element type to a string.
  31035. *
  31036. * It should be the case that `valueFromString(valueToString(val))` returns
  31037. * a value equivalent to `verifyValue(val)` for every legal value of `val`
  31038. * according to this element type.
  31039. *
  31040. * This may be used when the element must be stored or used as a string,
  31041. * e.g., as a map key on an Object.
  31042. *
  31043. * Legal only when isMapKey is true.
  31044. *
  31045. * @param {*} val The value
  31046. * @returns {string} The string form of the value.
  31047. */
  31048. ElementPrototype.valueToString = function(value) {
  31049. if (!this.isMapKey) {
  31050. throw Error("valueToString() called on non-map-key element");
  31051. }
  31052. if (this.type === ProtoBuf.TYPES["bytes"]) {
  31053. return value.toString("binary");
  31054. } else {
  31055. return value.toString();
  31056. }
  31057. };
  31058. /**
  31059. * @alias ProtoBuf.Reflect.Element
  31060. * @expose
  31061. */
  31062. Reflect.Element = Element;
  31063. /**
  31064. * Constructs a new Message.
  31065. * @exports ProtoBuf.Reflect.Message
  31066. * @param {!ProtoBuf.Builder} builder Builder reference
  31067. * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
  31068. * @param {string} name Message name
  31069. * @param {Object.<string,*>=} options Message options
  31070. * @param {boolean=} isGroup `true` if this is a legacy group
  31071. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  31072. * @constructor
  31073. * @extends ProtoBuf.Reflect.Namespace
  31074. */
  31075. var Message = function(builder, parent, name, options, isGroup, syntax) {
  31076. Namespace.call(this, builder, parent, name, options, syntax);
  31077. /**
  31078. * @override
  31079. */
  31080. this.className = "Message";
  31081. /**
  31082. * Extensions range.
  31083. * @type {!Array.<number>|undefined}
  31084. * @expose
  31085. */
  31086. this.extensions = undefined;
  31087. /**
  31088. * Runtime message class.
  31089. * @type {?function(new:ProtoBuf.Builder.Message)}
  31090. * @expose
  31091. */
  31092. this.clazz = null;
  31093. /**
  31094. * Whether this is a legacy group or not.
  31095. * @type {boolean}
  31096. * @expose
  31097. */
  31098. this.isGroup = !!isGroup;
  31099. // The following cached collections are used to efficiently iterate over or look up fields when decoding.
  31100. /**
  31101. * Cached fields.
  31102. * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
  31103. * @private
  31104. */
  31105. this._fields = null;
  31106. /**
  31107. * Cached fields by id.
  31108. * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
  31109. * @private
  31110. */
  31111. this._fieldsById = null;
  31112. /**
  31113. * Cached fields by name.
  31114. * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
  31115. * @private
  31116. */
  31117. this._fieldsByName = null;
  31118. };
  31119. /**
  31120. * @alias ProtoBuf.Reflect.Message.prototype
  31121. * @inner
  31122. */
  31123. var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
  31124. /**
  31125. * Builds the message and returns the runtime counterpart, which is a fully functional class.
  31126. * @see ProtoBuf.Builder.Message
  31127. * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
  31128. * @return {ProtoBuf.Reflect.Message} Message class
  31129. * @throws {Error} If the message cannot be built
  31130. * @expose
  31131. */
  31132. MessagePrototype.build = function(rebuild) {
  31133. if (this.clazz && !rebuild)
  31134. return this.clazz;
  31135. // Create the runtime Message class in its own scope
  31136. var clazz = (function(ProtoBuf, T) {
  31137. var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
  31138. oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
  31139. /**
  31140. * Constructs a new runtime Message.
  31141. * @name ProtoBuf.Builder.Message
  31142. * @class Barebone of all runtime messages.
  31143. * @param {!Object.<string,*>|string} values Preset values
  31144. * @param {...string} var_args
  31145. * @constructor
  31146. * @throws {Error} If the message cannot be created
  31147. */
  31148. var Message = function(values, var_args) {
  31149. ProtoBuf.Builder.Message.call(this);
  31150. // Create virtual oneof properties
  31151. for (var i=0, k=oneofs.length; i<k; ++i)
  31152. this[oneofs[i].name] = null;
  31153. // Create fields and set default values
  31154. for (i=0, k=fields.length; i<k; ++i) {
  31155. var field = fields[i];
  31156. this[field.name] =
  31157. field.repeated ? [] :
  31158. (field.map ? new ProtoBuf.Map(field) : null);
  31159. if ((field.required || T.syntax === 'proto3') &&
  31160. field.defaultValue !== null)
  31161. this[field.name] = field.defaultValue;
  31162. }
  31163. if (arguments.length > 0) {
  31164. var value;
  31165. // Set field values from a values object
  31166. if (arguments.length === 1 && values !== null && typeof values === 'object' &&
  31167. /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
  31168. /* not a repeated field */ !Array.isArray(values) &&
  31169. /* not a Map */ !(values instanceof ProtoBuf.Map) &&
  31170. /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
  31171. /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
  31172. /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
  31173. this.$set(values);
  31174. } else // Set field values from arguments, in declaration order
  31175. for (i=0, k=arguments.length; i<k; ++i)
  31176. if (typeof (value = arguments[i]) !== 'undefined')
  31177. this.$set(fields[i].name, value); // May throw
  31178. }
  31179. };
  31180. /**
  31181. * @alias ProtoBuf.Builder.Message.prototype
  31182. * @inner
  31183. */
  31184. var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
  31185. /**
  31186. * Adds a value to a repeated field.
  31187. * @name ProtoBuf.Builder.Message#add
  31188. * @function
  31189. * @param {string} key Field name
  31190. * @param {*} value Value to add
  31191. * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
  31192. * @returns {!ProtoBuf.Builder.Message} this
  31193. * @throws {Error} If the value cannot be added
  31194. * @expose
  31195. */
  31196. MessagePrototype.add = function(key, value, noAssert) {
  31197. var field = T._fieldsByName[key];
  31198. if (!noAssert) {
  31199. if (!field)
  31200. throw Error(this+"#"+key+" is undefined");
  31201. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  31202. throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
  31203. if (!field.repeated)
  31204. throw Error(this+"#"+key+" is not a repeated field");
  31205. value = field.verifyValue(value, true);
  31206. }
  31207. if (this[key] === null)
  31208. this[key] = [];
  31209. this[key].push(value);
  31210. return this;
  31211. };
  31212. /**
  31213. * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
  31214. * @name ProtoBuf.Builder.Message#$add
  31215. * @function
  31216. * @param {string} key Field name
  31217. * @param {*} value Value to add
  31218. * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
  31219. * @returns {!ProtoBuf.Builder.Message} this
  31220. * @throws {Error} If the value cannot be added
  31221. * @expose
  31222. */
  31223. MessagePrototype.$add = MessagePrototype.add;
  31224. /**
  31225. * Sets a field's value.
  31226. * @name ProtoBuf.Builder.Message#set
  31227. * @function
  31228. * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
  31229. * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
  31230. * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
  31231. * @returns {!ProtoBuf.Builder.Message} this
  31232. * @throws {Error} If the value cannot be set
  31233. * @expose
  31234. */
  31235. MessagePrototype.set = function(keyOrObj, value, noAssert) {
  31236. if (keyOrObj && typeof keyOrObj === 'object') {
  31237. noAssert = value;
  31238. for (var ikey in keyOrObj)
  31239. if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined')
  31240. this.$set(ikey, value, noAssert);
  31241. return this;
  31242. }
  31243. var field = T._fieldsByName[keyOrObj];
  31244. if (!noAssert) {
  31245. if (!field)
  31246. throw Error(this+"#"+keyOrObj+" is not a field: undefined");
  31247. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  31248. throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
  31249. this[field.name] = (value = field.verifyValue(value)); // May throw
  31250. } else
  31251. this[keyOrObj] = value;
  31252. if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
  31253. var currentField = this[field.oneof.name]; // Virtual field references currently set field
  31254. if (value !== null) {
  31255. if (currentField !== null && currentField !== field.name)
  31256. this[currentField] = null; // Clear currently set field
  31257. this[field.oneof.name] = field.name; // Point virtual field at this field
  31258. } else if (/* value === null && */currentField === keyOrObj)
  31259. this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
  31260. }
  31261. return this;
  31262. };
  31263. /**
  31264. * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
  31265. * @name ProtoBuf.Builder.Message#$set
  31266. * @function
  31267. * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
  31268. * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
  31269. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  31270. * @throws {Error} If the value cannot be set
  31271. * @expose
  31272. */
  31273. MessagePrototype.$set = MessagePrototype.set;
  31274. /**
  31275. * Gets a field's value.
  31276. * @name ProtoBuf.Builder.Message#get
  31277. * @function
  31278. * @param {string} key Key
  31279. * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
  31280. * @return {*} Value
  31281. * @throws {Error} If there is no such field
  31282. * @expose
  31283. */
  31284. MessagePrototype.get = function(key, noAssert) {
  31285. if (noAssert)
  31286. return this[key];
  31287. var field = T._fieldsByName[key];
  31288. if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
  31289. throw Error(this+"#"+key+" is not a field: undefined");
  31290. if (!(field instanceof ProtoBuf.Reflect.Message.Field))
  31291. throw Error(this+"#"+key+" is not a field: "+field.toString(true));
  31292. return this[field.name];
  31293. };
  31294. /**
  31295. * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
  31296. * @name ProtoBuf.Builder.Message#$get
  31297. * @function
  31298. * @param {string} key Key
  31299. * @return {*} Value
  31300. * @throws {Error} If there is no such field
  31301. * @expose
  31302. */
  31303. MessagePrototype.$get = MessagePrototype.get;
  31304. // Getters and setters
  31305. for (var i=0; i<fields.length; i++) {
  31306. var field = fields[i];
  31307. // no setters for extension fields as these are named by their fqn
  31308. if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
  31309. continue;
  31310. if (T.builder.options['populateAccessors'])
  31311. (function(field) {
  31312. // set/get[SomeValue]
  31313. var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
  31314. return match.toUpperCase().replace('_','');
  31315. });
  31316. Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
  31317. // set/get_[some_value] FIXME: Do we really need these?
  31318. var name = field.originalName.replace(/([A-Z])/g, function(match) {
  31319. return "_"+match;
  31320. });
  31321. /**
  31322. * The current field's unbound setter function.
  31323. * @function
  31324. * @param {*} value
  31325. * @param {boolean=} noAssert
  31326. * @returns {!ProtoBuf.Builder.Message}
  31327. * @inner
  31328. */
  31329. var setter = function(value, noAssert) {
  31330. this[field.name] = noAssert ? value : field.verifyValue(value);
  31331. return this;
  31332. };
  31333. /**
  31334. * The current field's unbound getter function.
  31335. * @function
  31336. * @returns {*}
  31337. * @inner
  31338. */
  31339. var getter = function() {
  31340. return this[field.name];
  31341. };
  31342. if (T.getChild("set"+Name) === null)
  31343. /**
  31344. * Sets a value. This method is present for each field, but only if there is no name conflict with
  31345. * another field.
  31346. * @name ProtoBuf.Builder.Message#set[SomeField]
  31347. * @function
  31348. * @param {*} value Value to set
  31349. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  31350. * @returns {!ProtoBuf.Builder.Message} this
  31351. * @abstract
  31352. * @throws {Error} If the value cannot be set
  31353. */
  31354. MessagePrototype["set"+Name] = setter;
  31355. if (T.getChild("set_"+name) === null)
  31356. /**
  31357. * Sets a value. This method is present for each field, but only if there is no name conflict with
  31358. * another field.
  31359. * @name ProtoBuf.Builder.Message#set_[some_field]
  31360. * @function
  31361. * @param {*} value Value to set
  31362. * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
  31363. * @returns {!ProtoBuf.Builder.Message} this
  31364. * @abstract
  31365. * @throws {Error} If the value cannot be set
  31366. */
  31367. MessagePrototype["set_"+name] = setter;
  31368. if (T.getChild("get"+Name) === null)
  31369. /**
  31370. * Gets a value. This method is present for each field, but only if there is no name conflict with
  31371. * another field.
  31372. * @name ProtoBuf.Builder.Message#get[SomeField]
  31373. * @function
  31374. * @abstract
  31375. * @return {*} The value
  31376. */
  31377. MessagePrototype["get"+Name] = getter;
  31378. if (T.getChild("get_"+name) === null)
  31379. /**
  31380. * Gets a value. This method is present for each field, but only if there is no name conflict with
  31381. * another field.
  31382. * @name ProtoBuf.Builder.Message#get_[some_field]
  31383. * @function
  31384. * @return {*} The value
  31385. * @abstract
  31386. */
  31387. MessagePrototype["get_"+name] = getter;
  31388. })(field);
  31389. }
  31390. // En-/decoding
  31391. /**
  31392. * Encodes the message.
  31393. * @name ProtoBuf.Builder.Message#$encode
  31394. * @function
  31395. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  31396. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  31397. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  31398. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31399. * returns the encoded ByteBuffer in the `encoded` property on the error.
  31400. * @expose
  31401. * @see ProtoBuf.Builder.Message#encode64
  31402. * @see ProtoBuf.Builder.Message#encodeHex
  31403. * @see ProtoBuf.Builder.Message#encodeAB
  31404. */
  31405. MessagePrototype.encode = function(buffer, noVerify) {
  31406. if (typeof buffer === 'boolean')
  31407. noVerify = buffer,
  31408. buffer = undefined;
  31409. var isNew = false;
  31410. if (!buffer)
  31411. buffer = new ByteBuffer(),
  31412. isNew = true;
  31413. var le = buffer.littleEndian;
  31414. try {
  31415. T.encode(this, buffer.LE(), noVerify);
  31416. return (isNew ? buffer.flip() : buffer).LE(le);
  31417. } catch (e) {
  31418. buffer.LE(le);
  31419. throw(e);
  31420. }
  31421. };
  31422. /**
  31423. * Encodes a message using the specified data payload.
  31424. * @param {!Object.<string,*>} data Data payload
  31425. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  31426. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  31427. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  31428. * @expose
  31429. */
  31430. Message.encode = function(data, buffer, noVerify) {
  31431. return new Message(data).encode(buffer, noVerify);
  31432. };
  31433. /**
  31434. * Calculates the byte length of the message.
  31435. * @name ProtoBuf.Builder.Message#calculate
  31436. * @function
  31437. * @returns {number} Byte length
  31438. * @throws {Error} If the message cannot be calculated or if required fields are missing.
  31439. * @expose
  31440. */
  31441. MessagePrototype.calculate = function() {
  31442. return T.calculate(this);
  31443. };
  31444. /**
  31445. * Encodes the varint32 length-delimited message.
  31446. * @name ProtoBuf.Builder.Message#encodeDelimited
  31447. * @function
  31448. * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
  31449. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  31450. * @return {!ByteBuffer} Encoded message as a ByteBuffer
  31451. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31452. * returns the encoded ByteBuffer in the `encoded` property on the error.
  31453. * @expose
  31454. */
  31455. MessagePrototype.encodeDelimited = function(buffer, noVerify) {
  31456. var isNew = false;
  31457. if (!buffer)
  31458. buffer = new ByteBuffer(),
  31459. isNew = true;
  31460. var enc = new ByteBuffer().LE();
  31461. T.encode(this, enc, noVerify).flip();
  31462. buffer.writeVarint32(enc.remaining());
  31463. buffer.append(enc);
  31464. return isNew ? buffer.flip() : buffer;
  31465. };
  31466. /**
  31467. * Directly encodes the message to an ArrayBuffer.
  31468. * @name ProtoBuf.Builder.Message#encodeAB
  31469. * @function
  31470. * @return {ArrayBuffer} Encoded message as ArrayBuffer
  31471. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31472. * returns the encoded ArrayBuffer in the `encoded` property on the error.
  31473. * @expose
  31474. */
  31475. MessagePrototype.encodeAB = function() {
  31476. try {
  31477. return this.encode().toArrayBuffer();
  31478. } catch (e) {
  31479. if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
  31480. throw(e);
  31481. }
  31482. };
  31483. /**
  31484. * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
  31485. * @name ProtoBuf.Builder.Message#toArrayBuffer
  31486. * @function
  31487. * @return {ArrayBuffer} Encoded message as ArrayBuffer
  31488. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31489. * returns the encoded ArrayBuffer in the `encoded` property on the error.
  31490. * @expose
  31491. */
  31492. MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
  31493. /**
  31494. * Directly encodes the message to a node Buffer.
  31495. * @name ProtoBuf.Builder.Message#encodeNB
  31496. * @function
  31497. * @return {!Buffer}
  31498. * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
  31499. * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
  31500. * @expose
  31501. */
  31502. MessagePrototype.encodeNB = function() {
  31503. try {
  31504. return this.encode().toBuffer();
  31505. } catch (e) {
  31506. if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
  31507. throw(e);
  31508. }
  31509. };
  31510. /**
  31511. * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
  31512. * @name ProtoBuf.Builder.Message#toBuffer
  31513. * @function
  31514. * @return {!Buffer}
  31515. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31516. * returns the encoded node Buffer in the `encoded` property on the error.
  31517. * @expose
  31518. */
  31519. MessagePrototype.toBuffer = MessagePrototype.encodeNB;
  31520. /**
  31521. * Directly encodes the message to a base64 encoded string.
  31522. * @name ProtoBuf.Builder.Message#encode64
  31523. * @function
  31524. * @return {string} Base64 encoded string
  31525. * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
  31526. * still returns the encoded base64 string in the `encoded` property on the error.
  31527. * @expose
  31528. */
  31529. MessagePrototype.encode64 = function() {
  31530. try {
  31531. return this.encode().toBase64();
  31532. } catch (e) {
  31533. if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
  31534. throw(e);
  31535. }
  31536. };
  31537. /**
  31538. * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
  31539. * @name ProtoBuf.Builder.Message#toBase64
  31540. * @function
  31541. * @return {string} Base64 encoded string
  31542. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31543. * returns the encoded base64 string in the `encoded` property on the error.
  31544. * @expose
  31545. */
  31546. MessagePrototype.toBase64 = MessagePrototype.encode64;
  31547. /**
  31548. * Directly encodes the message to a hex encoded string.
  31549. * @name ProtoBuf.Builder.Message#encodeHex
  31550. * @function
  31551. * @return {string} Hex encoded string
  31552. * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
  31553. * still returns the encoded hex string in the `encoded` property on the error.
  31554. * @expose
  31555. */
  31556. MessagePrototype.encodeHex = function() {
  31557. try {
  31558. return this.encode().toHex();
  31559. } catch (e) {
  31560. if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
  31561. throw(e);
  31562. }
  31563. };
  31564. /**
  31565. * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
  31566. * @name ProtoBuf.Builder.Message#toHex
  31567. * @function
  31568. * @return {string} Hex encoded string
  31569. * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
  31570. * returns the encoded hex string in the `encoded` property on the error.
  31571. * @expose
  31572. */
  31573. MessagePrototype.toHex = MessagePrototype.encodeHex;
  31574. /**
  31575. * Clones a message object or field value to a raw object.
  31576. * @param {*} obj Object to clone
  31577. * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
  31578. * @param {boolean} longsAsStrings Whether to encode longs as strings
  31579. * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
  31580. * @returns {*} Cloned object
  31581. * @inner
  31582. */
  31583. function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
  31584. if (obj === null || typeof obj !== 'object') {
  31585. // Convert enum values to their respective names
  31586. if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
  31587. var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
  31588. if (name !== null)
  31589. return name;
  31590. }
  31591. // Pass-through string, number, boolean, null...
  31592. return obj;
  31593. }
  31594. // Convert ByteBuffers to raw buffer or strings
  31595. if (ByteBuffer.isByteBuffer(obj))
  31596. return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
  31597. // Convert Longs to proper objects or strings
  31598. if (ProtoBuf.Long.isLong(obj))
  31599. return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
  31600. var clone;
  31601. // Clone arrays
  31602. if (Array.isArray(obj)) {
  31603. clone = [];
  31604. obj.forEach(function(v, k) {
  31605. clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
  31606. });
  31607. return clone;
  31608. }
  31609. clone = {};
  31610. // Convert maps to objects
  31611. if (obj instanceof ProtoBuf.Map) {
  31612. var it = obj.entries();
  31613. for (var e = it.next(); !e.done; e = it.next())
  31614. clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
  31615. return clone;
  31616. }
  31617. // Everything else is a non-null object
  31618. var type = obj.$type,
  31619. field = undefined;
  31620. for (var i in obj)
  31621. if (obj.hasOwnProperty(i)) {
  31622. if (type && (field = type.getChild(i)))
  31623. clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
  31624. else
  31625. clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
  31626. }
  31627. return clone;
  31628. }
  31629. /**
  31630. * Returns the message's raw payload.
  31631. * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
  31632. * @param {boolean} longsAsStrings Whether to encode longs as strings
  31633. * @returns {Object.<string,*>} Raw payload
  31634. * @expose
  31635. */
  31636. MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
  31637. return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
  31638. };
  31639. /**
  31640. * Encodes a message to JSON.
  31641. * @returns {string} JSON string
  31642. * @expose
  31643. */
  31644. MessagePrototype.encodeJSON = function() {
  31645. return JSON.stringify(
  31646. cloneRaw(this,
  31647. /* binary-as-base64 */ true,
  31648. /* longs-as-strings */ true,
  31649. this.$type
  31650. )
  31651. );
  31652. };
  31653. /**
  31654. * Decodes a message from the specified buffer or string.
  31655. * @name ProtoBuf.Builder.Message.decode
  31656. * @function
  31657. * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
  31658. * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
  31659. * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
  31660. * @return {!ProtoBuf.Builder.Message} Decoded message
  31661. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  31662. * returns the decoded message with missing fields in the `decoded` property on the error.
  31663. * @expose
  31664. * @see ProtoBuf.Builder.Message.decode64
  31665. * @see ProtoBuf.Builder.Message.decodeHex
  31666. */
  31667. Message.decode = function(buffer, length, enc) {
  31668. if (typeof length === 'string')
  31669. enc = length,
  31670. length = -1;
  31671. if (typeof buffer === 'string')
  31672. buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
  31673. buffer = ByteBuffer.isByteBuffer(buffer) ? buffer : ByteBuffer.wrap(buffer); // May throw
  31674. var le = buffer.littleEndian;
  31675. try {
  31676. var msg = T.decode(buffer.LE());
  31677. buffer.LE(le);
  31678. return msg;
  31679. } catch (e) {
  31680. buffer.LE(le);
  31681. throw(e);
  31682. }
  31683. };
  31684. /**
  31685. * Decodes a varint32 length-delimited message from the specified buffer or string.
  31686. * @name ProtoBuf.Builder.Message.decodeDelimited
  31687. * @function
  31688. * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
  31689. * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
  31690. * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
  31691. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  31692. * returns the decoded message with missing fields in the `decoded` property on the error.
  31693. * @expose
  31694. */
  31695. Message.decodeDelimited = function(buffer, enc) {
  31696. if (typeof buffer === 'string')
  31697. buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
  31698. buffer = ByteBuffer.isByteBuffer(buffer) ? buffer : ByteBuffer.wrap(buffer); // May throw
  31699. if (buffer.remaining() < 1)
  31700. return null;
  31701. var off = buffer.offset,
  31702. len = buffer.readVarint32();
  31703. if (buffer.remaining() < len) {
  31704. buffer.offset = off;
  31705. return null;
  31706. }
  31707. try {
  31708. var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
  31709. buffer.offset += len;
  31710. return msg;
  31711. } catch (err) {
  31712. buffer.offset += len;
  31713. throw err;
  31714. }
  31715. };
  31716. /**
  31717. * Decodes the message from the specified base64 encoded string.
  31718. * @name ProtoBuf.Builder.Message.decode64
  31719. * @function
  31720. * @param {string} str String to decode from
  31721. * @return {!ProtoBuf.Builder.Message} Decoded message
  31722. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  31723. * returns the decoded message with missing fields in the `decoded` property on the error.
  31724. * @expose
  31725. */
  31726. Message.decode64 = function(str) {
  31727. return Message.decode(str, "base64");
  31728. };
  31729. /**
  31730. * Decodes the message from the specified hex encoded string.
  31731. * @name ProtoBuf.Builder.Message.decodeHex
  31732. * @function
  31733. * @param {string} str String to decode from
  31734. * @return {!ProtoBuf.Builder.Message} Decoded message
  31735. * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
  31736. * returns the decoded message with missing fields in the `decoded` property on the error.
  31737. * @expose
  31738. */
  31739. Message.decodeHex = function(str) {
  31740. return Message.decode(str, "hex");
  31741. };
  31742. /**
  31743. * Decodes the message from a JSON string.
  31744. * @name ProtoBuf.Builder.Message.decodeJSON
  31745. * @function
  31746. * @param {string} str String to decode from
  31747. * @return {!ProtoBuf.Builder.Message} Decoded message
  31748. * @throws {Error} If the message cannot be decoded or if required fields are
  31749. * missing.
  31750. * @expose
  31751. */
  31752. Message.decodeJSON = function(str) {
  31753. return new Message(JSON.parse(str));
  31754. };
  31755. // Utility
  31756. /**
  31757. * Returns a string representation of this Message.
  31758. * @name ProtoBuf.Builder.Message#toString
  31759. * @function
  31760. * @return {string} String representation as of ".Fully.Qualified.MessageName"
  31761. * @expose
  31762. */
  31763. MessagePrototype.toString = function() {
  31764. return T.toString();
  31765. };
  31766. // Properties
  31767. /**
  31768. * Message options.
  31769. * @name ProtoBuf.Builder.Message.$options
  31770. * @type {Object.<string,*>}
  31771. * @expose
  31772. */
  31773. var $optionsS; // cc needs this
  31774. /**
  31775. * Message options.
  31776. * @name ProtoBuf.Builder.Message#$options
  31777. * @type {Object.<string,*>}
  31778. * @expose
  31779. */
  31780. var $options;
  31781. /**
  31782. * Reflection type.
  31783. * @name ProtoBuf.Builder.Message.$type
  31784. * @type {!ProtoBuf.Reflect.Message}
  31785. * @expose
  31786. */
  31787. var $typeS;
  31788. /**
  31789. * Reflection type.
  31790. * @name ProtoBuf.Builder.Message#$type
  31791. * @type {!ProtoBuf.Reflect.Message}
  31792. * @expose
  31793. */
  31794. var $type;
  31795. if (Object.defineProperty)
  31796. Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
  31797. Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
  31798. Object.defineProperty(Message, "$type", { "value": T }),
  31799. Object.defineProperty(MessagePrototype, "$type", { "value": T });
  31800. return Message;
  31801. })(ProtoBuf, this);
  31802. // Static enums and prototyped sub-messages / cached collections
  31803. this._fields = [];
  31804. this._fieldsById = {};
  31805. this._fieldsByName = {};
  31806. for (var i=0, k=this.children.length, child; i<k; i++) {
  31807. child = this.children[i];
  31808. if (child instanceof Enum || child instanceof Message || child instanceof Service) {
  31809. if (clazz.hasOwnProperty(child.name))
  31810. throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
  31811. clazz[child.name] = child.build();
  31812. } else if (child instanceof Message.Field)
  31813. child.build(),
  31814. this._fields.push(child),
  31815. this._fieldsById[child.id] = child,
  31816. this._fieldsByName[child.name] = child;
  31817. else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
  31818. throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
  31819. }
  31820. return this.clazz = clazz;
  31821. };
  31822. /**
  31823. * Encodes a runtime message's contents to the specified buffer.
  31824. * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
  31825. * @param {ByteBuffer} buffer ByteBuffer to write to
  31826. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
  31827. * @return {ByteBuffer} The ByteBuffer for chaining
  31828. * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
  31829. * @expose
  31830. */
  31831. MessagePrototype.encode = function(message, buffer, noVerify) {
  31832. var fieldMissing = null,
  31833. field;
  31834. for (var i=0, k=this._fields.length, val; i<k; ++i) {
  31835. field = this._fields[i];
  31836. val = message[field.name];
  31837. if (field.required && val === null) {
  31838. if (fieldMissing === null)
  31839. fieldMissing = field;
  31840. } else
  31841. field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
  31842. }
  31843. if (fieldMissing !== null) {
  31844. var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
  31845. err["encoded"] = buffer; // Still expose what we got
  31846. throw(err);
  31847. }
  31848. return buffer;
  31849. };
  31850. /**
  31851. * Calculates a runtime message's byte length.
  31852. * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
  31853. * @returns {number} Byte length
  31854. * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
  31855. * @expose
  31856. */
  31857. MessagePrototype.calculate = function(message) {
  31858. for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
  31859. field = this._fields[i];
  31860. val = message[field.name];
  31861. if (field.required && val === null)
  31862. throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
  31863. else
  31864. n += field.calculate(val, message);
  31865. }
  31866. return n;
  31867. };
  31868. /**
  31869. * Skips all data until the end of the specified group has been reached.
  31870. * @param {number} expectedId Expected GROUPEND id
  31871. * @param {!ByteBuffer} buf ByteBuffer
  31872. * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
  31873. * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
  31874. * @inner
  31875. */
  31876. function skipTillGroupEnd(expectedId, buf) {
  31877. var tag = buf.readVarint32(), // Throws on OOB
  31878. wireType = tag & 0x07,
  31879. id = tag >>> 3;
  31880. switch (wireType) {
  31881. case ProtoBuf.WIRE_TYPES.VARINT:
  31882. do tag = buf.readUint8();
  31883. while ((tag & 0x80) === 0x80);
  31884. break;
  31885. case ProtoBuf.WIRE_TYPES.BITS64:
  31886. buf.offset += 8;
  31887. break;
  31888. case ProtoBuf.WIRE_TYPES.LDELIM:
  31889. tag = buf.readVarint32(); // reads the varint
  31890. buf.offset += tag; // skips n bytes
  31891. break;
  31892. case ProtoBuf.WIRE_TYPES.STARTGROUP:
  31893. skipTillGroupEnd(id, buf);
  31894. break;
  31895. case ProtoBuf.WIRE_TYPES.ENDGROUP:
  31896. if (id === expectedId)
  31897. return false;
  31898. else
  31899. throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
  31900. case ProtoBuf.WIRE_TYPES.BITS32:
  31901. buf.offset += 4;
  31902. break;
  31903. default:
  31904. throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
  31905. }
  31906. return true;
  31907. }
  31908. /**
  31909. * Decodes an encoded message and returns the decoded message.
  31910. * @param {ByteBuffer} buffer ByteBuffer to decode from
  31911. * @param {number=} length Message length. Defaults to decode all remaining data.
  31912. * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
  31913. * @return {ProtoBuf.Builder.Message} Decoded message
  31914. * @throws {Error} If the message cannot be decoded
  31915. * @expose
  31916. */
  31917. MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
  31918. length = typeof length === 'number' ? length : -1;
  31919. var start = buffer.offset,
  31920. msg = new (this.clazz)(),
  31921. tag, wireType, id, field;
  31922. while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
  31923. tag = buffer.readVarint32();
  31924. wireType = tag & 0x07;
  31925. id = tag >>> 3;
  31926. if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
  31927. if (id !== expectedGroupEndId)
  31928. throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
  31929. break;
  31930. }
  31931. if (!(field = this._fieldsById[id])) {
  31932. // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
  31933. switch (wireType) {
  31934. case ProtoBuf.WIRE_TYPES.VARINT:
  31935. buffer.readVarint32();
  31936. break;
  31937. case ProtoBuf.WIRE_TYPES.BITS32:
  31938. buffer.offset += 4;
  31939. break;
  31940. case ProtoBuf.WIRE_TYPES.BITS64:
  31941. buffer.offset += 8;
  31942. break;
  31943. case ProtoBuf.WIRE_TYPES.LDELIM:
  31944. var len = buffer.readVarint32();
  31945. buffer.offset += len;
  31946. break;
  31947. case ProtoBuf.WIRE_TYPES.STARTGROUP:
  31948. while (skipTillGroupEnd(id, buffer)) {}
  31949. break;
  31950. default:
  31951. throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
  31952. }
  31953. continue;
  31954. }
  31955. if (field.repeated && !field.options["packed"]) {
  31956. msg[field.name].push(field.decode(wireType, buffer));
  31957. } else if (field.map) {
  31958. var keyval = field.decode(wireType, buffer);
  31959. msg[field.name].set(keyval[0], keyval[1]);
  31960. } else {
  31961. msg[field.name] = field.decode(wireType, buffer);
  31962. if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
  31963. var currentField = msg[field.oneof.name]; // Virtual field references currently set field
  31964. if (currentField !== null && currentField !== field.name)
  31965. msg[currentField] = null; // Clear currently set field
  31966. msg[field.oneof.name] = field.name; // Point virtual field at this field
  31967. }
  31968. }
  31969. }
  31970. // Check if all required fields are present and set default values for optional fields that are not
  31971. for (var i=0, k=this._fields.length; i<k; ++i) {
  31972. field = this._fields[i];
  31973. if (msg[field.name] === null) {
  31974. if (this.syntax === "proto3") { // Proto3 sets default values by specification
  31975. msg[field.name] = field.defaultValue;
  31976. } else if (field.required) {
  31977. var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
  31978. err["decoded"] = msg; // Still expose what we got
  31979. throw(err);
  31980. } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
  31981. msg[field.name] = field.defaultValue;
  31982. }
  31983. }
  31984. return msg;
  31985. };
  31986. /**
  31987. * @alias ProtoBuf.Reflect.Message
  31988. * @expose
  31989. */
  31990. Reflect.Message = Message;
  31991. /**
  31992. * Constructs a new Message Field.
  31993. * @exports ProtoBuf.Reflect.Message.Field
  31994. * @param {!ProtoBuf.Builder} builder Builder reference
  31995. * @param {!ProtoBuf.Reflect.Message} message Message reference
  31996. * @param {string} rule Rule, one of requried, optional, repeated
  31997. * @param {string?} keytype Key data type, if any.
  31998. * @param {string} type Data type, e.g. int32
  31999. * @param {string} name Field name
  32000. * @param {number} id Unique field id
  32001. * @param {Object.<string,*>=} options Options
  32002. * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
  32003. * @param {string?} syntax The syntax level of this definition (e.g., proto3)
  32004. * @constructor
  32005. * @extends ProtoBuf.Reflect.T
  32006. */
  32007. var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
  32008. T.call(this, builder, message, name);
  32009. /**
  32010. * @override
  32011. */
  32012. this.className = "Message.Field";
  32013. /**
  32014. * Message field required flag.
  32015. * @type {boolean}
  32016. * @expose
  32017. */
  32018. this.required = rule === "required";
  32019. /**
  32020. * Message field repeated flag.
  32021. * @type {boolean}
  32022. * @expose
  32023. */
  32024. this.repeated = rule === "repeated";
  32025. /**
  32026. * Message field map flag.
  32027. * @type {boolean}
  32028. * @expose
  32029. */
  32030. this.map = rule === "map";
  32031. /**
  32032. * Message field key type. Type reference string if unresolved, protobuf
  32033. * type if resolved. Valid only if this.map === true, null otherwise.
  32034. * @type {string|{name: string, wireType: number}|null}
  32035. * @expose
  32036. */
  32037. this.keyType = keytype || null;
  32038. /**
  32039. * Message field type. Type reference string if unresolved, protobuf type if
  32040. * resolved. In a map field, this is the value type.
  32041. * @type {string|{name: string, wireType: number}}
  32042. * @expose
  32043. */
  32044. this.type = type;
  32045. /**
  32046. * Resolved type reference inside the global namespace.
  32047. * @type {ProtoBuf.Reflect.T|null}
  32048. * @expose
  32049. */
  32050. this.resolvedType = null;
  32051. /**
  32052. * Unique message field id.
  32053. * @type {number}
  32054. * @expose
  32055. */
  32056. this.id = id;
  32057. /**
  32058. * Message field options.
  32059. * @type {!Object.<string,*>}
  32060. * @dict
  32061. * @expose
  32062. */
  32063. this.options = options || {};
  32064. /**
  32065. * Default value.
  32066. * @type {*}
  32067. * @expose
  32068. */
  32069. this.defaultValue = null;
  32070. /**
  32071. * Enclosing OneOf.
  32072. * @type {?ProtoBuf.Reflect.Message.OneOf}
  32073. * @expose
  32074. */
  32075. this.oneof = oneof || null;
  32076. /**
  32077. * Syntax level of this definition (e.g., proto3).
  32078. * @type {string}
  32079. * @expose
  32080. */
  32081. this.syntax = syntax || 'proto2';
  32082. /**
  32083. * Original field name.
  32084. * @type {string}
  32085. * @expose
  32086. */
  32087. this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
  32088. /**
  32089. * Element implementation. Created in build() after types are resolved.
  32090. * @type {ProtoBuf.Element}
  32091. * @expose
  32092. */
  32093. this.element = null;
  32094. /**
  32095. * Key element implementation, for map fields. Created in build() after
  32096. * types are resolved.
  32097. * @type {ProtoBuf.Element}
  32098. * @expose
  32099. */
  32100. this.keyElement = null;
  32101. // Convert field names to camel case notation if the override is set
  32102. if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
  32103. this.name = ProtoBuf.Util.toCamelCase(this.name);
  32104. };
  32105. /**
  32106. * @alias ProtoBuf.Reflect.Message.Field.prototype
  32107. * @inner
  32108. */
  32109. var FieldPrototype = Field.prototype = Object.create(T.prototype);
  32110. /**
  32111. * Builds the field.
  32112. * @override
  32113. * @expose
  32114. */
  32115. FieldPrototype.build = function() {
  32116. this.element = new Element(this.type, this.resolvedType, false, this.syntax);
  32117. if (this.map)
  32118. this.keyElement = new Element(this.keyType, undefined, true, this.syntax);
  32119. // In proto3, fields do not have field presence, and every field is set to
  32120. // its type's default value ("", 0, 0.0, or false).
  32121. if (this.syntax === 'proto3' && !this.repeated && !this.map)
  32122. this.defaultValue = Element.defaultFieldValue(this.type);
  32123. // Otherwise, default values are present when explicitly specified
  32124. else if (typeof this.options['default'] !== 'undefined')
  32125. this.defaultValue = this.verifyValue(this.options['default']);
  32126. };
  32127. /**
  32128. * Checks if the given value can be set for this field.
  32129. * @param {*} value Value to check
  32130. * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
  32131. * @return {*} Verified, maybe adjusted, value
  32132. * @throws {Error} If the value cannot be set for this field
  32133. * @expose
  32134. */
  32135. FieldPrototype.verifyValue = function(value, skipRepeated) {
  32136. skipRepeated = skipRepeated || false;
  32137. var self = this;
  32138. function fail(val, msg) {
  32139. throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
  32140. }
  32141. if (value === null) { // NULL values for optional fields
  32142. if (this.required)
  32143. fail(typeof value, "required");
  32144. if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
  32145. fail(typeof value, "proto3 field without field presence cannot be null");
  32146. return null;
  32147. }
  32148. var i;
  32149. if (this.repeated && !skipRepeated) { // Repeated values as arrays
  32150. if (!Array.isArray(value))
  32151. value = [value];
  32152. var res = [];
  32153. for (i=0; i<value.length; i++)
  32154. res.push(this.element.verifyValue(value[i]));
  32155. return res;
  32156. }
  32157. if (this.map && !skipRepeated) { // Map values as objects
  32158. if (!(value instanceof ProtoBuf.Map)) {
  32159. // If not already a Map, attempt to convert.
  32160. if (!(value instanceof Object)) {
  32161. fail(typeof value,
  32162. "expected ProtoBuf.Map or raw object for map field");
  32163. }
  32164. return new ProtoBuf.Map(this, value);
  32165. } else {
  32166. return value;
  32167. }
  32168. }
  32169. // All non-repeated fields expect no array
  32170. if (!this.repeated && Array.isArray(value))
  32171. fail(typeof value, "no array expected");
  32172. return this.element.verifyValue(value);
  32173. };
  32174. /**
  32175. * Determines whether the field will have a presence on the wire given its
  32176. * value.
  32177. * @param {*} value Verified field value
  32178. * @param {!ProtoBuf.Builder.Message} message Runtime message
  32179. * @return {boolean} Whether the field will be present on the wire
  32180. */
  32181. FieldPrototype.hasWirePresence = function(value, message) {
  32182. if (this.syntax !== 'proto3')
  32183. return (value !== null);
  32184. if (this.oneof && message[this.oneof.name] === this.name)
  32185. return true;
  32186. switch (this.type) {
  32187. case ProtoBuf.TYPES["int32"]:
  32188. case ProtoBuf.TYPES["sint32"]:
  32189. case ProtoBuf.TYPES["sfixed32"]:
  32190. case ProtoBuf.TYPES["uint32"]:
  32191. case ProtoBuf.TYPES["fixed32"]:
  32192. return value !== 0;
  32193. case ProtoBuf.TYPES["int64"]:
  32194. case ProtoBuf.TYPES["sint64"]:
  32195. case ProtoBuf.TYPES["sfixed64"]:
  32196. case ProtoBuf.TYPES["uint64"]:
  32197. case ProtoBuf.TYPES["fixed64"]:
  32198. return value.low !== 0 || value.high !== 0;
  32199. case ProtoBuf.TYPES["bool"]:
  32200. return value;
  32201. case ProtoBuf.TYPES["float"]:
  32202. case ProtoBuf.TYPES["double"]:
  32203. return value !== 0.0;
  32204. case ProtoBuf.TYPES["string"]:
  32205. return value.length > 0;
  32206. case ProtoBuf.TYPES["bytes"]:
  32207. return value.remaining() > 0;
  32208. case ProtoBuf.TYPES["enum"]:
  32209. return value !== 0;
  32210. case ProtoBuf.TYPES["message"]:
  32211. return value !== null;
  32212. default:
  32213. return true;
  32214. }
  32215. };
  32216. /**
  32217. * Encodes the specified field value to the specified buffer.
  32218. * @param {*} value Verified field value
  32219. * @param {ByteBuffer} buffer ByteBuffer to encode to
  32220. * @param {!ProtoBuf.Builder.Message} message Runtime message
  32221. * @return {ByteBuffer} The ByteBuffer for chaining
  32222. * @throws {Error} If the field cannot be encoded
  32223. * @expose
  32224. */
  32225. FieldPrototype.encode = function(value, buffer, message) {
  32226. if (this.type === null || typeof this.type !== 'object')
  32227. throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
  32228. if (value === null || (this.repeated && value.length == 0))
  32229. return buffer; // Optional omitted
  32230. try {
  32231. if (this.repeated) {
  32232. var i;
  32233. // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
  32234. // types) can be declared 'packed'."
  32235. if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  32236. // "All of the elements of the field are packed into a single key-value pair with wire type 2
  32237. // (length-delimited). Each element is encoded the same way it would be normally, except without a
  32238. // tag preceding it."
  32239. buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  32240. buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
  32241. var start = buffer.offset; // Remember where the contents begin
  32242. for (i=0; i<value.length; i++)
  32243. this.element.encodeValue(this.id, value[i], buffer);
  32244. var len = buffer.offset-start,
  32245. varintLen = ByteBuffer.calculateVarint32(len);
  32246. if (varintLen > 1) { // We need to move the contents
  32247. var contents = buffer.slice(start, buffer.offset);
  32248. start += varintLen-1;
  32249. buffer.offset = start;
  32250. buffer.append(contents);
  32251. }
  32252. buffer.writeVarint32(len, start-varintLen);
  32253. } else {
  32254. // "If your message definition has repeated elements (without the [packed=true] option), the encoded
  32255. // message has zero or more key-value pairs with the same tag number"
  32256. for (i=0; i<value.length; i++)
  32257. buffer.writeVarint32((this.id << 3) | this.type.wireType),
  32258. this.element.encodeValue(this.id, value[i], buffer);
  32259. }
  32260. } else if (this.map) {
  32261. // Write out each map entry as a submessage.
  32262. value.forEach(function(val, key, m) {
  32263. // Compute the length of the submessage (key, val) pair.
  32264. var length =
  32265. ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
  32266. this.keyElement.calculateLength(1, key) +
  32267. ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
  32268. this.element.calculateLength(2, val);
  32269. // Submessage with wire type of length-delimited.
  32270. buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  32271. buffer.writeVarint32(length);
  32272. // Write out the key and val.
  32273. buffer.writeVarint32((1 << 3) | this.keyType.wireType);
  32274. this.keyElement.encodeValue(1, key, buffer);
  32275. buffer.writeVarint32((2 << 3) | this.type.wireType);
  32276. this.element.encodeValue(2, val, buffer);
  32277. }, this);
  32278. } else {
  32279. if (this.hasWirePresence(value, message)) {
  32280. buffer.writeVarint32((this.id << 3) | this.type.wireType);
  32281. this.element.encodeValue(this.id, value, buffer);
  32282. }
  32283. }
  32284. } catch (e) {
  32285. throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
  32286. }
  32287. return buffer;
  32288. };
  32289. /**
  32290. * Calculates the length of this field's value on the network level.
  32291. * @param {*} value Field value
  32292. * @param {!ProtoBuf.Builder.Message} message Runtime message
  32293. * @returns {number} Byte length
  32294. * @expose
  32295. */
  32296. FieldPrototype.calculate = function(value, message) {
  32297. value = this.verifyValue(value); // May throw
  32298. if (this.type === null || typeof this.type !== 'object')
  32299. throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
  32300. if (value === null || (this.repeated && value.length == 0))
  32301. return 0; // Optional omitted
  32302. var n = 0;
  32303. try {
  32304. if (this.repeated) {
  32305. var i, ni;
  32306. if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  32307. n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  32308. ni = 0;
  32309. for (i=0; i<value.length; i++)
  32310. ni += this.element.calculateLength(this.id, value[i]);
  32311. n += ByteBuffer.calculateVarint32(ni);
  32312. n += ni;
  32313. } else {
  32314. for (i=0; i<value.length; i++)
  32315. n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
  32316. n += this.element.calculateLength(this.id, value[i]);
  32317. }
  32318. } else if (this.map) {
  32319. // Each map entry becomes a submessage.
  32320. value.forEach(function(val, key, m) {
  32321. // Compute the length of the submessage (key, val) pair.
  32322. var length =
  32323. ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
  32324. this.keyElement.calculateLength(1, key) +
  32325. ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
  32326. this.element.calculateLength(2, val);
  32327. n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
  32328. n += ByteBuffer.calculateVarint32(length);
  32329. n += length;
  32330. }, this);
  32331. } else {
  32332. if (this.hasWirePresence(value, message)) {
  32333. n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
  32334. n += this.element.calculateLength(this.id, value);
  32335. }
  32336. }
  32337. } catch (e) {
  32338. throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
  32339. }
  32340. return n;
  32341. };
  32342. /**
  32343. * Decode the field value from the specified buffer.
  32344. * @param {number} wireType Leading wire type
  32345. * @param {ByteBuffer} buffer ByteBuffer to decode from
  32346. * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
  32347. * @return {*} Decoded value: array for packed repeated fields, [key, value] for
  32348. * map fields, or an individual value otherwise.
  32349. * @throws {Error} If the field cannot be decoded
  32350. * @expose
  32351. */
  32352. FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
  32353. var value, nBytes;
  32354. // We expect wireType to match the underlying type's wireType unless we see
  32355. // a packed repeated field, or unless this is a map field.
  32356. var wireTypeOK =
  32357. (!this.map && wireType == this.type.wireType) ||
  32358. (!skipRepeated && this.repeated && this.options["packed"] &&
  32359. wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
  32360. (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
  32361. if (!wireTypeOK)
  32362. throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
  32363. // Handle packed repeated fields.
  32364. if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
  32365. if (!skipRepeated) {
  32366. nBytes = buffer.readVarint32();
  32367. nBytes = buffer.offset + nBytes; // Limit
  32368. var values = [];
  32369. while (buffer.offset < nBytes)
  32370. values.push(this.decode(this.type.wireType, buffer, true));
  32371. return values;
  32372. }
  32373. // Read the next value otherwise...
  32374. }
  32375. // Handle maps.
  32376. if (this.map) {
  32377. // Read one (key, value) submessage, and return [key, value]
  32378. var key = Element.defaultFieldValue(this.keyType);
  32379. value = Element.defaultFieldValue(this.type);
  32380. // Read the length
  32381. nBytes = buffer.readVarint32();
  32382. if (buffer.remaining() < nBytes)
  32383. throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
  32384. // Get a sub-buffer of this key/value submessage
  32385. var msgbuf = buffer.clone();
  32386. msgbuf.limit = msgbuf.offset + nBytes;
  32387. buffer.offset += nBytes;
  32388. while (msgbuf.remaining() > 0) {
  32389. var tag = msgbuf.readVarint32();
  32390. wireType = tag & 0x07;
  32391. var id = tag >>> 3;
  32392. if (id === 1) {
  32393. key = this.keyElement.decode(msgbuf, wireType, id);
  32394. } else if (id === 2) {
  32395. value = this.element.decode(msgbuf, wireType, id);
  32396. } else {
  32397. throw Error("Unexpected tag in map field key/value submessage");
  32398. }
  32399. }
  32400. return [key, value];
  32401. }
  32402. // Handle singular and non-packed repeated field values.
  32403. return this.element.decode(buffer, wireType, this.id);
  32404. };
  32405. /**
  32406. * @alias ProtoBuf.Reflect.Message.Field
  32407. * @expose
  32408. */
  32409. Reflect.Message.Field = Field;
  32410. /**
  32411. * Constructs a new Message ExtensionField.
  32412. * @exports ProtoBuf.Reflect.Message.ExtensionField
  32413. * @param {!ProtoBuf.Builder} builder Builder reference
  32414. * @param {!ProtoBuf.Reflect.Message} message Message reference
  32415. * @param {string} rule Rule, one of requried, optional, repeated
  32416. * @param {string} type Data type, e.g. int32
  32417. * @param {string} name Field name
  32418. * @param {number} id Unique field id
  32419. * @param {!Object.<string,*>=} options Options
  32420. * @constructor
  32421. * @extends ProtoBuf.Reflect.Message.Field
  32422. */
  32423. var ExtensionField = function(builder, message, rule, type, name, id, options) {
  32424. Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
  32425. /**
  32426. * Extension reference.
  32427. * @type {!ProtoBuf.Reflect.Extension}
  32428. * @expose
  32429. */
  32430. this.extension;
  32431. };
  32432. // Extends Field
  32433. ExtensionField.prototype = Object.create(Field.prototype);
  32434. /**
  32435. * @alias ProtoBuf.Reflect.Message.ExtensionField
  32436. * @expose
  32437. */
  32438. Reflect.Message.ExtensionField = ExtensionField;
  32439. /**
  32440. * Constructs a new Message OneOf.
  32441. * @exports ProtoBuf.Reflect.Message.OneOf
  32442. * @param {!ProtoBuf.Builder} builder Builder reference
  32443. * @param {!ProtoBuf.Reflect.Message} message Message reference
  32444. * @param {string} name OneOf name
  32445. * @constructor
  32446. * @extends ProtoBuf.Reflect.T
  32447. */
  32448. var OneOf = function(builder, message, name) {
  32449. T.call(this, builder, message, name);
  32450. /**
  32451. * Enclosed fields.
  32452. * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
  32453. * @expose
  32454. */
  32455. this.fields = [];
  32456. };
  32457. /**
  32458. * @alias ProtoBuf.Reflect.Message.OneOf
  32459. * @expose
  32460. */
  32461. Reflect.Message.OneOf = OneOf;
  32462. /**
  32463. * Constructs a new Enum.
  32464. * @exports ProtoBuf.Reflect.Enum
  32465. * @param {!ProtoBuf.Builder} builder Builder reference
  32466. * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
  32467. * @param {string} name Enum name
  32468. * @param {Object.<string,*>=} options Enum options
  32469. * @param {string?} syntax The syntax level (e.g., proto3)
  32470. * @constructor
  32471. * @extends ProtoBuf.Reflect.Namespace
  32472. */
  32473. var Enum = function(builder, parent, name, options, syntax) {
  32474. Namespace.call(this, builder, parent, name, options, syntax);
  32475. /**
  32476. * @override
  32477. */
  32478. this.className = "Enum";
  32479. /**
  32480. * Runtime enum object.
  32481. * @type {Object.<string,number>|null}
  32482. * @expose
  32483. */
  32484. this.object = null;
  32485. };
  32486. /**
  32487. * Gets the string name of an enum value.
  32488. * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
  32489. * @param {number} value Enum value
  32490. * @returns {?string} Name or `null` if not present
  32491. * @expose
  32492. */
  32493. Enum.getName = function(enm, value) {
  32494. var keys = Object.keys(enm);
  32495. for (var i=0, key; i<keys.length; ++i)
  32496. if (enm[key = keys[i]] === value)
  32497. return key;
  32498. return null;
  32499. };
  32500. /**
  32501. * @alias ProtoBuf.Reflect.Enum.prototype
  32502. * @inner
  32503. */
  32504. var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
  32505. /**
  32506. * Builds this enum and returns the runtime counterpart.
  32507. * @param {boolean} rebuild Whether to rebuild or not, defaults to false
  32508. * @returns {!Object.<string,number>}
  32509. * @expose
  32510. */
  32511. EnumPrototype.build = function(rebuild) {
  32512. if (this.object && !rebuild)
  32513. return this.object;
  32514. var enm = new ProtoBuf.Builder.Enum(),
  32515. values = this.getChildren(Enum.Value);
  32516. for (var i=0, k=values.length; i<k; ++i)
  32517. enm[values[i]['name']] = values[i]['id'];
  32518. if (Object.defineProperty)
  32519. Object.defineProperty(enm, '$options', {
  32520. "value": this.buildOpt(),
  32521. "enumerable": false
  32522. });
  32523. return this.object = enm;
  32524. };
  32525. /**
  32526. * @alias ProtoBuf.Reflect.Enum
  32527. * @expose
  32528. */
  32529. Reflect.Enum = Enum;
  32530. /**
  32531. * Constructs a new Enum Value.
  32532. * @exports ProtoBuf.Reflect.Enum.Value
  32533. * @param {!ProtoBuf.Builder} builder Builder reference
  32534. * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
  32535. * @param {string} name Field name
  32536. * @param {number} id Unique field id
  32537. * @constructor
  32538. * @extends ProtoBuf.Reflect.T
  32539. */
  32540. var Value = function(builder, enm, name, id) {
  32541. T.call(this, builder, enm, name);
  32542. /**
  32543. * @override
  32544. */
  32545. this.className = "Enum.Value";
  32546. /**
  32547. * Unique enum value id.
  32548. * @type {number}
  32549. * @expose
  32550. */
  32551. this.id = id;
  32552. };
  32553. // Extends T
  32554. Value.prototype = Object.create(T.prototype);
  32555. /**
  32556. * @alias ProtoBuf.Reflect.Enum.Value
  32557. * @expose
  32558. */
  32559. Reflect.Enum.Value = Value;
  32560. /**
  32561. * An extension (field).
  32562. * @exports ProtoBuf.Reflect.Extension
  32563. * @constructor
  32564. * @param {!ProtoBuf.Builder} builder Builder reference
  32565. * @param {!ProtoBuf.Reflect.T} parent Parent object
  32566. * @param {string} name Object name
  32567. * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
  32568. */
  32569. var Extension = function(builder, parent, name, field) {
  32570. T.call(this, builder, parent, name);
  32571. /**
  32572. * Extended message field.
  32573. * @type {!ProtoBuf.Reflect.Message.Field}
  32574. * @expose
  32575. */
  32576. this.field = field;
  32577. };
  32578. // Extends T
  32579. Extension.prototype = Object.create(T.prototype);
  32580. /**
  32581. * @alias ProtoBuf.Reflect.Extension
  32582. * @expose
  32583. */
  32584. Reflect.Extension = Extension;
  32585. /**
  32586. * Constructs a new Service.
  32587. * @exports ProtoBuf.Reflect.Service
  32588. * @param {!ProtoBuf.Builder} builder Builder reference
  32589. * @param {!ProtoBuf.Reflect.Namespace} root Root
  32590. * @param {string} name Service name
  32591. * @param {Object.<string,*>=} options Options
  32592. * @constructor
  32593. * @extends ProtoBuf.Reflect.Namespace
  32594. */
  32595. var Service = function(builder, root, name, options) {
  32596. Namespace.call(this, builder, root, name, options);
  32597. /**
  32598. * @override
  32599. */
  32600. this.className = "Service";
  32601. /**
  32602. * Built runtime service class.
  32603. * @type {?function(new:ProtoBuf.Builder.Service)}
  32604. */
  32605. this.clazz = null;
  32606. };
  32607. /**
  32608. * @alias ProtoBuf.Reflect.Service.prototype
  32609. * @inner
  32610. */
  32611. var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
  32612. /**
  32613. * Builds the service and returns the runtime counterpart, which is a fully functional class.
  32614. * @see ProtoBuf.Builder.Service
  32615. * @param {boolean=} rebuild Whether to rebuild or not
  32616. * @return {Function} Service class
  32617. * @throws {Error} If the message cannot be built
  32618. * @expose
  32619. */
  32620. ServicePrototype.build = function(rebuild) {
  32621. if (this.clazz && !rebuild)
  32622. return this.clazz;
  32623. // Create the runtime Service class in its own scope
  32624. return this.clazz = (function(ProtoBuf, T) {
  32625. /**
  32626. * Constructs a new runtime Service.
  32627. * @name ProtoBuf.Builder.Service
  32628. * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
  32629. * @class Barebone of all runtime services.
  32630. * @constructor
  32631. * @throws {Error} If the service cannot be created
  32632. */
  32633. var Service = function(rpcImpl) {
  32634. ProtoBuf.Builder.Service.call(this);
  32635. /**
  32636. * Service implementation.
  32637. * @name ProtoBuf.Builder.Service#rpcImpl
  32638. * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
  32639. * @expose
  32640. */
  32641. this.rpcImpl = rpcImpl || function(name, msg, callback) {
  32642. // This is what a user has to implement: A function receiving the method name, the actual message to
  32643. // send (type checked) and the callback that's either provided with the error as its first
  32644. // argument or null and the actual response message.
  32645. setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
  32646. };
  32647. };
  32648. /**
  32649. * @alias ProtoBuf.Builder.Service.prototype
  32650. * @inner
  32651. */
  32652. var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
  32653. /**
  32654. * Asynchronously performs an RPC call using the given RPC implementation.
  32655. * @name ProtoBuf.Builder.Service.[Method]
  32656. * @function
  32657. * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
  32658. * @param {ProtoBuf.Builder.Message} req Request
  32659. * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
  32660. * the error if any and the response either as a pre-parsed message or as its raw bytes
  32661. * @abstract
  32662. */
  32663. /**
  32664. * Asynchronously performs an RPC call using the instance's RPC implementation.
  32665. * @name ProtoBuf.Builder.Service#[Method]
  32666. * @function
  32667. * @param {ProtoBuf.Builder.Message} req Request
  32668. * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
  32669. * the error if any and the response either as a pre-parsed message or as its raw bytes
  32670. * @abstract
  32671. */
  32672. var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
  32673. for (var i=0; i<rpc.length; i++) {
  32674. (function(method) {
  32675. // service#Method(message, callback)
  32676. ServicePrototype[method.name] = function(req, callback) {
  32677. try {
  32678. try {
  32679. // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
  32680. req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
  32681. } catch (err) {
  32682. if (!(err instanceof TypeError))
  32683. throw err;
  32684. }
  32685. if (req === null || typeof req !== 'object')
  32686. throw Error("Illegal arguments");
  32687. if (!(req instanceof method.resolvedRequestType.clazz))
  32688. req = new method.resolvedRequestType.clazz(req);
  32689. this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
  32690. if (err) {
  32691. callback(err);
  32692. return;
  32693. }
  32694. // Coalesce to empty string when service response has empty content
  32695. if (res === null)
  32696. res = ''
  32697. try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
  32698. if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
  32699. callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
  32700. return;
  32701. }
  32702. callback(null, res);
  32703. });
  32704. } catch (err) {
  32705. setTimeout(callback.bind(this, err), 0);
  32706. }
  32707. };
  32708. // Service.Method(rpcImpl, message, callback)
  32709. Service[method.name] = function(rpcImpl, req, callback) {
  32710. new Service(rpcImpl)[method.name](req, callback);
  32711. };
  32712. if (Object.defineProperty)
  32713. Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
  32714. Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
  32715. })(rpc[i]);
  32716. }
  32717. // Properties
  32718. /**
  32719. * Service options.
  32720. * @name ProtoBuf.Builder.Service.$options
  32721. * @type {Object.<string,*>}
  32722. * @expose
  32723. */
  32724. var $optionsS; // cc needs this
  32725. /**
  32726. * Service options.
  32727. * @name ProtoBuf.Builder.Service#$options
  32728. * @type {Object.<string,*>}
  32729. * @expose
  32730. */
  32731. var $options;
  32732. /**
  32733. * Reflection type.
  32734. * @name ProtoBuf.Builder.Service.$type
  32735. * @type {!ProtoBuf.Reflect.Service}
  32736. * @expose
  32737. */
  32738. var $typeS;
  32739. /**
  32740. * Reflection type.
  32741. * @name ProtoBuf.Builder.Service#$type
  32742. * @type {!ProtoBuf.Reflect.Service}
  32743. * @expose
  32744. */
  32745. var $type;
  32746. if (Object.defineProperty)
  32747. Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
  32748. Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
  32749. Object.defineProperty(Service, "$type", { "value": T }),
  32750. Object.defineProperty(ServicePrototype, "$type", { "value": T });
  32751. return Service;
  32752. })(ProtoBuf, this);
  32753. };
  32754. /**
  32755. * @alias ProtoBuf.Reflect.Service
  32756. * @expose
  32757. */
  32758. Reflect.Service = Service;
  32759. /**
  32760. * Abstract service method.
  32761. * @exports ProtoBuf.Reflect.Service.Method
  32762. * @param {!ProtoBuf.Builder} builder Builder reference
  32763. * @param {!ProtoBuf.Reflect.Service} svc Service
  32764. * @param {string} name Method name
  32765. * @param {Object.<string,*>=} options Options
  32766. * @constructor
  32767. * @extends ProtoBuf.Reflect.T
  32768. */
  32769. var Method = function(builder, svc, name, options) {
  32770. T.call(this, builder, svc, name);
  32771. /**
  32772. * @override
  32773. */
  32774. this.className = "Service.Method";
  32775. /**
  32776. * Options.
  32777. * @type {Object.<string, *>}
  32778. * @expose
  32779. */
  32780. this.options = options || {};
  32781. };
  32782. /**
  32783. * @alias ProtoBuf.Reflect.Service.Method.prototype
  32784. * @inner
  32785. */
  32786. var MethodPrototype = Method.prototype = Object.create(T.prototype);
  32787. /**
  32788. * Builds the method's '$options' property.
  32789. * @name ProtoBuf.Reflect.Service.Method#buildOpt
  32790. * @function
  32791. * @return {Object.<string,*>}
  32792. */
  32793. MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
  32794. /**
  32795. * @alias ProtoBuf.Reflect.Service.Method
  32796. * @expose
  32797. */
  32798. Reflect.Service.Method = Method;
  32799. /**
  32800. * RPC service method.
  32801. * @exports ProtoBuf.Reflect.Service.RPCMethod
  32802. * @param {!ProtoBuf.Builder} builder Builder reference
  32803. * @param {!ProtoBuf.Reflect.Service} svc Service
  32804. * @param {string} name Method name
  32805. * @param {string} request Request message name
  32806. * @param {string} response Response message name
  32807. * @param {boolean} request_stream Whether requests are streamed
  32808. * @param {boolean} response_stream Whether responses are streamed
  32809. * @param {Object.<string,*>=} options Options
  32810. * @constructor
  32811. * @extends ProtoBuf.Reflect.Service.Method
  32812. */
  32813. var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
  32814. Method.call(this, builder, svc, name, options);
  32815. /**
  32816. * @override
  32817. */
  32818. this.className = "Service.RPCMethod";
  32819. /**
  32820. * Request message name.
  32821. * @type {string}
  32822. * @expose
  32823. */
  32824. this.requestName = request;
  32825. /**
  32826. * Response message name.
  32827. * @type {string}
  32828. * @expose
  32829. */
  32830. this.responseName = response;
  32831. /**
  32832. * Whether requests are streamed
  32833. * @type {bool}
  32834. * @expose
  32835. */
  32836. this.requestStream = request_stream;
  32837. /**
  32838. * Whether responses are streamed
  32839. * @type {bool}
  32840. * @expose
  32841. */
  32842. this.responseStream = response_stream;
  32843. /**
  32844. * Resolved request message type.
  32845. * @type {ProtoBuf.Reflect.Message}
  32846. * @expose
  32847. */
  32848. this.resolvedRequestType = null;
  32849. /**
  32850. * Resolved response message type.
  32851. * @type {ProtoBuf.Reflect.Message}
  32852. * @expose
  32853. */
  32854. this.resolvedResponseType = null;
  32855. };
  32856. // Extends Method
  32857. RPCMethod.prototype = Object.create(Method.prototype);
  32858. /**
  32859. * @alias ProtoBuf.Reflect.Service.RPCMethod
  32860. * @expose
  32861. */
  32862. Reflect.Service.RPCMethod = RPCMethod;
  32863. return Reflect;
  32864. })(ProtoBuf);
  32865. /**
  32866. * @alias ProtoBuf.Builder
  32867. * @expose
  32868. */
  32869. ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
  32870. "use strict";
  32871. /**
  32872. * Constructs a new Builder.
  32873. * @exports ProtoBuf.Builder
  32874. * @class Provides the functionality to build protocol messages.
  32875. * @param {Object.<string,*>=} options Options
  32876. * @constructor
  32877. */
  32878. var Builder = function(options) {
  32879. /**
  32880. * Namespace.
  32881. * @type {ProtoBuf.Reflect.Namespace}
  32882. * @expose
  32883. */
  32884. this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
  32885. /**
  32886. * Namespace pointer.
  32887. * @type {ProtoBuf.Reflect.T}
  32888. * @expose
  32889. */
  32890. this.ptr = this.ns;
  32891. /**
  32892. * Resolved flag.
  32893. * @type {boolean}
  32894. * @expose
  32895. */
  32896. this.resolved = false;
  32897. /**
  32898. * The current building result.
  32899. * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
  32900. * @expose
  32901. */
  32902. this.result = null;
  32903. /**
  32904. * Imported files.
  32905. * @type {Array.<string>}
  32906. * @expose
  32907. */
  32908. this.files = {};
  32909. /**
  32910. * Import root override.
  32911. * @type {?string}
  32912. * @expose
  32913. */
  32914. this.importRoot = null;
  32915. /**
  32916. * Options.
  32917. * @type {!Object.<string, *>}
  32918. * @expose
  32919. */
  32920. this.options = options || {};
  32921. };
  32922. /**
  32923. * @alias ProtoBuf.Builder.prototype
  32924. * @inner
  32925. */
  32926. var BuilderPrototype = Builder.prototype;
  32927. // ----- Definition tests -----
  32928. /**
  32929. * Tests if a definition most likely describes a message.
  32930. * @param {!Object} def
  32931. * @returns {boolean}
  32932. * @expose
  32933. */
  32934. Builder.isMessage = function(def) {
  32935. // Messages require a string name
  32936. if (typeof def["name"] !== 'string')
  32937. return false;
  32938. // Messages do not contain values (enum) or rpc methods (service)
  32939. if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
  32940. return false;
  32941. return true;
  32942. };
  32943. /**
  32944. * Tests if a definition most likely describes a message field.
  32945. * @param {!Object} def
  32946. * @returns {boolean}
  32947. * @expose
  32948. */
  32949. Builder.isMessageField = function(def) {
  32950. // Message fields require a string rule, name and type and an id
  32951. if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
  32952. return false;
  32953. return true;
  32954. };
  32955. /**
  32956. * Tests if a definition most likely describes an enum.
  32957. * @param {!Object} def
  32958. * @returns {boolean}
  32959. * @expose
  32960. */
  32961. Builder.isEnum = function(def) {
  32962. // Enums require a string name
  32963. if (typeof def["name"] !== 'string')
  32964. return false;
  32965. // Enums require at least one value
  32966. if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
  32967. return false;
  32968. return true;
  32969. };
  32970. /**
  32971. * Tests if a definition most likely describes a service.
  32972. * @param {!Object} def
  32973. * @returns {boolean}
  32974. * @expose
  32975. */
  32976. Builder.isService = function(def) {
  32977. // Services require a string name and an rpc object
  32978. if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
  32979. return false;
  32980. return true;
  32981. };
  32982. /**
  32983. * Tests if a definition most likely describes an extended message
  32984. * @param {!Object} def
  32985. * @returns {boolean}
  32986. * @expose
  32987. */
  32988. Builder.isExtend = function(def) {
  32989. // Extends rquire a string ref
  32990. if (typeof def["ref"] !== 'string')
  32991. return false;
  32992. return true;
  32993. };
  32994. // ----- Building -----
  32995. /**
  32996. * Resets the pointer to the root namespace.
  32997. * @returns {!ProtoBuf.Builder} this
  32998. * @expose
  32999. */
  33000. BuilderPrototype.reset = function() {
  33001. this.ptr = this.ns;
  33002. return this;
  33003. };
  33004. /**
  33005. * Defines a namespace on top of the current pointer position and places the pointer on it.
  33006. * @param {string} namespace
  33007. * @return {!ProtoBuf.Builder} this
  33008. * @expose
  33009. */
  33010. BuilderPrototype.define = function(namespace) {
  33011. if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
  33012. throw Error("illegal namespace: "+namespace);
  33013. namespace.split(".").forEach(function(part) {
  33014. var ns = this.ptr.getChild(part);
  33015. if (ns === null) // Keep existing
  33016. this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
  33017. this.ptr = ns;
  33018. }, this);
  33019. return this;
  33020. };
  33021. /**
  33022. * Creates the specified definitions at the current pointer position.
  33023. * @param {!Array.<!Object>} defs Messages, enums or services to create
  33024. * @returns {!ProtoBuf.Builder} this
  33025. * @throws {Error} If a message definition is invalid
  33026. * @expose
  33027. */
  33028. BuilderPrototype.create = function(defs) {
  33029. if (!defs)
  33030. return this; // Nothing to create
  33031. if (!Array.isArray(defs))
  33032. defs = [defs];
  33033. else {
  33034. if (defs.length === 0)
  33035. return this;
  33036. defs = defs.slice();
  33037. }
  33038. // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
  33039. var stack = [defs];
  33040. while (stack.length > 0) {
  33041. defs = stack.pop();
  33042. if (!Array.isArray(defs)) // Stack always contains entire namespaces
  33043. throw Error("not a valid namespace: "+JSON.stringify(defs));
  33044. while (defs.length > 0) {
  33045. var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
  33046. if (Builder.isMessage(def)) {
  33047. var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
  33048. // Create OneOfs
  33049. var oneofs = {};
  33050. if (def["oneofs"])
  33051. Object.keys(def["oneofs"]).forEach(function(name) {
  33052. obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
  33053. }, this);
  33054. // Create fields
  33055. if (def["fields"])
  33056. def["fields"].forEach(function(fld) {
  33057. if (obj.getChild(fld["id"]|0) !== null)
  33058. throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
  33059. if (fld["options"] && typeof fld["options"] !== 'object')
  33060. throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
  33061. var oneof = null;
  33062. if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
  33063. throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
  33064. fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
  33065. if (oneof)
  33066. oneof.fields.push(fld);
  33067. obj.addChild(fld);
  33068. }, this);
  33069. // Push children to stack
  33070. var subObj = [];
  33071. if (def["enums"])
  33072. def["enums"].forEach(function(enm) {
  33073. subObj.push(enm);
  33074. });
  33075. if (def["messages"])
  33076. def["messages"].forEach(function(msg) {
  33077. subObj.push(msg);
  33078. });
  33079. if (def["services"])
  33080. def["services"].forEach(function(svc) {
  33081. subObj.push(svc);
  33082. });
  33083. // Set extension ranges
  33084. if (def["extensions"]) {
  33085. if (typeof def["extensions"][0] === 'number') // pre 5.0.1
  33086. obj.extensions = [ def["extensions"] ];
  33087. else
  33088. obj.extensions = def["extensions"];
  33089. }
  33090. // Create on top of current namespace
  33091. this.ptr.addChild(obj);
  33092. if (subObj.length > 0) {
  33093. stack.push(defs); // Push the current level back
  33094. defs = subObj; // Continue processing sub level
  33095. subObj = null;
  33096. this.ptr = obj; // And move the pointer to this namespace
  33097. obj = null;
  33098. continue;
  33099. }
  33100. subObj = null;
  33101. } else if (Builder.isEnum(def)) {
  33102. obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
  33103. def["values"].forEach(function(val) {
  33104. obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
  33105. }, this);
  33106. this.ptr.addChild(obj);
  33107. } else if (Builder.isService(def)) {
  33108. obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
  33109. Object.keys(def["rpc"]).forEach(function(name) {
  33110. var mtd = def["rpc"][name];
  33111. obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
  33112. }, this);
  33113. this.ptr.addChild(obj);
  33114. } else if (Builder.isExtend(def)) {
  33115. obj = this.ptr.resolve(def["ref"], true);
  33116. if (obj) {
  33117. def["fields"].forEach(function(fld) {
  33118. if (obj.getChild(fld['id']|0) !== null)
  33119. throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
  33120. // Check if field id is allowed to be extended
  33121. if (obj.extensions) {
  33122. var valid = false;
  33123. obj.extensions.forEach(function(range) {
  33124. if (fld["id"] >= range[0] && fld["id"] <= range[1])
  33125. valid = true;
  33126. });
  33127. if (!valid)
  33128. throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
  33129. }
  33130. // Convert extension field names to camel case notation if the override is set
  33131. var name = fld["name"];
  33132. if (this.options['convertFieldsToCamelCase'])
  33133. name = ProtoBuf.Util.toCamelCase(name);
  33134. // see #161: Extensions use their fully qualified name as their runtime key and...
  33135. var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
  33136. // ...are added on top of the current namespace as an extension which is used for
  33137. // resolving their type later on (the extension always keeps the original name to
  33138. // prevent naming collisions)
  33139. var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
  33140. field.extension = ext;
  33141. this.ptr.addChild(ext);
  33142. obj.addChild(field);
  33143. }, this);
  33144. } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
  33145. throw Error("extended message "+def["ref"]+" is not defined");
  33146. } else
  33147. throw Error("not a valid definition: "+JSON.stringify(def));
  33148. def = null;
  33149. obj = null;
  33150. }
  33151. // Break goes here
  33152. defs = null;
  33153. this.ptr = this.ptr.parent; // Namespace done, continue at parent
  33154. }
  33155. this.resolved = false; // Require re-resolve
  33156. this.result = null; // Require re-build
  33157. return this;
  33158. };
  33159. /**
  33160. * Propagates syntax to all children.
  33161. * @param {!Object} parent
  33162. * @inner
  33163. */
  33164. function propagateSyntax(parent) {
  33165. if (parent['messages']) {
  33166. parent['messages'].forEach(function(child) {
  33167. child["syntax"] = parent["syntax"];
  33168. propagateSyntax(child);
  33169. });
  33170. }
  33171. if (parent['enums']) {
  33172. parent['enums'].forEach(function(child) {
  33173. child["syntax"] = parent["syntax"];
  33174. });
  33175. }
  33176. }
  33177. /**
  33178. * Imports another definition into this builder.
  33179. * @param {Object.<string,*>} json Parsed import
  33180. * @param {(string|{root: string, file: string})=} filename Imported file name
  33181. * @returns {!ProtoBuf.Builder} this
  33182. * @throws {Error} If the definition or file cannot be imported
  33183. * @expose
  33184. */
  33185. BuilderPrototype["import"] = function(json, filename) {
  33186. var delim = '/';
  33187. // Make sure to skip duplicate imports
  33188. if (typeof filename === 'string') {
  33189. if (ProtoBuf.Util.IS_NODE)
  33190. filename = require("path")['resolve'](filename);
  33191. if (this.files[filename] === true)
  33192. return this.reset();
  33193. this.files[filename] = true;
  33194. } else if (typeof filename === 'object') { // Object with root, file.
  33195. var root = filename.root;
  33196. if (ProtoBuf.Util.IS_NODE)
  33197. root = require("path")['resolve'](root);
  33198. if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
  33199. delim = '\\';
  33200. var fname = root + delim + filename.file;
  33201. if (this.files[fname] === true)
  33202. return this.reset();
  33203. this.files[fname] = true;
  33204. }
  33205. // Import imports
  33206. if (json['imports'] && json['imports'].length > 0) {
  33207. var importRoot,
  33208. resetRoot = false;
  33209. if (typeof filename === 'object') { // If an import root is specified, override
  33210. this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
  33211. importRoot = this.importRoot;
  33212. filename = filename["file"];
  33213. if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
  33214. delim = '\\';
  33215. } else if (typeof filename === 'string') {
  33216. if (this.importRoot) // If import root is overridden, use it
  33217. importRoot = this.importRoot;
  33218. else { // Otherwise compute from filename
  33219. if (filename.indexOf("/") >= 0) { // Unix
  33220. importRoot = filename.replace(/\/[^\/]*$/, "");
  33221. if (/* /file.proto */ importRoot === "")
  33222. importRoot = "/";
  33223. } else if (filename.indexOf("\\") >= 0) { // Windows
  33224. importRoot = filename.replace(/\\[^\\]*$/, "");
  33225. delim = '\\';
  33226. } else
  33227. importRoot = ".";
  33228. }
  33229. } else
  33230. importRoot = null;
  33231. for (var i=0; i<json['imports'].length; i++) {
  33232. if (typeof json['imports'][i] === 'string') { // Import file
  33233. if (!importRoot)
  33234. throw Error("cannot determine import root");
  33235. var importFilename = json['imports'][i];
  33236. if (importFilename === "google/protobuf/descriptor.proto")
  33237. continue; // Not needed and therefore not used
  33238. importFilename = importRoot + delim + importFilename;
  33239. if (this.files[importFilename] === true)
  33240. continue; // Already imported
  33241. if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
  33242. importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
  33243. var contents = ProtoBuf.Util.fetch(importFilename);
  33244. if (contents === null)
  33245. throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
  33246. if (/\.json$/i.test(importFilename)) // Always possible
  33247. this["import"](JSON.parse(contents+""), importFilename); // May throw
  33248. else
  33249. this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
  33250. } else // Import structure
  33251. if (!filename)
  33252. this["import"](json['imports'][i]);
  33253. else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
  33254. this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
  33255. else // Without extension: Append _importN to make it unique
  33256. this["import"](json['imports'][i], filename+"_import"+i);
  33257. }
  33258. if (resetRoot) // Reset import root override when all imports are done
  33259. this.importRoot = null;
  33260. }
  33261. // Import structures
  33262. if (json['package'])
  33263. this.define(json['package']);
  33264. if (json['syntax'])
  33265. propagateSyntax(json);
  33266. var base = this.ptr;
  33267. if (json['options'])
  33268. Object.keys(json['options']).forEach(function(key) {
  33269. base.options[key] = json['options'][key];
  33270. });
  33271. if (json['messages'])
  33272. this.create(json['messages']),
  33273. this.ptr = base;
  33274. if (json['enums'])
  33275. this.create(json['enums']),
  33276. this.ptr = base;
  33277. if (json['services'])
  33278. this.create(json['services']),
  33279. this.ptr = base;
  33280. if (json['extends'])
  33281. this.create(json['extends']);
  33282. return this.reset();
  33283. };
  33284. /**
  33285. * Resolves all namespace objects.
  33286. * @throws {Error} If a type cannot be resolved
  33287. * @returns {!ProtoBuf.Builder} this
  33288. * @expose
  33289. */
  33290. BuilderPrototype.resolveAll = function() {
  33291. // Resolve all reflected objects
  33292. var res;
  33293. if (this.ptr == null || typeof this.ptr.type === 'object')
  33294. return this; // Done (already resolved)
  33295. if (this.ptr instanceof Reflect.Namespace) { // Resolve children
  33296. this.ptr.children.forEach(function(child) {
  33297. this.ptr = child;
  33298. this.resolveAll();
  33299. }, this);
  33300. } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
  33301. if (!Lang.TYPE.test(this.ptr.type)) {
  33302. if (!Lang.TYPEREF.test(this.ptr.type))
  33303. throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  33304. res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
  33305. if (!res)
  33306. throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  33307. this.ptr.resolvedType = res;
  33308. if (res instanceof Reflect.Enum) {
  33309. this.ptr.type = ProtoBuf.TYPES["enum"];
  33310. if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
  33311. throw Error("proto3 message cannot reference proto2 enum");
  33312. }
  33313. else if (res instanceof Reflect.Message)
  33314. this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
  33315. else
  33316. throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
  33317. } else
  33318. this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
  33319. // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
  33320. // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
  33321. if (this.ptr.map) {
  33322. if (!Lang.TYPE.test(this.ptr.keyType))
  33323. throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
  33324. this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
  33325. }
  33326. } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
  33327. if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
  33328. res = this.ptr.parent.resolve(this.ptr.requestName, true);
  33329. if (!res || !(res instanceof ProtoBuf.Reflect.Message))
  33330. throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
  33331. this.ptr.resolvedRequestType = res;
  33332. res = this.ptr.parent.resolve(this.ptr.responseName, true);
  33333. if (!res || !(res instanceof ProtoBuf.Reflect.Message))
  33334. throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
  33335. this.ptr.resolvedResponseType = res;
  33336. } else // Should not happen as nothing else is implemented
  33337. throw Error("illegal service type in "+this.ptr.toString(true));
  33338. } else if (
  33339. !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
  33340. !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
  33341. !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
  33342. )
  33343. throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
  33344. return this.reset();
  33345. };
  33346. /**
  33347. * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
  33348. * return the built package.
  33349. * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
  33350. * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
  33351. * @throws {Error} If a type could not be resolved
  33352. * @expose
  33353. */
  33354. BuilderPrototype.build = function(path) {
  33355. this.reset();
  33356. if (!this.resolved)
  33357. this.resolveAll(),
  33358. this.resolved = true,
  33359. this.result = null; // Require re-build
  33360. if (this.result === null) // (Re-)Build
  33361. this.result = this.ns.build();
  33362. if (!path)
  33363. return this.result;
  33364. var part = typeof path === 'string' ? path.split(".") : path,
  33365. ptr = this.result; // Build namespace pointer (no hasChild etc.)
  33366. for (var i=0; i<part.length; i++)
  33367. if (ptr[part[i]])
  33368. ptr = ptr[part[i]];
  33369. else {
  33370. ptr = null;
  33371. break;
  33372. }
  33373. return ptr;
  33374. };
  33375. /**
  33376. * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
  33377. * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
  33378. * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
  33379. * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
  33380. */
  33381. BuilderPrototype.lookup = function(path, excludeNonNamespace) {
  33382. return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
  33383. };
  33384. /**
  33385. * Returns a string representation of this object.
  33386. * @return {string} String representation as of "Builder"
  33387. * @expose
  33388. */
  33389. BuilderPrototype.toString = function() {
  33390. return "Builder";
  33391. };
  33392. // ----- Base classes -----
  33393. // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
  33394. /**
  33395. * @alias ProtoBuf.Builder.Message
  33396. */
  33397. Builder.Message = function() {};
  33398. /**
  33399. * @alias ProtoBuf.Builder.Enum
  33400. */
  33401. Builder.Enum = function() {};
  33402. /**
  33403. * @alias ProtoBuf.Builder.Message
  33404. */
  33405. Builder.Service = function() {};
  33406. return Builder;
  33407. })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
  33408. /**
  33409. * @alias ProtoBuf.Map
  33410. * @expose
  33411. */
  33412. ProtoBuf.Map = (function(ProtoBuf, Reflect) {
  33413. "use strict";
  33414. /**
  33415. * Constructs a new Map. A Map is a container that is used to implement map
  33416. * fields on message objects. It closely follows the ES6 Map API; however,
  33417. * it is distinct because we do not want to depend on external polyfills or
  33418. * on ES6 itself.
  33419. *
  33420. * @exports ProtoBuf.Map
  33421. * @param {!ProtoBuf.Reflect.Field} field Map field
  33422. * @param {Object.<string,*>=} contents Initial contents
  33423. * @constructor
  33424. */
  33425. var Map = function(field, contents) {
  33426. if (!field.map)
  33427. throw Error("field is not a map");
  33428. /**
  33429. * The field corresponding to this map.
  33430. * @type {!ProtoBuf.Reflect.Field}
  33431. */
  33432. this.field = field;
  33433. /**
  33434. * Element instance corresponding to key type.
  33435. * @type {!ProtoBuf.Reflect.Element}
  33436. */
  33437. this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
  33438. /**
  33439. * Element instance corresponding to value type.
  33440. * @type {!ProtoBuf.Reflect.Element}
  33441. */
  33442. this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
  33443. /**
  33444. * Internal map: stores mapping of (string form of key) -> (key, value)
  33445. * pair.
  33446. *
  33447. * We provide map semantics for arbitrary key types, but we build on top
  33448. * of an Object, which has only string keys. In order to avoid the need
  33449. * to convert a string key back to its native type in many situations,
  33450. * we store the native key value alongside the value. Thus, we only need
  33451. * a one-way mapping from a key type to its string form that guarantees
  33452. * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
  33453. * === K2).
  33454. *
  33455. * @type {!Object<string, {key: *, value: *}>}
  33456. */
  33457. this.map = {};
  33458. /**
  33459. * Returns the number of elements in the map.
  33460. */
  33461. Object.defineProperty(this, "size", {
  33462. get: function() { return Object.keys(this.map).length; }
  33463. });
  33464. // Fill initial contents from a raw object.
  33465. if (contents) {
  33466. var keys = Object.keys(contents);
  33467. for (var i = 0; i < keys.length; i++) {
  33468. var key = this.keyElem.valueFromString(keys[i]);
  33469. var val = this.valueElem.verifyValue(contents[keys[i]]);
  33470. this.map[this.keyElem.valueToString(key)] =
  33471. { key: key, value: val };
  33472. }
  33473. }
  33474. };
  33475. var MapPrototype = Map.prototype;
  33476. /**
  33477. * Helper: return an iterator over an array.
  33478. * @param {!Array<*>} arr the array
  33479. * @returns {!Object} an iterator
  33480. * @inner
  33481. */
  33482. function arrayIterator(arr) {
  33483. var idx = 0;
  33484. return {
  33485. next: function() {
  33486. if (idx < arr.length)
  33487. return { done: false, value: arr[idx++] };
  33488. return { done: true };
  33489. }
  33490. }
  33491. }
  33492. /**
  33493. * Clears the map.
  33494. */
  33495. MapPrototype.clear = function() {
  33496. this.map = {};
  33497. };
  33498. /**
  33499. * Deletes a particular key from the map.
  33500. * @returns {boolean} Whether any entry with this key was deleted.
  33501. */
  33502. MapPrototype["delete"] = function(key) {
  33503. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  33504. var hadKey = keyValue in this.map;
  33505. delete this.map[keyValue];
  33506. return hadKey;
  33507. };
  33508. /**
  33509. * Returns an iterator over [key, value] pairs in the map.
  33510. * @returns {Object} The iterator
  33511. */
  33512. MapPrototype.entries = function() {
  33513. var entries = [];
  33514. var strKeys = Object.keys(this.map);
  33515. for (var i = 0, entry; i < strKeys.length; i++)
  33516. entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
  33517. return arrayIterator(entries);
  33518. };
  33519. /**
  33520. * Returns an iterator over keys in the map.
  33521. * @returns {Object} The iterator
  33522. */
  33523. MapPrototype.keys = function() {
  33524. var keys = [];
  33525. var strKeys = Object.keys(this.map);
  33526. for (var i = 0; i < strKeys.length; i++)
  33527. keys.push(this.map[strKeys[i]].key);
  33528. return arrayIterator(keys);
  33529. };
  33530. /**
  33531. * Returns an iterator over values in the map.
  33532. * @returns {!Object} The iterator
  33533. */
  33534. MapPrototype.values = function() {
  33535. var values = [];
  33536. var strKeys = Object.keys(this.map);
  33537. for (var i = 0; i < strKeys.length; i++)
  33538. values.push(this.map[strKeys[i]].value);
  33539. return arrayIterator(values);
  33540. };
  33541. /**
  33542. * Iterates over entries in the map, calling a function on each.
  33543. * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
  33544. * @param {Object=} thisArg The `this` value for the callback
  33545. */
  33546. MapPrototype.forEach = function(cb, thisArg) {
  33547. var strKeys = Object.keys(this.map);
  33548. for (var i = 0, entry; i < strKeys.length; i++)
  33549. cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
  33550. };
  33551. /**
  33552. * Sets a key in the map to the given value.
  33553. * @param {*} key The key
  33554. * @param {*} value The value
  33555. * @returns {!ProtoBuf.Map} The map instance
  33556. */
  33557. MapPrototype.set = function(key, value) {
  33558. var keyValue = this.keyElem.verifyValue(key);
  33559. var valValue = this.valueElem.verifyValue(value);
  33560. this.map[this.keyElem.valueToString(keyValue)] =
  33561. { key: keyValue, value: valValue };
  33562. return this;
  33563. };
  33564. /**
  33565. * Gets the value corresponding to a key in the map.
  33566. * @param {*} key The key
  33567. * @returns {*|undefined} The value, or `undefined` if key not present
  33568. */
  33569. MapPrototype.get = function(key) {
  33570. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  33571. if (!(keyValue in this.map))
  33572. return undefined;
  33573. return this.map[keyValue].value;
  33574. };
  33575. /**
  33576. * Determines whether the given key is present in the map.
  33577. * @param {*} key The key
  33578. * @returns {boolean} `true` if the key is present
  33579. */
  33580. MapPrototype.has = function(key) {
  33581. var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
  33582. return (keyValue in this.map);
  33583. };
  33584. return Map;
  33585. })(ProtoBuf, ProtoBuf.Reflect);
  33586. /**
  33587. * Loads a .proto string and returns the Builder.
  33588. * @param {string} proto .proto file contents
  33589. * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
  33590. * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
  33591. * @return {ProtoBuf.Builder} Builder to create new messages
  33592. * @throws {Error} If the definition cannot be parsed or built
  33593. * @expose
  33594. */
  33595. ProtoBuf.loadProto = function(proto, builder, filename) {
  33596. if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
  33597. filename = builder,
  33598. builder = undefined;
  33599. return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename);
  33600. };
  33601. /**
  33602. * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}.
  33603. * @function
  33604. * @param {string} proto .proto file contents
  33605. * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted.
  33606. * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
  33607. * @return {ProtoBuf.Builder} Builder to create new messages
  33608. * @throws {Error} If the definition cannot be parsed or built
  33609. * @expose
  33610. */
  33611. ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy
  33612. /**
  33613. * Loads a .proto file and returns the Builder.
  33614. * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
  33615. * an overridden 'root' path for all imported files.
  33616. * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
  33617. * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
  33618. * file will be read synchronously and this function will return the Builder.
  33619. * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
  33620. * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
  33621. * request has failed), else undefined
  33622. * @expose
  33623. */
  33624. ProtoBuf.loadProtoFile = function(filename, callback, builder) {
  33625. if (callback && typeof callback === 'object')
  33626. builder = callback,
  33627. callback = null;
  33628. else if (!callback || typeof callback !== 'function')
  33629. callback = null;
  33630. if (callback)
  33631. return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
  33632. if (contents === null) {
  33633. callback(Error("Failed to fetch file"));
  33634. return;
  33635. }
  33636. try {
  33637. callback(null, ProtoBuf.loadProto(contents, builder, filename));
  33638. } catch (e) {
  33639. callback(e);
  33640. }
  33641. });
  33642. var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
  33643. return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename);
  33644. };
  33645. /**
  33646. * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}.
  33647. * @function
  33648. * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
  33649. * an overridden 'root' path for all imported files.
  33650. * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
  33651. * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
  33652. * file will be read synchronously and this function will return the Builder.
  33653. * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
  33654. * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
  33655. * request has failed), else undefined
  33656. * @expose
  33657. */
  33658. ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy
  33659. /**
  33660. * Constructs a new empty Builder.
  33661. * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
  33662. * @return {!ProtoBuf.Builder} Builder
  33663. * @expose
  33664. */
  33665. ProtoBuf.newBuilder = function(options) {
  33666. options = options || {};
  33667. if (typeof options['convertFieldsToCamelCase'] === 'undefined')
  33668. options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
  33669. if (typeof options['populateAccessors'] === 'undefined')
  33670. options['populateAccessors'] = ProtoBuf.populateAccessors;
  33671. return new ProtoBuf.Builder(options);
  33672. };
  33673. /**
  33674. * Loads a .json definition and returns the Builder.
  33675. * @param {!*|string} json JSON definition
  33676. * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
  33677. * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
  33678. * @return {ProtoBuf.Builder} Builder to create new messages
  33679. * @throws {Error} If the definition cannot be parsed or built
  33680. * @expose
  33681. */
  33682. ProtoBuf.loadJson = function(json, builder, filename) {
  33683. if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
  33684. filename = builder,
  33685. builder = null;
  33686. if (!builder || typeof builder !== 'object')
  33687. builder = ProtoBuf.newBuilder();
  33688. if (typeof json === 'string')
  33689. json = JSON.parse(json);
  33690. builder["import"](json, filename);
  33691. builder.resolveAll();
  33692. return builder;
  33693. };
  33694. /**
  33695. * Loads a .json file and returns the Builder.
  33696. * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
  33697. * an overridden 'root' path for all imported files.
  33698. * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
  33699. * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
  33700. * file will be read synchronously and this function will return the Builder.
  33701. * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
  33702. * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
  33703. * request has failed), else undefined
  33704. * @expose
  33705. */
  33706. ProtoBuf.loadJsonFile = function(filename, callback, builder) {
  33707. if (callback && typeof callback === 'object')
  33708. builder = callback,
  33709. callback = null;
  33710. else if (!callback || typeof callback !== 'function')
  33711. callback = null;
  33712. if (callback)
  33713. return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
  33714. if (contents === null) {
  33715. callback(Error("Failed to fetch file"));
  33716. return;
  33717. }
  33718. try {
  33719. callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
  33720. } catch (e) {
  33721. callback(e);
  33722. }
  33723. });
  33724. var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
  33725. return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
  33726. };
  33727. return ProtoBuf;
  33728. });
  33729. (function() {
  33730. 'use strict';
  33731. function validatePrivKey(privKey) {
  33732. if (privKey === undefined || !(privKey instanceof ArrayBuffer) || privKey.byteLength != 32) {
  33733. throw new Error("Invalid private key");
  33734. }
  33735. }
  33736. function validatePubKeyFormat(pubKey) {
  33737. if (pubKey === undefined || ((pubKey.byteLength != 33 || new Uint8Array(pubKey)[0] != 5) && pubKey.byteLength != 32)) {
  33738. throw new Error("Invalid public key");
  33739. }
  33740. if (pubKey.byteLength == 33) {
  33741. return pubKey.slice(1);
  33742. } else {
  33743. console.error("WARNING: Expected pubkey of length 33, please report the ST and client that generated the pubkey");
  33744. return pubKey;
  33745. }
  33746. }
  33747. function processKeys(raw_keys) {
  33748. // prepend version byte
  33749. var origPub = new Uint8Array(raw_keys.pubKey);
  33750. var pub = new Uint8Array(33);
  33751. pub.set(origPub, 1);
  33752. pub[0] = 5;
  33753. return { pubKey: pub.buffer, privKey: raw_keys.privKey };
  33754. }
  33755. function wrapCurve25519(curve25519) {
  33756. return {
  33757. // Curve 25519 crypto
  33758. createKeyPair: function(privKey) {
  33759. validatePrivKey(privKey);
  33760. var raw_keys = curve25519.keyPair(privKey);
  33761. if (raw_keys instanceof Promise) {
  33762. return raw_keys.then(processKeys);
  33763. } else {
  33764. return processKeys(raw_keys);
  33765. }
  33766. },
  33767. ECDHE: function(pubKey, privKey) {
  33768. pubKey = validatePubKeyFormat(pubKey);
  33769. validatePrivKey(privKey);
  33770. if (pubKey === undefined || pubKey.byteLength != 32) {
  33771. throw new Error("Invalid public key");
  33772. }
  33773. return curve25519.sharedSecret(pubKey, privKey);
  33774. },
  33775. Ed25519Sign: function(privKey, message) {
  33776. validatePrivKey(privKey);
  33777. if (message === undefined) {
  33778. throw new Error("Invalid message");
  33779. }
  33780. return curve25519.sign(privKey, message);
  33781. },
  33782. Ed25519Verify: function(pubKey, msg, sig) {
  33783. pubKey = validatePubKeyFormat(pubKey);
  33784. if (pubKey === undefined || pubKey.byteLength != 32) {
  33785. throw new Error("Invalid public key");
  33786. }
  33787. if (msg === undefined) {
  33788. throw new Error("Invalid message");
  33789. }
  33790. if (sig === undefined || sig.byteLength != 64) {
  33791. throw new Error("Invalid signature");
  33792. }
  33793. return curve25519.verify(pubKey, msg, sig);
  33794. }
  33795. };
  33796. }
  33797. Internal.Curve = wrapCurve25519(Internal.curve25519);
  33798. Internal.Curve.async = wrapCurve25519(Internal.curve25519_async);
  33799. function wrapCurve(curve) {
  33800. return {
  33801. generateKeyPair: function() {
  33802. var privKey = Internal.crypto.getRandomBytes(32);
  33803. return curve.createKeyPair(privKey);
  33804. },
  33805. createKeyPair: function(privKey) {
  33806. return curve.createKeyPair(privKey);
  33807. },
  33808. calculateAgreement: function(pubKey, privKey) {
  33809. return curve.ECDHE(pubKey, privKey);
  33810. },
  33811. verifySignature: function(pubKey, msg, sig) {
  33812. return curve.Ed25519Verify(pubKey, msg, sig);
  33813. },
  33814. calculateSignature: function(privKey, message) {
  33815. return curve.Ed25519Sign(privKey, message);
  33816. }
  33817. };
  33818. }
  33819. libsignal.Curve = wrapCurve(Internal.Curve);
  33820. libsignal.Curve.async = wrapCurve(Internal.Curve.async);
  33821. })();
  33822. /*
  33823. * vim: ts=4:sw=4
  33824. */
  33825. var Internal = Internal || {};
  33826. (function() {
  33827. 'use strict';
  33828. var crypto = window.crypto;
  33829. if (!crypto || !crypto.subtle || typeof crypto.getRandomValues !== 'function') {
  33830. throw new Error('WebCrypto not found');
  33831. }
  33832. Internal.crypto = {
  33833. getRandomBytes: function(size) {
  33834. var array = new Uint8Array(size);
  33835. crypto.getRandomValues(array);
  33836. return array.buffer;
  33837. },
  33838. encrypt: function(key, data, iv) {
  33839. return crypto.subtle.importKey('raw', key, {name: 'AES-CBC'}, false, ['encrypt']).then(function(key) {
  33840. return crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array(iv)}, key, data);
  33841. });
  33842. },
  33843. decrypt: function(key, data, iv) {
  33844. return crypto.subtle.importKey('raw', key, {name: 'AES-CBC'}, false, ['decrypt']).then(function(key) {
  33845. return crypto.subtle.decrypt({name: 'AES-CBC', iv: new Uint8Array(iv)}, key, data);
  33846. });
  33847. },
  33848. sign: function(key, data) {
  33849. return crypto.subtle.importKey('raw', key, {name: 'HMAC', hash: {name: 'SHA-256'}}, false, ['sign']).then(function(key) {
  33850. return crypto.subtle.sign( {name: 'HMAC', hash: 'SHA-256'}, key, data);
  33851. });
  33852. },
  33853. hash: function(data) {
  33854. return crypto.subtle.digest({name: 'SHA-512'}, data);
  33855. },
  33856. HKDF: function(input, salt, info) {
  33857. // Specific implementation of RFC 5869 that only returns the first 3 32-byte chunks
  33858. // TODO: We dont always need the third chunk, we might skip it
  33859. return Internal.crypto.sign(salt, input).then(function(PRK) {
  33860. var infoBuffer = new ArrayBuffer(info.byteLength + 1 + 32);
  33861. var infoArray = new Uint8Array(infoBuffer);
  33862. infoArray.set(new Uint8Array(info), 32);
  33863. infoArray[infoArray.length - 1] = 1;
  33864. return Internal.crypto.sign(PRK, infoBuffer.slice(32)).then(function(T1) {
  33865. infoArray.set(new Uint8Array(T1));
  33866. infoArray[infoArray.length - 1] = 2;
  33867. return Internal.crypto.sign(PRK, infoBuffer).then(function(T2) {
  33868. infoArray.set(new Uint8Array(T2));
  33869. infoArray[infoArray.length - 1] = 3;
  33870. return Internal.crypto.sign(PRK, infoBuffer).then(function(T3) {
  33871. return [ T1, T2, T3 ];
  33872. });
  33873. });
  33874. });
  33875. });
  33876. },
  33877. // Curve 25519 crypto
  33878. createKeyPair: function(privKey) {
  33879. if (privKey === undefined) {
  33880. privKey = Internal.crypto.getRandomBytes(32);
  33881. }
  33882. return Internal.Curve.async.createKeyPair(privKey);
  33883. },
  33884. ECDHE: function(pubKey, privKey) {
  33885. return Internal.Curve.async.ECDHE(pubKey, privKey);
  33886. },
  33887. Ed25519Sign: function(privKey, message) {
  33888. return Internal.Curve.async.Ed25519Sign(privKey, message);
  33889. },
  33890. Ed25519Verify: function(pubKey, msg, sig) {
  33891. return Internal.Curve.async.Ed25519Verify(pubKey, msg, sig);
  33892. }
  33893. };
  33894. // HKDF for TextSecure has a bit of additional handling - salts always end up being 32 bytes
  33895. Internal.HKDF = function(input, salt, info) {
  33896. if (salt.byteLength != 32) {
  33897. throw new Error("Got salt of incorrect length");
  33898. }
  33899. return Internal.crypto.HKDF(input, salt, util.toArrayBuffer(info));
  33900. };
  33901. Internal.verifyMAC = function(data, key, mac, length) {
  33902. return Internal.crypto.sign(key, data).then(function(calculated_mac) {
  33903. if (mac.byteLength != length || calculated_mac.byteLength < length) {
  33904. throw new Error("Bad MAC length");
  33905. }
  33906. var a = new Uint8Array(calculated_mac);
  33907. var b = new Uint8Array(mac);
  33908. var result = 0;
  33909. for (var i=0; i < mac.byteLength; ++i) {
  33910. result = result | (a[i] ^ b[i]);
  33911. }
  33912. if (result !== 0) {
  33913. console.log('Our MAC ', dcodeIO.ByteBuffer.wrap(calculated_mac).toHex());
  33914. console.log('Their MAC', dcodeIO.ByteBuffer.wrap(mac).toHex());
  33915. throw new Error("Bad MAC");
  33916. }
  33917. });
  33918. };
  33919. libsignal.HKDF = {
  33920. deriveSecrets: function(input, salt, info) {
  33921. return Internal.HKDF(input, salt, info);
  33922. }
  33923. };
  33924. libsignal.crypto = {
  33925. encrypt: function(key, data, iv) {
  33926. return Internal.crypto.encrypt(key, data, iv);
  33927. },
  33928. decrypt: function(key, data, iv) {
  33929. return Internal.crypto.decrypt(key, data, iv);
  33930. },
  33931. calculateMAC: function(key, data) {
  33932. return Internal.crypto.sign(key, data);
  33933. },
  33934. verifyMAC: function(data, key, mac, length) {
  33935. return Internal.verifyMAC(data, key, mac, length);
  33936. },
  33937. getRandomBytes: function(size) {
  33938. return Internal.crypto.getRandomBytes(size);
  33939. }
  33940. };
  33941. })();
  33942. /*
  33943. * vim: ts=4:sw=4
  33944. */
  33945. var util = (function() {
  33946. 'use strict';
  33947. var StaticArrayBufferProto = new ArrayBuffer().__proto__;
  33948. return {
  33949. toString: function(thing) {
  33950. if (typeof thing == 'string') {
  33951. return thing;
  33952. }
  33953. return new dcodeIO.ByteBuffer.wrap(thing).toString('binary');
  33954. },
  33955. toArrayBuffer: function(thing) {
  33956. if (thing === undefined) {
  33957. return undefined;
  33958. }
  33959. if (thing === Object(thing)) {
  33960. if (thing.__proto__ == StaticArrayBufferProto) {
  33961. return thing;
  33962. }
  33963. }
  33964. var str;
  33965. if (typeof thing == "string") {
  33966. str = thing;
  33967. } else {
  33968. throw new Error("Tried to convert a non-string of type " + typeof thing + " to an array buffer");
  33969. }
  33970. return new dcodeIO.ByteBuffer.wrap(thing, 'binary').toArrayBuffer();
  33971. },
  33972. isEqual: function(a, b) {
  33973. // TODO: Special-case arraybuffers, etc
  33974. if (a === undefined || b === undefined) {
  33975. return false;
  33976. }
  33977. a = util.toString(a);
  33978. b = util.toString(b);
  33979. var maxLength = Math.max(a.length, b.length);
  33980. if (maxLength < 5) {
  33981. throw new Error("a/b compare too short");
  33982. }
  33983. return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length));
  33984. }
  33985. };
  33986. })();
  33987. function isNonNegativeInteger(n) {
  33988. return (typeof n === 'number' && (n % 1) === 0 && n >= 0);
  33989. }
  33990. var KeyHelper = {
  33991. generateIdentityKeyPair: function() {
  33992. return Internal.crypto.createKeyPair();
  33993. },
  33994. generateRegistrationId: function() {
  33995. var registrationId = new Uint16Array(Internal.crypto.getRandomBytes(2))[0];
  33996. return registrationId & 0x3fff;
  33997. },
  33998. generateSignedPreKey: function (identityKeyPair, signedKeyId) {
  33999. if (!(identityKeyPair.privKey instanceof ArrayBuffer) ||
  34000. identityKeyPair.privKey.byteLength != 32 ||
  34001. !(identityKeyPair.pubKey instanceof ArrayBuffer) ||
  34002. identityKeyPair.pubKey.byteLength != 33) {
  34003. throw new TypeError('Invalid argument for identityKeyPair');
  34004. }
  34005. if (!isNonNegativeInteger(signedKeyId)) {
  34006. throw new TypeError(
  34007. 'Invalid argument for signedKeyId: ' + signedKeyId
  34008. );
  34009. }
  34010. return Internal.crypto.createKeyPair().then(function(keyPair) {
  34011. return Internal.crypto.Ed25519Sign(identityKeyPair.privKey, keyPair.pubKey).then(function(sig) {
  34012. return {
  34013. keyId : signedKeyId,
  34014. keyPair : keyPair,
  34015. signature : sig
  34016. };
  34017. });
  34018. });
  34019. },
  34020. generatePreKey: function(keyId) {
  34021. if (!isNonNegativeInteger(keyId)) {
  34022. throw new TypeError('Invalid argument for keyId: ' + keyId);
  34023. }
  34024. return Internal.crypto.createKeyPair().then(function(keyPair) {
  34025. return { keyId: keyId, keyPair: keyPair };
  34026. });
  34027. }
  34028. };
  34029. libsignal.KeyHelper = KeyHelper;
  34030. var Internal = Internal || {};
  34031. Internal.protoText = function() {
  34032. var protoText = {};
  34033. protoText['protos/WhisperTextProtocol.proto'] =
  34034. 'package textsecure;\n' +
  34035. 'option java_package = "org.whispersystems.libsignal.protocol";\n' +
  34036. 'option java_outer_classname = "WhisperProtos";\n' +
  34037. 'message WhisperMessage {\n' +
  34038. ' optional bytes ephemeralKey = 1;\n' +
  34039. ' optional uint32 counter = 2;\n' +
  34040. ' optional uint32 previousCounter = 3;\n' +
  34041. ' optional bytes ciphertext = 4; // PushMessageContent\n' +
  34042. '}\n' +
  34043. 'message PreKeyWhisperMessage {\n' +
  34044. ' optional uint32 registrationId = 5;\n' +
  34045. ' optional uint32 preKeyId = 1;\n' +
  34046. ' optional uint32 signedPreKeyId = 6;\n' +
  34047. ' optional bytes baseKey = 2;\n' +
  34048. ' optional bytes identityKey = 3;\n' +
  34049. ' optional bytes message = 4; // WhisperMessage\n' +
  34050. '}\n' +
  34051. 'message KeyExchangeMessage {\n' +
  34052. ' optional uint32 id = 1;\n' +
  34053. ' optional bytes baseKey = 2;\n' +
  34054. ' optional bytes ephemeralKey = 3;\n' +
  34055. ' optional bytes identityKey = 4;\n' +
  34056. ' optional bytes baseKeySignature = 5;\n' +
  34057. '}\n' +
  34058. '' ;
  34059. return protoText;
  34060. }();
  34061. /* vim: ts=4:sw=4 */
  34062. var Internal = Internal || {};
  34063. Internal.protobuf = function() {
  34064. 'use strict';
  34065. function loadProtoBufs(filename) {
  34066. return dcodeIO.ProtoBuf.loadProto(Internal.protoText['protos/' + filename]).build('textsecure');
  34067. }
  34068. var protocolMessages = loadProtoBufs('WhisperTextProtocol.proto');
  34069. return {
  34070. WhisperMessage : protocolMessages.WhisperMessage,
  34071. PreKeyWhisperMessage : protocolMessages.PreKeyWhisperMessage
  34072. };
  34073. }();
  34074. /*
  34075. * vim: ts=4:sw=4
  34076. */
  34077. var Internal = Internal || {};
  34078. Internal.BaseKeyType = {
  34079. OURS: 1,
  34080. THEIRS: 2
  34081. };
  34082. Internal.ChainType = {
  34083. SENDING: 1,
  34084. RECEIVING: 2
  34085. };
  34086. Internal.SessionRecord = function() {
  34087. 'use strict';
  34088. var ARCHIVED_STATES_MAX_LENGTH = 40;
  34089. var OLD_RATCHETS_MAX_LENGTH = 10;
  34090. var SESSION_RECORD_VERSION = 'v1';
  34091. var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__;
  34092. var StaticArrayBufferProto = new ArrayBuffer().__proto__;
  34093. var StaticUint8ArrayProto = new Uint8Array().__proto__;
  34094. function isStringable(thing) {
  34095. return (thing === Object(thing) &&
  34096. (thing.__proto__ == StaticArrayBufferProto ||
  34097. thing.__proto__ == StaticUint8ArrayProto ||
  34098. thing.__proto__ == StaticByteBufferProto));
  34099. }
  34100. function ensureStringed(thing) {
  34101. if (typeof thing == "string" || typeof thing == "number" || typeof thing == "boolean") {
  34102. return thing;
  34103. } else if (isStringable(thing)) {
  34104. return util.toString(thing);
  34105. } else if (thing instanceof Array) {
  34106. var array = [];
  34107. for (var i = 0; i < thing.length; i++) {
  34108. array[i] = ensureStringed(thing[i]);
  34109. }
  34110. return array;
  34111. } else if (thing === Object(thing)) {
  34112. var obj = {};
  34113. for (var key in thing) {
  34114. try {
  34115. obj[key] = ensureStringed(thing[key]);
  34116. } catch (ex) {
  34117. console.log('Error serializing key', key);
  34118. throw ex;
  34119. }
  34120. }
  34121. return obj;
  34122. } else if (thing === null) {
  34123. return null;
  34124. } else {
  34125. throw new Error("unsure of how to jsonify object of type " + typeof thing);
  34126. }
  34127. }
  34128. function jsonThing(thing) {
  34129. return JSON.stringify(ensureStringed(thing)); //TODO: jquery???
  34130. }
  34131. var migrations = [
  34132. {
  34133. version: 'v1',
  34134. migrate: function migrateV1(data) {
  34135. var sessions = data.sessions;
  34136. var key;
  34137. if (data.registrationId) {
  34138. for (key in sessions) {
  34139. if (!sessions[key].registrationId) {
  34140. sessions[key].registrationId = data.registrationId;
  34141. }
  34142. }
  34143. } else {
  34144. for (key in sessions) {
  34145. if (sessions[key].indexInfo.closed === -1) {
  34146. console.log('V1 session storage migration error: registrationId',
  34147. data.registrationId, 'for open session version',
  34148. data.version);
  34149. }
  34150. }
  34151. }
  34152. }
  34153. }
  34154. ];
  34155. function migrate(data) {
  34156. var run = (data.version === undefined);
  34157. for (var i=0; i < migrations.length; ++i) {
  34158. if (run) {
  34159. migrations[i].migrate(data);
  34160. } else if (migrations[i].version === data.version) {
  34161. run = true;
  34162. }
  34163. }
  34164. if (!run) {
  34165. throw new Error("Error migrating SessionRecord");
  34166. }
  34167. }
  34168. var SessionRecord = function() {
  34169. this.sessions = {};
  34170. this.version = SESSION_RECORD_VERSION;
  34171. };
  34172. SessionRecord.deserialize = function(serialized) {
  34173. var data = JSON.parse(serialized);
  34174. if (data.version !== SESSION_RECORD_VERSION) { migrate(data); }
  34175. var record = new SessionRecord();
  34176. record.sessions = data.sessions;
  34177. if (record.sessions === undefined || record.sessions === null || typeof record.sessions !== "object" || Array.isArray(record.sessions)) {
  34178. throw new Error("Error deserializing SessionRecord");
  34179. }
  34180. return record;
  34181. };
  34182. SessionRecord.prototype = {
  34183. serialize: function() {
  34184. return jsonThing({
  34185. sessions : this.sessions,
  34186. version : this.version
  34187. });
  34188. },
  34189. haveOpenSession: function() {
  34190. var openSession = this.getOpenSession();
  34191. return (!!openSession && !!openSession.registrationId);
  34192. },
  34193. getSessionByBaseKey: function(baseKey) {
  34194. var session = this.sessions[util.toString(baseKey)];
  34195. if (session && session.indexInfo.baseKeyType === Internal.BaseKeyType.OURS) {
  34196. console.log("Tried to lookup a session using our basekey");
  34197. return undefined;
  34198. }
  34199. return session;
  34200. },
  34201. getSessionByRemoteEphemeralKey: function(remoteEphemeralKey) {
  34202. this.detectDuplicateOpenSessions();
  34203. var sessions = this.sessions;
  34204. var searchKey = util.toString(remoteEphemeralKey);
  34205. var openSession;
  34206. for (var key in sessions) {
  34207. if (sessions[key].indexInfo.closed == -1) {
  34208. openSession = sessions[key];
  34209. }
  34210. if (sessions[key][searchKey] !== undefined) {
  34211. return sessions[key];
  34212. }
  34213. }
  34214. if (openSession !== undefined) {
  34215. return openSession;
  34216. }
  34217. return undefined;
  34218. },
  34219. getOpenSession: function() {
  34220. var sessions = this.sessions;
  34221. if (sessions === undefined) {
  34222. return undefined;
  34223. }
  34224. this.detectDuplicateOpenSessions();
  34225. for (var key in sessions) {
  34226. if (sessions[key].indexInfo.closed == -1) {
  34227. return sessions[key];
  34228. }
  34229. }
  34230. return undefined;
  34231. },
  34232. detectDuplicateOpenSessions: function() {
  34233. var openSession;
  34234. var sessions = this.sessions;
  34235. for (var key in sessions) {
  34236. if (sessions[key].indexInfo.closed == -1) {
  34237. if (openSession !== undefined) {
  34238. throw new Error("Datastore inconsistensy: multiple open sessions");
  34239. }
  34240. openSession = sessions[key];
  34241. }
  34242. }
  34243. },
  34244. updateSessionState: function(session) {
  34245. var sessions = this.sessions;
  34246. this.removeOldChains(session);
  34247. sessions[util.toString(session.indexInfo.baseKey)] = session;
  34248. this.removeOldSessions();
  34249. },
  34250. getSessions: function() {
  34251. // return an array of sessions ordered by time closed,
  34252. // followed by the open session
  34253. var list = [];
  34254. var openSession;
  34255. for (var k in this.sessions) {
  34256. if (this.sessions[k].indexInfo.closed === -1) {
  34257. openSession = this.sessions[k];
  34258. } else {
  34259. list.push(this.sessions[k]);
  34260. }
  34261. }
  34262. list = list.sort(function(s1, s2) {
  34263. return s1.indexInfo.closed - s2.indexInfo.closed;
  34264. });
  34265. if (openSession) {
  34266. list.push(openSession);
  34267. }
  34268. return list;
  34269. },
  34270. archiveCurrentState: function() {
  34271. var open_session = this.getOpenSession();
  34272. if (open_session !== undefined) {
  34273. this.closeSession(open_session);
  34274. this.updateSessionState(open_session);
  34275. }
  34276. },
  34277. closeSession: function(session) {
  34278. if (session.indexInfo.closed > -1) {
  34279. return;
  34280. }
  34281. console.log('closing session', session.indexInfo.baseKey);
  34282. // After this has run, we can still receive messages on ratchet chains which
  34283. // were already open (unless we know we dont need them),
  34284. // but we cannot send messages or step the ratchet
  34285. // Delete current sending ratchet
  34286. delete session[util.toString(session.currentRatchet.ephemeralKeyPair.pubKey)];
  34287. // Move all receive ratchets to the oldRatchetList to mark them for deletion
  34288. for (var i in session) {
  34289. if (session[i].chainKey !== undefined && session[i].chainKey.key !== undefined) {
  34290. session.oldRatchetList[session.oldRatchetList.length] = {
  34291. added: Date.now(), ephemeralKey: i
  34292. };
  34293. }
  34294. }
  34295. session.indexInfo.closed = Date.now();
  34296. this.removeOldChains(session);
  34297. },
  34298. removeOldChains: function(session) {
  34299. // Sending ratchets are always removed when we step because we never need them again
  34300. // Receiving ratchets are added to the oldRatchetList, which we parse
  34301. // here and remove all but the last ten.
  34302. while (session.oldRatchetList.length > OLD_RATCHETS_MAX_LENGTH) {
  34303. var index = 0;
  34304. var oldest = session.oldRatchetList[0];
  34305. for (var i = 0; i < session.oldRatchetList.length; i++) {
  34306. if (session.oldRatchetList[i].added < oldest.added) {
  34307. oldest = session.oldRatchetList[i];
  34308. index = i;
  34309. }
  34310. }
  34311. console.log("Deleting chain closed at", oldest.added);
  34312. delete session[util.toString(oldest.ephemeralKey)];
  34313. session.oldRatchetList.splice(index, 1);
  34314. }
  34315. },
  34316. removeOldSessions: function() {
  34317. // Retain only the last 20 sessions
  34318. var sessions = this.sessions;
  34319. var oldestBaseKey, oldestSession;
  34320. while (Object.keys(sessions).length > ARCHIVED_STATES_MAX_LENGTH) {
  34321. for (var key in sessions) {
  34322. var session = sessions[key];
  34323. if (session.indexInfo.closed > -1 && // session is closed
  34324. (!oldestSession || session.indexInfo.closed < oldestSession.indexInfo.closed)) {
  34325. oldestBaseKey = key;
  34326. oldestSession = session;
  34327. }
  34328. }
  34329. console.log("Deleting session closed at", oldestSession.indexInfo.closed);
  34330. delete sessions[util.toString(oldestBaseKey)];
  34331. }
  34332. },
  34333. };
  34334. return SessionRecord;
  34335. }();
  34336. function SignalProtocolAddress(name, deviceId) {
  34337. this.name = name;
  34338. this.deviceId = deviceId;
  34339. }
  34340. SignalProtocolAddress.prototype = {
  34341. getName: function() {
  34342. return this.name;
  34343. },
  34344. getDeviceId: function() {
  34345. return this.deviceId;
  34346. },
  34347. toString: function() {
  34348. return this.name + '.' + this.deviceId;
  34349. },
  34350. equals: function(other) {
  34351. if (!(other instanceof SignalProtocolAddress)) { return false; }
  34352. return other.name === this.name && other.deviceId === this.deviceId;
  34353. }
  34354. };
  34355. libsignal.SignalProtocolAddress = function(name, deviceId) {
  34356. var address = new SignalProtocolAddress(name, deviceId);
  34357. ['getName', 'getDeviceId', 'toString', 'equals'].forEach(function(method) {
  34358. this[method] = address[method].bind(address);
  34359. }.bind(this));
  34360. };
  34361. libsignal.SignalProtocolAddress.fromString = function(encodedAddress) {
  34362. if (typeof encodedAddress !== 'string' || !encodedAddress.match(/.*\.\d+/)) {
  34363. throw new Error('Invalid SignalProtocolAddress string');
  34364. }
  34365. var parts = encodedAddress.split('.');
  34366. return new libsignal.SignalProtocolAddress(parts[0], parseInt(parts[1]));
  34367. };
  34368. function SessionBuilder(storage, remoteAddress) {
  34369. this.remoteAddress = remoteAddress;
  34370. this.storage = storage;
  34371. }
  34372. SessionBuilder.prototype = {
  34373. processPreKey: function(device) {
  34374. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34375. return this.storage.isTrustedIdentity(
  34376. this.remoteAddress.getName(), device.identityKey
  34377. ).then(function(trusted) {
  34378. if (!trusted) {
  34379. throw new Error('Identity key changed');
  34380. }
  34381. return Internal.crypto.Ed25519Verify(
  34382. device.identityKey,
  34383. device.signedPreKey.publicKey,
  34384. device.signedPreKey.signature
  34385. );
  34386. }).then(function() {
  34387. return Internal.crypto.createKeyPair();
  34388. }).then(function(baseKey) {
  34389. var devicePreKey;
  34390. if (device.preKey) {
  34391. devicePreKey = device.preKey.publicKey;
  34392. }
  34393. return this.initSession(true, baseKey, undefined, device.identityKey,
  34394. devicePreKey, device.signedPreKey.publicKey, device.registrationId
  34395. ).then(function(session) {
  34396. session.pendingPreKey = {
  34397. signedKeyId : device.signedPreKey.keyId,
  34398. baseKey : baseKey.pubKey
  34399. };
  34400. if (device.preKey) {
  34401. session.pendingPreKey.preKeyId = device.preKey.keyId;
  34402. }
  34403. return session;
  34404. });
  34405. }.bind(this)).then(function(session) {
  34406. var address = this.remoteAddress.toString();
  34407. return this.storage.loadSession(address).then(function(serialized) {
  34408. var record;
  34409. if (serialized !== undefined) {
  34410. record = Internal.SessionRecord.deserialize(serialized);
  34411. } else {
  34412. record = new Internal.SessionRecord();
  34413. }
  34414. record.archiveCurrentState();
  34415. record.updateSessionState(session, device.registrationId);
  34416. return Promise.all([
  34417. this.storage.storeSession(address, record.serialize()),
  34418. this.storage.saveIdentity(this.remoteAddress.getName(), session.indexInfo.remoteIdentityKey)
  34419. ]);
  34420. }.bind(this));
  34421. }.bind(this));
  34422. }.bind(this));
  34423. },
  34424. processV3: function(record, message) {
  34425. var preKeyPair, signedPreKeyPair, session;
  34426. return this.storage.isTrustedIdentity(
  34427. this.remoteAddress.getName(), message.identityKey.toArrayBuffer()
  34428. ).then(function(trusted) {
  34429. if (!trusted) {
  34430. var e = new Error('Unknown identity key');
  34431. e.identityKey = message.identityKey.toArrayBuffer();
  34432. throw e;
  34433. }
  34434. return Promise.all([
  34435. this.storage.loadPreKey(message.preKeyId),
  34436. this.storage.loadSignedPreKey(message.signedPreKeyId),
  34437. ]).then(function(results) {
  34438. preKeyPair = results[0];
  34439. signedPreKeyPair = results[1];
  34440. });
  34441. }.bind(this)).then(function() {
  34442. session = record.getSessionByBaseKey(message.baseKey);
  34443. if (session) {
  34444. console.log("Duplicate PreKeyMessage for session");
  34445. return;
  34446. }
  34447. session = record.getOpenSession();
  34448. if (signedPreKeyPair === undefined) {
  34449. // Session may or may not be the right one, but if its not, we
  34450. // can't do anything about it ...fall through and let
  34451. // decryptWhisperMessage handle that case
  34452. if (session !== undefined && session.currentRatchet !== undefined) {
  34453. return;
  34454. } else {
  34455. throw new Error("Missing Signed PreKey for PreKeyWhisperMessage");
  34456. }
  34457. }
  34458. if (session !== undefined) {
  34459. record.archiveCurrentState();
  34460. }
  34461. if (message.preKeyId && !preKeyPair) {
  34462. console.log('Invalid prekey id', message.preKeyId);
  34463. }
  34464. return this.initSession(false, preKeyPair, signedPreKeyPair,
  34465. message.identityKey.toArrayBuffer(),
  34466. message.baseKey.toArrayBuffer(), undefined, message.registrationId
  34467. ).then(function(new_session) {
  34468. // Note that the session is not actually saved until the very
  34469. // end of decryptWhisperMessage ... to ensure that the sender
  34470. // actually holds the private keys for all reported pubkeys
  34471. record.updateSessionState(new_session, message.registrationId);
  34472. return this.storage.saveIdentity(this.remoteAddress.getName(), message.identityKey.toArrayBuffer()).then(function() {
  34473. return message.preKeyId;
  34474. });
  34475. }.bind(this));
  34476. }.bind(this));
  34477. },
  34478. initSession: function(isInitiator, ourEphemeralKey, ourSignedKey,
  34479. theirIdentityPubKey, theirEphemeralPubKey,
  34480. theirSignedPubKey, registrationId) {
  34481. return this.storage.getIdentityKeyPair().then(function(ourIdentityKey) {
  34482. if (isInitiator) {
  34483. if (ourSignedKey !== undefined) {
  34484. throw new Error("Invalid call to initSession");
  34485. }
  34486. ourSignedKey = ourEphemeralKey;
  34487. } else {
  34488. if (theirSignedPubKey !== undefined) {
  34489. throw new Error("Invalid call to initSession");
  34490. }
  34491. theirSignedPubKey = theirEphemeralPubKey;
  34492. }
  34493. var sharedSecret;
  34494. if (ourEphemeralKey === undefined || theirEphemeralPubKey === undefined) {
  34495. sharedSecret = new Uint8Array(32 * 4);
  34496. } else {
  34497. sharedSecret = new Uint8Array(32 * 5);
  34498. }
  34499. for (var i = 0; i < 32; i++) {
  34500. sharedSecret[i] = 0xff;
  34501. }
  34502. return Promise.all([
  34503. Internal.crypto.ECDHE(theirSignedPubKey, ourIdentityKey.privKey),
  34504. Internal.crypto.ECDHE(theirIdentityPubKey, ourSignedKey.privKey),
  34505. Internal.crypto.ECDHE(theirSignedPubKey, ourSignedKey.privKey)
  34506. ]).then(function(ecRes) {
  34507. if (isInitiator) {
  34508. sharedSecret.set(new Uint8Array(ecRes[0]), 32);
  34509. sharedSecret.set(new Uint8Array(ecRes[1]), 32 * 2);
  34510. } else {
  34511. sharedSecret.set(new Uint8Array(ecRes[0]), 32 * 2);
  34512. sharedSecret.set(new Uint8Array(ecRes[1]), 32);
  34513. }
  34514. sharedSecret.set(new Uint8Array(ecRes[2]), 32 * 3);
  34515. if (ourEphemeralKey !== undefined && theirEphemeralPubKey !== undefined) {
  34516. return Internal.crypto.ECDHE(
  34517. theirEphemeralPubKey, ourEphemeralKey.privKey
  34518. ).then(function(ecRes4) {
  34519. sharedSecret.set(new Uint8Array(ecRes4), 32 * 4);
  34520. });
  34521. }
  34522. }).then(function() {
  34523. return Internal.HKDF(sharedSecret.buffer, new ArrayBuffer(32), "WhisperText");
  34524. }).then(function(masterKey) {
  34525. var session = {
  34526. registrationId: registrationId,
  34527. currentRatchet: {
  34528. rootKey : masterKey[0],
  34529. lastRemoteEphemeralKey : theirSignedPubKey,
  34530. previousCounter : 0
  34531. },
  34532. indexInfo: {
  34533. remoteIdentityKey : theirIdentityPubKey,
  34534. closed : -1
  34535. },
  34536. oldRatchetList: []
  34537. };
  34538. // If we're initiating we go ahead and set our first sending ephemeral key now,
  34539. // otherwise we figure it out when we first maybeStepRatchet with the remote's ephemeral key
  34540. if (isInitiator) {
  34541. session.indexInfo.baseKey = ourEphemeralKey.pubKey;
  34542. session.indexInfo.baseKeyType = Internal.BaseKeyType.OURS;
  34543. return Internal.crypto.createKeyPair().then(function(ourSendingEphemeralKey) {
  34544. session.currentRatchet.ephemeralKeyPair = ourSendingEphemeralKey;
  34545. return this.calculateSendingRatchet(session, theirSignedPubKey).then(function() {
  34546. return session;
  34547. });
  34548. }.bind(this));
  34549. } else {
  34550. session.indexInfo.baseKey = theirEphemeralPubKey;
  34551. session.indexInfo.baseKeyType = Internal.BaseKeyType.THEIRS;
  34552. session.currentRatchet.ephemeralKeyPair = ourSignedKey;
  34553. return session;
  34554. }
  34555. }.bind(this));
  34556. }.bind(this));
  34557. },
  34558. calculateSendingRatchet: function(session, remoteKey) {
  34559. var ratchet = session.currentRatchet;
  34560. return Internal.crypto.ECDHE(
  34561. remoteKey, util.toArrayBuffer(ratchet.ephemeralKeyPair.privKey)
  34562. ).then(function(sharedSecret) {
  34563. return Internal.HKDF(
  34564. sharedSecret, util.toArrayBuffer(ratchet.rootKey), "WhisperRatchet"
  34565. );
  34566. }).then(function(masterKey) {
  34567. session[util.toString(ratchet.ephemeralKeyPair.pubKey)] = {
  34568. messageKeys : {},
  34569. chainKey : { counter : -1, key : masterKey[1] },
  34570. chainType : Internal.ChainType.SENDING
  34571. };
  34572. ratchet.rootKey = masterKey[0];
  34573. });
  34574. }
  34575. };
  34576. libsignal.SessionBuilder = function (storage, remoteAddress) {
  34577. var builder = new SessionBuilder(storage, remoteAddress);
  34578. this.processPreKey = builder.processPreKey.bind(builder);
  34579. this.processV3 = builder.processV3.bind(builder);
  34580. };
  34581. function SessionCipher(storage, remoteAddress) {
  34582. this.remoteAddress = remoteAddress;
  34583. this.storage = storage;
  34584. }
  34585. SessionCipher.prototype = {
  34586. getRecord: function(encodedNumber) {
  34587. return this.storage.loadSession(encodedNumber).then(function(serialized) {
  34588. if (serialized === undefined) {
  34589. return undefined;
  34590. }
  34591. return Internal.SessionRecord.deserialize(serialized);
  34592. });
  34593. },
  34594. encrypt: function(buffer, encoding) {
  34595. buffer = dcodeIO.ByteBuffer.wrap(buffer, encoding).toArrayBuffer();
  34596. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34597. if (!(buffer instanceof ArrayBuffer)) {
  34598. throw new Error("Expected buffer to be an ArrayBuffer");
  34599. }
  34600. var address = this.remoteAddress.toString();
  34601. var ourIdentityKey, myRegistrationId, record, session, chain;
  34602. var msg = new Internal.protobuf.WhisperMessage();
  34603. return Promise.all([
  34604. this.storage.getIdentityKeyPair(),
  34605. this.storage.getLocalRegistrationId(),
  34606. this.getRecord(address)
  34607. ]).then(function(results) {
  34608. ourIdentityKey = results[0];
  34609. myRegistrationId = results[1];
  34610. record = results[2];
  34611. if (!record) {
  34612. throw new Error("No record for " + address);
  34613. }
  34614. session = record.getOpenSession();
  34615. if (!session) {
  34616. throw new Error("No session to encrypt message for " + address);
  34617. }
  34618. msg.ephemeralKey = util.toArrayBuffer(
  34619. session.currentRatchet.ephemeralKeyPair.pubKey
  34620. );
  34621. chain = session[util.toString(msg.ephemeralKey)];
  34622. if (chain.chainType === Internal.ChainType.RECEIVING) {
  34623. throw new Error("Tried to encrypt on a receiving chain");
  34624. }
  34625. return this.fillMessageKeys(chain, chain.chainKey.counter + 1);
  34626. }.bind(this)).then(function() {
  34627. return Internal.HKDF(
  34628. util.toArrayBuffer(chain.messageKeys[chain.chainKey.counter]),
  34629. new ArrayBuffer(32), "WhisperMessageKeys");
  34630. }).then(function(keys) {
  34631. delete chain.messageKeys[chain.chainKey.counter];
  34632. msg.counter = chain.chainKey.counter;
  34633. msg.previousCounter = session.currentRatchet.previousCounter;
  34634. return Internal.crypto.encrypt(
  34635. keys[0], buffer, keys[2].slice(0, 16)
  34636. ).then(function(ciphertext) {
  34637. msg.ciphertext = ciphertext;
  34638. var encodedMsg = msg.toArrayBuffer();
  34639. var macInput = new Uint8Array(encodedMsg.byteLength + 33*2 + 1);
  34640. macInput.set(new Uint8Array(util.toArrayBuffer(ourIdentityKey.pubKey)));
  34641. macInput.set(new Uint8Array(util.toArrayBuffer(session.indexInfo.remoteIdentityKey)), 33);
  34642. macInput[33*2] = (3 << 4) | 3;
  34643. macInput.set(new Uint8Array(encodedMsg), 33*2 + 1);
  34644. return Internal.crypto.sign(keys[1], macInput.buffer).then(function(mac) {
  34645. var result = new Uint8Array(encodedMsg.byteLength + 9);
  34646. result[0] = (3 << 4) | 3;
  34647. result.set(new Uint8Array(encodedMsg), 1);
  34648. result.set(new Uint8Array(mac, 0, 8), encodedMsg.byteLength + 1);
  34649. record.updateSessionState(session);
  34650. return this.storage.storeSession(address, record.serialize()).then(function() {
  34651. return result;
  34652. });
  34653. }.bind(this));
  34654. }.bind(this));
  34655. }.bind(this)).then(function(message) {
  34656. if (session.pendingPreKey !== undefined) {
  34657. var preKeyMsg = new Internal.protobuf.PreKeyWhisperMessage();
  34658. preKeyMsg.identityKey = util.toArrayBuffer(ourIdentityKey.pubKey);
  34659. preKeyMsg.registrationId = myRegistrationId;
  34660. preKeyMsg.baseKey = util.toArrayBuffer(session.pendingPreKey.baseKey);
  34661. if (session.pendingPreKey.preKeyId) {
  34662. preKeyMsg.preKeyId = session.pendingPreKey.preKeyId;
  34663. }
  34664. preKeyMsg.signedPreKeyId = session.pendingPreKey.signedKeyId;
  34665. preKeyMsg.message = message;
  34666. var result = String.fromCharCode((3 << 4) | 3) + util.toString(preKeyMsg.encode());
  34667. return {
  34668. type : 3,
  34669. body : result,
  34670. registrationId : session.registrationId
  34671. };
  34672. } else {
  34673. return {
  34674. type : 1,
  34675. body : util.toString(message),
  34676. registrationId : session.registrationId
  34677. };
  34678. }
  34679. });
  34680. }.bind(this));
  34681. },
  34682. decryptWithSessionList: function(buffer, sessionList, errors) {
  34683. // Iterate recursively through the list, attempting to decrypt
  34684. // using each one at a time. Stop and return the result if we get
  34685. // a valid result
  34686. if (sessionList.length === 0) {
  34687. return Promise.reject(errors[0]);
  34688. }
  34689. var session = sessionList.pop();
  34690. return this.doDecryptWhisperMessage(buffer, session).then(function(plaintext) {
  34691. return { plaintext: plaintext, session: session };
  34692. }).catch(function(e) {
  34693. errors.push(e);
  34694. return this.decryptWithSessionList(buffer, sessionList, errors);
  34695. }.bind(this));
  34696. },
  34697. decryptWhisperMessage: function(buffer, encoding) {
  34698. buffer = dcodeIO.ByteBuffer.wrap(buffer, encoding).toArrayBuffer();
  34699. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34700. var address = this.remoteAddress.toString();
  34701. return this.getRecord(address).then(function(record) {
  34702. if (!record) {
  34703. throw new Error("No record for device " + address);
  34704. }
  34705. var errors = [];
  34706. return this.decryptWithSessionList(buffer, record.getSessions(), errors).then(function(result) {
  34707. return this.getRecord(address).then(function(record) {
  34708. record.updateSessionState(result.session);
  34709. return this.storage.storeSession(address, record.serialize()).then(function() {
  34710. return result.plaintext;
  34711. });
  34712. }.bind(this));
  34713. }.bind(this));
  34714. }.bind(this));
  34715. }.bind(this));
  34716. },
  34717. decryptPreKeyWhisperMessage: function(buffer, encoding) {
  34718. buffer = dcodeIO.ByteBuffer.wrap(buffer, encoding);
  34719. var version = buffer.readUint8();
  34720. if ((version & 0xF) > 3 || (version >> 4) < 3) { // min version > 3 or max version < 3
  34721. throw new Error("Incompatible version number on PreKeyWhisperMessage");
  34722. }
  34723. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34724. var address = this.remoteAddress.toString();
  34725. return this.getRecord(address).then(function(record) {
  34726. var preKeyProto = Internal.protobuf.PreKeyWhisperMessage.decode(buffer);
  34727. if (!record) {
  34728. if (preKeyProto.registrationId === undefined) {
  34729. throw new Error("No registrationId");
  34730. }
  34731. record = new Internal.SessionRecord(
  34732. preKeyProto.registrationId
  34733. );
  34734. }
  34735. var builder = new SessionBuilder(this.storage, this.remoteAddress);
  34736. return builder.processV3(record, preKeyProto).then(function(preKeyId) {
  34737. var session = record.getSessionByBaseKey(preKeyProto.baseKey);
  34738. return this.doDecryptWhisperMessage(
  34739. preKeyProto.message.toArrayBuffer(), session
  34740. ).then(function(plaintext) {
  34741. record.updateSessionState(session);
  34742. return this.storage.storeSession(address, record.serialize()).then(function() {
  34743. if (preKeyId !== undefined && preKeyId !== null) {
  34744. return this.storage.removePreKey(preKeyId);
  34745. }
  34746. }.bind(this)).then(function() {
  34747. return plaintext;
  34748. });
  34749. }.bind(this));
  34750. }.bind(this));
  34751. }.bind(this));
  34752. }.bind(this));
  34753. },
  34754. doDecryptWhisperMessage: function(messageBytes, session) {
  34755. if (!messageBytes instanceof ArrayBuffer) {
  34756. throw new Error("Expected messageBytes to be an ArrayBuffer");
  34757. }
  34758. var version = (new Uint8Array(messageBytes))[0];
  34759. if ((version & 0xF) > 3 || (version >> 4) < 3) { // min version > 3 or max version < 3
  34760. throw new Error("Incompatible version number on WhisperMessage");
  34761. }
  34762. var messageProto = messageBytes.slice(1, messageBytes.byteLength- 8);
  34763. var mac = messageBytes.slice(messageBytes.byteLength - 8, messageBytes.byteLength);
  34764. var message = Internal.protobuf.WhisperMessage.decode(messageProto);
  34765. var remoteEphemeralKey = message.ephemeralKey.toArrayBuffer();
  34766. if (session === undefined) {
  34767. return Promise.reject(new Error("No session found to decrypt message from " + this.remoteAddress.toString()));
  34768. }
  34769. if (session.indexInfo.closed != -1) {
  34770. console.log('decrypting message for closed session');
  34771. }
  34772. return this.maybeStepRatchet(session, remoteEphemeralKey, message.previousCounter).then(function() {
  34773. var chain = session[util.toString(message.ephemeralKey)];
  34774. if (chain.chainType === Internal.ChainType.SENDING) {
  34775. throw new Error("Tried to decrypt on a sending chain");
  34776. }
  34777. return this.fillMessageKeys(chain, message.counter).then(function() {
  34778. var messageKey = chain.messageKeys[message.counter];
  34779. if (messageKey === undefined) {
  34780. var e = new Error("Message key not found. The counter was repeated or the key was not filled.");
  34781. e.name = 'MessageCounterError';
  34782. throw e;
  34783. }
  34784. delete chain.messageKeys[message.counter];
  34785. return Internal.HKDF(util.toArrayBuffer(messageKey), new ArrayBuffer(32), "WhisperMessageKeys");
  34786. });
  34787. }.bind(this)).then(function(keys) {
  34788. return this.storage.getIdentityKeyPair().then(function(ourIdentityKey) {
  34789. var macInput = new Uint8Array(messageProto.byteLength + 33*2 + 1);
  34790. macInput.set(new Uint8Array(util.toArrayBuffer(session.indexInfo.remoteIdentityKey)));
  34791. macInput.set(new Uint8Array(util.toArrayBuffer(ourIdentityKey.pubKey)), 33);
  34792. macInput[33*2] = (3 << 4) | 3;
  34793. macInput.set(new Uint8Array(messageProto), 33*2 + 1);
  34794. return Internal.verifyMAC(macInput.buffer, keys[1], mac, 8);
  34795. }.bind(this)).then(function() {
  34796. return Internal.crypto.decrypt(keys[0], message.ciphertext.toArrayBuffer(), keys[2].slice(0, 16));
  34797. });
  34798. }.bind(this)).then(function(plaintext) {
  34799. delete session.pendingPreKey;
  34800. return plaintext;
  34801. });
  34802. },
  34803. fillMessageKeys: function(chain, counter) {
  34804. if (Object.keys(chain.messageKeys).length >= 1000) {
  34805. console.log("Too many message keys for chain");
  34806. return Promise.resolve(); // Stalker, much?
  34807. }
  34808. if (chain.chainKey.counter >= counter) {
  34809. return Promise.resolve(); // Already calculated
  34810. }
  34811. if (chain.chainKey.key === undefined) {
  34812. throw new Error("Got invalid request to extend chain after it was already closed");
  34813. }
  34814. var key = util.toArrayBuffer(chain.chainKey.key);
  34815. var byteArray = new Uint8Array(1);
  34816. byteArray[0] = 1;
  34817. return Internal.crypto.sign(key, byteArray.buffer).then(function(mac) {
  34818. byteArray[0] = 2;
  34819. return Internal.crypto.sign(key, byteArray.buffer).then(function(key) {
  34820. chain.messageKeys[chain.chainKey.counter + 1] = mac;
  34821. chain.chainKey.key = key;
  34822. chain.chainKey.counter += 1;
  34823. return this.fillMessageKeys(chain, counter);
  34824. }.bind(this));
  34825. }.bind(this));
  34826. },
  34827. maybeStepRatchet: function(session, remoteKey, previousCounter) {
  34828. if (session[util.toString(remoteKey)] !== undefined) {
  34829. return Promise.resolve();
  34830. }
  34831. console.log('New remote ephemeral key');
  34832. var ratchet = session.currentRatchet;
  34833. return Promise.resolve().then(function() {
  34834. var previousRatchet = session[util.toString(ratchet.lastRemoteEphemeralKey)];
  34835. if (previousRatchet !== undefined) {
  34836. return this.fillMessageKeys(previousRatchet, previousCounter).then(function() {
  34837. delete previousRatchet.chainKey.key;
  34838. session.oldRatchetList[session.oldRatchetList.length] = {
  34839. added : Date.now(),
  34840. ephemeralKey : ratchet.lastRemoteEphemeralKey
  34841. };
  34842. });
  34843. }
  34844. }.bind(this)).then(function() {
  34845. return this.calculateRatchet(session, remoteKey, false).then(function() {
  34846. // Now swap the ephemeral key and calculate the new sending chain
  34847. var previousRatchet = util.toString(ratchet.ephemeralKeyPair.pubKey);
  34848. if (session[previousRatchet] !== undefined) {
  34849. ratchet.previousCounter = session[previousRatchet].chainKey.counter;
  34850. delete session[previousRatchet];
  34851. }
  34852. return Internal.crypto.createKeyPair().then(function(keyPair) {
  34853. ratchet.ephemeralKeyPair = keyPair;
  34854. return this.calculateRatchet(session, remoteKey, true).then(function() {
  34855. ratchet.lastRemoteEphemeralKey = remoteKey;
  34856. }.bind(this));
  34857. }.bind(this));
  34858. }.bind(this));
  34859. }.bind(this));
  34860. },
  34861. calculateRatchet: function(session, remoteKey, sending) {
  34862. var ratchet = session.currentRatchet;
  34863. return Internal.crypto.ECDHE(remoteKey, util.toArrayBuffer(ratchet.ephemeralKeyPair.privKey)).then(function(sharedSecret) {
  34864. return Internal.HKDF(sharedSecret, util.toArrayBuffer(ratchet.rootKey), "WhisperRatchet").then(function(masterKey) {
  34865. var ephemeralPublicKey;
  34866. if (sending) {
  34867. ephemeralPublicKey = ratchet.ephemeralKeyPair.pubKey;
  34868. }
  34869. else {
  34870. ephemeralPublicKey = remoteKey;
  34871. }
  34872. session[util.toString(ephemeralPublicKey)] = {
  34873. messageKeys: {},
  34874. chainKey: { counter: -1, key: masterKey[1] },
  34875. chainType: sending ? Internal.ChainType.SENDING : Internal.ChainType.RECEIVING
  34876. };
  34877. ratchet.rootKey = masterKey[0];
  34878. });
  34879. });
  34880. },
  34881. getRemoteRegistrationId: function() {
  34882. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34883. return this.getRecord(this.remoteAddress.toString()).then(function(record) {
  34884. if (record === undefined) {
  34885. return undefined;
  34886. }
  34887. var openSession = record.getOpenSession();
  34888. if (openSession === undefined) {
  34889. return null;
  34890. }
  34891. return openSession.registrationId;
  34892. });
  34893. }.bind(this));
  34894. },
  34895. hasOpenSession: function() {
  34896. return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() {
  34897. return this.getRecord(this.remoteAddress.toString()).then(function(record) {
  34898. if (record === undefined) {
  34899. return false;
  34900. }
  34901. return record.haveOpenSession();
  34902. });
  34903. }.bind(this));
  34904. },
  34905. closeOpenSessionForDevice: function() {
  34906. var address = this.remoteAddress.toString();
  34907. return Internal.SessionLock.queueJobForNumber(address, function() {
  34908. return this.getRecord(address).then(function(record) {
  34909. if (record === undefined || record.getOpenSession() === undefined) {
  34910. return;
  34911. }
  34912. record.archiveCurrentState();
  34913. return this.storage.storeSession(address, record.serialize());
  34914. }.bind(this));
  34915. }.bind(this));
  34916. }
  34917. };
  34918. libsignal.SessionCipher = function(storage, remoteAddress) {
  34919. var cipher = new SessionCipher(storage, remoteAddress);
  34920. // returns a Promise that resolves to a ciphertext object
  34921. this.encrypt = cipher.encrypt.bind(cipher);
  34922. // returns a Promise that inits a session if necessary and resolves
  34923. // to a decrypted plaintext array buffer
  34924. this.decryptPreKeyWhisperMessage = cipher.decryptPreKeyWhisperMessage.bind(cipher);
  34925. // returns a Promise that resolves to decrypted plaintext array buffer
  34926. this.decryptWhisperMessage = cipher.decryptWhisperMessage.bind(cipher);
  34927. this.getRemoteRegistrationId = cipher.getRemoteRegistrationId.bind(cipher);
  34928. this.hasOpenSession = cipher.hasOpenSession.bind(cipher);
  34929. this.closeOpenSessionForDevice = cipher.closeOpenSessionForDevice.bind(cipher);
  34930. };
  34931. /*
  34932. * jobQueue manages multiple queues indexed by device to serialize
  34933. * session io ops on the database.
  34934. */
  34935. ;(function() {
  34936. 'use strict';
  34937. Internal.SessionLock = {};
  34938. var jobQueue = {};
  34939. Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJob) {
  34940. var runPrevious = jobQueue[number] || Promise.resolve();
  34941. var runCurrent = jobQueue[number] = runPrevious.then(runJob, runJob);
  34942. runCurrent.then(function() {
  34943. if (jobQueue[number] === runCurrent) {
  34944. delete jobQueue[number];
  34945. }
  34946. });
  34947. return runCurrent;
  34948. };
  34949. })();
  34950. (function() {
  34951. var VERSION = 0;
  34952. function iterateHash(data, key, count) {
  34953. data = dcodeIO.ByteBuffer.concat([data, key]).toArrayBuffer();
  34954. return Internal.crypto.hash(data).then(function(result) {
  34955. if (--count === 0) {
  34956. return result;
  34957. } else {
  34958. return iterateHash(result, key, count);
  34959. }
  34960. });
  34961. }
  34962. function shortToArrayBuffer(number) {
  34963. return new Uint16Array([number]).buffer;
  34964. }
  34965. function getEncodedChunk(hash, offset) {
  34966. var chunk = ( hash[offset] * Math.pow(2,32) +
  34967. hash[offset+1] * Math.pow(2,24) +
  34968. hash[offset+2] * Math.pow(2,16) +
  34969. hash[offset+3] * Math.pow(2,8) +
  34970. hash[offset+4] ) % 100000;
  34971. var s = chunk.toString();
  34972. while (s.length < 5) {
  34973. s = '0' + s;
  34974. }
  34975. return s;
  34976. }
  34977. function getDisplayStringFor(identifier, key, iterations) {
  34978. var bytes = dcodeIO.ByteBuffer.concat([
  34979. shortToArrayBuffer(VERSION), key, identifier
  34980. ]).toArrayBuffer();
  34981. return iterateHash(bytes, key, iterations).then(function(output) {
  34982. output = new Uint8Array(output);
  34983. return getEncodedChunk(output, 0) +
  34984. getEncodedChunk(output, 5) +
  34985. getEncodedChunk(output, 10) +
  34986. getEncodedChunk(output, 15) +
  34987. getEncodedChunk(output, 20) +
  34988. getEncodedChunk(output, 25);
  34989. });
  34990. }
  34991. libsignal.FingerprintGenerator = function(iterations) {
  34992. this.iterations = iterations;
  34993. };
  34994. libsignal.FingerprintGenerator.prototype = {
  34995. createFor: function(localIdentifier, localIdentityKey,
  34996. remoteIdentifier, remoteIdentityKey) {
  34997. if (typeof localIdentifier !== 'string' ||
  34998. typeof remoteIdentifier !== 'string' ||
  34999. !(localIdentityKey instanceof ArrayBuffer) ||
  35000. !(remoteIdentityKey instanceof ArrayBuffer)) {
  35001. throw new Error('Invalid arguments');
  35002. }
  35003. return Promise.all([
  35004. getDisplayStringFor(localIdentifier, localIdentityKey, this.iterations),
  35005. getDisplayStringFor(remoteIdentifier, remoteIdentityKey, this.iterations)
  35006. ]).then(function(fingerprints) {
  35007. return fingerprints.sort().join('');
  35008. });
  35009. }
  35010. };
  35011. })();
  35012. })();
  35013. /*
  35014. * vim: ts=4:sw=4:expandtab
  35015. */
  35016. ;(function() {
  35017. 'use strict';
  35018. window.textsecure = window.textsecure || {};
  35019. window.textsecure.storage = window.textsecure.storage || {};
  35020. textsecure.storage.protocol = new SignalProtocolStore();
  35021. textsecure.ProvisioningCipher = libsignal.ProvisioningCipher;
  35022. textsecure.startWorker = libsignal.worker.startWorker;
  35023. textsecure.stopWorker = libsignal.worker.stopWorker;
  35024. })();
  35025. /*
  35026. * vim: ts=4:sw=4:expandtab
  35027. */
  35028. ;(function(){
  35029. 'use strict';
  35030. var encrypt = libsignal.crypto.encrypt;
  35031. var decrypt = libsignal.crypto.decrypt;
  35032. var calculateMAC = libsignal.crypto.calculateMAC;
  35033. var verifyMAC = libsignal.crypto.verifyMAC;
  35034. window.textsecure = window.textsecure || {};
  35035. window.textsecure.crypto = {
  35036. // Decrypts message into a raw string
  35037. decryptWebsocketMessage: function(message, signaling_key) {
  35038. var decodedMessage = message.toArrayBuffer();
  35039. if (signaling_key.byteLength != 52) {
  35040. throw new Error("Got invalid length signaling_key");
  35041. }
  35042. if (decodedMessage.byteLength < 1 + 16 + 10) {
  35043. throw new Error("Got invalid length message");
  35044. }
  35045. if (new Uint8Array(decodedMessage)[0] != 1) {
  35046. throw new Error("Got bad version number: " + decodedMessage[0]);
  35047. }
  35048. var aes_key = signaling_key.slice(0, 32);
  35049. var mac_key = signaling_key.slice(32, 32 + 20);
  35050. var iv = decodedMessage.slice(1, 1 + 16);
  35051. var ciphertext = decodedMessage.slice(1 + 16, decodedMessage.byteLength - 10);
  35052. var ivAndCiphertext = decodedMessage.slice(0, decodedMessage.byteLength - 10);
  35053. var mac = decodedMessage.slice(decodedMessage.byteLength - 10, decodedMessage.byteLength);
  35054. return verifyMAC(ivAndCiphertext, mac_key, mac, 10).then(function() {
  35055. return decrypt(aes_key, ciphertext, iv);
  35056. });
  35057. },
  35058. decryptAttachment: function(encryptedBin, keys) {
  35059. if (keys.byteLength != 64) {
  35060. throw new Error("Got invalid length attachment keys");
  35061. }
  35062. if (encryptedBin.byteLength < 16 + 32) {
  35063. throw new Error("Got invalid length attachment");
  35064. }
  35065. var aes_key = keys.slice(0, 32);
  35066. var mac_key = keys.slice(32, 64);
  35067. var iv = encryptedBin.slice(0, 16);
  35068. var ciphertext = encryptedBin.slice(16, encryptedBin.byteLength - 32);
  35069. var ivAndCiphertext = encryptedBin.slice(0, encryptedBin.byteLength - 32);
  35070. var mac = encryptedBin.slice(encryptedBin.byteLength - 32, encryptedBin.byteLength);
  35071. return verifyMAC(ivAndCiphertext, mac_key, mac, 32).then(function() {
  35072. return decrypt(aes_key, ciphertext, iv);
  35073. });
  35074. },
  35075. encryptAttachment: function(plaintext, keys, iv) {
  35076. if (keys.byteLength != 64) {
  35077. throw new Error("Got invalid length attachment keys");
  35078. }
  35079. if (iv.byteLength != 16) {
  35080. throw new Error("Got invalid length attachment iv");
  35081. }
  35082. var aes_key = keys.slice(0, 32);
  35083. var mac_key = keys.slice(32, 64);
  35084. return encrypt(aes_key, plaintext, iv).then(function(ciphertext) {
  35085. var ivAndCiphertext = new Uint8Array(16 + ciphertext.byteLength);
  35086. ivAndCiphertext.set(new Uint8Array(iv));
  35087. ivAndCiphertext.set(new Uint8Array(ciphertext), 16);
  35088. return calculateMAC(mac_key, ivAndCiphertext.buffer).then(function(mac) {
  35089. var encryptedBin = new Uint8Array(16 + ciphertext.byteLength + 32);
  35090. encryptedBin.set(ivAndCiphertext);
  35091. encryptedBin.set(new Uint8Array(mac), 16 + ciphertext.byteLength);
  35092. return encryptedBin.buffer;
  35093. });
  35094. });
  35095. },
  35096. getRandomBytes: function(size) {
  35097. return libsignal.crypto.getRandomBytes(size);
  35098. }
  35099. };
  35100. })();
  35101. /*
  35102. * vim: ts=4:sw=4:expandtab
  35103. */
  35104. 'use strict';
  35105. ;(function() {
  35106. /************************************************
  35107. *** Utilities to store data in local storage ***
  35108. ************************************************/
  35109. window.textsecure = window.textsecure || {};
  35110. window.textsecure.storage = window.textsecure.storage || {};
  35111. // Overrideable storage implementation
  35112. window.textsecure.storage.impl = window.textsecure.storage.impl || {
  35113. /*****************************
  35114. *** Base Storage Routines ***
  35115. *****************************/
  35116. put: function(key, value) {
  35117. if (value === undefined)
  35118. throw new Error("Tried to store undefined");
  35119. localStorage.setItem("" + key, textsecure.utils.jsonThing(value));
  35120. },
  35121. get: function(key, defaultValue) {
  35122. var value = localStorage.getItem("" + key);
  35123. if (value === null)
  35124. return defaultValue;
  35125. return JSON.parse(value);
  35126. },
  35127. remove: function(key) {
  35128. localStorage.removeItem("" + key);
  35129. },
  35130. };
  35131. window.textsecure.storage.put = function(key, value) {
  35132. return textsecure.storage.impl.put(key, value);
  35133. };
  35134. window.textsecure.storage.get = function(key, defaultValue) {
  35135. return textsecure.storage.impl.get(key, defaultValue);
  35136. };
  35137. window.textsecure.storage.remove = function(key) {
  35138. return textsecure.storage.impl.remove(key);
  35139. };
  35140. })();
  35141. /*
  35142. * vim: ts=4:sw=4:expandtab
  35143. */
  35144. 'use strict';
  35145. ;(function() {
  35146. /*********************************************
  35147. *** Utilities to store data about the user ***
  35148. **********************************************/
  35149. window.textsecure = window.textsecure || {};
  35150. window.textsecure.storage = window.textsecure.storage || {};
  35151. window.textsecure.storage.user = {
  35152. setNumberAndDeviceId: function(number, deviceId, deviceName) {
  35153. textsecure.storage.put("number_id", number + "." + deviceId);
  35154. if (deviceName) {
  35155. textsecure.storage.put("device_name", deviceName);
  35156. }
  35157. },
  35158. getNumber: function(key, defaultValue) {
  35159. var number_id = textsecure.storage.get("number_id");
  35160. if (number_id === undefined)
  35161. return undefined;
  35162. return textsecure.utils.unencodeNumber(number_id)[0];
  35163. },
  35164. getDeviceId: function(key) {
  35165. var number_id = textsecure.storage.get("number_id");
  35166. if (number_id === undefined)
  35167. return undefined;
  35168. return textsecure.utils.unencodeNumber(number_id)[1];
  35169. },
  35170. getDeviceName: function(key) {
  35171. return textsecure.storage.get("device_name");
  35172. }
  35173. };
  35174. })();
  35175. /*
  35176. * vim: ts=4:sw=4:expandtab
  35177. */
  35178. 'use strict';
  35179. ;(function() {
  35180. /*********************
  35181. *** Group Storage ***
  35182. *********************/
  35183. window.textsecure = window.textsecure || {};
  35184. window.textsecure.storage = window.textsecure.storage || {};
  35185. // create a random group id that we haven't seen before.
  35186. function generateNewGroupId() {
  35187. var groupId = getString(libsignal.crypto.getRandomBytes(16));
  35188. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35189. if (group === undefined) {
  35190. return groupId;
  35191. } else {
  35192. console.warn('group id collision'); // probably a bad sign.
  35193. return generateNewGroupId();
  35194. }
  35195. });
  35196. }
  35197. window.textsecure.storage.groups = {
  35198. createNewGroup: function(numbers, groupId) {
  35199. var groupId = groupId;
  35200. return new Promise(function(resolve) {
  35201. if (groupId !== undefined) {
  35202. resolve(textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35203. if (group !== undefined) {
  35204. throw new Error("Tried to recreate group");
  35205. }
  35206. }));
  35207. } else {
  35208. resolve(generateNewGroupId().then(function(newGroupId) {
  35209. groupId = newGroupId;
  35210. }));
  35211. }
  35212. }).then(function() {
  35213. var me = textsecure.storage.user.getNumber();
  35214. var haveMe = false;
  35215. var finalNumbers = [];
  35216. for (var i in numbers) {
  35217. var number = numbers[i];
  35218. if (!textsecure.utils.isNumberSane(number))
  35219. throw new Error("Invalid number in group");
  35220. if (number == me)
  35221. haveMe = true;
  35222. if (finalNumbers.indexOf(number) < 0)
  35223. finalNumbers.push(number);
  35224. }
  35225. if (!haveMe)
  35226. finalNumbers.push(me);
  35227. var groupObject = {numbers: finalNumbers, numberRegistrationIds: {}};
  35228. for (var i in finalNumbers)
  35229. groupObject.numberRegistrationIds[finalNumbers[i]] = {};
  35230. return textsecure.storage.protocol.putGroup(groupId, groupObject).then(function() {
  35231. return {id: groupId, numbers: finalNumbers};
  35232. });
  35233. });
  35234. },
  35235. getNumbers: function(groupId) {
  35236. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35237. if (group === undefined)
  35238. return undefined;
  35239. return group.numbers;
  35240. });
  35241. },
  35242. removeNumber: function(groupId, number) {
  35243. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35244. if (group === undefined)
  35245. return undefined;
  35246. var me = textsecure.storage.user.getNumber();
  35247. if (number == me)
  35248. throw new Error("Cannot remove ourselves from a group, leave the group instead");
  35249. var i = group.numbers.indexOf(number);
  35250. if (i > -1) {
  35251. group.numbers.splice(i, 1);
  35252. delete group.numberRegistrationIds[number];
  35253. return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
  35254. return group.numbers;
  35255. });
  35256. }
  35257. return group.numbers;
  35258. });
  35259. },
  35260. addNumbers: function(groupId, numbers) {
  35261. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35262. if (group === undefined)
  35263. return undefined;
  35264. for (var i in numbers) {
  35265. var number = numbers[i];
  35266. if (!textsecure.utils.isNumberSane(number))
  35267. throw new Error("Invalid number in set to add to group");
  35268. if (group.numbers.indexOf(number) < 0) {
  35269. group.numbers.push(number);
  35270. group.numberRegistrationIds[number] = {};
  35271. }
  35272. }
  35273. return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
  35274. return group.numbers;
  35275. });
  35276. });
  35277. },
  35278. deleteGroup: function(groupId) {
  35279. return textsecure.storage.protocol.removeGroup(groupId);
  35280. },
  35281. getGroup: function(groupId) {
  35282. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35283. if (group === undefined)
  35284. return undefined;
  35285. return { id: groupId, numbers: group.numbers };
  35286. });
  35287. },
  35288. updateNumbers: function(groupId, numbers) {
  35289. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35290. if (group === undefined)
  35291. throw new Error("Tried to update numbers for unknown group");
  35292. if (numbers.filter(textsecure.utils.isNumberSane).length < numbers.length)
  35293. throw new Error("Invalid number in new group members");
  35294. var added = numbers.filter(function(number) { return group.numbers.indexOf(number) < 0; });
  35295. return textsecure.storage.groups.addNumbers(groupId, added);
  35296. });
  35297. },
  35298. needUpdateByDeviceRegistrationId: function(groupId, number, encodedNumber, registrationId) {
  35299. return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
  35300. if (group === undefined)
  35301. throw new Error("Unknown group for device registration id");
  35302. if (group.numberRegistrationIds[number] === undefined)
  35303. throw new Error("Unknown number in group for device registration id");
  35304. if (group.numberRegistrationIds[number][encodedNumber] == registrationId)
  35305. return false;
  35306. var needUpdate = group.numberRegistrationIds[number][encodedNumber] !== undefined;
  35307. group.numberRegistrationIds[number][encodedNumber] = registrationId;
  35308. return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
  35309. return needUpdate;
  35310. });
  35311. });
  35312. },
  35313. };
  35314. })();
  35315. ;(function() {
  35316. 'use strict';
  35317. window.textsecure = window.textsecure || {};
  35318. window.textsecure.protobuf = {};
  35319. function loadProtoBufs(filename) {
  35320. return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}, function(error, result) {
  35321. var protos = result.build('textsecure');
  35322. for (var protoName in protos) {
  35323. textsecure.protobuf[protoName] = protos[protoName];
  35324. }
  35325. });
  35326. };
  35327. loadProtoBufs('IncomingPushMessageSignal.proto');
  35328. loadProtoBufs('SubProtocol.proto');
  35329. loadProtoBufs('DeviceMessages.proto');
  35330. })();
  35331. /*
  35332. * vim: ts=4:sw=4:expandtab
  35333. */
  35334. ;(function(){
  35335. 'use strict';
  35336. /*
  35337. * WebSocket-Resources
  35338. *
  35339. * Create a request-response interface over websockets using the
  35340. * WebSocket-Resources sub-protocol[1].
  35341. *
  35342. * var client = new WebSocketResource(socket, function(request) {
  35343. * request.respond(200, 'OK');
  35344. * });
  35345. *
  35346. * client.sendRequest({
  35347. * verb: 'PUT',
  35348. * path: '/v1/messages',
  35349. * body: '{ some: "json" }',
  35350. * success: function(message, status, request) {...},
  35351. * error: function(message, status, request) {...}
  35352. * });
  35353. *
  35354. * 1. https://github.com/WhisperSystems/WebSocket-Resources
  35355. *
  35356. */
  35357. var Request = function(options) {
  35358. this.verb = options.verb || options.type;
  35359. this.path = options.path || options.url;
  35360. this.body = options.body || options.data;
  35361. this.success = options.success;
  35362. this.error = options.error;
  35363. this.id = options.id;
  35364. if (this.id === undefined) {
  35365. var bits = new Uint32Array(2);
  35366. window.crypto.getRandomValues(bits);
  35367. this.id = dcodeIO.Long.fromBits(bits[0], bits[1], true);
  35368. }
  35369. if (this.body === undefined) {
  35370. this.body = null;
  35371. }
  35372. };
  35373. var IncomingWebSocketRequest = function(options) {
  35374. var request = new Request(options);
  35375. var socket = options.socket;
  35376. this.verb = request.verb;
  35377. this.path = request.path;
  35378. this.body = request.body;
  35379. this.respond = function(status, message) {
  35380. socket.send(
  35381. new textsecure.protobuf.WebSocketMessage({
  35382. type: textsecure.protobuf.WebSocketMessage.Type.RESPONSE,
  35383. response: { id: request.id, message: message, status: status }
  35384. }).encode().toArrayBuffer()
  35385. );
  35386. };
  35387. };
  35388. var outgoing = {};
  35389. var OutgoingWebSocketRequest = function(options, socket) {
  35390. var request = new Request(options);
  35391. outgoing[request.id] = request;
  35392. socket.send(
  35393. new textsecure.protobuf.WebSocketMessage({
  35394. type: textsecure.protobuf.WebSocketMessage.Type.REQUEST,
  35395. request: {
  35396. verb : request.verb,
  35397. path : request.path,
  35398. body : request.body,
  35399. id : request.id
  35400. }
  35401. }).encode().toArrayBuffer()
  35402. );
  35403. };
  35404. window.WebSocketResource = function(socket, opts) {
  35405. opts = opts || {};
  35406. var handleRequest = opts.handleRequest;
  35407. if (typeof handleRequest !== 'function') {
  35408. handleRequest = function(request) {
  35409. request.respond(404, 'Not found');
  35410. };
  35411. }
  35412. this.sendRequest = function(options) {
  35413. return new OutgoingWebSocketRequest(options, socket);
  35414. };
  35415. socket.onmessage = function(socketMessage) {
  35416. var blob = socketMessage.data;
  35417. var reader = new FileReader();
  35418. reader.onload = function() {
  35419. var message = textsecure.protobuf.WebSocketMessage.decode(reader.result);
  35420. if (message.type === textsecure.protobuf.WebSocketMessage.Type.REQUEST ) {
  35421. handleRequest(
  35422. new IncomingWebSocketRequest({
  35423. verb : message.request.verb,
  35424. path : message.request.path,
  35425. body : message.request.body,
  35426. id : message.request.id,
  35427. socket : socket
  35428. })
  35429. );
  35430. }
  35431. else if (message.type === textsecure.protobuf.WebSocketMessage.Type.RESPONSE ) {
  35432. var response = message.response;
  35433. var request = outgoing[response.id];
  35434. if (request) {
  35435. request.response = response;
  35436. var callback = request.error;
  35437. if (response.status >= 200 && response.status < 300) {
  35438. callback = request.success;
  35439. }
  35440. if (typeof callback === 'function') {
  35441. callback(response.message, response.status, request);
  35442. }
  35443. } else {
  35444. throw 'Received response for unknown request ' + message.response.id;
  35445. }
  35446. }
  35447. };
  35448. reader.readAsArrayBuffer(blob);
  35449. };
  35450. if (opts.keepalive) {
  35451. var keepalive = new KeepAlive(this, {
  35452. path : opts.keepalive.path,
  35453. disconnect : opts.keepalive.disconnect
  35454. });
  35455. var resetKeepAliveTimer = keepalive.reset.bind(keepalive);
  35456. socket.addEventListener('open', resetKeepAliveTimer);
  35457. socket.addEventListener('message', resetKeepAliveTimer);
  35458. socket.addEventListener('close', keepalive.stop.bind(keepalive));
  35459. }
  35460. this.close = function(code, reason) {
  35461. if (!code) { code = 3000; }
  35462. socket.close(code, reason);
  35463. };
  35464. };
  35465. function KeepAlive(websocketResource, opts) {
  35466. if (websocketResource instanceof WebSocketResource) {
  35467. opts = opts || {};
  35468. this.path = opts.path;
  35469. if (this.path === undefined) {
  35470. this.path = '/';
  35471. }
  35472. this.disconnect = opts.disconnect;
  35473. if (this.disconnect === undefined) {
  35474. this.disconnect = true;
  35475. }
  35476. this.wsr = websocketResource;
  35477. } else {
  35478. throw new TypeError('KeepAlive expected a WebSocketResource');
  35479. }
  35480. }
  35481. KeepAlive.prototype = {
  35482. constructor: KeepAlive,
  35483. stop: function() {
  35484. clearTimeout(this.keepAliveTimer);
  35485. clearTimeout(this.disconnectTimer);
  35486. },
  35487. reset: function() {
  35488. clearTimeout(this.keepAliveTimer);
  35489. clearTimeout(this.disconnectTimer);
  35490. this.keepAliveTimer = setTimeout(function() {
  35491. this.wsr.sendRequest({
  35492. verb: 'GET',
  35493. path: this.path,
  35494. success: this.reset.bind(this)
  35495. });
  35496. if (this.disconnect) {
  35497. // automatically disconnect if server doesn't ack
  35498. this.disconnectTimer = setTimeout(function() {
  35499. clearTimeout(this.keepAliveTimer);
  35500. this.wsr.close(3001, 'No response to keepalive request');
  35501. }.bind(this), 1000);
  35502. } else {
  35503. this.reset();
  35504. }
  35505. }.bind(this), 55000);
  35506. },
  35507. };
  35508. }());
  35509. /*
  35510. * vim: ts=4:sw=4:expandtab
  35511. */
  35512. window.textsecure = window.textsecure || {};
  35513. /*********************************
  35514. *** Type conversion utilities ***
  35515. *********************************/
  35516. // Strings/arrays
  35517. //TODO: Throw all this shit in favor of consistent types
  35518. //TODO: Namespace
  35519. var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__;
  35520. var StaticArrayBufferProto = new ArrayBuffer().__proto__;
  35521. var StaticUint8ArrayProto = new Uint8Array().__proto__;
  35522. function getString(thing) {
  35523. if (thing === Object(thing)) {
  35524. if (thing.__proto__ == StaticUint8ArrayProto)
  35525. return String.fromCharCode.apply(null, thing);
  35526. if (thing.__proto__ == StaticArrayBufferProto)
  35527. return getString(new Uint8Array(thing));
  35528. if (thing.__proto__ == StaticByteBufferProto)
  35529. return thing.toString("binary");
  35530. }
  35531. return thing;
  35532. }
  35533. function getStringable(thing) {
  35534. return (typeof thing == "string" || typeof thing == "number" || typeof thing == "boolean" ||
  35535. (thing === Object(thing) &&
  35536. (thing.__proto__ == StaticArrayBufferProto ||
  35537. thing.__proto__ == StaticUint8ArrayProto ||
  35538. thing.__proto__ == StaticByteBufferProto)));
  35539. }
  35540. // Number formatting utils
  35541. window.textsecure.utils = function() {
  35542. var self = {};
  35543. self.unencodeNumber = function(number) {
  35544. return number.split(".");
  35545. };
  35546. self.isNumberSane = function(number) {
  35547. return number[0] == "+" &&
  35548. /^[0-9]+$/.test(number.substring(1));
  35549. }
  35550. /**************************
  35551. *** JSON'ing Utilities ***
  35552. **************************/
  35553. function ensureStringed(thing) {
  35554. if (getStringable(thing))
  35555. return getString(thing);
  35556. else if (thing instanceof Array) {
  35557. var res = [];
  35558. for (var i = 0; i < thing.length; i++)
  35559. res[i] = ensureStringed(thing[i]);
  35560. return res;
  35561. } else if (thing === Object(thing)) {
  35562. var res = {};
  35563. for (var key in thing)
  35564. res[key] = ensureStringed(thing[key]);
  35565. return res;
  35566. } else if (thing === null) {
  35567. return null;
  35568. }
  35569. throw new Error("unsure of how to jsonify object of type " + typeof thing);
  35570. }
  35571. self.jsonThing = function(thing) {
  35572. return JSON.stringify(ensureStringed(thing));
  35573. }
  35574. return self;
  35575. }();
  35576. /*
  35577. * vim: ts=4:sw=4:expandtab
  35578. */
  35579. ;(function() {
  35580. "use strict";
  35581. window.StringView = {
  35582. /*
  35583. * These functions from the Mozilla Developer Network
  35584. * and have been placed in the public domain.
  35585. * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
  35586. * https://developer.mozilla.org/en-US/docs/MDN/About#Copyrights_and_licenses
  35587. */
  35588. b64ToUint6: function(nChr) {
  35589. return nChr > 64 && nChr < 91 ?
  35590. nChr - 65
  35591. : nChr > 96 && nChr < 123 ?
  35592. nChr - 71
  35593. : nChr > 47 && nChr < 58 ?
  35594. nChr + 4
  35595. : nChr === 43 ?
  35596. 62
  35597. : nChr === 47 ?
  35598. 63
  35599. :
  35600. 0;
  35601. },
  35602. base64ToBytes: function(sBase64, nBlocksSize) {
  35603. var
  35604. sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, ""), nInLen = sB64Enc.length,
  35605. nOutLen = nBlocksSize ? Math.ceil((nInLen * 3 + 1 >> 2) / nBlocksSize) * nBlocksSize : nInLen * 3 + 1 >> 2;
  35606. var aBBytes = new ArrayBuffer(nOutLen);
  35607. var taBytes = new Uint8Array(aBBytes);
  35608. for (var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) {
  35609. nMod4 = nInIdx & 3;
  35610. nUint24 |= StringView.b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4;
  35611. if (nMod4 === 3 || nInLen - nInIdx === 1) {
  35612. for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {
  35613. taBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255;
  35614. }
  35615. nUint24 = 0;
  35616. }
  35617. }
  35618. return aBBytes;
  35619. },
  35620. uint6ToB64: function(nUint6) {
  35621. return nUint6 < 26 ?
  35622. nUint6 + 65
  35623. : nUint6 < 52 ?
  35624. nUint6 + 71
  35625. : nUint6 < 62 ?
  35626. nUint6 - 4
  35627. : nUint6 === 62 ?
  35628. 43
  35629. : nUint6 === 63 ?
  35630. 47
  35631. :
  35632. 65;
  35633. },
  35634. bytesToBase64: function(aBytes) {
  35635. var nMod3, sB64Enc = "";
  35636. for (var nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {
  35637. nMod3 = nIdx % 3;
  35638. if (nIdx > 0 && (nIdx * 4 / 3) % 76 === 0) { sB64Enc += "\r\n"; }
  35639. nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24);
  35640. if (nMod3 === 2 || aBytes.length - nIdx === 1) {
  35641. sB64Enc += String.fromCharCode(
  35642. StringView.uint6ToB64(nUint24 >>> 18 & 63),
  35643. StringView.uint6ToB64(nUint24 >>> 12 & 63),
  35644. StringView.uint6ToB64(nUint24 >>> 6 & 63),
  35645. StringView.uint6ToB64(nUint24 & 63)
  35646. );
  35647. nUint24 = 0;
  35648. }
  35649. }
  35650. return sB64Enc.replace(/A(?=A$|$)/g, "=");
  35651. }
  35652. };
  35653. }());
  35654. /*
  35655. * vim: ts=4:sw=4:expandtab
  35656. *
  35657. * Implements EventTarget
  35658. * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
  35659. *
  35660. */
  35661. ;(function () {
  35662. 'use strict';
  35663. window.textsecure = window.textsecure || {};
  35664. function EventTarget() {
  35665. }
  35666. EventTarget.prototype = {
  35667. constructor: EventTarget,
  35668. dispatchEvent: function(ev) {
  35669. if (!(ev instanceof Event)) {
  35670. throw new Error('Expects an event');
  35671. }
  35672. if (this.listeners === null || typeof this.listeners !== 'object') {
  35673. this.listeners = {};
  35674. }
  35675. var listeners = this.listeners[ev.type];
  35676. if (typeof listeners === 'object') {
  35677. for (var i=0; i < listeners.length; ++i) {
  35678. if (typeof listeners[i] === 'function') {
  35679. listeners[i].call(null, ev);
  35680. }
  35681. }
  35682. }
  35683. },
  35684. addEventListener: function(eventName, callback) {
  35685. if (typeof eventName !== 'string') {
  35686. throw new Error('First argument expects a string');
  35687. }
  35688. if (typeof callback !== 'function') {
  35689. throw new Error('Second argument expects a function');
  35690. }
  35691. if (this.listeners === null || typeof this.listeners !== 'object') {
  35692. this.listeners = {};
  35693. }
  35694. var listeners = this.listeners[eventName];
  35695. if (typeof listeners !== 'object') {
  35696. listeners = [];
  35697. }
  35698. listeners.push(callback);
  35699. this.listeners[eventName] = listeners;
  35700. },
  35701. removeEventListener: function(eventName, callback) {
  35702. if (typeof eventName !== 'string') {
  35703. throw new Error('First argument expects a string');
  35704. }
  35705. if (typeof callback !== 'function') {
  35706. throw new Error('Second argument expects a function');
  35707. }
  35708. if (this.listeners === null || typeof this.listeners !== 'object') {
  35709. this.listeners = {};
  35710. }
  35711. var listeners = this.listeners[eventName];
  35712. if (typeof listeners === 'object') {
  35713. for (var i=0; i < listeners.length; ++ i) {
  35714. if (listeners[i] === callback) {
  35715. listeners.splice(i, 1);
  35716. return;
  35717. }
  35718. }
  35719. }
  35720. this.listeners[eventName] = listeners;
  35721. },
  35722. extend: function(obj) {
  35723. for (var prop in obj) {
  35724. this[prop] = obj[prop];
  35725. }
  35726. return this;
  35727. }
  35728. };
  35729. textsecure.EventTarget = EventTarget;
  35730. }());
  35731. /*
  35732. * vim: ts=4:sw=4:expandtab
  35733. */
  35734. function PortManager(ports) {
  35735. this.ports = ports;
  35736. this.idx = 0;
  35737. }
  35738. PortManager.prototype = {
  35739. constructor: PortManager,
  35740. getPort: function() {
  35741. var port = this.ports[this.idx];
  35742. this.idx = (this.idx + 1) % this.ports.length;
  35743. return port;
  35744. }
  35745. };
  35746. var TextSecureServer = (function() {
  35747. 'use strict';
  35748. function validateResponse(response, schema) {
  35749. try {
  35750. for (var i in schema) {
  35751. switch (schema[i]) {
  35752. case 'object':
  35753. case 'string':
  35754. case 'number':
  35755. if (typeof response[i] !== schema[i]) {
  35756. return false;
  35757. }
  35758. break;
  35759. }
  35760. }
  35761. } catch(ex) {
  35762. return false;
  35763. }
  35764. return true;
  35765. }
  35766. // Promise-based async xhr routine
  35767. function promise_ajax(url, options) {
  35768. return new Promise(function (resolve, reject) {
  35769. if (!url) {
  35770. url = options.host + ':' + options.port + '/' + options.path;
  35771. }
  35772. console.log(options.type, url);
  35773. var xhr = new XMLHttpRequest();
  35774. xhr.open(options.type, url, true /*async*/);
  35775. if ( options.responseType ) {
  35776. xhr[ 'responseType' ] = options.responseType;
  35777. }
  35778. if (options.user && options.password) {
  35779. xhr.setRequestHeader("Authorization", "Basic " + btoa(getString(options.user) + ":" + getString(options.password)));
  35780. }
  35781. if (options.contentType) {
  35782. xhr.setRequestHeader( "Content-Type", options.contentType );
  35783. }
  35784. xhr.setRequestHeader( 'X-Signal-Agent', 'OWD' );
  35785. xhr.onload = function() {
  35786. var result = xhr.response;
  35787. if ( (!xhr.responseType || xhr.responseType === "text") &&
  35788. typeof xhr.responseText === "string" ) {
  35789. result = xhr.responseText;
  35790. }
  35791. if (options.dataType === 'json') {
  35792. try { result = JSON.parse(xhr.responseText + ''); } catch(e) {}
  35793. if (options.validateResponse) {
  35794. if (!validateResponse(result, options.validateResponse)) {
  35795. console.log(options.type, url, xhr.status, 'Error');
  35796. reject(HTTPError(xhr.status, result, options.stack));
  35797. }
  35798. }
  35799. }
  35800. if ( 0 <= xhr.status && xhr.status < 400) {
  35801. console.log(options.type, url, xhr.status, 'Success');
  35802. resolve(result, xhr.status);
  35803. } else {
  35804. console.log(options.type, url, xhr.status, 'Error');
  35805. reject(HTTPError(xhr.status, result, options.stack));
  35806. }
  35807. };
  35808. xhr.onerror = function() {
  35809. console.log(options.type, url, xhr.status, 'Error');
  35810. reject(HTTPError(xhr.status, null, options.stack));
  35811. };
  35812. xhr.send( options.data || null );
  35813. });
  35814. }
  35815. function retry_ajax(url, options, limit, count) {
  35816. count = count || 0;
  35817. limit = limit || 3;
  35818. if (options.ports) {
  35819. options.port = options.ports[count % options.ports.length];
  35820. }
  35821. count++;
  35822. return promise_ajax(url, options).catch(function(e) {
  35823. if (e.name === 'HTTPError' && e.code === -1 && count < limit) {
  35824. return new Promise(function(resolve) {
  35825. setTimeout(function() {
  35826. resolve(retry_ajax(url, options, limit, count));
  35827. }, 1000);
  35828. });
  35829. } else {
  35830. throw e;
  35831. }
  35832. });
  35833. }
  35834. function ajax(url, options) {
  35835. options.stack = new Error().stack; // just in case, save stack here.
  35836. return retry_ajax(url, options);
  35837. }
  35838. function HTTPError(code, response, stack) {
  35839. if (code > 999 || code < 100) {
  35840. code = -1;
  35841. }
  35842. var e = new Error();
  35843. e.name = 'HTTPError';
  35844. e.code = code;
  35845. e.stack = stack;
  35846. if (response) {
  35847. e.response = response;
  35848. }
  35849. return e;
  35850. }
  35851. var URL_CALLS = {
  35852. accounts : "v1/accounts",
  35853. devices : "v1/devices",
  35854. keys : "v2/keys",
  35855. signed : "v2/keys/signed",
  35856. messages : "v1/messages",
  35857. attachment : "v1/attachments"
  35858. };
  35859. function TextSecureServer(url, ports, username, password, attachment_server_url) {
  35860. if (typeof url !== 'string') {
  35861. throw new Error('Invalid server url');
  35862. }
  35863. this.portManager = new PortManager(ports);
  35864. this.url = url;
  35865. this.username = username;
  35866. this.password = password;
  35867. this.attachment_id_regex = RegExp("^https:\/\/.*\/(\\d+)\?");
  35868. if (attachment_server_url) {
  35869. // strip trailing /
  35870. attachment_server_url = attachment_server_url.replace(/\/$/,'');
  35871. // and escape
  35872. attachment_server_url = attachment_server_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  35873. this.attachment_id_regex = RegExp( "^" + attachment_server_url + "\/(\\d+)\?");
  35874. }
  35875. }
  35876. TextSecureServer.prototype = {
  35877. constructor: TextSecureServer,
  35878. getUrl: function() {
  35879. return this.url + ':' + this.portManager.getPort();
  35880. },
  35881. ajax: function(param) {
  35882. if (!param.urlParameters) {
  35883. param.urlParameters = '';
  35884. }
  35885. return ajax(null, {
  35886. host : this.url,
  35887. ports : this.portManager.ports,
  35888. path : URL_CALLS[param.call] + param.urlParameters,
  35889. type : param.httpType,
  35890. data : param.jsonData && textsecure.utils.jsonThing(param.jsonData),
  35891. contentType : 'application/json; charset=utf-8',
  35892. dataType : 'json',
  35893. user : this.username,
  35894. password : this.password,
  35895. validateResponse: param.validateResponse
  35896. }).catch(function(e) {
  35897. var code = e.code;
  35898. if (code === 200) {
  35899. // happens sometimes when we get no response
  35900. // (TODO: Fix server to return 204? instead)
  35901. return null;
  35902. }
  35903. var message;
  35904. switch (code) {
  35905. case -1:
  35906. message = "Failed to connect to the server, please check your network connection.";
  35907. break;
  35908. case 413:
  35909. message = "Rate limit exceeded, please try again later.";
  35910. break;
  35911. case 403:
  35912. message = "Invalid code, please try again.";
  35913. break;
  35914. case 417:
  35915. // TODO: This shouldn't be a thing?, but its in the API doc?
  35916. message = "Number already registered.";
  35917. break;
  35918. case 401:
  35919. message = "Invalid authentication, most likely someone re-registered and invalidated our registration.";
  35920. break;
  35921. case 404:
  35922. message = "Number is not registered.";
  35923. break;
  35924. default:
  35925. message = "The server rejected our query, please file a bug report.";
  35926. }
  35927. e.message = message
  35928. throw e;
  35929. });
  35930. },
  35931. requestVerificationSMS: function(number) {
  35932. return this.ajax({
  35933. call : 'accounts',
  35934. httpType : 'GET',
  35935. urlParameters : '/sms/code/' + number,
  35936. });
  35937. },
  35938. requestVerificationVoice: function(number) {
  35939. return this.ajax({
  35940. call : 'accounts',
  35941. httpType : 'GET',
  35942. urlParameters : '/voice/code/' + number,
  35943. });
  35944. },
  35945. confirmCode: function(number, code, password, signaling_key, registrationId, deviceName) {
  35946. var jsonData = {
  35947. signalingKey : btoa(getString(signaling_key)),
  35948. supportsSms : false,
  35949. fetchesMessages : true,
  35950. registrationId : registrationId,
  35951. };
  35952. var call, urlPrefix, schema;
  35953. if (deviceName) {
  35954. jsonData.name = deviceName;
  35955. call = 'devices';
  35956. urlPrefix = '/';
  35957. schema = { deviceId: 'number' };
  35958. } else {
  35959. call = 'accounts';
  35960. urlPrefix = '/code/';
  35961. }
  35962. this.username = number;
  35963. this.password = password;
  35964. return this.ajax({
  35965. call : call,
  35966. httpType : 'PUT',
  35967. urlParameters : urlPrefix + code,
  35968. jsonData : jsonData,
  35969. validateResponse : schema
  35970. });
  35971. },
  35972. getDevices: function(number) {
  35973. return this.ajax({
  35974. call : 'devices',
  35975. httpType : 'GET',
  35976. });
  35977. },
  35978. registerKeys: function(genKeys) {
  35979. var keys = {};
  35980. keys.identityKey = btoa(getString(genKeys.identityKey));
  35981. keys.signedPreKey = {
  35982. keyId: genKeys.signedPreKey.keyId,
  35983. publicKey: btoa(getString(genKeys.signedPreKey.publicKey)),
  35984. signature: btoa(getString(genKeys.signedPreKey.signature))
  35985. };
  35986. keys.preKeys = [];
  35987. var j = 0;
  35988. for (var i in genKeys.preKeys) {
  35989. keys.preKeys[j++] = {
  35990. keyId: genKeys.preKeys[i].keyId,
  35991. publicKey: btoa(getString(genKeys.preKeys[i].publicKey))
  35992. };
  35993. }
  35994. // This is just to make the server happy
  35995. // (v2 clients should choke on publicKey)
  35996. keys.lastResortKey = {keyId: 0x7fffFFFF, publicKey: btoa("42")};
  35997. return this.ajax({
  35998. call : 'keys',
  35999. httpType : 'PUT',
  36000. jsonData : keys,
  36001. });
  36002. },
  36003. setSignedPreKey: function(signedPreKey) {
  36004. return this.ajax({
  36005. call : 'signed',
  36006. httpType : 'PUT',
  36007. jsonData : {
  36008. keyId: signedPreKey.keyId,
  36009. publicKey: btoa(getString(signedPreKey.publicKey)),
  36010. signature: btoa(getString(signedPreKey.signature))
  36011. }
  36012. });
  36013. },
  36014. getMyKeys: function(number, deviceId) {
  36015. return this.ajax({
  36016. call : 'keys',
  36017. httpType : 'GET',
  36018. validateResponse : {count: 'number'}
  36019. }).then(function(res) {
  36020. return res.count;
  36021. });
  36022. },
  36023. getKeysForNumber: function(number, deviceId) {
  36024. if (deviceId === undefined)
  36025. deviceId = "*";
  36026. return this.ajax({
  36027. call : 'keys',
  36028. httpType : 'GET',
  36029. urlParameters : "/" + number + "/" + deviceId,
  36030. validateResponse : {identityKey: 'string', devices: 'object'}
  36031. }).then(function(res) {
  36032. if (res.devices.constructor !== Array) {
  36033. throw new Error("Invalid response");
  36034. }
  36035. res.identityKey = StringView.base64ToBytes(res.identityKey);
  36036. res.devices.forEach(function(device) {
  36037. if ( !validateResponse(device, {signedPreKey: 'object'}) ||
  36038. !validateResponse(device.signedPreKey, {publicKey: 'string', signature: 'string'}) ) {
  36039. throw new Error("Invalid signedPreKey");
  36040. }
  36041. if ( device.preKey ) {
  36042. if ( !validateResponse(device, {preKey: 'object'}) ||
  36043. !validateResponse(device.preKey, {publicKey: 'string'})) {
  36044. throw new Error("Invalid preKey");
  36045. }
  36046. device.preKey.publicKey = StringView.base64ToBytes(device.preKey.publicKey);
  36047. }
  36048. device.signedPreKey.publicKey = StringView.base64ToBytes(device.signedPreKey.publicKey);
  36049. device.signedPreKey.signature = StringView.base64ToBytes(device.signedPreKey.signature);
  36050. });
  36051. return res;
  36052. });
  36053. },
  36054. sendMessages: function(destination, messageArray, timestamp) {
  36055. var jsonData = { messages: messageArray, timestamp: timestamp};
  36056. return this.ajax({
  36057. call : 'messages',
  36058. httpType : 'PUT',
  36059. urlParameters : '/' + destination,
  36060. jsonData : jsonData,
  36061. });
  36062. },
  36063. getAttachment: function(id) {
  36064. return this.ajax({
  36065. call : 'attachment',
  36066. httpType : 'GET',
  36067. urlParameters : '/' + id,
  36068. validateResponse : {location: 'string'}
  36069. }).then(function(response) {
  36070. var match = response.location.match(this.attachment_id_regex);
  36071. if (!match) {
  36072. console.log('Invalid attachment url for incoming message', response.location);
  36073. throw new Error('Received invalid attachment url');
  36074. }
  36075. return ajax(response.location, {
  36076. type : "GET",
  36077. responseType: "arraybuffer",
  36078. contentType : "application/octet-stream"
  36079. });
  36080. }.bind(this));
  36081. },
  36082. putAttachment: function(encryptedBin) {
  36083. return this.ajax({
  36084. call : 'attachment',
  36085. httpType : 'GET',
  36086. }).then(function(response) {
  36087. // Extract the id as a string from the location url
  36088. // (workaround for ids too large for Javascript numbers)
  36089. var match = response.location.match(this.attachment_id_regex);
  36090. if (!match) {
  36091. console.log('Invalid attachment url for outgoing message', response.location);
  36092. throw new Error('Received invalid attachment url');
  36093. }
  36094. return ajax(response.location, {
  36095. type : "PUT",
  36096. contentType : "application/octet-stream",
  36097. data : encryptedBin,
  36098. processData : false,
  36099. }).then(function() {
  36100. return match[1];
  36101. }.bind(this));
  36102. }.bind(this));
  36103. },
  36104. getMessageSocket: function() {
  36105. var url = this.getUrl();
  36106. console.log('opening message socket', url);
  36107. return new WebSocket(
  36108. url.replace('https://', 'wss://').replace('http://', 'ws://')
  36109. + '/v1/websocket/?login=' + encodeURIComponent(this.username)
  36110. + '&password=' + encodeURIComponent(this.password)
  36111. + '&agent=OWD'
  36112. );
  36113. },
  36114. getProvisioningSocket: function () {
  36115. var url = this.getUrl();
  36116. console.log('opening provisioning socket', url);
  36117. return new WebSocket(
  36118. url.replace('https://', 'wss://').replace('http://', 'ws://')
  36119. + '/v1/websocket/provisioning/?agent=OWD'
  36120. );
  36121. }
  36122. };
  36123. return TextSecureServer;
  36124. })();
  36125. /*
  36126. * vim: ts=4:sw=4:expandtab
  36127. */
  36128. ;(function () {
  36129. 'use strict';
  36130. window.textsecure = window.textsecure || {};
  36131. var ARCHIVE_AGE = 7 * 24 * 60 * 60 * 1000;
  36132. function AccountManager(url, ports, username, password) {
  36133. this.server = new TextSecureServer(url, ports, username, password);
  36134. this.pending = Promise.resolve();
  36135. }
  36136. AccountManager.prototype = new textsecure.EventTarget();
  36137. AccountManager.prototype.extend({
  36138. constructor: AccountManager,
  36139. requestVoiceVerification: function(number) {
  36140. return this.server.requestVerificationVoice(number);
  36141. },
  36142. requestSMSVerification: function(number) {
  36143. return this.server.requestVerificationSMS(number);
  36144. },
  36145. registerSingleDevice: function(number, verificationCode) {
  36146. var registerKeys = this.server.registerKeys.bind(this.server);
  36147. var createAccount = this.createAccount.bind(this);
  36148. var generateKeys = this.generateKeys.bind(this, 100);
  36149. var registrationDone = this.registrationDone.bind(this);
  36150. this.pending = this.pending.then(function() {
  36151. return libsignal.KeyHelper.generateIdentityKeyPair().then(function(identityKeyPair) {
  36152. return createAccount(number, verificationCode, identityKeyPair).
  36153. then(generateKeys).
  36154. then(registerKeys).
  36155. then(registrationDone);
  36156. }.bind(this));
  36157. }.bind(this));
  36158. return this.pending;
  36159. },
  36160. registerSecondDevice: function(setProvisioningUrl, confirmNumber, progressCallback) {
  36161. var createAccount = this.createAccount.bind(this);
  36162. var generateKeys = this.generateKeys.bind(this, 100, progressCallback);
  36163. var registrationDone = this.registrationDone.bind(this);
  36164. var registerKeys = this.server.registerKeys.bind(this.server);
  36165. var getSocket = this.server.getProvisioningSocket.bind(this.server);
  36166. this.pending = this.pending.then(function() {
  36167. var provisioningCipher = new libsignal.ProvisioningCipher();
  36168. return provisioningCipher.getPublicKey().then(function(pubKey) {
  36169. return new Promise(function(resolve, reject) {
  36170. var socket = getSocket();
  36171. socket.onclose = function(e) {
  36172. console.log('websocket closed', e.code);
  36173. reject(new Error('websocket closed'));
  36174. };
  36175. var wsr = new WebSocketResource(socket, {
  36176. keepalive: { path: '/v1/keepalive/provisioning' },
  36177. handleRequest: function(request) {
  36178. if (request.path === "/v1/address" && request.verb === "PUT") {
  36179. var proto = textsecure.protobuf.ProvisioningUuid.decode(request.body);
  36180. setProvisioningUrl([
  36181. 'tsdevice:/?uuid=', proto.uuid, '&pub_key=',
  36182. encodeURIComponent(btoa(getString(pubKey)))
  36183. ].join(''));
  36184. request.respond(200, 'OK');
  36185. } else if (request.path === "/v1/message" && request.verb === "PUT") {
  36186. var envelope = textsecure.protobuf.ProvisionEnvelope.decode(request.body, 'binary');
  36187. request.respond(200, 'OK');
  36188. wsr.close();
  36189. resolve(provisioningCipher.decrypt(envelope).then(function(provisionMessage) {
  36190. return confirmNumber(provisionMessage.number).then(function(deviceName) {
  36191. if (typeof deviceName !== 'string' || deviceName.length === 0) {
  36192. throw new Error('Invalid device name');
  36193. }
  36194. return createAccount(
  36195. provisionMessage.number,
  36196. provisionMessage.provisioningCode,
  36197. provisionMessage.identityKeyPair,
  36198. deviceName,
  36199. provisionMessage.userAgent
  36200. );
  36201. });
  36202. }));
  36203. } else {
  36204. console.log('Unknown websocket message', request.path);
  36205. }
  36206. }
  36207. });
  36208. });
  36209. }).then(generateKeys).
  36210. then(registerKeys).
  36211. then(registrationDone);
  36212. }.bind(this));
  36213. return this.pending;
  36214. },
  36215. refreshPreKeys: function() {
  36216. var generateKeys = this.generateKeys.bind(this, 100);
  36217. var registerKeys = this.server.registerKeys.bind(this.server);
  36218. this.pending = this.pending.then(function() {
  36219. return this.server.getMyKeys().then(function(preKeyCount) {
  36220. console.log('prekey count ' + preKeyCount);
  36221. if (preKeyCount < 10) {
  36222. return generateKeys().then(registerKeys);
  36223. }
  36224. }.bind(this));
  36225. }.bind(this));
  36226. return this.pending;
  36227. },
  36228. rotateSignedPreKey: function() {
  36229. this.pending = this.pending.then(function() {
  36230. var signedKeyId = textsecure.storage.get('signedKeyId', 1);
  36231. if (typeof signedKeyId != 'number') {
  36232. throw new Error('Invalid signedKeyId');
  36233. }
  36234. var store = textsecure.storage.protocol;
  36235. var server = this.server;
  36236. var cleanSignedPreKeys = this.cleanSignedPreKeys;
  36237. return store.getIdentityKeyPair().then(function(identityKey) {
  36238. return libsignal.KeyHelper.generateSignedPreKey(identityKey, signedKeyId);
  36239. }).then(function(res) {
  36240. return server.setSignedPreKey({
  36241. keyId : res.keyId,
  36242. publicKey : res.keyPair.pubKey,
  36243. signature : res.signature
  36244. }).then(function() {
  36245. textsecure.storage.put('signedKeyId', signedKeyId + 1);
  36246. textsecure.storage.remove('signedKeyRotationRejected');
  36247. return store.storeSignedPreKey(res.keyId, res.keyPair).then(function() {
  36248. return cleanSignedPreKeys();
  36249. });
  36250. }).catch(function(e) {
  36251. if (e instanceof Error && e.name == 'HTTPError' && e.code >= 400 && e.code <= 599) {
  36252. var rejections = 1 + textsecure.storage.get('signedKeyRotationRejected', 0);
  36253. textsecure.storage.put('signedKeyRotationRejected', rejections);
  36254. console.log('Signed key rotation rejected count:', rejections);
  36255. }
  36256. });
  36257. });
  36258. }.bind(this));
  36259. return this.pending;
  36260. },
  36261. cleanSignedPreKeys: function() {
  36262. var nextSignedKeyId = textsecure.storage.get('signedKeyId');
  36263. if (typeof nextSignedKeyId != 'number') {
  36264. return Promise.resolve();
  36265. }
  36266. var activeSignedPreKeyId = nextSignedKeyId - 1;
  36267. var store = textsecure.storage.protocol;
  36268. return store.loadSignedPreKeys().then(function(allRecords) {
  36269. var oldRecords = allRecords.filter(function(record) {
  36270. return record.keyId !== activeSignedPreKeyId;
  36271. });
  36272. oldRecords.sort(function(a, b) {
  36273. return (a.created_at || 0) - (b.created_at || 0);
  36274. });
  36275. console.log("Active signed prekey: " + activeSignedPreKeyId);
  36276. console.log("Old signed prekey record count: " + oldRecords.length);
  36277. oldRecords.forEach(function(oldRecord) {
  36278. if ( oldRecord.keyId > activeSignedPreKeyId - 3 ) {
  36279. // keep at least the last 3 signed keys
  36280. return;
  36281. }
  36282. var created_at = oldRecord.created_at || 0;
  36283. var archiveDuration = Date.now() - created_at;
  36284. if (archiveDuration > ARCHIVE_AGE) {
  36285. console.log("Removing signed prekey record:",
  36286. oldRecord.keyId, "with timestamp:", created_at);
  36287. store.removeSignedPreKey(oldRecord.keyId);
  36288. }
  36289. });
  36290. });
  36291. },
  36292. createAccount: function(number, verificationCode, identityKeyPair, deviceName, userAgent) {
  36293. var signalingKey = libsignal.crypto.getRandomBytes(32 + 20);
  36294. var password = btoa(getString(libsignal.crypto.getRandomBytes(16)));
  36295. password = password.substring(0, password.length - 2);
  36296. var registrationId = libsignal.KeyHelper.generateRegistrationId();
  36297. return this.server.confirmCode(
  36298. number, verificationCode, password, signalingKey, registrationId, deviceName
  36299. ).then(function(response) {
  36300. return textsecure.storage.protocol.clearSessionStore().then(function() {
  36301. textsecure.storage.remove('identityKey');
  36302. textsecure.storage.remove('signaling_key');
  36303. textsecure.storage.remove('password');
  36304. textsecure.storage.remove('registrationId');
  36305. textsecure.storage.remove('number_id');
  36306. textsecure.storage.remove('device_name');
  36307. textsecure.storage.remove('regionCode');
  36308. textsecure.storage.remove('userAgent');
  36309. // update our own identity key, which may have changed
  36310. // if we're relinking after a reinstall on the master device
  36311. var putIdentity = textsecure.storage.protocol.saveIdentity.bind(
  36312. null, number, identityKeyPair.pubKey
  36313. );
  36314. textsecure.storage.protocol.removeIdentityKey(number).then(putIdentity, putIdentity);
  36315. textsecure.storage.put('identityKey', identityKeyPair);
  36316. textsecure.storage.put('signaling_key', signalingKey);
  36317. textsecure.storage.put('password', password);
  36318. textsecure.storage.put('registrationId', registrationId);
  36319. if (userAgent) {
  36320. textsecure.storage.put('userAgent', userAgent);
  36321. }
  36322. textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
  36323. textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
  36324. this.server.username = textsecure.storage.get('number_id');
  36325. }.bind(this));
  36326. }.bind(this));
  36327. },
  36328. generateKeys: function (count, progressCallback) {
  36329. if (typeof progressCallback !== 'function') {
  36330. progressCallback = undefined;
  36331. }
  36332. var startId = textsecure.storage.get('maxPreKeyId', 1);
  36333. var signedKeyId = textsecure.storage.get('signedKeyId', 1);
  36334. if (typeof startId != 'number') {
  36335. throw new Error('Invalid maxPreKeyId');
  36336. }
  36337. if (typeof signedKeyId != 'number') {
  36338. throw new Error('Invalid signedKeyId');
  36339. }
  36340. var store = textsecure.storage.protocol;
  36341. return store.getIdentityKeyPair().then(function(identityKey) {
  36342. var result = { preKeys: [], identityKey: identityKey.pubKey };
  36343. var promises = [];
  36344. for (var keyId = startId; keyId < startId+count; ++keyId) {
  36345. promises.push(
  36346. libsignal.KeyHelper.generatePreKey(keyId).then(function(res) {
  36347. store.storePreKey(res.keyId, res.keyPair);
  36348. result.preKeys.push({
  36349. keyId : res.keyId,
  36350. publicKey : res.keyPair.pubKey
  36351. });
  36352. if (progressCallback) { progressCallback(); }
  36353. })
  36354. );
  36355. }
  36356. promises.push(
  36357. libsignal.KeyHelper.generateSignedPreKey(identityKey, signedKeyId).then(function(res) {
  36358. store.storeSignedPreKey(res.keyId, res.keyPair);
  36359. result.signedPreKey = {
  36360. keyId : res.keyId,
  36361. publicKey : res.keyPair.pubKey,
  36362. signature : res.signature
  36363. };
  36364. })
  36365. );
  36366. textsecure.storage.put('maxPreKeyId', startId + count);
  36367. textsecure.storage.put('signedKeyId', signedKeyId + 1);
  36368. return Promise.all(promises).then(function() {
  36369. return this.cleanSignedPreKeys().then(function() {
  36370. return result;
  36371. });
  36372. }.bind(this));
  36373. }.bind(this));
  36374. },
  36375. registrationDone: function() {
  36376. console.log('registration done');
  36377. this.dispatchEvent(new Event('registration'));
  36378. }
  36379. });
  36380. textsecure.AccountManager = AccountManager;
  36381. }());
  36382. /*
  36383. * vim: ts=4:sw=4:expandtab
  36384. */
  36385. function MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url) {
  36386. this.url = url;
  36387. this.signalingKey = signalingKey;
  36388. this.username = username;
  36389. this.password = password;
  36390. this.server = new TextSecureServer(url, ports, username, password, attachment_server_url);
  36391. var address = libsignal.SignalProtocolAddress.fromString(username);
  36392. this.number = address.getName();
  36393. this.deviceId = address.getDeviceId();
  36394. }
  36395. MessageReceiver.prototype = new textsecure.EventTarget();
  36396. MessageReceiver.prototype.extend({
  36397. constructor: MessageReceiver,
  36398. connect: function() {
  36399. if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
  36400. this.socket.close();
  36401. }
  36402. console.log('opening websocket');
  36403. // initialize the socket and start listening for messages
  36404. this.socket = this.server.getMessageSocket();
  36405. this.socket.onclose = this.onclose.bind(this);
  36406. this.socket.onerror = this.onerror.bind(this);
  36407. this.socket.onopen = this.onopen.bind(this);
  36408. this.wsr = new WebSocketResource(this.socket, {
  36409. handleRequest: this.handleRequest.bind(this),
  36410. keepalive: { path: '/v1/keepalive', disconnect: true }
  36411. });
  36412. this.pending = Promise.resolve();
  36413. },
  36414. close: function() {
  36415. this.socket.close(3000, 'called close');
  36416. delete this.listeners;
  36417. },
  36418. onopen: function() {
  36419. console.log('websocket open');
  36420. },
  36421. onerror: function(error) {
  36422. console.log('websocket error');
  36423. },
  36424. onclose: function(ev) {
  36425. console.log('websocket closed', ev.code, ev.reason || '');
  36426. if (ev.code === 3000) {
  36427. return;
  36428. }
  36429. var eventTarget = this;
  36430. // possible 403 or network issue. Make an request to confirm
  36431. this.server.getDevices(this.number).
  36432. then(this.connect.bind(this)). // No HTTP error? Reconnect
  36433. catch(function(e) {
  36434. var ev = new Event('error');
  36435. ev.error = e;
  36436. eventTarget.dispatchEvent(ev);
  36437. });
  36438. },
  36439. handleRequest: function(request) {
  36440. // We do the message decryption here, instead of in the ordered pending queue,
  36441. // to avoid exposing the time it took us to process messages through the time-to-ack.
  36442. // TODO: handle different types of requests. for now we blindly assume
  36443. // PUT /messages <encrypted Envelope>
  36444. textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) {
  36445. var envelope = textsecure.protobuf.Envelope.decode(plaintext);
  36446. // After this point, decoding errors are not the server's
  36447. // fault, and we should handle them gracefully and tell the
  36448. // user they received an invalid message
  36449. request.respond(200, 'OK');
  36450. if (!this.isBlocked(envelope.source)) {
  36451. this.queueEnvelope(envelope);
  36452. }
  36453. }.bind(this)).catch(function(e) {
  36454. request.respond(500, 'Bad encrypted websocket message');
  36455. console.log("Error handling incoming message:", e);
  36456. var ev = new Event('error');
  36457. ev.error = e;
  36458. this.dispatchEvent(ev);
  36459. }.bind(this));
  36460. },
  36461. queueEnvelope: function(envelope) {
  36462. var handleEnvelope = this.handleEnvelope.bind(this, envelope);
  36463. this.pending = this.pending.then(handleEnvelope, handleEnvelope);
  36464. },
  36465. handleEnvelope: function(envelope) {
  36466. if (envelope.type === textsecure.protobuf.Envelope.Type.RECEIPT) {
  36467. return this.onDeliveryReceipt(envelope);
  36468. }
  36469. if (envelope.content) {
  36470. return this.handleContentMessage(envelope);
  36471. } else if (envelope.legacyMessage) {
  36472. return this.handleLegacyMessage(envelope);
  36473. } else {
  36474. throw new Error('Received message with no content and no legacyMessage');
  36475. }
  36476. },
  36477. getStatus: function() {
  36478. if (this.socket) {
  36479. return this.socket.readyState;
  36480. } else {
  36481. return -1;
  36482. }
  36483. },
  36484. onDeliveryReceipt: function (envelope) {
  36485. var ev = new Event('receipt');
  36486. ev.proto = envelope;
  36487. this.dispatchEvent(ev);
  36488. },
  36489. unpad: function(paddedPlaintext) {
  36490. paddedPlaintext = new Uint8Array(paddedPlaintext);
  36491. var plaintext;
  36492. for (var i = paddedPlaintext.length - 1; i >= 0; i--) {
  36493. if (paddedPlaintext[i] == 0x80) {
  36494. plaintext = new Uint8Array(i);
  36495. plaintext.set(paddedPlaintext.subarray(0, i));
  36496. plaintext = plaintext.buffer;
  36497. break;
  36498. } else if (paddedPlaintext[i] !== 0x00) {
  36499. throw new Error('Invalid padding');
  36500. }
  36501. }
  36502. return plaintext;
  36503. },
  36504. decrypt: function(envelope, ciphertext) {
  36505. var promise;
  36506. var address = new libsignal.SignalProtocolAddress(envelope.source, envelope.sourceDevice);
  36507. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  36508. switch(envelope.type) {
  36509. case textsecure.protobuf.Envelope.Type.CIPHERTEXT:
  36510. console.log('message from', envelope.source + '.' + envelope.sourceDevice, envelope.timestamp.toNumber());
  36511. promise = sessionCipher.decryptWhisperMessage(ciphertext).then(this.unpad);
  36512. break;
  36513. case textsecure.protobuf.Envelope.Type.PREKEY_BUNDLE:
  36514. console.log('prekey message from', envelope.source + '.' + envelope.sourceDevice, envelope.timestamp.toNumber());
  36515. promise = this.decryptPreKeyWhisperMessage(ciphertext, sessionCipher, address);
  36516. break;
  36517. default:
  36518. promise = Promise.reject(new Error("Unknown message type"));
  36519. }
  36520. return promise.catch(function(error) {
  36521. var ev = new Event('error');
  36522. ev.error = error;
  36523. ev.proto = envelope;
  36524. this.dispatchEvent(ev);
  36525. return Promise.reject(error);
  36526. }.bind(this));
  36527. },
  36528. decryptPreKeyWhisperMessage: function(ciphertext, sessionCipher, address) {
  36529. return sessionCipher.decryptPreKeyWhisperMessage(ciphertext).then(this.unpad).catch(function(e) {
  36530. if (e.message === 'Unknown identity key') {
  36531. // create an error that the UI will pick up and ask the
  36532. // user if they want to re-negotiate
  36533. throw new textsecure.IncomingIdentityKeyError(
  36534. address.toString(),
  36535. ciphertext.toArrayBuffer(),
  36536. e.identityKey
  36537. );
  36538. }
  36539. throw e;
  36540. });
  36541. },
  36542. handleSentMessage: function(destination, timestamp, message, expirationStartTimestamp) {
  36543. var p = Promise.resolve();
  36544. if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
  36545. textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
  36546. p = this.handleEndSession(destination);
  36547. }
  36548. return p.then(function() {
  36549. return this.processDecrypted(message, this.number).then(function(message) {
  36550. var ev = new Event('sent');
  36551. ev.data = {
  36552. destination : destination,
  36553. timestamp : timestamp.toNumber(),
  36554. message : message
  36555. };
  36556. if (expirationStartTimestamp) {
  36557. ev.data.expirationStartTimestamp = expirationStartTimestamp.toNumber();
  36558. }
  36559. this.dispatchEvent(ev);
  36560. }.bind(this));
  36561. }.bind(this));
  36562. },
  36563. handleDataMessage: function(envelope, message) {
  36564. var encodedNumber = envelope.source + '.' + envelope.sourceDevice;
  36565. console.log('data message from', encodedNumber, envelope.timestamp.toNumber());
  36566. var p = Promise.resolve();
  36567. if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
  36568. textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
  36569. p = this.handleEndSession(envelope.source);
  36570. }
  36571. return p.then(function() {
  36572. return this.processDecrypted(message, envelope.source).then(function(message) {
  36573. var ev = new Event('message');
  36574. ev.data = {
  36575. source : envelope.source,
  36576. timestamp : envelope.timestamp.toNumber(),
  36577. message : message
  36578. };
  36579. this.dispatchEvent(ev);
  36580. }.bind(this));
  36581. }.bind(this));
  36582. },
  36583. handleLegacyMessage: function (envelope) {
  36584. return this.decrypt(envelope, envelope.legacyMessage).then(function(plaintext) {
  36585. var message = textsecure.protobuf.DataMessage.decode(plaintext);
  36586. return this.handleDataMessage(envelope, message);
  36587. }.bind(this));
  36588. },
  36589. handleContentMessage: function (envelope) {
  36590. return this.decrypt(envelope, envelope.content).then(function(plaintext) {
  36591. var content = textsecure.protobuf.Content.decode(plaintext);
  36592. if (content.syncMessage) {
  36593. return this.handleSyncMessage(envelope, content.syncMessage);
  36594. } else if (content.dataMessage) {
  36595. return this.handleDataMessage(envelope, content.dataMessage);
  36596. } else {
  36597. throw new Error('Got Content message with no dataMessage and no syncMessage');
  36598. }
  36599. }.bind(this));
  36600. },
  36601. handleSyncMessage: function(envelope, syncMessage) {
  36602. if (envelope.source !== this.number) {
  36603. throw new Error('Received sync message from another number');
  36604. }
  36605. if (envelope.sourceDevice == this.deviceId) {
  36606. throw new Error('Received sync message from our own device');
  36607. }
  36608. if (syncMessage.sent) {
  36609. var sentMessage = syncMessage.sent;
  36610. console.log('sent message to',
  36611. sentMessage.destination,
  36612. sentMessage.timestamp.toNumber(),
  36613. 'from', envelope.source + '.' + envelope.sourceDevice
  36614. );
  36615. return this.handleSentMessage(
  36616. sentMessage.destination,
  36617. sentMessage.timestamp,
  36618. sentMessage.message,
  36619. sentMessage.expirationStartTimestamp
  36620. );
  36621. } else if (syncMessage.contacts) {
  36622. this.handleContacts(syncMessage.contacts);
  36623. } else if (syncMessage.groups) {
  36624. this.handleGroups(syncMessage.groups);
  36625. } else if (syncMessage.blocked) {
  36626. this.handleBlocked(syncMessage.blocked);
  36627. } else if (syncMessage.request) {
  36628. console.log('Got SyncMessage Request');
  36629. } else if (syncMessage.read) {
  36630. console.log('read messages',
  36631. 'from', envelope.source + '.' + envelope.sourceDevice);
  36632. this.handleRead(syncMessage.read, envelope.timestamp);
  36633. } else {
  36634. throw new Error('Got empty SyncMessage');
  36635. }
  36636. },
  36637. handleRead: function(read, timestamp) {
  36638. for (var i = 0; i < read.length; ++i) {
  36639. var ev = new Event('read');
  36640. ev.timestamp = timestamp.toNumber();
  36641. ev.read = {
  36642. timestamp : read[i].timestamp.toNumber(),
  36643. sender : read[i].sender
  36644. }
  36645. this.dispatchEvent(ev);
  36646. }
  36647. },
  36648. handleContacts: function(contacts) {
  36649. console.log('contact sync');
  36650. var eventTarget = this;
  36651. var attachmentPointer = contacts.blob;
  36652. return this.handleAttachment(attachmentPointer).then(function() {
  36653. var contactBuffer = new ContactBuffer(attachmentPointer.data);
  36654. var contactDetails = contactBuffer.next();
  36655. while (contactDetails !== undefined) {
  36656. var ev = new Event('contact');
  36657. ev.contactDetails = contactDetails;
  36658. eventTarget.dispatchEvent(ev);
  36659. contactDetails = contactBuffer.next();
  36660. }
  36661. eventTarget.dispatchEvent(new Event('contactsync'));
  36662. });
  36663. },
  36664. handleGroups: function(groups) {
  36665. console.log('group sync');
  36666. var eventTarget = this;
  36667. var attachmentPointer = groups.blob;
  36668. return this.handleAttachment(attachmentPointer).then(function() {
  36669. var groupBuffer = new GroupBuffer(attachmentPointer.data);
  36670. var groupDetails = groupBuffer.next();
  36671. var promises = [];
  36672. while (groupDetails !== undefined) {
  36673. var promise = (function(groupDetails) {
  36674. groupDetails.id = groupDetails.id.toBinary();
  36675. if (groupDetails.active) {
  36676. return textsecure.storage.groups.getGroup(groupDetails.id).
  36677. then(function(existingGroup) {
  36678. if (existingGroup === undefined) {
  36679. return textsecure.storage.groups.createNewGroup(
  36680. groupDetails.members, groupDetails.id
  36681. );
  36682. } else {
  36683. return textsecure.storage.groups.updateNumbers(
  36684. groupDetails.id, groupDetails.members
  36685. );
  36686. }
  36687. }).then(function() { return groupDetails });
  36688. } else {
  36689. return Promise.resolve(groupDetails);
  36690. }
  36691. })(groupDetails).then(function(groupDetails) {
  36692. var ev = new Event('group');
  36693. ev.groupDetails = groupDetails;
  36694. eventTarget.dispatchEvent(ev);
  36695. }).catch(function(e) {
  36696. console.log('error processing group', e);
  36697. });
  36698. groupDetails = groupBuffer.next();
  36699. promises.push(promise);
  36700. }
  36701. Promise.all(promises).then(function() {
  36702. eventTarget.dispatchEvent(new Event('groupsync'));
  36703. });
  36704. });
  36705. },
  36706. handleBlocked: function(blocked) {
  36707. textsecure.storage.put('blocked', blocked.numbers);
  36708. },
  36709. isBlocked: function(number) {
  36710. return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
  36711. },
  36712. handleAttachment: function(attachment) {
  36713. function decryptAttachment(encrypted) {
  36714. return textsecure.crypto.decryptAttachment(
  36715. encrypted,
  36716. attachment.key.toArrayBuffer()
  36717. );
  36718. }
  36719. function updateAttachment(data) {
  36720. attachment.data = data;
  36721. }
  36722. return this.server.getAttachment(attachment.id.toString()).
  36723. then(decryptAttachment).
  36724. then(updateAttachment);
  36725. },
  36726. tryMessageAgain: function(from, ciphertext) {
  36727. var address = libsignal.SignalProtocolAddress.fromString(from);
  36728. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  36729. console.log('retrying prekey whisper message');
  36730. return this.decryptPreKeyWhisperMessage(ciphertext, sessionCipher, address).then(function(plaintext) {
  36731. var finalMessage = textsecure.protobuf.DataMessage.decode(plaintext);
  36732. var p = Promise.resolve();
  36733. if ((finalMessage.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION)
  36734. == textsecure.protobuf.DataMessage.Flags.END_SESSION &&
  36735. finalMessage.sync !== null) {
  36736. var number = address.getName();
  36737. p = this.handleEndSession(number);
  36738. }
  36739. return p.then(function() {
  36740. return this.processDecrypted(finalMessage);
  36741. }.bind(this));
  36742. }.bind(this));
  36743. },
  36744. handleEndSession: function(number) {
  36745. console.log('got end session');
  36746. return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
  36747. return Promise.all(deviceIds.map(function(deviceId) {
  36748. var address = new libsignal.SignalProtocolAddress(number, deviceId);
  36749. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  36750. console.log('closing session for', address.toString());
  36751. return sessionCipher.closeOpenSessionForDevice();
  36752. }));
  36753. });
  36754. },
  36755. processDecrypted: function(decrypted, source) {
  36756. // Now that its decrypted, validate the message and clean it up for consumer processing
  36757. // Note that messages may (generally) only perform one action and we ignore remaining fields
  36758. // after the first action.
  36759. if (decrypted.flags == null) {
  36760. decrypted.flags = 0;
  36761. }
  36762. if (decrypted.expireTimer == null) {
  36763. decrypted.expireTimer = 0;
  36764. }
  36765. if (decrypted.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) {
  36766. decrypted.body = null;
  36767. decrypted.attachments = [];
  36768. decrypted.group = null;
  36769. return Promise.resolve(decrypted);
  36770. } else if (decrypted.flags & textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE ) {
  36771. decrypted.body = null;
  36772. decrypted.attachments = [];
  36773. } else if (decrypted.flags != 0) {
  36774. throw new Error("Unknown flags in message");
  36775. }
  36776. var promises = [];
  36777. if (decrypted.group !== null) {
  36778. decrypted.group.id = decrypted.group.id.toBinary();
  36779. if (decrypted.group.type == textsecure.protobuf.GroupContext.Type.UPDATE) {
  36780. if (decrypted.group.avatar !== null) {
  36781. promises.push(this.handleAttachment(decrypted.group.avatar));
  36782. }
  36783. }
  36784. promises.push(textsecure.storage.groups.getNumbers(decrypted.group.id).then(function(existingGroup) {
  36785. if (existingGroup === undefined) {
  36786. if (decrypted.group.type != textsecure.protobuf.GroupContext.Type.UPDATE) {
  36787. decrypted.group.members = [source];
  36788. console.log("Got message for unknown group");
  36789. }
  36790. return textsecure.storage.groups.createNewGroup(decrypted.group.members, decrypted.group.id);
  36791. } else {
  36792. var fromIndex = existingGroup.indexOf(source);
  36793. if (fromIndex < 0) {
  36794. //TODO: This could be indication of a race...
  36795. console.log("Sender was not a member of the group they were sending from");
  36796. }
  36797. switch(decrypted.group.type) {
  36798. case textsecure.protobuf.GroupContext.Type.UPDATE:
  36799. decrypted.body = null;
  36800. decrypted.attachments = [];
  36801. return textsecure.storage.groups.updateNumbers(
  36802. decrypted.group.id, decrypted.group.members
  36803. );
  36804. break;
  36805. case textsecure.protobuf.GroupContext.Type.QUIT:
  36806. decrypted.body = null;
  36807. decrypted.attachments = [];
  36808. if (source === this.number) {
  36809. return textsecure.storage.groups.deleteGroup(decrypted.group.id);
  36810. } else {
  36811. return textsecure.storage.groups.removeNumber(decrypted.group.id, source);
  36812. }
  36813. case textsecure.protobuf.GroupContext.Type.DELIVER:
  36814. decrypted.group.name = null;
  36815. decrypted.group.members = [];
  36816. decrypted.group.avatar = null;
  36817. break;
  36818. default:
  36819. throw new Error("Unknown group message type");
  36820. }
  36821. }
  36822. }.bind(this)));
  36823. }
  36824. for (var i in decrypted.attachments) {
  36825. promises.push(this.handleAttachment(decrypted.attachments[i]));
  36826. }
  36827. return Promise.all(promises).then(function() {
  36828. return decrypted;
  36829. });
  36830. }
  36831. });
  36832. window.textsecure = window.textsecure || {};
  36833. textsecure.MessageReceiver = function(url, ports, username, password, signalingKey, attachment_server_url) {
  36834. var messageReceiver = new MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url);
  36835. this.addEventListener = messageReceiver.addEventListener.bind(messageReceiver);
  36836. this.removeEventListener = messageReceiver.removeEventListener.bind(messageReceiver);
  36837. this.getStatus = messageReceiver.getStatus.bind(messageReceiver);
  36838. this.close = messageReceiver.close.bind(messageReceiver);
  36839. messageReceiver.connect();
  36840. textsecure.replay.registerFunction(messageReceiver.tryMessageAgain.bind(messageReceiver), textsecure.replay.Type.INIT_SESSION);
  36841. };
  36842. textsecure.MessageReceiver.prototype = {
  36843. constructor: textsecure.MessageReceiver
  36844. };
  36845. /*
  36846. * vim: ts=4:sw=4:expandtab
  36847. */
  36848. function OutgoingMessage(server, timestamp, numbers, message, callback) {
  36849. this.server = server;
  36850. this.timestamp = timestamp;
  36851. this.numbers = numbers;
  36852. this.message = message; // DataMessage or ContentMessage proto
  36853. this.callback = callback;
  36854. this.legacy = (message instanceof textsecure.protobuf.DataMessage);
  36855. this.numbersCompleted = 0;
  36856. this.errors = [];
  36857. this.successfulNumbers = [];
  36858. }
  36859. OutgoingMessage.prototype = {
  36860. constructor: OutgoingMessage,
  36861. numberCompleted: function() {
  36862. this.numbersCompleted++;
  36863. if (this.numbersCompleted >= this.numbers.length) {
  36864. this.callback({successfulNumbers: this.successfulNumbers, errors: this.errors});
  36865. }
  36866. },
  36867. registerError: function(number, reason, error) {
  36868. if (!error || error.name === 'HTTPError' && error.code !== 404) {
  36869. error = new textsecure.OutgoingMessageError(number, this.message.toArrayBuffer(), this.timestamp, error);
  36870. }
  36871. error.number = number;
  36872. error.reason = reason;
  36873. this.errors[this.errors.length] = error;
  36874. this.numberCompleted();
  36875. },
  36876. reloadDevicesAndSend: function(number, recurse) {
  36877. return function() {
  36878. return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
  36879. if (deviceIds.length == 0) {
  36880. return this.registerError(number, "Got empty device list when loading device keys", null);
  36881. }
  36882. return this.doSendMessage(number, deviceIds, recurse);
  36883. }.bind(this));
  36884. }.bind(this);
  36885. },
  36886. getKeysForNumber: function(number, updateDevices) {
  36887. var handleResult = function(response) {
  36888. return Promise.all(response.devices.map(function(device) {
  36889. device.identityKey = response.identityKey;
  36890. if (updateDevices === undefined || updateDevices.indexOf(device.deviceId) > -1) {
  36891. var address = new libsignal.SignalProtocolAddress(number, device.deviceId);
  36892. var builder = new libsignal.SessionBuilder(textsecure.storage.protocol, address);
  36893. if (device.registrationId === 0) {
  36894. console.log("device registrationId 0!");
  36895. }
  36896. return builder.processPreKey(device).catch(function(error) {
  36897. if (error.message === "Identity key changed") {
  36898. error = new textsecure.OutgoingIdentityKeyError(
  36899. number, this.message.toArrayBuffer(),
  36900. this.timestamp, device.identityKey);
  36901. this.registerError(number, "Identity key changed", error);
  36902. }
  36903. throw error;
  36904. }.bind(this));
  36905. }
  36906. }.bind(this)));
  36907. }.bind(this);
  36908. if (updateDevices === undefined) {
  36909. return this.server.getKeysForNumber(number).then(handleResult);
  36910. } else {
  36911. var promise = Promise.resolve();
  36912. updateDevices.forEach(function(device) {
  36913. promise = promise.then(function() {
  36914. return this.server.getKeysForNumber(number, device).then(handleResult).catch(function(e) {
  36915. if (e.name === 'HTTPError' && e.code === 404) {
  36916. if (device !== 1) return this.removeDeviceIdsForNumber(number, [device]);
  36917. else throw new textsecure.UnregisteredUserError(number, e);
  36918. } else {
  36919. throw e;
  36920. }
  36921. }.bind(this));
  36922. }.bind(this));
  36923. }.bind(this));
  36924. return promise;
  36925. }
  36926. },
  36927. transmitMessage: function(number, jsonData, timestamp) {
  36928. return this.server.sendMessages(number, jsonData, timestamp).catch(function(e) {
  36929. if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410)) {
  36930. // 409 and 410 should bubble and be handled by doSendMessage
  36931. // 404 should throw UnregisteredUserError
  36932. // all other network errors can be retried later.
  36933. if (e.code === 404) {
  36934. throw new textsecure.UnregisteredUserError(number, e);
  36935. }
  36936. throw new textsecure.SendMessageNetworkError(number, jsonData, e, timestamp);
  36937. }
  36938. throw e;
  36939. });
  36940. },
  36941. getPaddedMessageLength: function(messageLength) {
  36942. var messageLengthWithTerminator = messageLength + 1;
  36943. var messagePartCount = Math.floor(messageLengthWithTerminator / 160);
  36944. if (messageLengthWithTerminator % 160 !== 0) {
  36945. messagePartCount++;
  36946. }
  36947. return messagePartCount * 160;
  36948. },
  36949. doSendMessage: function(number, deviceIds, recurse) {
  36950. var ciphers = {};
  36951. var plaintext = this.message.toArrayBuffer();
  36952. var paddedPlaintext = new Uint8Array(
  36953. this.getPaddedMessageLength(plaintext.byteLength + 1) - 1
  36954. );
  36955. paddedPlaintext.set(new Uint8Array(plaintext));
  36956. paddedPlaintext[plaintext.byteLength] = 0x80;
  36957. return Promise.all(deviceIds.map(function(deviceId) {
  36958. var address = new libsignal.SignalProtocolAddress(number, deviceId);
  36959. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  36960. ciphers[address.getDeviceId()] = sessionCipher;
  36961. return this.encryptToDevice(address, paddedPlaintext, sessionCipher);
  36962. }.bind(this))).then(function(jsonData) {
  36963. return this.transmitMessage(number, jsonData, this.timestamp).then(function() {
  36964. this.successfulNumbers[this.successfulNumbers.length] = number;
  36965. this.numberCompleted();
  36966. }.bind(this));
  36967. }.bind(this)).catch(function(error) {
  36968. if (error instanceof Error && error.name == "HTTPError" && (error.code == 410 || error.code == 409)) {
  36969. if (!recurse)
  36970. return this.registerError(number, "Hit retry limit attempting to reload device list", error);
  36971. var p;
  36972. if (error.code == 409) {
  36973. p = this.removeDeviceIdsForNumber(number, error.response.extraDevices);
  36974. } else {
  36975. p = Promise.all(error.response.staleDevices.map(function(deviceId) {
  36976. return ciphers[deviceId].closeOpenSessionForDevice();
  36977. }));
  36978. }
  36979. return p.then(function() {
  36980. var resetDevices = ((error.code == 410) ? error.response.staleDevices : error.response.missingDevices);
  36981. return this.getKeysForNumber(number, resetDevices)
  36982. .then(this.reloadDevicesAndSend(number, (error.code == 409)))
  36983. .catch(function(error) {
  36984. this.registerError(number, "Failed to reload device keys", error);
  36985. }.bind(this));
  36986. }.bind(this));
  36987. } else {
  36988. this.registerError(number, "Failed to create or send message", error);
  36989. }
  36990. }.bind(this));
  36991. },
  36992. encryptToDevice: function(address, plaintext, sessionCipher) {
  36993. return sessionCipher.encrypt(plaintext).then(function(ciphertext) {
  36994. return this.toJSON(address, ciphertext);
  36995. }.bind(this));
  36996. },
  36997. toJSON: function(address, encryptedMsg) {
  36998. var json = {
  36999. type : encryptedMsg.type,
  37000. destinationDeviceId : address.getDeviceId(),
  37001. destinationRegistrationId : encryptedMsg.registrationId
  37002. };
  37003. var content = btoa(encryptedMsg.body);
  37004. if (this.legacy) {
  37005. json.body = content;
  37006. } else {
  37007. json.content = content;
  37008. }
  37009. return json;
  37010. },
  37011. getStaleDeviceIdsForNumber: function(number) {
  37012. return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
  37013. if (deviceIds.length === 0) {
  37014. return [1];
  37015. }
  37016. var updateDevices = [];
  37017. return Promise.all(deviceIds.map(function(deviceId) {
  37018. var address = new libsignal.SignalProtocolAddress(number, deviceId);
  37019. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  37020. return sessionCipher.hasOpenSession().then(function(hasSession) {
  37021. if (!hasSession) {
  37022. updateDevices.push(deviceId);
  37023. }
  37024. });
  37025. })).then(function() {
  37026. return updateDevices;
  37027. });
  37028. });
  37029. },
  37030. removeDeviceIdsForNumber: function(number, deviceIdsToRemove) {
  37031. var promise = Promise.resolve();
  37032. for (var j in deviceIdsToRemove) {
  37033. promise = promise.then(function() {
  37034. var encodedNumber = number + "." + deviceIdsToRemove[j];
  37035. return textsecure.storage.protocol.removeSession(encodedNumber);
  37036. });
  37037. }
  37038. return promise;
  37039. },
  37040. sendToNumber: function(number) {
  37041. return this.getStaleDeviceIdsForNumber(number).then(function(updateDevices) {
  37042. return this.getKeysForNumber(number, updateDevices)
  37043. .then(this.reloadDevicesAndSend(number, true))
  37044. .catch(function(error) {
  37045. this.registerError(number, "Failed to retreive new device keys for number " + number, error);
  37046. }.bind(this));
  37047. }.bind(this));
  37048. }
  37049. };
  37050. /*
  37051. * vim: ts=4:sw=4:expandtab
  37052. */
  37053. function stringToArrayBuffer(str) {
  37054. if (typeof str !== 'string') {
  37055. throw new Error('Passed non-string to stringToArrayBuffer');
  37056. }
  37057. var res = new ArrayBuffer(str.length);
  37058. var uint = new Uint8Array(res);
  37059. for (var i = 0; i < str.length; i++) {
  37060. uint[i] = str.charCodeAt(i);
  37061. }
  37062. return res;
  37063. }
  37064. function Message(options) {
  37065. this.body = options.body;
  37066. this.attachments = options.attachments || [];
  37067. this.group = options.group;
  37068. this.flags = options.flags;
  37069. this.recipients = options.recipients;
  37070. this.timestamp = options.timestamp;
  37071. this.needsSync = options.needsSync;
  37072. this.expireTimer = options.expireTimer;
  37073. if (!(this.recipients instanceof Array) || this.recipients.length < 1) {
  37074. throw new Error('Invalid recipient list');
  37075. }
  37076. if (!this.group && this.recipients.length > 1) {
  37077. throw new Error('Invalid recipient list for non-group');
  37078. }
  37079. if (typeof this.timestamp !== 'number') {
  37080. throw new Error('Invalid timestamp');
  37081. }
  37082. if (this.expireTimer !== undefined && this.expireTimer !== null) {
  37083. if (typeof this.expireTimer !== 'number' || !(this.expireTimer >= 0)) {
  37084. throw new Error('Invalid expireTimer');
  37085. }
  37086. }
  37087. if (this.attachments) {
  37088. if (!(this.attachments instanceof Array)) {
  37089. throw new Error('Invalid message attachments');
  37090. }
  37091. }
  37092. if (this.flags !== undefined) {
  37093. if (typeof this.flags !== 'number') {
  37094. throw new Error('Invalid message flags');
  37095. }
  37096. }
  37097. if (this.isEndSession()) {
  37098. if (this.body !== null || this.group !== null || this.attachments.length !== 0) {
  37099. throw new Error('Invalid end session message');
  37100. }
  37101. } else {
  37102. if ( (typeof this.timestamp !== 'number') ||
  37103. (this.body && typeof this.body !== 'string') ) {
  37104. throw new Error('Invalid message body');
  37105. }
  37106. if (this.group) {
  37107. if ( (typeof this.group.id !== 'string') ||
  37108. (typeof this.group.type !== 'number') ) {
  37109. throw new Error('Invalid group context');
  37110. }
  37111. }
  37112. }
  37113. }
  37114. Message.prototype = {
  37115. constructor: Message,
  37116. isEndSession: function() {
  37117. return (this.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION);
  37118. },
  37119. toProto: function() {
  37120. if (this.dataMessage instanceof textsecure.protobuf.DataMessage) {
  37121. return this.dataMessage;
  37122. }
  37123. var proto = new textsecure.protobuf.DataMessage();
  37124. if (this.body) {
  37125. proto.body = this.body;
  37126. }
  37127. proto.attachments = this.attachmentPointers;
  37128. if (this.flags) {
  37129. proto.flags = this.flags;
  37130. }
  37131. if (this.group) {
  37132. proto.group = new textsecure.protobuf.GroupContext();
  37133. proto.group.id = stringToArrayBuffer(this.group.id);
  37134. proto.group.type = this.group.type
  37135. }
  37136. if (this.expireTimer) {
  37137. proto.expireTimer = this.expireTimer;
  37138. }
  37139. this.dataMessage = proto;
  37140. return proto;
  37141. },
  37142. toArrayBuffer: function() {
  37143. return this.toProto().toArrayBuffer();
  37144. }
  37145. };
  37146. function MessageSender(url, ports, username, password, attachment_server_url) {
  37147. this.server = new TextSecureServer(url, ports, username, password, attachment_server_url);
  37148. this.pendingMessages = {};
  37149. }
  37150. MessageSender.prototype = {
  37151. constructor: MessageSender,
  37152. makeAttachmentPointer: function(attachment) {
  37153. if (typeof attachment !== 'object' || attachment == null) {
  37154. return Promise.resolve(undefined);
  37155. }
  37156. var proto = new textsecure.protobuf.AttachmentPointer();
  37157. proto.key = libsignal.crypto.getRandomBytes(64);
  37158. var iv = libsignal.crypto.getRandomBytes(16);
  37159. return textsecure.crypto.encryptAttachment(attachment.data, proto.key, iv).then(function(encryptedBin) {
  37160. return this.server.putAttachment(encryptedBin).then(function(id) {
  37161. proto.id = id;
  37162. proto.contentType = attachment.contentType;
  37163. return proto;
  37164. });
  37165. }.bind(this));
  37166. },
  37167. retransmitMessage: function(number, jsonData, timestamp) {
  37168. var outgoing = new OutgoingMessage(this.server);
  37169. return outgoing.transmitMessage(number, jsonData, timestamp);
  37170. },
  37171. tryMessageAgain: function(number, encodedMessage, timestamp) {
  37172. var proto = textsecure.protobuf.DataMessage.decode(encodedMessage);
  37173. return this.sendIndividualProto(number, proto, timestamp);
  37174. },
  37175. queueJobForNumber: function(number, runJob) {
  37176. var runPrevious = this.pendingMessages[number] || Promise.resolve();
  37177. var runCurrent = this.pendingMessages[number] = runPrevious.then(runJob, runJob);
  37178. runCurrent.then(function() {
  37179. if (this.pendingMessages[number] === runCurrent) {
  37180. delete this.pendingMessages[number];
  37181. }
  37182. }.bind(this));
  37183. },
  37184. uploadMedia: function(message) {
  37185. return Promise.all(
  37186. message.attachments.map(this.makeAttachmentPointer.bind(this))
  37187. ).then(function(attachmentPointers) {
  37188. message.attachmentPointers = attachmentPointers;
  37189. }).catch(function(error) {
  37190. if (error instanceof Error && error.name === 'HTTPError') {
  37191. throw new textsecure.MessageError(message, error);
  37192. } else {
  37193. throw error;
  37194. }
  37195. });
  37196. },
  37197. sendMessage: function(attrs) {
  37198. var message = new Message(attrs);
  37199. return this.uploadMedia(message).then(function() {
  37200. return new Promise(function(resolve, reject) {
  37201. this.sendMessageProto(
  37202. message.timestamp,
  37203. message.recipients,
  37204. message.toProto(),
  37205. function(res) {
  37206. res.dataMessage = message.toArrayBuffer();
  37207. if (res.errors.length > 0) {
  37208. reject(res);
  37209. } else {
  37210. resolve(res);
  37211. }
  37212. }
  37213. );
  37214. }.bind(this));
  37215. }.bind(this));
  37216. },
  37217. sendMessageProto: function(timestamp, numbers, message, callback) {
  37218. var rejections = textsecure.storage.get('signedKeyRotationRejected', 0);
  37219. if (rejections > 5) {
  37220. throw new textsecure.SignedPreKeyRotationError(numbers, message.toArrayBuffer(), timestamp);
  37221. }
  37222. var outgoing = new OutgoingMessage(this.server, timestamp, numbers, message, callback);
  37223. numbers.forEach(function(number) {
  37224. this.queueJobForNumber(number, function() {
  37225. return outgoing.sendToNumber(number);
  37226. });
  37227. }.bind(this));
  37228. },
  37229. retrySendMessageProto: function(numbers, encodedMessage, timestamp) {
  37230. var proto = textsecure.protobuf.DataMessage.decode(encodedMessage);
  37231. return new Promise(function(resolve, reject) {
  37232. this.sendMessageProto(timestamp, numbers, proto, function(res) {
  37233. if (res.errors.length > 0)
  37234. reject(res);
  37235. else
  37236. resolve(res);
  37237. });
  37238. }.bind(this));
  37239. },
  37240. sendIndividualProto: function(number, proto, timestamp) {
  37241. return new Promise(function(resolve, reject) {
  37242. this.sendMessageProto(timestamp, [number], proto, function(res) {
  37243. if (res.errors.length > 0)
  37244. reject(res);
  37245. else
  37246. resolve(res);
  37247. });
  37248. }.bind(this));
  37249. },
  37250. sendSyncMessage: function(encodedDataMessage, timestamp, destination, expirationStartTimestamp) {
  37251. var myNumber = textsecure.storage.user.getNumber();
  37252. var myDevice = textsecure.storage.user.getDeviceId();
  37253. if (myDevice == 1) {
  37254. return Promise.resolve();
  37255. }
  37256. var dataMessage = textsecure.protobuf.DataMessage.decode(encodedDataMessage);
  37257. var sentMessage = new textsecure.protobuf.SyncMessage.Sent();
  37258. sentMessage.timestamp = timestamp;
  37259. sentMessage.message = dataMessage;
  37260. if (destination) {
  37261. sentMessage.destination = destination;
  37262. }
  37263. if (expirationStartTimestamp) {
  37264. sentMessage.expirationStartTimestamp = expirationStartTimestamp;
  37265. }
  37266. var syncMessage = new textsecure.protobuf.SyncMessage();
  37267. syncMessage.sent = sentMessage;
  37268. var contentMessage = new textsecure.protobuf.Content();
  37269. contentMessage.syncMessage = syncMessage;
  37270. return this.sendIndividualProto(myNumber, contentMessage, Date.now());
  37271. },
  37272. sendRequestGroupSyncMessage: function() {
  37273. var myNumber = textsecure.storage.user.getNumber();
  37274. var myDevice = textsecure.storage.user.getDeviceId();
  37275. if (myDevice != 1) {
  37276. var request = new textsecure.protobuf.SyncMessage.Request();
  37277. request.type = textsecure.protobuf.SyncMessage.Request.Type.GROUPS;
  37278. var syncMessage = new textsecure.protobuf.SyncMessage();
  37279. syncMessage.request = request;
  37280. var contentMessage = new textsecure.protobuf.Content();
  37281. contentMessage.syncMessage = syncMessage;
  37282. return this.sendIndividualProto(myNumber, contentMessage, Date.now());
  37283. }
  37284. },
  37285. sendRequestContactSyncMessage: function() {
  37286. var myNumber = textsecure.storage.user.getNumber();
  37287. var myDevice = textsecure.storage.user.getDeviceId();
  37288. if (myDevice != 1) {
  37289. var request = new textsecure.protobuf.SyncMessage.Request();
  37290. request.type = textsecure.protobuf.SyncMessage.Request.Type.CONTACTS;
  37291. var syncMessage = new textsecure.protobuf.SyncMessage();
  37292. syncMessage.request = request;
  37293. var contentMessage = new textsecure.protobuf.Content();
  37294. contentMessage.syncMessage = syncMessage;
  37295. return this.sendIndividualProto(myNumber, contentMessage, Date.now());
  37296. }
  37297. },
  37298. syncReadMessages: function(reads) {
  37299. var myNumber = textsecure.storage.user.getNumber();
  37300. var myDevice = textsecure.storage.user.getDeviceId();
  37301. if (myDevice != 1) {
  37302. var syncMessage = new textsecure.protobuf.SyncMessage();
  37303. syncMessage.read = [];
  37304. for (var i = 0; i < reads.length; ++i) {
  37305. var read = new textsecure.protobuf.SyncMessage.Read();
  37306. read.timestamp = reads[i].timestamp;
  37307. read.sender = reads[i].sender;
  37308. syncMessage.read.push(read);
  37309. }
  37310. var contentMessage = new textsecure.protobuf.Content();
  37311. contentMessage.syncMessage = syncMessage;
  37312. return this.sendIndividualProto(myNumber, contentMessage, Date.now());
  37313. }
  37314. },
  37315. sendGroupProto: function(numbers, proto, timestamp) {
  37316. timestamp = timestamp || Date.now();
  37317. var me = textsecure.storage.user.getNumber();
  37318. numbers = numbers.filter(function(number) { return number != me; });
  37319. if (numbers.length === 0) {
  37320. return Promise.reject(new Error('No other members in the group'));
  37321. }
  37322. return new Promise(function(resolve, reject) {
  37323. this.sendMessageProto(timestamp, numbers, proto, function(res) {
  37324. res.dataMessage = proto.toArrayBuffer();
  37325. if (res.errors.length > 0)
  37326. reject(res);
  37327. else
  37328. resolve(res);
  37329. }.bind(this));
  37330. }.bind(this));
  37331. },
  37332. sendMessageToNumber: function(number, messageText, attachments, timestamp, expireTimer) {
  37333. return this.sendMessage({
  37334. recipients : [number],
  37335. body : messageText,
  37336. timestamp : timestamp,
  37337. attachments : attachments,
  37338. needsSync : true,
  37339. expireTimer : expireTimer
  37340. });
  37341. },
  37342. closeSession: function(number, timestamp) {
  37343. console.log('sending end session');
  37344. var proto = new textsecure.protobuf.DataMessage();
  37345. proto.body = "TERMINATE";
  37346. proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION;
  37347. return this.sendIndividualProto(number, proto, timestamp).then(function(res) {
  37348. return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
  37349. return Promise.all(deviceIds.map(function(deviceId) {
  37350. var address = new libsignal.SignalProtocolAddress(number, deviceId);
  37351. console.log('closing session for', address.toString());
  37352. var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
  37353. return sessionCipher.closeOpenSessionForDevice();
  37354. })).then(function() {
  37355. return res;
  37356. });
  37357. });
  37358. });
  37359. },
  37360. sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) {
  37361. return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
  37362. if (numbers === undefined)
  37363. return Promise.reject(new Error("Unknown Group"));
  37364. var me = textsecure.storage.user.getNumber();
  37365. numbers = numbers.filter(function(number) { return number != me; });
  37366. if (numbers.length === 0) {
  37367. return Promise.reject(new Error('No other members in the group'));
  37368. }
  37369. return this.sendMessage({
  37370. recipients : numbers,
  37371. body : messageText,
  37372. timestamp : timestamp,
  37373. attachments : attachments,
  37374. needsSync : true,
  37375. expireTimer : expireTimer,
  37376. group: {
  37377. id: groupId,
  37378. type: textsecure.protobuf.GroupContext.Type.DELIVER
  37379. }
  37380. });
  37381. }.bind(this));
  37382. },
  37383. createGroup: function(numbers, name, avatar) {
  37384. var proto = new textsecure.protobuf.DataMessage();
  37385. proto.group = new textsecure.protobuf.GroupContext();
  37386. return textsecure.storage.groups.createNewGroup(numbers).then(function(group) {
  37387. proto.group.id = stringToArrayBuffer(group.id);
  37388. var numbers = group.numbers;
  37389. proto.group.type = textsecure.protobuf.GroupContext.Type.UPDATE;
  37390. proto.group.members = numbers;
  37391. proto.group.name = name;
  37392. return this.makeAttachmentPointer(avatar).then(function(attachment) {
  37393. proto.group.avatar = attachment;
  37394. return this.sendGroupProto(numbers, proto).then(function() {
  37395. return proto.group.id;
  37396. });
  37397. }.bind(this));
  37398. }.bind(this));
  37399. },
  37400. updateGroup: function(groupId, name, avatar, numbers) {
  37401. var proto = new textsecure.protobuf.DataMessage();
  37402. proto.group = new textsecure.protobuf.GroupContext();
  37403. proto.group.id = stringToArrayBuffer(groupId);
  37404. proto.group.type = textsecure.protobuf.GroupContext.Type.UPDATE;
  37405. proto.group.name = name;
  37406. return textsecure.storage.groups.addNumbers(groupId, numbers).then(function(numbers) {
  37407. if (numbers === undefined) {
  37408. return Promise.reject(new Error("Unknown Group"));
  37409. }
  37410. proto.group.members = numbers;
  37411. return this.makeAttachmentPointer(avatar).then(function(attachment) {
  37412. proto.group.avatar = attachment;
  37413. return this.sendGroupProto(numbers, proto).then(function() {
  37414. return proto.group.id;
  37415. });
  37416. }.bind(this));
  37417. }.bind(this));
  37418. },
  37419. addNumberToGroup: function(groupId, number) {
  37420. var proto = new textsecure.protobuf.DataMessage();
  37421. proto.group = new textsecure.protobuf.GroupContext();
  37422. proto.group.id = stringToArrayBuffer(groupId);
  37423. proto.group.type = textsecure.protobuf.GroupContext.Type.UPDATE;
  37424. return textsecure.storage.groups.addNumbers(groupId, [number]).then(function(numbers) {
  37425. if (numbers === undefined)
  37426. return Promise.reject(new Error("Unknown Group"));
  37427. proto.group.members = numbers;
  37428. return this.sendGroupProto(numbers, proto);
  37429. }.bind(this));
  37430. },
  37431. setGroupName: function(groupId, name) {
  37432. var proto = new textsecure.protobuf.DataMessage();
  37433. proto.group = new textsecure.protobuf.GroupContext();
  37434. proto.group.id = stringToArrayBuffer(groupId);
  37435. proto.group.type = textsecure.protobuf.GroupContext.Type.UPDATE;
  37436. proto.group.name = name;
  37437. return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
  37438. if (numbers === undefined)
  37439. return Promise.reject(new Error("Unknown Group"));
  37440. proto.group.members = numbers;
  37441. return this.sendGroupProto(numbers, proto);
  37442. }.bind(this));
  37443. },
  37444. setGroupAvatar: function(groupId, avatar) {
  37445. var proto = new textsecure.protobuf.DataMessage();
  37446. proto.group = new textsecure.protobuf.GroupContext();
  37447. proto.group.id = stringToArrayBuffer(groupId);
  37448. proto.group.type = textsecure.protobuf.GroupContext.Type.UPDATE;
  37449. return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
  37450. if (numbers === undefined)
  37451. return Promise.reject(new Error("Unknown Group"));
  37452. proto.group.members = numbers;
  37453. return this.makeAttachmentPointer(avatar).then(function(attachment) {
  37454. proto.group.avatar = attachment;
  37455. return this.sendGroupProto(numbers, proto);
  37456. }.bind(this));
  37457. }.bind(this));
  37458. },
  37459. leaveGroup: function(groupId) {
  37460. var proto = new textsecure.protobuf.DataMessage();
  37461. proto.group = new textsecure.protobuf.GroupContext();
  37462. proto.group.id = stringToArrayBuffer(groupId);
  37463. proto.group.type = textsecure.protobuf.GroupContext.Type.QUIT;
  37464. return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
  37465. if (numbers === undefined)
  37466. return Promise.reject(new Error("Unknown Group"));
  37467. return textsecure.storage.groups.deleteGroup(groupId).then(function() {
  37468. return this.sendGroupProto(numbers, proto);
  37469. }.bind(this));
  37470. });
  37471. },
  37472. sendExpirationTimerUpdateToGroup: function(groupId, expireTimer, timestamp) {
  37473. return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
  37474. if (numbers === undefined)
  37475. return Promise.reject(new Error("Unknown Group"));
  37476. var me = textsecure.storage.user.getNumber();
  37477. numbers = numbers.filter(function(number) { return number != me; });
  37478. if (numbers.length === 0) {
  37479. return Promise.reject(new Error('No other members in the group'));
  37480. }
  37481. return this.sendMessage({
  37482. recipients : numbers,
  37483. timestamp : timestamp,
  37484. needsSync : true,
  37485. expireTimer : expireTimer,
  37486. flags : textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
  37487. group: {
  37488. id: groupId,
  37489. type: textsecure.protobuf.GroupContext.Type.DELIVER
  37490. }
  37491. });
  37492. }.bind(this));
  37493. },
  37494. sendExpirationTimerUpdateToNumber: function(number, expireTimer, timestamp) {
  37495. var proto = new textsecure.protobuf.DataMessage();
  37496. return this.sendMessage({
  37497. recipients : [number],
  37498. timestamp : timestamp,
  37499. needsSync : true,
  37500. expireTimer : expireTimer,
  37501. flags : textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE
  37502. });
  37503. }
  37504. };
  37505. window.textsecure = window.textsecure || {};
  37506. textsecure.MessageSender = function(url, ports, username, password, attachment_server_url) {
  37507. var sender = new MessageSender(url, ports, username, password, attachment_server_url);
  37508. textsecure.replay.registerFunction(sender.tryMessageAgain.bind(sender), textsecure.replay.Type.ENCRYPT_MESSAGE);
  37509. textsecure.replay.registerFunction(sender.retransmitMessage.bind(sender), textsecure.replay.Type.TRANSMIT_MESSAGE);
  37510. textsecure.replay.registerFunction(sender.sendMessage.bind(sender), textsecure.replay.Type.REBUILD_MESSAGE);
  37511. textsecure.replay.registerFunction(sender.retrySendMessageProto.bind(sender), textsecure.replay.Type.RETRY_SEND_MESSAGE_PROTO);
  37512. this.sendExpirationTimerUpdateToNumber = sender.sendExpirationTimerUpdateToNumber.bind(sender);
  37513. this.sendExpirationTimerUpdateToGroup = sender.sendExpirationTimerUpdateToGroup .bind(sender);
  37514. this.sendRequestGroupSyncMessage = sender.sendRequestGroupSyncMessage .bind(sender);
  37515. this.sendRequestContactSyncMessage = sender.sendRequestContactSyncMessage .bind(sender);
  37516. this.sendMessageToNumber = sender.sendMessageToNumber .bind(sender);
  37517. this.closeSession = sender.closeSession .bind(sender);
  37518. this.sendMessageToGroup = sender.sendMessageToGroup .bind(sender);
  37519. this.createGroup = sender.createGroup .bind(sender);
  37520. this.updateGroup = sender.updateGroup .bind(sender);
  37521. this.addNumberToGroup = sender.addNumberToGroup .bind(sender);
  37522. this.setGroupName = sender.setGroupName .bind(sender);
  37523. this.setGroupAvatar = sender.setGroupAvatar .bind(sender);
  37524. this.leaveGroup = sender.leaveGroup .bind(sender);
  37525. this.sendSyncMessage = sender.sendSyncMessage .bind(sender);
  37526. this.syncReadMessages = sender.syncReadMessages .bind(sender);
  37527. };
  37528. textsecure.MessageSender.prototype = {
  37529. constructor: textsecure.MessageSender
  37530. };
  37531. /*
  37532. * vim: ts=4:sw=4:expandtab
  37533. */
  37534. ;(function () {
  37535. 'use strict';
  37536. window.textsecure = window.textsecure || {};
  37537. function SyncRequest(sender, receiver) {
  37538. if (!(sender instanceof textsecure.MessageSender) || !(receiver instanceof textsecure.MessageReceiver)) {
  37539. throw new Error('Tried to construct a SyncRequest without MessageSender and MessageReceiver');
  37540. }
  37541. this.receiver = receiver;
  37542. this.oncontact = this.onContactSyncComplete.bind(this);
  37543. receiver.addEventListener('contactsync', this.oncontact);
  37544. this.ongroup = this.onGroupSyncComplete.bind(this);
  37545. receiver.addEventListener('groupsync', this.ongroup);
  37546. sender.sendRequestContactSyncMessage().then(function() {
  37547. sender.sendRequestGroupSyncMessage();
  37548. });
  37549. this.timeout = setTimeout(this.onTimeout.bind(this), 60000);
  37550. }
  37551. SyncRequest.prototype = new textsecure.EventTarget();
  37552. SyncRequest.prototype.extend({
  37553. constructor: SyncRequest,
  37554. onContactSyncComplete: function() {
  37555. this.contactSync = true;
  37556. this.update();
  37557. },
  37558. onGroupSyncComplete: function() {
  37559. this.groupSync = true;
  37560. this.update();
  37561. },
  37562. update: function() {
  37563. if (this.contactSync && this.groupSync) {
  37564. this.dispatchEvent(new Event('success'));
  37565. this.cleanup();
  37566. }
  37567. },
  37568. onTimeout: function() {
  37569. if (this.contactSync || this.groupSync) {
  37570. this.dispatchEvent(new Event('success'));
  37571. } else {
  37572. this.dispatchEvent(new Event('timeout'));
  37573. }
  37574. this.cleanup();
  37575. },
  37576. cleanup: function() {
  37577. clearTimeout(this.timeout);
  37578. this.receiver.removeEventListener('contactsync', this.oncontact);
  37579. this.receiver.removeEventListener('groupSync', this.ongroup);
  37580. delete this.listeners;
  37581. }
  37582. });
  37583. textsecure.SyncRequest = function(sender, receiver) {
  37584. var syncRequest = new SyncRequest(sender, receiver);
  37585. this.addEventListener = syncRequest.addEventListener.bind(syncRequest);
  37586. this.removeEventListener = syncRequest.removeEventListener.bind(syncRequest);
  37587. };
  37588. textsecure.SyncRequest.prototype = {
  37589. constructor: textsecure.SyncRequest
  37590. };
  37591. }());
  37592. /*
  37593. * vim: ts=4:sw=4:expandtab
  37594. */
  37595. function ProtoParser(arrayBuffer, protobuf) {
  37596. this.protobuf = protobuf;
  37597. this.buffer = new dcodeIO.ByteBuffer();
  37598. this.buffer.append(arrayBuffer);
  37599. this.buffer.offset = 0;
  37600. this.buffer.limit = arrayBuffer.byteLength;
  37601. }
  37602. ProtoParser.prototype = {
  37603. constructor: ProtoParser,
  37604. next: function() {
  37605. try {
  37606. if (this.buffer.limit === this.buffer.offset) {
  37607. return undefined; // eof
  37608. }
  37609. var len = this.buffer.readVarint32();
  37610. var nextBuffer = this.buffer.slice(
  37611. this.buffer.offset, this.buffer.offset+len
  37612. ).toArrayBuffer();
  37613. // TODO: de-dupe ByteBuffer.js includes in libaxo/libts
  37614. // then remove this toArrayBuffer call.
  37615. var proto = this.protobuf.decode(nextBuffer);
  37616. this.buffer.skip(len);
  37617. if (proto.avatar) {
  37618. var attachmentLen = proto.avatar.length;
  37619. proto.avatar.data = this.buffer.slice(
  37620. this.buffer.offset, this.buffer.offset + attachmentLen
  37621. ).toArrayBuffer();
  37622. this.buffer.skip(attachmentLen);
  37623. }
  37624. return proto;
  37625. } catch(e) {
  37626. console.log(e);
  37627. }
  37628. }
  37629. };
  37630. var GroupBuffer = function(arrayBuffer) {
  37631. ProtoParser.call(this, arrayBuffer, textsecure.protobuf.GroupDetails);
  37632. };
  37633. GroupBuffer.prototype = Object.create(ProtoParser.prototype);
  37634. GroupBuffer.prototype.constructor = GroupBuffer;
  37635. var ContactBuffer = function(arrayBuffer) {
  37636. ProtoParser.call(this, arrayBuffer, textsecure.protobuf.ContactDetails);
  37637. };
  37638. ContactBuffer.prototype = Object.create(ProtoParser.prototype);
  37639. ContactBuffer.prototype.constructor = ContactBuffer;
  37640. (function() {
  37641. 'use strict';
  37642. function ProvisioningCipher() {}
  37643. ProvisioningCipher.prototype = {
  37644. decrypt: function(provisionEnvelope) {
  37645. var masterEphemeral = provisionEnvelope.publicKey.toArrayBuffer();
  37646. var message = provisionEnvelope.body.toArrayBuffer();
  37647. if (new Uint8Array(message)[0] != 1) {
  37648. throw new Error("Bad version number on ProvisioningMessage");
  37649. }
  37650. var iv = message.slice(1, 16 + 1);
  37651. var mac = message.slice(message.byteLength - 32, message.byteLength);
  37652. var ivAndCiphertext = message.slice(0, message.byteLength - 32);
  37653. var ciphertext = message.slice(16 + 1, message.byteLength - 32);
  37654. return libsignal.Curve.async.calculateAgreement(
  37655. masterEphemeral, this.keyPair.privKey
  37656. ).then(function(ecRes) {
  37657. return libsignal.HKDF.deriveSecrets(
  37658. ecRes, new ArrayBuffer(32), "TextSecure Provisioning Message"
  37659. );
  37660. }).then(function(keys) {
  37661. return libsignal.crypto.verifyMAC(ivAndCiphertext, keys[1], mac, 32).then(function() {
  37662. return libsignal.crypto.decrypt(keys[0], ciphertext, iv);
  37663. });
  37664. }).then(function(plaintext) {
  37665. var provisionMessage = textsecure.protobuf.ProvisionMessage.decode(plaintext);
  37666. var privKey = provisionMessage.identityKeyPrivate.toArrayBuffer();
  37667. return libsignal.Curve.async.createKeyPair(privKey).then(function(keyPair) {
  37668. return {
  37669. identityKeyPair : keyPair,
  37670. number : provisionMessage.number,
  37671. provisioningCode : provisionMessage.provisioningCode,
  37672. userAgent : provisionMessage.userAgent
  37673. };
  37674. });
  37675. });
  37676. },
  37677. getPublicKey: function() {
  37678. return Promise.resolve().then(function() {
  37679. if (!this.keyPair) {
  37680. return libsignal.Curve.async.generateKeyPair().then(function(keyPair) {
  37681. this.keyPair = keyPair;
  37682. }.bind(this));
  37683. }
  37684. }.bind(this)).then(function() {
  37685. return this.keyPair.pubKey;
  37686. }.bind(this));
  37687. }
  37688. };
  37689. libsignal.ProvisioningCipher = function() {
  37690. var cipher = new ProvisioningCipher();
  37691. this.decrypt = cipher.decrypt.bind(cipher);
  37692. this.getPublicKey = cipher.getPublicKey.bind(cipher);
  37693. };
  37694. })();
  37695. })();