musl_linux_amd64.go 190 KB

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