//
// sub_100910800 from 0x100910800 to 0x100910bbb (955 bytes)
//
// 1 xrefs:
// > sub_10090E510 @ 0x10090e8dd
//
// 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:38:09 +0000
//
void __fastcall sub_100910800(__int64 a1, __int64 a2, __int64 a3, int *a4)
{
signed __int64 v4; // r8
__int64 v5; // r9
__int64 v6; // rbx
int *v7; // rsi
__int64 v8; // r9
__int64 v9; // r13
int v10; // edx
int v11; // ebx
bool v12; // cc
unsigned int v13; // r14d
unsigned int v14; // r15d
size_t v15; // r15
const void *v16; // rdi
size_t v17; // r14
int *v18; // r12
const void *v19; // rsi
size_t v20; // rdx
int v21; // eax
bool v22; // dl
unsigned int v23; // r14d
unsigned int v24; // r15d
size_t v25; // r15
const void *v26; // rdi
__int64 v27; // r13
size_t v28; // r14
int *v29; // r12
const void *v30; // rsi
size_t v31; // rdx
int v32; // eax
bool v33; // dl
bool v34; // zf
int *v35; // r10
int *v36; // r15
int v37; // ebx
size_t v38; // r13
char *v39; // rsi
size_t v40; // rdx
int v41; // eax
bool v42; // cl
__int64 v43; // rbx
int v44; // ecx
unsigned int v45; // r14d
size_t v46; // r14
const void *v47; // rdi
unsigned int v48; // r12d
__int64 v49; // r13
size_t v50; // r12
const void *v51; // rsi
size_t v52; // rdx
int v53; // eax
bool v54; // dl
int v55; // r14d
unsigned int v56; // r12d
size_t v57; // r12
const void *v58; // rdi
__int64 v59; // [rsp-80h] [rbp-80h]
int v60; // [rsp-78h] [rbp-78h]
__int128 v61; // [rsp-70h] [rbp-70h] BYREF
char *v62; // [rsp-60h] [rbp-60h]
__int64 v63; // [rsp-58h] [rbp-58h]
unsigned __int64 v64; // [rsp-50h] [rbp-50h]
int *v65; // [rsp-48h] [rbp-48h]
int *v66; // [rsp-40h] [rbp-40h]
__int64 v67; // [rsp-38h] [rbp-38h]
if ( a3 < 2 )
return;
v4 = (unsigned __int64)(a3 - 2) >> 1;
if ( v4 < ((__int64)a4 - a1) >> 5 )
return;
v5 = ((__int64)a4 - a1) >> 4;
v6 = v5 + 1;
v7 = (int *)(a1 + 32 * (v5 + 1));
v8 = v5 + 2;
v63 = a1;
v64 = (unsigned __int64)(a3 - 2) >> 1;
if ( v8 >= a3 )
{
v8 = v6;
v11 = *a4;
v12 = *v7 <= *a4;
if ( *v7 < *a4 )
return;
}
else
{
v9 = a3;
v10 = v7[8];
if ( *v7 < v10 )
goto LABEL_5;
if ( *v7 > v10 )
goto LABEL_20;
v13 = *((unsigned __int8 *)v7 + 40);
v14 = *((unsigned __int8 *)v7 + 8);
if ( (v14 & 1) != 0 )
{
v15 = *((_QWORD *)v7 + 2);
v16 = *((const void **)v7 + 3);
}
else
{
v15 = v14 >> 1;
v16 = (char *)v7 + 9;
}
v66 = a4;
v67 = v8;
if ( (v13 & 1) != 0 )
{
v17 = *((_QWORD *)v7 + 6);
v18 = v7;
v19 = *((const void **)v7 + 7);
}
else
{
v17 = v13 >> 1;
v18 = v7;
v19 = (char *)v7 + 41;
}
v20 = v15;
if ( v17 < v15 )
v20 = v17;
v21 = memcmp(v16, v19, v20);
v22 = v21 < 0;
if ( !v21 )
v22 = v15 < v17;
a4 = v66;
a1 = v63;
v7 = v18;
v4 = v64;
v8 = v67;
if ( v22 )
LABEL_5:
v7 += 8;
else
LABEL_20:
v8 = v6;
a3 = v9;
v11 = *a4;
v12 = *v7 <= *a4;
if ( *v7 < *a4 )
return;
}
if ( !v12 )
goto LABEL_34;
v23 = *((unsigned __int8 *)a4 + 8);
v24 = *((unsigned __int8 *)v7 + 8);
if ( (v24 & 1) != 0 )
{
v25 = *((_QWORD *)v7 + 2);
v26 = *((const void **)v7 + 3);
}
else
{
v25 = v24 >> 1;
v26 = (char *)v7 + 9;
}
v65 = v7;
v67 = v8;
v27 = a3;
if ( (v23 & 1) != 0 )
{
v28 = *((_QWORD *)a4 + 2);
v29 = a4;
v30 = *((const void **)a4 + 3);
}
else
{
v28 = v23 >> 1;
v29 = a4;
v30 = (char *)a4 + 9;
}
v31 = v25;
if ( v28 < v25 )
v31 = v28;
v32 = memcmp(v26, v30, v31);
v33 = v32 < 0;
if ( !v32 )
v33 = v25 < v28;
v34 = !v33;
a4 = v29;
a3 = v27;
a1 = v63;
v7 = v65;
v4 = v64;
v8 = v67;
if ( v34 )
{
LABEL_34:
v60 = v11;
v61 = *(_OWORD *)(a4 + 2);
v62 = *((char **)a4 + 3);
*(_OWORD *)(a4 + 2) = 0;
*((_QWORD *)a4 + 3) = 0;
*a4 = *v7;
v35 = v7 + 2;
*(_OWORD *)(a4 + 2) = *(_OWORD *)(v7 + 2);
*((_QWORD *)a4 + 3) = *((_QWORD *)v7 + 3);
*((_WORD *)v7 + 4) = 0;
if ( v4 >= v8 )
{
v59 = a3;
while ( 1 )
{
v43 = 2 * v8 + 1;
v36 = (int *)(a1 + 32 * v43);
v8 = 2 * v8 + 2;
if ( v8 >= a3 )
goto LABEL_62;
v44 = v36[8];
if ( *v36 < v44 )
goto LABEL_49;
if ( *v36 > v44 )
goto LABEL_62;
v45 = *((unsigned __int8 *)v36 + 8);
if ( (v45 & 1) != 0 )
{
v46 = *((_QWORD *)v36 + 2);
v47 = *((const void **)v36 + 3);
}
else
{
v46 = v45 >> 1;
v47 = (char *)v36 + 9;
}
v48 = *((unsigned __int8 *)v36 + 40);
v65 = v7;
v67 = v8;
v66 = v35;
v49 = a3;
if ( (v48 & 1) != 0 )
{
v50 = *((_QWORD *)v36 + 6);
v51 = *((const void **)v36 + 7);
}
else
{
v50 = v48 >> 1;
v51 = (char *)v36 + 41;
}
v52 = v46;
if ( v50 < v46 )
v52 = v50;
v53 = memcmp(v47, v51, v52);
v54 = v53 < 0;
if ( !v53 )
v54 = v46 < v50;
v34 = v54;
a3 = v49;
a1 = v63;
v7 = v65;
v4 = v64;
v8 = v67;
v35 = v66;
if ( v34 )
LABEL_49:
v36 += 8;
else
LABEL_62:
v8 = v43;
v55 = *v36;
v37 = v60;
if ( *v36 < v60 )
break;
if ( v55 <= v60 )
{
v56 = *((unsigned __int8 *)v36 + 8);
if ( (v56 & 1) != 0 )
{
v57 = *((_QWORD *)v36 + 2);
v58 = *((const void **)v36 + 3);
}
else
{
v57 = v56 >> 1;
v58 = (char *)v36 + 9;
}
v65 = v7;
v67 = v8;
v66 = v35;
if ( (v61 & 1) != 0 )
{
v38 = *((_QWORD *)&v61 + 1);
v39 = v62;
}
else
{
v38 = (unsigned __int8)v61 >> 1;
v39 = (char *)&v61 + 1;
}
v40 = v57;
if ( v38 < v57 )
v40 = v38;
v41 = memcmp(v58, v39, v40);
v42 = v57 < v38;
if ( v41 )
v42 = v41 < 0;
a3 = v59;
a1 = v63;
v7 = v65;
v4 = v64;
v8 = v67;
v35 = v66;
if ( v42 )
break;
}
*v7 = v55;
v35 = v36 + 2;
*(_OWORD *)(v7 + 2) = *(_OWORD *)(v36 + 2);
*((_QWORD *)v7 + 3) = *((_QWORD *)v36 + 3);
*((_WORD *)v36 + 4) = 0;
v7 = v36;
if ( v4 < v8 )
goto LABEL_36;
}
}
else
{
v36 = v7;
LABEL_36:
v37 = v60;
v7 = v36;
}
*v7 = v37;
*((_QWORD *)v35 + 2) = v62;
*(_OWORD *)v35 = v61;
}
}