//
// sub_10095BE00 from 0x10095be00 to 0x10095c1af (943 bytes)
//
// 2 xrefs:
// > sub_10095BA70 @ 0x10095bc5a
// > sub_10095BA70 @ 0x10095bced
//
// 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:43 +0000
//
char **__fastcall sub_10095BE00(_QWORD *a1, __int64 a2, __int64 a3, unsigned __int64 a4)
{
__int64 v5; // r15
_DWORD *v6; // r13
__int64 v7; // rax
unsigned __int64 v8; // rdx
_QWORD *v9; // rbx
void **v10; // r12
void *v11; // rdi
__int64 v12; // rbx
__int64 v13; // r12
__int64 v14; // rbx
__int64 v15; // rax
_DWORD *v16; // r12
char **result; // rax
unsigned __int64 v18; // rax
_QWORD *v19; // rbx
__int64 v20; // r13
char *v21; // r12
__int64 v22; // rdi
__int64 v23; // rdi
unsigned __int64 v24; // [rsp+8h] [rbp-68h]
char *v25; // [rsp+38h] [rbp-38h] BYREF
_QWORD *v26; // [rsp+40h] [rbp-30h]
v5 = a2;
v6 = (_DWORD *)*a1;
v7 = a1[2];
v8 = 0xAAAAAAAAAAAAAAABLL * ((v7 - *a1) >> 5);
v26 = a1;
if ( v8 < a4 )
{
if ( !v6 )
goto LABEL_33;
v24 = a4;
v9 = v26;
v10 = (void **)v26[1];
v11 = v6;
if ( v10 == (void **)v6 )
{
LABEL_32:
v9[1] = v6;
operator delete(v11);
*(_OWORD *)v9 = 0;
v9[2] = 0;
v7 = 0;
a4 = v24;
LABEL_33:
if ( a4 > 0x2AAAAAAAAAAAAAALL )
goto LABEL_49;
v18 = 0xAAAAAAAAAAAAAAABLL * (v7 >> 5);
if ( 2 * v18 > a4 )
a4 = 2 * v18;
if ( v18 >= 0x155555555555555LL )
a4 = 0x2AAAAAAAAAAAAAALL;
v19 = v26;
if ( a4 > 0x2AAAAAAAAAAAAAALL )
LABEL_49:
sub_10066D100();
v20 = 96 * a4;
v21 = (char *)operator new(96 * a4);
*v26 = v21;
v19[1] = v21;
v19[2] = &v21[v20];
v25 = v21;
result = &v25;
if ( a2 == a3 )
{
v22 = (__int64)v21;
}
else
{
v22 = (__int64)v21;
do
{
result = (char **)sub_10066CDC0(v22, v5);
v5 += 96;
v22 = (__int64)(v25 + 96);
v25 += 96;
}
while ( v5 != a3 );
}
v19[1] = v22;
return result;
}
while ( 1 )
{
if ( (*(_BYTE *)(v10 - 3) & 1) != 0 )
{
operator delete(*(v10 - 1));
if ( (*(_BYTE *)(v10 - 8) & 1) == 0 )
{
LABEL_8:
if ( (*(_BYTE *)(v10 - 11) & 1) != 0 )
goto LABEL_12;
goto LABEL_5;
}
}
else if ( (*(_BYTE *)(v10 - 8) & 1) == 0 )
{
goto LABEL_8;
}
operator delete(*(v10 - 6));
if ( (*(_BYTE *)(v10 - 11) & 1) != 0 )
LABEL_12:
operator delete(*(v10 - 9));
LABEL_5:
v10 -= 12;
if ( v10 == (void **)v6 )
{
v9 = v26;
v11 = (void *)*v26;
goto LABEL_32;
}
}
}
v12 = a1[1];
if ( 0xAAAAAAAAAAAAAAABLL * ((v12 - (__int64)v6) >> 5) >= a4 )
{
v16 = v6;
if ( a2 != a3 )
{
do
{
*v6 = *(_DWORD *)v5;
std::string::operator=((std::string *)(v6 + 2), (const std::string *)(v5 + 8));
std::string::operator=((std::string *)(v6 + 8), (const std::string *)(v5 + 32));
*((_QWORD *)v6 + 7) = *(_QWORD *)(v5 + 56);
*((_BYTE *)v6 + 64) = *(_BYTE *)(v5 + 64);
std::string::operator=((std::string *)v6 + 3, (const std::string *)(v5 + 72));
v6 += 24;
v16 += 24;
v5 += 96;
}
while ( v5 != a3 );
v12 = v26[1];
}
while ( 1 )
{
if ( (_DWORD *)v12 == v6 )
{
result = (char **)v26;
v26[1] = v16;
return result;
}
if ( (*(_BYTE *)(v12 - 24) & 1) != 0 )
{
operator delete(*(void **)(v12 - 8));
if ( (*(_BYTE *)(v12 - 64) & 1) != 0 )
{
LABEL_28:
operator delete(*(void **)(v12 - 48));
if ( (*(_BYTE *)(v12 - 88) & 1) == 0 )
goto LABEL_21;
goto LABEL_29;
}
}
else if ( (*(_BYTE *)(v12 - 64) & 1) != 0 )
{
goto LABEL_28;
}
if ( (*(_BYTE *)(v12 - 88) & 1) == 0 )
goto LABEL_21;
LABEL_29:
operator delete(*(void **)(v12 - 72));
LABEL_21:
v12 -= 96;
}
}
v13 = a2 + a1[1] - (_QWORD)v6;
if ( (_DWORD *)v12 != v6 )
{
v14 = 0;
do
{
v6[v14] = *(_DWORD *)(a2 + v14 * 4);
std::string::operator=((std::string *)&v6[v14 + 2], (const std::string *)(a2 + v14 * 4 + 8));
std::string::operator=((std::string *)&v6[v14 + 8], (const std::string *)(a2 + v14 * 4 + 32));
*(_QWORD *)&v6[v14 + 14] = *(_QWORD *)(a2 + v14 * 4 + 56);
LOBYTE(v6[v14 + 16]) = *(_BYTE *)(a2 + v14 * 4 + 64);
std::string::operator=((std::string *)&v6[v14 + 18], (const std::string *)(a2 + v14 * 4 + 72));
v15 = a2 + v14 * 4 + 96;
v14 += 24;
}
while ( v15 != v13 );
v12 = v26[1];
}
v25 = (char *)v12;
v23 = v12;
if ( v13 != a3 )
{
v23 = v12;
do
{
sub_10066CDC0(v23, v13);
v13 += 96;
v23 = (__int64)(v25 + 96);
v25 += 96;
}
while ( v13 != a3 );
}
result = (char **)v26;
v26[1] = v23;
return result;
}