//
// sub_1005F8DC8 from 0x1005f8dc8 to 0x1005f8e90 (200 bytes)
//
// 6 xrefs:
// > sub_1005F5BBC @ 0x1005f5c9c
// > sub_1005F623C @ 0x1005f644c
// > sub_1005F623C @ 0x1005f655c
// > sub_1005F6E94 @ 0x1005f73fc
// > sub_1005F6E94 @ 0x1005f7448
// > sub_1005F6E94 @ 0x1005f7720
//
// 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
//
_QWORD *__fastcall sub_1005F8DC8(_QWORD *a1, _QWORD *a2, int a3)
{
_QWORD *v4; // x20
int **v5; // x9
int *v6; // x0
__int64 v7; // x0
__int64 v8; // x8
__int64 v9; // x10
_QWORD *v10; // x9
if ( (*a2 & 0x300LL) == 0 )
return a2;
v4 = (_QWORD *)a2[4];
v5 = (int **)(*a1 + v4[1]);
if ( !v5 )
{
a2 = (_QWORD *)v4[6];
if ( a2 )
return a2;
goto LABEL_13;
}
v6 = *v5;
if ( (*a2 & 0x100) != 0 )
v7 = (int)sub_10058AE10((__int64)v6);
else
v7 = sub_1005F000C(v6);
v8 = v4[4];
if ( v8 < 1 )
{
LABEL_12:
a2 = (_QWORD *)v4[5];
if ( a2 )
return a2;
LABEL_13:
if ( a3 )
sub_1005E0E48(13, 110, 164, (__int64)"tasn_utl.c", 273);
return nullptr;
}
v9 = 0;
v10 = (_QWORD *)v4[3];
while ( *v10 != v7 )
{
++v9;
v10 += 6;
if ( v9 >= v8 )
goto LABEL_12;
}
return v10 + 1;
}