//
// sub_1004C4520 from 0x1004c4520 to 0x1004c45b4 (148 bytes)
//
// 1 xrefs:
// > sub_1004C1EA0 @ 0x1004c210c
//
// 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_1004C4520(__int64 a1, __int64 a2, unsigned __int64 a3)
{
__int64 v5; // x0
__int64 result; // x0
void (__fastcall *v7)(_QWORD, __int64, _QWORD, __int64); // x8
int v8; // [xsp+Ch] [xbp-14h] BYREF
v5 = *(_QWORD *)(a1 + 96);
if ( !*(_QWORD *)(v5 + 368) && (*(_BYTE *)(v5 + 45) & 4) == 0 )
return 14;
*(_DWORD *)(a1 + 64) = a3;
result = sub_10045FB3C(v5, a2, a3, 2);
if ( !(_DWORD)result )
{
if ( !(unsigned int)sub_10045FE78(*(_QWORD *)(a1 + 96), &v8, 2) )
*(_DWORD *)(a1 + 64) = v8;
v7 = *(void (__fastcall **)(_QWORD, __int64, _QWORD, __int64))(a1 + 336);
if ( v7 )
v7(*(_QWORD *)(a1 + 344), a2, *(unsigned int *)(a1 + 64), 2);
return 0;
}
return result;
}