musl_linux_riscv64.go 192 KB

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