//
// png_read_sig from 0xbded08 to 0xbdedec (228 bytes)
//
// 2 xrefs:
// > png_read_info @ 0xbd334c
// > ??> @ 0x347a0
//
// 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_read_sig(__int64 result, __int64 a2)
{
unsigned int v2; // w20
__int64 v3; // x21
__int64 v4; // x19
v2 = *(unsigned __int8 *)(result + 693);
if ( v2 <= 7 )
{
v3 = result;
*(_DWORD *)(result + 1252) = 17;
v4 = a2 + 44;
png_read_data(result);
*(_BYTE *)(v3 + 693) = 8;
result = png_sig_cmp(v4, (unsigned __int8)v2, 8LL - (unsigned __int8)v2);
if ( (_DWORD)result )
{
if ( v2 <= 3 )
{
if ( (unsigned int)png_sig_cmp(v4, (unsigned __int8)v2, 4LL - (unsigned __int8)v2) )
png_error(v3, "Not a PNG file");
}
png_error(v3, "PNG file corrupted by ASCII conversion");
}
if ( v2 <= 2 )
{
result = *(_DWORD *)(v3 + 356) | 0x1000u;
*(_DWORD *)(v3 + 356) = result;
}
}
return result;
}