//
// png_handle_oFFs from 0xbe0ba4 to 0xbe0ce8 (324 bytes)
//
// 4 xrefs:
// > png_push_read_chunk @ 0xbcf8d0
// > png_read_info @ 0xbd3624
// > png_read_end @ 0xbd5b9c
// > ??> @ 0x69348
//
// 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 png_handle_oFFs(_DWORD *a1, __int64 a2, unsigned int a3)
{
int v5; // w1
_BYTE v7[16]; // [xsp+38h] [xbp+38h] BYREF
v5 = a1[89];
if ( (v5 & 1) == 0 )
png_chunk_error((__int64)a1, "missing IHDR");
if ( (v5 & 4) != 0 )
{
png_crc_finish(a1, a3);
png_chunk_benign_error((__int64)a1, "out of place");
}
else if ( a2 && (*(_DWORD *)(a2 + 8) & 0x100) != 0 )
{
png_crc_finish(a1, a3);
png_chunk_benign_error((__int64)a1, "duplicate");
}
else if ( a3 == 9 )
{
png_crc_read((__int64)a1, (__int64)v7, 9u);
if ( !png_crc_finish(a1, 0) )
png_set_oFFs(
a1,
a2,
(v7[1] << 16) + (v7[0] << 24) + v7[3] + (v7[2] << 8),
(v7[5] << 16) + (v7[4] << 24) + v7[7] + (v7[6] << 8),
v7[8]);
}
else
{
png_crc_finish(a1, a3);
png_chunk_benign_error((__int64)a1, "invalid");
}
return _stack_chk_guard;
}