//
// sub_1005378B8 from 0x1005378b8 to 0x10053796c (180 bytes)
//
// 2 xrefs:
// > sub_1005327C8 @ 0x10053319c
// > sub_100533BC8 @ 0x100533fd4
//
// 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_1005378B8(__int64 a1, int a2, int a3, __int64 a4, __int64 a5, _DWORD *a6)
{
__int64 v6; // x8
unsigned __int16 **v7; // x9
unsigned __int16 **v8; // x8
unsigned __int16 *v9; // x9
__int64 v10; // x10
unsigned __int16 *i; // x8
unsigned __int16 v12; // w9
__int64 (*v14)(void); // x6
v6 = *(_QWORD *)(a1 + 256);
v7 = (unsigned __int16 **)(v6 + 704);
v8 = (unsigned __int16 **)(v6 + 688);
if ( a2 )
v8 = v7;
v9 = v8[1];
if ( !v9 )
return 1;
v10 = 0;
for ( i = *v8; *i != a3; i += 24 )
{
if ( ++v10 >= (unsigned __int64)v9 )
return 1;
}
if ( !i )
return 1;
v12 = i[1];
if ( (v12 & 2) == 0 && !a2 )
{
*a6 = 110;
return 0;
}
if ( (v12 & 1) == 0 )
{
i[1] = v12 | 1;
v14 = *((__int64 (**)(void))i + 4);
if ( v14 )
return v14();
return 1;
}
*a6 = 50;
return 0;
}