musl_linux_arm.go 191 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918
  1. // Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm.go -pkgname libc -static-locals-prefix _s -Iarch/arm -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/__ctype_b_loc.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/locale/localeconv.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT.
  2. package libc
  3. import (
  4. "math"
  5. "reflect"
  6. "sync/atomic"
  7. "unsafe"
  8. )
  9. var _ = math.Pi
  10. var _ reflect.Kind
  11. var _ atomic.Value
  12. var _ unsafe.Pointer
  13. // musl as a whole is licensed under the following standard MIT license:
  14. //
  15. // ----------------------------------------------------------------------
  16. // Copyright © 2005-2020 Rich Felker, et al.
  17. //
  18. // Permission is hereby granted, free of charge, to any person obtaining
  19. // a copy of this software and associated documentation files (the
  20. // "Software"), to deal in the Software without restriction, including
  21. // without limitation the rights to use, copy, modify, merge, publish,
  22. // distribute, sublicense, and/or sell copies of the Software, and to
  23. // permit persons to whom the Software is furnished to do so, subject to
  24. // the following conditions:
  25. //
  26. // The above copyright notice and this permission notice shall be
  27. // included in all copies or substantial portions of the Software.
  28. //
  29. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  30. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  31. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  32. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  33. // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  34. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  35. // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  36. // ----------------------------------------------------------------------
  37. //
  38. // Authors/contributors include:
  39. //
  40. // A. Wilcox
  41. // Ada Worcester
  42. // Alex Dowad
  43. // Alex Suykov
  44. // Alexander Monakov
  45. // Andre McCurdy
  46. // Andrew Kelley
  47. // Anthony G. Basile
  48. // Aric Belsito
  49. // Arvid Picciani
  50. // Bartosz Brachaczek
  51. // Benjamin Peterson
  52. // Bobby Bingham
  53. // Boris Brezillon
  54. // Brent Cook
  55. // Chris Spiegel
  56. // Clément Vasseur
  57. // Daniel Micay
  58. // Daniel Sabogal
  59. // Daurnimator
  60. // David Carlier
  61. // David Edelsohn
  62. // Denys Vlasenko
  63. // Dmitry Ivanov
  64. // Dmitry V. Levin
  65. // Drew DeVault
  66. // Emil Renner Berthing
  67. // Fangrui Song
  68. // Felix Fietkau
  69. // Felix Janda
  70. // Gianluca Anzolin
  71. // Hauke Mehrtens
  72. // He X
  73. // Hiltjo Posthuma
  74. // Isaac Dunham
  75. // Jaydeep Patil
  76. // Jens Gustedt
  77. // Jeremy Huntwork
  78. // Jo-Philipp Wich
  79. // Joakim Sindholt
  80. // John Spencer
  81. // Julien Ramseier
  82. // Justin Cormack
  83. // Kaarle Ritvanen
  84. // Khem Raj
  85. // Kylie McClain
  86. // Leah Neukirchen
  87. // Luca Barbato
  88. // Luka Perkov
  89. // M Farkas-Dyck (Strake)
  90. // Mahesh Bodapati
  91. // Markus Wichmann
  92. // Masanori Ogino
  93. // Michael Clark
  94. // Michael Forney
  95. // Mikhail Kremnyov
  96. // Natanael Copa
  97. // Nicholas J. Kain
  98. // orc
  99. // Pascal Cuoq
  100. // Patrick Oppenlander
  101. // Petr Hosek
  102. // Petr Skocik
  103. // Pierre Carrier
  104. // Reini Urban
  105. // Rich Felker
  106. // Richard Pennington
  107. // Ryan Fairfax
  108. // Samuel Holland
  109. // Segev Finer
  110. // Shiz
  111. // sin
  112. // Solar Designer
  113. // Stefan Kristiansson
  114. // Stefan O'Rear
  115. // Szabolcs Nagy
  116. // Timo Teräs
  117. // Trutz Behn
  118. // Valentin Ochs
  119. // Will Dietz
  120. // William Haddon
  121. // William Pitcock
  122. //
  123. // Portions of this software are derived from third-party works licensed
  124. // under terms compatible with the above MIT license:
  125. //
  126. // The TRE regular expression implementation (src/regex/reg* and
  127. // src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
  128. // under a 2-clause BSD license (license text in the source files). The
  129. // included version has been heavily modified by Rich Felker in 2012, in
  130. // the interests of size, simplicity, and namespace cleanliness.
  131. //
  132. // Much of the math library code (src/math/* and src/complex/*) is
  133. // Copyright © 1993,2004 Sun Microsystems or
  134. // Copyright © 2003-2011 David Schultz or
  135. // Copyright © 2003-2009 Steven G. Kargl or
  136. // Copyright © 2003-2009 Bruce D. Evans or
  137. // Copyright © 2008 Stephen L. Moshier or
  138. // Copyright © 2017-2018 Arm Limited
  139. // and labelled as such in comments in the individual source files. All
  140. // have been licensed under extremely permissive terms.
  141. //
  142. // The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
  143. // The Android Open Source Project and is licensed under a two-clause BSD
  144. // license. It was taken from Bionic libc, used on Android.
  145. //
  146. // The AArch64 memcpy and memset code (src/string/aarch64/*) are
  147. // Copyright © 1999-2019, Arm Limited.
  148. //
  149. // The implementation of DES for crypt (src/crypt/crypt_des.c) is
  150. // Copyright © 1994 David Burren. It is licensed under a BSD license.
  151. //
  152. // The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
  153. // originally written by Solar Designer and placed into the public
  154. // domain. The code also comes with a fallback permissive license for use
  155. // in jurisdictions that may not recognize the public domain.
  156. //
  157. // The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
  158. // Valentin Ochs and is licensed under an MIT-style license.
  159. //
  160. // The x86_64 port was written by Nicholas J. Kain and is licensed under
  161. // the standard MIT terms.
  162. //
  163. // The mips and microblaze ports were originally written by Richard
  164. // Pennington for use in the ellcc project. The original code was adapted
  165. // by Rich Felker for build system and code conventions during upstream
  166. // integration. It is licensed under the standard MIT terms.
  167. //
  168. // The mips64 port was contributed by Imagination Technologies and is
  169. // licensed under the standard MIT terms.
  170. //
  171. // The powerpc port was also originally written by Richard Pennington,
  172. // and later supplemented and integrated by John Spencer. It is licensed
  173. // under the standard MIT terms.
  174. //
  175. // All other files which have no copyright comments are original works
  176. // produced specifically for use as part of this library, written either
  177. // by Rich Felker, the main author of the library, or by one or more
  178. // contibutors listed above. Details on authorship of individual files
  179. // can be found in the git version control history of the project. The
  180. // omission of copyright and license comments in each file is in the
  181. // interest of source tree size.
  182. //
  183. // In addition, permission is hereby granted for all public header files
  184. // (include/* and arch/*/bits/*) and crt files intended to be linked into
  185. // applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
  186. // the copyright notice and permission notice otherwise required by the
  187. // license, and to use these files without any requirement of
  188. // attribution. These files include substantial contributions from:
  189. //
  190. // Bobby Bingham
  191. // John Spencer
  192. // Nicholas J. Kain
  193. // Rich Felker
  194. // Richard Pennington
  195. // Stefan Kristiansson
  196. // Szabolcs Nagy
  197. //
  198. // all of whom have explicitly granted such permission.
  199. //
  200. // This file previously contained text expressing a belief that most of
  201. // the files covered by the above exception were sufficiently trivial not
  202. // to be subject to copyright, resulting in confusion over whether it
  203. // negated the permissions granted in the license. In the spirit of
  204. // permissive licensing, and of not having licensing issues being an
  205. // obstacle to adoption, that text has been removed.
  206. const ( /* copyright.c:194:1: */
  207. __musl__copyright__ = 0
  208. )
  209. const ( /* nameser.h:117:1: */
  210. ns_uop_delete = 0
  211. ns_uop_add = 1
  212. ns_uop_max = 2
  213. )
  214. const ( /* nameser.h:147:1: */
  215. ns_t_invalid = 0
  216. ns_t_a = 1
  217. ns_t_ns = 2
  218. ns_t_md = 3
  219. ns_t_mf = 4
  220. ns_t_cname = 5
  221. ns_t_soa = 6
  222. ns_t_mb = 7
  223. ns_t_mg = 8
  224. ns_t_mr = 9
  225. ns_t_null = 10
  226. ns_t_wks = 11
  227. ns_t_ptr = 12
  228. ns_t_hinfo = 13
  229. ns_t_minfo = 14
  230. ns_t_mx = 15
  231. ns_t_txt = 16
  232. ns_t_rp = 17
  233. ns_t_afsdb = 18
  234. ns_t_x25 = 19
  235. ns_t_isdn = 20
  236. ns_t_rt = 21
  237. ns_t_nsap = 22
  238. ns_t_nsap_ptr = 23
  239. ns_t_sig = 24
  240. ns_t_key = 25
  241. ns_t_px = 26
  242. ns_t_gpos = 27
  243. ns_t_aaaa = 28
  244. ns_t_loc = 29
  245. ns_t_nxt = 30
  246. ns_t_eid = 31
  247. ns_t_nimloc = 32
  248. ns_t_srv = 33
  249. ns_t_atma = 34
  250. ns_t_naptr = 35
  251. ns_t_kx = 36
  252. ns_t_cert = 37
  253. ns_t_a6 = 38
  254. ns_t_dname = 39
  255. ns_t_sink = 40
  256. ns_t_opt = 41
  257. ns_t_apl = 42
  258. ns_t_tkey = 249
  259. ns_t_tsig = 250
  260. ns_t_ixfr = 251
  261. ns_t_axfr = 252
  262. ns_t_mailb = 253
  263. ns_t_maila = 254
  264. ns_t_any = 255
  265. ns_t_zxfr = 256
  266. ns_t_max = 65536
  267. )
  268. const ( /* nameser.h:210:1: */
  269. ns_c_invalid = 0
  270. ns_c_in = 1
  271. ns_c_2 = 2
  272. ns_c_chaos = 3
  273. ns_c_hs = 4
  274. ns_c_none = 254
  275. ns_c_any = 255
  276. ns_c_max = 65536
  277. )
  278. const ( /* nameser.h:221:1: */
  279. ns_kt_rsa = 1
  280. ns_kt_dh = 2
  281. ns_kt_dsa = 3
  282. ns_kt_private = 254
  283. )
  284. const ( /* nameser.h:228:1: */
  285. cert_t_pkix = 1
  286. cert_t_spki = 2
  287. cert_t_pgp = 3
  288. cert_t_url = 253
  289. cert_t_oid = 254
  290. )
  291. const ( /* nameser.h:28:1: */
  292. ns_s_qd = 0
  293. ns_s_zn = 0
  294. ns_s_an = 1
  295. ns_s_pr = 1
  296. ns_s_ns = 2
  297. ns_s_ud = 2
  298. ns_s_ar = 3
  299. ns_s_max = 4
  300. )
  301. const ( /* nameser.h:75:1: */
  302. ns_f_qr = 0
  303. ns_f_opcode = 1
  304. ns_f_aa = 2
  305. ns_f_tc = 3
  306. ns_f_rd = 4
  307. ns_f_ra = 5
  308. ns_f_z = 6
  309. ns_f_ad = 7
  310. ns_f_cd = 8
  311. ns_f_rcode = 9
  312. ns_f_max = 10
  313. )
  314. const ( /* nameser.h:89:1: */
  315. ns_o_query = 0
  316. ns_o_iquery = 1
  317. ns_o_status = 2
  318. ns_o_notify = 4
  319. ns_o_update = 5
  320. ns_o_max = 6
  321. )
  322. const ( /* nameser.h:98:1: */
  323. ns_r_noerror = 0
  324. ns_r_formerr = 1
  325. ns_r_servfail = 2
  326. ns_r_nxdomain = 3
  327. ns_r_notimpl = 4
  328. ns_r_refused = 5
  329. ns_r_yxdomain = 6
  330. ns_r_yxrrset = 7
  331. ns_r_nxrrset = 8
  332. ns_r_notauth = 9
  333. ns_r_notzone = 10
  334. ns_r_max = 11
  335. ns_r_badvers = 16
  336. ns_r_badsig = 16
  337. ns_r_badkey = 17
  338. ns_r_badtime = 18
  339. )
  340. const ( /* pthread_impl.h:58:1: */
  341. DT_EXITING = 0
  342. DT_JOINABLE = 1
  343. DT_DETACHED = 2
  344. )
  345. type ptrdiff_t = int32 /* <builtin>:3:26 */
  346. type size_t = uint32 /* <builtin>:9:23 */
  347. type wchar_t = uint32 /* <builtin>:15:24 */
  348. type uint16_t = uint16 /* alltypes.h:119:25 */
  349. type uint32_t = uint32 /* alltypes.h:124:25 */
  350. type uint64_t = uint64 /* alltypes.h:129:25 */
  351. func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
  352. return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24
  353. }
  354. var table = [384]uint16{
  355. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  356. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  357. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  358. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  359. uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536),
  360. uint16((0x200/256 | 0x200*256) % 65536), uint16((0x320/256 | 0x320*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536),
  361. uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536),
  362. uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536),
  363. uint16((0x160/256 | 0x160*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536),
  364. uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536),
  365. uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536),
  366. uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536),
  367. uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536),
  368. uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536),
  369. uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536),
  370. uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536),
  371. uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536),
  372. uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536),
  373. uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536),
  374. uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536),
  375. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  376. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  377. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  378. uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0),
  379. } /* __ctype_b_loc.c:9:29 */
  380. var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
  381. func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
  382. return uintptr(unsafe.Pointer(&ptable))
  383. }
  384. func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
  385. return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5))
  386. }
  387. type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:336:9 */
  388. type locale_t = uintptr /* alltypes.h:336:32 */
  389. func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
  390. return Bool32(func() int32 {
  391. if 0 != 0 {
  392. return Xisalpha(tls, c)
  393. }
  394. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  395. }() != 0 || func() int32 {
  396. if 0 != 0 {
  397. return Xisdigit(tls, c)
  398. }
  399. return Bool32(uint32(c)-uint32('0') < uint32(10))
  400. }() != 0)
  401. }
  402. func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
  403. return Xisalnum(tls, c)
  404. }
  405. func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
  406. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  407. }
  408. func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
  409. return Xisalpha(tls, c)
  410. }
  411. func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
  412. return Bool32(uint32(c)-uint32('0') < uint32(10))
  413. }
  414. func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
  415. return Xisdigit(tls, c)
  416. }
  417. func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
  418. return Bool32(uint32(c)-uint32('a') < uint32(26))
  419. }
  420. func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
  421. return Xislower(tls, c)
  422. }
  423. func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
  424. return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
  425. }
  426. func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
  427. return Xisprint(tls, c)
  428. }
  429. func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
  430. return Bool32(uint32(c)-uint32('A') < uint32(26))
  431. }
  432. func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
  433. return Xisupper(tls, c)
  434. }
  435. func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
  436. return Bool32(func() int32 {
  437. if 0 != 0 {
  438. return Xisdigit(tls, c)
  439. }
  440. return Bool32(uint32(c)-uint32('0') < uint32(10))
  441. }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6))
  442. }
  443. func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
  444. return Xisxdigit(tls, c)
  445. }
  446. type off_t = int64 /* alltypes.h:155:16 */
  447. type ino_t = uint64 /* alltypes.h:160:25 */
  448. type dirent = struct {
  449. d_ino ino_t
  450. d_off off_t
  451. d_reclen uint16
  452. d_type uint8
  453. d_name [256]uint8
  454. _ [5]byte
  455. } /* dirent.h:5:1 */
  456. type __dirstream = struct {
  457. tell off_t
  458. fd int32
  459. buf_pos int32
  460. buf_end int32
  461. lock [1]int32
  462. buf [2048]uint8
  463. } /* dirent.h:20:9 */
  464. type DIR = __dirstream /* dirent.h:20:28 */
  465. type ssize_t = int32 /* alltypes.h:58:15 */
  466. type intptr_t = int32 /* alltypes.h:63:15 */
  467. type pid_t = int32 /* alltypes.h:228:13 */
  468. type uid_t = uint32 /* alltypes.h:238:18 */
  469. type gid_t = uint32 /* alltypes.h:243:18 */
  470. type useconds_t = uint32 /* alltypes.h:253:18 */
  471. type div_t = struct {
  472. quot int32
  473. rem int32
  474. } /* stdlib.h:62:35 */
  475. type ldiv_t = struct {
  476. quot int32
  477. rem int32
  478. } /* stdlib.h:63:36 */
  479. type lldiv_t = struct {
  480. quot int64
  481. rem int64
  482. } /* stdlib.h:64:41 */
  483. func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
  484. var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
  485. Xfree(tls, dir)
  486. return ret
  487. }
  488. type mode_t = uint32 /* alltypes.h:145:18 */
  489. type iovec = struct {
  490. iov_base uintptr
  491. iov_len size_t
  492. } /* alltypes.h:348:1 */
  493. type flock = struct {
  494. l_type int16
  495. l_whence int16
  496. _ [4]byte
  497. l_start off_t
  498. l_len off_t
  499. l_pid pid_t
  500. _ [4]byte
  501. } /* fcntl.h:24:1 */
  502. type file_handle = struct {
  503. _ [0]uint32
  504. handle_bytes uint32
  505. handle_type int32
  506. } /* fcntl.h:167:1 */
  507. type f_owner_ex = struct {
  508. __type int32
  509. pid pid_t
  510. } /* fcntl.h:172:1 */
  511. type syscall_arg_t = int32 /* syscall.h:22:14 */
  512. func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
  513. var fd int32
  514. var dir uintptr
  515. if AssignInt32(&fd, Xopen(tls, name, 00|040000|02000000, 0)) < 0 {
  516. return uintptr(0)
  517. }
  518. if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint32(1), uint32(unsafe.Sizeof(DIR{}))))) != 0) {
  519. X__syscall1(tls, 6, int32(fd))
  520. return uintptr(0)
  521. }
  522. (*DIR)(unsafe.Pointer(dir)).fd = fd
  523. return dir
  524. }
  525. type max_align_t = struct {
  526. __ll int64
  527. __ld float64
  528. } /* alltypes.h:34:54 */
  529. type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
  530. func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
  531. var de uintptr
  532. if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
  533. var len int32 = int32(X__syscall3(tls, 217, int32((*DIR)(unsafe.Pointer(dir)).fd), int32(dir+24), int32(unsafe.Sizeof([2048]uint8{}))))
  534. if len <= 0 {
  535. if len < 0 && len != -2 {
  536. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = -len
  537. }
  538. return uintptr(0)
  539. }
  540. (*DIR)(unsafe.Pointer(dir)).buf_end = len
  541. (*DIR)(unsafe.Pointer(dir)).buf_pos = 0
  542. }
  543. de = dir + 24 + uintptr((*DIR)(unsafe.Pointer(dir)).buf_pos)
  544. *(*int32)(unsafe.Pointer(dir + 12)) += int32((*dirent)(unsafe.Pointer(de)).d_reclen)
  545. (*DIR)(unsafe.Pointer(dir)).tell = (*dirent)(unsafe.Pointer(de)).d_off
  546. return de
  547. }
  548. type uintptr_t = uint32 /* alltypes.h:48:24 */
  549. type int8_t = int8 /* alltypes.h:89:25 */
  550. type int16_t = int16 /* alltypes.h:94:25 */
  551. type int32_t = int32 /* alltypes.h:99:25 */
  552. type int64_t = int64 /* alltypes.h:104:25 */
  553. type intmax_t = int64 /* alltypes.h:109:25 */
  554. type uint8_t = uint8 /* alltypes.h:114:25 */
  555. type uintmax_t = uint64 /* alltypes.h:139:25 */
  556. type int_fast8_t = int8_t /* stdint.h:22:16 */
  557. type int_fast64_t = int64_t /* stdint.h:23:17 */
  558. type int_least8_t = int8_t /* stdint.h:25:17 */
  559. type int_least16_t = int16_t /* stdint.h:26:17 */
  560. type int_least32_t = int32_t /* stdint.h:27:17 */
  561. type int_least64_t = int64_t /* stdint.h:28:17 */
  562. type uint_fast8_t = uint8_t /* stdint.h:30:17 */
  563. type uint_fast64_t = uint64_t /* stdint.h:31:18 */
  564. type uint_least8_t = uint8_t /* stdint.h:33:18 */
  565. type uint_least16_t = uint16_t /* stdint.h:34:18 */
  566. type uint_least32_t = uint32_t /* stdint.h:35:18 */
  567. type uint_least64_t = uint64_t /* stdint.h:36:18 */
  568. type int_fast16_t = int32_t /* stdint.h:1:17 */
  569. type int_fast32_t = int32_t /* stdint.h:2:17 */
  570. type uint_fast16_t = uint32_t /* stdint.h:3:18 */
  571. type uint_fast32_t = uint32_t /* stdint.h:4:18 */
  572. type _IO_FILE = struct {
  573. flags uint32
  574. rpos uintptr
  575. rend uintptr
  576. close uintptr
  577. wend uintptr
  578. wpos uintptr
  579. mustbezero_1 uintptr
  580. wbase uintptr
  581. read uintptr
  582. write uintptr
  583. seek uintptr
  584. buf uintptr
  585. buf_size size_t
  586. prev uintptr
  587. next uintptr
  588. fd int32
  589. pipe_pid int32
  590. lockcount int32
  591. mode int32
  592. lock int32
  593. lbf int32
  594. cookie uintptr
  595. off off_t
  596. getln_buf uintptr
  597. mustbezero_2 uintptr
  598. shend uintptr
  599. _ [4]byte
  600. shlim off_t
  601. shcnt off_t
  602. prev_locked uintptr
  603. next_locked uintptr
  604. locale uintptr
  605. _ [4]byte
  606. } /* alltypes.h:313:9 */
  607. type FILE = _IO_FILE /* alltypes.h:313:25 */
  608. type va_list = uintptr /* alltypes.h:319:27 */
  609. type _G_fpos64_t = struct {
  610. _ [0]uint64
  611. __opaque [16]uint8
  612. } /* stdio.h:54:9 */
  613. type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
  614. type float_t = float32 /* alltypes.h:23:15 */
  615. type double_t = float64 /* alltypes.h:28:16 */
  616. func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */
  617. bp := tls.Alloc(4)
  618. defer tls.Free(4)
  619. // var __u struct {__f float32;} at bp, 4
  620. *(*float32)(unsafe.Pointer(bp)) = __f
  621. return *(*uint32)(unsafe.Pointer(bp))
  622. }
  623. func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */
  624. bp := tls.Alloc(8)
  625. defer tls.Free(8)
  626. // var __u struct {__f float64;} at bp, 8
  627. *(*float64)(unsafe.Pointer(bp)) = __f
  628. return *(*uint64)(unsafe.Pointer(bp))
  629. }
  630. type __pthread = struct {
  631. self uintptr
  632. dtv uintptr
  633. prev uintptr
  634. next uintptr
  635. sysinfo uintptr_t
  636. canary uintptr_t
  637. canary2 uintptr_t
  638. tid int32
  639. errno_val int32
  640. detach_state int32
  641. cancel int32
  642. canceldisable uint8
  643. cancelasync uint8
  644. tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */
  645. _ [1]byte
  646. map_base uintptr
  647. map_size size_t
  648. stack uintptr
  649. stack_size size_t
  650. guard_size size_t
  651. result uintptr
  652. cancelbuf uintptr
  653. tsd uintptr
  654. robust_list struct {
  655. head uintptr
  656. off int32
  657. pending uintptr
  658. }
  659. timer_id int32
  660. locale locale_t
  661. killlock [1]int32
  662. dlerror_buf uintptr
  663. stdio_locks uintptr
  664. canary_at_end uintptr_t
  665. dtv_copy uintptr
  666. } /* alltypes.h:266:9 */
  667. func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */
  668. var c int32
  669. var x int32
  670. var y int64
  671. var neg int32 = 0
  672. c = func() int32 {
  673. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  674. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  675. }
  676. return X__shgetc(tls, f)
  677. }()
  678. if c == '+' || c == '-' {
  679. neg = Bool32(c == '-')
  680. c = func() int32 {
  681. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  682. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  683. }
  684. return X__shgetc(tls, f)
  685. }()
  686. if uint32(c-'0') >= 10 && pok != 0 {
  687. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  688. (*FILE)(unsafe.Pointer(f)).rpos--
  689. } else {
  690. }
  691. }
  692. }
  693. if uint32(c-'0') >= 10 {
  694. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  695. (*FILE)(unsafe.Pointer(f)).rpos--
  696. } else {
  697. }
  698. return -0x7fffffffffffffff - int64(1)
  699. }
  700. for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 {
  701. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  702. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  703. }
  704. return X__shgetc(tls, f)
  705. }() {
  706. x = 10*x + c - '0'
  707. }
  708. for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 {
  709. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  710. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  711. }
  712. return X__shgetc(tls, f)
  713. }() {
  714. y = int64(10)*y + int64(c) - int64('0')
  715. }
  716. for ; uint32(c-'0') < 10; c = func() int32 {
  717. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  718. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  719. }
  720. return X__shgetc(tls, f)
  721. }() {
  722. }
  723. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  724. (*FILE)(unsafe.Pointer(f)).rpos--
  725. } else {
  726. }
  727. if neg != 0 {
  728. return -y
  729. }
  730. return y
  731. }
  732. func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */
  733. bp := tls.Alloc(512)
  734. defer tls.Free(512)
  735. // var x [128]uint32_t at bp, 512
  736. var i int32
  737. var j int32
  738. var k int32
  739. var a int32
  740. var z int32
  741. var lrp int64 = int64(0)
  742. var dc int64 = int64(0)
  743. var e10 int64 = int64(0)
  744. var lnz int32 = 0
  745. var gotdig int32 = 0
  746. var gotrad int32 = 0
  747. var rp int32
  748. var e2 int32
  749. var emax int32 = -emin - bits + 3
  750. var denormal int32 = 0
  751. var y float64
  752. var frac float64 = float64(0)
  753. var bias float64 = float64(0)
  754. j = 0
  755. k = 0
  756. // Don't let leading zeros consume buffer space
  757. for ; c == '0'; c = func() int32 {
  758. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  759. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  760. }
  761. return X__shgetc(tls, f)
  762. }() {
  763. gotdig = 1
  764. }
  765. if c == '.' {
  766. gotrad = 1
  767. for c = func() int32 {
  768. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  769. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  770. }
  771. return X__shgetc(tls, f)
  772. }(); c == '0'; c = func() int32 {
  773. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  774. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  775. }
  776. return X__shgetc(tls, f)
  777. }() {
  778. gotdig = 1
  779. lrp--
  780. }
  781. }
  782. *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0)
  783. for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 {
  784. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  785. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  786. }
  787. return X__shgetc(tls, f)
  788. }() {
  789. if c == '.' {
  790. if gotrad != 0 {
  791. break
  792. }
  793. gotrad = 1
  794. lrp = dc
  795. } else if k < 128-3 {
  796. dc++
  797. if c != '0' {
  798. lnz = int32(dc)
  799. }
  800. if j != 0 {
  801. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))*uint32_t(10) + uint32_t(c) - uint32_t('0')
  802. } else {
  803. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0')
  804. }
  805. if PreIncInt32(&j, 1) == 9 {
  806. k++
  807. j = 0
  808. }
  809. gotdig = 1
  810. } else {
  811. dc++
  812. if c != '0' {
  813. lnz = (128 - 4) * 9
  814. *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1)
  815. }
  816. }
  817. }
  818. if !(gotrad != 0) {
  819. lrp = dc
  820. }
  821. if gotdig != 0 && c|32 == 'e' {
  822. e10 = scanexp(tls, f, pok)
  823. if e10 == -0x7fffffffffffffff-int64(1) {
  824. if pok != 0 {
  825. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  826. (*FILE)(unsafe.Pointer(f)).rpos--
  827. } else {
  828. }
  829. } else {
  830. X__shlim(tls, f, int64(0))
  831. return float64(0)
  832. }
  833. e10 = int64(0)
  834. }
  835. lrp = lrp + e10
  836. } else if c >= 0 {
  837. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  838. (*FILE)(unsafe.Pointer(f)).rpos--
  839. } else {
  840. }
  841. }
  842. if !(gotdig != 0) {
  843. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  844. X__shlim(tls, f, int64(0))
  845. return float64(0)
  846. }
  847. // Handle zero specially to avoid nasty special cases later
  848. if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) {
  849. return float64(sign) * 0.0
  850. }
  851. // Optimize small integers (w/no exponent) and over/under-flow
  852. if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) {
  853. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  854. }
  855. if lrp > int64(-emin/2) {
  856. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  857. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  858. }
  859. if lrp < int64(emin-2*53) {
  860. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  861. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  862. }
  863. // Align incomplete final B1B digit
  864. if j != 0 {
  865. for ; j < 9; j++ {
  866. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10)
  867. }
  868. k++
  869. j = 0
  870. }
  871. a = 0
  872. z = k
  873. e2 = 0
  874. rp = int32(lrp)
  875. // Optimize small to mid-size integers (even in exp. notation)
  876. if lnz < 9 && lnz <= rp && rp < 18 {
  877. if rp == 9 {
  878. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  879. }
  880. if rp < 9 {
  881. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp])
  882. }
  883. var bitlim int32 = bits - 3*(rp-9)
  884. if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) {
  885. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10])
  886. }
  887. }
  888. // Drop trailing zeros
  889. for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- {
  890. }
  891. // Align radix point to B1B digit boundary
  892. if rp%9 != 0 {
  893. var rpm9 int32
  894. if rp >= 0 {
  895. rpm9 = rp % 9
  896. } else {
  897. rpm9 = rp%9 + 9
  898. }
  899. var p10 int32 = _sp10s[8-rpm9]
  900. var carry uint32_t = uint32_t(0)
  901. for k = a; k != z; k++ {
  902. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10)
  903. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry
  904. carry = uint32_t(1000000000/p10) * tmp
  905. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  906. a = (a + 1) & (128 - 1)
  907. rp = rp - 9
  908. }
  909. }
  910. if carry != 0 {
  911. *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry
  912. }
  913. rp = rp + (9 - rpm9)
  914. }
  915. // Upscale until desired number of bits are left of radix point
  916. for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] {
  917. var carry uint32_t = uint32_t(0)
  918. e2 = e2 - 29
  919. for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) {
  920. var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry)
  921. if tmp > uint64(1000000000) {
  922. carry = uint32_t(tmp / uint64(1000000000))
  923. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000))
  924. } else {
  925. carry = uint32_t(0)
  926. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp)
  927. }
  928. if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  929. z = k
  930. }
  931. if k == a {
  932. break
  933. }
  934. }
  935. if carry != 0 {
  936. rp = rp + 9
  937. a = (a - 1) & (128 - 1)
  938. if a == z {
  939. z = (z - 1) & (128 - 1)
  940. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4))
  941. }
  942. *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry
  943. }
  944. }
  945. // Downscale until exactly number of bits are left of radix point
  946. for {
  947. var carry uint32_t = uint32_t(0)
  948. var sh int32 = 1
  949. for i = 0; i < 2; i++ {
  950. k = (a + i) & (128 - 1)
  951. if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] {
  952. i = 2
  953. break
  954. }
  955. if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] {
  956. break
  957. }
  958. }
  959. if i == 2 && rp == 9*2 {
  960. break
  961. }
  962. // FIXME: find a way to compute optimal sh
  963. if rp > 9+9*2 {
  964. sh = 9
  965. }
  966. e2 = e2 + sh
  967. for k = a; k != z; k = (k + 1) & (128 - 1) {
  968. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1)
  969. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry
  970. carry = uint32_t(int32(1000000000)>>sh) * tmp
  971. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  972. a = (a + 1) & (128 - 1)
  973. i--
  974. rp = rp - 9
  975. }
  976. }
  977. if carry != 0 {
  978. if (z+1)&(128-1) != a {
  979. *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry
  980. z = (z + 1) & (128 - 1)
  981. } else {
  982. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1)
  983. }
  984. }
  985. }
  986. // Assemble desired bits into floating point variable
  987. for y = float64(AssignInt32(&i, 0)); i < 2; i++ {
  988. if (a+i)&(128-1) == z {
  989. *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0)
  990. }
  991. y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)))
  992. }
  993. y = y * float64(sign)
  994. // Limit precision for denormal results
  995. if bits > 53+e2-emin {
  996. bits = 53 + e2 - emin
  997. if bits < 0 {
  998. bits = 0
  999. }
  1000. denormal = 1
  1001. }
  1002. // Calculate bias term to force rounding, move out lower bits
  1003. if bits < 53 {
  1004. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y)
  1005. frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits))
  1006. y = y - frac
  1007. y = y + bias
  1008. }
  1009. // Process tail of decimal input so it can affect rounding
  1010. if (a+i)&(128-1) != z {
  1011. var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))
  1012. if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) {
  1013. frac = frac + 0.25*float64(sign)
  1014. } else if t > uint32_t(500000000) {
  1015. frac = frac + 0.75*float64(sign)
  1016. } else if t == uint32_t(500000000) {
  1017. if (a+i+1)&(128-1) == z {
  1018. frac = frac + 0.5*float64(sign)
  1019. } else {
  1020. frac = frac + 0.75*float64(sign)
  1021. }
  1022. }
  1023. if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) {
  1024. frac += 1
  1025. }
  1026. }
  1027. y = y + frac
  1028. y = y - bias
  1029. if (e2+53)&0x7fffffff > emax-5 {
  1030. if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 {
  1031. if denormal != 0 && bits == 53+e2-emin {
  1032. denormal = 0
  1033. }
  1034. y = y * 0.5
  1035. e2++
  1036. }
  1037. if e2+53 > emax || denormal != 0 && frac != 0 {
  1038. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1039. }
  1040. }
  1041. return Xscalbnl(tls, y, e2)
  1042. }
  1043. var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */
  1044. var _sp10s = [8]int32{10, 100, 1000, 10000,
  1045. 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */
  1046. func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */
  1047. var x uint32_t = uint32_t(0)
  1048. var y float64 = float64(0)
  1049. var scale float64 = float64(1)
  1050. var bias float64 = float64(0)
  1051. var gottail int32 = 0
  1052. var gotrad int32 = 0
  1053. var gotdig int32 = 0
  1054. var rp int64 = int64(0)
  1055. var dc int64 = int64(0)
  1056. var e2 int64 = int64(0)
  1057. var d int32
  1058. var c int32
  1059. c = func() int32 {
  1060. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1061. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1062. }
  1063. return X__shgetc(tls, f)
  1064. }()
  1065. // Skip leading zeros
  1066. for ; c == '0'; c = func() int32 {
  1067. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1068. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1069. }
  1070. return X__shgetc(tls, f)
  1071. }() {
  1072. gotdig = 1
  1073. }
  1074. if c == '.' {
  1075. gotrad = 1
  1076. c = func() int32 {
  1077. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1078. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1079. }
  1080. return X__shgetc(tls, f)
  1081. }()
  1082. // Count zeros after the radix point before significand
  1083. rp = int64(0)
  1084. __1:
  1085. if !(c == '0') {
  1086. goto __3
  1087. }
  1088. gotdig = 1
  1089. goto __2
  1090. __2:
  1091. c = func() int32 {
  1092. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1093. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1094. }
  1095. return X__shgetc(tls, f)
  1096. }()
  1097. rp--
  1098. goto __1
  1099. goto __3
  1100. __3:
  1101. }
  1102. for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 {
  1103. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1104. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1105. }
  1106. return X__shgetc(tls, f)
  1107. }() {
  1108. if c == '.' {
  1109. if gotrad != 0 {
  1110. break
  1111. }
  1112. rp = dc
  1113. gotrad = 1
  1114. } else {
  1115. gotdig = 1
  1116. if c > '9' {
  1117. d = c | 32 + 10 - 'a'
  1118. } else {
  1119. d = c - '0'
  1120. }
  1121. if dc < int64(8) {
  1122. x = x*uint32_t(16) + uint32_t(d)
  1123. } else if dc < int64(53/4+1) {
  1124. y = y + float64(d)*AssignDivFloat64(&scale, float64(16))
  1125. } else if d != 0 && !(gottail != 0) {
  1126. y = y + 0.5*scale
  1127. gottail = 1
  1128. }
  1129. dc++
  1130. }
  1131. }
  1132. if !(gotdig != 0) {
  1133. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1134. (*FILE)(unsafe.Pointer(f)).rpos--
  1135. } else {
  1136. }
  1137. if pok != 0 {
  1138. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1139. (*FILE)(unsafe.Pointer(f)).rpos--
  1140. } else {
  1141. }
  1142. if gotrad != 0 {
  1143. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1144. (*FILE)(unsafe.Pointer(f)).rpos--
  1145. } else {
  1146. }
  1147. }
  1148. } else {
  1149. X__shlim(tls, f, int64(0))
  1150. }
  1151. return float64(sign) * 0.0
  1152. }
  1153. if !(gotrad != 0) {
  1154. rp = dc
  1155. }
  1156. for dc < int64(8) {
  1157. x = x * uint32_t(16)
  1158. dc++
  1159. }
  1160. if c|32 == 'p' {
  1161. e2 = scanexp(tls, f, pok)
  1162. if e2 == -0x7fffffffffffffff-int64(1) {
  1163. if pok != 0 {
  1164. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1165. (*FILE)(unsafe.Pointer(f)).rpos--
  1166. } else {
  1167. }
  1168. } else {
  1169. X__shlim(tls, f, int64(0))
  1170. return float64(0)
  1171. }
  1172. e2 = int64(0)
  1173. }
  1174. } else {
  1175. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1176. (*FILE)(unsafe.Pointer(f)).rpos--
  1177. } else {
  1178. }
  1179. }
  1180. e2 = e2 + (int64(4)*rp - int64(32))
  1181. if !(x != 0) {
  1182. return float64(sign) * 0.0
  1183. }
  1184. if e2 > int64(-emin) {
  1185. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1186. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  1187. }
  1188. if e2 < int64(emin-2*53) {
  1189. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1190. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  1191. }
  1192. for x < 0x80000000 {
  1193. if y >= 0.5 {
  1194. x = x + (x + uint32_t(1))
  1195. y = y + (y - float64(1))
  1196. } else {
  1197. x = x + x
  1198. y = y + y
  1199. }
  1200. e2--
  1201. }
  1202. if int64(bits) > int64(32)+e2-int64(emin) {
  1203. bits = int32(int64(32) + e2 - int64(emin))
  1204. if bits < 0 {
  1205. bits = 0
  1206. }
  1207. }
  1208. if bits < 53 {
  1209. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign))
  1210. }
  1211. if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) {
  1212. x++
  1213. y = float64(0)
  1214. }
  1215. y = bias + float64(sign)*float64(x) + float64(sign)*y
  1216. y = y - bias
  1217. if !(y != 0) {
  1218. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1219. }
  1220. return Xscalbnl(tls, y, int32(e2))
  1221. }
  1222. func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
  1223. var sign int32 = 1
  1224. var i size_t
  1225. var bits int32
  1226. var emin int32
  1227. var c int32
  1228. switch prec {
  1229. case 0:
  1230. bits = 24
  1231. emin = -125 - bits
  1232. break
  1233. case 1:
  1234. bits = 53
  1235. emin = -1021 - bits
  1236. break
  1237. case 2:
  1238. bits = 53
  1239. emin = -1021 - bits
  1240. break
  1241. default:
  1242. return float64(0)
  1243. }
  1244. for __isspace(tls, AssignInt32(&c, func() int32 {
  1245. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1246. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1247. }
  1248. return X__shgetc(tls, f)
  1249. }())) != 0 {
  1250. }
  1251. if c == '+' || c == '-' {
  1252. sign = sign - 2*Bool32(c == '-')
  1253. c = func() int32 {
  1254. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1255. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1256. }
  1257. return X__shgetc(tls, f)
  1258. }()
  1259. }
  1260. for i = size_t(0); i < size_t(8) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ {
  1261. if i < size_t(7) {
  1262. c = func() int32 {
  1263. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1264. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1265. }
  1266. return X__shgetc(tls, f)
  1267. }()
  1268. }
  1269. }
  1270. if i == size_t(3) || i == size_t(8) || i > size_t(3) && pok != 0 {
  1271. if i != size_t(8) {
  1272. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1273. (*FILE)(unsafe.Pointer(f)).rpos--
  1274. } else {
  1275. }
  1276. if pok != 0 {
  1277. for ; i > size_t(3); i-- {
  1278. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1279. (*FILE)(unsafe.Pointer(f)).rpos--
  1280. } else {
  1281. }
  1282. }
  1283. }
  1284. }
  1285. return float64(float32(sign) * X__builtin_inff(tls))
  1286. }
  1287. if !(i != 0) {
  1288. for i = size_t(0); i < size_t(3) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ {
  1289. if i < size_t(2) {
  1290. c = func() int32 {
  1291. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1292. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1293. }
  1294. return X__shgetc(tls, f)
  1295. }()
  1296. }
  1297. }
  1298. }
  1299. if i == size_t(3) {
  1300. if func() int32 {
  1301. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1302. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1303. }
  1304. return X__shgetc(tls, f)
  1305. }() != '(' {
  1306. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1307. (*FILE)(unsafe.Pointer(f)).rpos--
  1308. } else {
  1309. }
  1310. return float64(X__builtin_nanf(tls, ts+13))
  1311. }
  1312. for i = size_t(1); ; i++ {
  1313. c = func() int32 {
  1314. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1315. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1316. }
  1317. return X__shgetc(tls, f)
  1318. }()
  1319. if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' {
  1320. continue
  1321. }
  1322. if c == ')' {
  1323. return float64(X__builtin_nanf(tls, ts+13))
  1324. }
  1325. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1326. (*FILE)(unsafe.Pointer(f)).rpos--
  1327. } else {
  1328. }
  1329. if !(pok != 0) {
  1330. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  1331. X__shlim(tls, f, int64(0))
  1332. return float64(0)
  1333. }
  1334. for PostDecUint32(&i, 1) != 0 {
  1335. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1336. (*FILE)(unsafe.Pointer(f)).rpos--
  1337. } else {
  1338. }
  1339. }
  1340. return float64(X__builtin_nanf(tls, ts+13))
  1341. }
  1342. return float64(X__builtin_nanf(tls, ts+13))
  1343. }
  1344. if i != 0 {
  1345. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1346. (*FILE)(unsafe.Pointer(f)).rpos--
  1347. } else {
  1348. }
  1349. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  1350. X__shlim(tls, f, int64(0))
  1351. return float64(0)
  1352. }
  1353. if c == '0' {
  1354. c = func() int32 {
  1355. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1356. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1357. }
  1358. return X__shgetc(tls, f)
  1359. }()
  1360. if c|32 == 'x' {
  1361. return hexfloat(tls, f, bits, emin, sign, pok)
  1362. }
  1363. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1364. (*FILE)(unsafe.Pointer(f)).rpos--
  1365. } else {
  1366. }
  1367. c = '0'
  1368. }
  1369. return decfloat(tls, f, c, bits, emin, sign, pok)
  1370. }
  1371. // Lookup table for digit values. -1==255>=36 -> invalid
  1372. var table1 = [257]uint8{Uint8FromInt32(-1),
  1373. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1374. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1375. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1376. uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1377. Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
  1378. uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1379. Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
  1380. uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1381. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1382. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1383. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1384. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1385. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1386. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1387. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1388. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  1389. } /* intscan.c:7:28 */
  1390. func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
  1391. var val uintptr
  1392. var c int32
  1393. var neg int32
  1394. var x uint32
  1395. var y uint64
  1396. var bs int32
  1397. val = uintptr(unsafe.Pointer(&table1)) + uintptr(1)
  1398. neg = 0
  1399. if !(base > uint32(36) || base == uint32(1)) {
  1400. goto __1
  1401. }
  1402. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  1403. return uint64(0)
  1404. __1:
  1405. ;
  1406. __2:
  1407. if !(__isspace(tls, AssignInt32(&c, func() int32 {
  1408. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1409. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1410. }
  1411. return X__shgetc(tls, f)
  1412. }())) != 0) {
  1413. goto __3
  1414. }
  1415. goto __2
  1416. __3:
  1417. ;
  1418. if !(c == '+' || c == '-') {
  1419. goto __4
  1420. }
  1421. neg = -Bool32(c == '-')
  1422. c = func() int32 {
  1423. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1424. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1425. }
  1426. return X__shgetc(tls, f)
  1427. }()
  1428. __4:
  1429. ;
  1430. if !((base == uint32(0) || base == uint32(16)) && c == '0') {
  1431. goto __5
  1432. }
  1433. c = func() int32 {
  1434. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1435. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1436. }
  1437. return X__shgetc(tls, f)
  1438. }()
  1439. if !(c|32 == 'x') {
  1440. goto __7
  1441. }
  1442. c = func() int32 {
  1443. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1444. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1445. }
  1446. return X__shgetc(tls, f)
  1447. }()
  1448. if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) {
  1449. goto __9
  1450. }
  1451. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1452. (*FILE)(unsafe.Pointer(f)).rpos--
  1453. } else {
  1454. }
  1455. if !(pok != 0) {
  1456. goto __10
  1457. }
  1458. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1459. (*FILE)(unsafe.Pointer(f)).rpos--
  1460. } else {
  1461. }
  1462. goto __11
  1463. __10:
  1464. X__shlim(tls, f, int64(0))
  1465. __11:
  1466. ;
  1467. return uint64(0)
  1468. __9:
  1469. ;
  1470. base = uint32(16)
  1471. goto __8
  1472. __7:
  1473. if !(base == uint32(0)) {
  1474. goto __12
  1475. }
  1476. base = uint32(8)
  1477. __12:
  1478. ;
  1479. __8:
  1480. ;
  1481. goto __6
  1482. __5:
  1483. if !(base == uint32(0)) {
  1484. goto __13
  1485. }
  1486. base = uint32(10)
  1487. __13:
  1488. ;
  1489. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) {
  1490. goto __14
  1491. }
  1492. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1493. (*FILE)(unsafe.Pointer(f)).rpos--
  1494. } else {
  1495. }
  1496. X__shlim(tls, f, int64(0))
  1497. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  1498. return uint64(0)
  1499. __14:
  1500. ;
  1501. __6:
  1502. ;
  1503. if !(base == uint32(10)) {
  1504. goto __15
  1505. }
  1506. x = uint32(0)
  1507. __17:
  1508. if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) {
  1509. goto __19
  1510. }
  1511. x = x*uint32(10) + uint32(c-'0')
  1512. goto __18
  1513. __18:
  1514. c = func() int32 {
  1515. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1516. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1517. }
  1518. return X__shgetc(tls, f)
  1519. }()
  1520. goto __17
  1521. goto __19
  1522. __19:
  1523. ;
  1524. y = uint64(x)
  1525. __20:
  1526. if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) {
  1527. goto __22
  1528. }
  1529. y = y*uint64(10) + uint64(c-'0')
  1530. goto __21
  1531. __21:
  1532. c = func() int32 {
  1533. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1534. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1535. }
  1536. return X__shgetc(tls, f)
  1537. }()
  1538. goto __20
  1539. goto __22
  1540. __22:
  1541. ;
  1542. if !(uint32(c-'0') >= 10) {
  1543. goto __23
  1544. }
  1545. goto done
  1546. __23:
  1547. ;
  1548. goto __16
  1549. __15:
  1550. if !!(base&(base-uint32(1)) != 0) {
  1551. goto __24
  1552. }
  1553. bs = int32(*(*uint8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7)))))
  1554. x = uint32(0)
  1555. __26:
  1556. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) {
  1557. goto __28
  1558. }
  1559. x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  1560. goto __27
  1561. __27:
  1562. c = func() int32 {
  1563. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1564. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1565. }
  1566. return X__shgetc(tls, f)
  1567. }()
  1568. goto __26
  1569. goto __28
  1570. __28:
  1571. ;
  1572. y = uint64(x)
  1573. __29:
  1574. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) {
  1575. goto __31
  1576. }
  1577. y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  1578. goto __30
  1579. __30:
  1580. c = func() int32 {
  1581. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1582. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1583. }
  1584. return X__shgetc(tls, f)
  1585. }()
  1586. goto __29
  1587. goto __31
  1588. __31:
  1589. ;
  1590. goto __25
  1591. __24:
  1592. x = uint32(0)
  1593. __32:
  1594. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) {
  1595. goto __34
  1596. }
  1597. x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  1598. goto __33
  1599. __33:
  1600. c = func() int32 {
  1601. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1602. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1603. }
  1604. return X__shgetc(tls, f)
  1605. }()
  1606. goto __32
  1607. goto __34
  1608. __34:
  1609. ;
  1610. y = uint64(x)
  1611. __35:
  1612. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(base) && uint64(base)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) {
  1613. goto __37
  1614. }
  1615. y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  1616. goto __36
  1617. __36:
  1618. c = func() int32 {
  1619. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1620. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1621. }
  1622. return X__shgetc(tls, f)
  1623. }()
  1624. goto __35
  1625. goto __37
  1626. __37:
  1627. ;
  1628. __25:
  1629. ;
  1630. __16:
  1631. ;
  1632. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  1633. goto __38
  1634. }
  1635. __39:
  1636. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  1637. goto __41
  1638. }
  1639. goto __40
  1640. __40:
  1641. c = func() int32 {
  1642. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  1643. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  1644. }
  1645. return X__shgetc(tls, f)
  1646. }()
  1647. goto __39
  1648. goto __41
  1649. __41:
  1650. ;
  1651. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1652. y = lim
  1653. if !(lim&uint64(1) != 0) {
  1654. goto __42
  1655. }
  1656. neg = 0
  1657. __42:
  1658. ;
  1659. __38:
  1660. ;
  1661. done:
  1662. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  1663. (*FILE)(unsafe.Pointer(f)).rpos--
  1664. } else {
  1665. }
  1666. if !(y >= lim) {
  1667. goto __43
  1668. }
  1669. if !(!(lim&uint64(1) != 0) && !(neg != 0)) {
  1670. goto __44
  1671. }
  1672. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1673. return lim - uint64(1)
  1674. goto __45
  1675. __44:
  1676. if !(y > lim) {
  1677. goto __46
  1678. }
  1679. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  1680. return lim
  1681. __46:
  1682. ;
  1683. __45:
  1684. ;
  1685. __43:
  1686. ;
  1687. return y ^ uint64(neg) - uint64(neg)
  1688. }
  1689. // The shcnt field stores the number of bytes read so far, offset by
  1690. // the value of buf-rpos at the last function call (__shlim or __shgetc),
  1691. // so that between calls the inline shcnt macro can add rpos-buf to get
  1692. // the actual count.
  1693. func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
  1694. (*FILE)(unsafe.Pointer(f)).shlim = lim
  1695. (*FILE)(unsafe.Pointer(f)).shcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).buf) - int32((*FILE)(unsafe.Pointer(f)).rpos)) / 1)
  1696. // If lim is nonzero, rend must be a valid pointer.
  1697. if lim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).rend)-int32((*FILE)(unsafe.Pointer(f)).rpos))/1) > lim {
  1698. (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr(lim)
  1699. } else {
  1700. (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend
  1701. }
  1702. }
  1703. func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
  1704. var c int32
  1705. var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1)
  1706. if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
  1707. (*FILE)(unsafe.Pointer(f)).shcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).buf)-int32((*FILE)(unsafe.Pointer(f)).rpos))/1) + cnt
  1708. (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos
  1709. (*FILE)(unsafe.Pointer(f)).shlim = int64(-1)
  1710. return -1
  1711. }
  1712. cnt++
  1713. if (*FILE)(unsafe.Pointer(f)).shlim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).rend)-int32((*FILE)(unsafe.Pointer(f)).rpos))/1) > (*FILE)(unsafe.Pointer(f)).shlim-cnt {
  1714. (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr((*FILE)(unsafe.Pointer(f)).shlim-cnt)
  1715. } else {
  1716. (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend
  1717. }
  1718. (*FILE)(unsafe.Pointer(f)).shcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).buf)-int32((*FILE)(unsafe.Pointer(f)).rpos))/1) + cnt
  1719. if (*FILE)(unsafe.Pointer(f)).rpos <= (*FILE)(unsafe.Pointer(f)).buf {
  1720. *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c)
  1721. }
  1722. return c
  1723. }
  1724. type lconv = struct {
  1725. decimal_point uintptr
  1726. thousands_sep uintptr
  1727. grouping uintptr
  1728. int_curr_symbol uintptr
  1729. currency_symbol uintptr
  1730. mon_decimal_point uintptr
  1731. mon_thousands_sep uintptr
  1732. mon_grouping uintptr
  1733. positive_sign uintptr
  1734. negative_sign uintptr
  1735. int_frac_digits uint8
  1736. frac_digits uint8
  1737. p_cs_precedes uint8
  1738. p_sep_by_space uint8
  1739. n_cs_precedes uint8
  1740. n_sep_by_space uint8
  1741. p_sign_posn uint8
  1742. n_sign_posn uint8
  1743. int_p_cs_precedes uint8
  1744. int_p_sep_by_space uint8
  1745. int_n_cs_precedes uint8
  1746. int_n_sep_by_space uint8
  1747. int_p_sign_posn uint8
  1748. int_n_sign_posn uint8
  1749. _ [2]byte
  1750. } /* locale.h:24:1 */
  1751. // Support signed or unsigned plain-char
  1752. // Implementation choices...
  1753. // Arbitrary numbers...
  1754. // POSIX/SUS requirements follow. These numbers come directly
  1755. // from SUS and have nothing to do with the host system.
  1756. var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
  1757. func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
  1758. return uintptr(unsafe.Pointer(&posix_lconv))
  1759. }
  1760. func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
  1761. bp := tls.Alloc(8)
  1762. defer tls.Free(8)
  1763. *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) {
  1764. *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
  1765. return r
  1766. }()
  1767. var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
  1768. if !(e != 0) {
  1769. if *(*uint64_t)(unsafe.Pointer(bp))<<1 != 0 {
  1770. return 3
  1771. }
  1772. return 2
  1773. }
  1774. if e == 0x7ff {
  1775. if *(*uint64_t)(unsafe.Pointer(bp))<<12 != 0 {
  1776. return 0
  1777. }
  1778. return 1
  1779. }
  1780. return 4
  1781. }
  1782. func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
  1783. bp := tls.Alloc(4)
  1784. defer tls.Free(4)
  1785. *(*struct{ f float32 })(unsafe.Pointer(bp)) = func() (r struct{ f float32 }) {
  1786. *(*float32)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
  1787. return r
  1788. }()
  1789. var e int32 = int32(*(*uint32_t)(unsafe.Pointer(bp)) >> 23 & uint32_t(0xff))
  1790. if !(e != 0) {
  1791. if *(*uint32_t)(unsafe.Pointer(bp))<<1 != 0 {
  1792. return 3
  1793. }
  1794. return 2
  1795. }
  1796. if e == 0xff {
  1797. if *(*uint32_t)(unsafe.Pointer(bp))<<9 != 0 {
  1798. return 0
  1799. }
  1800. return 1
  1801. }
  1802. return 4
  1803. }
  1804. func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
  1805. return X__fpclassify(tls, x)
  1806. }
  1807. func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
  1808. return Xcopysign(tls, x, y)
  1809. }
  1810. func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
  1811. return Xfabs(tls, x)
  1812. }
  1813. func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
  1814. return Xfmod(tls, x, y)
  1815. }
  1816. func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
  1817. return X__builtin_nanf(tls, ts+13)
  1818. }
  1819. var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
  1820. func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
  1821. bp := tls.Alloc(8)
  1822. defer tls.Free(8)
  1823. *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) {
  1824. *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
  1825. return r
  1826. }()
  1827. var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
  1828. var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63)
  1829. var y double_t
  1830. if e >= 0x3ff+52 {
  1831. return x
  1832. }
  1833. if s != 0 {
  1834. y = x - toint + toint
  1835. } else {
  1836. y = x + toint - toint
  1837. }
  1838. if y == float64(0) {
  1839. if s != 0 {
  1840. return -Float64FromFloat64(0.0)
  1841. }
  1842. return float64(0)
  1843. }
  1844. return y
  1845. }
  1846. func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
  1847. bp := tls.Alloc(8)
  1848. defer tls.Free(8)
  1849. // var u struct {f float64;} at bp, 8
  1850. var y double_t = x
  1851. if n > 1023 {
  1852. y = y * 0x1p1023
  1853. n = n - 1023
  1854. if n > 1023 {
  1855. y = y * 0x1p1023
  1856. n = n - 1023
  1857. if n > 1023 {
  1858. n = 1023
  1859. }
  1860. }
  1861. } else if n < -1022 {
  1862. // make sure final n < -53 to avoid double
  1863. // rounding in the subnormal range
  1864. y = y * (float64(0x1p-1022) * 0x1p53)
  1865. n = n + (1022 - 53)
  1866. if n < -1022 {
  1867. y = y * (float64(0x1p-1022) * 0x1p53)
  1868. n = n + (1022 - 53)
  1869. if n < -1022 {
  1870. n = -1022
  1871. }
  1872. }
  1873. }
  1874. *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52
  1875. x = y * *(*float64)(unsafe.Pointer(bp))
  1876. return x
  1877. }
  1878. func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
  1879. return Xscalbn(tls, x, n)
  1880. }
  1881. // Support signed or unsigned plain-char
  1882. // Implementation choices...
  1883. // Arbitrary numbers...
  1884. // POSIX/SUS requirements follow. These numbers come directly
  1885. // from SUS and have nothing to do with the host system.
  1886. type __locale_map = struct {
  1887. __map uintptr
  1888. map_size size_t
  1889. name [24]uint8
  1890. next uintptr
  1891. } /* alltypes.h:336:9 */
  1892. type tls_module = struct {
  1893. next uintptr
  1894. image uintptr
  1895. len size_t
  1896. size size_t
  1897. align size_t
  1898. offset size_t
  1899. } /* libc.h:14:1 */
  1900. type __libc = struct {
  1901. can_do_threads uint8
  1902. threaded uint8
  1903. secure uint8
  1904. need_locks int8
  1905. threads_minus_1 int32
  1906. auxv uintptr
  1907. tls_head uintptr
  1908. tls_size size_t
  1909. tls_align size_t
  1910. tls_cnt size_t
  1911. page_size size_t
  1912. global_locale struct{ cat [6]uintptr }
  1913. } /* libc.h:20:1 */
  1914. type time_t = int64 /* alltypes.h:78:16 */
  1915. type clockid_t = int32 /* alltypes.h:207:13 */
  1916. type timespec = struct {
  1917. tv_sec time_t
  1918. tv_nsec int32
  1919. __12 uint32 /* int : 32 */
  1920. } /* alltypes.h:222:1 */
  1921. type pthread_t = uintptr /* alltypes.h:266:26 */
  1922. type pthread_once_t = int32 /* alltypes.h:272:13 */
  1923. type pthread_key_t = uint32 /* alltypes.h:277:18 */
  1924. type pthread_spinlock_t = int32 /* alltypes.h:282:13 */
  1925. type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:287:37 */
  1926. type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:292:37 */
  1927. type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:297:37 */
  1928. type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:302:40 */
  1929. type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:342:9 */
  1930. type sigset_t = __sigset_t /* alltypes.h:342:71 */
  1931. type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:365:147 */
  1932. type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:370:157 */
  1933. type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:380:112 */
  1934. type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:390:139 */
  1935. type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:395:137 */
  1936. type sched_param = struct {
  1937. sched_priority int32
  1938. __reserved1 int32
  1939. __reserved2 [4]int32
  1940. __reserved3 int32
  1941. } /* sched.h:19:1 */
  1942. type timer_t = uintptr /* alltypes.h:202:14 */
  1943. type clock_t = int32 /* alltypes.h:212:14 */
  1944. type tm = struct {
  1945. tm_sec int32
  1946. tm_min int32
  1947. tm_hour int32
  1948. tm_mday int32
  1949. tm_mon int32
  1950. tm_year int32
  1951. tm_wday int32
  1952. tm_yday int32
  1953. tm_isdst int32
  1954. tm_gmtoff int32
  1955. tm_zone uintptr
  1956. } /* time.h:38:1 */
  1957. type itimerspec = struct {
  1958. it_interval struct {
  1959. tv_sec time_t
  1960. tv_nsec int32
  1961. __12 uint32 /* int : 32 */
  1962. }
  1963. it_value struct {
  1964. tv_sec time_t
  1965. tv_nsec int32
  1966. __12 uint32 /* int : 32 */
  1967. }
  1968. } /* time.h:80:1 */
  1969. type sigevent = struct {
  1970. sigev_value struct{ sival_int int32 }
  1971. sigev_signo int32
  1972. sigev_notify int32
  1973. sigev_notify_function uintptr
  1974. sigev_notify_attributes uintptr
  1975. __pad [44]uint8
  1976. } /* time.h:107:1 */
  1977. type __ptcb = struct {
  1978. __f uintptr
  1979. __x uintptr
  1980. __next uintptr
  1981. } /* alltypes.h:266:9 */
  1982. type sigaltstack = struct {
  1983. ss_sp uintptr
  1984. ss_flags int32
  1985. ss_size size_t
  1986. } /* signal.h:44:9 */
  1987. type stack_t = sigaltstack /* signal.h:44:28 */
  1988. type greg_t = int32 /* signal.h:10:13 */
  1989. type gregset_t = [18]int32 /* signal.h:10:21 */
  1990. type sigcontext = struct {
  1991. trap_no uint32
  1992. error_code uint32
  1993. oldmask uint32
  1994. arm_r0 uint32
  1995. arm_r1 uint32
  1996. arm_r2 uint32
  1997. arm_r3 uint32
  1998. arm_r4 uint32
  1999. arm_r5 uint32
  2000. arm_r6 uint32
  2001. arm_r7 uint32
  2002. arm_r8 uint32
  2003. arm_r9 uint32
  2004. arm_r10 uint32
  2005. arm_fp uint32
  2006. arm_ip uint32
  2007. arm_sp uint32
  2008. arm_lr uint32
  2009. arm_pc uint32
  2010. arm_cpsr uint32
  2011. fault_address uint32
  2012. } /* signal.h:11:9 */
  2013. type mcontext_t = sigcontext /* signal.h:18:3 */
  2014. type __ucontext = struct {
  2015. uc_flags uint32
  2016. uc_link uintptr
  2017. uc_stack stack_t
  2018. uc_mcontext mcontext_t
  2019. uc_sigmask sigset_t
  2020. uc_regspace [64]uint64
  2021. } /* signal.h:31:9 */
  2022. type ucontext_t = __ucontext /* signal.h:38:3 */
  2023. type sigval = struct{ sival_int int32 } /* time.h:107:1 */
  2024. type siginfo_t = struct {
  2025. si_signo int32
  2026. si_errno int32
  2027. si_code int32
  2028. __si_fields struct {
  2029. _ [0]uint32
  2030. __pad [116]uint8
  2031. }
  2032. } /* signal.h:145:3 */
  2033. type sigaction = struct {
  2034. __sa_handler struct{ sa_handler uintptr }
  2035. sa_mask sigset_t
  2036. sa_flags int32
  2037. sa_restorer uintptr
  2038. } /* signal.h:167:1 */
  2039. type sig_t = uintptr /* signal.h:251:14 */
  2040. type sig_atomic_t = int32 /* signal.h:269:13 */
  2041. func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:46:19: */
  2042. panic(`arch/arm/atomic_arch.h:48:2: assembler statements not supported`)
  2043. return int32(0)
  2044. //TODO for (;;) {
  2045. //TODO register int r0 __asm__("r0") = t;
  2046. //TODO register int r1 __asm__("r1") = s;
  2047. //TODO register volatile int *r2 __asm__("r2") = p;
  2048. //TODO register uintptr_t r3 __asm__("r3") = __a_cas_ptr;
  2049. //TODO int old;
  2050. //TODO __asm__ __volatile__ (
  2051. //TODO BLX " r3"
  2052. //TODO : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2)
  2053. //TODO : "memory", "lr", "ip", "cc" );
  2054. //TODO if (!r0) return t;
  2055. //TODO if ((old=*p)!=t) return old;
  2056. //TODO }
  2057. }
  2058. func a_barrier(tls *TLS) { /* atomic_arch.h:68:20: */
  2059. panic(`arch/arm/atomic_arch.h:70:2: assembler statements not supported`)
  2060. //TODO register uintptr_t ip __asm__("ip") = __a_barrier_ptr;
  2061. //TODO __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" );
  2062. }
  2063. func a_clz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:91:19: */
  2064. panic(`arch/arm/atomic_arch.h:93:2: assembler statements not supported`)
  2065. return int32(x)
  2066. }
  2067. func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:108:19: */
  2068. var old int32
  2069. for ok := true; ok; ok = a_cas(tls, p, old, v) != old {
  2070. old = *(*int32)(unsafe.Pointer(p))
  2071. }
  2072. return old
  2073. }
  2074. func a_fetch_add(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:119:19: */
  2075. var old int32
  2076. for ok := true; ok; ok = a_cas(tls, p, old, int32(uint32(old)+uint32(v))) != old {
  2077. old = *(*int32)(unsafe.Pointer(p))
  2078. }
  2079. return old
  2080. }
  2081. func a_fetch_and(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:130:19: */
  2082. var old int32
  2083. for ok := true; ok; ok = a_cas(tls, p, old, old&v) != old {
  2084. old = *(*int32)(unsafe.Pointer(p))
  2085. }
  2086. return old
  2087. }
  2088. func a_fetch_or(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:140:19: */
  2089. var old int32
  2090. for ok := true; ok; ok = a_cas(tls, p, old, old|v) != old {
  2091. old = *(*int32)(unsafe.Pointer(p))
  2092. }
  2093. return old
  2094. }
  2095. func a_and(tls *TLS, p uintptr, v int32) { /* atomic.h:151:20: */
  2096. a_fetch_and(tls, p, v)
  2097. }
  2098. func a_or(tls *TLS, p uintptr, v int32) { /* atomic.h:159:20: */
  2099. a_fetch_or(tls, p, v)
  2100. }
  2101. func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */
  2102. bp := tls.Alloc(8)
  2103. defer tls.Free(8)
  2104. *(*struct{ v uint64_t })(unsafe.Pointer(bp)) = func() (r struct{ v uint64_t }) {
  2105. *(*uint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = v
  2106. return r
  2107. }()
  2108. if *(*uint32_t)(unsafe.Pointer(bp)) != 0 {
  2109. a_or(tls, p, int32(*(*uint32_t)(unsafe.Pointer(bp))))
  2110. }
  2111. if *(*uint32_t)(unsafe.Pointer(bp + 1*4)) != 0 {
  2112. a_or(tls, p+uintptr(1)*4, int32(*(*uint32_t)(unsafe.Pointer(bp + 1*4))))
  2113. }
  2114. }
  2115. type a_cas_p_undefined_but_pointer_not_32bit = [1]uint8 /* atomic.h:229:14 */
  2116. func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */
  2117. return 31 - a_clz_32(tls, x&-x)
  2118. }
  2119. func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */
  2120. if uint32(unsafe.Sizeof(int32(0))) < uint32(8) {
  2121. var y uint32_t = uint32_t(x)
  2122. if !(y != 0) {
  2123. y = uint32_t(x >> 32)
  2124. return 32 + a_ctz_32(tls, y)
  2125. }
  2126. return a_ctz_32(tls, y)
  2127. }
  2128. return int32(_sdebruijn648[x&-x*0x022fdd63cc95386d>>58])
  2129. }
  2130. var _sdebruijn648 = [64]uint8{
  2131. uint8(0), uint8(1), uint8(2), uint8(53), uint8(3), uint8(7), uint8(54), uint8(27), uint8(4), uint8(38), uint8(41), uint8(8), uint8(34), uint8(55), uint8(48), uint8(28),
  2132. uint8(62), uint8(5), uint8(39), uint8(46), uint8(44), uint8(42), uint8(22), uint8(9), uint8(24), uint8(35), uint8(59), uint8(56), uint8(49), uint8(18), uint8(29), uint8(11),
  2133. uint8(63), uint8(52), uint8(6), uint8(26), uint8(37), uint8(40), uint8(33), uint8(47), uint8(61), uint8(45), uint8(43), uint8(21), uint8(23), uint8(58), uint8(17), uint8(10),
  2134. uint8(51), uint8(25), uint8(36), uint8(32), uint8(60), uint8(20), uint8(57), uint8(16), uint8(50), uint8(31), uint8(19), uint8(15), uint8(30), uint8(14), uint8(13), uint8(12),
  2135. } /* atomic.h:274:20 */
  2136. type __timer = struct {
  2137. timerid int32
  2138. thread pthread_t
  2139. } /* pthread_impl.h:64:1 */
  2140. func __pthread_self(tls *TLS) pthread_t { /* pthread_arch.h:19:25: */
  2141. var p uintptr_t
  2142. panic(`arch/arm/pthread_arch.h:23:2: assembler statements not supported`)
  2143. return uintptr(p - uintptr_t(unsafe.Sizeof(__pthread{})))
  2144. }
  2145. func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */
  2146. if priv != 0 {
  2147. priv = 128
  2148. }
  2149. if cnt < 0 {
  2150. cnt = 0x7fffffff
  2151. }
  2152. _ = Bool32(X__syscall3(tls, 240, int32(addr), int32(1|priv), int32(cnt)) != -38 || X__syscall3(tls, 240, int32(addr), 1, int32(cnt)) != 0)
  2153. }
  2154. func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */
  2155. if priv != 0 {
  2156. priv = 128
  2157. }
  2158. _ = Bool32(X__syscall4(tls, 240, int32(addr), int32(0|priv), int32(val), 0) != -38 || X__syscall4(tls, 240, int32(addr), 0, int32(val), 0) != 0)
  2159. }
  2160. var X__fsmu8 = [51]uint32_t{
  2161. func() uint32 {
  2162. if 0x2 < 2 {
  2163. return Uint32FromInt32(-1)
  2164. }
  2165. return func() uint32 {
  2166. if Int32(0x80) == Int32(0x80) {
  2167. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2168. }
  2169. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2170. }()<<23 | uint32_t(0x2)
  2171. }(), func() uint32 {
  2172. if 0x3 < 2 {
  2173. return Uint32FromInt32(-1)
  2174. }
  2175. return func() uint32 {
  2176. if Int32(0x80) == Int32(0x80) {
  2177. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2178. }
  2179. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2180. }()<<23 | uint32_t(0x3)
  2181. }(), func() uint32 {
  2182. if 0x4 < 2 {
  2183. return Uint32FromInt32(-1)
  2184. }
  2185. return func() uint32 {
  2186. if Int32(0x80) == Int32(0x80) {
  2187. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2188. }
  2189. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2190. }()<<23 | uint32_t(0x4)
  2191. }(), func() uint32 {
  2192. if 0x5 < 2 {
  2193. return Uint32FromInt32(-1)
  2194. }
  2195. return func() uint32 {
  2196. if Int32(0x80) == Int32(0x80) {
  2197. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2198. }
  2199. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2200. }()<<23 | uint32_t(0x5)
  2201. }(), func() uint32 {
  2202. if 0x6 < 2 {
  2203. return Uint32FromInt32(-1)
  2204. }
  2205. return func() uint32 {
  2206. if Int32(0x80) == Int32(0x80) {
  2207. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2208. }
  2209. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2210. }()<<23 | uint32_t(0x6)
  2211. }(), func() uint32 {
  2212. if 0x7 < 2 {
  2213. return Uint32FromInt32(-1)
  2214. }
  2215. return func() uint32 {
  2216. if Int32(0x80) == Int32(0x80) {
  2217. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2218. }
  2219. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2220. }()<<23 | uint32_t(0x7)
  2221. }(),
  2222. func() uint32 {
  2223. if 0x8 < 2 {
  2224. return Uint32FromInt32(-1)
  2225. }
  2226. return func() uint32 {
  2227. if Int32(0x80) == Int32(0x80) {
  2228. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2229. }
  2230. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2231. }()<<23 | uint32_t(0x8)
  2232. }(), func() uint32 {
  2233. if 0x9 < 2 {
  2234. return Uint32FromInt32(-1)
  2235. }
  2236. return func() uint32 {
  2237. if Int32(0x80) == Int32(0x80) {
  2238. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2239. }
  2240. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2241. }()<<23 | uint32_t(0x9)
  2242. }(), func() uint32 {
  2243. if 0xa < 2 {
  2244. return Uint32FromInt32(-1)
  2245. }
  2246. return func() uint32 {
  2247. if Int32(0x80) == Int32(0x80) {
  2248. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2249. }
  2250. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2251. }()<<23 | uint32_t(0xa)
  2252. }(), func() uint32 {
  2253. if 0xb < 2 {
  2254. return Uint32FromInt32(-1)
  2255. }
  2256. return func() uint32 {
  2257. if Int32(0x80) == Int32(0x80) {
  2258. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2259. }
  2260. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2261. }()<<23 | uint32_t(0xb)
  2262. }(), func() uint32 {
  2263. if 0xc < 2 {
  2264. return Uint32FromInt32(-1)
  2265. }
  2266. return func() uint32 {
  2267. if Int32(0x80) == Int32(0x80) {
  2268. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2269. }
  2270. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2271. }()<<23 | uint32_t(0xc)
  2272. }(), func() uint32 {
  2273. if 0xd < 2 {
  2274. return Uint32FromInt32(-1)
  2275. }
  2276. return func() uint32 {
  2277. if Int32(0x80) == Int32(0x80) {
  2278. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2279. }
  2280. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2281. }()<<23 | uint32_t(0xd)
  2282. }(), func() uint32 {
  2283. if 0xe < 2 {
  2284. return Uint32FromInt32(-1)
  2285. }
  2286. return func() uint32 {
  2287. if Int32(0x80) == Int32(0x80) {
  2288. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2289. }
  2290. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2291. }()<<23 | uint32_t(0xe)
  2292. }(), func() uint32 {
  2293. if 0xf < 2 {
  2294. return Uint32FromInt32(-1)
  2295. }
  2296. return func() uint32 {
  2297. if Int32(0x80) == Int32(0x80) {
  2298. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2299. }
  2300. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2301. }()<<23 | uint32_t(0xf)
  2302. }(),
  2303. func() uint32 {
  2304. if 0x0+16 < 2 {
  2305. return Uint32FromInt32(-1)
  2306. }
  2307. return func() uint32 {
  2308. if Int32(0x80) == Int32(0x80) {
  2309. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2310. }
  2311. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2312. }()<<23 | uint32_t(0x0+16)
  2313. }(), func() uint32 {
  2314. if 0x1+16 < 2 {
  2315. return Uint32FromInt32(-1)
  2316. }
  2317. return func() uint32 {
  2318. if Int32(0x80) == Int32(0x80) {
  2319. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2320. }
  2321. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2322. }()<<23 | uint32_t(0x1+16)
  2323. }(), func() uint32 {
  2324. if 0x2+16 < 2 {
  2325. return Uint32FromInt32(-1)
  2326. }
  2327. return func() uint32 {
  2328. if Int32(0x80) == Int32(0x80) {
  2329. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2330. }
  2331. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2332. }()<<23 | uint32_t(0x2+16)
  2333. }(), func() uint32 {
  2334. if 0x3+16 < 2 {
  2335. return Uint32FromInt32(-1)
  2336. }
  2337. return func() uint32 {
  2338. if Int32(0x80) == Int32(0x80) {
  2339. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2340. }
  2341. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2342. }()<<23 | uint32_t(0x3+16)
  2343. }(), func() uint32 {
  2344. if 0x4+16 < 2 {
  2345. return Uint32FromInt32(-1)
  2346. }
  2347. return func() uint32 {
  2348. if Int32(0x80) == Int32(0x80) {
  2349. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2350. }
  2351. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2352. }()<<23 | uint32_t(0x4+16)
  2353. }(), func() uint32 {
  2354. if 0x5+16 < 2 {
  2355. return Uint32FromInt32(-1)
  2356. }
  2357. return func() uint32 {
  2358. if Int32(0x80) == Int32(0x80) {
  2359. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2360. }
  2361. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2362. }()<<23 | uint32_t(0x5+16)
  2363. }(), func() uint32 {
  2364. if 0x6+16 < 2 {
  2365. return Uint32FromInt32(-1)
  2366. }
  2367. return func() uint32 {
  2368. if Int32(0x80) == Int32(0x80) {
  2369. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2370. }
  2371. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2372. }()<<23 | uint32_t(0x6+16)
  2373. }(), func() uint32 {
  2374. if 0x7+16 < 2 {
  2375. return Uint32FromInt32(-1)
  2376. }
  2377. return func() uint32 {
  2378. if Int32(0x80) == Int32(0x80) {
  2379. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2380. }
  2381. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2382. }()<<23 | uint32_t(0x7+16)
  2383. }(),
  2384. func() uint32 {
  2385. if 0x8+16 < 2 {
  2386. return Uint32FromInt32(-1)
  2387. }
  2388. return func() uint32 {
  2389. if Int32(0x80) == Int32(0x80) {
  2390. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2391. }
  2392. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2393. }()<<23 | uint32_t(0x8+16)
  2394. }(), func() uint32 {
  2395. if 0x9+16 < 2 {
  2396. return Uint32FromInt32(-1)
  2397. }
  2398. return func() uint32 {
  2399. if Int32(0x80) == Int32(0x80) {
  2400. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2401. }
  2402. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2403. }()<<23 | uint32_t(0x9+16)
  2404. }(), func() uint32 {
  2405. if 0xa+16 < 2 {
  2406. return Uint32FromInt32(-1)
  2407. }
  2408. return func() uint32 {
  2409. if Int32(0x80) == Int32(0x80) {
  2410. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2411. }
  2412. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2413. }()<<23 | uint32_t(0xa+16)
  2414. }(), func() uint32 {
  2415. if 0xb+16 < 2 {
  2416. return Uint32FromInt32(-1)
  2417. }
  2418. return func() uint32 {
  2419. if Int32(0x80) == Int32(0x80) {
  2420. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2421. }
  2422. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2423. }()<<23 | uint32_t(0xb+16)
  2424. }(), func() uint32 {
  2425. if 0xc+16 < 2 {
  2426. return Uint32FromInt32(-1)
  2427. }
  2428. return func() uint32 {
  2429. if Int32(0x80) == Int32(0x80) {
  2430. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2431. }
  2432. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2433. }()<<23 | uint32_t(0xc+16)
  2434. }(), func() uint32 {
  2435. if 0xd+16 < 2 {
  2436. return Uint32FromInt32(-1)
  2437. }
  2438. return func() uint32 {
  2439. if Int32(0x80) == Int32(0x80) {
  2440. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2441. }
  2442. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2443. }()<<23 | uint32_t(0xd+16)
  2444. }(), func() uint32 {
  2445. if 0xe+16 < 2 {
  2446. return Uint32FromInt32(-1)
  2447. }
  2448. return func() uint32 {
  2449. if Int32(0x80) == Int32(0x80) {
  2450. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2451. }
  2452. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2453. }()<<23 | uint32_t(0xe+16)
  2454. }(), func() uint32 {
  2455. if 0xf+16 < 2 {
  2456. return Uint32FromInt32(-1)
  2457. }
  2458. return func() uint32 {
  2459. if Int32(0x80) == Int32(0x80) {
  2460. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2461. }
  2462. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2463. }()<<23 | uint32_t(0xf+16)
  2464. }(),
  2465. func() uint32 {
  2466. if 0x0 == 0 {
  2467. return func() uint32 {
  2468. if Int32(0xa0) == Int32(0x80) {
  2469. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2470. }
  2471. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2472. }() << 23
  2473. }
  2474. return func() uint32 {
  2475. if 0x0 == 0xd {
  2476. return func() uint32 {
  2477. if Int32(0x80) == Int32(0x80) {
  2478. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2479. }
  2480. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2481. }() << 23
  2482. }
  2483. return func() uint32 {
  2484. if Int32(0x80) == Int32(0x80) {
  2485. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2486. }
  2487. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2488. }() << 23
  2489. }()
  2490. }() | uint32_t(func() uint32 {
  2491. if Int32(0x80) == Int32(0x80) {
  2492. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2493. }
  2494. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2495. }()<<23)>>6 | uint32_t(0x0), func() uint32 {
  2496. if 0x1 == 0 {
  2497. return func() uint32 {
  2498. if Int32(0xa0) == Int32(0x80) {
  2499. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2500. }
  2501. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2502. }() << 23
  2503. }
  2504. return func() uint32 {
  2505. if 0x1 == 0xd {
  2506. return func() uint32 {
  2507. if Int32(0x80) == Int32(0x80) {
  2508. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2509. }
  2510. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2511. }() << 23
  2512. }
  2513. return func() uint32 {
  2514. if Int32(0x80) == Int32(0x80) {
  2515. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2516. }
  2517. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2518. }() << 23
  2519. }()
  2520. }() | uint32_t(func() uint32 {
  2521. if Int32(0x80) == Int32(0x80) {
  2522. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2523. }
  2524. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2525. }()<<23)>>6 | uint32_t(0x1), func() uint32 {
  2526. if 0x2 == 0 {
  2527. return func() uint32 {
  2528. if Int32(0xa0) == Int32(0x80) {
  2529. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2530. }
  2531. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2532. }() << 23
  2533. }
  2534. return func() uint32 {
  2535. if 0x2 == 0xd {
  2536. return func() uint32 {
  2537. if Int32(0x80) == Int32(0x80) {
  2538. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2539. }
  2540. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2541. }() << 23
  2542. }
  2543. return func() uint32 {
  2544. if Int32(0x80) == Int32(0x80) {
  2545. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2546. }
  2547. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2548. }() << 23
  2549. }()
  2550. }() | uint32_t(func() uint32 {
  2551. if Int32(0x80) == Int32(0x80) {
  2552. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2553. }
  2554. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2555. }()<<23)>>6 | uint32_t(0x2), func() uint32 {
  2556. if 0x3 == 0 {
  2557. return func() uint32 {
  2558. if Int32(0xa0) == Int32(0x80) {
  2559. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2560. }
  2561. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2562. }() << 23
  2563. }
  2564. return func() uint32 {
  2565. if 0x3 == 0xd {
  2566. return func() uint32 {
  2567. if Int32(0x80) == Int32(0x80) {
  2568. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2569. }
  2570. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2571. }() << 23
  2572. }
  2573. return func() uint32 {
  2574. if Int32(0x80) == Int32(0x80) {
  2575. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2576. }
  2577. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2578. }() << 23
  2579. }()
  2580. }() | uint32_t(func() uint32 {
  2581. if Int32(0x80) == Int32(0x80) {
  2582. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2583. }
  2584. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2585. }()<<23)>>6 | uint32_t(0x3), func() uint32 {
  2586. if 0x4 == 0 {
  2587. return func() uint32 {
  2588. if Int32(0xa0) == Int32(0x80) {
  2589. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2590. }
  2591. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2592. }() << 23
  2593. }
  2594. return func() uint32 {
  2595. if 0x4 == 0xd {
  2596. return func() uint32 {
  2597. if Int32(0x80) == Int32(0x80) {
  2598. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2599. }
  2600. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2601. }() << 23
  2602. }
  2603. return func() uint32 {
  2604. if Int32(0x80) == Int32(0x80) {
  2605. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2606. }
  2607. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2608. }() << 23
  2609. }()
  2610. }() | uint32_t(func() uint32 {
  2611. if Int32(0x80) == Int32(0x80) {
  2612. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2613. }
  2614. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2615. }()<<23)>>6 | uint32_t(0x4), func() uint32 {
  2616. if 0x5 == 0 {
  2617. return func() uint32 {
  2618. if Int32(0xa0) == Int32(0x80) {
  2619. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2620. }
  2621. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2622. }() << 23
  2623. }
  2624. return func() uint32 {
  2625. if 0x5 == 0xd {
  2626. return func() uint32 {
  2627. if Int32(0x80) == Int32(0x80) {
  2628. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2629. }
  2630. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2631. }() << 23
  2632. }
  2633. return func() uint32 {
  2634. if Int32(0x80) == Int32(0x80) {
  2635. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2636. }
  2637. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2638. }() << 23
  2639. }()
  2640. }() | uint32_t(func() uint32 {
  2641. if Int32(0x80) == Int32(0x80) {
  2642. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2643. }
  2644. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2645. }()<<23)>>6 | uint32_t(0x5), func() uint32 {
  2646. if 0x6 == 0 {
  2647. return func() uint32 {
  2648. if Int32(0xa0) == Int32(0x80) {
  2649. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2650. }
  2651. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2652. }() << 23
  2653. }
  2654. return func() uint32 {
  2655. if 0x6 == 0xd {
  2656. return func() uint32 {
  2657. if Int32(0x80) == Int32(0x80) {
  2658. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2659. }
  2660. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2661. }() << 23
  2662. }
  2663. return func() uint32 {
  2664. if Int32(0x80) == Int32(0x80) {
  2665. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2666. }
  2667. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2668. }() << 23
  2669. }()
  2670. }() | uint32_t(func() uint32 {
  2671. if Int32(0x80) == Int32(0x80) {
  2672. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2673. }
  2674. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2675. }()<<23)>>6 | uint32_t(0x6), func() uint32 {
  2676. if 0x7 == 0 {
  2677. return func() uint32 {
  2678. if Int32(0xa0) == Int32(0x80) {
  2679. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2680. }
  2681. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2682. }() << 23
  2683. }
  2684. return func() uint32 {
  2685. if 0x7 == 0xd {
  2686. return func() uint32 {
  2687. if Int32(0x80) == Int32(0x80) {
  2688. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2689. }
  2690. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2691. }() << 23
  2692. }
  2693. return func() uint32 {
  2694. if Int32(0x80) == Int32(0x80) {
  2695. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2696. }
  2697. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2698. }() << 23
  2699. }()
  2700. }() | uint32_t(func() uint32 {
  2701. if Int32(0x80) == Int32(0x80) {
  2702. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2703. }
  2704. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2705. }()<<23)>>6 | uint32_t(0x7),
  2706. func() uint32 {
  2707. if 0x8 == 0 {
  2708. return func() uint32 {
  2709. if Int32(0xa0) == Int32(0x80) {
  2710. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2711. }
  2712. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2713. }() << 23
  2714. }
  2715. return func() uint32 {
  2716. if 0x8 == 0xd {
  2717. return func() uint32 {
  2718. if Int32(0x80) == Int32(0x80) {
  2719. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2720. }
  2721. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2722. }() << 23
  2723. }
  2724. return func() uint32 {
  2725. if Int32(0x80) == Int32(0x80) {
  2726. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2727. }
  2728. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2729. }() << 23
  2730. }()
  2731. }() | uint32_t(func() uint32 {
  2732. if Int32(0x80) == Int32(0x80) {
  2733. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2734. }
  2735. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2736. }()<<23)>>6 | uint32_t(0x8), func() uint32 {
  2737. if 0x9 == 0 {
  2738. return func() uint32 {
  2739. if Int32(0xa0) == Int32(0x80) {
  2740. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2741. }
  2742. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2743. }() << 23
  2744. }
  2745. return func() uint32 {
  2746. if 0x9 == 0xd {
  2747. return func() uint32 {
  2748. if Int32(0x80) == Int32(0x80) {
  2749. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2750. }
  2751. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2752. }() << 23
  2753. }
  2754. return func() uint32 {
  2755. if Int32(0x80) == Int32(0x80) {
  2756. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2757. }
  2758. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2759. }() << 23
  2760. }()
  2761. }() | uint32_t(func() uint32 {
  2762. if Int32(0x80) == Int32(0x80) {
  2763. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2764. }
  2765. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2766. }()<<23)>>6 | uint32_t(0x9), func() uint32 {
  2767. if 0xa == 0 {
  2768. return func() uint32 {
  2769. if Int32(0xa0) == Int32(0x80) {
  2770. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2771. }
  2772. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2773. }() << 23
  2774. }
  2775. return func() uint32 {
  2776. if 0xa == 0xd {
  2777. return func() uint32 {
  2778. if Int32(0x80) == Int32(0x80) {
  2779. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2780. }
  2781. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2782. }() << 23
  2783. }
  2784. return func() uint32 {
  2785. if Int32(0x80) == Int32(0x80) {
  2786. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2787. }
  2788. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2789. }() << 23
  2790. }()
  2791. }() | uint32_t(func() uint32 {
  2792. if Int32(0x80) == Int32(0x80) {
  2793. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2794. }
  2795. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2796. }()<<23)>>6 | uint32_t(0xa), func() uint32 {
  2797. if 0xb == 0 {
  2798. return func() uint32 {
  2799. if Int32(0xa0) == Int32(0x80) {
  2800. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2801. }
  2802. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2803. }() << 23
  2804. }
  2805. return func() uint32 {
  2806. if 0xb == 0xd {
  2807. return func() uint32 {
  2808. if Int32(0x80) == Int32(0x80) {
  2809. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2810. }
  2811. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2812. }() << 23
  2813. }
  2814. return func() uint32 {
  2815. if Int32(0x80) == Int32(0x80) {
  2816. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2817. }
  2818. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2819. }() << 23
  2820. }()
  2821. }() | uint32_t(func() uint32 {
  2822. if Int32(0x80) == Int32(0x80) {
  2823. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2824. }
  2825. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2826. }()<<23)>>6 | uint32_t(0xb), func() uint32 {
  2827. if 0xc == 0 {
  2828. return func() uint32 {
  2829. if Int32(0xa0) == Int32(0x80) {
  2830. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2831. }
  2832. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2833. }() << 23
  2834. }
  2835. return func() uint32 {
  2836. if 0xc == 0xd {
  2837. return func() uint32 {
  2838. if Int32(0x80) == Int32(0x80) {
  2839. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2840. }
  2841. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2842. }() << 23
  2843. }
  2844. return func() uint32 {
  2845. if Int32(0x80) == Int32(0x80) {
  2846. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2847. }
  2848. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2849. }() << 23
  2850. }()
  2851. }() | uint32_t(func() uint32 {
  2852. if Int32(0x80) == Int32(0x80) {
  2853. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2854. }
  2855. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2856. }()<<23)>>6 | uint32_t(0xc), func() uint32 {
  2857. if 0xd == 0 {
  2858. return func() uint32 {
  2859. if Int32(0xa0) == Int32(0x80) {
  2860. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2861. }
  2862. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2863. }() << 23
  2864. }
  2865. return func() uint32 {
  2866. if 0xd == 0xd {
  2867. return func() uint32 {
  2868. if Int32(0x80) == Int32(0x80) {
  2869. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2870. }
  2871. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2872. }() << 23
  2873. }
  2874. return func() uint32 {
  2875. if Int32(0x80) == Int32(0x80) {
  2876. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2877. }
  2878. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2879. }() << 23
  2880. }()
  2881. }() | uint32_t(func() uint32 {
  2882. if Int32(0x80) == Int32(0x80) {
  2883. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2884. }
  2885. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2886. }()<<23)>>6 | uint32_t(0xd), func() uint32 {
  2887. if 0xe == 0 {
  2888. return func() uint32 {
  2889. if Int32(0xa0) == Int32(0x80) {
  2890. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2891. }
  2892. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2893. }() << 23
  2894. }
  2895. return func() uint32 {
  2896. if 0xe == 0xd {
  2897. return func() uint32 {
  2898. if Int32(0x80) == Int32(0x80) {
  2899. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2900. }
  2901. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2902. }() << 23
  2903. }
  2904. return func() uint32 {
  2905. if Int32(0x80) == Int32(0x80) {
  2906. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2907. }
  2908. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2909. }() << 23
  2910. }()
  2911. }() | uint32_t(func() uint32 {
  2912. if Int32(0x80) == Int32(0x80) {
  2913. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2914. }
  2915. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2916. }()<<23)>>6 | uint32_t(0xe), func() uint32 {
  2917. if 0xf == 0 {
  2918. return func() uint32 {
  2919. if Int32(0xa0) == Int32(0x80) {
  2920. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2921. }
  2922. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2923. }() << 23
  2924. }
  2925. return func() uint32 {
  2926. if 0xf == 0xd {
  2927. return func() uint32 {
  2928. if Int32(0x80) == Int32(0x80) {
  2929. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2930. }
  2931. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2932. }() << 23
  2933. }
  2934. return func() uint32 {
  2935. if Int32(0x80) == Int32(0x80) {
  2936. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2937. }
  2938. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2939. }() << 23
  2940. }()
  2941. }() | uint32_t(func() uint32 {
  2942. if Int32(0x80) == Int32(0x80) {
  2943. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2944. }
  2945. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2946. }()<<23)>>6 | uint32_t(0xf),
  2947. func() uint32 {
  2948. if 0x0 >= 5 {
  2949. return uint32(0)
  2950. }
  2951. return func() uint32 {
  2952. if 0x0 == 0 {
  2953. return func() uint32 {
  2954. if Int32(0x90) == Int32(0x80) {
  2955. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2956. }
  2957. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  2958. }() << 23
  2959. }
  2960. return func() uint32 {
  2961. if 0x0 == 4 {
  2962. return func() uint32 {
  2963. if Int32(0x80) == Int32(0x80) {
  2964. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  2965. }
  2966. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2967. }() << 23
  2968. }
  2969. return func() uint32 {
  2970. if Int32(0x80) == Int32(0x80) {
  2971. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2972. }
  2973. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2974. }() << 23
  2975. }()
  2976. }()
  2977. }() | uint32_t(func() uint32 {
  2978. if Int32(0x80) == Int32(0x80) {
  2979. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2980. }
  2981. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2982. }()<<23)>>6 | uint32_t(func() uint32 {
  2983. if Int32(0x80) == Int32(0x80) {
  2984. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2985. }
  2986. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2987. }()<<23)>>12 | uint32_t(0x0), func() uint32 {
  2988. if 0x1 >= 5 {
  2989. return uint32(0)
  2990. }
  2991. return func() uint32 {
  2992. if 0x1 == 0 {
  2993. return func() uint32 {
  2994. if Int32(0x90) == Int32(0x80) {
  2995. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2996. }
  2997. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  2998. }() << 23
  2999. }
  3000. return func() uint32 {
  3001. if 0x1 == 4 {
  3002. return func() uint32 {
  3003. if Int32(0x80) == Int32(0x80) {
  3004. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3005. }
  3006. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3007. }() << 23
  3008. }
  3009. return func() uint32 {
  3010. if Int32(0x80) == Int32(0x80) {
  3011. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3012. }
  3013. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3014. }() << 23
  3015. }()
  3016. }()
  3017. }() | uint32_t(func() uint32 {
  3018. if Int32(0x80) == Int32(0x80) {
  3019. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3020. }
  3021. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3022. }()<<23)>>6 | uint32_t(func() uint32 {
  3023. if Int32(0x80) == Int32(0x80) {
  3024. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3025. }
  3026. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3027. }()<<23)>>12 | uint32_t(0x1), func() uint32 {
  3028. if 0x2 >= 5 {
  3029. return uint32(0)
  3030. }
  3031. return func() uint32 {
  3032. if 0x2 == 0 {
  3033. return func() uint32 {
  3034. if Int32(0x90) == Int32(0x80) {
  3035. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3036. }
  3037. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3038. }() << 23
  3039. }
  3040. return func() uint32 {
  3041. if 0x2 == 4 {
  3042. return func() uint32 {
  3043. if Int32(0x80) == Int32(0x80) {
  3044. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3045. }
  3046. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3047. }() << 23
  3048. }
  3049. return func() uint32 {
  3050. if Int32(0x80) == Int32(0x80) {
  3051. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3052. }
  3053. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3054. }() << 23
  3055. }()
  3056. }()
  3057. }() | uint32_t(func() uint32 {
  3058. if Int32(0x80) == Int32(0x80) {
  3059. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3060. }
  3061. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3062. }()<<23)>>6 | uint32_t(func() uint32 {
  3063. if Int32(0x80) == Int32(0x80) {
  3064. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3065. }
  3066. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3067. }()<<23)>>12 | uint32_t(0x2), func() uint32 {
  3068. if 0x3 >= 5 {
  3069. return uint32(0)
  3070. }
  3071. return func() uint32 {
  3072. if 0x3 == 0 {
  3073. return func() uint32 {
  3074. if Int32(0x90) == Int32(0x80) {
  3075. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3076. }
  3077. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3078. }() << 23
  3079. }
  3080. return func() uint32 {
  3081. if 0x3 == 4 {
  3082. return func() uint32 {
  3083. if Int32(0x80) == Int32(0x80) {
  3084. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3085. }
  3086. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3087. }() << 23
  3088. }
  3089. return func() uint32 {
  3090. if Int32(0x80) == Int32(0x80) {
  3091. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3092. }
  3093. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3094. }() << 23
  3095. }()
  3096. }()
  3097. }() | uint32_t(func() uint32 {
  3098. if Int32(0x80) == Int32(0x80) {
  3099. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3100. }
  3101. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3102. }()<<23)>>6 | uint32_t(func() uint32 {
  3103. if Int32(0x80) == Int32(0x80) {
  3104. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3105. }
  3106. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3107. }()<<23)>>12 | uint32_t(0x3), func() uint32 {
  3108. if 0x4 >= 5 {
  3109. return uint32(0)
  3110. }
  3111. return func() uint32 {
  3112. if 0x4 == 0 {
  3113. return func() uint32 {
  3114. if Int32(0x90) == Int32(0x80) {
  3115. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3116. }
  3117. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3118. }() << 23
  3119. }
  3120. return func() uint32 {
  3121. if 0x4 == 4 {
  3122. return func() uint32 {
  3123. if Int32(0x80) == Int32(0x80) {
  3124. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3125. }
  3126. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3127. }() << 23
  3128. }
  3129. return func() uint32 {
  3130. if Int32(0x80) == Int32(0x80) {
  3131. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3132. }
  3133. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3134. }() << 23
  3135. }()
  3136. }()
  3137. }() | uint32_t(func() uint32 {
  3138. if Int32(0x80) == Int32(0x80) {
  3139. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3140. }
  3141. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3142. }()<<23)>>6 | uint32_t(func() uint32 {
  3143. if Int32(0x80) == Int32(0x80) {
  3144. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3145. }
  3146. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3147. }()<<23)>>12 | uint32_t(0x4),
  3148. } /* internal.c:18:16 */
  3149. type wint_t = uint32 /* alltypes.h:191:18 */
  3150. type wctype_t = uint32 /* alltypes.h:196:23 */
  3151. type __mbstate_t = struct {
  3152. __opaque1 uint32
  3153. __opaque2 uint32
  3154. } /* alltypes.h:330:9 */
  3155. type mbstate_t = __mbstate_t /* alltypes.h:330:63 */
  3156. func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
  3157. bp := tls.Alloc(4)
  3158. defer tls.Free(4)
  3159. var c uint32
  3160. var s uintptr
  3161. var N uint32
  3162. // var dummy wchar_t at bp, 4
  3163. s = src
  3164. N = n
  3165. if !!(st != 0) {
  3166. goto __1
  3167. }
  3168. st = uintptr(unsafe.Pointer(&_sinternal_state))
  3169. __1:
  3170. ;
  3171. c = *(*uint32)(unsafe.Pointer(st))
  3172. if !!(s != 0) {
  3173. goto __2
  3174. }
  3175. if !(c != 0) {
  3176. goto __4
  3177. }
  3178. goto ilseq
  3179. __4:
  3180. ;
  3181. return size_t(0)
  3182. goto __3
  3183. __2:
  3184. if !!(wc != 0) {
  3185. goto __5
  3186. }
  3187. wc = bp /* &dummy */
  3188. __5:
  3189. ;
  3190. __3:
  3191. ;
  3192. if !!(n != 0) {
  3193. goto __6
  3194. }
  3195. return Uint32FromInt32(-2)
  3196. __6:
  3197. ;
  3198. if !!(c != 0) {
  3199. goto __7
  3200. }
  3201. if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) {
  3202. goto __8
  3203. }
  3204. return BoolUint32(!!(int32(AssignPtrUint32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s))))) != 0))
  3205. __8:
  3206. ;
  3207. if !(func() int32 {
  3208. if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) {
  3209. return 4
  3210. }
  3211. return 1
  3212. }() == 1) {
  3213. goto __9
  3214. }
  3215. *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s)))))
  3216. return 1
  3217. __9:
  3218. ;
  3219. if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) {
  3220. goto __10
  3221. }
  3222. goto ilseq
  3223. __10:
  3224. ;
  3225. c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2]
  3226. n--
  3227. __7:
  3228. ;
  3229. if !(n != 0) {
  3230. goto __11
  3231. }
  3232. if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) {
  3233. goto __12
  3234. }
  3235. goto ilseq
  3236. __12:
  3237. ;
  3238. loop:
  3239. c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80)
  3240. n--
  3241. if !!(c&(uint32(1)<<31) != 0) {
  3242. goto __13
  3243. }
  3244. *(*uint32)(unsafe.Pointer(st)) = uint32(0)
  3245. *(*wchar_t)(unsafe.Pointer(wc)) = c
  3246. return N - n
  3247. __13:
  3248. ;
  3249. if !(n != 0) {
  3250. goto __14
  3251. }
  3252. if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) {
  3253. goto __15
  3254. }
  3255. goto ilseq
  3256. __15:
  3257. ;
  3258. goto loop
  3259. __14:
  3260. ;
  3261. __11:
  3262. ;
  3263. *(*uint32)(unsafe.Pointer(st)) = c
  3264. return Uint32FromInt32(-2)
  3265. ilseq:
  3266. *(*uint32)(unsafe.Pointer(st)) = uint32(0)
  3267. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84
  3268. return Uint32FromInt32(-1)
  3269. }
  3270. var _sinternal_state uint32 /* mbrtowc.c:8:18: */
  3271. func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
  3272. return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
  3273. }
  3274. type imaxdiv_t = struct {
  3275. quot intmax_t
  3276. rem intmax_t
  3277. } /* inttypes.h:14:40 */
  3278. type socklen_t = uint32 /* alltypes.h:354:18 */
  3279. type sa_family_t = uint16 /* alltypes.h:359:24 */
  3280. type msghdr = struct {
  3281. msg_name uintptr
  3282. msg_namelen socklen_t
  3283. msg_iov uintptr
  3284. msg_iovlen int32
  3285. msg_control uintptr
  3286. msg_controllen socklen_t
  3287. msg_flags int32
  3288. } /* socket.h:22:1 */
  3289. type cmsghdr = struct {
  3290. cmsg_len socklen_t
  3291. cmsg_level int32
  3292. cmsg_type int32
  3293. } /* socket.h:44:1 */
  3294. type linger = struct {
  3295. l_onoff int32
  3296. l_linger int32
  3297. } /* socket.h:74:1 */
  3298. type sockaddr = struct {
  3299. sa_family sa_family_t
  3300. sa_data [14]uint8
  3301. } /* socket.h:367:1 */
  3302. type sockaddr_storage = struct {
  3303. ss_family sa_family_t
  3304. __ss_padding [122]uint8
  3305. __ss_align uint32
  3306. } /* socket.h:372:1 */
  3307. type in_port_t = uint16_t /* in.h:12:18 */
  3308. type in_addr_t = uint32_t /* in.h:13:18 */
  3309. type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */
  3310. type sockaddr_in = struct {
  3311. sin_family sa_family_t
  3312. sin_port in_port_t
  3313. sin_addr struct{ s_addr in_addr_t }
  3314. sin_zero [8]uint8_t
  3315. } /* in.h:16:1 */
  3316. type in6_addr = struct {
  3317. __in6_union struct {
  3318. _ [0]uint32
  3319. __s6_addr [16]uint8_t
  3320. }
  3321. } /* in.h:23:1 */
  3322. type sockaddr_in6 = struct {
  3323. sin6_family sa_family_t
  3324. sin6_port in_port_t
  3325. sin6_flowinfo uint32_t
  3326. sin6_addr struct {
  3327. __in6_union struct {
  3328. _ [0]uint32
  3329. __s6_addr [16]uint8_t
  3330. }
  3331. }
  3332. sin6_scope_id uint32_t
  3333. } /* in.h:34:1 */
  3334. type ipv6_mreq = struct {
  3335. ipv6mr_multiaddr struct {
  3336. __in6_union struct {
  3337. _ [0]uint32
  3338. __s6_addr [16]uint8_t
  3339. }
  3340. }
  3341. ipv6mr_interface uint32
  3342. } /* in.h:42:1 */
  3343. type ip_opts = struct {
  3344. ip_dst struct{ s_addr in_addr_t }
  3345. ip_opts [40]uint8
  3346. } /* in.h:229:1 */
  3347. type ip_mreq = struct {
  3348. imr_multiaddr struct{ s_addr in_addr_t }
  3349. imr_interface struct{ s_addr in_addr_t }
  3350. } /* in.h:247:1 */
  3351. type ip_mreqn = struct {
  3352. imr_multiaddr struct{ s_addr in_addr_t }
  3353. imr_address struct{ s_addr in_addr_t }
  3354. imr_ifindex int32
  3355. } /* in.h:252:1 */
  3356. type ip_mreq_source = struct {
  3357. imr_multiaddr struct{ s_addr in_addr_t }
  3358. imr_interface struct{ s_addr in_addr_t }
  3359. imr_sourceaddr struct{ s_addr in_addr_t }
  3360. } /* in.h:258:1 */
  3361. type ip_msfilter = struct {
  3362. imsf_multiaddr struct{ s_addr in_addr_t }
  3363. imsf_interface struct{ s_addr in_addr_t }
  3364. imsf_fmode uint32_t
  3365. imsf_numsrc uint32_t
  3366. imsf_slist [1]struct{ s_addr in_addr_t }
  3367. } /* in.h:264:1 */
  3368. type group_req = struct {
  3369. gr_interface uint32_t
  3370. gr_group struct {
  3371. ss_family sa_family_t
  3372. __ss_padding [122]uint8
  3373. __ss_align uint32
  3374. }
  3375. } /* in.h:275:1 */
  3376. type group_source_req = struct {
  3377. gsr_interface uint32_t
  3378. gsr_group struct {
  3379. ss_family sa_family_t
  3380. __ss_padding [122]uint8
  3381. __ss_align uint32
  3382. }
  3383. gsr_source struct {
  3384. ss_family sa_family_t
  3385. __ss_padding [122]uint8
  3386. __ss_align uint32
  3387. }
  3388. } /* in.h:280:1 */
  3389. type group_filter = struct {
  3390. gf_interface uint32_t
  3391. gf_group struct {
  3392. ss_family sa_family_t
  3393. __ss_padding [122]uint8
  3394. __ss_align uint32
  3395. }
  3396. gf_fmode uint32_t
  3397. gf_numsrc uint32_t
  3398. gf_slist [1]struct {
  3399. ss_family sa_family_t
  3400. __ss_padding [122]uint8
  3401. __ss_align uint32
  3402. }
  3403. } /* in.h:286:1 */
  3404. type in_pktinfo = struct {
  3405. ipi_ifindex int32
  3406. ipi_spec_dst struct{ s_addr in_addr_t }
  3407. ipi_addr struct{ s_addr in_addr_t }
  3408. } /* in.h:297:1 */
  3409. type in6_pktinfo = struct {
  3410. ipi6_addr struct {
  3411. __in6_union struct {
  3412. _ [0]uint32
  3413. __s6_addr [16]uint8_t
  3414. }
  3415. }
  3416. ipi6_ifindex uint32
  3417. } /* in.h:303:1 */
  3418. type ip6_mtuinfo = struct {
  3419. ip6m_addr struct {
  3420. sin6_family sa_family_t
  3421. sin6_port in_port_t
  3422. sin6_flowinfo uint32_t
  3423. sin6_addr struct {
  3424. __in6_union struct {
  3425. _ [0]uint32
  3426. __s6_addr [16]uint8_t
  3427. }
  3428. }
  3429. sin6_scope_id uint32_t
  3430. }
  3431. ip6m_mtu uint32_t
  3432. } /* in.h:308:1 */
  3433. type addrinfo = struct {
  3434. ai_flags int32
  3435. ai_family int32
  3436. ai_socktype int32
  3437. ai_protocol int32
  3438. ai_addrlen socklen_t
  3439. ai_addr uintptr
  3440. ai_canonname uintptr
  3441. ai_next uintptr
  3442. } /* netdb.h:16:1 */
  3443. // Legacy functions follow (marked OBsolete in SUS)
  3444. type netent = struct {
  3445. n_name uintptr
  3446. n_aliases uintptr
  3447. n_addrtype int32
  3448. n_net uint32_t
  3449. } /* netdb.h:62:1 */
  3450. type hostent = struct {
  3451. h_name uintptr
  3452. h_aliases uintptr
  3453. h_addrtype int32
  3454. h_length int32
  3455. h_addr_list uintptr
  3456. } /* netdb.h:69:1 */
  3457. type servent = struct {
  3458. s_name uintptr
  3459. s_aliases uintptr
  3460. s_port int32
  3461. s_proto uintptr
  3462. } /* netdb.h:78:1 */
  3463. type protoent = struct {
  3464. p_name uintptr
  3465. p_aliases uintptr
  3466. p_proto int32
  3467. } /* netdb.h:85:1 */
  3468. type aibuf = struct {
  3469. ai struct {
  3470. ai_flags int32
  3471. ai_family int32
  3472. ai_socktype int32
  3473. ai_protocol int32
  3474. ai_addrlen socklen_t
  3475. ai_addr uintptr
  3476. ai_canonname uintptr
  3477. ai_next uintptr
  3478. }
  3479. sa struct {
  3480. sin struct {
  3481. sin_family sa_family_t
  3482. sin_port in_port_t
  3483. sin_addr struct{ s_addr in_addr_t }
  3484. sin_zero [8]uint8_t
  3485. }
  3486. _ [12]byte
  3487. }
  3488. lock [1]int32
  3489. slot int16
  3490. ref int16
  3491. } /* lookup.h:10:1 */
  3492. type sa = struct {
  3493. sin struct {
  3494. sin_family sa_family_t
  3495. sin_port in_port_t
  3496. sin_addr struct{ s_addr in_addr_t }
  3497. sin_zero [8]uint8_t
  3498. }
  3499. _ [12]byte
  3500. } /* lookup.h:10:1 */
  3501. type address = struct {
  3502. family int32
  3503. scopeid uint32
  3504. addr [16]uint8_t
  3505. sortkey int32
  3506. } /* lookup.h:20:1 */
  3507. type service = struct {
  3508. port uint16_t
  3509. proto uint8
  3510. socktype uint8
  3511. } /* lookup.h:27:1 */
  3512. type resolvconf = struct {
  3513. ns [3]struct {
  3514. family int32
  3515. scopeid uint32
  3516. addr [16]uint8_t
  3517. sortkey int32
  3518. }
  3519. nns uint32
  3520. attempts uint32
  3521. ndots uint32
  3522. timeout uint32
  3523. } /* lookup.h:34:1 */
  3524. func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
  3525. var cnt size_t
  3526. cnt = size_t(1)
  3527. __1:
  3528. if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) {
  3529. goto __3
  3530. }
  3531. goto __2
  3532. __2:
  3533. cnt++
  3534. p = (*addrinfo)(unsafe.Pointer(p)).ai_next
  3535. goto __1
  3536. goto __3
  3537. __3:
  3538. ;
  3539. var b uintptr = p - uintptr(uint32(uintptr(0)))
  3540. b -= 68 * uintptr((*aibuf)(unsafe.Pointer(b)).slot)
  3541. //TODO LOCK(b->lock);
  3542. if !(int32(AssignSubPtrInt16(b+66, int16(cnt))) != 0) {
  3543. Xfree(tls, b)
  3544. }
  3545. //TODO else UNLOCK(b->lock);
  3546. }
  3547. func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
  3548. bp := tls.Alloc(1608)
  3549. defer tls.Free(1608)
  3550. // var ports [2]service at bp, 8
  3551. // var addrs [48]address at bp+8, 1344
  3552. // var canon [256]uint8 at bp+1352, 256
  3553. var outcanon uintptr
  3554. var nservs int32
  3555. var naddrs int32
  3556. var nais int32
  3557. var canon_len int32
  3558. var i int32
  3559. var j int32
  3560. var k int32
  3561. var family int32 = 0
  3562. var flags int32 = 0
  3563. var proto int32 = 0
  3564. var socktype int32 = 0
  3565. var out uintptr
  3566. if !(host != 0) && !(serv != 0) {
  3567. return -2
  3568. }
  3569. if hint != 0 {
  3570. family = (*addrinfo)(unsafe.Pointer(hint)).ai_family
  3571. flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags
  3572. proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol
  3573. socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype
  3574. var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
  3575. if flags&mask != flags {
  3576. return -1
  3577. }
  3578. switch family {
  3579. case 2:
  3580. fallthrough
  3581. case 10:
  3582. fallthrough
  3583. case 0:
  3584. break
  3585. fallthrough
  3586. default:
  3587. return -6
  3588. }
  3589. }
  3590. if flags&0x20 != 0 {
  3591. Xabort(tls) //TODO-
  3592. // /* Define the "an address is configured" condition for address
  3593. // * families via ability to create a socket for the family plus
  3594. // * routability of the loopback address for the family. */
  3595. // static const struct sockaddr_in lo4 = {
  3596. // .sin_family = AF_INET, .sin_port = 65535,
  3597. // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
  3598. // ? 0x7f000001 : 0x0100007f
  3599. // };
  3600. // static const struct sockaddr_in6 lo6 = {
  3601. // .sin6_family = AF_INET6, .sin6_port = 65535,
  3602. // .sin6_addr = IN6ADDR_LOOPBACK_INIT
  3603. // };
  3604. // int tf[2] = { AF_INET, AF_INET6 };
  3605. // const void *ta[2] = { &lo4, &lo6 };
  3606. // socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
  3607. // for (i=0; i<2; i++) {
  3608. // if (family==tf[1-i]) continue;
  3609. // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
  3610. // IPPROTO_UDP);
  3611. // if (s>=0) {
  3612. // int cs;
  3613. // pthread_setcancelstate(
  3614. // PTHREAD_CANCEL_DISABLE, &cs);
  3615. // int r = connect(s, ta[i], tl[i]);
  3616. // pthread_setcancelstate(cs, 0);
  3617. // close(s);
  3618. // if (!r) continue;
  3619. // }
  3620. // switch (errno) {
  3621. // case EADDRNOTAVAIL:
  3622. // case EAFNOSUPPORT:
  3623. // case EHOSTUNREACH:
  3624. // case ENETDOWN:
  3625. // case ENETUNREACH:
  3626. // break;
  3627. // default:
  3628. // return EAI_SYSTEM;
  3629. // }
  3630. // if (family == tf[i]) return EAI_NONAME;
  3631. // family = tf[1-i];
  3632. // }
  3633. }
  3634. nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
  3635. if nservs < 0 {
  3636. return nservs
  3637. }
  3638. naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
  3639. if naddrs < 0 {
  3640. return naddrs
  3641. }
  3642. nais = nservs * naddrs
  3643. canon_len = int32(Xstrlen(tls, bp+1352))
  3644. out = Xcalloc(tls, uint32(1), uint32(nais)*uint32(unsafe.Sizeof(aibuf{}))+uint32(canon_len)+uint32(1))
  3645. if !(out != 0) {
  3646. return -10
  3647. }
  3648. if canon_len != 0 {
  3649. outcanon = out + uintptr(nais)*68
  3650. Xmemcpy(tls, outcanon, bp+1352, uint32(canon_len+1))
  3651. } else {
  3652. outcanon = uintptr(0)
  3653. }
  3654. for k = AssignInt32(&i, 0); i < naddrs; i++ {
  3655. j = 0
  3656. __1:
  3657. if !(j < nservs) {
  3658. goto __3
  3659. }
  3660. {
  3661. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).slot = int16(k)
  3662. //TODO out[k].ai = (struct addrinfo){
  3663. //TODO .ai_family = addrs[i].family,
  3664. //TODO .ai_socktype = ports[j].socktype,
  3665. //TODO .ai_protocol = ports[j].proto,
  3666. //TODO .ai_addrlen = addrs[i].family == AF_INET
  3667. //TODO ? sizeof(struct sockaddr_in)
  3668. //TODO : sizeof(struct sockaddr_in6),
  3669. //TODO .ai_addr = (void *)&out[k].sa,
  3670. //TODO .ai_canonname = outcanon };
  3671. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family
  3672. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype)
  3673. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto)
  3674. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_addrlen = func() uint32 {
  3675. if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 {
  3676. return uint32(unsafe.Sizeof(sockaddr_in{}))
  3677. }
  3678. return uint32(unsafe.Sizeof(sockaddr_in6{}))
  3679. }()
  3680. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_addr = out + uintptr(k)*68 + 32
  3681. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).ai.ai_canonname = outcanon
  3682. if k != 0 {
  3683. (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*68)).ai.ai_next = out + uintptr(k)*68
  3684. }
  3685. switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family {
  3686. case 2:
  3687. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).sin_family = sa_family_t(2)
  3688. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port)
  3689. Xmemcpy(tls, out+uintptr(k)*68+32+4, bp+8+uintptr(i)*28+8, uint32(4))
  3690. break
  3691. case 10:
  3692. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).sin6_family = sa_family_t(10)
  3693. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port)
  3694. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid
  3695. Xmemcpy(tls, out+uintptr(k)*68+32+8, bp+8+uintptr(i)*28+8, uint32(16))
  3696. break
  3697. }
  3698. }
  3699. goto __2
  3700. __2:
  3701. j++
  3702. k++
  3703. goto __1
  3704. goto __3
  3705. __3:
  3706. }
  3707. (*aibuf)(unsafe.Pointer(out)).ref = int16(nais)
  3708. *(*uintptr)(unsafe.Pointer(res)) = out
  3709. return 0
  3710. }
  3711. type ucred = struct {
  3712. pid pid_t
  3713. uid uid_t
  3714. gid gid_t
  3715. } /* socket.h:57:1 */
  3716. type mmsghdr = struct {
  3717. msg_hdr struct {
  3718. msg_name uintptr
  3719. msg_namelen socklen_t
  3720. msg_iov uintptr
  3721. msg_iovlen int32
  3722. msg_control uintptr
  3723. msg_controllen socklen_t
  3724. msg_flags int32
  3725. }
  3726. msg_len uint32
  3727. } /* socket.h:63:1 */
  3728. func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
  3729. bp := tls.Alloc(4)
  3730. defer tls.Free(4)
  3731. var size size_t = size_t(63)
  3732. // var res uintptr at bp, 4
  3733. var err int32
  3734. for ok := true; ok; ok = err == 34 {
  3735. Xfree(tls, _sh)
  3736. _sh = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  3737. if !(_sh != 0) {
  3738. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  3739. return uintptr(0)
  3740. }
  3741. err = Xgethostbyaddr_r(tls, a, l, af, _sh,
  3742. _sh+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  3743. }
  3744. if err != 0 {
  3745. return uintptr(0)
  3746. }
  3747. return _sh
  3748. }
  3749. var _sh uintptr /* gethostbyaddr.c:9:24: */
  3750. func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
  3751. bp := tls.Alloc(28)
  3752. defer tls.Free(28)
  3753. //TODO union {
  3754. //TODO struct sockaddr_in sin;
  3755. //TODO struct sockaddr_in6 sin6;
  3756. //TODO } sa = { .sin.sin_family = af };
  3757. *(*struct {
  3758. sin sockaddr_in
  3759. _ [12]byte
  3760. })(unsafe.Pointer(bp)) = struct {
  3761. sin sockaddr_in
  3762. _ [12]byte
  3763. }{} //TODO-
  3764. (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO-
  3765. var sl socklen_t
  3766. if af == 10 {
  3767. sl = uint32(unsafe.Sizeof(sockaddr_in6{}))
  3768. } else {
  3769. sl = uint32(unsafe.Sizeof(sockaddr_in{}))
  3770. }
  3771. var i int32
  3772. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  3773. // Load address argument into sockaddr structure
  3774. if af == 10 && l == socklen_t(16) {
  3775. Xmemcpy(tls, bp+8, a, uint32(16))
  3776. } else if af == 2 && l == socklen_t(4) {
  3777. Xmemcpy(tls, bp+4, a, uint32(4))
  3778. } else {
  3779. *(*int32)(unsafe.Pointer(err)) = 3
  3780. return 22
  3781. }
  3782. // Align buffer and check for space for pointers and ip address
  3783. i = int32(uintptr_t(buf) & (uint32(unsafe.Sizeof(uintptr(0))) - uint32(1)))
  3784. if !(i != 0) {
  3785. i = int32(unsafe.Sizeof(uintptr(0)))
  3786. }
  3787. if buflen <= uint32(5)*uint32(unsafe.Sizeof(uintptr(0)))-uint32(i)+l {
  3788. return 34
  3789. }
  3790. buf += uintptr(uint32(unsafe.Sizeof(uintptr(0))) - uint32(i))
  3791. buflen = buflen - (uint32(5)*uint32(unsafe.Sizeof(uintptr(0))) - uint32(i) + l)
  3792. (*hostent)(unsafe.Pointer(h)).h_addr_list = buf
  3793. buf += uintptr(uint32(2) * uint32(unsafe.Sizeof(uintptr(0))))
  3794. (*hostent)(unsafe.Pointer(h)).h_aliases = buf
  3795. buf += uintptr(uint32(2) * uint32(unsafe.Sizeof(uintptr(0))))
  3796. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf
  3797. Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, l)
  3798. buf += uintptr(l)
  3799. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*4)) = uintptr(0)
  3800. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf
  3801. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*4)) = uintptr(0)
  3802. switch Xgetnameinfo(tls, bp, sl, buf, buflen, uintptr(0), uint32(0), 0) {
  3803. case -3:
  3804. *(*int32)(unsafe.Pointer(err)) = 2
  3805. return 11
  3806. case -12:
  3807. return 34
  3808. default:
  3809. fallthrough
  3810. case -10:
  3811. fallthrough
  3812. case -11:
  3813. fallthrough
  3814. case -4:
  3815. *(*int32)(unsafe.Pointer(err)) = 3
  3816. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  3817. case 0:
  3818. break
  3819. }
  3820. (*hostent)(unsafe.Pointer(h)).h_addrtype = af
  3821. (*hostent)(unsafe.Pointer(h)).h_length = int32(l)
  3822. (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases))
  3823. *(*uintptr)(unsafe.Pointer(res)) = h
  3824. return 0
  3825. }
  3826. func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
  3827. return Xgethostbyname2(tls, name, 2)
  3828. }
  3829. func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
  3830. bp := tls.Alloc(4)
  3831. defer tls.Free(4)
  3832. var size size_t = size_t(63)
  3833. // var res uintptr at bp, 4
  3834. var err int32
  3835. for ok := true; ok; ok = err == 34 {
  3836. Xfree(tls, _sh1)
  3837. _sh1 = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  3838. if !(_sh1 != 0) {
  3839. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  3840. return uintptr(0)
  3841. }
  3842. err = Xgethostbyname2_r(tls, name, af, _sh1,
  3843. _sh1+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  3844. }
  3845. if err != 0 {
  3846. return uintptr(0)
  3847. }
  3848. return _sh1
  3849. }
  3850. var _sh1 uintptr /* gethostbyname2.c:10:24: */
  3851. func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
  3852. bp := tls.Alloc(1600)
  3853. defer tls.Free(1600)
  3854. // var addrs [48]address at bp, 1344
  3855. // var canon [256]uint8 at bp+1344, 256
  3856. var i int32
  3857. var cnt int32
  3858. var align size_t
  3859. var need size_t
  3860. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  3861. cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
  3862. if cnt < 0 {
  3863. switch cnt {
  3864. case -2:
  3865. *(*int32)(unsafe.Pointer(err)) = 1
  3866. return 2
  3867. fallthrough
  3868. case -3:
  3869. *(*int32)(unsafe.Pointer(err)) = 2
  3870. return 11
  3871. fallthrough
  3872. default:
  3873. fallthrough
  3874. case -4:
  3875. *(*int32)(unsafe.Pointer(err)) = 3
  3876. return 74
  3877. fallthrough
  3878. case -10:
  3879. fallthrough
  3880. case -11:
  3881. *(*int32)(unsafe.Pointer(err)) = 3
  3882. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  3883. }
  3884. }
  3885. (*hostent)(unsafe.Pointer(h)).h_addrtype = af
  3886. (*hostent)(unsafe.Pointer(h)).h_length = func() int32 {
  3887. if af == 10 {
  3888. return 16
  3889. }
  3890. return 4
  3891. }()
  3892. // Align buffer
  3893. align = -uintptr_t(buf) & (uint32(unsafe.Sizeof(uintptr(0))) - uint32(1))
  3894. need = uint32(4) * uint32(unsafe.Sizeof(uintptr(0)))
  3895. need = need + uint32(cnt+1)*(uint32(unsafe.Sizeof(uintptr(0)))+uint32((*hostent)(unsafe.Pointer(h)).h_length))
  3896. need = need + (Xstrlen(tls, name) + size_t(1))
  3897. need = need + (Xstrlen(tls, bp+1344) + size_t(1))
  3898. need = need + align
  3899. if need > buflen {
  3900. return 34
  3901. }
  3902. buf += uintptr(align)
  3903. (*hostent)(unsafe.Pointer(h)).h_aliases = buf
  3904. buf += uintptr(uint32(3) * uint32(unsafe.Sizeof(uintptr(0))))
  3905. (*hostent)(unsafe.Pointer(h)).h_addr_list = buf
  3906. buf += uintptr(uint32(cnt+1) * uint32(unsafe.Sizeof(uintptr(0))))
  3907. for i = 0; i < cnt; i++ {
  3908. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*4)) = buf
  3909. buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length)
  3910. Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*4)), bp+uintptr(i)*28+8, uint32((*hostent)(unsafe.Pointer(h)).h_length))
  3911. }
  3912. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*4)) = uintptr(0)
  3913. (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf)
  3914. Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344)
  3915. buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + size_t(1))
  3916. if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 {
  3917. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*4)) = buf
  3918. Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*4)), name)
  3919. buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*4))) + size_t(1))
  3920. } else {
  3921. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*4)) = uintptr(0)
  3922. }
  3923. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*4)) = uintptr(0)
  3924. *(*uintptr)(unsafe.Pointer(res)) = h
  3925. return 0
  3926. }
  3927. func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
  3928. return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
  3929. }
  3930. type if_nameindex = struct {
  3931. if_index uint32
  3932. if_name uintptr
  3933. } /* if.h:12:1 */
  3934. type ifaddr = struct {
  3935. ifa_addr struct {
  3936. sa_family sa_family_t
  3937. sa_data [14]uint8
  3938. }
  3939. ifa_ifu struct {
  3940. ifu_broadaddr struct {
  3941. sa_family sa_family_t
  3942. sa_data [14]uint8
  3943. }
  3944. }
  3945. ifa_ifp uintptr
  3946. ifa_next uintptr
  3947. } /* if.h:51:1 */
  3948. type ifmap = struct {
  3949. mem_start uint32
  3950. mem_end uint32
  3951. base_addr uint16
  3952. irq uint8
  3953. dma uint8
  3954. port uint8
  3955. _ [3]byte
  3956. } /* if.h:64:1 */
  3957. type ifreq = struct {
  3958. ifr_ifrn struct{ ifrn_name [16]uint8 }
  3959. ifr_ifru struct {
  3960. _ [0]uint32
  3961. ifru_addr struct {
  3962. sa_family sa_family_t
  3963. sa_data [14]uint8
  3964. }
  3965. }
  3966. } /* if.h:76:1 */
  3967. type ifconf = struct {
  3968. ifc_len int32
  3969. ifc_ifcu struct{ ifcu_buf uintptr }
  3970. } /* if.h:116:1 */
  3971. type ns_sect = uint32 /* nameser.h:37:3 */
  3972. type __ns_msg = struct {
  3973. _msg uintptr
  3974. _eom uintptr
  3975. _id uint16_t
  3976. _flags uint16_t
  3977. _counts [4]uint16_t
  3978. _sections [4]uintptr
  3979. _sect ns_sect
  3980. _rrnum int32
  3981. _msg_ptr uintptr
  3982. } /* nameser.h:39:9 */
  3983. type ns_msg = __ns_msg /* nameser.h:46:3 */
  3984. type _ns_flagdata = struct {
  3985. mask int32
  3986. shift int32
  3987. } /* nameser.h:48:1 */
  3988. type __ns_rr = struct {
  3989. name [1025]uint8
  3990. _ [1]byte
  3991. __type uint16_t
  3992. rr_class uint16_t
  3993. _ [2]byte
  3994. ttl uint32_t
  3995. rdlength uint16_t
  3996. _ [2]byte
  3997. rdata uintptr
  3998. } /* nameser.h:59:9 */
  3999. type ns_rr = __ns_rr /* nameser.h:66:3 */
  4000. type ns_flag = uint32 /* nameser.h:87:3 */
  4001. type ns_opcode = uint32 /* nameser.h:96:3 */
  4002. type ns_rcode = uint32 /* nameser.h:115:3 */
  4003. type ns_update_operation = uint32 /* nameser.h:121:3 */
  4004. type ns_tsig_key1 = struct {
  4005. name [1025]uint8
  4006. alg [1025]uint8
  4007. _ [2]byte
  4008. data uintptr
  4009. len int32
  4010. } /* nameser.h:123:1 */
  4011. type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
  4012. type ns_tcp_tsig_state1 = struct {
  4013. counter int32
  4014. key uintptr
  4015. ctx uintptr
  4016. sig [512]uint8
  4017. siglen int32
  4018. } /* nameser.h:130:1 */
  4019. type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
  4020. type ns_type = uint32 /* nameser.h:200:3 */
  4021. type ns_class = uint32 /* nameser.h:219:3 */
  4022. type ns_key_types = uint32 /* nameser.h:226:3 */
  4023. type ns_cert_types = uint32 /* nameser.h:234:3 */
  4024. type HEADER = struct {
  4025. _ [0]uint32
  4026. id uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */
  4027. qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
  4028. nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
  4029. } /* nameser.h:353:3 */
  4030. // unused; purely for broken apps
  4031. type __res_state = struct {
  4032. retrans int32
  4033. retry int32
  4034. options uint32
  4035. nscount int32
  4036. nsaddr_list [3]struct {
  4037. sin_family sa_family_t
  4038. sin_port in_port_t
  4039. sin_addr struct{ s_addr in_addr_t }
  4040. sin_zero [8]uint8_t
  4041. }
  4042. id uint16
  4043. _ [2]byte
  4044. dnsrch [7]uintptr
  4045. defdname [256]uint8
  4046. pfcode uint32
  4047. ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
  4048. _ [4]byte
  4049. sort_list [10]struct {
  4050. addr struct{ s_addr in_addr_t }
  4051. mask uint32_t
  4052. }
  4053. qhook uintptr
  4054. rhook uintptr
  4055. res_h_errno int32
  4056. _vcsock int32
  4057. _flags uint32
  4058. _u struct {
  4059. _ [0]uint32
  4060. pad [52]uint8
  4061. }
  4062. } /* resolv.h:26:9 */
  4063. // unused; purely for broken apps
  4064. type res_state = uintptr /* resolv.h:62:3 */
  4065. type res_sym = struct {
  4066. number int32
  4067. name uintptr
  4068. humanname uintptr
  4069. } /* resolv.h:70:1 */
  4070. func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
  4071. p += uintptr(uint32(3) * uint32(unsafe.Sizeof(int32(0))))
  4072. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0)
  4073. for ok := true; ok; ok = x != 0 {
  4074. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(uint32('0') + x%uint32(10))
  4075. x = x / uint32(10)
  4076. }
  4077. return p
  4078. }
  4079. func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
  4080. bp := tls.Alloc(32)
  4081. defer tls.Free(32)
  4082. Xsprintf(tls, s, ts+25,
  4083. VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip)))))
  4084. }
  4085. func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
  4086. var i int32
  4087. for i = 15; i >= 0; i-- {
  4088. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
  4089. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  4090. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
  4091. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  4092. }
  4093. Xstrcpy(tls, s, ts+50)
  4094. }
  4095. var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */
  4096. func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
  4097. bp := tls.Alloc(556)
  4098. defer tls.Free(556)
  4099. // var line [512]uint8 at bp+16, 512
  4100. var p uintptr
  4101. var z uintptr
  4102. var _buf [1032]uint8
  4103. _ = _buf
  4104. // var atmp [16]uint8 at bp, 16
  4105. // var iplit address at bp+528, 28
  4106. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  4107. var f uintptr = Xfopen(tls, ts+76, ts+87)
  4108. if !(f != 0) {
  4109. return
  4110. }
  4111. if family == 2 {
  4112. Xmemcpy(tls, bp+uintptr(12), a, uint32(4))
  4113. Xmemcpy(tls, bp, ts+90, uint32(12))
  4114. a = bp /* &atmp[0] */
  4115. }
  4116. for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]uint8{})), f) != 0 {
  4117. if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
  4118. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  4119. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  4120. }
  4121. for p = bp + 16; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  4122. }
  4123. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  4124. if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
  4125. continue
  4126. }
  4127. if (*address)(unsafe.Pointer(bp+528)).family == 2 {
  4128. Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint32(4))
  4129. Xmemcpy(tls, bp+528+8, ts+90, uint32(12))
  4130. (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0)
  4131. }
  4132. if Xmemcmp(tls, a, bp+528+8, uint32(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid {
  4133. continue
  4134. }
  4135. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  4136. }
  4137. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  4138. }
  4139. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  4140. if (int32(z)-int32(p))/1 < 256 {
  4141. Xmemcpy(tls, buf, p, uint32((int32(z)-int32(p))/1+1))
  4142. break
  4143. }
  4144. }
  4145. //TODO __fclose_ca(f);
  4146. Xfclose(tls, f)
  4147. }
  4148. func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
  4149. Xabort(tls) //TODO-
  4150. // unsigned long svport;
  4151. // char line[128], *p, *z;
  4152. // unsigned char _buf[1032];
  4153. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  4154. // if (!f) return;
  4155. // while (fgets(line, sizeof line, f)) {
  4156. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  4157. // for (p=line; *p && !isspace(*p); p++);
  4158. // if (!*p) continue;
  4159. // *p++ = 0;
  4160. // svport = strtoul(p, &z, 10);
  4161. // if (svport != port || z==p) continue;
  4162. // if (dgram && strncmp(z, "/udp", 4)) continue;
  4163. // if (!dgram && strncmp(z, "/tcp", 4)) continue;
  4164. // if (p-line > 32) continue;
  4165. // memcpy(buf, line, p-line);
  4166. // break;
  4167. // }
  4168. // __fclose_ca(f);
  4169. }
  4170. func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
  4171. bp := tls.Alloc(347)
  4172. defer tls.Free(347)
  4173. // var ptr [78]uint8 at bp, 78
  4174. // var buf [256]uint8 at bp+78, 256
  4175. // var num [13]uint8 at bp+334, 13
  4176. var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family)
  4177. var a uintptr
  4178. var scopeid uint32
  4179. switch af {
  4180. case 2:
  4181. a = sa1 + 4
  4182. if sl < socklen_t(unsafe.Sizeof(sockaddr_in{})) {
  4183. return -6
  4184. }
  4185. mkptr4(tls, bp, a)
  4186. scopeid = uint32(0)
  4187. break
  4188. case 10:
  4189. a = sa1 + 8
  4190. if sl < socklen_t(unsafe.Sizeof(sockaddr_in6{})) {
  4191. return -6
  4192. }
  4193. if Xmemcmp(tls, a, ts+90, uint32(12)) != 0 {
  4194. mkptr6(tls, bp, a)
  4195. } else {
  4196. mkptr4(tls, bp, a+uintptr(12))
  4197. }
  4198. scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id
  4199. break
  4200. default:
  4201. return -6
  4202. }
  4203. if node != 0 && nodelen != 0 {
  4204. *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0)
  4205. if !(flags&0x01 != 0) {
  4206. reverse_hosts(tls, bp+78, a, scopeid, af)
  4207. }
  4208. if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) {
  4209. Xabort(tls) //TODO-
  4210. // unsigned char query[18+PTR_MAX], reply[512];
  4211. // int qlen = __res_mkquery(0, ptr, 1, RR_PTR,
  4212. // 0, 0, 0, query, sizeof query);
  4213. // query[3] = 0; /* don't need AD flag */
  4214. // int rlen = __res_send(query, qlen, reply, sizeof reply);
  4215. // buf[0] = 0;
  4216. // if (rlen > 0)
  4217. // __dns_parse(reply, rlen, dns_parse_callback, buf);
  4218. }
  4219. if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) {
  4220. if flags&0x08 != 0 {
  4221. return -2
  4222. }
  4223. Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]uint8{})))
  4224. if scopeid != 0 {
  4225. Xabort(tls) //TODO-
  4226. // char *p = 0, tmp[IF_NAMESIZE+1];
  4227. // if (!(flags & NI_NUMERICSCOPE) &&
  4228. // (IN6_IS_ADDR_LINKLOCAL(a) ||
  4229. // IN6_IS_ADDR_MC_LINKLOCAL(a)))
  4230. // p = if_indextoname(scopeid, tmp+1);
  4231. // if (!p)
  4232. // p = itoa(num, scopeid);
  4233. // *--p = '%';
  4234. // strcat(buf, p);
  4235. }
  4236. }
  4237. if Xstrlen(tls, bp+78) >= nodelen {
  4238. return -12
  4239. }
  4240. Xstrcpy(tls, node, bp+78)
  4241. }
  4242. if serv != 0 && servlen != 0 {
  4243. var p uintptr = bp + 78 /* buf */
  4244. var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port))
  4245. *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0)
  4246. if !(flags&0x02 != 0) {
  4247. reverse_services(tls, bp+78, port, flags&0x10)
  4248. }
  4249. if !(int32(*(*uint8)(unsafe.Pointer(p))) != 0) {
  4250. p = itoa(tls, bp+334, uint32(port))
  4251. }
  4252. if Xstrlen(tls, p) >= servlen {
  4253. return -12
  4254. }
  4255. Xstrcpy(tls, serv, p)
  4256. }
  4257. return 0
  4258. }
  4259. var Xh_errno int32 /* h_errno.c:4:5: */
  4260. func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
  4261. return uintptr(unsafe.Pointer(&Xh_errno))
  4262. }
  4263. func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
  4264. bp := tls.Alloc(20)
  4265. defer tls.Free(20)
  4266. var s uintptr = s0
  4267. var d uintptr = dest
  4268. *(*[4]uint32)(unsafe.Pointer(bp /* a */)) = [4]uint32{0: uint32(0)}
  4269. // var z uintptr at bp+16, 4
  4270. var i int32
  4271. for i = 0; i < 4; i++ {
  4272. *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) = Xstrtoul(tls, s, bp+16, 0)
  4273. if *(*uintptr)(unsafe.Pointer(bp + 16)) == s || *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != '.' || !(func() int32 {
  4274. if 0 != 0 {
  4275. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s))))
  4276. }
  4277. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
  4278. }() != 0) {
  4279. return 0
  4280. }
  4281. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != 0) {
  4282. break
  4283. }
  4284. s = *(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(1)
  4285. }
  4286. if i == 4 {
  4287. return 0
  4288. }
  4289. switch i {
  4290. case 0:
  4291. *(*uint32)(unsafe.Pointer(bp + 1*4)) = *(*uint32)(unsafe.Pointer(bp)) & uint32(0xffffff)
  4292. AssignShrPtrUint32(bp, int(24))
  4293. fallthrough
  4294. case 1:
  4295. *(*uint32)(unsafe.Pointer(bp + 2*4)) = *(*uint32)(unsafe.Pointer(bp + 1*4)) & uint32(0xffff)
  4296. AssignShrPtrUint32(bp+1*4, int(16))
  4297. fallthrough
  4298. case 2:
  4299. *(*uint32)(unsafe.Pointer(bp + 3*4)) = *(*uint32)(unsafe.Pointer(bp + 2*4)) & uint32(0xff)
  4300. AssignShrPtrUint32(bp+2*4, int(8))
  4301. }
  4302. for i = 0; i < 4; i++ {
  4303. if *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) > uint32(255) {
  4304. return 0
  4305. }
  4306. *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)))
  4307. }
  4308. return 1
  4309. }
  4310. func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
  4311. bp := tls.Alloc(276)
  4312. defer tls.Free(276)
  4313. var a uintptr = a0
  4314. var i int32
  4315. var j int32
  4316. var max int32
  4317. var best int32
  4318. // var buf [100]uint8 at bp+176, 100
  4319. switch af {
  4320. case 2:
  4321. if socklen_t(Xsnprintf(tls, s, l, ts+103, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l {
  4322. return s
  4323. }
  4324. break
  4325. case 10:
  4326. if Xmemcmp(tls, a, ts+90, uint32(12)) != 0 {
  4327. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]uint8{})),
  4328. ts+115,
  4329. VaList(bp+32, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
  4330. 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
  4331. 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
  4332. 256*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), 256*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  4333. } else {
  4334. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]uint8{})),
  4335. ts+139,
  4336. VaList(bp+96, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
  4337. 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
  4338. 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
  4339. int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  4340. }
  4341. // Replace longest /(^0|:)[:0]{2,}/ with "::"
  4342. i = AssignInt32(&best, 0)
  4343. max = 2
  4344. for ; *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
  4345. if i != 0 && int32(*(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
  4346. continue
  4347. }
  4348. j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169))
  4349. if j > max {
  4350. best = i
  4351. max = j
  4352. }
  4353. }
  4354. if max > 3 {
  4355. *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrUint8(bp+176+uintptr(best+1), uint8(':'))
  4356. Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint32(i-best-max+1))
  4357. }
  4358. if Xstrlen(tls, bp+176) < l {
  4359. Xstrcpy(tls, s, bp+176)
  4360. return s
  4361. }
  4362. break
  4363. default:
  4364. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  4365. return uintptr(0)
  4366. }
  4367. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
  4368. return uintptr(0)
  4369. }
  4370. func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
  4371. if c-uint32('0') < uint32(10) {
  4372. return int32(c - uint32('0'))
  4373. }
  4374. c = c | uint32(32)
  4375. if c-uint32('a') < uint32(6) {
  4376. return int32(c - uint32('a') + uint32(10))
  4377. }
  4378. return -1
  4379. }
  4380. func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
  4381. bp := tls.Alloc(16)
  4382. defer tls.Free(16)
  4383. // var ip [8]uint16_t at bp, 16
  4384. var a uintptr = a0
  4385. var i int32
  4386. var j int32
  4387. var v int32
  4388. var d int32
  4389. var brk int32 = -1
  4390. var need_v4 int32 = 0
  4391. if af == 2 {
  4392. for i = 0; i < 4; i++ {
  4393. for v = AssignInt32(&j, 0); j < 3 && func() int32 {
  4394. if 0 != 0 {
  4395. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))
  4396. }
  4397. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
  4398. }() != 0; j++ {
  4399. v = 10*v + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) - '0'
  4400. }
  4401. if j == 0 || j > 1 && int32(*(*uint8)(unsafe.Pointer(s))) == '0' || v > 255 {
  4402. return 0
  4403. }
  4404. *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
  4405. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
  4406. return 1
  4407. }
  4408. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
  4409. return 0
  4410. }
  4411. s += uintptr(j + 1)
  4412. }
  4413. return 0
  4414. } else if af != 10 {
  4415. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  4416. return -1
  4417. }
  4418. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
  4419. return 0
  4420. }
  4421. for i = 0; ; i++ {
  4422. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && brk < 0 {
  4423. brk = i
  4424. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
  4425. if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
  4426. break
  4427. }
  4428. if i == 7 {
  4429. return 0
  4430. }
  4431. continue
  4432. }
  4433. for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
  4434. v = 16*v + d
  4435. }
  4436. if j == 0 {
  4437. return 0
  4438. }
  4439. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
  4440. if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
  4441. break
  4442. }
  4443. if i == 7 {
  4444. return 0
  4445. }
  4446. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
  4447. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
  4448. return 0
  4449. }
  4450. need_v4 = 1
  4451. i++
  4452. break
  4453. }
  4454. s += uintptr(j + 1)
  4455. }
  4456. if brk >= 0 {
  4457. Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint32(2*(i+1-brk)))
  4458. for j = 0; j < 7-i; j++ {
  4459. *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
  4460. }
  4461. }
  4462. for j = 0; j < 8; j++ {
  4463. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
  4464. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
  4465. }
  4466. if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
  4467. return 0
  4468. }
  4469. return 1
  4470. }
  4471. func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
  4472. bp := tls.Alloc(88)
  4473. defer tls.Free(88)
  4474. // var a4 in_addr at bp, 4
  4475. // var a6 in6_addr at bp+68, 16
  4476. if X__inet_aton(tls, name, bp) > 0 {
  4477. if family == 10 { // wrong family
  4478. return -2
  4479. }
  4480. Xmemcpy(tls, buf+8, bp, uint32(unsafe.Sizeof(in_addr{})))
  4481. (*address)(unsafe.Pointer(buf)).family = 2
  4482. (*address)(unsafe.Pointer(buf)).scopeid = uint32(0)
  4483. return 1
  4484. }
  4485. // var tmp [64]uint8 at bp+4, 64
  4486. var p uintptr = Xstrchr(tls, name, '%')
  4487. // var z uintptr at bp+84, 4
  4488. var scopeid uint64 = uint64(0)
  4489. if p != 0 && (int32(p)-int32(name))/1 < 64 {
  4490. Xmemcpy(tls, bp+4, name, uint32((int32(p)-int32(name))/1))
  4491. *(*uint8)(unsafe.Pointer(bp + 4 + uintptr((int32(p)-int32(name))/1))) = uint8(0)
  4492. name = bp + 4 /* &tmp[0] */
  4493. }
  4494. if Xinet_pton(tls, 10, name, bp+68) <= 0 {
  4495. return 0
  4496. }
  4497. if family == 2 { // wrong family
  4498. return -2
  4499. }
  4500. Xmemcpy(tls, buf+8, bp+68, uint32(unsafe.Sizeof(in6_addr{})))
  4501. (*address)(unsafe.Pointer(buf)).family = 10
  4502. if p != 0 {
  4503. if func() int32 {
  4504. if 0 != 0 {
  4505. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
  4506. }
  4507. return Bool32(uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
  4508. }() != 0 {
  4509. scopeid = Xstrtoull(tls, p, bp+84, 10)
  4510. } else {
  4511. *(*uintptr)(unsafe.Pointer(bp + 84 /* z */)) = p - uintptr(1)
  4512. }
  4513. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 84)))) != 0 {
  4514. Xabort(tls) //TODO-
  4515. // if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
  4516. // !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
  4517. // return EAI_NONAME;
  4518. // scopeid = if_nametoindex(p);
  4519. // if (!scopeid) return EAI_NONAME;
  4520. }
  4521. if scopeid > uint64(0xffffffff) {
  4522. return -2
  4523. }
  4524. }
  4525. (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid)
  4526. return 1
  4527. }
  4528. func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
  4529. var s uintptr
  4530. //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
  4531. if Xstrnlen(tls, host, uint32(255))-size_t(1) >= size_t(254) {
  4532. return 0
  4533. }
  4534. for s = host; int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80 || int32(*(*uint8)(unsafe.Pointer(s))) == '.' || int32(*(*uint8)(unsafe.Pointer(s))) == '-' || Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0; s++ {
  4535. }
  4536. return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
  4537. }
  4538. var Xzero_struct_address address /* lookup_name.c:27:16: */
  4539. func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
  4540. var cnt int32 = 0
  4541. if name != 0 {
  4542. return 0
  4543. }
  4544. if flags&0x01 != 0 {
  4545. //TODO if (family != AF_INET6)
  4546. //TODO buf[cnt++] = (struct address){ .family = AF_INET };
  4547. if family != 10 {
  4548. var x = Xzero_struct_address
  4549. x.family = 2
  4550. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  4551. }
  4552. //TODO if (family != AF_INET)
  4553. //TODO buf[cnt++] = (struct address){ .family = AF_INET6 };
  4554. if family != 2 {
  4555. var x = Xzero_struct_address
  4556. x.family = 10
  4557. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  4558. }
  4559. } else {
  4560. Xabort(tls) //TODO-
  4561. // if (family != AF_INET6)
  4562. // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
  4563. // if (family != AF_INET)
  4564. // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
  4565. }
  4566. return cnt
  4567. }
  4568. func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
  4569. return X__lookup_ipliteral(tls, buf, name, family)
  4570. }
  4571. func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
  4572. bp := tls.Alloc(512)
  4573. defer tls.Free(512)
  4574. // var line [512]uint8 at bp, 512
  4575. var l size_t = Xstrlen(tls, name)
  4576. var cnt int32 = 0
  4577. var badfam int32 = 0
  4578. var _buf [1032]uint8
  4579. _ = _buf
  4580. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  4581. var _f FILE
  4582. _ = _f
  4583. var f uintptr = Xfopen(tls, ts+76, ts+87)
  4584. if !(f != 0) {
  4585. switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
  4586. case 2:
  4587. fallthrough
  4588. case 20:
  4589. fallthrough
  4590. case 13:
  4591. return 0
  4592. fallthrough
  4593. default:
  4594. return -11
  4595. }
  4596. }
  4597. for Xfgets(tls, bp, int32(unsafe.Sizeof([512]uint8{})), f) != 0 && cnt < 48 {
  4598. var p uintptr
  4599. var z uintptr
  4600. if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
  4601. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  4602. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  4603. }
  4604. for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ {
  4605. }
  4606. if !(p != 0) {
  4607. continue
  4608. }
  4609. // Isolate IP address to parse
  4610. for p = bp; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  4611. }
  4612. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  4613. switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
  4614. case 1:
  4615. cnt++
  4616. break
  4617. case 0:
  4618. continue
  4619. default:
  4620. badfam = -2
  4621. continue
  4622. }
  4623. // Extract first name as canonical name
  4624. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  4625. }
  4626. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  4627. }
  4628. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  4629. if is_valid_hostname(tls, p) != 0 {
  4630. Xmemcpy(tls, canon, p, uint32((int32(z)-int32(p))/1+1))
  4631. }
  4632. }
  4633. //TODO __fclose_ca(f);
  4634. Xfclose(tls, f)
  4635. if cnt != 0 {
  4636. return cnt
  4637. }
  4638. return badfam
  4639. }
  4640. type dpc_ctx = struct {
  4641. addrs uintptr
  4642. canon uintptr
  4643. cnt int32
  4644. } /* lookup_name.c:112:1 */
  4645. func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
  4646. return -1 //TODO-
  4647. Xabort(tls)
  4648. return int32(0) //TODO-
  4649. // char search[256];
  4650. // struct resolvconf conf;
  4651. // size_t l, dots;
  4652. // char *p, *z;
  4653. // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
  4654. // /* Count dots, suppress search when >=ndots or name ends in
  4655. // * a dot, which is an explicit request for global scope. */
  4656. // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
  4657. // if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
  4658. // /* Strip final dot for canon, fail if multiple trailing dots. */
  4659. // if (name[l-1]=='.') l--;
  4660. // if (!l || name[l-1]=='.') return EAI_NONAME;
  4661. // /* This can never happen; the caller already checked length. */
  4662. // if (l >= 256) return EAI_NONAME;
  4663. // /* Name with search domain appended is setup in canon[]. This both
  4664. // * provides the desired default canonical name (if the requested
  4665. // * name is not a CNAME record) and serves as a buffer for passing
  4666. // * the full requested name to name_from_dns. */
  4667. // memcpy(canon, name, l);
  4668. // canon[l] = '.';
  4669. // for (p=search; *p; p=z) {
  4670. // for (; isspace(*p); p++);
  4671. // for (z=p; *z && !isspace(*z); z++);
  4672. // if (z==p) break;
  4673. // if (z-p < 256 - l - 1) {
  4674. // memcpy(canon+l+1, p, z-p);
  4675. // canon[z-p+1+l] = 0;
  4676. // int cnt = name_from_dns(buf, canon, canon, family, &conf);
  4677. // if (cnt) return cnt;
  4678. // }
  4679. // }
  4680. // canon[l] = 0;
  4681. // return name_from_dns(buf, canon, name, family, &conf);
  4682. }
  4683. type policy = struct {
  4684. addr [16]uint8
  4685. len uint8
  4686. mask uint8
  4687. prec uint8
  4688. label uint8
  4689. } /* lookup_name.c:237:14 */
  4690. var defpolicy = [6]policy{
  4691. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)},
  4692. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)},
  4693. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)},
  4694. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)},
  4695. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)},
  4696. // Last rule must match all addresses to stop loop.
  4697. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)},
  4698. } /* lookup_name.c:241:3 */
  4699. func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
  4700. var i int32
  4701. for i = 0; ; i++ {
  4702. if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint32(defpolicy[i].len)) != 0 {
  4703. continue
  4704. }
  4705. if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) !=
  4706. int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) {
  4707. continue
  4708. }
  4709. return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
  4710. }
  4711. return uintptr(0)
  4712. }
  4713. func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
  4714. return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label)
  4715. }
  4716. func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
  4717. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
  4718. return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
  4719. }
  4720. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
  4721. return 2
  4722. }
  4723. if *(*uint32_t)(unsafe.Pointer(a)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 1*4)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 2*4)) == uint32_t(0) && int32(*(*uint8_t)(unsafe.Pointer(a + 12))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 13))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 14))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 15))) == 1 {
  4724. return 2
  4725. }
  4726. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
  4727. return 5
  4728. }
  4729. return 14
  4730. }
  4731. func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
  4732. // FIXME: The common prefix length should be limited to no greater
  4733. // than the nominal length of the prefix portion of the source
  4734. // address. However the definition of the source prefix length is
  4735. // not clear and thus this limiting is not yet implemented.
  4736. var i uint32
  4737. for i = uint32(0); i < uint32(128) && !((int32(*(*uint8_t)(unsafe.Pointer(s /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8)))))^int32(*(*uint8_t)(unsafe.Pointer(d /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8))))))&(int32(128)>>(i%uint32(8))) != 0); i++ {
  4738. }
  4739. return int32(i)
  4740. }
  4741. func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
  4742. var a uintptr = _a
  4743. var b uintptr = _b
  4744. return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey
  4745. }
  4746. func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
  4747. bp := tls.Alloc(92)
  4748. defer tls.Free(92)
  4749. var cnt int32 = 0
  4750. var i int32
  4751. var j int32
  4752. _ = j
  4753. *(*uint8)(unsafe.Pointer(canon)) = uint8(0)
  4754. if name != 0 {
  4755. // reject empty name and check len so it fits into temp bufs
  4756. var l size_t = Xstrnlen(tls, name, uint32(255))
  4757. if l-size_t(1) >= size_t(254) {
  4758. return -2
  4759. }
  4760. Xmemcpy(tls, canon, name, l+size_t(1))
  4761. }
  4762. // Procedurally, a request for v6 addresses with the v4-mapped
  4763. // flag set is like a request for unspecified family, followed
  4764. // by filtering of the results.
  4765. if flags&0x08 != 0 {
  4766. if family == 10 {
  4767. family = 0
  4768. } else {
  4769. flags = flags - 0x08
  4770. }
  4771. }
  4772. // Try each backend until there's at least one result.
  4773. cnt = name_from_null(tls, buf, name, family, flags)
  4774. if !(cnt != 0) {
  4775. cnt = name_from_numeric(tls, buf, name, family)
  4776. }
  4777. if !(cnt != 0) && !(flags&0x04 != 0) {
  4778. cnt = name_from_hosts(tls, buf, canon, name, family)
  4779. if !(cnt != 0) {
  4780. cnt = name_from_dns_search(tls, buf, canon, name, family)
  4781. }
  4782. }
  4783. if cnt <= 0 {
  4784. if cnt != 0 {
  4785. return cnt
  4786. }
  4787. return -2
  4788. }
  4789. // Filter/transform results for v4-mapped lookup, if requested.
  4790. if flags&0x08 != 0 {
  4791. Xabort(tls) //TODO-
  4792. // if (!(flags & AI_ALL)) {
  4793. // /* If any v6 results exist, remove v4 results. */
  4794. // for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
  4795. // if (i<cnt) {
  4796. // for (j=0; i<cnt; i++) {
  4797. // if (buf[i].family == AF_INET6)
  4798. // buf[j++] = buf[i];
  4799. // }
  4800. // cnt = i = j;
  4801. // }
  4802. // }
  4803. // /* Translate any remaining v4 results to v6 */
  4804. // for (i=0; i<cnt; i++) {
  4805. // if (buf[i].family != AF_INET) continue;
  4806. // memcpy(buf[i].addr+12, buf[i].addr, 4);
  4807. // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
  4808. // buf[i].family = AF_INET6;
  4809. // }
  4810. }
  4811. // No further processing is needed if there are fewer than 2
  4812. // results or if there are only IPv4 results.
  4813. if cnt < 2 || family == 2 {
  4814. return cnt
  4815. }
  4816. for i = 0; i < cnt; i++ {
  4817. if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).family != 2 {
  4818. break
  4819. }
  4820. }
  4821. if i == cnt {
  4822. return cnt
  4823. }
  4824. var cs int32
  4825. _ = cs
  4826. //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
  4827. // The following implements a subset of RFC 3484/6724 destination
  4828. // address selection by generating a single 31-bit sort key for
  4829. // each address. Rules 3, 4, and 7 are omitted for having
  4830. // excessive runtime and code size cost and dubious benefit.
  4831. // So far the label/precedence table cannot be customized.
  4832. for i = 0; i < cnt; i++ {
  4833. var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).family
  4834. var key int32 = 0
  4835. *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
  4836. *(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{sin6_family: sa_family_t(10), sin6_port: in_port_t(65535), sin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).scopeid}
  4837. *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
  4838. *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{sin_family: sa_family_t(2), sin_port: in_port_t(65535)}
  4839. var sa1 uintptr
  4840. var da uintptr
  4841. // var salen socklen_t at bp+88, 4
  4842. var dalen socklen_t
  4843. if family == 10 {
  4844. Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint32(16))
  4845. da = bp /* &da6 */
  4846. dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  4847. sa1 = bp + 28 /* &sa6 */
  4848. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  4849. } else {
  4850. Xmemcpy(tls, bp+28+8,
  4851. ts+90, uint32(12))
  4852. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  4853. Xmemcpy(tls, bp+8,
  4854. ts+90, uint32(12))
  4855. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  4856. Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint32(4))
  4857. da = bp + 56 /* &da4 */
  4858. dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  4859. sa1 = bp + 72 /* &sa4 */
  4860. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  4861. }
  4862. var dpolicy uintptr = policyof(tls, bp+8)
  4863. var dscope int32 = scopeof(tls, bp+8)
  4864. var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).label)
  4865. var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).prec)
  4866. var prefixlen int32 = 0
  4867. var fd int32 = Xsocket(tls, family, 2|02000000, 17)
  4868. if fd >= 0 {
  4869. if !(Xconnect(tls, fd, da, dalen) != 0) {
  4870. key = key | 0x40000000
  4871. if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
  4872. if family == 2 {
  4873. Xmemcpy(tls,
  4874. bp+28+8+uintptr(12),
  4875. bp+72+4, uint32(4))
  4876. }
  4877. if dscope == scopeof(tls, bp+28+8) {
  4878. key = key | 0x20000000
  4879. }
  4880. if dlabel == labelof(tls, bp+28+8) {
  4881. key = key | 0x10000000
  4882. }
  4883. prefixlen = prefixmatch(tls, bp+28+8,
  4884. bp+8)
  4885. }
  4886. }
  4887. Xclose(tls, fd)
  4888. }
  4889. key = key | dprec<<20
  4890. key = key | (15-dscope)<<16
  4891. key = key | prefixlen<<8
  4892. key = key | (48-i)<<0
  4893. (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key
  4894. }
  4895. Xqsort(tls, buf, uint32(cnt), uint32(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
  4896. f func(*TLS, uintptr, uintptr) int32
  4897. }{addrcmp})))
  4898. //TODO pthread_setcancelstate(cs, 0);
  4899. return cnt
  4900. }
  4901. func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
  4902. bp := tls.Alloc(4)
  4903. defer tls.Free(4)
  4904. var line [128]uint8
  4905. _ = line
  4906. var cnt int32 = 0
  4907. var p uintptr
  4908. _ = p
  4909. *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */
  4910. var port uint32 = uint32(0)
  4911. switch socktype {
  4912. case 1:
  4913. switch proto {
  4914. case 0:
  4915. proto = 6
  4916. fallthrough
  4917. case 6:
  4918. break
  4919. default:
  4920. return -8
  4921. }
  4922. break
  4923. case 2:
  4924. switch proto {
  4925. case 0:
  4926. proto = 17
  4927. fallthrough
  4928. case 17:
  4929. break
  4930. default:
  4931. return -8
  4932. }
  4933. fallthrough
  4934. case 0:
  4935. break
  4936. default:
  4937. if name != 0 {
  4938. return -8
  4939. }
  4940. (*service)(unsafe.Pointer(buf)).port = uint16_t(0)
  4941. (*service)(unsafe.Pointer(buf)).proto = uint8(proto)
  4942. (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype)
  4943. return 1
  4944. }
  4945. if name != 0 {
  4946. if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) {
  4947. return -8
  4948. }
  4949. port = Xstrtoul(tls, name, bp, 10)
  4950. }
  4951. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
  4952. if port > uint32(65535) {
  4953. return -8
  4954. }
  4955. if proto != 17 {
  4956. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port)
  4957. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1)
  4958. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6)
  4959. }
  4960. if proto != 6 {
  4961. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port)
  4962. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2)
  4963. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17)
  4964. }
  4965. return cnt
  4966. }
  4967. if flags&0x400 != 0 {
  4968. return -2
  4969. }
  4970. var l size_t = Xstrlen(tls, name)
  4971. _ = l
  4972. Xabort(tls) //TODO-
  4973. // unsigned char _buf[1032];
  4974. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  4975. // if (!f) switch (errno) {
  4976. // case ENOENT:
  4977. // case ENOTDIR:
  4978. // case EACCES:
  4979. // return EAI_SERVICE;
  4980. // default:
  4981. // return EAI_SYSTEM;
  4982. // }
  4983. Xabort(tls) //TODO-
  4984. // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
  4985. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  4986. // /* Find service name */
  4987. // for(p=line; (p=strstr(p, name)); p++) {
  4988. // if (p>line && !isspace(p[-1])) continue;
  4989. // if (p[l] && !isspace(p[l])) continue;
  4990. // break;
  4991. // }
  4992. // if (!p) continue;
  4993. // /* Skip past canonical name at beginning of line */
  4994. // for (p=line; *p && !isspace(*p); p++);
  4995. // port = strtoul(p, &z, 10);
  4996. // if (port > 65535 || z==p) continue;
  4997. // if (!strncmp(z, "/udp", 4)) {
  4998. // if (proto == IPPROTO_TCP) continue;
  4999. // buf[cnt].port = port;
  5000. // buf[cnt].socktype = SOCK_DGRAM;
  5001. // buf[cnt++].proto = IPPROTO_UDP;
  5002. // }
  5003. // if (!strncmp(z, "/tcp", 4)) {
  5004. // if (proto == IPPROTO_UDP) continue;
  5005. // buf[cnt].port = port;
  5006. // buf[cnt].socktype = SOCK_STREAM;
  5007. // buf[cnt++].proto = IPPROTO_TCP;
  5008. // }
  5009. // }
  5010. // __fclose_ca(f);
  5011. // return cnt > 0 ? cnt : EAI_SERVICE;
  5012. Xabort(tls)
  5013. return int32(0) //TODO-
  5014. }
  5015. func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
  5016. x = x ^ x>>11
  5017. x = x ^ x<<7&0x9D2C5680
  5018. x = x ^ x<<15&0xEFC60000
  5019. x = x ^ x>>18
  5020. return x
  5021. }
  5022. func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
  5023. return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
  5024. }
  5025. func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
  5026. var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
  5027. var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
  5028. if owner&CplInt32(0x40000000) == tid {
  5029. return 0
  5030. }
  5031. owner = a_cas(tls, f+76, 0, tid)
  5032. if !(owner != 0) {
  5033. return 1
  5034. }
  5035. for AssignInt32(&owner, a_cas(tls, f+76, 0, tid|0x40000000)) != 0 {
  5036. if owner&0x40000000 != 0 || a_cas(tls, f+76, owner, owner|0x40000000) == owner {
  5037. __futexwait(tls, f+76, owner|0x40000000, 1)
  5038. }
  5039. }
  5040. return 1
  5041. }
  5042. func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
  5043. if a_swap(tls, f+76, 0)&0x40000000 != 0 {
  5044. __wake(tls, f+76, 1, 1)
  5045. }
  5046. }
  5047. func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
  5048. *(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
  5049. if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
  5050. (*struct {
  5051. f func(*TLS, uintptr, uintptr, size_t) size_t
  5052. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint32(0))
  5053. }
  5054. (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+28, AssignPtrUintptr(f+16, uintptr(0)))
  5055. if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 {
  5056. *(*uint32)(unsafe.Pointer(f)) |= uint32(32)
  5057. return -1
  5058. }
  5059. (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+8, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size))
  5060. if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 {
  5061. return -1
  5062. }
  5063. return 0
  5064. }
  5065. func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
  5066. X__builtin_abort(tls) //TODO-
  5067. // __stdio_exit_needed();
  5068. }
  5069. // This function assumes it will never be called if there is already
  5070. // data buffered for reading.
  5071. func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
  5072. bp := tls.Alloc(1)
  5073. defer tls.Free(1)
  5074. // var c uint8 at bp, 1
  5075. if !(X__toread(tls, f) != 0) && (*struct {
  5076. f func(*TLS, uintptr, uintptr, size_t) size_t
  5077. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint32(1)) == size_t(1) {
  5078. return int32(*(*uint8)(unsafe.Pointer(bp)))
  5079. }
  5080. return -1
  5081. }
  5082. func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
  5083. var ret int32
  5084. var ap va_list
  5085. _ = ap
  5086. ap = va
  5087. ret = Xvsscanf(tls, s, fmt, ap)
  5088. _ = ap
  5089. return ret
  5090. }
  5091. type wctrans_t = uintptr /* wctype.h:20:19 */
  5092. func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */
  5093. if !(dest != 0) {
  5094. return
  5095. }
  5096. switch size {
  5097. case -2:
  5098. *(*uint8)(unsafe.Pointer(dest)) = uint8(i)
  5099. break
  5100. case -1:
  5101. *(*int16)(unsafe.Pointer(dest)) = int16(i)
  5102. break
  5103. case 0:
  5104. *(*int32)(unsafe.Pointer(dest)) = int32(i)
  5105. break
  5106. case 1:
  5107. *(*int32)(unsafe.Pointer(dest)) = int32(i)
  5108. break
  5109. case 3:
  5110. *(*int64)(unsafe.Pointer(dest)) = int64(i)
  5111. break
  5112. }
  5113. }
  5114. func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
  5115. var p uintptr
  5116. var i uint32
  5117. var ap2 va_list
  5118. _ = ap2
  5119. ap2 = ap
  5120. for i = n; i > uint32(1); i-- {
  5121. VaUintptr(&ap2)
  5122. }
  5123. p = VaUintptr(&ap2)
  5124. _ = ap2
  5125. return p
  5126. }
  5127. func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
  5128. bp := tls.Alloc(276)
  5129. defer tls.Free(276)
  5130. var width int32
  5131. var size int32
  5132. var alloc int32
  5133. var base int32
  5134. var p uintptr
  5135. var c int32
  5136. var t int32
  5137. var s uintptr
  5138. var wcs uintptr
  5139. // var st mbstate_t at bp+268, 8
  5140. var dest uintptr
  5141. var invert int32
  5142. var matches int32
  5143. var x uint64
  5144. var y float64
  5145. var pos off_t
  5146. // var scanset [257]uint8 at bp, 257
  5147. var i size_t
  5148. var k size_t
  5149. // var wc wchar_t at bp+260, 4
  5150. var __need_unlock int32
  5151. var tmp uintptr
  5152. var tmp1 uintptr
  5153. alloc = 0
  5154. dest = uintptr(0)
  5155. matches = 0
  5156. pos = int64(0)
  5157. __need_unlock = func() int32 {
  5158. if (*FILE)(unsafe.Pointer(f)).lock >= 0 {
  5159. return X__lockfile(tls, f)
  5160. }
  5161. return 0
  5162. }()
  5163. if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) {
  5164. goto __1
  5165. }
  5166. X__toread(tls, f)
  5167. __1:
  5168. ;
  5169. if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) {
  5170. goto __2
  5171. }
  5172. goto input_fail
  5173. __2:
  5174. ;
  5175. p = fmt
  5176. __3:
  5177. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  5178. goto __5
  5179. }
  5180. alloc = 0
  5181. if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) {
  5182. goto __6
  5183. }
  5184. __7:
  5185. if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) {
  5186. goto __8
  5187. }
  5188. p++
  5189. goto __7
  5190. __8:
  5191. ;
  5192. X__shlim(tls, f, int64(0))
  5193. __9:
  5194. if !(__isspace(tls, func() int32 {
  5195. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5196. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5197. }
  5198. return X__shgetc(tls, f)
  5199. }()) != 0) {
  5200. goto __10
  5201. }
  5202. goto __9
  5203. __10:
  5204. ;
  5205. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5206. (*FILE)(unsafe.Pointer(f)).rpos--
  5207. } else {
  5208. }
  5209. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1))
  5210. goto __4
  5211. __6:
  5212. ;
  5213. if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') {
  5214. goto __11
  5215. }
  5216. X__shlim(tls, f, int64(0))
  5217. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') {
  5218. goto __12
  5219. }
  5220. p++
  5221. __14:
  5222. if !(__isspace(tls, AssignInt32(&c, func() int32 {
  5223. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5224. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5225. }
  5226. return X__shgetc(tls, f)
  5227. }())) != 0) {
  5228. goto __15
  5229. }
  5230. goto __14
  5231. __15:
  5232. ;
  5233. goto __13
  5234. __12:
  5235. c = func() int32 {
  5236. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5237. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5238. }
  5239. return X__shgetc(tls, f)
  5240. }()
  5241. __13:
  5242. ;
  5243. if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) {
  5244. goto __16
  5245. }
  5246. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5247. (*FILE)(unsafe.Pointer(f)).rpos--
  5248. } else {
  5249. }
  5250. if !(c < 0) {
  5251. goto __17
  5252. }
  5253. goto input_fail
  5254. __17:
  5255. ;
  5256. goto match_fail
  5257. __16:
  5258. ;
  5259. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1))
  5260. goto __4
  5261. __11:
  5262. ;
  5263. p++
  5264. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') {
  5265. goto __18
  5266. }
  5267. dest = uintptr(0)
  5268. p++
  5269. goto __19
  5270. __18:
  5271. if !(func() int32 {
  5272. if 0 != 0 {
  5273. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p))))
  5274. }
  5275. return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10))
  5276. }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') {
  5277. goto __20
  5278. }
  5279. dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0'))
  5280. p += uintptr(2)
  5281. goto __21
  5282. __20:
  5283. dest = VaUintptr(&ap)
  5284. __21:
  5285. ;
  5286. __19:
  5287. ;
  5288. width = 0
  5289. __22:
  5290. if !(func() int32 {
  5291. if 0 != 0 {
  5292. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p))))
  5293. }
  5294. return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10))
  5295. }() != 0) {
  5296. goto __24
  5297. }
  5298. width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0'
  5299. goto __23
  5300. __23:
  5301. p++
  5302. goto __22
  5303. goto __24
  5304. __24:
  5305. ;
  5306. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') {
  5307. goto __25
  5308. }
  5309. wcs = uintptr(0)
  5310. s = uintptr(0)
  5311. alloc = BoolInt32(!!(dest != 0))
  5312. p++
  5313. goto __26
  5314. __25:
  5315. alloc = 0
  5316. __26:
  5317. ;
  5318. size = 0
  5319. switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) {
  5320. case 'h':
  5321. goto __28
  5322. case 'l':
  5323. goto __29
  5324. case 'j':
  5325. goto __30
  5326. case 'z':
  5327. goto __31
  5328. case 't':
  5329. goto __32
  5330. case 'L':
  5331. goto __33
  5332. case 'd':
  5333. goto __34
  5334. case 'i':
  5335. goto __35
  5336. case 'o':
  5337. goto __36
  5338. case 'u':
  5339. goto __37
  5340. case 'x':
  5341. goto __38
  5342. case 'a':
  5343. goto __39
  5344. case 'e':
  5345. goto __40
  5346. case 'f':
  5347. goto __41
  5348. case 'g':
  5349. goto __42
  5350. case 'A':
  5351. goto __43
  5352. case 'E':
  5353. goto __44
  5354. case 'F':
  5355. goto __45
  5356. case 'G':
  5357. goto __46
  5358. case 'X':
  5359. goto __47
  5360. case 's':
  5361. goto __48
  5362. case 'c':
  5363. goto __49
  5364. case '[':
  5365. goto __50
  5366. case 'S':
  5367. goto __51
  5368. case 'C':
  5369. goto __52
  5370. case 'p':
  5371. goto __53
  5372. case 'n':
  5373. goto __54
  5374. default:
  5375. goto __55
  5376. }
  5377. goto __27
  5378. __28:
  5379. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') {
  5380. goto __56
  5381. }
  5382. p++
  5383. size = -2
  5384. goto __57
  5385. __56:
  5386. size = -1
  5387. __57:
  5388. ;
  5389. goto __27
  5390. __29:
  5391. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') {
  5392. goto __58
  5393. }
  5394. p++
  5395. size = 3
  5396. goto __59
  5397. __58:
  5398. size = 1
  5399. __59:
  5400. ;
  5401. goto __27
  5402. __30:
  5403. size = 3
  5404. goto __27
  5405. __31:
  5406. __32:
  5407. size = 1
  5408. goto __27
  5409. __33:
  5410. size = 2
  5411. goto __27
  5412. __34:
  5413. __35:
  5414. __36:
  5415. __37:
  5416. __38:
  5417. __39:
  5418. __40:
  5419. __41:
  5420. __42:
  5421. __43:
  5422. __44:
  5423. __45:
  5424. __46:
  5425. __47:
  5426. __48:
  5427. __49:
  5428. __50:
  5429. __51:
  5430. __52:
  5431. __53:
  5432. __54:
  5433. p--
  5434. goto __27
  5435. __55:
  5436. goto fmt_fail
  5437. __27:
  5438. ;
  5439. t = int32(*(*uint8)(unsafe.Pointer(p)))
  5440. // C or S
  5441. if !(t&0x2f == 3) {
  5442. goto __60
  5443. }
  5444. t = t | 32
  5445. size = 1
  5446. __60:
  5447. ;
  5448. switch t {
  5449. case 'c':
  5450. goto __62
  5451. case '[':
  5452. goto __63
  5453. case 'n':
  5454. goto __64
  5455. default:
  5456. goto __65
  5457. }
  5458. goto __61
  5459. __62:
  5460. if !(width < 1) {
  5461. goto __66
  5462. }
  5463. width = 1
  5464. __66:
  5465. ;
  5466. __63:
  5467. goto __61
  5468. __64:
  5469. store_int(tls, dest, size, uint64(pos))
  5470. // do not increment match count, etc!
  5471. goto __4
  5472. __65:
  5473. X__shlim(tls, f, int64(0))
  5474. __67:
  5475. if !(__isspace(tls, func() int32 {
  5476. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5477. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5478. }
  5479. return X__shgetc(tls, f)
  5480. }()) != 0) {
  5481. goto __68
  5482. }
  5483. goto __67
  5484. __68:
  5485. ;
  5486. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5487. (*FILE)(unsafe.Pointer(f)).rpos--
  5488. } else {
  5489. }
  5490. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1))
  5491. __61:
  5492. ;
  5493. X__shlim(tls, f, int64(width))
  5494. if !(func() int32 {
  5495. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5496. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5497. }
  5498. return X__shgetc(tls, f)
  5499. }() < 0) {
  5500. goto __69
  5501. }
  5502. goto input_fail
  5503. __69:
  5504. ;
  5505. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5506. (*FILE)(unsafe.Pointer(f)).rpos--
  5507. } else {
  5508. }
  5509. switch t {
  5510. case 's':
  5511. goto __71
  5512. case 'c':
  5513. goto __72
  5514. case '[':
  5515. goto __73
  5516. case 'p':
  5517. goto __74
  5518. case 'X':
  5519. goto __75
  5520. case 'x':
  5521. goto __76
  5522. case 'o':
  5523. goto __77
  5524. case 'd':
  5525. goto __78
  5526. case 'u':
  5527. goto __79
  5528. case 'i':
  5529. goto __80
  5530. case 'a':
  5531. goto __81
  5532. case 'A':
  5533. goto __82
  5534. case 'e':
  5535. goto __83
  5536. case 'E':
  5537. goto __84
  5538. case 'f':
  5539. goto __85
  5540. case 'F':
  5541. goto __86
  5542. case 'g':
  5543. goto __87
  5544. case 'G':
  5545. goto __88
  5546. }
  5547. goto __70
  5548. __71:
  5549. __72:
  5550. __73:
  5551. if !(t == 'c' || t == 's') {
  5552. goto __89
  5553. }
  5554. Xmemset(tls, bp, -1, uint32(unsafe.Sizeof([257]uint8{})))
  5555. *(*uint8)(unsafe.Pointer(bp)) = uint8(0)
  5556. if !(t == 's') {
  5557. goto __91
  5558. }
  5559. *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0)
  5560. *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0)
  5561. *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0)
  5562. *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0)
  5563. *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0)
  5564. *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0)
  5565. __91:
  5566. ;
  5567. goto __90
  5568. __89:
  5569. if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') {
  5570. goto __92
  5571. }
  5572. p++
  5573. invert = 1
  5574. goto __93
  5575. __92:
  5576. invert = 0
  5577. __93:
  5578. ;
  5579. Xmemset(tls, bp, invert, uint32(unsafe.Sizeof([257]uint8{})))
  5580. *(*uint8)(unsafe.Pointer(bp)) = uint8(0)
  5581. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') {
  5582. goto __94
  5583. }
  5584. p++
  5585. *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert)
  5586. goto __95
  5587. __94:
  5588. if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') {
  5589. goto __96
  5590. }
  5591. p++
  5592. *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert)
  5593. __96:
  5594. ;
  5595. __95:
  5596. ;
  5597. __97:
  5598. if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') {
  5599. goto __99
  5600. }
  5601. if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) {
  5602. goto __100
  5603. }
  5604. goto fmt_fail
  5605. __100:
  5606. ;
  5607. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') {
  5608. goto __101
  5609. }
  5610. c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1))))
  5611. __102:
  5612. if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) {
  5613. goto __104
  5614. }
  5615. *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert)
  5616. goto __103
  5617. __103:
  5618. c++
  5619. goto __102
  5620. goto __104
  5621. __104:
  5622. ;
  5623. __101:
  5624. ;
  5625. *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert)
  5626. goto __98
  5627. __98:
  5628. p++
  5629. goto __97
  5630. goto __99
  5631. __99:
  5632. ;
  5633. __90:
  5634. ;
  5635. wcs = uintptr(0)
  5636. s = uintptr(0)
  5637. i = size_t(0)
  5638. if t == 'c' {
  5639. k = uint32(width) + 1
  5640. } else {
  5641. k = uint32(31)
  5642. }
  5643. if !(size == 1) {
  5644. goto __105
  5645. }
  5646. if !(alloc != 0) {
  5647. goto __107
  5648. }
  5649. wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0))))
  5650. if !!(wcs != 0) {
  5651. goto __109
  5652. }
  5653. goto alloc_fail
  5654. __109:
  5655. ;
  5656. goto __108
  5657. __107:
  5658. wcs = dest
  5659. __108:
  5660. ;
  5661. *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{}
  5662. __110:
  5663. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5664. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5665. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5666. }
  5667. return X__shgetc(tls, f)
  5668. }())+1))) != 0) {
  5669. goto __111
  5670. }
  5671. switch Xmbrtowc(tls, bp+260, func() uintptr { *(*uint8)(unsafe.Pointer(bp + 264)) = uint8(c); return bp + 264 }(), uint32(1), bp+268 /* &st */) {
  5672. case Uint32FromInt32(-1):
  5673. goto __113
  5674. case Uint32FromInt32(-2):
  5675. goto __114
  5676. }
  5677. goto __112
  5678. __113:
  5679. goto input_fail
  5680. __114:
  5681. goto __110
  5682. __112:
  5683. ;
  5684. if !(wcs != 0) {
  5685. goto __115
  5686. }
  5687. *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint32(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */))
  5688. __115:
  5689. ;
  5690. if !(alloc != 0 && i == k) {
  5691. goto __116
  5692. }
  5693. k = k + (k + size_t(1))
  5694. tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0))))
  5695. if !!(tmp != 0) {
  5696. goto __117
  5697. }
  5698. goto alloc_fail
  5699. __117:
  5700. ;
  5701. wcs = tmp
  5702. __116:
  5703. ;
  5704. goto __110
  5705. __111:
  5706. ;
  5707. if !!(Xmbsinit(tls, bp+268) != 0) {
  5708. goto __118
  5709. }
  5710. goto input_fail
  5711. __118:
  5712. ;
  5713. goto __106
  5714. __105:
  5715. if !(alloc != 0) {
  5716. goto __119
  5717. }
  5718. s = Xmalloc(tls, k)
  5719. if !!(s != 0) {
  5720. goto __121
  5721. }
  5722. goto alloc_fail
  5723. __121:
  5724. ;
  5725. __122:
  5726. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5727. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5728. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5729. }
  5730. return X__shgetc(tls, f)
  5731. }())+1))) != 0) {
  5732. goto __123
  5733. }
  5734. *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = uint8(c)
  5735. if !(i == k) {
  5736. goto __124
  5737. }
  5738. k = k + (k + size_t(1))
  5739. tmp1 = Xrealloc(tls, s, k)
  5740. if !!(tmp1 != 0) {
  5741. goto __125
  5742. }
  5743. goto alloc_fail
  5744. __125:
  5745. ;
  5746. s = tmp1
  5747. __124:
  5748. ;
  5749. goto __122
  5750. __123:
  5751. ;
  5752. goto __120
  5753. __119:
  5754. if !(AssignUintptr(&s, dest) != 0) {
  5755. goto __126
  5756. }
  5757. __128:
  5758. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5759. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5760. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5761. }
  5762. return X__shgetc(tls, f)
  5763. }())+1))) != 0) {
  5764. goto __129
  5765. }
  5766. *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = uint8(c)
  5767. goto __128
  5768. __129:
  5769. ;
  5770. goto __127
  5771. __126:
  5772. __130:
  5773. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5774. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5775. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5776. }
  5777. return X__shgetc(tls, f)
  5778. }())+1))) != 0) {
  5779. goto __131
  5780. }
  5781. goto __130
  5782. __131:
  5783. ;
  5784. __127:
  5785. ;
  5786. __120:
  5787. ;
  5788. __106:
  5789. ;
  5790. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5791. (*FILE)(unsafe.Pointer(f)).rpos--
  5792. } else {
  5793. }
  5794. if !!((*FILE)(unsafe.Pointer(f)).shcnt+off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1) != 0) {
  5795. goto __132
  5796. }
  5797. goto match_fail
  5798. __132:
  5799. ;
  5800. if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1) != off_t(width)) {
  5801. goto __133
  5802. }
  5803. goto match_fail
  5804. __133:
  5805. ;
  5806. if !(alloc != 0) {
  5807. goto __134
  5808. }
  5809. if !(size == 1) {
  5810. goto __135
  5811. }
  5812. *(*uintptr)(unsafe.Pointer(dest)) = wcs
  5813. goto __136
  5814. __135:
  5815. *(*uintptr)(unsafe.Pointer(dest)) = s
  5816. __136:
  5817. ;
  5818. __134:
  5819. ;
  5820. if !(t != 'c') {
  5821. goto __137
  5822. }
  5823. if !(wcs != 0) {
  5824. goto __138
  5825. }
  5826. *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = wchar_t(0)
  5827. __138:
  5828. ;
  5829. if !(s != 0) {
  5830. goto __139
  5831. }
  5832. *(*uint8)(unsafe.Pointer(s + uintptr(i))) = uint8(0)
  5833. __139:
  5834. ;
  5835. __137:
  5836. ;
  5837. goto __70
  5838. __74:
  5839. __75:
  5840. __76:
  5841. base = 16
  5842. goto int_common
  5843. __77:
  5844. base = 8
  5845. goto int_common
  5846. __78:
  5847. __79:
  5848. base = 10
  5849. goto int_common
  5850. __80:
  5851. base = 0
  5852. int_common:
  5853. x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1))
  5854. if !!((*FILE)(unsafe.Pointer(f)).shcnt+off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1) != 0) {
  5855. goto __140
  5856. }
  5857. goto match_fail
  5858. __140:
  5859. ;
  5860. if !(t == 'p' && dest != 0) {
  5861. goto __141
  5862. }
  5863. *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x))
  5864. goto __142
  5865. __141:
  5866. store_int(tls, dest, size, x)
  5867. __142:
  5868. ;
  5869. goto __70
  5870. __81:
  5871. __82:
  5872. __83:
  5873. __84:
  5874. __85:
  5875. __86:
  5876. __87:
  5877. __88:
  5878. y = X__floatscan(tls, f, size, 0)
  5879. if !!((*FILE)(unsafe.Pointer(f)).shcnt+off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1) != 0) {
  5880. goto __143
  5881. }
  5882. goto match_fail
  5883. __143:
  5884. ;
  5885. if !(dest != 0) {
  5886. goto __144
  5887. }
  5888. switch size {
  5889. case 0:
  5890. goto __146
  5891. case 1:
  5892. goto __147
  5893. case 2:
  5894. goto __148
  5895. }
  5896. goto __145
  5897. __146:
  5898. *(*float32)(unsafe.Pointer(dest)) = float32(y)
  5899. goto __145
  5900. __147:
  5901. *(*float64)(unsafe.Pointer(dest)) = y
  5902. goto __145
  5903. __148:
  5904. *(*float64)(unsafe.Pointer(dest)) = y
  5905. goto __145
  5906. __145:
  5907. ;
  5908. __144:
  5909. ;
  5910. goto __70
  5911. __70:
  5912. ;
  5913. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1))
  5914. if !(dest != 0) {
  5915. goto __149
  5916. }
  5917. matches++
  5918. __149:
  5919. ;
  5920. goto __4
  5921. __4:
  5922. p++
  5923. goto __3
  5924. goto __5
  5925. __5:
  5926. ;
  5927. if !(0 != 0) {
  5928. goto __150
  5929. }
  5930. fmt_fail:
  5931. alloc_fail:
  5932. input_fail:
  5933. if !!(matches != 0) {
  5934. goto __151
  5935. }
  5936. matches--
  5937. __151:
  5938. ;
  5939. match_fail:
  5940. if !(alloc != 0) {
  5941. goto __152
  5942. }
  5943. Xfree(tls, s)
  5944. Xfree(tls, wcs)
  5945. __152:
  5946. ;
  5947. __150:
  5948. ;
  5949. __153:
  5950. if !(__need_unlock != 0) {
  5951. goto __156
  5952. }
  5953. X__unlockfile(tls, f)
  5954. __156:
  5955. ;
  5956. goto __154
  5957. __154:
  5958. if 0 != 0 {
  5959. goto __153
  5960. }
  5961. goto __155
  5962. __155:
  5963. ;
  5964. return matches
  5965. }
  5966. func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */
  5967. var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie
  5968. var k size_t = len + size_t(256)
  5969. var end uintptr = Xmemchr(tls, src, 0, k)
  5970. if end != 0 {
  5971. k = size_t((int32(end) - int32(src)) / 1)
  5972. }
  5973. if k < len {
  5974. len = k
  5975. }
  5976. Xmemcpy(tls, buf, src, len)
  5977. (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len)
  5978. (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k)
  5979. (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k)
  5980. return len
  5981. }
  5982. func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
  5983. bp := tls.Alloc(144)
  5984. defer tls.Free(144)
  5985. *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct {
  5986. f func(*TLS, uintptr, uintptr, size_t) size_t
  5987. }{string_read})), buf: s, lock: -1, cookie: s}
  5988. return Xvfscanf(tls, bp, fmt, ap)
  5989. }
  5990. func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
  5991. var try uintptr
  5992. var sign int32
  5993. for nel > size_t(0) {
  5994. try = base + uintptr(width*(nel/size_t(2)))
  5995. sign = (*struct {
  5996. f func(*TLS, uintptr, uintptr) int32
  5997. })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
  5998. if sign < 0 {
  5999. nel = nel / size_t(2)
  6000. } else if sign > 0 {
  6001. base = try + uintptr(width)
  6002. nel = nel - (nel/size_t(2) + size_t(1))
  6003. } else {
  6004. return try
  6005. }
  6006. }
  6007. return uintptr(0)
  6008. }
  6009. func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
  6010. bp := tls.Alloc(144)
  6011. defer tls.Free(144)
  6012. // var f FILE at bp, 144
  6013. (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+4, s)
  6014. (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1)
  6015. X__shlim(tls, bp, int64(0))
  6016. var y float64 = X__floatscan(tls, bp, prec, 1)
  6017. var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).rpos)-int32((*FILE)(unsafe.Pointer(bp)).buf))/1)
  6018. if p != 0 {
  6019. *(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
  6020. if cnt != 0 {
  6021. return s + uintptr(cnt)
  6022. }
  6023. return s
  6024. }()
  6025. }
  6026. return y
  6027. }
  6028. func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
  6029. return float32(strtox(tls, s, p, 0))
  6030. }
  6031. func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
  6032. return strtox(tls, s, p, 1)
  6033. }
  6034. func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
  6035. return strtox(tls, s, p, 2)
  6036. }
  6037. func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
  6038. bp := tls.Alloc(144)
  6039. defer tls.Free(144)
  6040. // var f FILE at bp, 144
  6041. (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+4, s)
  6042. (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1)
  6043. X__shlim(tls, bp, int64(0))
  6044. var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
  6045. if p != 0 {
  6046. var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).rpos)-int32((*FILE)(unsafe.Pointer(bp)).buf))/1))
  6047. *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
  6048. }
  6049. return y
  6050. }
  6051. func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
  6052. return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
  6053. }
  6054. func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
  6055. return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
  6056. }
  6057. func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
  6058. return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
  6059. }
  6060. func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
  6061. return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
  6062. }
  6063. func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
  6064. return Xstrtoll(tls, s, p, base)
  6065. }
  6066. func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
  6067. return Xstrtoull(tls, s, p, base)
  6068. }
  6069. func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
  6070. var l size_t = Xstrlen(tls, s)
  6071. var d uintptr = Xmalloc(tls, l+size_t(1))
  6072. if !(d != 0) {
  6073. return uintptr(0)
  6074. }
  6075. return Xmemcpy(tls, d, s, l+size_t(1))
  6076. }
  6077. func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
  6078. var l size_t = Xstrnlen(tls, d, n)
  6079. if l == n {
  6080. return l + Xstrlen(tls, s)
  6081. }
  6082. return l + Xstrlcpy(tls, d+uintptr(l), s, n-l)
  6083. }
  6084. // Support signed or unsigned plain-char
  6085. // Implementation choices...
  6086. // Arbitrary numbers...
  6087. // POSIX/SUS requirements follow. These numbers come directly
  6088. // from SUS and have nothing to do with the host system.
  6089. func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
  6090. var d0 uintptr
  6091. var wd uintptr
  6092. var ws uintptr
  6093. d0 = d
  6094. if !!(int32(PostDecUint32(&n, 1)) != 0) {
  6095. goto __1
  6096. }
  6097. goto finish
  6098. __1:
  6099. ;
  6100. if !(uintptr_t(s)&(uint32(unsafe.Sizeof(size_t(0)))-uint32(1)) == uintptr_t(d)&(uint32(unsafe.Sizeof(size_t(0)))-uint32(1))) {
  6101. goto __2
  6102. }
  6103. __3:
  6104. if !(uintptr_t(s)&(uint32(unsafe.Sizeof(size_t(0)))-uint32(1)) != 0 && n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) {
  6105. goto __5
  6106. }
  6107. goto __4
  6108. __4:
  6109. n--
  6110. s++
  6111. d++
  6112. goto __3
  6113. goto __5
  6114. __5:
  6115. ;
  6116. if !(n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0) {
  6117. goto __6
  6118. }
  6119. wd = d
  6120. ws = s
  6121. __7:
  6122. if !(n >= size_t(unsafe.Sizeof(size_t(0))) && !((*(*uint32)(unsafe.Pointer(ws))-Uint32(Uint32FromInt32(-1))/size_t(255)) & ^*(*uint32)(unsafe.Pointer(ws)) & (Uint32(Uint32FromInt32(-1))/size_t(255)*size_t(255/2+1)) != 0)) {
  6123. goto __9
  6124. }
  6125. *(*size_t)(unsafe.Pointer(wd)) = *(*uint32)(unsafe.Pointer(ws))
  6126. goto __8
  6127. __8:
  6128. n = n - size_t(unsafe.Sizeof(size_t(0)))
  6129. ws += 4
  6130. wd += 4
  6131. goto __7
  6132. goto __9
  6133. __9:
  6134. ;
  6135. d = wd
  6136. s = ws
  6137. __6:
  6138. ;
  6139. __2:
  6140. ;
  6141. __10:
  6142. if !(n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) {
  6143. goto __12
  6144. }
  6145. goto __11
  6146. __11:
  6147. n--
  6148. s++
  6149. d++
  6150. goto __10
  6151. goto __12
  6152. __12:
  6153. ;
  6154. *(*uint8)(unsafe.Pointer(d)) = uint8(0)
  6155. finish:
  6156. return size_t((int32(d)-int32(d0))/1) + Xstrlen(tls, s)
  6157. }
  6158. func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
  6159. var l uintptr = _l
  6160. var r uintptr = _r
  6161. if !(int32(PostDecUint32(&n, 1)) != 0) {
  6162. return 0
  6163. }
  6164. __1:
  6165. if !(*(*uint8)(unsafe.Pointer(l)) != 0 && *(*uint8)(unsafe.Pointer(r)) != 0 && n != 0 && (int32(*(*uint8)(unsafe.Pointer(l))) == int32(*(*uint8)(unsafe.Pointer(r))) || Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) == Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))))) {
  6166. goto __3
  6167. }
  6168. goto __2
  6169. __2:
  6170. l++
  6171. r++
  6172. n--
  6173. goto __1
  6174. goto __3
  6175. __3:
  6176. ;
  6177. return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r))))
  6178. }
  6179. func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
  6180. return Xstrncasecmp(tls, l, r, n)
  6181. }
  6182. func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
  6183. var a uintptr = d
  6184. d += uintptr(Xstrlen(tls, d))
  6185. for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
  6186. n--
  6187. *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))
  6188. }
  6189. *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = uint8(0)
  6190. return a
  6191. }
  6192. func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
  6193. var p uintptr = Xmemchr(tls, s, 0, n)
  6194. if p != 0 {
  6195. return uint32((int32(p) - int32(s)) / 1)
  6196. }
  6197. return n
  6198. }
  6199. func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
  6200. bp := tls.Alloc(32)
  6201. defer tls.Free(32)
  6202. var a uintptr = s
  6203. *(*[8]size_t)(unsafe.Pointer(bp /* byteset */)) = [8]size_t{0: size_t(0)}
  6204. if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) {
  6205. return size_t(0)
  6206. }
  6207. if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) {
  6208. for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ {
  6209. }
  6210. return size_t((int32(s) - int32(a)) / 1)
  6211. }
  6212. for ; *(*uint8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint32(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4, size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; c++ {
  6213. }
  6214. for ; *(*uint8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4))&(size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; s++ {
  6215. }
  6216. return size_t((int32(s) - int32(a)) / 1)
  6217. }
  6218. func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
  6219. if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
  6220. return uintptr(0)
  6221. }
  6222. s += uintptr(Xstrspn(tls, s, sep))
  6223. if !(int32(*(*uint8)(unsafe.Pointer(s))) != 0) {
  6224. return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0))
  6225. }
  6226. _sp = s + uintptr(Xstrcspn(tls, s, sep))
  6227. if *(*uint8)(unsafe.Pointer(_sp)) != 0 {
  6228. *(*uint8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = uint8(0)
  6229. } else {
  6230. _sp = uintptr(0)
  6231. }
  6232. return s
  6233. }
  6234. var _sp uintptr /* strtok.c:5:14: */
  6235. func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
  6236. return *(*int32)(unsafe.Pointer(a + 3*4))
  6237. }
  6238. func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
  6239. *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 3*4))
  6240. return 0
  6241. }
  6242. //
  6243. // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
  6244. // {
  6245. // *size = a->_a_guardsize;
  6246. // return 0;
  6247. // }
  6248. //
  6249. // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit)
  6250. // {
  6251. // *inherit = a->_a_sched;
  6252. // return 0;
  6253. // }
  6254. //
  6255. // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param)
  6256. // {
  6257. // param->sched_priority = a->_a_prio;
  6258. // return 0;
  6259. // }
  6260. //
  6261. // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy)
  6262. // {
  6263. // *policy = a->_a_policy;
  6264. // return 0;
  6265. // }
  6266. //
  6267. // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope)
  6268. // {
  6269. // *scope = PTHREAD_SCOPE_SYSTEM;
  6270. // return 0;
  6271. // }
  6272. //
  6273. // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size)
  6274. // {
  6275. // if (!a->_a_stackaddr)
  6276. // return EINVAL;
  6277. // *size = a->_a_stacksize;
  6278. // *addr = (void *)(a->_a_stackaddr - *size);
  6279. // return 0;
  6280. // }
  6281. //
  6282. // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
  6283. // {
  6284. // *size = a->_a_stacksize;
  6285. // return 0;
  6286. // }
  6287. //
  6288. // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared)
  6289. // {
  6290. // *pshared = !!a->__attr;
  6291. // return 0;
  6292. // }
  6293. //
  6294. // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk)
  6295. // {
  6296. // *clk = a->__attr & 0x7fffffff;
  6297. // return 0;
  6298. // }
  6299. //
  6300. // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared)
  6301. // {
  6302. // *pshared = a->__attr>>31;
  6303. // return 0;
  6304. // }
  6305. //
  6306. // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
  6307. // {
  6308. // *protocol = PTHREAD_PRIO_NONE;
  6309. // return 0;
  6310. // }
  6311. // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared)
  6312. // {
  6313. // *pshared = a->__attr / 128U % 2;
  6314. // return 0;
  6315. // }
  6316. //
  6317. // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust)
  6318. // {
  6319. // *robust = a->__attr / 4U % 2;
  6320. // return 0;
  6321. // }
  6322. func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
  6323. return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
  6324. }
  6325. // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type)
  6326. // {
  6327. // *type = a->__attr & 3;
  6328. // return 0;
  6329. // }
  6330. //
  6331. // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared)
  6332. // {
  6333. // *pshared = a->__attr[0];
  6334. // return 0;
  6335. // }
  6336. func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
  6337. if uint32(state) > 1 {
  6338. return 22
  6339. }
  6340. *(*int32)(unsafe.Pointer(a + 3*4)) = state
  6341. return 0
  6342. }
  6343. func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
  6344. return *(*int32)(unsafe.Pointer(m)) & 15
  6345. }
  6346. // int __pthread_mutex_lock(pthread_mutex_t *m)
  6347. // {
  6348. // if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
  6349. // && !a_cas(&m->_m_lock, 0, EBUSY))
  6350. // return 0;
  6351. //
  6352. // return __pthread_mutex_timedlock(m, 0);
  6353. // }
  6354. //
  6355. // weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
  6356. func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
  6357. return 0
  6358. }
  6359. func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
  6360. *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
  6361. return 0
  6362. }
  6363. func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
  6364. if uint32(type1) > uint32(2) {
  6365. return 22
  6366. }
  6367. (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1)
  6368. return 0
  6369. }
  6370. func init() {
  6371. *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45:
  6372. }
  6373. var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00.\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  6374. var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data