//
// sub_1004BC378 from 0x1004bc378 to 0x1004bc448 (208 bytes)
//
// 1 xrefs:
// > sub_1004D0BEC @ 0x1004d0c38
//
// 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_1004BC378(_QWORD *a1, int a2, unsigned int a3, _DWORD *a4)
{
__int64 v4; // x8
_QWORD *v5; // x9
__int64 v6; // x10
__int64 v7; // x8
__int64 *v8; // x9
__int64 *v9; // x9
v4 = 31;
if ( (a3 & 0x80000000) == 0 && a4 )
{
v5 = a1 + 40;
while ( 1 )
{
v5 = (_QWORD *)*v5;
if ( v5 == a1 + 40 )
break;
v6 = v5[2];
if ( *(_DWORD *)(v6 + 20) == a2 )
{
v7 = *(_QWORD *)(v6 + 112);
if ( !v7 )
goto LABEL_19;
LABEL_17:
if ( *(_DWORD *)v7 > (signed int)a3 )
{
a2 = *(_DWORD *)(*(_QWORD *)(v7 + 8) + 4LL * a3);
goto LABEL_21;
}
return 31;
}
}
v8 = a1 + 80;
do
{
v8 = (__int64 *)*v8;
if ( v8 == a1 + 80 )
{
v9 = a1 + 47;
while ( 1 )
{
v9 = (__int64 *)*v9;
if ( v9 == a1 + 47 )
goto LABEL_19;
if ( *((_DWORD *)v9 + 36) == a2 )
{
v7 = v9[32];
if ( !v7 )
goto LABEL_19;
goto LABEL_17;
}
}
}
}
while ( *((_DWORD *)v8 + 48) != a2 );
v7 = v8[34];
if ( v7 )
goto LABEL_17;
LABEL_19:
if ( a3 )
return 31;
LABEL_21:
v4 = 0;
*a4 = a2;
}
return v4;
}