musl_linux_s390x.go 188 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968
  1. // Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_s390x.go -pkgname libc -static-locals-prefix _s -Iarch/s390x -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 = int32 /* <builtin>:15:24 */
  348. type uint16_t = uint16 /* alltypes.h:113:25 */
  349. type uint32_t = uint32 /* alltypes.h:118:25 */
  350. type uint64_t = uint64 /* alltypes.h:123: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), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200),
  360. uint16(0x200), uint16(0x320), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x200), uint16(0x200),
  361. uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200),
  362. uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200),
  363. uint16(0x160), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0),
  364. uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0),
  365. uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8),
  366. uint16(0x8d8), uint16(0x8d8), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0),
  367. uint16(0x4c0), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8c5),
  368. uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5),
  369. uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5),
  370. uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0),
  371. uint16(0x4c0), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8c6),
  372. uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6),
  373. uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6),
  374. uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x200),
  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:330:9 */
  388. type locale_t = uintptr /* alltypes.h:330: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:149:16 */
  447. type ino_t = uint64 /* alltypes.h:154: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:52:15 */
  466. type intptr_t = int64 /* alltypes.h:57:15 */
  467. type pid_t = int32 /* alltypes.h:222:13 */
  468. type uid_t = uint32 /* alltypes.h:232:18 */
  469. type gid_t = uint32 /* alltypes.h:237:18 */
  470. type useconds_t = uint32 /* alltypes.h:247: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:139:18 */
  489. type iovec = struct {
  490. iov_base uintptr
  491. iov_len size_t
  492. } /* alltypes.h:342: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|0200000|02000000, 0)) < 0 {
  516. return uintptr(0)
  517. }
  518. if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint64(1), uint64(unsafe.Sizeof(DIR{}))))) != 0) {
  519. __syscall1(tls, int64(6), 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:28: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(__syscall3(tls, int64(220), 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:42:24 */
  549. type int8_t = int8 /* alltypes.h:83:25 */
  550. type int16_t = int16 /* alltypes.h:88:25 */
  551. type int32_t = int32 /* alltypes.h:93:25 */
  552. type int64_t = int64 /* alltypes.h:98:25 */
  553. type intmax_t = int64 /* alltypes.h:103:25 */
  554. type uint8_t = uint8 /* alltypes.h:108:25 */
  555. type uintmax_t = uint64 /* alltypes.h:133: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:307:9 */
  607. type FILE = _IO_FILE /* alltypes.h:307:25 */
  608. type va_list = uintptr /* alltypes.h:313: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 = float64 /* alltypes.h:17:16 */
  615. type double_t = float64 /* alltypes.h:22: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:260: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:330: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:72:16 */
  1917. type clockid_t = int32 /* alltypes.h:201:13 */
  1918. type timespec = struct {
  1919. tv_sec time_t
  1920. tv_nsec int64
  1921. } /* alltypes.h:216:1 */
  1922. type pthread_t = uintptr /* alltypes.h:260:26 */
  1923. type pthread_once_t = int32 /* alltypes.h:266:13 */
  1924. type pthread_key_t = uint32 /* alltypes.h:271:18 */
  1925. type pthread_spinlock_t = int32 /* alltypes.h:276:13 */
  1926. type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:281:37 */
  1927. type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:286:37 */
  1928. type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:291:37 */
  1929. type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:296:40 */
  1930. type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:336:9 */
  1931. type sigset_t = __sigset_t /* alltypes.h:336:71 */
  1932. type pthread_attr_t = struct {
  1933. __u struct {
  1934. _ [0]uint64
  1935. __i [14]int32
  1936. }
  1937. } /* alltypes.h:359:147 */
  1938. type pthread_mutex_t = struct {
  1939. __u struct {
  1940. _ [0]uint64
  1941. __i [10]int32
  1942. }
  1943. } /* alltypes.h:364:157 */
  1944. type pthread_cond_t = struct {
  1945. __u struct {
  1946. _ [0]uint64
  1947. __i [12]int32
  1948. }
  1949. } /* alltypes.h:374:112 */
  1950. type pthread_rwlock_t = struct {
  1951. __u struct {
  1952. _ [0]uint64
  1953. __i [14]int32
  1954. }
  1955. } /* alltypes.h:384:139 */
  1956. type pthread_barrier_t = struct {
  1957. __u struct {
  1958. _ [0]uint64
  1959. __i [8]int32
  1960. }
  1961. } /* alltypes.h:389: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:196:14 */
  1973. type clock_t = int64 /* alltypes.h:206: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:260: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:11:23 */
  2023. type gregset_t = [27]uint64 /* signal.h:11:31 */
  2024. type fpreg_t = struct{ d float64 } /* signal.h:21:3 */
  2025. type fpregset_t = struct {
  2026. fpc uint32
  2027. _ [4]byte
  2028. fprs [16]fpreg_t
  2029. } /* signal.h:26:3 */
  2030. type mcontext_t = struct {
  2031. psw struct {
  2032. mask uint64
  2033. addr uint64
  2034. }
  2035. gregs [16]uint64
  2036. aregs [16]uint32
  2037. fpregs fpregset_t
  2038. } /* signal.h:34:3 */
  2039. type sigcontext = struct {
  2040. oldmask [1]uint64
  2041. sregs uintptr
  2042. } /* signal.h:36:1 */
  2043. type __ucontext = struct {
  2044. uc_flags uint64
  2045. uc_link uintptr
  2046. uc_stack stack_t
  2047. uc_mcontext mcontext_t
  2048. uc_sigmask sigset_t
  2049. } /* signal.h:67:9 */
  2050. type ucontext_t = __ucontext /* signal.h:73:3 */
  2051. type sigval = struct {
  2052. _ [0]uint64
  2053. sival_int int32
  2054. _ [4]byte
  2055. } /* time.h:107:1 */
  2056. type siginfo_t = struct {
  2057. si_signo int32
  2058. si_errno int32
  2059. si_code int32
  2060. _ [4]byte
  2061. __si_fields struct {
  2062. _ [0]uint64
  2063. __pad [112]uint8
  2064. }
  2065. } /* signal.h:145:3 */
  2066. type sigaction = struct {
  2067. __sa_handler struct{ sa_handler uintptr }
  2068. sa_mask sigset_t
  2069. sa_flags int32
  2070. _ [4]byte
  2071. sa_restorer uintptr
  2072. } /* signal.h:167:1 */
  2073. type sig_t = uintptr /* signal.h:251:14 */
  2074. type sig_atomic_t = int32 /* signal.h:269:13 */
  2075. func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */
  2076. panic(`arch/s390x/atomic_arch.h:4:2: assembler statements not supported`)
  2077. return t
  2078. }
  2079. func a_barrier(tls *TLS) { /* atomic_arch.h:21:20: */
  2080. panic(`arch/s390x/atomic_arch.h:23:2: assembler statements not supported`)
  2081. }
  2082. func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:108:19: */
  2083. var old int32
  2084. for ok := true; ok; ok = a_cas(tls, p, old, v) != old {
  2085. old = *(*int32)(unsafe.Pointer(p))
  2086. }
  2087. return old
  2088. }
  2089. func a_fetch_add(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:119:19: */
  2090. var old int32
  2091. for ok := true; ok; ok = a_cas(tls, p, old, int32(uint32(old)+uint32(v))) != old {
  2092. old = *(*int32)(unsafe.Pointer(p))
  2093. }
  2094. return old
  2095. }
  2096. func a_fetch_and(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:130:19: */
  2097. var old int32
  2098. for ok := true; ok; ok = a_cas(tls, p, old, old&v) != old {
  2099. old = *(*int32)(unsafe.Pointer(p))
  2100. }
  2101. return old
  2102. }
  2103. func a_fetch_or(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:140:19: */
  2104. var old int32
  2105. for ok := true; ok; ok = a_cas(tls, p, old, old|v) != old {
  2106. old = *(*int32)(unsafe.Pointer(p))
  2107. }
  2108. return old
  2109. }
  2110. func a_and(tls *TLS, p uintptr, v int32) { /* atomic.h:151:20: */
  2111. a_fetch_and(tls, p, v)
  2112. }
  2113. func a_or(tls *TLS, p uintptr, v int32) { /* atomic.h:159:20: */
  2114. a_fetch_or(tls, p, v)
  2115. }
  2116. func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */
  2117. bp := tls.Alloc(8)
  2118. defer tls.Free(8)
  2119. *(*struct{ v uint64_t })(unsafe.Pointer(bp)) = func() (r struct{ v uint64_t }) {
  2120. *(*uint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = v
  2121. return r
  2122. }()
  2123. if *(*uint32_t)(unsafe.Pointer(bp)) != 0 {
  2124. a_or(tls, p, int32(*(*uint32_t)(unsafe.Pointer(bp))))
  2125. }
  2126. if *(*uint32_t)(unsafe.Pointer(bp + 1*4)) != 0 {
  2127. a_or(tls, p+uintptr(1)*4, int32(*(*uint32_t)(unsafe.Pointer(bp + 1*4))))
  2128. }
  2129. }
  2130. func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */
  2131. return int32(_sdebruijn328[x&-x*uint32_t(0x076be629)>>27])
  2132. }
  2133. var _sdebruijn328 = [32]uint8{
  2134. 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),
  2135. 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),
  2136. } /* atomic.h:261:20 */
  2137. func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */
  2138. if uint64(unsafe.Sizeof(int64(0))) < uint64(8) {
  2139. var y uint32_t = uint32_t(x)
  2140. if !(y != 0) {
  2141. y = uint32_t(x >> 32)
  2142. return 32 + a_ctz_32(tls, y)
  2143. }
  2144. return a_ctz_32(tls, y)
  2145. }
  2146. return int32(_sdebruijn648[uint64(x&-x)*0x022fdd63cc95386d>>58])
  2147. }
  2148. var _sdebruijn648 = [64]uint8{
  2149. uint8(0), uint8(1), uint8(2), uint8(53), uint8(3), uint8(7), uint8(54), uint8(27), uint8(4), uint8(38), uint8(41), uint8(8), uint8(34), uint8(55), uint8(48), uint8(28),
  2150. uint8(62), uint8(5), uint8(39), uint8(46), uint8(44), uint8(42), uint8(22), uint8(9), uint8(24), uint8(35), uint8(59), uint8(56), uint8(49), uint8(18), uint8(29), uint8(11),
  2151. uint8(63), uint8(52), uint8(6), uint8(26), uint8(37), uint8(40), uint8(33), uint8(47), uint8(61), uint8(45), uint8(43), uint8(21), uint8(23), uint8(58), uint8(17), uint8(10),
  2152. uint8(51), uint8(25), uint8(36), uint8(32), uint8(60), uint8(20), uint8(57), uint8(16), uint8(50), uint8(31), uint8(19), uint8(15), uint8(30), uint8(14), uint8(13), uint8(12),
  2153. } /* atomic.h:274:20 */
  2154. type __timer = struct {
  2155. timerid int32
  2156. _ [4]byte
  2157. thread pthread_t
  2158. } /* pthread_impl.h:64:1 */
  2159. func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */
  2160. var self uintptr
  2161. panic(`arch/s390x/pthread_arch.h:4:2: assembler statements not supported`)
  2162. return self
  2163. }
  2164. func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */
  2165. if priv != 0 {
  2166. priv = 128
  2167. }
  2168. if cnt < 0 {
  2169. cnt = 0x7fffffff
  2170. }
  2171. _ = Bool32(__syscall3(tls, int64(238), int64(addr), int64(1|priv), int64(cnt)) != int64(-38) || __syscall3(tls, int64(238), int64(addr), int64(1), int64(cnt)) != 0)
  2172. }
  2173. func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */
  2174. if priv != 0 {
  2175. priv = 128
  2176. }
  2177. _ = Bool32(__syscall4(tls, int64(238), int64(addr), int64(0|priv), int64(val), int64(0)) != int64(-38) || __syscall4(tls, int64(238), int64(addr), int64(0), int64(val), int64(0)) != 0)
  2178. }
  2179. var X__fsmu8 = [51]uint32_t{
  2180. func() uint32 {
  2181. if 0x2 < 2 {
  2182. return Uint32FromInt32(-1)
  2183. }
  2184. return func() uint32 {
  2185. if Int32(0x80) == Int32(0x80) {
  2186. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2187. }
  2188. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2189. }()<<23 | uint32_t(0x2)
  2190. }(), func() uint32 {
  2191. if 0x3 < 2 {
  2192. return Uint32FromInt32(-1)
  2193. }
  2194. return func() uint32 {
  2195. if Int32(0x80) == Int32(0x80) {
  2196. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2197. }
  2198. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2199. }()<<23 | uint32_t(0x3)
  2200. }(), func() uint32 {
  2201. if 0x4 < 2 {
  2202. return Uint32FromInt32(-1)
  2203. }
  2204. return func() uint32 {
  2205. if Int32(0x80) == Int32(0x80) {
  2206. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2207. }
  2208. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2209. }()<<23 | uint32_t(0x4)
  2210. }(), func() uint32 {
  2211. if 0x5 < 2 {
  2212. return Uint32FromInt32(-1)
  2213. }
  2214. return func() uint32 {
  2215. if Int32(0x80) == Int32(0x80) {
  2216. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2217. }
  2218. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2219. }()<<23 | uint32_t(0x5)
  2220. }(), func() uint32 {
  2221. if 0x6 < 2 {
  2222. return Uint32FromInt32(-1)
  2223. }
  2224. return func() uint32 {
  2225. if Int32(0x80) == Int32(0x80) {
  2226. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2227. }
  2228. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2229. }()<<23 | uint32_t(0x6)
  2230. }(), func() uint32 {
  2231. if 0x7 < 2 {
  2232. return Uint32FromInt32(-1)
  2233. }
  2234. return func() uint32 {
  2235. if Int32(0x80) == Int32(0x80) {
  2236. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2237. }
  2238. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2239. }()<<23 | uint32_t(0x7)
  2240. }(),
  2241. func() uint32 {
  2242. if 0x8 < 2 {
  2243. return Uint32FromInt32(-1)
  2244. }
  2245. return func() uint32 {
  2246. if Int32(0x80) == Int32(0x80) {
  2247. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2248. }
  2249. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2250. }()<<23 | uint32_t(0x8)
  2251. }(), func() uint32 {
  2252. if 0x9 < 2 {
  2253. return Uint32FromInt32(-1)
  2254. }
  2255. return func() uint32 {
  2256. if Int32(0x80) == Int32(0x80) {
  2257. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2258. }
  2259. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2260. }()<<23 | uint32_t(0x9)
  2261. }(), func() uint32 {
  2262. if 0xa < 2 {
  2263. return Uint32FromInt32(-1)
  2264. }
  2265. return func() uint32 {
  2266. if Int32(0x80) == Int32(0x80) {
  2267. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2268. }
  2269. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2270. }()<<23 | uint32_t(0xa)
  2271. }(), func() uint32 {
  2272. if 0xb < 2 {
  2273. return Uint32FromInt32(-1)
  2274. }
  2275. return func() uint32 {
  2276. if Int32(0x80) == Int32(0x80) {
  2277. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2278. }
  2279. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2280. }()<<23 | uint32_t(0xb)
  2281. }(), func() uint32 {
  2282. if 0xc < 2 {
  2283. return Uint32FromInt32(-1)
  2284. }
  2285. return func() uint32 {
  2286. if Int32(0x80) == Int32(0x80) {
  2287. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2288. }
  2289. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2290. }()<<23 | uint32_t(0xc)
  2291. }(), func() uint32 {
  2292. if 0xd < 2 {
  2293. return Uint32FromInt32(-1)
  2294. }
  2295. return func() uint32 {
  2296. if Int32(0x80) == Int32(0x80) {
  2297. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2298. }
  2299. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2300. }()<<23 | uint32_t(0xd)
  2301. }(), func() uint32 {
  2302. if 0xe < 2 {
  2303. return Uint32FromInt32(-1)
  2304. }
  2305. return func() uint32 {
  2306. if Int32(0x80) == Int32(0x80) {
  2307. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2308. }
  2309. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2310. }()<<23 | uint32_t(0xe)
  2311. }(), func() uint32 {
  2312. if 0xf < 2 {
  2313. return Uint32FromInt32(-1)
  2314. }
  2315. return func() uint32 {
  2316. if Int32(0x80) == Int32(0x80) {
  2317. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2318. }
  2319. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2320. }()<<23 | uint32_t(0xf)
  2321. }(),
  2322. func() uint32 {
  2323. if 0x0+16 < 2 {
  2324. return Uint32FromInt32(-1)
  2325. }
  2326. return func() uint32 {
  2327. if Int32(0x80) == Int32(0x80) {
  2328. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2329. }
  2330. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2331. }()<<23 | uint32_t(0x0+16)
  2332. }(), func() uint32 {
  2333. if 0x1+16 < 2 {
  2334. return Uint32FromInt32(-1)
  2335. }
  2336. return func() uint32 {
  2337. if Int32(0x80) == Int32(0x80) {
  2338. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2339. }
  2340. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2341. }()<<23 | uint32_t(0x1+16)
  2342. }(), func() uint32 {
  2343. if 0x2+16 < 2 {
  2344. return Uint32FromInt32(-1)
  2345. }
  2346. return func() uint32 {
  2347. if Int32(0x80) == Int32(0x80) {
  2348. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2349. }
  2350. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2351. }()<<23 | uint32_t(0x2+16)
  2352. }(), func() uint32 {
  2353. if 0x3+16 < 2 {
  2354. return Uint32FromInt32(-1)
  2355. }
  2356. return func() uint32 {
  2357. if Int32(0x80) == Int32(0x80) {
  2358. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2359. }
  2360. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2361. }()<<23 | uint32_t(0x3+16)
  2362. }(), func() uint32 {
  2363. if 0x4+16 < 2 {
  2364. return Uint32FromInt32(-1)
  2365. }
  2366. return func() uint32 {
  2367. if Int32(0x80) == Int32(0x80) {
  2368. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2369. }
  2370. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2371. }()<<23 | uint32_t(0x4+16)
  2372. }(), func() uint32 {
  2373. if 0x5+16 < 2 {
  2374. return Uint32FromInt32(-1)
  2375. }
  2376. return func() uint32 {
  2377. if Int32(0x80) == Int32(0x80) {
  2378. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2379. }
  2380. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2381. }()<<23 | uint32_t(0x5+16)
  2382. }(), func() uint32 {
  2383. if 0x6+16 < 2 {
  2384. return Uint32FromInt32(-1)
  2385. }
  2386. return func() uint32 {
  2387. if Int32(0x80) == Int32(0x80) {
  2388. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2389. }
  2390. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2391. }()<<23 | uint32_t(0x6+16)
  2392. }(), func() uint32 {
  2393. if 0x7+16 < 2 {
  2394. return Uint32FromInt32(-1)
  2395. }
  2396. return func() uint32 {
  2397. if Int32(0x80) == Int32(0x80) {
  2398. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2399. }
  2400. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2401. }()<<23 | uint32_t(0x7+16)
  2402. }(),
  2403. func() uint32 {
  2404. if 0x8+16 < 2 {
  2405. return Uint32FromInt32(-1)
  2406. }
  2407. return func() uint32 {
  2408. if Int32(0x80) == Int32(0x80) {
  2409. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2410. }
  2411. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2412. }()<<23 | uint32_t(0x8+16)
  2413. }(), func() uint32 {
  2414. if 0x9+16 < 2 {
  2415. return Uint32FromInt32(-1)
  2416. }
  2417. return func() uint32 {
  2418. if Int32(0x80) == Int32(0x80) {
  2419. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2420. }
  2421. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2422. }()<<23 | uint32_t(0x9+16)
  2423. }(), func() uint32 {
  2424. if 0xa+16 < 2 {
  2425. return Uint32FromInt32(-1)
  2426. }
  2427. return func() uint32 {
  2428. if Int32(0x80) == Int32(0x80) {
  2429. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2430. }
  2431. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2432. }()<<23 | uint32_t(0xa+16)
  2433. }(), func() uint32 {
  2434. if 0xb+16 < 2 {
  2435. return Uint32FromInt32(-1)
  2436. }
  2437. return func() uint32 {
  2438. if Int32(0x80) == Int32(0x80) {
  2439. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2440. }
  2441. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2442. }()<<23 | uint32_t(0xb+16)
  2443. }(), func() uint32 {
  2444. if 0xc+16 < 2 {
  2445. return Uint32FromInt32(-1)
  2446. }
  2447. return func() uint32 {
  2448. if Int32(0x80) == Int32(0x80) {
  2449. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2450. }
  2451. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2452. }()<<23 | uint32_t(0xc+16)
  2453. }(), func() uint32 {
  2454. if 0xd+16 < 2 {
  2455. return Uint32FromInt32(-1)
  2456. }
  2457. return func() uint32 {
  2458. if Int32(0x80) == Int32(0x80) {
  2459. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2460. }
  2461. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2462. }()<<23 | uint32_t(0xd+16)
  2463. }(), func() uint32 {
  2464. if 0xe+16 < 2 {
  2465. return Uint32FromInt32(-1)
  2466. }
  2467. return func() uint32 {
  2468. if Int32(0x80) == Int32(0x80) {
  2469. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2470. }
  2471. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2472. }()<<23 | uint32_t(0xe+16)
  2473. }(), func() uint32 {
  2474. if 0xf+16 < 2 {
  2475. return Uint32FromInt32(-1)
  2476. }
  2477. return func() uint32 {
  2478. if Int32(0x80) == Int32(0x80) {
  2479. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2480. }
  2481. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2482. }()<<23 | uint32_t(0xf+16)
  2483. }(),
  2484. func() uint32 {
  2485. if 0x0 == 0 {
  2486. return func() uint32 {
  2487. if Int32(0xa0) == Int32(0x80) {
  2488. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2489. }
  2490. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2491. }() << 23
  2492. }
  2493. return func() uint32 {
  2494. if 0x0 == 0xd {
  2495. return func() uint32 {
  2496. if Int32(0x80) == Int32(0x80) {
  2497. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2498. }
  2499. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2500. }() << 23
  2501. }
  2502. return func() uint32 {
  2503. if Int32(0x80) == Int32(0x80) {
  2504. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2505. }
  2506. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2507. }() << 23
  2508. }()
  2509. }() | uint32_t(func() uint32 {
  2510. if Int32(0x80) == Int32(0x80) {
  2511. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2512. }
  2513. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2514. }()<<23)>>6 | uint32_t(0x0), func() uint32 {
  2515. if 0x1 == 0 {
  2516. return func() uint32 {
  2517. if Int32(0xa0) == Int32(0x80) {
  2518. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2519. }
  2520. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2521. }() << 23
  2522. }
  2523. return func() uint32 {
  2524. if 0x1 == 0xd {
  2525. return func() uint32 {
  2526. if Int32(0x80) == Int32(0x80) {
  2527. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2528. }
  2529. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2530. }() << 23
  2531. }
  2532. return func() uint32 {
  2533. if Int32(0x80) == Int32(0x80) {
  2534. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2535. }
  2536. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2537. }() << 23
  2538. }()
  2539. }() | uint32_t(func() uint32 {
  2540. if Int32(0x80) == Int32(0x80) {
  2541. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2542. }
  2543. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2544. }()<<23)>>6 | uint32_t(0x1), func() uint32 {
  2545. if 0x2 == 0 {
  2546. return func() uint32 {
  2547. if Int32(0xa0) == Int32(0x80) {
  2548. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2549. }
  2550. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2551. }() << 23
  2552. }
  2553. return func() uint32 {
  2554. if 0x2 == 0xd {
  2555. return func() uint32 {
  2556. if Int32(0x80) == Int32(0x80) {
  2557. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2558. }
  2559. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2560. }() << 23
  2561. }
  2562. return func() uint32 {
  2563. if Int32(0x80) == Int32(0x80) {
  2564. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2565. }
  2566. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2567. }() << 23
  2568. }()
  2569. }() | uint32_t(func() uint32 {
  2570. if Int32(0x80) == Int32(0x80) {
  2571. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2572. }
  2573. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2574. }()<<23)>>6 | uint32_t(0x2), func() uint32 {
  2575. if 0x3 == 0 {
  2576. return func() uint32 {
  2577. if Int32(0xa0) == Int32(0x80) {
  2578. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2579. }
  2580. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2581. }() << 23
  2582. }
  2583. return func() uint32 {
  2584. if 0x3 == 0xd {
  2585. return func() uint32 {
  2586. if Int32(0x80) == Int32(0x80) {
  2587. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2588. }
  2589. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2590. }() << 23
  2591. }
  2592. return func() uint32 {
  2593. if Int32(0x80) == Int32(0x80) {
  2594. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2595. }
  2596. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2597. }() << 23
  2598. }()
  2599. }() | uint32_t(func() uint32 {
  2600. if Int32(0x80) == Int32(0x80) {
  2601. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2602. }
  2603. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2604. }()<<23)>>6 | uint32_t(0x3), func() uint32 {
  2605. if 0x4 == 0 {
  2606. return func() uint32 {
  2607. if Int32(0xa0) == Int32(0x80) {
  2608. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2609. }
  2610. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2611. }() << 23
  2612. }
  2613. return func() uint32 {
  2614. if 0x4 == 0xd {
  2615. return func() uint32 {
  2616. if Int32(0x80) == Int32(0x80) {
  2617. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2618. }
  2619. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2620. }() << 23
  2621. }
  2622. return func() uint32 {
  2623. if Int32(0x80) == Int32(0x80) {
  2624. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2625. }
  2626. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2627. }() << 23
  2628. }()
  2629. }() | uint32_t(func() uint32 {
  2630. if Int32(0x80) == Int32(0x80) {
  2631. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2632. }
  2633. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2634. }()<<23)>>6 | uint32_t(0x4), func() uint32 {
  2635. if 0x5 == 0 {
  2636. return func() uint32 {
  2637. if Int32(0xa0) == Int32(0x80) {
  2638. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2639. }
  2640. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2641. }() << 23
  2642. }
  2643. return func() uint32 {
  2644. if 0x5 == 0xd {
  2645. return func() uint32 {
  2646. if Int32(0x80) == Int32(0x80) {
  2647. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2648. }
  2649. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2650. }() << 23
  2651. }
  2652. return func() uint32 {
  2653. if Int32(0x80) == Int32(0x80) {
  2654. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2655. }
  2656. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2657. }() << 23
  2658. }()
  2659. }() | uint32_t(func() uint32 {
  2660. if Int32(0x80) == Int32(0x80) {
  2661. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2662. }
  2663. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2664. }()<<23)>>6 | uint32_t(0x5), func() uint32 {
  2665. if 0x6 == 0 {
  2666. return func() uint32 {
  2667. if Int32(0xa0) == Int32(0x80) {
  2668. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2669. }
  2670. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2671. }() << 23
  2672. }
  2673. return func() uint32 {
  2674. if 0x6 == 0xd {
  2675. return func() uint32 {
  2676. if Int32(0x80) == Int32(0x80) {
  2677. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2678. }
  2679. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2680. }() << 23
  2681. }
  2682. return func() uint32 {
  2683. if Int32(0x80) == Int32(0x80) {
  2684. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2685. }
  2686. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2687. }() << 23
  2688. }()
  2689. }() | uint32_t(func() uint32 {
  2690. if Int32(0x80) == Int32(0x80) {
  2691. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2692. }
  2693. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2694. }()<<23)>>6 | uint32_t(0x6), func() uint32 {
  2695. if 0x7 == 0 {
  2696. return func() uint32 {
  2697. if Int32(0xa0) == Int32(0x80) {
  2698. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2699. }
  2700. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2701. }() << 23
  2702. }
  2703. return func() uint32 {
  2704. if 0x7 == 0xd {
  2705. return func() uint32 {
  2706. if Int32(0x80) == Int32(0x80) {
  2707. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2708. }
  2709. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2710. }() << 23
  2711. }
  2712. return func() uint32 {
  2713. if Int32(0x80) == Int32(0x80) {
  2714. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2715. }
  2716. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2717. }() << 23
  2718. }()
  2719. }() | uint32_t(func() uint32 {
  2720. if Int32(0x80) == Int32(0x80) {
  2721. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2722. }
  2723. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2724. }()<<23)>>6 | uint32_t(0x7),
  2725. func() uint32 {
  2726. if 0x8 == 0 {
  2727. return func() uint32 {
  2728. if Int32(0xa0) == Int32(0x80) {
  2729. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2730. }
  2731. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2732. }() << 23
  2733. }
  2734. return func() uint32 {
  2735. if 0x8 == 0xd {
  2736. return func() uint32 {
  2737. if Int32(0x80) == Int32(0x80) {
  2738. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2739. }
  2740. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2741. }() << 23
  2742. }
  2743. return func() uint32 {
  2744. if Int32(0x80) == Int32(0x80) {
  2745. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2746. }
  2747. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2748. }() << 23
  2749. }()
  2750. }() | uint32_t(func() uint32 {
  2751. if Int32(0x80) == Int32(0x80) {
  2752. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2753. }
  2754. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2755. }()<<23)>>6 | uint32_t(0x8), func() uint32 {
  2756. if 0x9 == 0 {
  2757. return func() uint32 {
  2758. if Int32(0xa0) == Int32(0x80) {
  2759. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2760. }
  2761. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2762. }() << 23
  2763. }
  2764. return func() uint32 {
  2765. if 0x9 == 0xd {
  2766. return func() uint32 {
  2767. if Int32(0x80) == Int32(0x80) {
  2768. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2769. }
  2770. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2771. }() << 23
  2772. }
  2773. return func() uint32 {
  2774. if Int32(0x80) == Int32(0x80) {
  2775. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2776. }
  2777. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2778. }() << 23
  2779. }()
  2780. }() | uint32_t(func() uint32 {
  2781. if Int32(0x80) == Int32(0x80) {
  2782. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2783. }
  2784. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2785. }()<<23)>>6 | uint32_t(0x9), func() uint32 {
  2786. if 0xa == 0 {
  2787. return func() uint32 {
  2788. if Int32(0xa0) == Int32(0x80) {
  2789. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2790. }
  2791. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2792. }() << 23
  2793. }
  2794. return func() uint32 {
  2795. if 0xa == 0xd {
  2796. return func() uint32 {
  2797. if Int32(0x80) == Int32(0x80) {
  2798. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2799. }
  2800. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2801. }() << 23
  2802. }
  2803. return func() uint32 {
  2804. if Int32(0x80) == Int32(0x80) {
  2805. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2806. }
  2807. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2808. }() << 23
  2809. }()
  2810. }() | uint32_t(func() uint32 {
  2811. if Int32(0x80) == Int32(0x80) {
  2812. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2813. }
  2814. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2815. }()<<23)>>6 | uint32_t(0xa), func() uint32 {
  2816. if 0xb == 0 {
  2817. return func() uint32 {
  2818. if Int32(0xa0) == Int32(0x80) {
  2819. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2820. }
  2821. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2822. }() << 23
  2823. }
  2824. return func() uint32 {
  2825. if 0xb == 0xd {
  2826. return func() uint32 {
  2827. if Int32(0x80) == Int32(0x80) {
  2828. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2829. }
  2830. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2831. }() << 23
  2832. }
  2833. return func() uint32 {
  2834. if Int32(0x80) == Int32(0x80) {
  2835. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2836. }
  2837. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2838. }() << 23
  2839. }()
  2840. }() | uint32_t(func() uint32 {
  2841. if Int32(0x80) == Int32(0x80) {
  2842. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2843. }
  2844. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2845. }()<<23)>>6 | uint32_t(0xb), func() uint32 {
  2846. if 0xc == 0 {
  2847. return func() uint32 {
  2848. if Int32(0xa0) == Int32(0x80) {
  2849. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2850. }
  2851. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2852. }() << 23
  2853. }
  2854. return func() uint32 {
  2855. if 0xc == 0xd {
  2856. return func() uint32 {
  2857. if Int32(0x80) == Int32(0x80) {
  2858. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2859. }
  2860. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2861. }() << 23
  2862. }
  2863. return func() uint32 {
  2864. if Int32(0x80) == Int32(0x80) {
  2865. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2866. }
  2867. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2868. }() << 23
  2869. }()
  2870. }() | uint32_t(func() uint32 {
  2871. if Int32(0x80) == Int32(0x80) {
  2872. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2873. }
  2874. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2875. }()<<23)>>6 | uint32_t(0xc), func() uint32 {
  2876. if 0xd == 0 {
  2877. return func() uint32 {
  2878. if Int32(0xa0) == Int32(0x80) {
  2879. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2880. }
  2881. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2882. }() << 23
  2883. }
  2884. return func() uint32 {
  2885. if 0xd == 0xd {
  2886. return func() uint32 {
  2887. if Int32(0x80) == Int32(0x80) {
  2888. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2889. }
  2890. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2891. }() << 23
  2892. }
  2893. return func() uint32 {
  2894. if Int32(0x80) == Int32(0x80) {
  2895. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2896. }
  2897. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2898. }() << 23
  2899. }()
  2900. }() | uint32_t(func() uint32 {
  2901. if Int32(0x80) == Int32(0x80) {
  2902. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2903. }
  2904. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2905. }()<<23)>>6 | uint32_t(0xd), func() uint32 {
  2906. if 0xe == 0 {
  2907. return func() uint32 {
  2908. if Int32(0xa0) == Int32(0x80) {
  2909. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2910. }
  2911. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2912. }() << 23
  2913. }
  2914. return func() uint32 {
  2915. if 0xe == 0xd {
  2916. return func() uint32 {
  2917. if Int32(0x80) == Int32(0x80) {
  2918. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2919. }
  2920. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2921. }() << 23
  2922. }
  2923. return func() uint32 {
  2924. if Int32(0x80) == Int32(0x80) {
  2925. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2926. }
  2927. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2928. }() << 23
  2929. }()
  2930. }() | uint32_t(func() uint32 {
  2931. if Int32(0x80) == Int32(0x80) {
  2932. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2933. }
  2934. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2935. }()<<23)>>6 | uint32_t(0xe), func() uint32 {
  2936. if 0xf == 0 {
  2937. return func() uint32 {
  2938. if Int32(0xa0) == Int32(0x80) {
  2939. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2940. }
  2941. return Uint32(Uint32(0) - Uint32FromInt32(0xa0))
  2942. }() << 23
  2943. }
  2944. return func() uint32 {
  2945. if 0xf == 0xd {
  2946. return func() uint32 {
  2947. if Int32(0x80) == Int32(0x80) {
  2948. return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))
  2949. }
  2950. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2951. }() << 23
  2952. }
  2953. return func() uint32 {
  2954. if Int32(0x80) == Int32(0x80) {
  2955. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2956. }
  2957. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2958. }() << 23
  2959. }()
  2960. }() | uint32_t(func() uint32 {
  2961. if Int32(0x80) == Int32(0x80) {
  2962. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2963. }
  2964. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2965. }()<<23)>>6 | uint32_t(0xf),
  2966. func() uint32 {
  2967. if 0x0 >= 5 {
  2968. return uint32(0)
  2969. }
  2970. return func() uint32 {
  2971. if 0x0 == 0 {
  2972. return func() uint32 {
  2973. if Int32(0x90) == Int32(0x80) {
  2974. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2975. }
  2976. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  2977. }() << 23
  2978. }
  2979. return func() uint32 {
  2980. if 0x0 == 4 {
  2981. return func() uint32 {
  2982. if Int32(0x80) == Int32(0x80) {
  2983. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  2984. }
  2985. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2986. }() << 23
  2987. }
  2988. return func() uint32 {
  2989. if Int32(0x80) == Int32(0x80) {
  2990. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2991. }
  2992. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  2993. }() << 23
  2994. }()
  2995. }()
  2996. }() | uint32_t(func() uint32 {
  2997. if Int32(0x80) == Int32(0x80) {
  2998. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  2999. }
  3000. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3001. }()<<23)>>6 | uint32_t(func() uint32 {
  3002. if Int32(0x80) == Int32(0x80) {
  3003. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3004. }
  3005. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3006. }()<<23)>>12 | uint32_t(0x0), func() uint32 {
  3007. if 0x1 >= 5 {
  3008. return uint32(0)
  3009. }
  3010. return func() uint32 {
  3011. if 0x1 == 0 {
  3012. return func() uint32 {
  3013. if Int32(0x90) == Int32(0x80) {
  3014. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3015. }
  3016. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3017. }() << 23
  3018. }
  3019. return func() uint32 {
  3020. if 0x1 == 4 {
  3021. return func() uint32 {
  3022. if Int32(0x80) == Int32(0x80) {
  3023. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3024. }
  3025. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3026. }() << 23
  3027. }
  3028. return func() uint32 {
  3029. if Int32(0x80) == Int32(0x80) {
  3030. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3031. }
  3032. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3033. }() << 23
  3034. }()
  3035. }()
  3036. }() | uint32_t(func() uint32 {
  3037. if Int32(0x80) == Int32(0x80) {
  3038. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3039. }
  3040. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3041. }()<<23)>>6 | uint32_t(func() uint32 {
  3042. if Int32(0x80) == Int32(0x80) {
  3043. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3044. }
  3045. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3046. }()<<23)>>12 | uint32_t(0x1), func() uint32 {
  3047. if 0x2 >= 5 {
  3048. return uint32(0)
  3049. }
  3050. return func() uint32 {
  3051. if 0x2 == 0 {
  3052. return func() uint32 {
  3053. if Int32(0x90) == Int32(0x80) {
  3054. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3055. }
  3056. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3057. }() << 23
  3058. }
  3059. return func() uint32 {
  3060. if 0x2 == 4 {
  3061. return func() uint32 {
  3062. if Int32(0x80) == Int32(0x80) {
  3063. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3064. }
  3065. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3066. }() << 23
  3067. }
  3068. return func() uint32 {
  3069. if Int32(0x80) == Int32(0x80) {
  3070. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3071. }
  3072. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3073. }() << 23
  3074. }()
  3075. }()
  3076. }() | uint32_t(func() uint32 {
  3077. if Int32(0x80) == Int32(0x80) {
  3078. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3079. }
  3080. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3081. }()<<23)>>6 | uint32_t(func() uint32 {
  3082. if Int32(0x80) == Int32(0x80) {
  3083. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3084. }
  3085. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3086. }()<<23)>>12 | uint32_t(0x2), func() uint32 {
  3087. if 0x3 >= 5 {
  3088. return uint32(0)
  3089. }
  3090. return func() uint32 {
  3091. if 0x3 == 0 {
  3092. return func() uint32 {
  3093. if Int32(0x90) == Int32(0x80) {
  3094. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3095. }
  3096. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3097. }() << 23
  3098. }
  3099. return func() uint32 {
  3100. if 0x3 == 4 {
  3101. return func() uint32 {
  3102. if Int32(0x80) == Int32(0x80) {
  3103. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3104. }
  3105. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3106. }() << 23
  3107. }
  3108. return func() uint32 {
  3109. if Int32(0x80) == Int32(0x80) {
  3110. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3111. }
  3112. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3113. }() << 23
  3114. }()
  3115. }()
  3116. }() | uint32_t(func() uint32 {
  3117. if Int32(0x80) == Int32(0x80) {
  3118. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3119. }
  3120. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3121. }()<<23)>>6 | uint32_t(func() uint32 {
  3122. if Int32(0x80) == Int32(0x80) {
  3123. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3124. }
  3125. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3126. }()<<23)>>12 | uint32_t(0x3), func() uint32 {
  3127. if 0x4 >= 5 {
  3128. return uint32(0)
  3129. }
  3130. return func() uint32 {
  3131. if 0x4 == 0 {
  3132. return func() uint32 {
  3133. if Int32(0x90) == Int32(0x80) {
  3134. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3135. }
  3136. return Uint32(Uint32(0) - Uint32FromInt32(0x90))
  3137. }() << 23
  3138. }
  3139. return func() uint32 {
  3140. if 0x4 == 4 {
  3141. return func() uint32 {
  3142. if Int32(0x80) == Int32(0x80) {
  3143. return Uint32(Uint32(0x40) - Uint32FromInt32(0x90))
  3144. }
  3145. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3146. }() << 23
  3147. }
  3148. return func() uint32 {
  3149. if Int32(0x80) == Int32(0x80) {
  3150. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3151. }
  3152. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3153. }() << 23
  3154. }()
  3155. }()
  3156. }() | uint32_t(func() uint32 {
  3157. if Int32(0x80) == Int32(0x80) {
  3158. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3159. }
  3160. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3161. }()<<23)>>6 | uint32_t(func() uint32 {
  3162. if Int32(0x80) == Int32(0x80) {
  3163. return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))
  3164. }
  3165. return Uint32(Uint32(0) - Uint32FromInt32(0x80))
  3166. }()<<23)>>12 | uint32_t(0x4),
  3167. } /* internal.c:18:16 */
  3168. type wint_t = uint32 /* alltypes.h:185:18 */
  3169. type wctype_t = uint64 /* alltypes.h:190:23 */
  3170. type __mbstate_t = struct {
  3171. __opaque1 uint32
  3172. __opaque2 uint32
  3173. } /* alltypes.h:324:9 */
  3174. type mbstate_t = __mbstate_t /* alltypes.h:324:63 */
  3175. func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
  3176. bp := tls.Alloc(4)
  3177. defer tls.Free(4)
  3178. var c uint32
  3179. var s uintptr
  3180. var N uint32
  3181. // var dummy wchar_t at bp, 4
  3182. s = src
  3183. N = uint32(n)
  3184. if !!(st != 0) {
  3185. goto __1
  3186. }
  3187. st = uintptr(unsafe.Pointer(&_sinternal_state))
  3188. __1:
  3189. ;
  3190. c = *(*uint32)(unsafe.Pointer(st))
  3191. if !!(s != 0) {
  3192. goto __2
  3193. }
  3194. if !(c != 0) {
  3195. goto __4
  3196. }
  3197. goto ilseq
  3198. __4:
  3199. ;
  3200. return uint64(0)
  3201. goto __3
  3202. __2:
  3203. if !!(wc != 0) {
  3204. goto __5
  3205. }
  3206. wc = bp /* &dummy */
  3207. __5:
  3208. ;
  3209. __3:
  3210. ;
  3211. if !!(n != 0) {
  3212. goto __6
  3213. }
  3214. return Uint64FromInt32(-2)
  3215. __6:
  3216. ;
  3217. if !!(c != 0) {
  3218. goto __7
  3219. }
  3220. if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) {
  3221. goto __8
  3222. }
  3223. return BoolUint64(!!(AssignPtrInt32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s)))) != 0))
  3224. __8:
  3225. ;
  3226. if !(func() int32 {
  3227. if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) {
  3228. return 4
  3229. }
  3230. return 1
  3231. }() == 1) {
  3232. goto __9
  3233. }
  3234. *(*wchar_t)(unsafe.Pointer(wc)) = 0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s))))
  3235. return 1
  3236. __9:
  3237. ;
  3238. if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) {
  3239. goto __10
  3240. }
  3241. goto ilseq
  3242. __10:
  3243. ;
  3244. c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2]
  3245. n--
  3246. __7:
  3247. ;
  3248. if !(n != 0) {
  3249. goto __11
  3250. }
  3251. if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) {
  3252. goto __12
  3253. }
  3254. goto ilseq
  3255. __12:
  3256. ;
  3257. loop:
  3258. c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80)
  3259. n--
  3260. if !!(c&(uint32(1)<<31) != 0) {
  3261. goto __13
  3262. }
  3263. *(*uint32)(unsafe.Pointer(st)) = uint32(0)
  3264. *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(c)
  3265. return size_t(N) - n
  3266. __13:
  3267. ;
  3268. if !(n != 0) {
  3269. goto __14
  3270. }
  3271. if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) {
  3272. goto __15
  3273. }
  3274. goto ilseq
  3275. __15:
  3276. ;
  3277. goto loop
  3278. __14:
  3279. ;
  3280. __11:
  3281. ;
  3282. *(*uint32)(unsafe.Pointer(st)) = c
  3283. return Uint64FromInt32(-2)
  3284. ilseq:
  3285. *(*uint32)(unsafe.Pointer(st)) = uint32(0)
  3286. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84
  3287. return Uint64FromInt32(-1)
  3288. }
  3289. var _sinternal_state uint32 /* mbrtowc.c:8:18: */
  3290. func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
  3291. return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
  3292. }
  3293. type imaxdiv_t = struct {
  3294. quot intmax_t
  3295. rem intmax_t
  3296. } /* inttypes.h:14:40 */
  3297. type socklen_t = uint32 /* alltypes.h:348:18 */
  3298. type sa_family_t = uint16 /* alltypes.h:353:24 */
  3299. type msghdr = struct {
  3300. msg_name uintptr
  3301. msg_namelen socklen_t
  3302. _ [4]byte
  3303. msg_iov uintptr
  3304. __pad1 int32
  3305. msg_iovlen int32
  3306. msg_control uintptr
  3307. __pad2 int32
  3308. msg_controllen socklen_t
  3309. msg_flags int32
  3310. _ [4]byte
  3311. } /* socket.h:22:1 */
  3312. type cmsghdr = struct {
  3313. __pad1 int32
  3314. cmsg_len socklen_t
  3315. cmsg_level int32
  3316. cmsg_type int32
  3317. } /* socket.h:44:1 */
  3318. type linger = struct {
  3319. l_onoff int32
  3320. l_linger int32
  3321. } /* socket.h:74:1 */
  3322. type sockaddr = struct {
  3323. sa_family sa_family_t
  3324. sa_data [14]uint8
  3325. } /* socket.h:367:1 */
  3326. type sockaddr_storage = struct {
  3327. ss_family sa_family_t
  3328. __ss_padding [118]uint8
  3329. __ss_align uint64
  3330. } /* socket.h:372:1 */
  3331. type in_port_t = uint16_t /* in.h:12:18 */
  3332. type in_addr_t = uint32_t /* in.h:13:18 */
  3333. type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */
  3334. type sockaddr_in = struct {
  3335. sin_family sa_family_t
  3336. sin_port in_port_t
  3337. sin_addr struct{ s_addr in_addr_t }
  3338. sin_zero [8]uint8_t
  3339. } /* in.h:16:1 */
  3340. type in6_addr = struct {
  3341. __in6_union struct {
  3342. _ [0]uint32
  3343. __s6_addr [16]uint8_t
  3344. }
  3345. } /* in.h:23:1 */
  3346. type sockaddr_in6 = struct {
  3347. sin6_family sa_family_t
  3348. sin6_port in_port_t
  3349. sin6_flowinfo uint32_t
  3350. sin6_addr struct {
  3351. __in6_union struct {
  3352. _ [0]uint32
  3353. __s6_addr [16]uint8_t
  3354. }
  3355. }
  3356. sin6_scope_id uint32_t
  3357. } /* in.h:34:1 */
  3358. type ipv6_mreq = struct {
  3359. ipv6mr_multiaddr struct {
  3360. __in6_union struct {
  3361. _ [0]uint32
  3362. __s6_addr [16]uint8_t
  3363. }
  3364. }
  3365. ipv6mr_interface uint32
  3366. } /* in.h:42:1 */
  3367. type ip_opts = struct {
  3368. ip_dst struct{ s_addr in_addr_t }
  3369. ip_opts [40]uint8
  3370. } /* in.h:229:1 */
  3371. type ip_mreq = struct {
  3372. imr_multiaddr struct{ s_addr in_addr_t }
  3373. imr_interface struct{ s_addr in_addr_t }
  3374. } /* in.h:247:1 */
  3375. type ip_mreqn = struct {
  3376. imr_multiaddr struct{ s_addr in_addr_t }
  3377. imr_address struct{ s_addr in_addr_t }
  3378. imr_ifindex int32
  3379. } /* in.h:252:1 */
  3380. type ip_mreq_source = struct {
  3381. imr_multiaddr struct{ s_addr in_addr_t }
  3382. imr_interface struct{ s_addr in_addr_t }
  3383. imr_sourceaddr struct{ s_addr in_addr_t }
  3384. } /* in.h:258:1 */
  3385. type ip_msfilter = struct {
  3386. imsf_multiaddr struct{ s_addr in_addr_t }
  3387. imsf_interface struct{ s_addr in_addr_t }
  3388. imsf_fmode uint32_t
  3389. imsf_numsrc uint32_t
  3390. imsf_slist [1]struct{ s_addr in_addr_t }
  3391. } /* in.h:264:1 */
  3392. type group_req = struct {
  3393. gr_interface uint32_t
  3394. _ [4]byte
  3395. gr_group struct {
  3396. ss_family sa_family_t
  3397. __ss_padding [118]uint8
  3398. __ss_align uint64
  3399. }
  3400. } /* in.h:275:1 */
  3401. type group_source_req = struct {
  3402. gsr_interface uint32_t
  3403. _ [4]byte
  3404. gsr_group struct {
  3405. ss_family sa_family_t
  3406. __ss_padding [118]uint8
  3407. __ss_align uint64
  3408. }
  3409. gsr_source struct {
  3410. ss_family sa_family_t
  3411. __ss_padding [118]uint8
  3412. __ss_align uint64
  3413. }
  3414. } /* in.h:280:1 */
  3415. type group_filter = struct {
  3416. gf_interface uint32_t
  3417. _ [4]byte
  3418. gf_group struct {
  3419. ss_family sa_family_t
  3420. __ss_padding [118]uint8
  3421. __ss_align uint64
  3422. }
  3423. gf_fmode uint32_t
  3424. gf_numsrc uint32_t
  3425. gf_slist [1]struct {
  3426. ss_family sa_family_t
  3427. __ss_padding [118]uint8
  3428. __ss_align uint64
  3429. }
  3430. } /* in.h:286:1 */
  3431. type in_pktinfo = struct {
  3432. ipi_ifindex int32
  3433. ipi_spec_dst struct{ s_addr in_addr_t }
  3434. ipi_addr struct{ s_addr in_addr_t }
  3435. } /* in.h:297:1 */
  3436. type in6_pktinfo = struct {
  3437. ipi6_addr struct {
  3438. __in6_union struct {
  3439. _ [0]uint32
  3440. __s6_addr [16]uint8_t
  3441. }
  3442. }
  3443. ipi6_ifindex uint32
  3444. } /* in.h:303:1 */
  3445. type ip6_mtuinfo = struct {
  3446. ip6m_addr struct {
  3447. sin6_family sa_family_t
  3448. sin6_port in_port_t
  3449. sin6_flowinfo uint32_t
  3450. sin6_addr struct {
  3451. __in6_union struct {
  3452. _ [0]uint32
  3453. __s6_addr [16]uint8_t
  3454. }
  3455. }
  3456. sin6_scope_id uint32_t
  3457. }
  3458. ip6m_mtu uint32_t
  3459. } /* in.h:308:1 */
  3460. type addrinfo = struct {
  3461. ai_flags int32
  3462. ai_family int32
  3463. ai_socktype int32
  3464. ai_protocol int32
  3465. ai_addrlen socklen_t
  3466. _ [4]byte
  3467. ai_addr uintptr
  3468. ai_canonname uintptr
  3469. ai_next uintptr
  3470. } /* netdb.h:16:1 */
  3471. // Legacy functions follow (marked OBsolete in SUS)
  3472. type netent = struct {
  3473. n_name uintptr
  3474. n_aliases uintptr
  3475. n_addrtype int32
  3476. n_net uint32_t
  3477. } /* netdb.h:62:1 */
  3478. type hostent = struct {
  3479. h_name uintptr
  3480. h_aliases uintptr
  3481. h_addrtype int32
  3482. h_length int32
  3483. h_addr_list uintptr
  3484. } /* netdb.h:69:1 */
  3485. type servent = struct {
  3486. s_name uintptr
  3487. s_aliases uintptr
  3488. s_port int32
  3489. _ [4]byte
  3490. s_proto uintptr
  3491. } /* netdb.h:78:1 */
  3492. type protoent = struct {
  3493. p_name uintptr
  3494. p_aliases uintptr
  3495. p_proto int32
  3496. _ [4]byte
  3497. } /* netdb.h:85:1 */
  3498. type aibuf = struct {
  3499. ai struct {
  3500. ai_flags int32
  3501. ai_family int32
  3502. ai_socktype int32
  3503. ai_protocol int32
  3504. ai_addrlen socklen_t
  3505. _ [4]byte
  3506. ai_addr uintptr
  3507. ai_canonname uintptr
  3508. ai_next uintptr
  3509. }
  3510. sa struct {
  3511. sin struct {
  3512. sin_family sa_family_t
  3513. sin_port in_port_t
  3514. sin_addr struct{ s_addr in_addr_t }
  3515. sin_zero [8]uint8_t
  3516. }
  3517. _ [12]byte
  3518. }
  3519. lock [1]int32
  3520. slot int16
  3521. ref int16
  3522. _ [4]byte
  3523. } /* lookup.h:10:1 */
  3524. type sa = struct {
  3525. sin struct {
  3526. sin_family sa_family_t
  3527. sin_port in_port_t
  3528. sin_addr struct{ s_addr in_addr_t }
  3529. sin_zero [8]uint8_t
  3530. }
  3531. _ [12]byte
  3532. } /* lookup.h:10:1 */
  3533. type address = struct {
  3534. family int32
  3535. scopeid uint32
  3536. addr [16]uint8_t
  3537. sortkey int32
  3538. } /* lookup.h:20:1 */
  3539. type service = struct {
  3540. port uint16_t
  3541. proto uint8
  3542. socktype uint8
  3543. } /* lookup.h:27:1 */
  3544. type resolvconf = struct {
  3545. ns [3]struct {
  3546. family int32
  3547. scopeid uint32
  3548. addr [16]uint8_t
  3549. sortkey int32
  3550. }
  3551. nns uint32
  3552. attempts uint32
  3553. ndots uint32
  3554. timeout uint32
  3555. } /* lookup.h:34:1 */
  3556. func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
  3557. var cnt size_t
  3558. cnt = uint64(1)
  3559. __1:
  3560. if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) {
  3561. goto __3
  3562. }
  3563. goto __2
  3564. __2:
  3565. cnt++
  3566. p = (*addrinfo)(unsafe.Pointer(p)).ai_next
  3567. goto __1
  3568. goto __3
  3569. __3:
  3570. ;
  3571. var b uintptr = p - uintptr(uint64(uintptr(0)))
  3572. b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).slot)
  3573. //TODO LOCK(b->lock);
  3574. if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) {
  3575. Xfree(tls, b)
  3576. }
  3577. //TODO else UNLOCK(b->lock);
  3578. }
  3579. func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
  3580. bp := tls.Alloc(1608)
  3581. defer tls.Free(1608)
  3582. // var ports [2]service at bp, 8
  3583. // var addrs [48]address at bp+8, 1344
  3584. // var canon [256]uint8 at bp+1352, 256
  3585. var outcanon uintptr
  3586. var nservs int32
  3587. var naddrs int32
  3588. var nais int32
  3589. var canon_len int32
  3590. var i int32
  3591. var j int32
  3592. var k int32
  3593. var family int32 = 0
  3594. var flags int32 = 0
  3595. var proto int32 = 0
  3596. var socktype int32 = 0
  3597. var out uintptr
  3598. if !(host != 0) && !(serv != 0) {
  3599. return -2
  3600. }
  3601. if hint != 0 {
  3602. family = (*addrinfo)(unsafe.Pointer(hint)).ai_family
  3603. flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags
  3604. proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol
  3605. socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype
  3606. var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
  3607. if flags&mask != flags {
  3608. return -1
  3609. }
  3610. switch family {
  3611. case 2:
  3612. fallthrough
  3613. case 10:
  3614. fallthrough
  3615. case 0:
  3616. break
  3617. fallthrough
  3618. default:
  3619. return -6
  3620. }
  3621. }
  3622. if flags&0x20 != 0 {
  3623. Xabort(tls) //TODO-
  3624. // /* Define the "an address is configured" condition for address
  3625. // * families via ability to create a socket for the family plus
  3626. // * routability of the loopback address for the family. */
  3627. // static const struct sockaddr_in lo4 = {
  3628. // .sin_family = AF_INET, .sin_port = 65535,
  3629. // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
  3630. // ? 0x7f000001 : 0x0100007f
  3631. // };
  3632. // static const struct sockaddr_in6 lo6 = {
  3633. // .sin6_family = AF_INET6, .sin6_port = 65535,
  3634. // .sin6_addr = IN6ADDR_LOOPBACK_INIT
  3635. // };
  3636. // int tf[2] = { AF_INET, AF_INET6 };
  3637. // const void *ta[2] = { &lo4, &lo6 };
  3638. // socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
  3639. // for (i=0; i<2; i++) {
  3640. // if (family==tf[1-i]) continue;
  3641. // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
  3642. // IPPROTO_UDP);
  3643. // if (s>=0) {
  3644. // int cs;
  3645. // pthread_setcancelstate(
  3646. // PTHREAD_CANCEL_DISABLE, &cs);
  3647. // int r = connect(s, ta[i], tl[i]);
  3648. // pthread_setcancelstate(cs, 0);
  3649. // close(s);
  3650. // if (!r) continue;
  3651. // }
  3652. // switch (errno) {
  3653. // case EADDRNOTAVAIL:
  3654. // case EAFNOSUPPORT:
  3655. // case EHOSTUNREACH:
  3656. // case ENETDOWN:
  3657. // case ENETUNREACH:
  3658. // break;
  3659. // default:
  3660. // return EAI_SYSTEM;
  3661. // }
  3662. // if (family == tf[i]) return EAI_NONAME;
  3663. // family = tf[1-i];
  3664. // }
  3665. }
  3666. nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
  3667. if nservs < 0 {
  3668. return nservs
  3669. }
  3670. naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
  3671. if naddrs < 0 {
  3672. return naddrs
  3673. }
  3674. nais = nservs * naddrs
  3675. canon_len = int32(Xstrlen(tls, bp+1352))
  3676. out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1))
  3677. if !(out != 0) {
  3678. return -10
  3679. }
  3680. if canon_len != 0 {
  3681. outcanon = out + uintptr(nais)*88
  3682. Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1))
  3683. } else {
  3684. outcanon = uintptr(0)
  3685. }
  3686. for k = AssignInt32(&i, 0); i < naddrs; i++ {
  3687. j = 0
  3688. __1:
  3689. if !(j < nservs) {
  3690. goto __3
  3691. }
  3692. {
  3693. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k)
  3694. //TODO out[k].ai = (struct addrinfo){
  3695. //TODO .ai_family = addrs[i].family,
  3696. //TODO .ai_socktype = ports[j].socktype,
  3697. //TODO .ai_protocol = ports[j].proto,
  3698. //TODO .ai_addrlen = addrs[i].family == AF_INET
  3699. //TODO ? sizeof(struct sockaddr_in)
  3700. //TODO : sizeof(struct sockaddr_in6),
  3701. //TODO .ai_addr = (void *)&out[k].sa,
  3702. //TODO .ai_canonname = outcanon };
  3703. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family
  3704. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype)
  3705. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto)
  3706. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 {
  3707. if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 {
  3708. return uint32(unsafe.Sizeof(sockaddr_in{}))
  3709. }
  3710. return uint32(unsafe.Sizeof(sockaddr_in6{}))
  3711. }()
  3712. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = out + uintptr(k)*88 + 48
  3713. (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon
  3714. if k != 0 {
  3715. (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).ai.ai_next = out + uintptr(k)*88
  3716. }
  3717. switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family {
  3718. case 2:
  3719. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_family = sa_family_t(2)
  3720. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port)
  3721. Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4))
  3722. break
  3723. case 10:
  3724. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_family = sa_family_t(10)
  3725. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port)
  3726. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid
  3727. Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16))
  3728. break
  3729. }
  3730. }
  3731. goto __2
  3732. __2:
  3733. j++
  3734. k++
  3735. goto __1
  3736. goto __3
  3737. __3:
  3738. }
  3739. (*aibuf)(unsafe.Pointer(out)).ref = int16(nais)
  3740. *(*uintptr)(unsafe.Pointer(res)) = out
  3741. return 0
  3742. }
  3743. type ucred = struct {
  3744. pid pid_t
  3745. uid uid_t
  3746. gid gid_t
  3747. } /* socket.h:57:1 */
  3748. type mmsghdr = struct {
  3749. msg_hdr struct {
  3750. msg_name uintptr
  3751. msg_namelen socklen_t
  3752. _ [4]byte
  3753. msg_iov uintptr
  3754. __pad1 int32
  3755. msg_iovlen int32
  3756. msg_control uintptr
  3757. __pad2 int32
  3758. msg_controllen socklen_t
  3759. msg_flags int32
  3760. _ [4]byte
  3761. }
  3762. msg_len uint32
  3763. _ [4]byte
  3764. } /* socket.h:63:1 */
  3765. func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
  3766. bp := tls.Alloc(8)
  3767. defer tls.Free(8)
  3768. var size size_t = uint64(63)
  3769. // var res uintptr at bp, 8
  3770. var err int32
  3771. for ok := true; ok; ok = err == 34 {
  3772. Xfree(tls, _sh)
  3773. _sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
  3774. if !(_sh != 0) {
  3775. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  3776. return uintptr(0)
  3777. }
  3778. err = Xgethostbyaddr_r(tls, a, l, af, _sh,
  3779. _sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  3780. }
  3781. if err != 0 {
  3782. return uintptr(0)
  3783. }
  3784. return _sh
  3785. }
  3786. var _sh uintptr /* gethostbyaddr.c:9:24: */
  3787. 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: */
  3788. bp := tls.Alloc(28)
  3789. defer tls.Free(28)
  3790. //TODO union {
  3791. //TODO struct sockaddr_in sin;
  3792. //TODO struct sockaddr_in6 sin6;
  3793. //TODO } sa = { .sin.sin_family = af };
  3794. *(*struct {
  3795. sin sockaddr_in
  3796. _ [12]byte
  3797. })(unsafe.Pointer(bp)) = struct {
  3798. sin sockaddr_in
  3799. _ [12]byte
  3800. }{} //TODO-
  3801. (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO-
  3802. var sl socklen_t
  3803. if af == 10 {
  3804. sl = uint32(unsafe.Sizeof(sockaddr_in6{}))
  3805. } else {
  3806. sl = uint32(unsafe.Sizeof(sockaddr_in{}))
  3807. }
  3808. var i int32
  3809. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  3810. // Load address argument into sockaddr structure
  3811. if af == 10 && l == socklen_t(16) {
  3812. Xmemcpy(tls, bp+8, a, uint64(16))
  3813. } else if af == 2 && l == socklen_t(4) {
  3814. Xmemcpy(tls, bp+4, a, uint64(4))
  3815. } else {
  3816. *(*int32)(unsafe.Pointer(err)) = 3
  3817. return 22
  3818. }
  3819. // Align buffer and check for space for pointers and ip address
  3820. i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))
  3821. if !(i != 0) {
  3822. i = int32(unsafe.Sizeof(uintptr(0)))
  3823. }
  3824. if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) {
  3825. return 34
  3826. }
  3827. buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))
  3828. buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l))
  3829. (*hostent)(unsafe.Pointer(h)).h_addr_list = buf
  3830. buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))
  3831. (*hostent)(unsafe.Pointer(h)).h_aliases = buf
  3832. buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))
  3833. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf
  3834. Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l))
  3835. buf += uintptr(l)
  3836. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0)
  3837. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf
  3838. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0)
  3839. switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) {
  3840. case -3:
  3841. *(*int32)(unsafe.Pointer(err)) = 2
  3842. return 11
  3843. case -12:
  3844. return 34
  3845. default:
  3846. fallthrough
  3847. case -10:
  3848. fallthrough
  3849. case -11:
  3850. fallthrough
  3851. case -4:
  3852. *(*int32)(unsafe.Pointer(err)) = 3
  3853. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  3854. case 0:
  3855. break
  3856. }
  3857. (*hostent)(unsafe.Pointer(h)).h_addrtype = af
  3858. (*hostent)(unsafe.Pointer(h)).h_length = int32(l)
  3859. (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases))
  3860. *(*uintptr)(unsafe.Pointer(res)) = h
  3861. return 0
  3862. }
  3863. func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
  3864. return Xgethostbyname2(tls, name, 2)
  3865. }
  3866. func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
  3867. bp := tls.Alloc(8)
  3868. defer tls.Free(8)
  3869. var size size_t = uint64(63)
  3870. // var res uintptr at bp, 8
  3871. var err int32
  3872. for ok := true; ok; ok = err == 34 {
  3873. Xfree(tls, _sh1)
  3874. _sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
  3875. if !(_sh1 != 0) {
  3876. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  3877. return uintptr(0)
  3878. }
  3879. err = Xgethostbyname2_r(tls, name, af, _sh1,
  3880. _sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  3881. }
  3882. if err != 0 {
  3883. return uintptr(0)
  3884. }
  3885. return _sh1
  3886. }
  3887. var _sh1 uintptr /* gethostbyname2.c:10:24: */
  3888. 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: */
  3889. bp := tls.Alloc(1600)
  3890. defer tls.Free(1600)
  3891. // var addrs [48]address at bp, 1344
  3892. // var canon [256]uint8 at bp+1344, 256
  3893. var i int32
  3894. var cnt int32
  3895. var align size_t
  3896. var need size_t
  3897. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  3898. cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
  3899. if cnt < 0 {
  3900. switch cnt {
  3901. case -2:
  3902. *(*int32)(unsafe.Pointer(err)) = 1
  3903. return 2
  3904. fallthrough
  3905. case -3:
  3906. *(*int32)(unsafe.Pointer(err)) = 2
  3907. return 11
  3908. fallthrough
  3909. default:
  3910. fallthrough
  3911. case -4:
  3912. *(*int32)(unsafe.Pointer(err)) = 3
  3913. return 74
  3914. fallthrough
  3915. case -10:
  3916. fallthrough
  3917. case -11:
  3918. *(*int32)(unsafe.Pointer(err)) = 3
  3919. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  3920. }
  3921. }
  3922. (*hostent)(unsafe.Pointer(h)).h_addrtype = af
  3923. (*hostent)(unsafe.Pointer(h)).h_length = func() int32 {
  3924. if af == 10 {
  3925. return 16
  3926. }
  3927. return 4
  3928. }()
  3929. // Align buffer
  3930. align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))
  3931. need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0)))
  3932. need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).h_length))
  3933. need = need + (Xstrlen(tls, name) + uint64(1))
  3934. need = need + (Xstrlen(tls, bp+1344) + uint64(1))
  3935. need = need + align
  3936. if need > buflen {
  3937. return 34
  3938. }
  3939. buf += uintptr(align)
  3940. (*hostent)(unsafe.Pointer(h)).h_aliases = buf
  3941. buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0))))
  3942. (*hostent)(unsafe.Pointer(h)).h_addr_list = buf
  3943. buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0))))
  3944. for i = 0; i < cnt; i++ {
  3945. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf
  3946. buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length)
  3947. 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))
  3948. }
  3949. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0)
  3950. (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf)
  3951. Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344)
  3952. buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1))
  3953. if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 {
  3954. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf
  3955. Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name)
  3956. buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1))
  3957. } else {
  3958. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0)
  3959. }
  3960. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0)
  3961. *(*uintptr)(unsafe.Pointer(res)) = h
  3962. return 0
  3963. }
  3964. func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
  3965. return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
  3966. }
  3967. type if_nameindex = struct {
  3968. if_index uint32
  3969. _ [4]byte
  3970. if_name uintptr
  3971. } /* if.h:12:1 */
  3972. type ifaddr = struct {
  3973. ifa_addr struct {
  3974. sa_family sa_family_t
  3975. sa_data [14]uint8
  3976. }
  3977. ifa_ifu struct {
  3978. ifu_broadaddr struct {
  3979. sa_family sa_family_t
  3980. sa_data [14]uint8
  3981. }
  3982. }
  3983. ifa_ifp uintptr
  3984. ifa_next uintptr
  3985. } /* if.h:51:1 */
  3986. type ifmap = struct {
  3987. mem_start uint64
  3988. mem_end uint64
  3989. base_addr uint16
  3990. irq uint8
  3991. dma uint8
  3992. port uint8
  3993. _ [3]byte
  3994. } /* if.h:64:1 */
  3995. type ifreq = struct {
  3996. ifr_ifrn struct{ ifrn_name [16]uint8 }
  3997. ifr_ifru struct {
  3998. _ [0]uint64
  3999. ifru_addr struct {
  4000. sa_family sa_family_t
  4001. sa_data [14]uint8
  4002. }
  4003. _ [8]byte
  4004. }
  4005. } /* if.h:76:1 */
  4006. type ifconf = struct {
  4007. ifc_len int32
  4008. _ [4]byte
  4009. ifc_ifcu struct{ ifcu_buf uintptr }
  4010. } /* if.h:116:1 */
  4011. type ns_sect = uint32 /* nameser.h:37:3 */
  4012. type __ns_msg = struct {
  4013. _msg uintptr
  4014. _eom uintptr
  4015. _id uint16_t
  4016. _flags uint16_t
  4017. _counts [4]uint16_t
  4018. _ [4]byte
  4019. _sections [4]uintptr
  4020. _sect ns_sect
  4021. _rrnum int32
  4022. _msg_ptr uintptr
  4023. } /* nameser.h:39:9 */
  4024. type ns_msg = __ns_msg /* nameser.h:46:3 */
  4025. type _ns_flagdata = struct {
  4026. mask int32
  4027. shift int32
  4028. } /* nameser.h:48:1 */
  4029. type __ns_rr = struct {
  4030. name [1025]uint8
  4031. _ [1]byte
  4032. __type uint16_t
  4033. rr_class uint16_t
  4034. _ [2]byte
  4035. ttl uint32_t
  4036. rdlength uint16_t
  4037. _ [2]byte
  4038. rdata uintptr
  4039. } /* nameser.h:59:9 */
  4040. type ns_rr = __ns_rr /* nameser.h:66:3 */
  4041. type ns_flag = uint32 /* nameser.h:87:3 */
  4042. type ns_opcode = uint32 /* nameser.h:96:3 */
  4043. type ns_rcode = uint32 /* nameser.h:115:3 */
  4044. type ns_update_operation = uint32 /* nameser.h:121:3 */
  4045. type ns_tsig_key1 = struct {
  4046. name [1025]uint8
  4047. alg [1025]uint8
  4048. _ [6]byte
  4049. data uintptr
  4050. len int32
  4051. _ [4]byte
  4052. } /* nameser.h:123:1 */
  4053. type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
  4054. type ns_tcp_tsig_state1 = struct {
  4055. counter int32
  4056. _ [4]byte
  4057. key uintptr
  4058. ctx uintptr
  4059. sig [512]uint8
  4060. siglen int32
  4061. _ [4]byte
  4062. } /* nameser.h:130:1 */
  4063. type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
  4064. type ns_type = uint32 /* nameser.h:200:3 */
  4065. type ns_class = uint32 /* nameser.h:219:3 */
  4066. type ns_key_types = uint32 /* nameser.h:226:3 */
  4067. type ns_cert_types = uint32 /* nameser.h:234:3 */
  4068. type HEADER = struct {
  4069. _ [0]uint32
  4070. id uint32 /* unsigned id: 16, unsigned qr: 1, unsigned opcode: 4, unsigned aa: 1, unsigned tc: 1, unsigned rd: 1, unsigned ra: 1, unsigned unused: 1, unsigned ad: 1, unsigned cd: 1, unsigned rcode: 4 */
  4071. qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
  4072. nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
  4073. } /* nameser.h:353:3 */
  4074. // unused; purely for broken apps
  4075. type __res_state = struct {
  4076. retrans int32
  4077. retry int32
  4078. options uint64
  4079. nscount int32
  4080. nsaddr_list [3]struct {
  4081. sin_family sa_family_t
  4082. sin_port in_port_t
  4083. sin_addr struct{ s_addr in_addr_t }
  4084. sin_zero [8]uint8_t
  4085. }
  4086. id uint16
  4087. _ [2]byte
  4088. dnsrch [7]uintptr
  4089. defdname [256]uint8
  4090. pfcode uint64
  4091. ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
  4092. _ [4]byte
  4093. sort_list [10]struct {
  4094. addr struct{ s_addr in_addr_t }
  4095. mask uint32_t
  4096. }
  4097. qhook uintptr
  4098. rhook uintptr
  4099. res_h_errno int32
  4100. _vcsock int32
  4101. _flags uint32
  4102. _ [4]byte
  4103. _u struct {
  4104. _ [0]uint64
  4105. pad [52]uint8
  4106. _ [4]byte
  4107. }
  4108. } /* resolv.h:26:9 */
  4109. // unused; purely for broken apps
  4110. type res_state = uintptr /* resolv.h:62:3 */
  4111. type res_sym = struct {
  4112. number int32
  4113. _ [4]byte
  4114. name uintptr
  4115. humanname uintptr
  4116. } /* resolv.h:70:1 */
  4117. func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
  4118. p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))
  4119. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0)
  4120. for ok := true; ok; ok = x != 0 {
  4121. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(uint32('0') + x%uint32(10))
  4122. x = x / uint32(10)
  4123. }
  4124. return p
  4125. }
  4126. func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
  4127. bp := tls.Alloc(32)
  4128. defer tls.Free(32)
  4129. Xsprintf(tls, s, ts+25,
  4130. 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)))))
  4131. }
  4132. func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
  4133. var i int32
  4134. for i = 15; i >= 0; i-- {
  4135. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
  4136. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  4137. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
  4138. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  4139. }
  4140. Xstrcpy(tls, s, ts+50)
  4141. }
  4142. var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */
  4143. func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
  4144. bp := tls.Alloc(556)
  4145. defer tls.Free(556)
  4146. // var line [512]uint8 at bp+16, 512
  4147. var p uintptr
  4148. var z uintptr
  4149. var _buf [1032]uint8
  4150. _ = _buf
  4151. // var atmp [16]uint8 at bp, 16
  4152. // var iplit address at bp+528, 28
  4153. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  4154. var f uintptr = Xfopen(tls, ts+76, ts+87)
  4155. if !(f != 0) {
  4156. return
  4157. }
  4158. if family == 2 {
  4159. Xmemcpy(tls, bp+uintptr(12), a, uint64(4))
  4160. Xmemcpy(tls, bp, ts+90, uint64(12))
  4161. a = bp /* &atmp[0] */
  4162. }
  4163. for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]uint8{})), f) != 0 {
  4164. if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
  4165. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  4166. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  4167. }
  4168. for p = bp + 16; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  4169. }
  4170. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  4171. if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
  4172. continue
  4173. }
  4174. if (*address)(unsafe.Pointer(bp+528)).family == 2 {
  4175. Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4))
  4176. Xmemcpy(tls, bp+528+8, ts+90, uint64(12))
  4177. (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0)
  4178. }
  4179. if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid {
  4180. continue
  4181. }
  4182. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  4183. }
  4184. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  4185. }
  4186. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  4187. if (int64(z)-int64(p))/1 < int64(256) {
  4188. Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1)))
  4189. break
  4190. }
  4191. }
  4192. //TODO __fclose_ca(f);
  4193. Xfclose(tls, f)
  4194. }
  4195. func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
  4196. Xabort(tls) //TODO-
  4197. // unsigned long svport;
  4198. // char line[128], *p, *z;
  4199. // unsigned char _buf[1032];
  4200. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  4201. // if (!f) return;
  4202. // while (fgets(line, sizeof line, f)) {
  4203. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  4204. // for (p=line; *p && !isspace(*p); p++);
  4205. // if (!*p) continue;
  4206. // *p++ = 0;
  4207. // svport = strtoul(p, &z, 10);
  4208. // if (svport != port || z==p) continue;
  4209. // if (dgram && strncmp(z, "/udp", 4)) continue;
  4210. // if (!dgram && strncmp(z, "/tcp", 4)) continue;
  4211. // if (p-line > 32) continue;
  4212. // memcpy(buf, line, p-line);
  4213. // break;
  4214. // }
  4215. // __fclose_ca(f);
  4216. }
  4217. 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: */
  4218. bp := tls.Alloc(347)
  4219. defer tls.Free(347)
  4220. // var ptr [78]uint8 at bp, 78
  4221. // var buf [256]uint8 at bp+78, 256
  4222. // var num [13]uint8 at bp+334, 13
  4223. var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family)
  4224. var a uintptr
  4225. var scopeid uint32
  4226. switch af {
  4227. case 2:
  4228. a = sa1 + 4
  4229. if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) {
  4230. return -6
  4231. }
  4232. mkptr4(tls, bp, a)
  4233. scopeid = uint32(0)
  4234. break
  4235. case 10:
  4236. a = sa1 + 8
  4237. if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) {
  4238. return -6
  4239. }
  4240. if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 {
  4241. mkptr6(tls, bp, a)
  4242. } else {
  4243. mkptr4(tls, bp, a+uintptr(12))
  4244. }
  4245. scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id
  4246. break
  4247. default:
  4248. return -6
  4249. }
  4250. if node != 0 && nodelen != 0 {
  4251. *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0)
  4252. if !(flags&0x01 != 0) {
  4253. reverse_hosts(tls, bp+78, a, scopeid, af)
  4254. }
  4255. if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) {
  4256. Xabort(tls) //TODO-
  4257. // unsigned char query[18+PTR_MAX], reply[512];
  4258. // int qlen = __res_mkquery(0, ptr, 1, RR_PTR,
  4259. // 0, 0, 0, query, sizeof query);
  4260. // query[3] = 0; /* don't need AD flag */
  4261. // int rlen = __res_send(query, qlen, reply, sizeof reply);
  4262. // buf[0] = 0;
  4263. // if (rlen > 0)
  4264. // __dns_parse(reply, rlen, dns_parse_callback, buf);
  4265. }
  4266. if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) {
  4267. if flags&0x08 != 0 {
  4268. return -2
  4269. }
  4270. Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]uint8{})))
  4271. if scopeid != 0 {
  4272. Xabort(tls) //TODO-
  4273. // char *p = 0, tmp[IF_NAMESIZE+1];
  4274. // if (!(flags & NI_NUMERICSCOPE) &&
  4275. // (IN6_IS_ADDR_LINKLOCAL(a) ||
  4276. // IN6_IS_ADDR_MC_LINKLOCAL(a)))
  4277. // p = if_indextoname(scopeid, tmp+1);
  4278. // if (!p)
  4279. // p = itoa(num, scopeid);
  4280. // *--p = '%';
  4281. // strcat(buf, p);
  4282. }
  4283. }
  4284. if Xstrlen(tls, bp+78) >= size_t(nodelen) {
  4285. return -12
  4286. }
  4287. Xstrcpy(tls, node, bp+78)
  4288. }
  4289. if serv != 0 && servlen != 0 {
  4290. var p uintptr = bp + 78 /* buf */
  4291. var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port))
  4292. *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0)
  4293. if !(flags&0x02 != 0) {
  4294. reverse_services(tls, bp+78, port, flags&0x10)
  4295. }
  4296. if !(int32(*(*uint8)(unsafe.Pointer(p))) != 0) {
  4297. p = itoa(tls, bp+334, uint32(port))
  4298. }
  4299. if Xstrlen(tls, p) >= size_t(servlen) {
  4300. return -12
  4301. }
  4302. Xstrcpy(tls, serv, p)
  4303. }
  4304. return 0
  4305. }
  4306. var Xh_errno int32 /* h_errno.c:4:5: */
  4307. func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
  4308. return uintptr(unsafe.Pointer(&Xh_errno))
  4309. }
  4310. func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
  4311. bp := tls.Alloc(40)
  4312. defer tls.Free(40)
  4313. var s uintptr = s0
  4314. var d uintptr = dest
  4315. *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)}
  4316. // var z uintptr at bp+32, 8
  4317. var i int32
  4318. for i = 0; i < 4; i++ {
  4319. *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0)
  4320. 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 {
  4321. if 0 != 0 {
  4322. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s))))
  4323. }
  4324. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
  4325. }() != 0) {
  4326. return 0
  4327. }
  4328. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) {
  4329. break
  4330. }
  4331. s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1)
  4332. }
  4333. if i == 4 {
  4334. return 0
  4335. }
  4336. switch i {
  4337. case 0:
  4338. *(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff)
  4339. AssignShrPtrUint64(bp, int(24))
  4340. fallthrough
  4341. case 1:
  4342. *(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff)
  4343. AssignShrPtrUint64(bp+1*8, int(16))
  4344. fallthrough
  4345. case 2:
  4346. *(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff)
  4347. AssignShrPtrUint64(bp+2*8, int(8))
  4348. }
  4349. for i = 0; i < 4; i++ {
  4350. if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) {
  4351. return 0
  4352. }
  4353. *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)))
  4354. }
  4355. return 1
  4356. }
  4357. func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
  4358. bp := tls.Alloc(276)
  4359. defer tls.Free(276)
  4360. var a uintptr = a0
  4361. var i int32
  4362. var j int32
  4363. var max int32
  4364. var best int32
  4365. // var buf [100]uint8 at bp+176, 100
  4366. switch af {
  4367. case 2:
  4368. 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 {
  4369. return s
  4370. }
  4371. break
  4372. case 10:
  4373. if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 {
  4374. Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})),
  4375. ts+115,
  4376. 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))),
  4377. 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))),
  4378. 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))),
  4379. 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)))))
  4380. } else {
  4381. Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})),
  4382. ts+139,
  4383. 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))),
  4384. 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))),
  4385. 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))),
  4386. int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  4387. }
  4388. // Replace longest /(^0|:)[:0]{2,}/ with "::"
  4389. i = AssignInt32(&best, 0)
  4390. max = 2
  4391. for ; *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
  4392. if i != 0 && int32(*(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
  4393. continue
  4394. }
  4395. j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169))
  4396. if j > max {
  4397. best = i
  4398. max = j
  4399. }
  4400. }
  4401. if max > 3 {
  4402. *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrUint8(bp+176+uintptr(best+1), uint8(':'))
  4403. Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1))
  4404. }
  4405. if Xstrlen(tls, bp+176) < size_t(l) {
  4406. Xstrcpy(tls, s, bp+176)
  4407. return s
  4408. }
  4409. break
  4410. default:
  4411. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  4412. return uintptr(0)
  4413. }
  4414. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
  4415. return uintptr(0)
  4416. }
  4417. func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
  4418. if c-uint32('0') < uint32(10) {
  4419. return int32(c - uint32('0'))
  4420. }
  4421. c = c | uint32(32)
  4422. if c-uint32('a') < uint32(6) {
  4423. return int32(c - uint32('a') + uint32(10))
  4424. }
  4425. return -1
  4426. }
  4427. func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
  4428. bp := tls.Alloc(16)
  4429. defer tls.Free(16)
  4430. // var ip [8]uint16_t at bp, 16
  4431. var a uintptr = a0
  4432. var i int32
  4433. var j int32
  4434. var v int32
  4435. var d int32
  4436. var brk int32 = -1
  4437. var need_v4 int32 = 0
  4438. if af == 2 {
  4439. for i = 0; i < 4; i++ {
  4440. for v = AssignInt32(&j, 0); j < 3 && func() int32 {
  4441. if 0 != 0 {
  4442. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))
  4443. }
  4444. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
  4445. }() != 0; j++ {
  4446. v = 10*v + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) - '0'
  4447. }
  4448. if j == 0 || j > 1 && int32(*(*uint8)(unsafe.Pointer(s))) == '0' || v > 255 {
  4449. return 0
  4450. }
  4451. *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
  4452. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
  4453. return 1
  4454. }
  4455. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
  4456. return 0
  4457. }
  4458. s += uintptr(j + 1)
  4459. }
  4460. return 0
  4461. } else if af != 10 {
  4462. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  4463. return -1
  4464. }
  4465. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
  4466. return 0
  4467. }
  4468. for i = 0; ; i++ {
  4469. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && brk < 0 {
  4470. brk = i
  4471. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
  4472. if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
  4473. break
  4474. }
  4475. if i == 7 {
  4476. return 0
  4477. }
  4478. continue
  4479. }
  4480. for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
  4481. v = 16*v + d
  4482. }
  4483. if j == 0 {
  4484. return 0
  4485. }
  4486. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
  4487. if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
  4488. break
  4489. }
  4490. if i == 7 {
  4491. return 0
  4492. }
  4493. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
  4494. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
  4495. return 0
  4496. }
  4497. need_v4 = 1
  4498. i++
  4499. break
  4500. }
  4501. s += uintptr(j + 1)
  4502. }
  4503. if brk >= 0 {
  4504. Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk)))
  4505. for j = 0; j < 7-i; j++ {
  4506. *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
  4507. }
  4508. }
  4509. for j = 0; j < 8; j++ {
  4510. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
  4511. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
  4512. }
  4513. if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
  4514. return 0
  4515. }
  4516. return 1
  4517. }
  4518. func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
  4519. bp := tls.Alloc(96)
  4520. defer tls.Free(96)
  4521. // var a4 in_addr at bp, 4
  4522. // var a6 in6_addr at bp+68, 16
  4523. if X__inet_aton(tls, name, bp) > 0 {
  4524. if family == 10 { // wrong family
  4525. return -2
  4526. }
  4527. Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{})))
  4528. (*address)(unsafe.Pointer(buf)).family = 2
  4529. (*address)(unsafe.Pointer(buf)).scopeid = uint32(0)
  4530. return 1
  4531. }
  4532. // var tmp [64]uint8 at bp+4, 64
  4533. var p uintptr = Xstrchr(tls, name, '%')
  4534. // var z uintptr at bp+88, 8
  4535. var scopeid uint64 = uint64(0)
  4536. if p != 0 && (int64(p)-int64(name))/1 < int64(64) {
  4537. Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1))
  4538. *(*uint8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = uint8(0)
  4539. name = bp + 4 /* &tmp[0] */
  4540. }
  4541. if Xinet_pton(tls, 10, name, bp+68) <= 0 {
  4542. return 0
  4543. }
  4544. if family == 2 { // wrong family
  4545. return -2
  4546. }
  4547. Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{})))
  4548. (*address)(unsafe.Pointer(buf)).family = 10
  4549. if p != 0 {
  4550. if func() int32 {
  4551. if 0 != 0 {
  4552. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
  4553. }
  4554. return Bool32(uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
  4555. }() != 0 {
  4556. scopeid = Xstrtoull(tls, p, bp+88, 10)
  4557. } else {
  4558. *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1)
  4559. }
  4560. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 {
  4561. Xabort(tls) //TODO-
  4562. // if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
  4563. // !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
  4564. // return EAI_NONAME;
  4565. // scopeid = if_nametoindex(p);
  4566. // if (!scopeid) return EAI_NONAME;
  4567. }
  4568. if scopeid > uint64(0xffffffff) {
  4569. return -2
  4570. }
  4571. }
  4572. (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid)
  4573. return 1
  4574. }
  4575. func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
  4576. var s uintptr
  4577. //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
  4578. if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) {
  4579. return 0
  4580. }
  4581. 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++ {
  4582. }
  4583. return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
  4584. }
  4585. var Xzero_struct_address address /* lookup_name.c:27:16: */
  4586. func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
  4587. var cnt int32 = 0
  4588. if name != 0 {
  4589. return 0
  4590. }
  4591. if flags&0x01 != 0 {
  4592. //TODO if (family != AF_INET6)
  4593. //TODO buf[cnt++] = (struct address){ .family = AF_INET };
  4594. if family != 10 {
  4595. var x = Xzero_struct_address
  4596. x.family = 2
  4597. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  4598. }
  4599. //TODO if (family != AF_INET)
  4600. //TODO buf[cnt++] = (struct address){ .family = AF_INET6 };
  4601. if family != 2 {
  4602. var x = Xzero_struct_address
  4603. x.family = 10
  4604. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  4605. }
  4606. } else {
  4607. Xabort(tls) //TODO-
  4608. // if (family != AF_INET6)
  4609. // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
  4610. // if (family != AF_INET)
  4611. // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
  4612. }
  4613. return cnt
  4614. }
  4615. func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
  4616. return X__lookup_ipliteral(tls, buf, name, family)
  4617. }
  4618. func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
  4619. bp := tls.Alloc(512)
  4620. defer tls.Free(512)
  4621. // var line [512]uint8 at bp, 512
  4622. var l size_t = Xstrlen(tls, name)
  4623. var cnt int32 = 0
  4624. var badfam int32 = 0
  4625. var _buf [1032]uint8
  4626. _ = _buf
  4627. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  4628. var _f FILE
  4629. _ = _f
  4630. var f uintptr = Xfopen(tls, ts+76, ts+87)
  4631. if !(f != 0) {
  4632. switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
  4633. case 2:
  4634. fallthrough
  4635. case 20:
  4636. fallthrough
  4637. case 13:
  4638. return 0
  4639. fallthrough
  4640. default:
  4641. return -11
  4642. }
  4643. }
  4644. for Xfgets(tls, bp, int32(unsafe.Sizeof([512]uint8{})), f) != 0 && cnt < 48 {
  4645. var p uintptr
  4646. var z uintptr
  4647. if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
  4648. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  4649. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  4650. }
  4651. 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++ {
  4652. }
  4653. if !(p != 0) {
  4654. continue
  4655. }
  4656. // Isolate IP address to parse
  4657. for p = bp; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  4658. }
  4659. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  4660. switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
  4661. case 1:
  4662. cnt++
  4663. break
  4664. case 0:
  4665. continue
  4666. default:
  4667. badfam = -2
  4668. continue
  4669. }
  4670. // Extract first name as canonical name
  4671. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  4672. }
  4673. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  4674. }
  4675. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  4676. if is_valid_hostname(tls, p) != 0 {
  4677. Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1)))
  4678. }
  4679. }
  4680. //TODO __fclose_ca(f);
  4681. Xfclose(tls, f)
  4682. if cnt != 0 {
  4683. return cnt
  4684. }
  4685. return badfam
  4686. }
  4687. type dpc_ctx = struct {
  4688. addrs uintptr
  4689. canon uintptr
  4690. cnt int32
  4691. _ [4]byte
  4692. } /* lookup_name.c:112:1 */
  4693. func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
  4694. return -1 //TODO-
  4695. Xabort(tls)
  4696. return int32(0) //TODO-
  4697. // char search[256];
  4698. // struct resolvconf conf;
  4699. // size_t l, dots;
  4700. // char *p, *z;
  4701. // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
  4702. // /* Count dots, suppress search when >=ndots or name ends in
  4703. // * a dot, which is an explicit request for global scope. */
  4704. // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
  4705. // if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
  4706. // /* Strip final dot for canon, fail if multiple trailing dots. */
  4707. // if (name[l-1]=='.') l--;
  4708. // if (!l || name[l-1]=='.') return EAI_NONAME;
  4709. // /* This can never happen; the caller already checked length. */
  4710. // if (l >= 256) return EAI_NONAME;
  4711. // /* Name with search domain appended is setup in canon[]. This both
  4712. // * provides the desired default canonical name (if the requested
  4713. // * name is not a CNAME record) and serves as a buffer for passing
  4714. // * the full requested name to name_from_dns. */
  4715. // memcpy(canon, name, l);
  4716. // canon[l] = '.';
  4717. // for (p=search; *p; p=z) {
  4718. // for (; isspace(*p); p++);
  4719. // for (z=p; *z && !isspace(*z); z++);
  4720. // if (z==p) break;
  4721. // if (z-p < 256 - l - 1) {
  4722. // memcpy(canon+l+1, p, z-p);
  4723. // canon[z-p+1+l] = 0;
  4724. // int cnt = name_from_dns(buf, canon, canon, family, &conf);
  4725. // if (cnt) return cnt;
  4726. // }
  4727. // }
  4728. // canon[l] = 0;
  4729. // return name_from_dns(buf, canon, name, family, &conf);
  4730. }
  4731. type policy = struct {
  4732. addr [16]uint8
  4733. len uint8
  4734. mask uint8
  4735. prec uint8
  4736. label uint8
  4737. } /* lookup_name.c:237:14 */
  4738. var defpolicy = [6]policy{
  4739. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)},
  4740. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)},
  4741. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)},
  4742. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)},
  4743. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)},
  4744. // Last rule must match all addresses to stop loop.
  4745. {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)},
  4746. } /* lookup_name.c:241:3 */
  4747. func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
  4748. var i int32
  4749. for i = 0; ; i++ {
  4750. if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].len)) != 0 {
  4751. continue
  4752. }
  4753. if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) !=
  4754. int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) {
  4755. continue
  4756. }
  4757. return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
  4758. }
  4759. return uintptr(0)
  4760. }
  4761. func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
  4762. return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label)
  4763. }
  4764. func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
  4765. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
  4766. return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
  4767. }
  4768. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
  4769. return 2
  4770. }
  4771. 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 {
  4772. return 2
  4773. }
  4774. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
  4775. return 5
  4776. }
  4777. return 14
  4778. }
  4779. func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
  4780. // FIXME: The common prefix length should be limited to no greater
  4781. // than the nominal length of the prefix portion of the source
  4782. // address. However the definition of the source prefix length is
  4783. // not clear and thus this limiting is not yet implemented.
  4784. var i uint32
  4785. 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++ {
  4786. }
  4787. return int32(i)
  4788. }
  4789. func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
  4790. var a uintptr = _a
  4791. var b uintptr = _b
  4792. return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey
  4793. }
  4794. func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
  4795. bp := tls.Alloc(92)
  4796. defer tls.Free(92)
  4797. var cnt int32 = 0
  4798. var i int32
  4799. var j int32
  4800. _ = j
  4801. *(*uint8)(unsafe.Pointer(canon)) = uint8(0)
  4802. if name != 0 {
  4803. // reject empty name and check len so it fits into temp bufs
  4804. var l size_t = Xstrnlen(tls, name, uint64(255))
  4805. if l-uint64(1) >= uint64(254) {
  4806. return -2
  4807. }
  4808. Xmemcpy(tls, canon, name, l+uint64(1))
  4809. }
  4810. // Procedurally, a request for v6 addresses with the v4-mapped
  4811. // flag set is like a request for unspecified family, followed
  4812. // by filtering of the results.
  4813. if flags&0x08 != 0 {
  4814. if family == 10 {
  4815. family = 0
  4816. } else {
  4817. flags = flags - 0x08
  4818. }
  4819. }
  4820. // Try each backend until there's at least one result.
  4821. cnt = name_from_null(tls, buf, name, family, flags)
  4822. if !(cnt != 0) {
  4823. cnt = name_from_numeric(tls, buf, name, family)
  4824. }
  4825. if !(cnt != 0) && !(flags&0x04 != 0) {
  4826. cnt = name_from_hosts(tls, buf, canon, name, family)
  4827. if !(cnt != 0) {
  4828. cnt = name_from_dns_search(tls, buf, canon, name, family)
  4829. }
  4830. }
  4831. if cnt <= 0 {
  4832. if cnt != 0 {
  4833. return cnt
  4834. }
  4835. return -2
  4836. }
  4837. // Filter/transform results for v4-mapped lookup, if requested.
  4838. if flags&0x08 != 0 {
  4839. Xabort(tls) //TODO-
  4840. // if (!(flags & AI_ALL)) {
  4841. // /* If any v6 results exist, remove v4 results. */
  4842. // for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
  4843. // if (i<cnt) {
  4844. // for (j=0; i<cnt; i++) {
  4845. // if (buf[i].family == AF_INET6)
  4846. // buf[j++] = buf[i];
  4847. // }
  4848. // cnt = i = j;
  4849. // }
  4850. // }
  4851. // /* Translate any remaining v4 results to v6 */
  4852. // for (i=0; i<cnt; i++) {
  4853. // if (buf[i].family != AF_INET) continue;
  4854. // memcpy(buf[i].addr+12, buf[i].addr, 4);
  4855. // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
  4856. // buf[i].family = AF_INET6;
  4857. // }
  4858. }
  4859. // No further processing is needed if there are fewer than 2
  4860. // results or if there are only IPv4 results.
  4861. if cnt < 2 || family == 2 {
  4862. return cnt
  4863. }
  4864. for i = 0; i < cnt; i++ {
  4865. if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).family != 2 {
  4866. break
  4867. }
  4868. }
  4869. if i == cnt {
  4870. return cnt
  4871. }
  4872. var cs int32
  4873. _ = cs
  4874. //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
  4875. // The following implements a subset of RFC 3484/6724 destination
  4876. // address selection by generating a single 31-bit sort key for
  4877. // each address. Rules 3, 4, and 7 are omitted for having
  4878. // excessive runtime and code size cost and dubious benefit.
  4879. // So far the label/precedence table cannot be customized.
  4880. for i = 0; i < cnt; i++ {
  4881. var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).family
  4882. var key int32 = 0
  4883. *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
  4884. *(*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}
  4885. *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
  4886. *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{sin_family: sa_family_t(2), sin_port: in_port_t(65535)}
  4887. var sa1 uintptr
  4888. var da uintptr
  4889. // var salen socklen_t at bp+88, 4
  4890. var dalen socklen_t
  4891. if family == 10 {
  4892. Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16))
  4893. da = bp /* &da6 */
  4894. dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  4895. sa1 = bp + 28 /* &sa6 */
  4896. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  4897. } else {
  4898. Xmemcpy(tls, bp+28+8,
  4899. ts+90, uint64(12))
  4900. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
  4901. Xmemcpy(tls, bp+8,
  4902. ts+90, uint64(12))
  4903. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
  4904. Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4))
  4905. da = bp + 56 /* &da4 */
  4906. dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  4907. sa1 = bp + 72 /* &sa4 */
  4908. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  4909. }
  4910. var dpolicy uintptr = policyof(tls, bp+8)
  4911. var dscope int32 = scopeof(tls, bp+8)
  4912. var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).label)
  4913. var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).prec)
  4914. var prefixlen int32 = 0
  4915. var fd int32 = Xsocket(tls, family, 2|02000000, 17)
  4916. if fd >= 0 {
  4917. if !(Xconnect(tls, fd, da, dalen) != 0) {
  4918. key = key | 0x40000000
  4919. if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
  4920. if family == 2 {
  4921. Xmemcpy(tls,
  4922. bp+28+8+uintptr(12),
  4923. bp+72+4, uint64(4))
  4924. }
  4925. if dscope == scopeof(tls, bp+28+8) {
  4926. key = key | 0x20000000
  4927. }
  4928. if dlabel == labelof(tls, bp+28+8) {
  4929. key = key | 0x10000000
  4930. }
  4931. prefixlen = prefixmatch(tls, bp+28+8,
  4932. bp+8)
  4933. }
  4934. }
  4935. Xclose(tls, fd)
  4936. }
  4937. key = key | dprec<<20
  4938. key = key | (15-dscope)<<16
  4939. key = key | prefixlen<<8
  4940. key = key | (48-i)<<0
  4941. (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key
  4942. }
  4943. Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
  4944. f func(*TLS, uintptr, uintptr) int32
  4945. }{addrcmp})))
  4946. //TODO pthread_setcancelstate(cs, 0);
  4947. return cnt
  4948. }
  4949. func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
  4950. bp := tls.Alloc(8)
  4951. defer tls.Free(8)
  4952. var line [128]uint8
  4953. _ = line
  4954. var cnt int32 = 0
  4955. var p uintptr
  4956. _ = p
  4957. *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */
  4958. var port uint64 = uint64(0)
  4959. switch socktype {
  4960. case 1:
  4961. switch proto {
  4962. case 0:
  4963. proto = 6
  4964. fallthrough
  4965. case 6:
  4966. break
  4967. default:
  4968. return -8
  4969. }
  4970. break
  4971. case 2:
  4972. switch proto {
  4973. case 0:
  4974. proto = 17
  4975. fallthrough
  4976. case 17:
  4977. break
  4978. default:
  4979. return -8
  4980. }
  4981. fallthrough
  4982. case 0:
  4983. break
  4984. default:
  4985. if name != 0 {
  4986. return -8
  4987. }
  4988. (*service)(unsafe.Pointer(buf)).port = uint16_t(0)
  4989. (*service)(unsafe.Pointer(buf)).proto = uint8(proto)
  4990. (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype)
  4991. return 1
  4992. }
  4993. if name != 0 {
  4994. if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) {
  4995. return -8
  4996. }
  4997. port = Xstrtoul(tls, name, bp, 10)
  4998. }
  4999. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
  5000. if port > uint64(65535) {
  5001. return -8
  5002. }
  5003. if proto != 17 {
  5004. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port)
  5005. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1)
  5006. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6)
  5007. }
  5008. if proto != 6 {
  5009. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port)
  5010. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2)
  5011. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17)
  5012. }
  5013. return cnt
  5014. }
  5015. if flags&0x400 != 0 {
  5016. return -2
  5017. }
  5018. var l size_t = Xstrlen(tls, name)
  5019. _ = l
  5020. Xabort(tls) //TODO-
  5021. // unsigned char _buf[1032];
  5022. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  5023. // if (!f) switch (errno) {
  5024. // case ENOENT:
  5025. // case ENOTDIR:
  5026. // case EACCES:
  5027. // return EAI_SERVICE;
  5028. // default:
  5029. // return EAI_SYSTEM;
  5030. // }
  5031. Xabort(tls) //TODO-
  5032. // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
  5033. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  5034. // /* Find service name */
  5035. // for(p=line; (p=strstr(p, name)); p++) {
  5036. // if (p>line && !isspace(p[-1])) continue;
  5037. // if (p[l] && !isspace(p[l])) continue;
  5038. // break;
  5039. // }
  5040. // if (!p) continue;
  5041. // /* Skip past canonical name at beginning of line */
  5042. // for (p=line; *p && !isspace(*p); p++);
  5043. // port = strtoul(p, &z, 10);
  5044. // if (port > 65535 || z==p) continue;
  5045. // if (!strncmp(z, "/udp", 4)) {
  5046. // if (proto == IPPROTO_TCP) continue;
  5047. // buf[cnt].port = port;
  5048. // buf[cnt].socktype = SOCK_DGRAM;
  5049. // buf[cnt++].proto = IPPROTO_UDP;
  5050. // }
  5051. // if (!strncmp(z, "/tcp", 4)) {
  5052. // if (proto == IPPROTO_UDP) continue;
  5053. // buf[cnt].port = port;
  5054. // buf[cnt].socktype = SOCK_STREAM;
  5055. // buf[cnt++].proto = IPPROTO_TCP;
  5056. // }
  5057. // }
  5058. // __fclose_ca(f);
  5059. // return cnt > 0 ? cnt : EAI_SERVICE;
  5060. Xabort(tls)
  5061. return int32(0) //TODO-
  5062. }
  5063. func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
  5064. x = x ^ x>>11
  5065. x = x ^ x<<7&0x9D2C5680
  5066. x = x ^ x<<15&0xEFC60000
  5067. x = x ^ x>>18
  5068. return x
  5069. }
  5070. func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
  5071. return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
  5072. }
  5073. func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
  5074. var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
  5075. var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
  5076. if owner&CplInt32(0x40000000) == tid {
  5077. return 0
  5078. }
  5079. owner = a_cas(tls, f+140, 0, tid)
  5080. if !(owner != 0) {
  5081. return 1
  5082. }
  5083. for AssignInt32(&owner, a_cas(tls, f+140, 0, tid|0x40000000)) != 0 {
  5084. if owner&0x40000000 != 0 || a_cas(tls, f+140, owner, owner|0x40000000) == owner {
  5085. __futexwait(tls, f+140, owner|0x40000000, 1)
  5086. }
  5087. }
  5088. return 1
  5089. }
  5090. func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
  5091. if a_swap(tls, f+140, 0)&0x40000000 != 0 {
  5092. __wake(tls, f+140, 1, 1)
  5093. }
  5094. }
  5095. func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
  5096. *(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
  5097. if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
  5098. (*struct {
  5099. f func(*TLS, uintptr, uintptr, size_t) size_t
  5100. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint64(0))
  5101. }
  5102. (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0)))
  5103. if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 {
  5104. *(*uint32)(unsafe.Pointer(f)) |= uint32(32)
  5105. return -1
  5106. }
  5107. (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size))
  5108. if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 {
  5109. return -1
  5110. }
  5111. return 0
  5112. }
  5113. func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
  5114. X__builtin_abort(tls) //TODO-
  5115. // __stdio_exit_needed();
  5116. }
  5117. // This function assumes it will never be called if there is already
  5118. // data buffered for reading.
  5119. func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
  5120. bp := tls.Alloc(1)
  5121. defer tls.Free(1)
  5122. // var c uint8 at bp, 1
  5123. if !(X__toread(tls, f) != 0) && (*struct {
  5124. f func(*TLS, uintptr, uintptr, size_t) size_t
  5125. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint64(1)) == uint64(1) {
  5126. return int32(*(*uint8)(unsafe.Pointer(bp)))
  5127. }
  5128. return -1
  5129. }
  5130. func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
  5131. var ret int32
  5132. var ap va_list
  5133. _ = ap
  5134. ap = va
  5135. ret = Xvsscanf(tls, s, fmt, ap)
  5136. _ = ap
  5137. return ret
  5138. }
  5139. type wctrans_t = uintptr /* wctype.h:20:19 */
  5140. func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */
  5141. if !(dest != 0) {
  5142. return
  5143. }
  5144. switch size {
  5145. case -2:
  5146. *(*uint8)(unsafe.Pointer(dest)) = uint8(i)
  5147. break
  5148. case -1:
  5149. *(*int16)(unsafe.Pointer(dest)) = int16(i)
  5150. break
  5151. case 0:
  5152. *(*int32)(unsafe.Pointer(dest)) = int32(i)
  5153. break
  5154. case 1:
  5155. *(*int64)(unsafe.Pointer(dest)) = int64(i)
  5156. break
  5157. case 3:
  5158. *(*int64)(unsafe.Pointer(dest)) = int64(i)
  5159. break
  5160. }
  5161. }
  5162. func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
  5163. var p uintptr
  5164. var i uint32
  5165. var ap2 va_list
  5166. _ = ap2
  5167. ap2 = ap
  5168. for i = n; i > uint32(1); i-- {
  5169. VaUintptr(&ap2)
  5170. }
  5171. p = VaUintptr(&ap2)
  5172. _ = ap2
  5173. return p
  5174. }
  5175. func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
  5176. bp := tls.Alloc(276)
  5177. defer tls.Free(276)
  5178. var width int32
  5179. var size int32
  5180. var alloc int32
  5181. var base int32
  5182. var p uintptr
  5183. var c int32
  5184. var t int32
  5185. var s uintptr
  5186. var wcs uintptr
  5187. // var st mbstate_t at bp+268, 8
  5188. var dest uintptr
  5189. var invert int32
  5190. var matches int32
  5191. var x uint64
  5192. var y float64
  5193. var pos off_t
  5194. // var scanset [257]uint8 at bp, 257
  5195. var i size_t
  5196. var k size_t
  5197. // var wc wchar_t at bp+260, 4
  5198. var __need_unlock int32
  5199. var tmp uintptr
  5200. var tmp1 uintptr
  5201. alloc = 0
  5202. dest = uintptr(0)
  5203. matches = 0
  5204. pos = int64(0)
  5205. __need_unlock = func() int32 {
  5206. if (*FILE)(unsafe.Pointer(f)).lock >= 0 {
  5207. return X__lockfile(tls, f)
  5208. }
  5209. return 0
  5210. }()
  5211. if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) {
  5212. goto __1
  5213. }
  5214. X__toread(tls, f)
  5215. __1:
  5216. ;
  5217. if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) {
  5218. goto __2
  5219. }
  5220. goto input_fail
  5221. __2:
  5222. ;
  5223. p = fmt
  5224. __3:
  5225. if !(*(*uint8)(unsafe.Pointer(p)) != 0) {
  5226. goto __5
  5227. }
  5228. alloc = 0
  5229. if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) {
  5230. goto __6
  5231. }
  5232. __7:
  5233. if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) {
  5234. goto __8
  5235. }
  5236. p++
  5237. goto __7
  5238. __8:
  5239. ;
  5240. X__shlim(tls, f, int64(0))
  5241. __9:
  5242. if !(__isspace(tls, func() int32 {
  5243. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5244. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5245. }
  5246. return X__shgetc(tls, f)
  5247. }()) != 0) {
  5248. goto __10
  5249. }
  5250. goto __9
  5251. __10:
  5252. ;
  5253. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5254. (*FILE)(unsafe.Pointer(f)).rpos--
  5255. } else {
  5256. }
  5257. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1)
  5258. goto __4
  5259. __6:
  5260. ;
  5261. if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') {
  5262. goto __11
  5263. }
  5264. X__shlim(tls, f, int64(0))
  5265. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') {
  5266. goto __12
  5267. }
  5268. p++
  5269. __14:
  5270. if !(__isspace(tls, AssignInt32(&c, func() int32 {
  5271. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5272. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5273. }
  5274. return X__shgetc(tls, f)
  5275. }())) != 0) {
  5276. goto __15
  5277. }
  5278. goto __14
  5279. __15:
  5280. ;
  5281. goto __13
  5282. __12:
  5283. c = func() int32 {
  5284. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5285. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5286. }
  5287. return X__shgetc(tls, f)
  5288. }()
  5289. __13:
  5290. ;
  5291. if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) {
  5292. goto __16
  5293. }
  5294. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5295. (*FILE)(unsafe.Pointer(f)).rpos--
  5296. } else {
  5297. }
  5298. if !(c < 0) {
  5299. goto __17
  5300. }
  5301. goto input_fail
  5302. __17:
  5303. ;
  5304. goto match_fail
  5305. __16:
  5306. ;
  5307. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1)
  5308. goto __4
  5309. __11:
  5310. ;
  5311. p++
  5312. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') {
  5313. goto __18
  5314. }
  5315. dest = uintptr(0)
  5316. p++
  5317. goto __19
  5318. __18:
  5319. if !(func() int32 {
  5320. if 0 != 0 {
  5321. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p))))
  5322. }
  5323. return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10))
  5324. }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') {
  5325. goto __20
  5326. }
  5327. dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0'))
  5328. p += uintptr(2)
  5329. goto __21
  5330. __20:
  5331. dest = VaUintptr(&ap)
  5332. __21:
  5333. ;
  5334. __19:
  5335. ;
  5336. width = 0
  5337. __22:
  5338. if !(func() int32 {
  5339. if 0 != 0 {
  5340. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p))))
  5341. }
  5342. return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10))
  5343. }() != 0) {
  5344. goto __24
  5345. }
  5346. width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0'
  5347. goto __23
  5348. __23:
  5349. p++
  5350. goto __22
  5351. goto __24
  5352. __24:
  5353. ;
  5354. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') {
  5355. goto __25
  5356. }
  5357. wcs = uintptr(0)
  5358. s = uintptr(0)
  5359. alloc = BoolInt32(!!(dest != 0))
  5360. p++
  5361. goto __26
  5362. __25:
  5363. alloc = 0
  5364. __26:
  5365. ;
  5366. size = 0
  5367. switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) {
  5368. case 'h':
  5369. goto __28
  5370. case 'l':
  5371. goto __29
  5372. case 'j':
  5373. goto __30
  5374. case 'z':
  5375. goto __31
  5376. case 't':
  5377. goto __32
  5378. case 'L':
  5379. goto __33
  5380. case 'd':
  5381. goto __34
  5382. case 'i':
  5383. goto __35
  5384. case 'o':
  5385. goto __36
  5386. case 'u':
  5387. goto __37
  5388. case 'x':
  5389. goto __38
  5390. case 'a':
  5391. goto __39
  5392. case 'e':
  5393. goto __40
  5394. case 'f':
  5395. goto __41
  5396. case 'g':
  5397. goto __42
  5398. case 'A':
  5399. goto __43
  5400. case 'E':
  5401. goto __44
  5402. case 'F':
  5403. goto __45
  5404. case 'G':
  5405. goto __46
  5406. case 'X':
  5407. goto __47
  5408. case 's':
  5409. goto __48
  5410. case 'c':
  5411. goto __49
  5412. case '[':
  5413. goto __50
  5414. case 'S':
  5415. goto __51
  5416. case 'C':
  5417. goto __52
  5418. case 'p':
  5419. goto __53
  5420. case 'n':
  5421. goto __54
  5422. default:
  5423. goto __55
  5424. }
  5425. goto __27
  5426. __28:
  5427. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') {
  5428. goto __56
  5429. }
  5430. p++
  5431. size = -2
  5432. goto __57
  5433. __56:
  5434. size = -1
  5435. __57:
  5436. ;
  5437. goto __27
  5438. __29:
  5439. if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') {
  5440. goto __58
  5441. }
  5442. p++
  5443. size = 3
  5444. goto __59
  5445. __58:
  5446. size = 1
  5447. __59:
  5448. ;
  5449. goto __27
  5450. __30:
  5451. size = 3
  5452. goto __27
  5453. __31:
  5454. __32:
  5455. size = 1
  5456. goto __27
  5457. __33:
  5458. size = 2
  5459. goto __27
  5460. __34:
  5461. __35:
  5462. __36:
  5463. __37:
  5464. __38:
  5465. __39:
  5466. __40:
  5467. __41:
  5468. __42:
  5469. __43:
  5470. __44:
  5471. __45:
  5472. __46:
  5473. __47:
  5474. __48:
  5475. __49:
  5476. __50:
  5477. __51:
  5478. __52:
  5479. __53:
  5480. __54:
  5481. p--
  5482. goto __27
  5483. __55:
  5484. goto fmt_fail
  5485. __27:
  5486. ;
  5487. t = int32(*(*uint8)(unsafe.Pointer(p)))
  5488. // C or S
  5489. if !(t&0x2f == 3) {
  5490. goto __60
  5491. }
  5492. t = t | 32
  5493. size = 1
  5494. __60:
  5495. ;
  5496. switch t {
  5497. case 'c':
  5498. goto __62
  5499. case '[':
  5500. goto __63
  5501. case 'n':
  5502. goto __64
  5503. default:
  5504. goto __65
  5505. }
  5506. goto __61
  5507. __62:
  5508. if !(width < 1) {
  5509. goto __66
  5510. }
  5511. width = 1
  5512. __66:
  5513. ;
  5514. __63:
  5515. goto __61
  5516. __64:
  5517. store_int(tls, dest, size, uint64(pos))
  5518. // do not increment match count, etc!
  5519. goto __4
  5520. __65:
  5521. X__shlim(tls, f, int64(0))
  5522. __67:
  5523. if !(__isspace(tls, func() int32 {
  5524. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5525. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5526. }
  5527. return X__shgetc(tls, f)
  5528. }()) != 0) {
  5529. goto __68
  5530. }
  5531. goto __67
  5532. __68:
  5533. ;
  5534. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5535. (*FILE)(unsafe.Pointer(f)).rpos--
  5536. } else {
  5537. }
  5538. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1)
  5539. __61:
  5540. ;
  5541. X__shlim(tls, f, int64(width))
  5542. if !(func() int32 {
  5543. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5544. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5545. }
  5546. return X__shgetc(tls, f)
  5547. }() < 0) {
  5548. goto __69
  5549. }
  5550. goto input_fail
  5551. __69:
  5552. ;
  5553. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5554. (*FILE)(unsafe.Pointer(f)).rpos--
  5555. } else {
  5556. }
  5557. switch t {
  5558. case 's':
  5559. goto __71
  5560. case 'c':
  5561. goto __72
  5562. case '[':
  5563. goto __73
  5564. case 'p':
  5565. goto __74
  5566. case 'X':
  5567. goto __75
  5568. case 'x':
  5569. goto __76
  5570. case 'o':
  5571. goto __77
  5572. case 'd':
  5573. goto __78
  5574. case 'u':
  5575. goto __79
  5576. case 'i':
  5577. goto __80
  5578. case 'a':
  5579. goto __81
  5580. case 'A':
  5581. goto __82
  5582. case 'e':
  5583. goto __83
  5584. case 'E':
  5585. goto __84
  5586. case 'f':
  5587. goto __85
  5588. case 'F':
  5589. goto __86
  5590. case 'g':
  5591. goto __87
  5592. case 'G':
  5593. goto __88
  5594. }
  5595. goto __70
  5596. __71:
  5597. __72:
  5598. __73:
  5599. if !(t == 'c' || t == 's') {
  5600. goto __89
  5601. }
  5602. Xmemset(tls, bp, -1, uint64(unsafe.Sizeof([257]uint8{})))
  5603. *(*uint8)(unsafe.Pointer(bp)) = uint8(0)
  5604. if !(t == 's') {
  5605. goto __91
  5606. }
  5607. *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0)
  5608. *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0)
  5609. *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0)
  5610. *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0)
  5611. *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0)
  5612. *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0)
  5613. __91:
  5614. ;
  5615. goto __90
  5616. __89:
  5617. if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') {
  5618. goto __92
  5619. }
  5620. p++
  5621. invert = 1
  5622. goto __93
  5623. __92:
  5624. invert = 0
  5625. __93:
  5626. ;
  5627. Xmemset(tls, bp, invert, uint64(unsafe.Sizeof([257]uint8{})))
  5628. *(*uint8)(unsafe.Pointer(bp)) = uint8(0)
  5629. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') {
  5630. goto __94
  5631. }
  5632. p++
  5633. *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert)
  5634. goto __95
  5635. __94:
  5636. if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') {
  5637. goto __96
  5638. }
  5639. p++
  5640. *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert)
  5641. __96:
  5642. ;
  5643. __95:
  5644. ;
  5645. __97:
  5646. if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') {
  5647. goto __99
  5648. }
  5649. if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) {
  5650. goto __100
  5651. }
  5652. goto fmt_fail
  5653. __100:
  5654. ;
  5655. if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') {
  5656. goto __101
  5657. }
  5658. c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1))))
  5659. __102:
  5660. if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) {
  5661. goto __104
  5662. }
  5663. *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert)
  5664. goto __103
  5665. __103:
  5666. c++
  5667. goto __102
  5668. goto __104
  5669. __104:
  5670. ;
  5671. __101:
  5672. ;
  5673. *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert)
  5674. goto __98
  5675. __98:
  5676. p++
  5677. goto __97
  5678. goto __99
  5679. __99:
  5680. ;
  5681. __90:
  5682. ;
  5683. wcs = uintptr(0)
  5684. s = uintptr(0)
  5685. i = uint64(0)
  5686. if t == 'c' {
  5687. k = uint64(uint32(width) + 1)
  5688. } else {
  5689. k = uint64(31)
  5690. }
  5691. if !(size == 1) {
  5692. goto __105
  5693. }
  5694. if !(alloc != 0) {
  5695. goto __107
  5696. }
  5697. wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0))))
  5698. if !!(wcs != 0) {
  5699. goto __109
  5700. }
  5701. goto alloc_fail
  5702. __109:
  5703. ;
  5704. goto __108
  5705. __107:
  5706. wcs = dest
  5707. __108:
  5708. ;
  5709. *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{}
  5710. __110:
  5711. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5712. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5713. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5714. }
  5715. return X__shgetc(tls, f)
  5716. }())+1))) != 0) {
  5717. goto __111
  5718. }
  5719. switch Xmbrtowc(tls, bp+260, func() uintptr { *(*uint8)(unsafe.Pointer(bp + 264)) = uint8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) {
  5720. case Uint64FromInt32(-1):
  5721. goto __113
  5722. case Uint64FromInt32(-2):
  5723. goto __114
  5724. }
  5725. goto __112
  5726. __113:
  5727. goto input_fail
  5728. __114:
  5729. goto __110
  5730. __112:
  5731. ;
  5732. if !(wcs != 0) {
  5733. goto __115
  5734. }
  5735. *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint64(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */))
  5736. __115:
  5737. ;
  5738. if !(alloc != 0 && i == k) {
  5739. goto __116
  5740. }
  5741. k = k + (k + uint64(1))
  5742. tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0))))
  5743. if !!(tmp != 0) {
  5744. goto __117
  5745. }
  5746. goto alloc_fail
  5747. __117:
  5748. ;
  5749. wcs = tmp
  5750. __116:
  5751. ;
  5752. goto __110
  5753. __111:
  5754. ;
  5755. if !!(Xmbsinit(tls, bp+268) != 0) {
  5756. goto __118
  5757. }
  5758. goto input_fail
  5759. __118:
  5760. ;
  5761. goto __106
  5762. __105:
  5763. if !(alloc != 0) {
  5764. goto __119
  5765. }
  5766. s = Xmalloc(tls, k)
  5767. if !!(s != 0) {
  5768. goto __121
  5769. }
  5770. goto alloc_fail
  5771. __121:
  5772. ;
  5773. __122:
  5774. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5775. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5776. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5777. }
  5778. return X__shgetc(tls, f)
  5779. }())+1))) != 0) {
  5780. goto __123
  5781. }
  5782. *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c)
  5783. if !(i == k) {
  5784. goto __124
  5785. }
  5786. k = k + (k + uint64(1))
  5787. tmp1 = Xrealloc(tls, s, k)
  5788. if !!(tmp1 != 0) {
  5789. goto __125
  5790. }
  5791. goto alloc_fail
  5792. __125:
  5793. ;
  5794. s = tmp1
  5795. __124:
  5796. ;
  5797. goto __122
  5798. __123:
  5799. ;
  5800. goto __120
  5801. __119:
  5802. if !(AssignUintptr(&s, dest) != 0) {
  5803. goto __126
  5804. }
  5805. __128:
  5806. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5807. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5808. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5809. }
  5810. return X__shgetc(tls, f)
  5811. }())+1))) != 0) {
  5812. goto __129
  5813. }
  5814. *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c)
  5815. goto __128
  5816. __129:
  5817. ;
  5818. goto __127
  5819. __126:
  5820. __130:
  5821. if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 {
  5822. if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend {
  5823. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1))))
  5824. }
  5825. return X__shgetc(tls, f)
  5826. }())+1))) != 0) {
  5827. goto __131
  5828. }
  5829. goto __130
  5830. __131:
  5831. ;
  5832. __127:
  5833. ;
  5834. __120:
  5835. ;
  5836. __106:
  5837. ;
  5838. if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) {
  5839. (*FILE)(unsafe.Pointer(f)).rpos--
  5840. } else {
  5841. }
  5842. if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) {
  5843. goto __132
  5844. }
  5845. goto match_fail
  5846. __132:
  5847. ;
  5848. if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != off_t(width)) {
  5849. goto __133
  5850. }
  5851. goto match_fail
  5852. __133:
  5853. ;
  5854. if !(alloc != 0) {
  5855. goto __134
  5856. }
  5857. if !(size == 1) {
  5858. goto __135
  5859. }
  5860. *(*uintptr)(unsafe.Pointer(dest)) = wcs
  5861. goto __136
  5862. __135:
  5863. *(*uintptr)(unsafe.Pointer(dest)) = s
  5864. __136:
  5865. ;
  5866. __134:
  5867. ;
  5868. if !(t != 'c') {
  5869. goto __137
  5870. }
  5871. if !(wcs != 0) {
  5872. goto __138
  5873. }
  5874. *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = 0
  5875. __138:
  5876. ;
  5877. if !(s != 0) {
  5878. goto __139
  5879. }
  5880. *(*uint8)(unsafe.Pointer(s + uintptr(i))) = uint8(0)
  5881. __139:
  5882. ;
  5883. __137:
  5884. ;
  5885. goto __70
  5886. __74:
  5887. __75:
  5888. __76:
  5889. base = 16
  5890. goto int_common
  5891. __77:
  5892. base = 8
  5893. goto int_common
  5894. __78:
  5895. __79:
  5896. base = 10
  5897. goto int_common
  5898. __80:
  5899. base = 0
  5900. int_common:
  5901. x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1))
  5902. if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) {
  5903. goto __140
  5904. }
  5905. goto match_fail
  5906. __140:
  5907. ;
  5908. if !(t == 'p' && dest != 0) {
  5909. goto __141
  5910. }
  5911. *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x))
  5912. goto __142
  5913. __141:
  5914. store_int(tls, dest, size, x)
  5915. __142:
  5916. ;
  5917. goto __70
  5918. __81:
  5919. __82:
  5920. __83:
  5921. __84:
  5922. __85:
  5923. __86:
  5924. __87:
  5925. __88:
  5926. y = X__floatscan(tls, f, size, 0)
  5927. if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) {
  5928. goto __143
  5929. }
  5930. goto match_fail
  5931. __143:
  5932. ;
  5933. if !(dest != 0) {
  5934. goto __144
  5935. }
  5936. switch size {
  5937. case 0:
  5938. goto __146
  5939. case 1:
  5940. goto __147
  5941. case 2:
  5942. goto __148
  5943. }
  5944. goto __145
  5945. __146:
  5946. *(*float32)(unsafe.Pointer(dest)) = float32(y)
  5947. goto __145
  5948. __147:
  5949. *(*float64)(unsafe.Pointer(dest)) = y
  5950. goto __145
  5951. __148:
  5952. *(*float64)(unsafe.Pointer(dest)) = y
  5953. goto __145
  5954. __145:
  5955. ;
  5956. __144:
  5957. ;
  5958. goto __70
  5959. __70:
  5960. ;
  5961. pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1)
  5962. if !(dest != 0) {
  5963. goto __149
  5964. }
  5965. matches++
  5966. __149:
  5967. ;
  5968. goto __4
  5969. __4:
  5970. p++
  5971. goto __3
  5972. goto __5
  5973. __5:
  5974. ;
  5975. if !(0 != 0) {
  5976. goto __150
  5977. }
  5978. fmt_fail:
  5979. alloc_fail:
  5980. input_fail:
  5981. if !!(matches != 0) {
  5982. goto __151
  5983. }
  5984. matches--
  5985. __151:
  5986. ;
  5987. match_fail:
  5988. if !(alloc != 0) {
  5989. goto __152
  5990. }
  5991. Xfree(tls, s)
  5992. Xfree(tls, wcs)
  5993. __152:
  5994. ;
  5995. __150:
  5996. ;
  5997. __153:
  5998. if !(__need_unlock != 0) {
  5999. goto __156
  6000. }
  6001. X__unlockfile(tls, f)
  6002. __156:
  6003. ;
  6004. goto __154
  6005. __154:
  6006. if 0 != 0 {
  6007. goto __153
  6008. }
  6009. goto __155
  6010. __155:
  6011. ;
  6012. return matches
  6013. }
  6014. func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */
  6015. var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie
  6016. var k size_t = len + uint64(256)
  6017. var end uintptr = Xmemchr(tls, src, 0, k)
  6018. if end != 0 {
  6019. k = size_t((int64(end) - int64(src)) / 1)
  6020. }
  6021. if k < len {
  6022. len = k
  6023. }
  6024. Xmemcpy(tls, buf, src, len)
  6025. (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len)
  6026. (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k)
  6027. (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k)
  6028. return len
  6029. }
  6030. func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
  6031. bp := tls.Alloc(232)
  6032. defer tls.Free(232)
  6033. *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct {
  6034. f func(*TLS, uintptr, uintptr, size_t) size_t
  6035. }{string_read})), buf: s, lock: -1, cookie: s}
  6036. return Xvfscanf(tls, bp, fmt, ap)
  6037. }
  6038. func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
  6039. var try uintptr
  6040. var sign int32
  6041. for nel > uint64(0) {
  6042. try = base + uintptr(width*(nel/uint64(2)))
  6043. sign = (*struct {
  6044. f func(*TLS, uintptr, uintptr) int32
  6045. })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
  6046. if sign < 0 {
  6047. nel = nel / uint64(2)
  6048. } else if sign > 0 {
  6049. base = try + uintptr(width)
  6050. nel = nel - (nel/uint64(2) + uint64(1))
  6051. } else {
  6052. return try
  6053. }
  6054. }
  6055. return uintptr(0)
  6056. }
  6057. func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
  6058. bp := tls.Alloc(232)
  6059. defer tls.Free(232)
  6060. // var f FILE at bp, 232
  6061. (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s)
  6062. (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1)
  6063. X__shlim(tls, bp, int64(0))
  6064. var y float64 = X__floatscan(tls, bp, prec, 1)
  6065. var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1
  6066. if p != 0 {
  6067. *(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
  6068. if cnt != 0 {
  6069. return s + uintptr(cnt)
  6070. }
  6071. return s
  6072. }()
  6073. }
  6074. return y
  6075. }
  6076. func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
  6077. return float32(strtox(tls, s, p, 0))
  6078. }
  6079. func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
  6080. return strtox(tls, s, p, 1)
  6081. }
  6082. func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
  6083. return strtox(tls, s, p, 2)
  6084. }
  6085. func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
  6086. bp := tls.Alloc(232)
  6087. defer tls.Free(232)
  6088. // var f FILE at bp, 232
  6089. (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s)
  6090. (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1)
  6091. X__shlim(tls, bp, int64(0))
  6092. var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
  6093. if p != 0 {
  6094. var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1)
  6095. *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
  6096. }
  6097. return y
  6098. }
  6099. func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
  6100. return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
  6101. }
  6102. func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
  6103. return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
  6104. }
  6105. func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
  6106. return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
  6107. }
  6108. func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
  6109. return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
  6110. }
  6111. func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
  6112. return intmax_t(Xstrtoll(tls, s, p, base))
  6113. }
  6114. func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
  6115. return uintmax_t(Xstrtoull(tls, s, p, base))
  6116. }
  6117. func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
  6118. var l size_t = Xstrlen(tls, s)
  6119. var d uintptr = Xmalloc(tls, l+uint64(1))
  6120. if !(d != 0) {
  6121. return uintptr(0)
  6122. }
  6123. return Xmemcpy(tls, d, s, l+uint64(1))
  6124. }
  6125. func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
  6126. var l size_t = Xstrnlen(tls, d, n)
  6127. if l == n {
  6128. return l + Xstrlen(tls, s)
  6129. }
  6130. return l + Xstrlcpy(tls, d+uintptr(l), s, n-l)
  6131. }
  6132. // Support signed or unsigned plain-char
  6133. // Implementation choices...
  6134. // Arbitrary numbers...
  6135. // POSIX/SUS requirements follow. These numbers come directly
  6136. // from SUS and have nothing to do with the host system.
  6137. func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
  6138. var d0 uintptr
  6139. var wd uintptr
  6140. var ws uintptr
  6141. d0 = d
  6142. if !!(int32(PostDecUint64(&n, 1)) != 0) {
  6143. goto __1
  6144. }
  6145. goto finish
  6146. __1:
  6147. ;
  6148. if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) {
  6149. goto __2
  6150. }
  6151. __3:
  6152. if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) {
  6153. goto __5
  6154. }
  6155. goto __4
  6156. __4:
  6157. n--
  6158. s++
  6159. d++
  6160. goto __3
  6161. goto __5
  6162. __5:
  6163. ;
  6164. if !(n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0) {
  6165. goto __6
  6166. }
  6167. wd = d
  6168. ws = s
  6169. __7:
  6170. 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)) {
  6171. goto __9
  6172. }
  6173. *(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws))
  6174. goto __8
  6175. __8:
  6176. n = n - size_t(unsafe.Sizeof(size_t(0)))
  6177. ws += 8
  6178. wd += 8
  6179. goto __7
  6180. goto __9
  6181. __9:
  6182. ;
  6183. d = wd
  6184. s = ws
  6185. __6:
  6186. ;
  6187. __2:
  6188. ;
  6189. __10:
  6190. if !(n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) {
  6191. goto __12
  6192. }
  6193. goto __11
  6194. __11:
  6195. n--
  6196. s++
  6197. d++
  6198. goto __10
  6199. goto __12
  6200. __12:
  6201. ;
  6202. *(*uint8)(unsafe.Pointer(d)) = uint8(0)
  6203. finish:
  6204. return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s)
  6205. }
  6206. func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
  6207. var l uintptr = _l
  6208. var r uintptr = _r
  6209. if !(int32(PostDecUint64(&n, 1)) != 0) {
  6210. return 0
  6211. }
  6212. __1:
  6213. 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)))))) {
  6214. goto __3
  6215. }
  6216. goto __2
  6217. __2:
  6218. l++
  6219. r++
  6220. n--
  6221. goto __1
  6222. goto __3
  6223. __3:
  6224. ;
  6225. return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r))))
  6226. }
  6227. func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
  6228. return Xstrncasecmp(tls, l, r, n)
  6229. }
  6230. func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
  6231. var a uintptr = d
  6232. d += uintptr(Xstrlen(tls, d))
  6233. for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
  6234. n--
  6235. *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))
  6236. }
  6237. *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = uint8(0)
  6238. return a
  6239. }
  6240. func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
  6241. var p uintptr = Xmemchr(tls, s, 0, n)
  6242. if p != 0 {
  6243. return uint64((int64(p) - int64(s)) / 1)
  6244. }
  6245. return n
  6246. }
  6247. func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
  6248. bp := tls.Alloc(32)
  6249. defer tls.Free(32)
  6250. var a uintptr = s
  6251. *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)}
  6252. if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) {
  6253. return uint64(0)
  6254. }
  6255. if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) {
  6256. for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ {
  6257. }
  6258. return size_t((int64(s) - int64(a)) / 1)
  6259. }
  6260. 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++ {
  6261. }
  6262. 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++ {
  6263. }
  6264. return size_t((int64(s) - int64(a)) / 1)
  6265. }
  6266. func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
  6267. if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
  6268. return uintptr(0)
  6269. }
  6270. s += uintptr(Xstrspn(tls, s, sep))
  6271. if !(int32(*(*uint8)(unsafe.Pointer(s))) != 0) {
  6272. return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0))
  6273. }
  6274. _sp = s + uintptr(Xstrcspn(tls, s, sep))
  6275. if *(*uint8)(unsafe.Pointer(_sp)) != 0 {
  6276. *(*uint8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = uint8(0)
  6277. } else {
  6278. _sp = uintptr(0)
  6279. }
  6280. return s
  6281. }
  6282. var _sp uintptr /* strtok.c:5:14: */
  6283. func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
  6284. return *(*int32)(unsafe.Pointer(a + 6*4))
  6285. }
  6286. func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
  6287. *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
  6288. return 0
  6289. }
  6290. //
  6291. // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
  6292. // {
  6293. // *size = a->_a_guardsize;
  6294. // return 0;
  6295. // }
  6296. //
  6297. // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit)
  6298. // {
  6299. // *inherit = a->_a_sched;
  6300. // return 0;
  6301. // }
  6302. //
  6303. // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param)
  6304. // {
  6305. // param->sched_priority = a->_a_prio;
  6306. // return 0;
  6307. // }
  6308. //
  6309. // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy)
  6310. // {
  6311. // *policy = a->_a_policy;
  6312. // return 0;
  6313. // }
  6314. //
  6315. // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope)
  6316. // {
  6317. // *scope = PTHREAD_SCOPE_SYSTEM;
  6318. // return 0;
  6319. // }
  6320. //
  6321. // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size)
  6322. // {
  6323. // if (!a->_a_stackaddr)
  6324. // return EINVAL;
  6325. // *size = a->_a_stacksize;
  6326. // *addr = (void *)(a->_a_stackaddr - *size);
  6327. // return 0;
  6328. // }
  6329. //
  6330. // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
  6331. // {
  6332. // *size = a->_a_stacksize;
  6333. // return 0;
  6334. // }
  6335. //
  6336. // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared)
  6337. // {
  6338. // *pshared = !!a->__attr;
  6339. // return 0;
  6340. // }
  6341. //
  6342. // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk)
  6343. // {
  6344. // *clk = a->__attr & 0x7fffffff;
  6345. // return 0;
  6346. // }
  6347. //
  6348. // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared)
  6349. // {
  6350. // *pshared = a->__attr>>31;
  6351. // return 0;
  6352. // }
  6353. //
  6354. // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
  6355. // {
  6356. // *protocol = PTHREAD_PRIO_NONE;
  6357. // return 0;
  6358. // }
  6359. // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared)
  6360. // {
  6361. // *pshared = a->__attr / 128U % 2;
  6362. // return 0;
  6363. // }
  6364. //
  6365. // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust)
  6366. // {
  6367. // *robust = a->__attr / 4U % 2;
  6368. // return 0;
  6369. // }
  6370. func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
  6371. return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
  6372. }
  6373. // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type)
  6374. // {
  6375. // *type = a->__attr & 3;
  6376. // return 0;
  6377. // }
  6378. //
  6379. // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared)
  6380. // {
  6381. // *pshared = a->__attr[0];
  6382. // return 0;
  6383. // }
  6384. func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
  6385. if uint32(state) > 1 {
  6386. return 22
  6387. }
  6388. *(*int32)(unsafe.Pointer(a + 6*4)) = state
  6389. return 0
  6390. }
  6391. func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
  6392. return *(*int32)(unsafe.Pointer(m)) & 15
  6393. }
  6394. // int __pthread_mutex_lock(pthread_mutex_t *m)
  6395. // {
  6396. // if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
  6397. // && !a_cas(&m->_m_lock, 0, EBUSY))
  6398. // return 0;
  6399. //
  6400. // return __pthread_mutex_timedlock(m, 0);
  6401. // }
  6402. //
  6403. // weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
  6404. func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
  6405. return 0
  6406. }
  6407. func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
  6408. *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
  6409. return 0
  6410. }
  6411. func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
  6412. if uint32(type1) > uint32(2) {
  6413. return 22
  6414. }
  6415. (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1)
  6416. return 0
  6417. }
  6418. func init() {
  6419. *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45:
  6420. }
  6421. 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"
  6422. var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data