musl_linux_386.go 190 KB

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