//
// sub_100340AE4 from 0x100340ae4 to 0x1003418d4 (3568 bytes)
//
// 2 xrefs:
// > GameStatsManager::tryFixPathBug @ 0x10032ffd0
// > sub_100340AE4 @ 0x100341168
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_100340AE4(__int64 result, char *a2, __int64 a3, char a4)
{
char *v7; // x19
char *v8; // x23
__int64 v9; // x9
char *v10; // x8
int v11; // w10
int v12; // w12
char *v13; // x9
int v14; // w15
int *v15; // x11
int v16; // w14
int v17; // w16
int v18; // w13
bool v19; // w17
_BOOL4 v20; // w12
char *v21; // x9
int v22; // w15
int *v23; // x11
int v24; // w14
int v25; // w16
int v26; // w13
bool v27; // w17
_BOOL4 v28; // w12
int v29; // w10
int v30; // w13
int v31; // w12
int v32; // w14
_BOOL4 v33; // w13
int v34; // w10
int v35; // w13
int v36; // w12
int v37; // w14
_BOOL4 v38; // w13
int v39; // w10
int v40; // w11
_BOOL4 v41; // w11
int v42; // w10
char *v43; // x9
int v44; // w13
char *v45; // x10
int v46; // w15
int *v47; // x11
int v48; // w14
int v49; // w12
bool v50; // w0
int v51; // w16
int v52; // w17
_BOOL4 v53; // w17
int v54; // w12
int v55; // w14
int v56; // w13
int v57; // w15
_BOOL4 v58; // w14
int v59; // w8
int v60; // w10
_BOOL4 v61; // w10
int v62; // w8
int v63; // w11
int v64; // w13
_BOOL4 v65; // w13
int v66; // w12
char *v67; // x10
int v68; // w11
int v69; // w12
char *v70; // x13
int *v71; // x14
int v72; // w16
int v73; // w15
bool v74; // w1
int v75; // w0
int v76; // w17
_BOOL4 v77; // w0
int v78; // w11
int v79; // w15
int v80; // w16
_BOOL4 v81; // w16
int v82; // w11
int v83; // w12
_BOOL4 v84; // w12
int v85; // w11
int v86; // w15
int v87; // w16
int v88; // w13
int v89; // w14
_BOOL4 v90; // w17
_BOOL4 v91; // w15
bool v92; // w15
int32x2_t v93; // d0
int v94; // w8
int v95; // w10
bool v96; // w8
__int64 v97; // x13
int v98; // w8
int v99; // w9
int v100; // w11
int v101; // w12
bool v102; // w10
bool v103; // w11
char *v104; // x10
char *v105; // x11
int v106; // w13
int v107; // w14
_BOOL4 v108; // w13
_BOOL4 v109; // w14
int v110; // w13
int v111; // w14
bool v112; // w13
bool v113; // w14
int v114; // w14
char *v115; // x13
int v116; // w12
int v117; // w14
bool v118; // w14
int v119; // w15
_BOOL4 v120; // w15
char v121; // w25
int v122; // w8
int v123; // w9
int v124; // w10
bool v125; // w10
int v126; // w10
int v127; // w11
bool v128; // w10
bool v129; // w11
char *v130; // x10
int v131; // w10
_BOOL4 v132; // w11
_BOOL4 v133; // w10
char *v134; // x10
int v135; // w11
int v136; // w12
bool v137; // w11
bool v138; // w12
int v139; // w11
int v140; // w12
int v141; // w11
int v142; // w12
_BOOL4 v143; // w12
int v144; // w13
bool v145; // w13
int v146; // w8
int v147; // w10
int v148; // w9
int v149; // w11
_BOOL4 v150; // w10
int v151; // w8
__int128 v152; // q0
int v153; // w9
int v154; // w11
_BOOL4 v155; // w12
int v156; // w9
int v157; // w11
_BOOL4 v158; // w10
int32x2_t v159; // d1
int v160; // w10
unsigned __int8 v161; // w9
bool v162; // w8
int v163; // w8
int v164; // w10
int v165; // w9
int v166; // w11
bool v167; // zf
_BOOL4 v168; // w10
int v169; // w8
char *v170; // x8
int v171; // w13
int *v172; // x9
int v173; // w12
int v174; // w14
int v175; // w10
bool v176; // w17
int v177; // w16
int v178; // w15
_BOOL4 v179; // w16
char *v180; // x10
bool v182; // w8
__int64 v183; // x8
char *v184; // x9
int v185; // w11
int v186; // w13
int v187; // w12
int v188; // w14
_BOOL4 v189; // w10
_BOOL4 v190; // w11
int v191; // w10
int v192; // w11
__int64 v193; // x13
char *v194; // x14
int v195; // w15
int v196; // w15
bool v197; // w14
bool v198; // w15
char *v199; // x12
signed __int64 v200; // x8
signed __int64 v201; // x11
signed __int64 v202; // x10
__int64 v203; // x12
char *v204; // x11
int v205; // w14
int v206; // w15
int v207; // w16
_BOOL4 v208; // w14
char *v209; // x13
int v210; // w14
int v211; // w15
bool v212; // w14
int v213; // w14
int v214; // w15
char *v215; // x17
__int64 v216; // x17
int v217; // w16
int v218; // w0
_BOOL4 v219; // w16
bool v220; // zf
int v221; // w17
_BOOL4 v222; // w17
__int64 v223; // x13
int32x2_t v224; // x11
char *v225; // x12
char *v226; // x15
char *v227; // x8
__int64 v228; // x14
char *v229; // x15
int v230; // w16
int v231; // w17
_BOOL4 v232; // w17
__int64 v233; // x11
bool v234; // cc
unsigned __int64 v235; // x11
unsigned __int64 v236; // x11
char *v237; // x12
int v238; // w13
int v239; // w14
int v240; // w15
_BOOL4 v241; // w14
int v242; // w14
int v243; // w15
char *v244; // x16
int v245; // w16
bool v246; // w16
int v247; // w10
int v248; // w10
int v249; // w12
int v250; // w11
int v251; // w13
_BOOL4 v252; // w12
_DWORD *v253; // x8
int v254; // w11
int v255; // w12
int v256; // w9
int v257; // w13
_BOOL4 v258; // w10
_BOOL4 v259; // w11
int v260; // w10
int v261; // w11
_DWORD *v262; // x12
_DWORD *v263; // x13
int v264; // t1
int v265; // w14
bool v266; // w13
bool v267; // w14
int v268; // w9
int v269; // w13
_BOOL4 v270; // w12
int v271; // w10
v7 = (char *)result;
while ( 2 )
{
v8 = v7;
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
v7 = v8;
v9 = (a2 - v8) >> 3;
if ( v9 > 2 )
{
switch ( v9 )
{
case 3LL:
v170 = v8 + 12;
v171 = *((_DWORD *)v8 + 3);
v172 = (int *)(v8 + 4);
v173 = *((_DWORD *)v8 + 1);
v174 = *((_DWORD *)v8 + 2);
v175 = *(_DWORD *)v8;
if ( v171 == v173 )
v176 = v174 < *(_DWORD *)v8;
else
v176 = v171 > v173;
v177 = *((_DWORD *)a2 - 1);
v178 = *((_DWORD *)a2 - 2);
result = v178 < v174;
v167 = v177 == v171;
v179 = v177 > v171;
if ( v167 )
v179 = v178 < v174;
if ( v176 )
{
if ( v179 )
{
*(_DWORD *)v8 = v178;
*((_DWORD *)a2 - 2) = v175;
}
else
{
*(_DWORD *)v8 = v174;
*((_DWORD *)v8 + 1) = v171;
*((_DWORD *)v8 + 2) = v175;
*((_DWORD *)v8 + 3) = v173;
v268 = *((_DWORD *)a2 - 2);
v269 = *((_DWORD *)a2 - 1);
v167 = v269 == v173;
v270 = v269 > v173;
if ( v167 )
v270 = v268 < v175;
if ( !v270 )
return result;
*((_DWORD *)v8 + 2) = v268;
*((_DWORD *)a2 - 2) = v175;
v172 = (int *)(v8 + 12);
}
v170 = a2 - 4;
}
else
{
if ( !v179 )
return result;
*((_DWORD *)v8 + 2) = v178;
*((_DWORD *)a2 - 2) = v174;
v247 = *((_DWORD *)v8 + 3);
*((_DWORD *)v8 + 3) = *((_DWORD *)a2 - 1);
*((_DWORD *)a2 - 1) = v247;
v248 = *((_DWORD *)v8 + 2);
v249 = *((_DWORD *)v8 + 3);
v250 = *(_DWORD *)v8;
v251 = *((_DWORD *)v8 + 1);
v167 = v249 == v251;
v252 = v249 > v251;
if ( v167 )
v252 = v248 < *(_DWORD *)v8;
if ( !v252 )
return result;
*(_DWORD *)v8 = v248;
*((_DWORD *)v8 + 2) = v250;
}
v271 = *v172;
*v172 = *(_DWORD *)v170;
*(_DWORD *)v170 = v271;
return result;
case 4LL:
return sub_1003418D4(v8, v8 + 8, v8 + 16, a2 - 8);
case 5LL:
result = sub_1003418D4(v8, v8 + 8, v8 + 16, v8 + 24);
v146 = *((_DWORD *)a2 - 2);
v147 = *((_DWORD *)a2 - 1);
v148 = *((_DWORD *)v8 + 6);
v149 = *((_DWORD *)v8 + 7);
v167 = v147 == v149;
v150 = v147 > v149;
if ( v167 )
v150 = v146 < v148;
if ( v150 )
{
*((_DWORD *)v8 + 6) = v146;
*((_DWORD *)a2 - 2) = v148;
v151 = *((_DWORD *)v8 + 7);
*((_DWORD *)v8 + 7) = *((_DWORD *)a2 - 1);
*((_DWORD *)a2 - 1) = v151;
*(_QWORD *)&v152 = *((_QWORD *)v8 + 3);
v154 = *((_DWORD *)v8 + 4);
v153 = *((_DWORD *)v8 + 5);
v155 = (int)v152 < v154;
if ( DWORD1(v152) != v153 )
v155 = SDWORD1(v152) > v153;
if ( v155 )
{
*((_QWORD *)v8 + 2) = v152;
*((_DWORD *)v8 + 6) = v154;
*((_DWORD *)v8 + 7) = v153;
v157 = *((_DWORD *)v8 + 2);
v156 = *((_DWORD *)v8 + 3);
v158 = (int)v152 < v157;
if ( DWORD1(v152) != v156 )
v158 = SDWORD1(v152) > v156;
if ( v158 )
{
*((_QWORD *)v8 + 1) = v152;
v159 = *(int32x2_t *)v8;
v160 = HIDWORD(*(_QWORD *)v8);
*((_DWORD *)v8 + 4) = v157;
*((_DWORD *)v8 + 5) = v156;
v161 = vcgt_s32(v159, *(int32x2_t *)&v152).u8[0];
v162 = SDWORD1(v152) > v160;
if ( DWORD1(v152) == v160 )
v162 = v161;
if ( v162 )
{
*((int32x2_t *)&v152 + 1) = v159;
*(_OWORD *)v8 = v152;
}
}
}
}
return result;
}
}
else
{
if ( (unsigned __int64)v9 < 2 )
return result;
if ( v9 == 2 )
{
v163 = *((_DWORD *)a2 - 2);
v164 = *((_DWORD *)a2 - 1);
v165 = *(_DWORD *)v8;
v166 = *((_DWORD *)v8 + 1);
v167 = v164 == v166;
v168 = v164 > v166;
if ( v167 )
v168 = v163 < *(_DWORD *)v8;
if ( v168 )
{
*(_DWORD *)v8 = v163;
*((_DWORD *)a2 - 2) = v165;
v169 = *((_DWORD *)v8 + 1);
*((_DWORD *)v8 + 1) = *((_DWORD *)a2 - 1);
*((_DWORD *)a2 - 1) = v169;
}
return result;
}
}
if ( v9 <= 23 )
{
v180 = v8 + 8;
v182 = v8 == a2 || v180 == a2;
if ( (a4 & 1) != 0 )
{
if ( !v182 )
{
v183 = 0;
v184 = v8;
do
{
v186 = *((_DWORD *)v184 + 2);
v185 = *((_DWORD *)v184 + 3);
v187 = *(_DWORD *)v184;
v188 = *((_DWORD *)v184 + 1);
v184 = v180;
v189 = v186 < v187;
v167 = v185 == v188;
v190 = v185 > v188;
if ( !v167 )
v189 = v190;
if ( v189 )
{
v191 = *(_DWORD *)v184;
v192 = *((_DWORD *)v184 + 1);
v193 = v183;
while ( 1 )
{
v194 = &v8[v193];
v195 = *(_DWORD *)&v8[v193 + 4];
*((_DWORD *)v194 + 2) = v187;
*((_DWORD *)v194 + 3) = v195;
if ( !v193 )
break;
v187 = *((_DWORD *)v194 - 2);
v196 = *((_DWORD *)v194 - 1);
v197 = v187 > v191;
v167 = v196 == v192;
v198 = v196 < v192;
if ( !v167 )
v197 = v198;
v193 -= 8;
if ( !v197 )
{
v199 = &v8[v193 + 8];
goto LABEL_219;
}
}
v199 = v8;
LABEL_219:
*(_DWORD *)v199 = v191;
*((_DWORD *)v199 + 1) = v192;
}
v180 = v184 + 8;
v183 += 8;
}
while ( v184 + 8 != a2 );
}
}
else if ( !v182 )
{
v253 = v8 + 12;
do
{
v255 = *((_DWORD *)v7 + 2);
v254 = *((_DWORD *)v7 + 3);
v256 = *(_DWORD *)v7;
v257 = *((_DWORD *)v7 + 1);
v7 = v180;
v258 = v255 < v256;
v167 = v254 == v257;
v259 = v254 > v257;
if ( !v167 )
v258 = v259;
if ( v258 )
{
v260 = *(_DWORD *)v7;
v261 = *((_DWORD *)v7 + 1);
v262 = v253;
do
{
v263 = v262;
v264 = *(v262 - 2);
v262 -= 2;
*(v263 - 1) = v256;
*v263 = v264;
v256 = *(v263 - 5);
v265 = *(v263 - 4);
v266 = v256 > v260;
v167 = v265 == v261;
v267 = v265 < v261;
if ( !v167 )
v266 = v267;
}
while ( v266 );
*(v262 - 1) = v260;
*v262 = v261;
}
v180 = v7 + 8;
v253 += 2;
}
while ( v7 + 8 != a2 );
}
return result;
}
if ( !a3 )
{
if ( v8 != a2 )
{
v200 = (unsigned __int64)(v9 - 2) >> 1;
v201 = v200;
do
{
v202 = v201;
if ( v200 >= v201 )
{
v203 = (2 * v201) | 1;
v204 = &v8[8 * v203];
if ( 2 * v202 + 2 >= v9 )
{
v207 = *(_DWORD *)v204;
}
else
{
v205 = *((_DWORD *)v204 + 3);
v207 = *(_DWORD *)v204;
v206 = *((_DWORD *)v204 + 1);
result = *((unsigned int *)v204 + 2);
v167 = v206 == v205;
v208 = v206 > v205;
if ( v167 )
v208 = *(_DWORD *)v204 < (int)result;
if ( v208 )
{
v207 = *((_DWORD *)v204 + 2);
v204 += 8;
v203 = 2 * v202 + 2;
}
}
v209 = &v8[8 * v202];
v210 = *((_DWORD *)v204 + 1);
v211 = *((_DWORD *)v209 + 1);
v167 = v210 == v211;
v212 = v210 > v211;
if ( v167 )
v212 = v207 < *(_DWORD *)v209;
if ( !v212 )
{
v213 = *(_DWORD *)v209;
v214 = *((_DWORD *)v209 + 1);
do
{
v215 = v209;
v209 = v204;
*(_DWORD *)v215 = v207;
*((_DWORD *)v215 + 1) = *((_DWORD *)v204 + 1);
if ( v200 < v203 )
break;
v216 = (2 * v203) | 1;
v204 = &v8[8 * v216];
v203 = 2 * v203 + 2;
if ( v203 >= v9 )
{
v207 = *(_DWORD *)v204;
v203 = v216;
}
else
{
v217 = *((_DWORD *)v204 + 3);
v218 = *((_DWORD *)v204 + 1);
v167 = v218 == v217;
v219 = v218 > v217;
if ( v167 )
v219 = *(_DWORD *)v204 < *((_DWORD *)v204 + 2);
v220 = !v219;
v207 = v219 ? *((_DWORD *)v204 + 2) : *(_DWORD *)v204;
if ( v220 )
v203 = v216;
else
v204 += 8;
}
v221 = *((_DWORD *)v204 + 1);
result = v207 < v213;
v167 = v221 == v214;
v222 = v221 > v214;
if ( v167 )
v222 = v207 < v213;
}
while ( !v222 );
*(_DWORD *)v209 = v213;
*((_DWORD *)v209 + 1) = v214;
}
}
v201 = v202 - 1;
}
while ( v202 );
do
{
v223 = 0;
v224 = *(int32x2_t *)v8;
v225 = v8;
do
{
v226 = &v225[8 * v223];
v227 = v226 + 8;
v228 = (2 * v223) | 1;
v223 = 2 * v223 + 2;
if ( v223 >= v9 )
{
v230 = *(_DWORD *)v227;
v223 = v228;
}
else
{
v230 = *((_DWORD *)v226 + 4);
v231 = *((_DWORD *)v226 + 5);
v229 = v226 + 16;
result = *((unsigned int *)v229 - 1);
v167 = (_DWORD)result == v231;
v232 = (int)result > v231;
if ( v167 )
v232 = *((_DWORD *)v229 - 2) < v230;
if ( v232 )
{
v227 = v229;
}
else
{
v230 = *((_DWORD *)v229 - 2);
v223 = v228;
}
}
*(_DWORD *)v225 = v230;
*((_DWORD *)v225 + 1) = *((_DWORD *)v227 + 1);
v225 = v227;
}
while ( v223 <= (__int64)((unsigned __int64)(v9 - 2) >> 1) );
if ( v227 == a2 - 8 )
{
*(int32x2_t *)v227 = v224;
}
else
{
*(_DWORD *)v227 = *((_DWORD *)a2 - 2);
*((_DWORD *)v227 + 1) = *((_DWORD *)a2 - 1);
*((int32x2_t *)a2 - 1) = v224;
v233 = (v227 - v8 + 8) >> 3;
v234 = v233 < 2;
v235 = v233 - 2;
if ( !v234 )
{
v236 = v235 >> 1;
v237 = &v8[8 * v236];
v238 = *(_DWORD *)v237;
v239 = *((_DWORD *)v237 + 1);
v240 = *((_DWORD *)v227 + 1);
v167 = v239 == v240;
v241 = v239 > v240;
if ( v167 )
v241 = *(_DWORD *)v237 < *(_DWORD *)v227;
if ( v241 )
{
v242 = *(_DWORD *)v227;
v243 = *((_DWORD *)v227 + 1);
do
{
v244 = v227;
v227 = v237;
*(_DWORD *)v244 = v238;
*((_DWORD *)v244 + 1) = *((_DWORD *)v237 + 1);
if ( !v236 )
break;
v236 = (v236 - 1) >> 1;
v237 = &v8[8 * v236];
v238 = *(_DWORD *)v237;
v245 = *((_DWORD *)v237 + 1);
v167 = v245 == v243;
v246 = v245 > v243;
if ( v167 )
v246 = *(_DWORD *)v237 < v242;
}
while ( v246 );
*(_DWORD *)v227 = v242;
*((_DWORD *)v227 + 1) = v243;
}
}
}
a2 -= 8;
v234 = v9-- <= 2;
}
while ( !v234 );
}
return result;
}
v10 = &v8[8 * ((unsigned __int64)v9 >> 1)];
v11 = *((_DWORD *)a2 - 2);
v12 = *((_DWORD *)a2 - 1);
if ( (unsigned __int64)v9 >= 0x81 )
{
v13 = v10 + 4;
v14 = *((_DWORD *)v10 + 1);
v15 = (int *)(v8 + 4);
v16 = *((_DWORD *)v8 + 1);
v17 = *(_DWORD *)v10;
v18 = *(_DWORD *)v8;
v19 = *(_DWORD *)v10 < *(_DWORD *)v8;
if ( v14 != v16 )
v19 = v14 > v16;
v167 = v12 == v14;
v20 = v12 > v14;
if ( v167 )
v20 = v11 < v17;
if ( v19 )
{
if ( v20 )
{
*(_DWORD *)v8 = v11;
*((_DWORD *)a2 - 2) = v18;
LABEL_41:
v13 = a2 - 4;
goto LABEL_42;
}
*(_DWORD *)v8 = v17;
*((_DWORD *)v8 + 1) = v14;
*(_DWORD *)v10 = v18;
*((_DWORD *)v10 + 1) = v16;
v39 = *((_DWORD *)a2 - 2);
v40 = *((_DWORD *)a2 - 1);
v167 = v40 == v16;
v41 = v40 > v16;
if ( v167 )
v41 = v39 < v18;
if ( v41 )
{
*(_DWORD *)v10 = v39;
*((_DWORD *)a2 - 2) = v18;
v15 = (int *)(v10 + 4);
goto LABEL_41;
}
}
else if ( v20 )
{
*(_DWORD *)v10 = v11;
*((_DWORD *)a2 - 2) = v17;
v29 = *((_DWORD *)v10 + 1);
*((_DWORD *)v10 + 1) = *((_DWORD *)a2 - 1);
*((_DWORD *)a2 - 1) = v29;
v30 = *((_DWORD *)v10 + 1);
v31 = *(_DWORD *)v8;
v32 = *((_DWORD *)v8 + 1);
v167 = v30 == v32;
v33 = v30 > v32;
if ( v167 )
v33 = *(_DWORD *)v10 < *(_DWORD *)v8;
if ( v33 )
{
*(_DWORD *)v8 = *(_DWORD *)v10;
*(_DWORD *)v10 = v31;
LABEL_42:
v42 = *v15;
*v15 = *(_DWORD *)v13;
*(_DWORD *)v13 = v42;
}
}
v43 = v10 - 8;
v44 = *((_DWORD *)v10 - 2);
v45 = v10 - 4;
v46 = *((_DWORD *)v10 - 1);
v47 = (int *)(v8 + 12);
v48 = *((_DWORD *)v8 + 3);
v49 = *((_DWORD *)v8 + 2);
if ( v46 == v48 )
v50 = v44 < v49;
else
v50 = v46 > v48;
v51 = *((_DWORD *)a2 - 4);
v52 = *((_DWORD *)a2 - 3);
v167 = v52 == v46;
v53 = v52 > v46;
if ( v167 )
v53 = v51 < v44;
if ( v50 )
{
if ( v53 )
{
*((_DWORD *)v8 + 2) = v51;
*((_DWORD *)a2 - 4) = v49;
LABEL_66:
v45 = a2 - 12;
goto LABEL_67;
}
*((_DWORD *)v8 + 2) = v44;
*((_DWORD *)v8 + 3) = v46;
*(_DWORD *)v43 = v49;
*((_DWORD *)v10 - 1) = v48;
v63 = *((_DWORD *)a2 - 4);
v64 = *((_DWORD *)a2 - 3);
v167 = v64 == v48;
v65 = v64 > v48;
if ( v167 )
v65 = v63 < v49;
if ( v65 )
{
*(_DWORD *)v43 = v63;
*((_DWORD *)a2 - 4) = v49;
v47 = (int *)(v10 - 4);
goto LABEL_66;
}
}
else if ( v53 )
{
*(_DWORD *)v43 = v51;
*((_DWORD *)a2 - 4) = v44;
v54 = *((_DWORD *)v10 - 1);
*((_DWORD *)v10 - 1) = *((_DWORD *)a2 - 3);
*((_DWORD *)a2 - 3) = v54;
v55 = *((_DWORD *)v10 - 1);
v56 = *((_DWORD *)v8 + 2);
v57 = *((_DWORD *)v8 + 3);
v167 = v55 == v57;
v58 = v55 > v57;
if ( v167 )
v58 = *(_DWORD *)v43 < v56;
if ( v58 )
{
*((_DWORD *)v8 + 2) = *(_DWORD *)v43;
*(_DWORD *)v43 = v56;
LABEL_67:
v66 = *v47;
*v47 = *(_DWORD *)v45;
*(_DWORD *)v45 = v66;
}
}
v67 = v10 + 8;
v68 = *((_DWORD *)v10 + 2);
v70 = v10 + 12;
v69 = *((_DWORD *)v10 + 3);
v71 = (int *)(v8 + 20);
v72 = *((_DWORD *)v8 + 5);
v73 = *((_DWORD *)v8 + 4);
if ( v69 == v72 )
v74 = v68 < v73;
else
v74 = v69 > v72;
v76 = *((_DWORD *)a2 - 6);
v75 = *((_DWORD *)a2 - 5);
v167 = v75 == v69;
v77 = v75 > v69;
if ( v167 )
v77 = v76 < v68;
if ( v74 )
{
if ( v77 )
{
*((_DWORD *)v8 + 4) = v76;
*((_DWORD *)a2 - 6) = v73;
LABEL_85:
v70 = a2 - 20;
goto LABEL_86;
}
*((_DWORD *)v8 + 4) = v68;
*((_DWORD *)v8 + 5) = v69;
*(_DWORD *)v67 = v73;
*((_DWORD *)v10 + 3) = v72;
v82 = *((_DWORD *)a2 - 6);
v83 = *((_DWORD *)a2 - 5);
v167 = v83 == v72;
v84 = v83 > v72;
if ( v167 )
v84 = v82 < v73;
if ( v84 )
{
*(_DWORD *)v67 = v82;
*((_DWORD *)a2 - 6) = v73;
v71 = (int *)(v10 + 12);
goto LABEL_85;
}
v68 = v73;
v69 = v72;
}
else if ( v77 )
{
*(_DWORD *)v67 = v76;
*((_DWORD *)a2 - 6) = v68;
v78 = *((_DWORD *)v10 + 3);
*((_DWORD *)v10 + 3) = *((_DWORD *)a2 - 5);
*((_DWORD *)a2 - 5) = v78;
v68 = *(_DWORD *)v67;
v69 = *((_DWORD *)v10 + 3);
v79 = *((_DWORD *)v8 + 4);
v80 = *((_DWORD *)v8 + 5);
v167 = v69 == v80;
v81 = v69 > v80;
if ( v167 )
v81 = *(_DWORD *)v67 < v79;
if ( v81 )
{
*((_DWORD *)v8 + 4) = v68;
*(_DWORD *)v67 = v79;
LABEL_86:
v85 = *v71;
*v71 = *(_DWORD *)v70;
*(_DWORD *)v70 = v85;
v68 = *(_DWORD *)v67;
v69 = *((_DWORD *)v10 + 3);
}
}
v87 = *(_DWORD *)v10;
v86 = *((_DWORD *)v10 + 1);
v89 = *(_DWORD *)v43;
v88 = *((_DWORD *)v10 - 1);
if ( v86 == v88 )
result = *(_DWORD *)v10 < *(_DWORD *)v43;
else
result = v86 > v88;
v90 = v68 < v87;
if ( v69 != v86 )
v90 = v69 > v86;
if ( (result & 1) != 0 )
{
if ( !v90 )
{
*(_DWORD *)v43 = v87;
*((_DWORD *)v10 - 1) = v86;
*(_DWORD *)v10 = v89;
*((_DWORD *)v10 + 1) = v88;
v91 = v69 > v88;
if ( v69 == v88 )
v91 = v68 < v89;
v43 = v10;
if ( !v91 )
{
v86 = v88;
v87 = v89;
LABEL_103:
v93 = *(int32x2_t *)v8;
*(_DWORD *)v8 = v87;
*((_DWORD *)v8 + 1) = v86;
*(int32x2_t *)v10 = v93;
goto LABEL_104;
}
}
}
else
{
if ( !v90 )
goto LABEL_103;
*(_DWORD *)v10 = v68;
*((_DWORD *)v10 + 1) = v69;
*(_DWORD *)v67 = v87;
*((_DWORD *)v10 + 3) = v86;
v92 = v69 > v88;
if ( v69 == v88 )
v92 = v68 < v89;
v67 = v10;
if ( !v92 )
{
v86 = v69;
v87 = v68;
goto LABEL_103;
}
}
*(_DWORD *)v67 = v89;
*(_DWORD *)v43 = v68;
*((_DWORD *)v43 + 1) = v69;
*((_DWORD *)v67 + 1) = v88;
v87 = *(_DWORD *)v10;
v86 = *((_DWORD *)v10 + 1);
goto LABEL_103;
}
v21 = v8 + 4;
v22 = *((_DWORD *)v8 + 1);
v23 = (int *)(v10 + 4);
v24 = *((_DWORD *)v10 + 1);
v25 = *(_DWORD *)v8;
v26 = *(_DWORD *)v10;
v27 = *(_DWORD *)v8 < *(_DWORD *)v10;
if ( v22 != v24 )
v27 = v22 > v24;
result = v11 < v25;
v167 = v12 == v22;
v28 = v12 > v22;
if ( v167 )
v28 = v11 < v25;
if ( v27 )
{
if ( v28 )
{
*(_DWORD *)v10 = v11;
*((_DWORD *)a2 - 2) = v26;
LABEL_60:
v21 = a2 - 4;
goto LABEL_61;
}
*(_DWORD *)v10 = v25;
*((_DWORD *)v10 + 1) = v22;
*(_DWORD *)v8 = v26;
*((_DWORD *)v8 + 1) = v24;
v59 = *((_DWORD *)a2 - 2);
v60 = *((_DWORD *)a2 - 1);
v167 = v60 == v24;
v61 = v60 > v24;
if ( v167 )
v61 = v59 < v26;
if ( v61 )
{
*(_DWORD *)v8 = v59;
*((_DWORD *)a2 - 2) = v26;
v23 = (int *)(v8 + 4);
goto LABEL_60;
}
}
else if ( v28 )
{
*(_DWORD *)v8 = v11;
*((_DWORD *)a2 - 2) = v25;
v34 = *((_DWORD *)v8 + 1);
*((_DWORD *)v8 + 1) = *((_DWORD *)a2 - 1);
*((_DWORD *)a2 - 1) = v34;
v35 = *((_DWORD *)v8 + 1);
v36 = *(_DWORD *)v10;
v37 = *((_DWORD *)v10 + 1);
v167 = v35 == v37;
v38 = v35 > v37;
if ( v167 )
v38 = *(_DWORD *)v8 < *(_DWORD *)v10;
if ( v38 )
{
*(_DWORD *)v10 = *(_DWORD *)v8;
*(_DWORD *)v8 = v36;
LABEL_61:
v62 = *v23;
*v23 = *(_DWORD *)v21;
*(_DWORD *)v21 = v62;
}
}
LABEL_104:
--a3;
if ( (a4 & 1) != 0 )
break;
v94 = *((_DWORD *)v8 - 1);
v95 = *((_DWORD *)v8 + 1);
v167 = v94 == v95;
v96 = v94 > v95;
if ( v167 )
v96 = *((_DWORD *)v8 - 2) < *(_DWORD *)v8;
if ( v96 )
break;
v123 = *(_DWORD *)v8;
v122 = *((_DWORD *)v8 + 1);
v124 = *((_DWORD *)a2 - 1);
v167 = v124 == v122;
v125 = v124 < v122;
if ( v167 )
v125 = *((_DWORD *)a2 - 2) > *(_DWORD *)v8;
if ( v125 )
{
do
{
v126 = *((_DWORD *)v8 + 2);
v127 = *((_DWORD *)v8 + 3);
v8 += 8;
v128 = v126 > v123;
v167 = v127 == v122;
v129 = v127 < v122;
if ( !v167 )
v128 = v129;
}
while ( !v128 );
}
else
{
v130 = v8 + 8;
do
{
v8 = v130;
if ( v130 >= a2 )
break;
v131 = *((_DWORD *)v130 + 1);
v132 = *(_DWORD *)v8 > v123;
v167 = v131 == v122;
v133 = v131 < v122;
if ( !v167 )
v132 = v133;
v130 = v8 + 8;
}
while ( !v132 );
}
v134 = a2;
if ( v8 < a2 )
{
v134 = a2;
do
{
v135 = *((_DWORD *)v134 - 2);
v136 = *((_DWORD *)v134 - 1);
v134 -= 8;
v137 = v135 > v123;
v167 = v136 == v122;
v138 = v136 < v122;
if ( !v167 )
v137 = v138;
}
while ( v137 );
}
if ( v8 < v134 )
{
v139 = *(_DWORD *)v8;
v140 = *(_DWORD *)v134;
do
{
*(_DWORD *)v8 = v140;
*(_DWORD *)v134 = v139;
v141 = *((_DWORD *)v8 + 1);
*((_DWORD *)v8 + 1) = *((_DWORD *)v134 + 1);
*((_DWORD *)v134 + 1) = v141;
do
{
v139 = *((_DWORD *)v8 + 2);
v142 = *((_DWORD *)v8 + 3);
v8 += 8;
v167 = v142 == v122;
v143 = v142 < v122;
if ( v167 )
v143 = v139 > v123;
}
while ( !v143 );
do
{
v140 = *((_DWORD *)v134 - 2);
v144 = *((_DWORD *)v134 - 1);
v134 -= 8;
v167 = v144 == v122;
v145 = v144 < v122;
if ( v167 )
v145 = v140 > v123;
}
while ( v145 );
}
while ( v8 < v134 );
}
if ( v8 - 8 != v7 )
{
*(_DWORD *)v7 = *((_DWORD *)v8 - 2);
*((_DWORD *)v7 + 1) = *((_DWORD *)v8 - 1);
}
a4 = 0;
*((_DWORD *)v8 - 2) = v123;
*((_DWORD *)v8 - 1) = v122;
}
v97 = 0;
v98 = *(_DWORD *)v8;
v99 = *((_DWORD *)v8 + 1);
do
{
v101 = *(_DWORD *)&v8[v97 + 8];
v100 = *(_DWORD *)&v8[v97 + 12];
v102 = v101 < v98;
v167 = v100 == v99;
v103 = v100 > v99;
if ( !v167 )
v102 = v103;
v97 += 8;
}
while ( v102 );
v104 = &v8[v97];
v105 = a2;
if ( v97 == 8 )
{
v105 = a2;
do
{
if ( v104 >= v105 )
break;
v110 = *((_DWORD *)v105 - 2);
v111 = *((_DWORD *)v105 - 1);
v105 -= 8;
v112 = v110 < v98;
v167 = v111 == v99;
v113 = v111 > v99;
if ( !v167 )
v112 = v113;
}
while ( !v112 );
}
else
{
do
{
v106 = *((_DWORD *)v105 - 2);
v107 = *((_DWORD *)v105 - 1);
v105 -= 8;
v108 = v106 < v98;
v167 = v107 == v99;
v109 = v107 > v99;
if ( !v167 )
v108 = v109;
}
while ( !v108 );
}
if ( v104 >= v105 )
{
v8 = v104;
}
else
{
v114 = *(_DWORD *)v105;
v8 = v104;
v115 = v105;
do
{
*(_DWORD *)v8 = v114;
*(_DWORD *)v115 = v101;
v116 = *((_DWORD *)v8 + 1);
*((_DWORD *)v8 + 1) = *((_DWORD *)v115 + 1);
*((_DWORD *)v115 + 1) = v116;
do
{
v101 = *((_DWORD *)v8 + 2);
v117 = *((_DWORD *)v8 + 3);
v8 += 8;
v167 = v117 == v99;
v118 = v117 > v99;
if ( v167 )
v118 = v101 < v98;
}
while ( v118 );
do
{
v114 = *((_DWORD *)v115 - 2);
v119 = *((_DWORD *)v115 - 1);
v115 -= 8;
v167 = v119 == v99;
v120 = v119 > v99;
if ( v167 )
v120 = v114 < v98;
}
while ( !v120 );
}
while ( v8 < v115 );
}
if ( v8 - 8 != v7 )
{
*(_DWORD *)v7 = *((_DWORD *)v8 - 2);
*((_DWORD *)v7 + 1) = *((_DWORD *)v8 - 1);
}
*((_DWORD *)v8 - 2) = v98;
*((_DWORD *)v8 - 1) = v99;
if ( v104 >= v105 )
break;
LABEL_139:
result = sub_100340AE4(v7, v8 - 8, a3, a4 & 1);
a4 = 0;
}
v121 = sub_100341A98(v7, v8 - 8);
result = sub_100341A98(v8, a2);
if ( (_DWORD)result )
break;
if ( (v121 & 1) == 0 )
goto LABEL_139;
}
a2 = v8 - 8;
if ( (v121 & 1) == 0 )
continue;
return result;
}
}