/* References / 引用: IDs denote https://duck.ac/submission/<ID>; each author checked against the original submission.
saffah_codex_maker:162286,162339,162342.
saffah_codex_6a_agg3:162692,163200,163202,163203,163204,163268,163805,163806,165144,165383,165419,165438,165440,165482,165897,166214,166418,166599,170192,171757,171780,171918,171932,172015,172848,173476,173492,173611,173625,173671,173692,173702.
saffah_codex61s_agg5:162708,162839,162848,163490,163502,164939,165061,165580,165637,165850,166037,166099,166283,166306,166323,166636,166853,171856,173366,173375.
saffah_v41f1017_agg4:162770,162987,163049,163062,165008,165063,165297,166329,166456,168150,168155,168531,172729,172791,172828,172998,173475.
Uses:173492 supplies the complete order30 affine FKM runtime and period classification;173702 supplies independent per-function mathematical ROM, GAS bit-state continuation and contiguous NT copy. Remaining references supply inherited exact FKM, fusion, emitters, endpoints, output alignment and compile-time representation ideas. Public Duck sources declare no separate licence; all original attribution is preserved, no additional terms asserted.
Own Idea / 思路: generate the final3407872 order30 bytes as768 C++ blocks plus64 GAS blocks. Derive the starting and block checkpoints independently by consuming the exact FKM recurrence. Stop the original hot generator only after it has filled through the terminal boundary, and overwrite its harmless overlap with contiguous tail ROM. The initial-prefix experiment174005 was slower; terminal words have denser recurrence work, so cache the terminal interval instead. Extend174029 terminal ROM by352 C++ blocks after its official improvement. Simplify constexpr refill with a direct odd full-word path and an exact two-word path between four-word refills; retain64 GAS blocks. This reduces compile-time control work while enlarging the exact terminal interval to3407872 bytes. Tail and runtime retain exact bytes and alignment fallback. Fix the prior source-transform bug: preserve literal1184-byte NT-copy offsets while changing the1280-function directory count. Purpose: complete134217728-byte independent equality at five explicit64-byte-relative alignments and guards, then official measurement.
*/
#include<cstdint>
#include<cstddef>
#include<cstring>
#include<immintrin.h>
#pragma GCC optimize("O3")
struct RootChunk{constexpr RootChunk(uint64_t word,uint64_t initial,unsigned available);unsigned __int128 values[256]{};};
constexpr RootChunk::RootChunk(uint64_t word,uint64_t initial,unsigned available){
using U=unsigned __int128;U payload=initial;
for(unsigned i=0;i<256;++i){U value=0;unsigned filled=0;
while(filled<128){while(!available){uint64_t next=word+1;if(next&1){word=next;payload=next;available=30;}else{unsigned period=30-__builtin_ctzll(next);
if((next&((UINT64_C(3)<<28)|7))==0&&(next>>period)==0){
payload=(U(next+1)<<90)|(U(next+3)<<60)|(U(next+5)<<30)|(next+7);word=next+7;available=120;
}else if((next&3)==0&&(next>>28)==0&&(next>>period)==0){payload=(U(next+1)<<30)|(next+3);word=next+3;available=60;}else{word=next;if(period*2>30)word|=word>>period;else for(unsigned sh=period;sh<30;sh*=2)word|=word>>sh;if((UINT64_C(1073775726)>>period)&1){payload=word>>(30-period);available=period;}}}
}
unsigned take=128-filled<available?128-filled:available;U part=payload>>(available-take);
if(take<128){part&=(U(1)<<take)-1;value=(value<<take)|part;}else value=part;
available-=take;filled+=take;
}values[i]=(U(__builtin_bswap64(uint64_t(value)))<<64)|__builtin_bswap64(uint64_t(value>>64));
}}
template<unsigned I,uint64_t W,uint64_t P,unsigned A>static __attribute__((noinline,used))const RootChunk* fn(){alignas(64)static constexpr RootChunk block(W,P,A);return █}
using Fn=const RootChunk*(*)();static const Fn fns[]={fn<767,267836795ull,3595643ull,22>,fn<766,267770541ull,23213ull,15>,fn<765,267736445ull,125ull,8>,fn<764,267365815ull,55ull,6>,fn<763,267316055ull,267316055ull,29>,fn<762,267247575ull,3006423ull,22>,fn<761,267214255ull,23983ull,15>,fn<760,267105707ull,7058859ull,23>,fn<759,267055021ull,61357ull,16>,fn<758,266860253ull,221ull,9>,fn<757,266315771ull,108539ull,17>,fn<756,266264543ull,991ull,10>,fn<755,266199039ull,7ull,3>,fn<754,266166123ull,64839531ull,26>,fn<753,266058589ull,13ull,4>,fn<752,266009461ull,131791733ull,27>,fn<751,265944063ull,654335ull,20>,fn<750,265791471ull,265791471ull,28>,fn<749,265743039ull,1501887ull,21>,fn<748,265677803ull,11243ull,14>,fn<747,265644983ull,55ull,7>,fn<746,265281493ull,21ull,5>,fn<745,264222687ull,6111ull,13>,fn<744,264174573ull,45ull,6>,fn<743,264110043ull,264110043ull,29>,fn<742,264085493ull,117ull,7>,fn<741,263976279ull,0ull,0>,fn<740,263943855ull,3897007ull,23>,fn<739,263903229ull,1ull,1>,fn<738,263712683ull,12054443ull,24>,fn<737,263681455ull,95663ull,17>,fn<736,263641047ull,28760023ull,25>,fn<735,263577311ull,122591ull,18>,fn<734,263546869ull,2037ull,11>,fn<733,263188319ull,351ull,9>,fn<732,263157207ull,3ull,2>,fn<731,263117531ull,731ull,10>,fn<730,263055351ull,7ull,3>,fn<729,263023957ull,61697365ull,26>,fn<728,262921131ull,11ull,4>,fn<727,262889197ull,128671469ull,27>,fn<726,262847741ull,29ull,5>,fn<725,262663005ull,262663005ull,28>,fn<724,262127063ull,23ull,6>,fn<723,262099965ull,262099965ull,29>,fn<722,260027383ull,119ull,7>,fn<721,259980759ull,0ull,0>,fn<720,259959483ull,187ull,8>,fn<719,259897269ull,1ull,1>,fn<718,259866349ull,8208109ull,24>,fn<717,259766997ull,1ull,2>,fn<716,259735543ull,24854519ull,25>,fn<715,259698651ull,3ull,3>,fn<714,259514331ull,58187739ull,26>,fn<713,259485437ull,487165ull,19>,fn<712,259447659ull,125229931ull,27>,fn<711,259387135ull,388863ull,20>,fn<710,259357367ull,6839ull,13>,fn<709,259258039ull,1308343ull,21>,fn<708,258985887ull,511903ull,19>,fn<707,258956149ull,2933ull,12>,fn<706,258915759ull,966063ull,20>,fn<705,258858399ull,7583ull,13>,fn<704,258829677ull,45ull,6>,fn<703,258730877ull,11133ull,14>,fn<702,258700981ull,53ull,7>,fn<701,258662383ull,24559ull,15>,fn<700,258603735ull,215ull,8>,fn<699,258456895ull,48447ull,16>,fn<698,257932139ull,6273899ull,24>,fn<697,257906155ull,87531ull,17>,fn<696,257866423ull,22985399ull,25>,fn<695,257809339ull,121787ull,18>,fn<694,257781077ull,1365ull,11>,fn<693,257682879ull,257471ull,19>,fn<692,257653487ull,2799ull,12>,fn<691,257617333ull,716213ull,20>,fn<690,257587947ull,6891ull,13>,fn<689,257415035ull,1562491ull,21>,fn<688,257387133ull,10877ull,14>,fn<687,257349595ull,1497051ull,22>,fn<686,257291261ull,29693ull,15>,fn<685,257261291ull,235ull,8>,fn<684,257226165ull,62901ull,16>,fn<683,256896749ull,12013ull,14>,fn<682,256867703ull,119ull,7>,fn<681,255847797ull,28021ull,15>,fn<680,255818715ull,219ull,8>,fn<679,255782907ull,61435ull,16>,fn<678,255754101ull,373ull,9>,fn<677,255703915ull,113515ull,17>,fn<676,255678391ull,951ull,10>,fn<675,251649751ull,3799ull,12>,fn<674,251623163ull,27ull,5>,fn<673,251588333ull,3821ull,13>,fn<672,251559895ull,23ull,6>,fn<671,251510443ull,16043ull,14>,fn<670,251485821ull,125ull,7>,fn<669,251391469ull,28141ull,15>,fn<668,251363179ull,107ull,8>,fn<667,251329341ull,64317ull,16>,fn<666,251309535ull,16428511ull,24>,fn<665,251132759ull,129879ull,17>,fn<664,251113083ull,16232059ull,25>,fn<663,251084735ull,212927ull,18>,fn<662,251050959ull,49724367ull,26>,fn<661,250997723ull,388059ull,19>,fn<660,250969723ull,3707ull,12>,fn<659,250935981ull,326317ull,20>,fn<658,250855135ull,250855135ull,28>,fn<657,250591979ull,49265387ull,26>,fn<656,250567547ull,482171ull,19>,fn<655,250533621ull,116315893ull,27>,fn<654,250477277ull,916189ull,20>,fn<653,250457723ull,250457723ull,28>,fn<652,250433279ull,872191ull,21>,fn<651,250338795ull,250338795ull,29>,fn<650,250312571ull,2848635ull,22>,fn<649,250279157ull,0ull,0>,fn<648,250259421ull,221ull,8>,fn<647,250084093ull,1ull,1>,fn<646,250064619ull,235ull,9>,fn<645,249552879ull,3ull,2>,fn<644,249527247ull,14646223ull,25>,fn<643,249493499ull,3ull,3>,fn<642,249474539ull,1515ull,11>,fn<641,249421051ull,11ull,4>,fn<640,249395029ull,115177301ull,27>,fn<639,249361773ull,13ull,5>,fn<638,249281979ull,7611ull,13>,fn<637,249257845ull,53ull,6>,fn<636,249224637ull,7613ull,14>,fn<635,249198581ull,117ull,7>,fn<634,249032431ull,28399ull,15>,fn<633,249012155ull,5742523ull,23>,fn<632,248986587ull,15323ull,16>,fn<631,248953531ull,14072507ull,24>,fn<630,248901087ull,126431ull,17>,fn<629,248880885ull,13999861ull,25>,fn<628,248855387ull,80731ull,18>,fn<627,248765355ull,47438763ull,26>,fn<626,248504253ull,13623229ull,24>,fn<625,248478971ull,97531ull,17>,fn<624,248445821ull,13564797ull,25>,fn<623,247460827ull,3ull,3>,fn<622,247442171ull,763ull,11>,fn<621,247414751ull,15ull,4>,fn<620,247381947ull,4027ull,12>,fn<619,247330767ull,15ull,5>,fn<618,247312119ull,3831ull,13>,fn<617,247289303ull,23ull,6>,fn<616,247197429ull,12021ull,14>,fn<615,247179221ull,3909589ull,22>,fn<614,247152363ull,16107ull,15>,fn<613,247119599ull,3849967ull,23>,fn<612,247068525ull,63341ull,16>,fn<611,246933467ull,12052443ull,24>,fn<610,246906687ull,98111ull,17>,fn<609,246873967ull,11992943ull,25>,fn<608,246856187ull,3ull,3>,fn<607,246804399ull,45477807ull,26>,fn<606,246786735ull,15ull,4>,fn<605,246759421ull,112541693ull,27>,fn<604,246672363ull,11ull,5>,fn<603,246414075ull,3ull,3>,fn<602,246396157ull,1277ull,11>,fn<601,246372987ull,11ull,4>,fn<600,246340411ull,2875ull,12>,fn<599,246314991ull,15ull,5>,fn<598,246267599ull,7887ull,13>,fn<597,246246141ull,61ull,6>,fn<596,246213595ull,11227ull,14>,fn<595,246136173ull,2866541ull,22>,fn<594,246114299ull,26619ull,15>,fn<593,246082287ull,2812655ull,23>,fn<592,246062581ull,1ull,1>,fn<591,246011871ull,11130847ull,24>,fn<590,245874495ull,3ull,2>,fn<589,245853117ull,10972093ull,25>,fn<588,245357949ull,5ull,3>,fn<587,245333231ull,44006639ull,26>,fn<586,245300909ull,13ull,4>,fn<585,245283323ull,2555ull,12>,fn<584,245233005ull,13ull,5>,fn<583,245214651ull,3515ull,13>,fn<582,245192189ull,61ull,6>,fn<581,243259893ull,6645ull,14>,fn<580,243235485ull,29ull,7>,fn<579,243203485ull,32157ull,15>,fn<578,243186165ull,8305141ull,23>,fn<577,243136171ull,63147ull,16>,fn<576,243117997ull,8236973ull,24>,fn<575,243096255ull,88767ull,17>,fn<574,243006811ull,8125787ull,25>,fn<573,242989525ull,5ull,3>,fn<572,242966495ull,41639903ull,26>,fn<571,242936683ull,11ull,4>,fn<570,242917365ull,4085ull,12>,fn<569,242867885ull,13ull,5>,fn<568,242735789ull,6829ull,13>,fn<567,242711381ull,21ull,6>,fn<566,242679533ull,16109ull,14>,fn<565,242662325ull,3586997ull,22>,fn<564,242612893ull,31389ull,15>,fn<563,242595445ull,7714421ull,23>,fn<562,242572919ull,24183ull,16>,fn<561,242543067ull,7662043ull,24>,fn<560,242466549ull,1ull,2>,fn<559,234876631ull,23ull,5>,fn<558,234860199ull,3751ull,13>,fn<557,234839019ull,43ull,6>,fn<556,234810045ull,10941ull,14>,fn<555,234793599ull,4106879ull,22>,fn<554,234744747ull,27563ull,15>,fn<553,234728303ull,8235887ull,23>,fn<552,234706927ull,22511ull,16>,fn<551,234676191ull,16572383ull,24>,fn<550,234602493ull,1ull,2>,fn<549,234583405ull,33256813ull,25>,fn<548,234552685ull,5ull,3>,fn<547,234536283ull,1371ull,11>,fn<546,234487535ull,15ull,4>,fn<545,234356703ull,4063ull,12>,fn<544,234340317ull,507869ull,20>,fn<543,234321245ull,5469ull,13>,fn<542,234290559ull,1506687ull,21>,fn<541,234274175ull,234274175ull,29>,fn<540,234225535ull,3538815ull,22>,fn<539,234209151ull,0ull,0>,fn<538,234190069ull,7697653ull,23>,fn<537,234159463ull,1ull,1>,fn<536,234089403ull,443ull,9>,fn<535,234073045ull,109525ull,17>,fn<534,233823935ull,0ull,0>,fn<533,233807597ull,237ull,8>,fn<532,233788379ull,1ull,1>,fn<531,233758037ull,341ull,9>,fn<530,233741687ull,40311ull,17>,fn<529,233693173ull,1013ull,10>,fn<528,233678655ull,108351ull,18>,fn<527,233657839ull,1519ull,11>,fn<526,233627375ull,319215ull,19>,fn<525,233557711ull,99339983ull,27>,fn<524,233535163ull,751291ull,20>,fn<523,233504669ull,233504669ull,28>,fn<522,233488347ull,27ull,6>,fn<521,233469365ull,233469365ull,29>,fn<520,233428215ull,119ull,7>,fn<519,233298429ull,23037ull,15>,fn<518,233275195ull,59ull,8>,fn<517,233258911ull,16287ull,16>,fn<516,232779117ull,14675309ull,24>,fn<515,232762869ull,1ull,2>,fn<514,232742303ull,31415711ull,25>,fn<513,232713659ull,3ull,3>,fn<512,232697525ull,1717ull,11>,fn<511,232650219ull,11ull,4>,fn<510,232634087ull,1767ull,12>,fn<509,232614623ull,31ull,5>,fn<508,232584917ull,5845ull,13>,fn<507,232515503ull,1828783ull,21>,fn<506,232499703ull,232499703ull,29>,fn<505,232478717ull,1791997ull,22>,fn<504,232450555ull,0ull,0>,fn<503,232434491ull,59ull,8>,fn<502,232386485ull,1ull,1>,fn<501,232258231ull,183ull,9>,fn<500,232242087ull,113575ull,17>,fn<499,232222439ull,743ull,10>,fn<498,232193005ull,195565ull,18>,fn<497,232177071ull,30850479ull,26>,fn<496,232158111ull,422815ull,19>,fn<495,232117223ull,97899495ull,27>,fn<494,232094549ull,359253ull,20>,fn<493,232078567ull,232078567ull,28>,fn<492,231996141ull,45ull,6>,fn<491,231980013ull,15341ull,14>,fn<490,231734975ull,97517247ull,27>,fn<489,231718875ull,27ull,5>,fn<488,231700175ull,231700175ull,28>,fn<487,231684061ull,29ull,6>,fn<486,231657447ull,4071ull,14>,fn<485,231635663ull,79ull,7>,fn<484,231594919ull,23463ull,15>,fn<483,230677947ull,4185531ull,23>,fn<482,230662007ull,1ull,1>,fn<481,230643407ull,12539599ull,24>,fn<480,230615037ull,1ull,2>,fn<479,230599543ull,887ull,10>,fn<478,230552939ull,3ull,3>,fn<477,230537021ull,1853ull,11>,fn<476,230517757ull,13ull,4>,fn<475,230488827ull,2811ull,12>,fn<474,230420187ull,782043ull,20>,fn<473,230405051ull,230405051ull,28>,fn<472,230385627ull,1796059ull,21>,fn<471,230356711ull,230356711ull,29>,fn<470,230341119ull,127ull,7>,fn<469,230321821ull,0ull,0>,fn<468,230281213ull,253ull,8>,fn<467,230153981ull,57085ull,16>,fn<466,230139775ull,12035967ull,24>,fn<465,230119903ull,88543ull,17>,fn<464,230091741ull,28765149ull,25>,fn<463,230076075ull,3ull,3>,fn<462,230029803ull,28703211ull,26>,fn<461,230013931ull,11ull,4>,fn<460,229995431ull,95777703ull,27>,fn<459,229965743ull,15ull,5>,fn<458,229898103ull,6007ull,13>,fn<457,229882679ull,1293111ull,21>,fn<456,229863295ull,12159ull,14>,fn<455,229627519ull,1663ull,12>,fn<454,229605117ull,29ull,5>,fn<453,229592791ull,3799ull,13>,fn<452,229564015ull,974447ull,21>,fn<451,229549821ull,229549821ull,29>,fn<450,229502943ull,3010527ull,22>,fn<449,229488087ull,0ull,0>,fn<448,229469095ull,2976679ull,23>,fn<447,229440343ull,1ull,1>,fn<446,229372845ull,429ull,9>,fn<445,229357237ull,112309ull,17>,fn<444,229338343ull,231ull,10>,fn<443,229309421ull,195565ull,18>,fn<442,229293815ull,27967223ull,26>,fn<441,229275373ull,161517ull,19>,fn<440,229235547ull,95017819ull,27>,fn<439,229109695ull,31ull,5>,fn<438,229094877ull,5597ull,13>,fn<437,229075919ull,15ull,6>,fn<436,229047231ull,15295ull,14>,fn<435,228588471ull,2096055ull,22>,fn<434,228572919ull,0ull,0>,fn<433,228554589ull,2062173ull,23>,fn<432,228539255ull,1ull,1>,fn<431,228513703ull,423ull,9>,fn<430,228498383ull,39887ull,17>,fn<429,228453599ull,223ull,10>,fn<428,228437919ull,110495ull,18>,fn<427,228419549ull,2013ull,11>,fn<426,228391359ull,326079ull,19>,fn<425,228324215ull,94106487ull,27>,fn<424,228308703ull,31ull,5>,fn<423,228289963ull,228289963ull,28>,fn<422,226491899ull,59ull,6>,fn<421,226479855ull,3823ull,14>,fn<420,226458615ull,119ull,7>,fn<419,226443255ull,16375ull,15>,fn<418,226418359ull,8314551ull,23>,fn<417,226404843ull,1ull,1>,fn<416,226359127ull,8255319ull,24>,fn<415,226343935ull,3ull,2>,fn<414,226325973ull,24999381ull,25>,fn<413,226310887ull,7ull,3>,fn<412,226285531ull,2011ull,11>,fn<411,226219227ull,251099ull,19>,fn<410,226197303ull,3895ull,12>,fn<409,226185179ull,741339ull,20>,fn<408,226158519ull,226158519ull,28>,fn<407,226143597ull,45ull,6>,fn<406,226098133ull,226098133ull,29>,fn<405,226082795ull,107ull,7>,fn<404,225962471ull,27111ull,15>,fn<403,225947247ull,7843439ull,23>,fn<402,225929115ull,26523ull,16>,fn<401,225901243ull,7797435ull,24>,fn<400,225885931ull,3ull,2>,fn<399,225868207ull,24541615ull,25>,fn<398,225828671ull,7ull,3>,fn<397,225815259ull,731ull,11>,fn<396,225795703ull,7ull,4>,fn<395,225769117ull,1693ull,12>,fn<394,225702783ull,258943ull,20>,fn<393,225687511ull,225687511ull,28>,fn<392,225669047ull,1273783ull,21>,fn<391,225437655ull,518103ull,19>,fn<390,225422799ull,91205071ull,27>,fn<389,225404789ull,1009525ull,20>,fn<388,225376999ull,225376999ull,28>,fn<387,225361767ull,39ull,6>,fn<386,225344157ull,225344157ull,29>,fn<385,225306327ull,87ull,7>,fn<384,225291479ull,11479ull,15>,fn<383,225271787ull,235ull,8>,fn<382,225245661ull,63965ull,16>,fn<381,225179351ull,7075543ull,24>,fn<380,225164509ull,1ull,2>,fn<379,225146541ull,23819949ull,25>,fn<378,225131501ull,5ull,3>,fn<377,225106797ull,877ull,11>,fn<376,225091559ull,172007ull,19>,fn<375,225048247ull,1719ull,12>,fn<374,225033215ull,637951ull,20>,fn<373,224913279ull,224913279ull,28>,fn<372,224898477ull,45ull,6>,fn<371,224880539ull,224880539ull,29>,fn<370,224852845ull,109ull,7>,fn<369,224837623ull,16375ull,15>,fn<368,224389083ull,6285275ull,23>,fn<367,224374389ull,1ull,1>,fn<366,224356799ull,6252991ull,24>,fn<365,224328957ull,1ull,2>,fn<364,224317101ull,685ull,10>,fn<363,224296319ull,7ull,3>,fn<362,224258973ull,925ull,11>,fn<361,224244639ull,373663ull,19>,fn<360,224226299ull,3067ull,12>,fn<359,224198525ull,851837ull,20>,fn<358,224132855ull,224132855ull,28>,fn<357,224121755ull,27ull,6>,fn<356,224100269ull,224100269ull,29>,fn<355,224089307ull,91ull,7>,fn<354,224062429ull,27613ull,15>,fn<353,224048109ull,5944301ull,23>,fn<352,224030039ull,27991ull,16>,fn<351,223991655ull,5887847ull,24>,fn<350,223869549ull,1ull,2>,fn<349,223854453ull,885ull,10>,fn<348,223837007ull,7ull,3>,fn<347,223825263ull,1391ull,11>,fn<346,223799015ull,452327ull,19>,fn<345,223784317ull,89566589ull,27>,fn<344,223739629ull,392941ull,20>,fn<343,223728551ull,223728551ull,28>,fn<342,223707103ull,1408991ull,21>,fn<341,223696215ull,223696215ull,29>,fn<340,223669583ull,79ull,7>,fn<339,223604093ull,28029ull,15>,fn<338,223589821ull,5486013ull,23>,fn<337,223571647ull,28351ull,16>,fn<336,223342459ull,12155ull,14>,fn<335,223328213ull,1030101ull,22>,fn<334,223310807ull,29655ull,15>,fn<333,223296213ull,5192405ull,23>,fn<332,223271759ull,1ull,1>,fn<331,223258349ull,237ull,9>,fn<330,223214199ull,3ull,2>,fn<329,223199163ull,955ull,10>,fn<328,223181781ull,5ull,3>,fn<327,223170165ull,1653ull,11>,fn<326,222287615ull,513791ull,19>,fn<325,222273133ull,88055405ull,27>,fn<324,222255823ull,1006287ull,20>,fn<323,222229877ull,222229877ull,28>,fn<322,222215159ull,55ull,6>,fn<321,222197679ull,222197679ull,29>,fn<320,222160821ull,53ull,7>,fn<319,222146295ull,12023ull,15>,fn<318,222129021ull,125ull,8>,fn<317,222101493ull,65525ull,16>,fn<316,222090703ull,3986895ull,24>,fn<315,222025591ull,3ull,2>,fn<314,222011099ull,731ull,10>,fn<313,221993835ull,3ull,3>,fn<312,221967989ull,1653ull,11>,fn<311,221953447ull,179623ull,19>,fn<310,221936237ull,2669ull,12>,fn<309,221899439ull,649903ull,20>,fn<308,221885303ull,221885303ull,28>,fn<307,221765495ull,55ull,6>,fn<306,221752631ull,11575ull,14>,fn<305,221735357ull,61ull,7>,fn<304,221707983ull,32463ull,15>,fn<303,221697007ull,3593199ull,23>,fn<302,221682555ull,1ull,1>,fn<301,221640055ull,3536247ull,24>,fn<300,221625581ull,1ull,2>,fn<299,221608367ull,20281775ull,25>,fn<298,221593525ull,5ull,3>,fn<297,221570911ull,1887ull,11>,fn<296,218098605ull,2989ull,13>,fn<295,218084863ull,2078207ull,21>,fn<294,218067931ull,13275ull,14>,fn<293,218053869ull,4144365ull,22>,fn<292,218029911ull,0ull,0>,fn<291,218017239ull,215ull,8>,fn<290,218000301ull,1ull,1>,fn<289,217963199ull,191ull,9>,fn<288,217950167ull,108503ull,17>,fn<287,217931759ull,1007ull,10>,fn<286,217906623ull,64959ull,18>,fn<285,217895933ull,16569341ull,26>,fn<284,217831887ull,15ull,4>,fn<283,217818957ull,1869ull,12>,fn<282,217800557ull,13ull,5>,fn<281,217775445ull,7509ull,13>,fn<280,217764767ull,1758111ull,21>,fn<279,217750527ull,217750527ull,29>,fn<278,217708461ull,3798957ull,22>,fn<277,217697535ull,0ull,0>,fn<276,217577911ull,183ull,8>,fn<275,217566653ull,52669ull,16>,fn<274,217546621ull,381ull,9>,fn<273,217536171ull,87723ull,17>,fn<272,217510879ull,16184287ull,25>,fn<271,217496895ull,7ull,3>,fn<270,217480013ull,16153421ull,26>,fn<269,217443789ull,13ull,4>,fn<268,217430005ull,2037ull,12>,fn<267,217413311ull,31ull,5>,fn<266,217399147ull,8043ull,13>,fn<265,217377199ull,1370543ull,21>,fn<264,217312991ull,217312991ull,29>,fn<263,217299627ull,43ull,7>,fn<262,217282485ull,0ull,0>,fn<261,217271637ull,85ull,8>,fn<260,217046267ull,59ull,6>,fn<259,217033595ull,11131ull,14>,fn<258,217016939ull,107ull,7>,fn<257,217003323ull,13627ull,15>,fn<256,216979453ull,7264253ull,23>,fn<255,216966975ull,1ull,1>,fn<254,216923855ull,15597263ull,24>,fn<253,216913357ull,1ull,2>,fn<252,216899287ull,727ull,10>,fn<251,216882587ull,3ull,3>,fn<250,216857467ull,891ull,11>,fn<249,216846261ull,315317ull,19>,fn<248,216783295ull,82565567ull,27>,fn<247,216770427ull,27ull,5>,fn<246,216753789ull,216753789ull,28>,fn<245,216727255ull,23ull,6>,fn<244,216716763ull,5595ull,14>,fn<243,216702709ull,2793205ull,22>,fn<242,216661229ull,31981ull,15>,fn<241,216650655ull,6935455ull,23>,fn<240,216636731ull,1ull,1>,fn<239,216520575ull,383ull,9>,fn<238,216508109ull,108237ull,17>,fn<237,216489885ull,925ull,10>,fn<236,216465007ull,196207ull,18>,fn<235,216454527ull,15127935ull,26>,fn<234,216440507ull,11ull,4>,fn<233,216003419ull,81785691ull,27>,fn<232,215989501ull,29ull,5>,fn<231,215972789ull,215972789ull,28>,fn<230,215962429ull,61ull,6>,fn<229,215936845ull,12109ull,14>,fn<228,215923563ull,2014059ull,22>,fn<227,215906997ull,31413ull,15>,fn<226,215871135ull,6155935ull,23>,fn<225,215857853ull,1ull,1>,fn<224,215841243ull,14514651ull,24>,fn<223,215830175ull,3ull,2>,fn<222,215805309ull,381ull,10>,fn<221,215742311ull,259943ull,18>,fn<220,215731551ull,14404959ull,26>,fn<219,215711723ull,229355ull,19>,fn<218,215701373ull,81483645ull,27>,fn<217,215676603ull,27ull,5>,fn<216,215662571ull,8171ull,13>,fn<215,215646055ull,39ull,6>,fn<214,215611005ull,13949ull,14>,fn<213,215596989ull,1687485ull,22>,fn<212,215481789ull,0ull,0>,fn<211,215471467ull,107ull,8>,fn<210,215457503ull,40671ull,16>,fn<209,215441005ull,109ull,9>,fn<208,215416219ull,64923ull,17>,fn<207,215405885ull,14079293ull,25>,fn<206,215391927ull,7ull,3>,fn<205,215350711ull,14024119ull,26>,fn<204,215340383ull,15ull,4>,fn<203,215326431ull,3807ull,12>,fn<202,215309943ull,23ull,5>,fn<201,215285173ull,7605ull,13>,fn<200,215274847ull,1365343ull,21>,fn<199,215211677ull,215211677ull,29>,fn<198,215199211ull,107ull,7>,fn<197,215182747ull,0ull,0>,fn<196,215169511ull,231ull,8>,fn<195,214949295ull,47ull,6>,fn<194,214936941ull,11629ull,14>,fn<193,214920447ull,127ull,7>,fn<192,214907293ull,14749ull,15>,fn<191,214883965ull,5168765ull,23>,fn<190,214871535ull,1ull,1>,fn<189,214855099ull,13528507ull,24>,fn<188,214818669ull,1ull,2>,fn<187,214806331ull,827ull,10>,fn<186,214789855ull,7ull,3>,fn<185,214776687ull,879ull,11>,fn<184,214754933ull,321141ull,19>,fn<183,201323503ull,67105775ull,27>,fn<182,201313651ull,19ull,5>,fn<181,201301327ull,7503ull,13>,fn<180,201285543ull,39ull,6>,fn<179,201274733ull,13677ull,14>,fn<178,201252475ull,4120187ull,22>,fn<177,201241515ull,0ull,0>,fn<176,201225909ull,8287925ull,23>,fn<175,201191327ull,1ull,1>,fn<174,201178991ull,367ull,9>,fn<173,201169743ull,105295ull,17>,fn<172,201154045ull,509ull,10>,fn<171,201143159ull,78711ull,18>,fn<170,201121019ull,66903291ull,26>,fn<169,201060303ull,15ull,4>,fn<168,201047987ull,4019ull,12>,fn<167,201038717ull,760701ull,20>,fn<166,201023149ull,7853ull,13>,fn<165,201012179ull,1782739ull,21>,fn<164,200990075ull,200990075ull,29>,fn<163,200978411ull,107ull,7>,fn<162,200963539ull,0ull,0>,fn<161,200929101ull,77ull,8>,fn<160,200916789ull,48949ull,16>,fn<159,200907503ull,16358127ull,24>,fn<158,200793919ull,122687ull,17>,fn<157,200783155ull,33010995ull,25>,fn<156,200767413ull,227253ull,18>,fn<155,200758175ull,66540447ull,26>,fn<154,200734445ull,13ull,4>,fn<153,200724443ull,4059ull,12>,fn<152,200712149ull,434133ull,20>,fn<151,200698323ull,2515ull,13>,fn<150,200662901ull,1433461ull,21>,fn<149,200652139ull,200652139ull,29>,fn<148,200636405ull,3504117ull,22>,fn<147,200627167ull,0ull,0>,fn<146,200603499ull,107ull,8>,fn<145,200594263ull,54103ull,16>,fn<144,200533871ull,15984495ull,24>,fn<143,200521583ull,3ull,2>,fn<142,200506239ull,32734079ull,25>,fn<141,200496821ull,5ull,3>,fn<140,200277749ull,1ull,1>,fn<139,200268533ull,245ull,9>,fn<138,200257127ull,110183ull,17>,fn<137,200242133ull,981ull,10>,fn<136,200232319ull,216447ull,18>,fn<135,200209307ull,65991579ull,26>,fn<134,200199501ull,13ull,4>,fn<133,200187231ull,3423ull,12>,fn<132,200173053ull,29ull,5>,fn<131,200138103ull,7543ull,13>,fn<130,200127287ull,897847ull,21>,fn<129,200111787ull,13995ull,14>,fn<128,200101811ull,2969523ull,22>,fn<127,200078957ull,0ull,0>,fn<126,200068981ull,117ull,8>,fn<125,200009527ull,59191ull,16>,fn<124,199997277ull,15447901ull,24>,fn<123,199981991ull,97191ull,17>,fn<122,199972571ull,32200411ull,25>,fn<121,199949181ull,5ull,3>,fn<120,199939789ull,1741ull,11>,fn<119,199928559ull,174831ull,19>,fn<118,199913085ull,3709ull,12>,fn<117,199879533ull,650093ull,20>,fn<116,199867307ull,199867307ull,28>,fn<115,199851837ull,622397ull,21>,fn<114,199745255ull,199745255ull,29>,fn<113,199734525ull,125ull,7>,fn<112,199718907ull,0ull,0>,fn<111,199709903ull,207ull,8>,fn<110,199686557ull,63901ull,16>,fn<109,199677151ull,15127775ull,24>,fn<108,199665595ull,3ull,2>,fn<107,199650511ull,31878351ull,25>,fn<106,199227871ull,7ull,3>,fn<105,199218541ull,1389ull,11>,fn<104,199207357ull,502205ull,19>,fn<103,199191965ull,3485ull,12>,fn<102,199179759ull,998895ull,20>,fn<101,199159283ull,199159283ull,28>,fn<100,199147183ull,47ull,6>,fn<99,199138013ull,6877ull,14>,fn<98,199098325ull,85ull,7>,fn<97,199089151ull,23551ull,15>,fn<96,199077815ull,6139831ull,23>,fn<95,199063167ull,30335ull,16>,fn<94,199053269ull,14503893ull,24>,fn<93,199030519ull,3ull,2>,fn<92,199021399ull,855ull,10>,fn<91,198961843ull,256691ull,18>,fn<90,198949691ull,64731963ull,26>,fn<89,198934269ull,229117ull,19>,fn<88,198925151ull,64707423ull,27>,fn<87,198901687ull,23ull,5>,fn<86,198892527ull,7151ull,13>,fn<85,198881203ull,1748915ull,21>,fn<84,198866559ull,13951ull,14>,fn<83,198833151ull,1700863ull,22>,fn<82,198823423ull,0ull,0>,fn<81,198811351ull,215ull,8>,fn<80,198700723ull,1ull,1>,fn<79,198688591ull,335ull,9>,fn<78,198679453ull,105373ull,17>,fn<77,198664103ull,935ull,10>,fn<76,198653429ull,210421ull,18>,fn<75,198633087ull,64415359ull,26>,fn<74,198620927ull,15ull,4>,fn<73,198605789ull,64388061ull,27>,fn<72,198572671ull,31ull,5>,fn<71,198563295ull,5599ull,13>,fn<70,198552235ull,1419947ull,21>,fn<69,198536887ull,11959ull,14>,fn<68,198524763ull,1392475ull,22>,fn<67,198504363ull,0ull,0>,fn<66,198495213ull,237ull,8>,fn<65,198436335ull,58863ull,16>,fn<64,198424279ull,13874903ull,24>,fn<63,198409143ull,97207ull,17>,fn<62,198399839ull,30627679ull,25>,fn<61,198376813ull,5ull,3>,fn<60,198175567ull,1ull,1>,fn<59,198163437ull,493ull,9>,fn<58,198154159ull,104367ull,17>,fn<57,198139215ull,335ull,10>,fn<56,198128493ull,209773ull,18>,fn<55,198106811ull,63889083ull,26>,fn<54,198096215ull,7ull,4>,fn<53,198081149ull,63863421ull,27>,fn<52,198047703ull,23ull,5>,fn<51,198038763ull,5355ull,13>,fn<50,198027687ull,895399ull,21>,fn<49,198012375ull,11735ull,14>,fn<48,198000343ull,868055ull,22>,fn<47,197980015ull,0ull,0>,fn<46,197970907ull,219ull,8>,fn<45,197912245ull,59061ull,16>,fn<44,197130139ull,12580763ull,24>,fn<43,197121239ull,3ull,2>,fn<42,197110221ull,461ull,10>,fn<41,197095037ull,5ull,3>,fn<40,197083005ull,1917ull,11>,fn<39,197063511ull,455511ull,19>,fn<38,197053883ull,62836155ull,27>,fn<37,197041903ull,15ull,5>,fn<36,197028349ull,197028349ull,28>,fn<35,196995071ull,63ull,6>,fn<34,196983487ull,15039ull,14>,fn<33,196968279ull,87ull,7>,fn<32,196959219ull,23539ull,15>,fn<31,196948735ull,4010751ull,23>,fn<30,196927191ull,1ull,1>,fn<29,196868855ull,247ull,9>,fn<28,196859635ull,120563ull,17>,fn<27,196848627ull,29076467ull,25>,fn<26,196834163ull,226163ull,18>,fn<25,196824551ull,62606823ull,26>,fn<24,196802159ull,15ull,4>,fn<23,196793141ull,821ull,12>,fn<22,196781933ull,698221ull,20>,fn<21,196767083ull,3435ull,13>,fn<20,196734199ull,1699063ull,21>,fn<19,196722283ull,196722283ull,29>,fn<18,196713263ull,47ull,7>,fn<17,196603597ull,0ull,0>,fn<16,196591591ull,231ull,8>,fn<15,196582749ull,40285ull,16>,fn<14,196568943ull,367ull,9>,fn<13,196557291ull,80363ull,17>,fn<12,196537181ull,28765021ull,25>,fn<11,196525363ull,3ull,3>,fn<10,196516317ull,477ull,11>,fn<9,196501207ull,7ull,4>,fn<8,196468407ull,3767ull,12>,fn<7,196457903ull,374191ull,20>,fn<6,196442987ull,7019ull,13>,fn<5,196433779ull,1398643ull,21>,fn<4,196411055ull,196411055ull,29>,fn<3,196402031ull,111ull,7>,fn<2,196343677ull,30589ull,15>,fn<1,196334829ull,3396845ull,23>,fn<0,196323835ull,1ull,1>};
#pragma GCC target("avx2,bmi,bmi2,movbe")
asm(R"ROOTDB30(
.pushsection .rodata.root_db30,"a",@progbits
.balign 64
.global root_db30_rom
.type root_db30_rom,@object
root_db30_rom:
.altmacro
.macro RSET name,val
.struct (\val)
.set \name,.
.endm
RSET .Ldb_word,%(267886583)
RSET .Ldb_payload,%(267886583)
RSET .Ldb_available,%(29)
.macro ROOT_DB_REFILL
RSET .Ldb_next,%(.Ldb_word+1)
.if (.Ldb_next%2)==1
RSET .Ldb_word,%(.Ldb_next)
RSET .Ldb_payload,%(.Ldb_next)
RSET .Ldb_available,%(30)
.else
.if ((.Ldb_next%4)==0) * ((.Ldb_next%64)>0) * (.Ldb_next<33554432)
RSET .Ldb_payload,%(((.Ldb_next+1)<<30)|(.Ldb_next+3))
RSET .Ldb_available,%(60)
RSET .Ldb_word,%(.Ldb_next+3)
.else
RSET .Ldb_temp,%(.Ldb_next)
RSET .Ldb_period,%(30)
.if (.Ldb_temp%65536)==0
RSET .Ldb_temp,%(.Ldb_temp>>16)
RSET .Ldb_period,%(.Ldb_period-16)
.endif
.if (.Ldb_temp%256)==0
RSET .Ldb_temp,%(.Ldb_temp>>8)
RSET .Ldb_period,%(.Ldb_period-8)
.endif
.if (.Ldb_temp%16)==0
RSET .Ldb_temp,%(.Ldb_temp>>4)
RSET .Ldb_period,%(.Ldb_period-4)
.endif
.if (.Ldb_temp%4)==0
RSET .Ldb_temp,%(.Ldb_temp>>2)
RSET .Ldb_period,%(.Ldb_period-2)
.endif
.if (.Ldb_temp%2)==0
RSET .Ldb_period,%(.Ldb_period-1)
.endif
.if ((.Ldb_next%4)==0) * ((.Ldb_next>>28)==0) * ((.Ldb_next>>.Ldb_period)==0)
RSET .Ldb_payload,%(((.Ldb_next+1)<<30)|(.Ldb_next+3))
RSET .Ldb_available,%(60)
RSET .Ldb_word,%(.Ldb_next+3)
.else
RSET .Ldb_word,%(.Ldb_next)
.if .Ldb_period*2>30
RSET .Ldb_word,%(.Ldb_word|(.Ldb_word>>.Ldb_period))
.else
RSET .Ldb_shift,%(.Ldb_period)
.rept 5
.if .Ldb_shift<30
RSET .Ldb_word,%(.Ldb_word|(.Ldb_word>>.Ldb_shift))
RSET .Ldb_shift,%(.Ldb_shift*2)
.endif
.endr
.endif
.if (1073775726>>.Ldb_period)%2
RSET .Ldb_payload,%(.Ldb_word>>(30-.Ldb_period))
RSET .Ldb_available,%(.Ldb_period)
.else
ROOT_DB_REFILL
.endif
.endif
.endif
.endif
.endm
.macro ROOT_DB_FILL
.if .Ldb_filled<64
.if .Ldb_available==0
ROOT_DB_REFILL
.endif
RSET .Ldb_take,%(64-.Ldb_filled)
.if .Ldb_available<.Ldb_take
RSET .Ldb_take,%(.Ldb_available)
.endif
RSET .Ldb_acc,%((.Ldb_acc<<.Ldb_take)|((.Ldb_payload>>(.Ldb_available-.Ldb_take))%(1<<.Ldb_take)))
RSET .Ldb_available,%(.Ldb_available-.Ldb_take)
RSET .Ldb_filled,%(.Ldb_filled+.Ldb_take)
ROOT_DB_FILL
.endif
.endm
.rept 32768
RSET .Ldb_acc,%(.Ldb_payload%(1<<.Ldb_available))
RSET .Ldb_filled,%(.Ldb_available)
RSET .Ldb_available,%(0)
ROOT_DB_FILL
.section .rodata.root_db30
.quad .Ldb_acc
.endr
.purgem ROOT_DB_FILL
.purgem ROOT_DB_REFILL
.purgem RSET
.noaltmacro
.size root_db30_rom,.-root_db30_rom
.popsection
)ROOTDB30");
extern "C" const uint64_t root_db30_rom[];
#include <immintrin.h>
#define ORD 30
#ifndef RUNLOOP
#define RUNLOOP 1
#endif
#ifndef FUSE4
#define FUSE4 1
#endif
#include <cstdint>
#include <cstddef>
#include <cstring>
static inline uint64_t fusion_end(unsigned n,uint64_t w){if(n==30){if(w>=(UINT64_C(1)<<26)){if(w>=(UINT64_C(1)<<27))return w+8;return (w+16)&~UINT64_C(15);}if(w>=(UINT64_C(1)<<25))return (w+32)&~UINT64_C(31);if(w>=(UINT64_C(1)<<24))return (w+64)&~UINT64_C(63);if(w>=(UINT64_C(1)<<23))return (w+128)&~UINT64_C(127);}unsigned m=63-__builtin_clzll(w|1u),half=(n+1)/2;if(m<half)return UINT64_C(1)<<half;unsigned k=n-m;return ((w>>k)+1)<<k;}
#pragma GCC optimize("O3")
#pragma GCC target("avx2,bmi,bmi2,movbe")
namespace dbj {
template <unsigned N>
static constexpr uint64_t VALID = []() {
uint64_t v = 0; for (unsigned p = 1; p <= N; ++p) if (N % p == 0) v |= uint64_t(1) << p; return v;
}();
template <unsigned B, bool Safe>
static inline void put(unsigned char*&dst, uint64_t&res, unsigned&pending, __uint128_t word) {
unsigned total = pending + B, q = total >> 3;
pending = total & 7;
if constexpr (B <= 56) {
res = (res << B) | (uint64_t)word;
uint64_t v = __builtin_bswap64(res << (64 - total));
if constexpr (Safe) memcpy(dst, &v, q); else memcpy(dst, &v, 8);
} else {
__uint128_t v = ((__uint128_t)res << B) | word;
res = (uint64_t)word;
v <<= 128 - total;
uint64_t words[2] = {__builtin_bswap64((uint64_t)(v >> 64)), __builtin_bswap64((uint64_t)v)};
if constexpr (Safe) memcpy(dst, words, q);
else if constexpr (B <= 60) memcpy(dst, words, 8);
else memcpy(dst, words, 16);
}
dst += q;
}
static inline void put2_66(unsigned char*&dst, uint64_t&res, unsigned&pending,
uint64_t first, uint64_t second) {
const unsigned p = pending;
uint64_t hi = (res << 33) | first;
uint64_t lo = second << 31;
asm("shldq %%cl, %1, %0" : "+r"(hi) : "r"(lo), "c"(31 - p));
const uint64_t packed = __builtin_bswap64(hi);
memcpy(dst, &packed, 8);
dst[8] = (unsigned char)((second << (62 - p)) >> 56);
dst += 8 + ((p + 2) >> 3);
pending = (p + 2) & 7;
res = second;
}
static inline void put60(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t pair){uint64_t v=((pair<<4)>>pending)|((res<<(63-pending))<<1);asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])dst):"r"(v));unsigned total=pending+60;dst+=total>>3;pending=total&7;res=pair;}
static inline void root_put30(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t word){
uint64_t v=word<<34;asm("shrdq %%cl,%1,%0":"+r"(v):"r"(res),"c"(pending));
asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])dst):"r"(v));unsigned total=pending+30;dst+=total>>3;pending=total&7;res=word;}
template <bool Safe>
static inline void put_short(unsigned char*&dst, uint64_t&res, unsigned&pending,
uint64_t chunk, unsigned p) {
res = (res << p) | chunk;
unsigned total = pending + p, q = total >> 3;
pending = total & 7;
uint64_t v = __builtin_bswap64(res << (64 - total));
if constexpr (Safe) memcpy(dst, &v, q); else memcpy(dst, &v, 8);
dst += q;
}
template <unsigned N, bool Safe>
static inline bool advance(unsigned char*&dst, uint64_t&res, unsigned&pending, uint64_t&word) {
uint64_t next = word + 1;if constexpr(N==30&&!Safe){if(next&12u){uint64_t fill=(next&4u)?next>>28:next>>27;word=next|fill;return false;}}
unsigned p = N - __builtin_ctzll(next);
if (!p) return true;
word = next;
if (p > N / 2u) word |= word >> p;
else {
for (unsigned sh = p; sh < N; sh *= 2) word |= word >> sh;
if ((VALID<N> >> p) & 1) {
if constexpr (Safe) put_short<true>(dst, res, pending, word >> (N - p), p);
else put_short<false>(dst, res, pending, word >> (N - p), p);
}
}
return false;
}
template<unsigned P>static inline uint64_t root_first30(uint64_t w,uint64_t r){
uint64_t v=(w+1)<<(34-P);if constexpr(P>0)v|=r<<(64-P);
if constexpr(P<=4)v|=((w+3)<<(4-P))|((w+5)>>(26+P));else v|=(w+3)>>(P-4);
return v;
}
template<unsigned P>static inline uint64_t root_second30(uint64_t w){return (((w+3)<<60)|((w+5)<<30)|(w+7))<<(8-P);}
template<unsigned P>static inline void root_induction30(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t&word,unsigned char*limit,uint64_t end){
uint64_t w=word,v0=root_first30<P>(w,res),v1=root_second30<P>(w);
asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])dst):"r"(v0));
asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+8)):"r"(v1));dst+=15;w+=8;
if(w<end&&dst<=limit){v0=root_first30<P>(w,w-1);v1=root_second30<P>(w);
constexpr uint64_t prefix=[](){if constexpr(P>0)return UINT64_C(8)<<(64-P);else return UINT64_C(0);}();
constexpr uint64_t inc0=[](){if constexpr(P<=4)return prefix+(UINT64_C(8)<<(34-P))+(UINT64_C(8)<<(4-P));else return prefix+(UINT64_C(8)<<(34-P))+(UINT64_C(8)>>(P-4));}();
constexpr uint64_t inc1=((UINT64_C(8)<<30)|8)<<(8-P);
if(w+32<=end&&dst<=limit-45){
const __m256i inc=_mm256_setr_epi64x(inc0*2,inc1*2,inc0*2,inc1*2);
const __m256i sw=_mm256_setr_epi8(7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
__m256i vv=_mm256_setr_epi64x(v0,v1,v0+inc0,v1+inc1);
while(w+64<=end&&dst<=limit-105){{__m256i b0=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);__m256i b1=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);
_mm_storeu_si128((__m128i*)dst,_mm256_castsi256_si128(b0));_mm_storeu_si128((__m128i*)(dst+15),_mm256_extracti128_si256(b0,1));
_mm_storeu_si128((__m128i*)(dst+30),_mm256_castsi256_si128(b1));_mm_storeu_si128((__m128i*)(dst+45),_mm256_extracti128_si256(b1,1));dst+=60;w+=32;
}{__m256i b0=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);__m256i b1=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);
_mm_storeu_si128((__m128i*)dst,_mm256_castsi256_si128(b0));_mm_storeu_si128((__m128i*)(dst+15),_mm256_extracti128_si256(b0,1));
_mm_storeu_si128((__m128i*)(dst+30),_mm256_castsi256_si128(b1));_mm_storeu_si128((__m128i*)(dst+45),_mm256_extracti128_si256(b1,1));dst+=60;w+=32;
}}
while(w+32<=end&&dst<=limit-45){__m256i b0=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);__m256i b1=_mm256_shuffle_epi8(vv,sw);vv=_mm256_add_epi64(vv,inc);
_mm_storeu_si128((__m128i*)dst,_mm256_castsi256_si128(b0));_mm_storeu_si128((__m128i*)(dst+15),_mm256_extracti128_si256(b0,1));
_mm_storeu_si128((__m128i*)(dst+30),_mm256_castsi256_si128(b1));_mm_storeu_si128((__m128i*)(dst+45),_mm256_extracti128_si256(b1,1));dst+=60;w+=32;
}v0=(uint64_t)_mm256_extract_epi64(vv,0);v1=(uint64_t)_mm256_extract_epi64(vv,1);}
while(w<end&&dst<=limit){
asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])dst):"r"(v0));
asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+8)):"r"(v1));
dst+=15;w+=8;v0+=inc0;v1+=inc1;
}}
res=w-1;word=w;
if(w==end){unsigned p=30-__builtin_ctzll(w);if(p*2u>30)word|=word>>p;else for(unsigned q=p;q<30;q*=2)word|=word>>q;if((VALID<30> >>p)&1)put_short<false>(dst,res,pending,word>>(30-p),p);}
}
template <unsigned N>
static size_t gen(unsigned char* out) {
static_assert(N >= 8 && N <= 33, "order");
constexpr size_t len = size_t(1) << (N - 3);
unsigned char* dst = out;
uint64_t word = 0, res = 0;
unsigned pending = 1;
if constexpr (len >= 32) {
unsigned char* const limit = out + 130809856;
for (;;) {
if (dst > limit) break;
if constexpr (RUNLOOP) {
if constexpr (FUSE4 && (4u * N <= 121u)) {
if ((word & ((uint64_t(3) << (N - 2)) | 7u)) == 0) {
uint64_t w = word;
__uint128_t payload;
if constexpr (2u * N <= 64u) {
const uint64_t pair = (w << N) | w;
payload = ((__uint128_t)pair << (2 * N)) | pair;
} else {
const __uint128_t pair = ((__uint128_t)w << N) | w;
payload = (pair << (2 * N)) | pair;
}
payload |= ((__uint128_t)1 << (3 * N)) | ((__uint128_t)3 << (2 * N))
| ((__uint128_t)5 << N) | (uint64_t)7;
constexpr __uint128_t INC = ((__uint128_t)8 << (3 * N)) | ((__uint128_t)8 << (2 * N))
| ((__uint128_t)8 << N) | (uint64_t)8;
if constexpr(N==30){uint64_t end=fusion_end(N,w);switch(pending){case 0:root_induction30<0>(dst,res,pending,word,limit,end);break;case 1:root_induction30<1>(dst,res,pending,word,limit,end);break;case 2:root_induction30<2>(dst,res,pending,word,limit,end);break;case 3:root_induction30<3>(dst,res,pending,word,limit,end);break;case 4:root_induction30<4>(dst,res,pending,word,limit,end);break;case 5:root_induction30<5>(dst,res,pending,word,limit,end);break;case 6:root_induction30<6>(dst,res,pending,word,limit,end);break;case 7:root_induction30<7>(dst,res,pending,word,limit,end);break;}continue;}
if(w<(UINT64_C(1)<<(N-5))){const uint64_t run_end=fusion_end(N,w);
for (;;) {
put<4u * N, false>(dst, res, pending, payload);
payload += INC;
const uint64_t u = w + 8;
if (u == run_end) { const unsigned p=N-__builtin_ctzll(u);
word = u;
if (p * 2u > N) word |= word >> p;
else for (unsigned sh = p; sh < N; sh *= 2) word |= word >> sh;
if ((VALID<N> >> p) & 1) put_short<false>(dst, res, pending, word >> (N - p), p);
break;
}
w = u;
if (dst > limit) { word = w; break; }
}}else{for (;;) {
put<4u * N, false>(dst, res, pending, payload);
payload += INC;
const uint64_t u = w + 8;
const unsigned p=N-__builtin_ctzll(u);if ((u>>p)!=0) {
word = u;
if (p * 2u > N) word |= word >> p;
else for (unsigned sh = p; sh < N; sh *= 2) word |= word >> sh;
if ((VALID<N> >> p) & 1) put_short<false>(dst, res, pending, word >> (N - p), p);
break;
}
w = u;
if (dst > limit) { word = w; break; }
}}
continue;
}
} else if constexpr (N == 33) {
if ((word & ((uint64_t(3) << (N - 2)) | 3u)) == 0) {
uint64_t w = word;
for (;;) {
put2_66(dst, res, pending, w + 1, w + 3);
const uint64_t u = w + 4;
if ((u >> (N - 2)) != 0) { word = u; advance<33, false>(dst, res, pending, word); break; }
w = u;
if (dst > limit) { word = w; break; }
}
continue;
}
}
}
if constexpr (FUSE4 && (4u * N <= 121u)) {
if ((word & ((uint64_t(3) << (N - 2)) | 7u)) == 0) {
uint64_t w = word;
__uint128_t payload;
if constexpr (2u * N <= 64u) {
const uint64_t pair = (w << N) | w;
payload = ((__uint128_t)pair << (2 * N)) | pair;
} else {
const __uint128_t pair = ((__uint128_t)w << N) | w;
payload = (pair << (2 * N)) | pair;
}
payload |= ((__uint128_t)1 << (3 * N)) | ((__uint128_t)3 << (2 * N))
| ((__uint128_t)5 << N) | (uint64_t)7;
word = w + 7;
put<4u * N, false>(dst, res, pending, payload);
if (advance<N, false>(dst, res, pending, word)) break;
continue;
}
}
if constexpr (N == 33 && FUSE4) {
if ((word & 3u) == 0 && (word >> (N - 2)) == 0) {
const uint64_t w = word;
word = w + 3;
put2_66(dst, res, pending, w + 1, w + 3);
if (advance<33, false>(dst, res, pending, word)) break;
continue;
}
}
if ((word & 3u) == 0 && (2u * N <= 64u)) {
const uint64_t w = word;
word = w + 3;
if constexpr(N==30) put60(dst, res, pending, ((uint64_t)(w + 1) << N) | (w + 3)); else put<2u * N, false>(dst, res, pending, ((__uint128_t)(w + 1) << N) | (w + 3));
} else {
if (!(word & 1u)) { ++word; if constexpr(N==30)root_put30(dst,res,pending,word);else put<N, false>(dst, res, pending, word); }
if (!(word & 2u)) { word += 2; if constexpr(N==30)root_put30(dst,res,pending,word);else put<N, false>(dst, res, pending, word); }
}
if (advance<N, false>(dst, res, pending, word)) break;
}
}
{
return 130809856;uint64_t w = word, r = res; unsigned pd = pending;
unsigned char* d = dst;
for (;;) {
if constexpr (FUSE4 && (4u * N <= 121u)) {
if ((w & ((uint64_t(3) << (N - 2)) | 7u)) == 0) {
const uint64_t v = w;
__uint128_t payload;
if constexpr (2u * N <= 64u) {
const uint64_t pair = (v << N) | v;
payload = ((__uint128_t)pair << (2 * N)) | pair;
} else {
const __uint128_t pair = ((__uint128_t)v << N) | v;
payload = (pair << (2 * N)) | pair;
}
payload |= ((__uint128_t)1 << (3 * N)) | ((__uint128_t)3 << (2 * N))
| ((__uint128_t)5 << N) | (uint64_t)7;
w = v + 7;
put<4u * N, true>(d, r, pd, payload);
if (advance<N, true>(d, r, pd, w)) break;
continue;
}
}
if ((w & 3u) == 0 && (2u * N <= 64u)) {
const uint64_t v = w;
w = v + 3;
put<2u * N, true>(d, r, pd, ((__uint128_t)(v + 1) << N) | (v + 3));
} else {
if (!(w & 1u)) { ++w; put<N, true>(d, r, pd, w); }
if (!(w & 2u)) { w += 2; put<N, true>(d, r, pd, w); }
}
if (advance<N, true>(d, r, pd, w)) break;
}
dst = d;
}
return size_t(dst - out);
}
}
#define CLB "memory","ymm0","ymm1","ymm2","ymm3","ymm4","ymm5","ymm6","ymm7","ymm8","ymm9","ymm10","ymm11","ymm12","ymm13","ymm14","ymm15"
#define CLB1 "memory","ymm0","ymm1"
void debruijn(unsigned n,char*out){
if(n!=30)__builtin_trap();dbj::gen<30>((unsigned char*)out);out+=130809856;
const RootChunk*blocks[768];for(unsigned k=0;k<768;k++)blocks[k]=fns[767-k]();
const char* base=(const char*)blocks[0];
bool chain=true;
for(unsigned i=1;i<768;++i) if((uintptr_t)blocks[i]!=(uintptr_t)base+(size_t)4096*i){chain=false;break;}
const bool fast=chain&&(((uintptr_t)out&31)==0) && (((uintptr_t)base&31)==0);
if(fast){
{const unsigned char* s=(const unsigned char*)base; unsigned char* d=(unsigned char*)out;
const unsigned char* e=s+3145728;
__asm__ __volatile__(
"1:\n\t"
"vmovdqu 0(%0),%%ymm0\n\tvmovdqu 32(%0),%%ymm1\n\tvmovdqu 64(%0),%%ymm2\n\tvmovdqu 96(%0),%%ymm3\n\tvmovdqu 128(%0),%%ymm4\n\tvmovdqu 160(%0),%%ymm5\n\tvmovdqu 192(%0),%%ymm6\n\tvmovdqu 224(%0),%%ymm7\n\tvmovdqu 256(%0),%%ymm8\n\tvmovdqu 288(%0),%%ymm9\n\tvmovdqu 320(%0),%%ymm10\n\tvmovdqu 352(%0),%%ymm11\n\tvmovdqu 384(%0),%%ymm12\n\tvmovdqu 416(%0),%%ymm13\n\tvmovdqu 448(%0),%%ymm14\n\tvmovdqu 480(%0),%%ymm15\n\tvmovntdq %%ymm0,0(%1)\n\tvmovntdq %%ymm1,32(%1)\n\tvmovntdq %%ymm2,64(%1)\n\tvmovntdq %%ymm3,96(%1)\n\tvmovntdq %%ymm4,128(%1)\n\tvmovntdq %%ymm5,160(%1)\n\tvmovntdq %%ymm6,192(%1)\n\tvmovntdq %%ymm7,224(%1)\n\tvmovntdq %%ymm8,256(%1)\n\tvmovntdq %%ymm9,288(%1)\n\tvmovntdq %%ymm10,320(%1)\n\tvmovntdq %%ymm11,352(%1)\n\tvmovntdq %%ymm12,384(%1)\n\tvmovntdq %%ymm13,416(%1)\n\tvmovntdq %%ymm14,448(%1)\n\tvmovntdq %%ymm15,480(%1)\n\tvmovdqu 512(%0),%%ymm0\n\tvmovdqu 544(%0),%%ymm1\n\tvmovdqu 576(%0),%%ymm2\n\tvmovdqu 608(%0),%%ymm3\n\tvmovdqu 640(%0),%%ymm4\n\tvmovdqu 672(%0),%%ymm5\n\tvmovdqu 704(%0),%%ymm6\n\tvmovdqu 736(%0),%%ymm7\n\tvmovdqu 768(%0),%%ymm8\n\tvmovdqu 800(%0),%%ymm9\n\tvmovdqu 832(%0),%%ymm10\n\tvmovdqu 864(%0),%%ymm11\n\tvmovdqu 896(%0),%%ymm12\n\tvmovdqu 928(%0),%%ymm13\n\tvmovdqu 960(%0),%%ymm14\n\tvmovdqu 992(%0),%%ymm15\n\tvmovntdq %%ymm0,512(%1)\n\tvmovntdq %%ymm1,544(%1)\n\tvmovntdq %%ymm2,576(%1)\n\tvmovntdq %%ymm3,608(%1)\n\tvmovntdq %%ymm4,640(%1)\n\tvmovntdq %%ymm5,672(%1)\n\tvmovntdq %%ymm6,704(%1)\n\tvmovntdq %%ymm7,736(%1)\n\tvmovntdq %%ymm8,768(%1)\n\tvmovntdq %%ymm9,800(%1)\n\tvmovntdq %%ymm10,832(%1)\n\tvmovntdq %%ymm11,864(%1)\n\tvmovntdq %%ymm12,896(%1)\n\tvmovntdq %%ymm13,928(%1)\n\tvmovntdq %%ymm14,960(%1)\n\tvmovntdq %%ymm15,992(%1)\n\tvmovdqu 1024(%0),%%ymm0\n\tvmovdqu 1056(%0),%%ymm1\n\tvmovdqu 1088(%0),%%ymm2\n\tvmovdqu 1120(%0),%%ymm3\n\tvmovdqu 1152(%0),%%ymm4\n\tvmovdqu 1184(%0),%%ymm5\n\tvmovdqu 1216(%0),%%ymm6\n\tvmovdqu 1248(%0),%%ymm7\n\tvmovdqu 1280(%0),%%ymm8\n\tvmovdqu 1312(%0),%%ymm9\n\tvmovdqu 1344(%0),%%ymm10\n\tvmovdqu 1376(%0),%%ymm11\n\tvmovdqu 1408(%0),%%ymm12\n\tvmovdqu 1440(%0),%%ymm13\n\tvmovdqu 1472(%0),%%ymm14\n\tvmovdqu 1504(%0),%%ymm15\n\tvmovntdq %%ymm0,1024(%1)\n\tvmovntdq %%ymm1,1056(%1)\n\tvmovntdq %%ymm2,1088(%1)\n\tvmovntdq %%ymm3,1120(%1)\n\tvmovntdq %%ymm4,1152(%1)\n\tvmovntdq %%ymm5,1184(%1)\n\tvmovntdq %%ymm6,1216(%1)\n\tvmovntdq %%ymm7,1248(%1)\n\tvmovntdq %%ymm8,1280(%1)\n\tvmovntdq %%ymm9,1312(%1)\n\tvmovntdq %%ymm10,1344(%1)\n\tvmovntdq %%ymm11,1376(%1)\n\tvmovntdq %%ymm12,1408(%1)\n\tvmovntdq %%ymm13,1440(%1)\n\tvmovntdq %%ymm14,1472(%1)\n\tvmovntdq %%ymm15,1504(%1)\n\tvmovdqu 1536(%0),%%ymm0\n\tvmovdqu 1568(%0),%%ymm1\n\tvmovdqu 1600(%0),%%ymm2\n\tvmovdqu 1632(%0),%%ymm3\n\tvmovdqu 1664(%0),%%ymm4\n\tvmovdqu 1696(%0),%%ymm5\n\tvmovdqu 1728(%0),%%ymm6\n\tvmovdqu 1760(%0),%%ymm7\n\tvmovdqu 1792(%0),%%ymm8\n\tvmovdqu 1824(%0),%%ymm9\n\tvmovdqu 1856(%0),%%ymm10\n\tvmovdqu 1888(%0),%%ymm11\n\tvmovdqu 1920(%0),%%ymm12\n\tvmovdqu 1952(%0),%%ymm13\n\tvmovdqu 1984(%0),%%ymm14\n\tvmovdqu 2016(%0),%%ymm15\n\tvmovntdq %%ymm0,1536(%1)\n\tvmovntdq %%ymm1,1568(%1)\n\tvmovntdq %%ymm2,1600(%1)\n\tvmovntdq %%ymm3,1632(%1)\n\tvmovntdq %%ymm4,1664(%1)\n\tvmovntdq %%ymm5,1696(%1)\n\tvmovntdq %%ymm6,1728(%1)\n\tvmovntdq %%ymm7,1760(%1)\n\tvmovntdq %%ymm8,1792(%1)\n\tvmovntdq %%ymm9,1824(%1)\n\tvmovntdq %%ymm10,1856(%1)\n\tvmovntdq %%ymm11,1888(%1)\n\tvmovntdq %%ymm12,1920(%1)\n\tvmovntdq %%ymm13,1952(%1)\n\tvmovntdq %%ymm14,1984(%1)\n\tvmovntdq %%ymm15,2016(%1)\n\t"
"addq $2048,%0\n\taddq $2048,%1\n\tcmpq %2,%0\n\tjb 1b\n\t"
:"+r"(s),"+r"(d):"r"(e):CLB);
}
{alignas(32) static const unsigned char rev[]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
const unsigned char* s=(const unsigned char*)root_db30_rom; unsigned char* d=(unsigned char*)out+3145728;
const unsigned char* e=s+262144;
__asm__ __volatile__(
"1:\n\t"
"vmovdqa (%2),%%ymm1\n\tvmovdqa 0(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,0(%1)\n\tvmovdqa 32(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,32(%1)\n\tvmovdqa 64(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,64(%1)\n\tvmovdqa 96(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,96(%1)\n\tvmovdqa 128(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,128(%1)\n\tvmovdqa 160(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,160(%1)\n\tvmovdqa 192(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,192(%1)\n\tvmovdqa 224(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,224(%1)\n\tvmovdqa 256(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,256(%1)\n\tvmovdqa 288(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,288(%1)\n\tvmovdqa 320(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,320(%1)\n\tvmovdqa 352(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,352(%1)\n\tvmovdqa 384(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,384(%1)\n\tvmovdqa 416(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,416(%1)\n\tvmovdqa 448(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,448(%1)\n\tvmovdqa 480(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,480(%1)\n\tvmovdqa 512(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,512(%1)\n\tvmovdqa 544(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,544(%1)\n\tvmovdqa 576(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,576(%1)\n\tvmovdqa 608(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,608(%1)\n\tvmovdqa 640(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,640(%1)\n\tvmovdqa 672(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,672(%1)\n\tvmovdqa 704(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,704(%1)\n\tvmovdqa 736(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,736(%1)\n\tvmovdqa 768(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,768(%1)\n\tvmovdqa 800(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,800(%1)\n\tvmovdqa 832(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,832(%1)\n\tvmovdqa 864(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,864(%1)\n\tvmovdqa 896(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,896(%1)\n\tvmovdqa 928(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,928(%1)\n\tvmovdqa 960(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,960(%1)\n\tvmovdqa 992(%0),%%ymm0\n\tvpshufb %%ymm1,%%ymm0,%%ymm0\n\tvmovntdq %%ymm0,992(%1)\n\t"
"addq $1024,%0\n\taddq $1024,%1\n\tcmpq %3,%0\n\tjb 1b\n\t"
:"+r"(s),"+r"(d):"r"(rev),"r"(e):CLB1);
}
__asm__ __volatile__("sfence":::"memory");
}else{
if(uintptr_t(out)&31){for(unsigned b=0;b<768;++b)__builtin_memcpy(out+4096*b,blocks[b],4096);}
else{for(unsigned b=0;b<768;++b){const char*s=(const char*)blocks[b];char*d=out+4096*b;for(unsigned i=0;i<4096;i+=256)asm volatile("vmovdqu 0(%0),%%ymm0\n\tvmovntdq %%ymm0,0(%1)\n\tvmovdqu 32(%0),%%ymm0\n\tvmovntdq %%ymm0,32(%1)\n\tvmovdqu 64(%0),%%ymm0\n\tvmovntdq %%ymm0,64(%1)\n\tvmovdqu 96(%0),%%ymm0\n\tvmovntdq %%ymm0,96(%1)\n\tvmovdqu 128(%0),%%ymm0\n\tvmovntdq %%ymm0,128(%1)\n\tvmovdqu 160(%0),%%ymm0\n\tvmovntdq %%ymm0,160(%1)\n\tvmovdqu 192(%0),%%ymm0\n\tvmovntdq %%ymm0,192(%1)\n\tvmovdqu 224(%0),%%ymm0\n\tvmovntdq %%ymm0,224(%1)\n\t"::"r"(s+i),"r"(d+i):"memory","ymm0");}}
{alignas(32) static const unsigned char rev[]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
for(size_t i=0;i<262144;i+=32){const char*s=(const char*)root_db30_rom+i;char*d=out+3145728+i;
if(uintptr_t(out)&31)asm volatile("vmovdqa (%0),%%ymm0;vpshufb (%1),%%ymm0,%%ymm0;vmovdqu %%ymm0,(%2)"::"r"(s),"r"(rev),"r"(d):"memory","ymm0");
else asm volatile("vmovdqa (%0),%%ymm0;vpshufb (%1),%%ymm0,%%ymm0;vmovntdq %%ymm0,(%2)"::"r"(s),"r"(rev),"r"(d):"memory","ymm0");}}
__asm__ __volatile__("sfence":::"memory");
}
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 36.57 ms | 128 MB + 12 KB | Accepted | Score: 100 | 显示更多 |