musl_linux_arm64.go 192 KB

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