//
// sub_1005B9E30 from 0x1005b9e30 to 0x1005bb2d6 (5286 bytes)
//
// 2 xrefs:
// > EditorUI::findObject @ 0x1005b9921
// > sub_1005B9E30 @ 0x1005ba3a3
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:32:44 +0000
//
float *__fastcall sub_1005B9E30(float *a1, float *a2, __int64 a3, char a4)
{
float *v5; // r15
float *result; // rax
float *v7; // r13
__int64 v8; // rdx
unsigned __int64 v9; // rbx
float *v10; // r14
float *v11; // r12
__int64 v12; // rax
__int64 v13; // r12
float *v14; // r14
float *v15; // rax
float *v16; // r14
__int64 v17; // rbx
unsigned __int64 v18; // r15
float *v19; // rax
__int64 v20; // r12
float *v21; // rax
float *v22; // r13
float *v23; // rbx
bool v24; // zf
__int64 v25; // r12
float *v26; // rax
float *v27; // r15
__int64 v28; // rax
__int64 v29; // r12
float *v30; // rax
__int64 v31; // r12
float *v32; // rax
float *v33; // rax
__int64 v34; // r12
float *v35; // rax
float **v36; // r13
float **v37; // rcx
char v38; // r12
float *v39; // r13
__int64 v40; // r14
float *v41; // rax
float *v42; // rax
__int64 v43; // r12
float *v44; // rax
float *v45; // rax
float v46; // xmm0_4
__int64 v47; // r12
float *v48; // rax
float v49; // xmm0_4
float *v50; // rbx
__int64 v51; // r12
float *v52; // rax
__int64 v53; // rax
__int64 v54; // r12
float *v55; // rax
float *v56; // rax
__int64 v57; // r12
float *v58; // rax
__int64 v59; // r12
__int64 v60; // r14
float *v61; // rax
bool v62; // cl
__int64 v63; // rbx
float *v64; // r15
float *v65; // r13
__int64 v66; // r14
__int64 v67; // r12
float *v68; // rax
__int64 v69; // r14
__int64 v70; // r13
__int64 v71; // r12
float *v72; // rax
signed __int64 v73; // rcx
__int64 v75; // rbx
float *v76; // rax
__int64 v77; // r15
__int64 v78; // r12
__int64 v79; // r14
float *v80; // rax
float *v81; // rax
__int64 v82; // rax
float *v83; // rbx
__int64 v84; // r12
__int64 v85; // r14
float *v86; // rax
float *v87; // rax
float *v88; // rax
float *v89; // r14
__int64 v90; // rbx
float *v91; // rax
__int64 v92; // r13
__int64 v93; // r12
float *v94; // rax
__int64 v95; // rax
__int64 v96; // r12
float *v97; // rax
signed __int64 v99; // rcx
float *v100; // rsi
__int64 v101; // rax
float *v102; // r15
__int64 v103; // rbx
float *v104; // r13
__int64 v105; // r12
__int64 v106; // r14
float *v107; // rax
float *v108; // rax
float **v109; // rcx
__int64 v110; // r15
unsigned __int64 v111; // r15
__int64 v112; // r12
__int64 v113; // r14
float *v114; // rax
float *v115; // rax
__int64 v116; // rax
float *v117; // rcx
__int64 v118; // r14
float *v119; // rax
float *v120; // rbx
__int64 v121; // r12
float *v122; // rax
float *v123; // r14
__int64 v124; // r12
float *v125; // rax
float *v126; // r15
__int64 v127; // rax
float *v128; // r14
_QWORD *v129; // rbx
__int64 v130; // r12
float *v131; // rax
signed __int64 v132; // [rsp+10h] [rbp-70h]
float *v133; // [rsp+10h] [rbp-70h]
float *v134; // [rsp+18h] [rbp-68h]
__int64 v135; // [rsp+18h] [rbp-68h]
__int64 v136; // [rsp+18h] [rbp-68h]
__int64 v138; // [rsp+20h] [rbp-60h]
signed __int64 v139; // [rsp+20h] [rbp-60h]
float *v140; // [rsp+28h] [rbp-58h]
signed __int64 v141; // [rsp+28h] [rbp-58h]
__int64 v142; // [rsp+28h] [rbp-58h]
float *v143; // [rsp+30h] [rbp-50h]
float v145; // [rsp+38h] [rbp-48h]
float v146; // [rsp+38h] [rbp-48h]
float v147; // [rsp+38h] [rbp-48h]
float v148; // [rsp+38h] [rbp-48h]
float v149; // [rsp+38h] [rbp-48h]
float *v150; // [rsp+40h] [rbp-40h]
float v151; // [rsp+48h] [rbp-38h]
float v152; // [rsp+48h] [rbp-38h]
float v153; // [rsp+48h] [rbp-38h]
float v154; // [rsp+48h] [rbp-38h]
float v155; // [rsp+48h] [rbp-38h]
float v156; // [rsp+48h] [rbp-38h]
float v157; // [rsp+48h] [rbp-38h]
float v158; // [rsp+48h] [rbp-38h]
float v159; // [rsp+48h] [rbp-38h]
float v160; // [rsp+48h] [rbp-38h]
float v161; // [rsp+48h] [rbp-38h]
float v162; // [rsp+48h] [rbp-38h]
float v163; // [rsp+48h] [rbp-38h]
float v164; // [rsp+48h] [rbp-38h]
float v165; // [rsp+48h] [rbp-38h]
float v166; // [rsp+48h] [rbp-38h]
float v167; // [rsp+48h] [rbp-38h]
float v168; // [rsp+48h] [rbp-38h]
float v169; // [rsp+48h] [rbp-38h]
float v170; // [rsp+48h] [rbp-38h]
float v171; // [rsp+48h] [rbp-38h]
float v172; // [rsp+48h] [rbp-38h]
float v173; // [rsp+48h] [rbp-38h]
float v174; // [rsp+48h] [rbp-38h]
float v175; // [rsp+48h] [rbp-38h]
float v176; // [rsp+48h] [rbp-38h]
float v177; // [rsp+48h] [rbp-38h]
float v178; // [rsp+48h] [rbp-38h]
float v179; // [rsp+48h] [rbp-38h]
float v180; // [rsp+48h] [rbp-38h]
float v181; // [rsp+48h] [rbp-38h]
float v182; // [rsp+48h] [rbp-38h]
float v183; // [rsp+48h] [rbp-38h]
float v184; // [rsp+48h] [rbp-38h]
float v185; // [rsp+48h] [rbp-38h]
float v186; // [rsp+48h] [rbp-38h]
float v187; // [rsp+48h] [rbp-38h]
float v188; // [rsp+48h] [rbp-38h]
float v189; // [rsp+48h] [rbp-38h]
float v190; // [rsp+48h] [rbp-38h]
float *v191; // [rsp+48h] [rbp-38h]
float *v192; // [rsp+48h] [rbp-38h]
float *v193; // [rsp+48h] [rbp-38h]
float v194; // [rsp+48h] [rbp-38h]
float v195; // [rsp+48h] [rbp-38h]
float v196; // [rsp+48h] [rbp-38h]
float v197; // [rsp+48h] [rbp-38h]
float v198; // [rsp+48h] [rbp-38h]
float v199; // [rsp+48h] [rbp-38h]
float v200; // [rsp+48h] [rbp-38h]
float v201; // [rsp+48h] [rbp-38h]
float v202; // [rsp+48h] [rbp-38h]
float v203; // [rsp+48h] [rbp-38h]
float v204; // [rsp+48h] [rbp-38h]
float v205; // [rsp+48h] [rbp-38h]
float v206; // [rsp+54h] [rbp-2Ch]
float v207; // [rsp+54h] [rbp-2Ch]
float v208; // [rsp+54h] [rbp-2Ch]
float v209; // [rsp+54h] [rbp-2Ch]
float v210; // [rsp+54h] [rbp-2Ch]
float v211; // [rsp+54h] [rbp-2Ch]
float v212; // [rsp+54h] [rbp-2Ch]
float v213; // [rsp+54h] [rbp-2Ch]
float v214; // [rsp+54h] [rbp-2Ch]
float v215; // [rsp+54h] [rbp-2Ch]
float v216; // [rsp+54h] [rbp-2Ch]
float v217; // [rsp+54h] [rbp-2Ch]
float v218; // [rsp+54h] [rbp-2Ch]
float v219; // [rsp+54h] [rbp-2Ch]
float v220; // [rsp+54h] [rbp-2Ch]
float v221; // [rsp+54h] [rbp-2Ch]
float v222; // [rsp+54h] [rbp-2Ch]
float v223; // [rsp+54h] [rbp-2Ch]
float v224; // [rsp+54h] [rbp-2Ch]
float v225; // [rsp+54h] [rbp-2Ch]
float v226; // [rsp+54h] [rbp-2Ch]
float v227; // [rsp+54h] [rbp-2Ch]
float v228; // [rsp+54h] [rbp-2Ch]
float v229; // [rsp+54h] [rbp-2Ch]
float v230; // [rsp+54h] [rbp-2Ch]
float v231; // [rsp+54h] [rbp-2Ch]
float v232; // [rsp+54h] [rbp-2Ch]
float v233; // [rsp+54h] [rbp-2Ch]
float v234; // [rsp+54h] [rbp-2Ch]
float v235; // [rsp+54h] [rbp-2Ch]
float v236; // [rsp+54h] [rbp-2Ch]
v143 = a2;
LABEL_2:
v5 = v143;
v140 = v143 - 2;
result = v143 - 6;
while ( 2 )
{
v7 = a1;
v8 = ((char *)v5 - (char *)a1) >> 3;
switch ( v8 )
{
case 0LL:
case 1LL:
return result;
case 2LL:
v59 = *((_QWORD *)v143 - 1);
v60 = *(_QWORD *)a1;
v183 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v59 + 192LL))(v59);
v218 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v60 + 192LL))(v60);
v61 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v59 + 192LL))(v59);
if ( v183 != v218 )
{
v184 = *v61;
result = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v60 + 192LL))(v60);
if ( *result <= v184 )
return result;
goto LABEL_176;
}
v205 = v61[1];
result = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v60 + 192LL))(v60) + 4);
if ( *result > v205 )
{
LABEL_176:
result = *(float **)v7;
*(_QWORD *)v7 = *((_QWORD *)v143 - 1);
*((_QWORD *)v143 - 1) = result;
return result;
}
return result;
case 3LL:
return (float *)sub_1005BB2F0(a1, a1 + 2, v140);
case 4LL:
return (float *)sub_1005BB610(a1, a1 + 2, a1 + 4, v140);
case 5LL:
return (float *)sub_1005BB830(a1, a1 + 2, a1 + 4, a1 + 6, v140);
default:
v150 = a1;
if ( v8 <= 23 )
{
result = a1 + 2;
v62 = a1 == v5 || a1 + 2 == v5;
if ( (a4 & 1) != 0 )
{
if ( v62 )
return result;
v63 = 8;
v64 = a1;
while ( 1 )
{
v66 = *(_QWORD *)v64;
v67 = *((_QWORD *)v64 + 1);
v64 = result;
v185 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 192LL))(v67);
v219 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v66 + 192LL))(v66);
v68 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 192LL))(v67);
if ( v185 == v219 )
{
v187 = v68[1];
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v66 + 192LL))(v66) + 4) > v187 )
{
LABEL_100:
v69 = *(_QWORD *)v64;
v70 = v63;
do
{
while ( 1 )
{
*(_QWORD *)((char *)v150 + v70) = *(_QWORD *)((char *)v150 + v70 - 8);
if ( v70 == 8 )
{
v65 = v150;
goto LABEL_94;
}
v71 = *(_QWORD *)((char *)v150 + v70 - 16);
v189 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v69 + 192LL))(v69);
v220 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v71 + 192LL))(v71);
v72 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v69 + 192LL))(v69);
if ( v189 != v220 )
break;
v188 = v72[1];
v70 -= 8;
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v71 + 192LL))(v71) + 4) <= v188 )
goto LABEL_105;
}
v190 = *v72;
v70 -= 8;
}
while ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v71 + 192LL))(v71) > v190 );
LABEL_105:
v65 = (float *)((char *)v150 + v70);
LABEL_94:
*(_QWORD *)v65 = v69;
}
}
else
{
v186 = *v68;
if ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v66 + 192LL))(v66) > v186 )
goto LABEL_100;
}
result = v64 + 2;
v63 += 8;
if ( v64 + 2 == v143 )
return result;
}
}
if ( v62 )
return result;
while ( 1 )
{
v123 = *(float **)v7;
v124 = *((_QWORD *)v7 + 1);
v7 = result;
v199 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v124 + 192LL))(v124);
v235 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v123 + 192LL))(v123);
v125 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v124 + 192LL))(v124);
if ( v199 == v235 )
{
v201 = v125[1];
v127 = (*(__int64 (__fastcall **)(float *))(*(_QWORD *)v123 + 192LL))(v123);
v126 = v143;
if ( *(float *)(v127 + 4) > v201 )
{
LABEL_170:
v128 = *(float **)v7;
v129 = v7;
do
{
while ( 1 )
{
v130 = *(v129 - 2);
*v129 = *(v129 - 1);
v203 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v128 + 192LL))(v128);
v236 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v130 + 192LL))(v130);
v131 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v128 + 192LL))(v128);
if ( v203 != v236 )
break;
v202 = v131[1];
--v129;
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v130 + 192LL))(v130) + 4) <= v202 )
goto LABEL_163;
}
v204 = *v131;
--v129;
}
while ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v130 + 192LL))(v130) > v204 );
LABEL_163:
*v129 = v128;
}
}
else
{
v200 = *v125;
v126 = v143;
if ( *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v123 + 192LL))(v123) > v200 )
goto LABEL_170;
}
result = v7 + 2;
if ( v7 + 2 == v126 )
return result;
}
}
if ( a3 )
{
v9 = (unsigned __int64)v8 >> 1;
v10 = &a1[2 * ((unsigned __int64)v8 >> 1)];
if ( (unsigned __int64)v8 < 0x81 )
{
a2 = v7;
sub_1005BB2F0(&v7[2 * ((unsigned __int64)v8 >> 1)], v7, v140);
--a3;
if ( (a4 & 1) != 0 )
goto LABEL_12;
}
else
{
sub_1005BB2F0(v7, &v7[2 * ((unsigned __int64)v8 >> 1)], v140);
v11 = &v7[2 * v9 - 2];
sub_1005BB2F0(v7 + 2, v11, v143 - 4);
sub_1005BB2F0(v7 + 4, &v150[2 * v9 + 2], v143 - 6);
a2 = v10;
v7 = v150;
sub_1005BB2F0(v11, v10, &v150[2 * v9 + 2]);
v12 = *(_QWORD *)v150;
*(_QWORD *)v150 = *(_QWORD *)&v150[2 * v9];
*(_QWORD *)&v150[2 * v9] = v12;
--a3;
if ( (a4 & 1) != 0 )
goto LABEL_12;
}
v13 = *((_QWORD *)v7 - 1);
v14 = *(float **)v7;
v151 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
v206 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v14 + 192LL))(v14);
v15 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
if ( v151 != v206 )
{
v152 = *v15;
if ( *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v14 + 192LL))(v14) > v152 )
goto LABEL_12;
LABEL_48:
v39 = *(float **)v7;
v40 = *(_QWORD *)v140;
v167 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v212 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 192LL))(v40);
v41 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v167 == v212 )
{
v171 = v41[1];
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 192LL))(v40) + 4) > v171 )
{
LABEL_50:
a1 = v150;
do
{
v43 = *((_QWORD *)a1 + 1);
v170 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v213 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v43 + 192LL))(v43);
v44 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v170 == v213 )
{
v169 = v44[1];
v42 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v43 + 192LL))(v43) + 4);
}
else
{
v169 = *v44;
v42 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v43 + 192LL))(v43);
}
a1 += 2;
}
while ( *v42 <= v169 );
goto LABEL_61;
}
}
else
{
v168 = *v41;
if ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 192LL))(v40) > v168 )
goto LABEL_50;
}
v45 = v150 + 2;
while ( 1 )
{
a1 = v45;
if ( v45 >= v5 )
break;
v47 = *(_QWORD *)v45;
v173 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v214 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 192LL))(v47);
v48 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v173 == v214 )
{
v172 = v48[1];
v46 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 192LL))(v47) + 4);
v45 = a1 + 2;
if ( v46 > v172 )
break;
}
else
{
v174 = *v48;
v49 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 192LL))(v47);
v45 = a1 + 2;
if ( v49 > v174 )
break;
}
}
LABEL_61:
v50 = v5;
if ( a1 < v5 )
{
v50 = v5;
do
{
while ( 1 )
{
v51 = *((_QWORD *)v50 - 1);
v176 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v215 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v51 + 192LL))(v51);
v52 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v176 != v215 )
break;
v175 = v52[1];
v50 -= 2;
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v51 + 192LL))(v51) + 4) <= v175 )
goto LABEL_66;
}
v177 = *v52;
v50 -= 2;
}
while ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v51 + 192LL))(v51) > v177 );
}
LABEL_66:
while ( a1 < v50 )
{
v53 = *(_QWORD *)a1;
*(_QWORD *)a1 = *(_QWORD *)v50;
*(_QWORD *)v50 = v53;
do
{
while ( 1 )
{
v54 = *((_QWORD *)a1 + 1);
v179 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v216 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v54 + 192LL))(v54);
v55 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v179 != v216 )
break;
v178 = v55[1];
a1 += 2;
if ( *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v54 + 192LL))(v54) + 4) > v178 )
goto LABEL_73;
}
v180 = *v55;
a1 += 2;
}
while ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v54 + 192LL))(v54) <= v180 );
do
{
LABEL_73:
v57 = *((_QWORD *)v50 - 1);
v182 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
v217 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 192LL))(v57);
v58 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v39 + 192LL))(v39);
if ( v182 == v217 )
{
v181 = v58[1];
v56 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 192LL))(v57) + 4);
}
else
{
v181 = *v58;
v56 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 192LL))(v57);
}
v50 -= 2;
}
while ( *v56 > v181 );
}
result = a1 - 2;
if ( a1 - 2 != v150 )
*(_QWORD *)v150 = *(_QWORD *)result;
*(_QWORD *)result = v39;
continue;
}
v166 = v15[1];
if ( *(float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v14 + 192LL))(v14) + 4) <= v166 )
goto LABEL_48;
LABEL_12:
v16 = *(float **)v7;
v17 = 2;
v18 = 0;
do
{
v20 = *(_QWORD *)&v7[v17];
v154 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20);
v207 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
v21 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20);
if ( v154 == v207 )
{
v153 = v21[1];
v19 = (float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) + 4);
}
else
{
v153 = *v21;
v19 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
}
v18 -= 8LL;
v17 += 2;
}
while ( *v19 > v153 );
v22 = &v7[v18 / 0xFFFFFFFFFFFFFFFCLL];
v23 = v143;
v24 = v18 == -8;
v5 = v143;
if ( v24 )
{
v23 = v143;
do
{
if ( v22 >= v23 )
break;
v34 = *((_QWORD *)v23 - 1);
v165 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v34 + 192LL))(v34);
v211 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
v35 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v34 + 192LL))(v34);
if ( v165 == v211 )
{
v164 = v35[1];
v33 = (float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) + 4);
}
else
{
v164 = *v35;
v33 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
}
v23 -= 2;
}
while ( *v33 <= v164 );
}
else
{
do
{
while ( 1 )
{
v25 = *((_QWORD *)v23 - 1);
v156 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 192LL))(v25);
v208 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
v26 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 192LL))(v25);
if ( v156 != v208 )
break;
v155 = v26[1];
v23 -= 2;
if ( *(float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) + 4) > v155 )
goto LABEL_22;
}
v157 = *v26;
v23 -= 2;
}
while ( *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) <= v157 );
}
LABEL_22:
v134 = v22;
if ( v22 >= v23 )
{
v36 = (float **)(v22 - 2);
v37 = (float **)v150;
if ( v36 != (float **)v150 )
goto LABEL_42;
}
else
{
v27 = v23;
do
{
v28 = *(_QWORD *)v22;
*(_QWORD *)v22 = *(_QWORD *)v27;
*(_QWORD *)v27 = v28;
do
{
while ( 1 )
{
v29 = *((_QWORD *)v22 + 1);
v159 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 192LL))(v29);
v209 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
v30 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 192LL))(v29);
if ( v159 != v209 )
break;
v158 = v30[1];
v22 += 2;
if ( *(float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) + 4) <= v158 )
goto LABEL_31;
}
v160 = *v30;
v22 += 2;
}
while ( *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) > v160 );
do
{
LABEL_31:
while ( 1 )
{
v31 = *((_QWORD *)v27 - 1);
v162 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v31 + 192LL))(v31);
v210 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16);
v32 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v31 + 192LL))(v31);
if ( v162 != v210 )
break;
v161 = v32[1];
v27 -= 2;
if ( *(float *)((*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) + 4) > v161 )
goto LABEL_24;
}
v163 = *v32;
v27 -= 2;
}
while ( *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 192LL))(v16) <= v163 );
LABEL_24:
;
}
while ( v22 < v27 );
v36 = (float **)(v22 - 2);
v5 = v143;
v37 = (float **)v150;
if ( v36 != (float **)v150 )
LABEL_42:
*v37 = *v36;
}
*v36 = v16;
if ( v134 < v23 )
goto LABEL_46;
v38 = sub_1005BBB00(v150, v36);
a1 = (float *)(v36 + 1);
a2 = v5;
result = (float *)sub_1005BBB00(v36 + 1, v5);
if ( !(_BYTE)result )
{
if ( v38 )
continue;
LABEL_46:
a2 = (float *)v36;
result = (float *)sub_1005B9E30(v150, v36, a3, a4 & 1);
a4 = 0;
a1 = (float *)(v36 + 1);
continue;
}
v143 = (float *)v36;
a1 = v150;
if ( v38 )
return result;
goto LABEL_2;
}
if ( a1 != v5 )
{
v141 = (unsigned __int64)(v8 - 2) >> 1;
v73 = v141;
v135 = ((char *)v5 - (char *)a1) >> 3;
while ( v141 < v73 )
{
LABEL_109:
if ( v73-- == 0 )
{
while ( 1 )
{
v133 = *(float **)v7;
v99 = (unsigned __int64)(v8 - 2) >> 1;
v100 = v7;
v101 = 0;
v136 = v8;
v139 = v99;
do
{
v102 = v100;
v100 += 2 * v101 + 2;
v103 = 2 * v101 + 1;
if ( 2 * v101 + 2 < v8 )
{
v142 = 2 * v101 + 2;
v104 = &v102[2 * v101];
v105 = *((_QWORD *)v104 + 1);
v106 = *((_QWORD *)v104 + 2);
v231 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v105 + 192LL))(v105);
v149 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v106 + 192LL))(v106);
v107 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v105 + 192LL))(v105);
if ( v231 == v149 )
{
v232 = v107[1];
v108 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v106 + 192LL))(v106) + 4);
}
else
{
v232 = *v107;
v108 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v106 + 192LL))(v106);
}
v99 = v139;
v8 = v136;
if ( *v108 > v232 )
{
v100 = v104 + 4;
v103 = v142;
}
}
*(_QWORD *)v102 = *(_QWORD *)v100;
v101 = v103;
}
while ( v103 <= v99 );
v109 = (float **)(v143 - 2);
v24 = v100 == v143 - 2;
v143 -= 2;
if ( v24 )
{
*(_QWORD *)v100 = v133;
v7 = v150;
}
else
{
*(_QWORD *)v100 = *v109;
*v109 = v133;
v7 = v150;
v110 = ((char *)v100 - (char *)v150 + 8) >> 3;
if ( v110 >= 2 )
{
v111 = (unsigned __int64)(v110 - 2) >> 1;
v112 = *(_QWORD *)&v150[2 * v111];
v113 = *(_QWORD *)v100;
v194 = *(float *)(*(__int64 (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)v112 + 192LL))(
v112,
v100,
v8);
v233 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v113 + 192LL))(v113);
v114 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v112 + 192LL))(v112);
if ( v194 == v233 )
{
v196 = v114[1];
v116 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v113 + 192LL))(v113);
v8 = v136;
if ( *(float *)(v116 + 4) > v196 )
{
LABEL_154:
v117 = &v150[2 * v111];
v118 = *(_QWORD *)v100;
do
{
v120 = v117;
*(_QWORD *)v100 = *(_QWORD *)v117;
if ( !v111 )
break;
v111 = (v111 - 1) >> 1;
v121 = *(_QWORD *)&v150[2 * v111];
v198 = *(float *)(*(__int64 (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)v121 + 192LL))(
v121,
v100,
v8);
v234 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v118 + 192LL))(v118);
v122 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v121 + 192LL))(v121);
if ( v198 == v234 )
{
v197 = v122[1];
v119 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v118 + 192LL))(v118) + 4);
}
else
{
v197 = *v122;
v119 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v118 + 192LL))(v118);
}
v117 = &v150[2 * v111];
v100 = v120;
}
while ( *v119 > v197 );
*(_QWORD *)v120 = v118;
v8 = v136;
}
}
else
{
v195 = *v114;
v115 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v113 + 192LL))(v113);
v8 = v136;
if ( *v115 > v195 )
goto LABEL_154;
}
}
}
result = (float *)(v8 - 1);
if ( v8-- <= 2 )
return result;
}
}
}
v75 = 2 * v73 + 1;
v76 = &v7[4 * v73 + 2];
v77 = 2 * v73 + 2;
v132 = v73;
if ( v77 >= v8 )
{
v77 = 2 * v73 + 1;
goto LABEL_119;
}
v78 = *(_QWORD *)v76;
v191 = &v7[4 * v73 + 2];
v79 = *((_QWORD *)v76 + 1);
v221 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v78 + 192LL))(v78);
v145 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v79 + 192LL))(v79);
v80 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v78 + 192LL))(v78);
if ( v221 == v145 )
{
v223 = v80[1];
v82 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v79 + 192LL))(v79);
v73 = v132;
if ( *(float *)(v82 + 4) <= v223 )
goto LABEL_118;
}
else
{
v222 = *v80;
v81 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v79 + 192LL))(v79);
v73 = v132;
if ( *v81 <= v222 )
{
LABEL_118:
v77 = v75;
v76 = v191;
LABEL_119:
v83 = &v7[2 * v73];
v192 = v76;
v84 = *(_QWORD *)v76;
v85 = *(_QWORD *)v83;
v224 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)v76 + 192LL))(*(_QWORD *)v76);
v146 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v85 + 192LL))(v85);
v86 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v84 + 192LL))(v84);
if ( v224 == v146 )
{
v225 = v86[1];
v87 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v85 + 192LL))(v85) + 4);
}
else
{
v225 = *v86;
v87 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v85 + 192LL))(v85);
}
v8 = v135;
v73 = v132;
if ( *v87 <= v225 )
{
v138 = *(_QWORD *)v83;
while ( 1 )
{
v89 = v192;
*(_QWORD *)v83 = *(_QWORD *)v192;
if ( v141 < v77 )
{
LABEL_108:
*(_QWORD *)v89 = v138;
v73 = v132;
goto LABEL_109;
}
v90 = 2 * v77 + 1;
v91 = &v7[4 * v77 + 2];
v77 = 2 * v77 + 2;
if ( v77 >= v8 )
{
v77 = v90;
}
else
{
v92 = *(_QWORD *)v91;
v193 = v91;
v93 = *((_QWORD *)v91 + 1);
v227 = *(float *)(*(__int64 (__fastcall **)(__int64, float *, __int64, signed __int64))(*(_QWORD *)v92 + 192LL))(
v92,
a2,
v8,
v73);
v147 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v93 + 192LL))(v93);
v94 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v92 + 192LL))(v92);
if ( v227 == v147 )
{
v229 = v94[1];
v95 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v93 + 192LL))(v93);
v7 = v150;
if ( *(float *)(v95 + 4) <= v229 )
{
LABEL_134:
v77 = v90;
v91 = v193;
goto LABEL_135;
}
}
else
{
v228 = *v94;
v7 = v150;
if ( *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v93 + 192LL))(v93) <= v228 )
goto LABEL_134;
}
v91 = v193 + 2;
}
LABEL_135:
v192 = v91;
v96 = *(_QWORD *)v91;
v230 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)v91 + 192LL))(*(_QWORD *)v91);
v148 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v138 + 192LL))(v138);
v97 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v96 + 192LL))(v96);
if ( v230 == v148 )
{
v226 = v97[1];
v88 = (float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v138 + 192LL))(v138) + 4);
}
else
{
v226 = *v97;
v88 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v138 + 192LL))(v138);
}
v8 = v135;
v83 = v89;
if ( *v88 > v226 )
goto LABEL_108;
}
}
goto LABEL_109;
}
}
v76 = v191 + 2;
goto LABEL_119;
}
return result;
}
}
}