//
// sub_653280 from 0x653280 to 0x6532cc (76 bytes)
//
// 0 xrefs:
//
// 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
//
_DWORD *__fastcall sub_653280(_DWORD *result, void *a2, size_t a3)
{
int *v3; // r5
int v4; // r5
size_t v5; // r7
int v7; // r6
_BOOL4 v8; // r3
if ( result )
{
v3 = (int *)result[72];
if ( !v3 || (v4 = *v3) == 0 )
png_error((int)result, "invalid memory read");
v5 = *(_DWORD *)(v4 + 16);
v7 = *(_DWORD *)(v4 + 12);
v8 = v5 >= a3;
if ( !v7 )
v8 = 0;
if ( !v8 )
png_error((int)result, "read beyond end of data");
result = memcpy(a2, *(const void **)(v4 + 12), a3);
*(_DWORD *)(v4 + 12) = v7 + a3;
*(_DWORD *)(v4 + 16) = v5 - a3;
}
return result;
}