//
// png_crc_finish from 0xbdf0b0 to 0xbdf19c (236 bytes)
//
// 82 xrefs:
// > png_push_crc_finish @ 0xbcf068
// > png_push_read_IDAT @ 0xbd0080
// > png_read_end @ 0xbd5a4c
// > png_handle_IHDR @ 0xbdf1f4
// > png_handle_PLTE @ 0xbdf41c
// > png_handle_PLTE @ 0xbdf498
// > png_handle_PLTE @ 0xbdf4bc
// > png_handle_PLTE @ 0xbdf4f0
// > png_handle_IEND @ 0xbdf5b4
// > png_handle_gAMA @ 0xbdf620
// > png_handle_gAMA @ 0xbdf640
// > png_handle_gAMA @ 0xbdf670
// > png_handle_sBIT @ 0xbdf744
// > png_handle_sBIT @ 0xbdf7ec
// > png_handle_sBIT @ 0xbdf830
// > png_handle_sBIT @ 0xbdf848
// > png_handle_cHRM @ 0xbdf8f8
// > png_handle_cHRM @ 0xbdf930
// > png_handle_cHRM @ 0xbdf958
// > png_handle_sRGB @ 0xbdfb98
// > png_handle_sRGB @ 0xbdfbb8
// > png_handle_sRGB @ 0xbdfbe8
// > png_handle_iCCP @ 0xbdfcc8
// > png_handle_iCCP @ 0xbdfda4
// > png_handle_iCCP @ 0xbdfdd8
// > png_handle_iCCP @ 0xbdfe08
// > png_handle_iCCP @ 0xbe0088
// > png_handle_sPLT @ 0xbe0238
// > png_handle_sPLT @ 0xbe0384
// > png_handle_sPLT @ 0xbe03c0
// > png_handle_sPLT @ 0xbe0414
// > png_handle_tRNS @ 0xbe0524
// > png_handle_tRNS @ 0xbe05ac
// > png_handle_tRNS @ 0xbe05c8
// > png_handle_tRNS @ 0xbe067c
// > png_handle_tRNS @ 0xbe0694
// > png_handle_bKGD @ 0xbe0738
// > png_handle_bKGD @ 0xbe0764
// > png_handle_bKGD @ 0xbe07a8
// > png_handle_bKGD @ 0xbe07e4
// > png_handle_hIST @ 0xbe093c
// > png_handle_hIST @ 0xbe09d8
// > png_handle_hIST @ 0xbe09fc
// > png_handle_hIST @ 0xbe0a2c
// > png_handle_pHYs @ 0xbe0ab4
// > png_handle_pHYs @ 0xbe0af0
// > png_handle_pHYs @ 0xbe0b0c
// > png_handle_pHYs @ 0xbe0b38
// > png_handle_oFFs @ 0xbe0bf4
// > png_handle_oFFs @ 0xbe0c30
// > png_handle_oFFs @ 0xbe0c4c
// > png_handle_oFFs @ 0xbe0c7c
// > png_handle_pCAL @ 0xbe0d5c
// > png_handle_pCAL @ 0xbe0e7c
// > png_handle_pCAL @ 0xbe0e98
// > png_handle_pCAL @ 0xbe0f44
// > png_handle_sCAL @ 0xbe107c
// > png_handle_sCAL @ 0xbe10dc
// > png_handle_sCAL @ 0xbe1110
// > png_handle_sCAL @ 0xbe1140
// > png_handle_sCAL @ 0xbe11cc
// > png_handle_tIME @ 0xbe131c
// > png_handle_tIME @ 0xbe1360
// > png_handle_tIME @ 0xbe13bc
// > png_handle_tEXt @ 0xbe1464
// > png_handle_tEXt @ 0xbe1558
// > png_handle_tEXt @ 0xbe1564
// > png_handle_zTXt @ 0xbe1644
// > png_handle_zTXt @ 0xbe1730
// > png_handle_zTXt @ 0xbe174c
// > png_handle_zTXt @ 0xbe1758
// > png_handle_iTXt @ 0xbe1890
// > png_handle_iTXt @ 0xbe1998
// > png_handle_iTXt @ 0xbe1ad8
// > png_handle_iTXt @ 0xbe1ae4
// > png_handle_unknown @ 0xbe1bb0
// > png_handle_unknown @ 0xbe1c14
// > png_handle_unknown @ 0xbe1c9c
// > png_handle_unknown @ 0xbe1d2c
// > png_read_IDAT_data @ 0xbe2acc
// > png_read_finish_IDAT @ 0xbe2d50
// > ??> @ 0x38a90
//
// 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
//
bool __fastcall png_crc_finish(_DWORD *a1, unsigned int a2)
{
unsigned int v3; // w19
_BOOL8 result; // x0
unsigned __int64 v5; // x0
_BYTE v6[1024]; // [xsp+38h] [xbp+38h] BYREF
v3 = a2;
if ( a2 )
{
if ( a2 <= 0x3FF )
{
LABEL_5:
png_crc_read((__int64)a1, (__int64)v6, v3);
}
else
{
while ( 1 )
{
v3 -= 1024;
png_crc_read((__int64)a1, (__int64)v6, 0x400u);
if ( !v3 )
break;
if ( v3 <= 0x3FF )
goto LABEL_5;
}
}
}
result = png_crc_error(a1);
if ( result )
{
if ( (a1[148] & 0x20000000) != 0 )
v5 = (((unsigned int)a1[90] ^ 0x200uLL) >> 9) & 1;
else
v5 = ((unsigned __int64)(unsigned int)a1[90] >> 10) & 1;
if ( !(_DWORD)v5 )
png_chunk_error((__int64)a1, "CRC error");
png_chunk_warning((__int64)a1, "CRC error");
return 1;
}
return result;
}