//
// sub_10050B9EC from 0x10050b9ec to 0x10050baf0 (260 bytes)
//
// 1 xrefs:
// > sub_100508F40 @ 0x100508f88
//
// 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_10050B9EC(__int64 a1, unsigned int *a2, unsigned __int64 a3, unsigned __int64 a4)
{
__int64 v8; // x19
_QWORD *v9; // x8
unsigned int v10; // w9
_QWORD *v11; // x10
_QWORD *v12; // x8
unsigned int v13; // w10
__int64 v14; // x9
_QWORD *v15; // x10
_DWORD *v16; // x11
__int64 v17; // x20
v8 = *(_QWORD *)(a1 + 168);
if ( v8 )
sub_100442B5C(*(_QWORD *)(a1 + 168), 5u);
if ( !a2 )
{
v17 = 31;
if ( !v8 )
return v17;
goto LABEL_21;
}
v9 = (_QWORD *)(a1 + 568);
v10 = -1;
v11 = (_QWORD *)(a1 + 568);
do
{
v11 = (_QWORD *)*v11;
++v10;
}
while ( v11 != v9 );
if ( !(a3 | a4) )
{
v17 = 0;
*a2 = v10;
if ( !v8 )
return v17;
goto LABEL_21;
}
v12 = (_QWORD *)*v9;
v13 = *a2;
if ( v10 < *a2 )
{
*a2 = v10;
v13 = v10;
}
if ( v13 )
{
v14 = v13;
v15 = (_QWORD *)a3;
v16 = (_DWORD *)a4;
do
{
if ( a3 )
*v15 = v12[3];
if ( a4 )
*v16 = v12[2];
v12 = (_QWORD *)*v12;
++v16;
++v15;
--v14;
}
while ( v14 );
}
v17 = 0;
if ( v8 )
LABEL_21:
sub_100442B7C(v8, 5u);
return v17;
}