//
// sub_1008AD770 from 0x1008ad770 to 0x1008ad808 (152 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:37:19 +0000
//
__int64 __fastcall sub_1008AD770(__int64 a1, _BYTE *a2, unsigned __int64 a3)
{
unsigned __int64 v4; // r14
__int64 v5; // rcx
__int64 result; // rax
__int64 v7; // rcx
unsigned __int64 v8; // rax
if ( !a1 )
return 4294967194LL;
v4 = *(_QWORD *)(a1 + 112);
if ( v4 >= a3 )
v4 = a3;
v5 = sub_1001586E0(a1);
result = 0xFFFFFFFFLL;
if ( !v5 )
{
if ( v4 )
{
*a2 = 0;
v7 = (*(__int64 (__fastcall **)(_QWORD, _QWORD, _BYTE *, unsigned __int64))(a1 + 8))(
*(_QWORD *)(a1 + 56),
*(_QWORD *)(a1 + 96),
a2,
v4);
result = 0xFFFFFFFFLL;
if ( v7 != v4 )
return result;
}
else if ( !a2 )
{
return (unsigned int)v4;
}
v8 = *(_QWORD *)(a1 + 112);
if ( v8 < a3 )
a2[v8] = 0;
return (unsigned int)v4;
}
return result;
}