//
// sub_1004B26F4 from 0x1004b26f4 to 0x1004b2828 (308 bytes)
//
// 4 xrefs:
// > sub_10043FA1C @ 0x1004403b8
// > sub_10043FA1C @ 0x1004403d8
// > sub_10043FA1C @ 0x1004403f8
// > sub_1004C5748 @ 0x1004c575c
//
// 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_1004B26F4(_QWORD *a1, __int64 a2, int a3, __int64 a4)
{
_QWORD *v8; // x23
int v9; // w24
int v10; // w8
__int64 result; // x0
int v12; // w9
if ( a3 < 0 )
{
if ( !a2 )
{
v8 = a1;
while ( 1 )
{
v8 = (_QWORD *)*v8;
if ( v8 == a1 )
return 63;
if ( *((_BYTE *)v8 + 60) )
goto LABEL_28;
}
}
v8 = (_QWORD *)*a1;
if ( (_QWORD *)*a1 == a1 )
return 63;
while ( !*((_BYTE *)v8 + 60) || (unsigned int)sub_1004C6FC4(v8[4], a2) )
{
v8 = (_QWORD *)*v8;
if ( v8 == a1 )
return 63;
}
}
else
{
v8 = (_QWORD *)*a1;
if ( a2 )
{
if ( (_QWORD *)*a1 != a1 )
{
v9 = 0;
while ( 1 )
{
if ( !(unsigned int)sub_1004C6FC4(v8[4], a2) )
{
if ( v9 == a3 )
goto LABEL_28;
++v9;
}
v8 = (_QWORD *)*v8;
if ( v8 == a1 )
return 63;
}
}
return 63;
}
if ( (_QWORD *)*a1 == a1 )
return 63;
if ( a3 )
{
v10 = a3 + 1;
do
{
v8 = (_QWORD *)*v8;
if ( v8 == a1 )
return 63;
}
while ( --v10 >= 2 );
}
if ( !v8 )
return 63;
}
LABEL_28:
*(_QWORD *)a4 = v8[3];
*(_QWORD *)(a4 + 8) = v8[4];
*(_QWORD *)(a4 + 16) = v8[5];
v12 = *((unsigned __int8 *)v8 + 60);
*(_DWORD *)(a4 + 24) = *((_DWORD *)v8 + 14);
*(_DWORD *)(a4 + 28) = v12;
result = 0;
if ( v12 )
*((_BYTE *)v8 + 60) = 0;
return result;
}