//
// png_calculate_crc from 0xe3b8b8 to 0xe3b960 (168 bytes)
//
// 37 xrefs:
// > png_push_crc_finish @ 0xe45264
// > png_push_crc_finish @ 0xe452bc
// > png_push_read_IDAT @ 0xe46290
// > png_push_read_IDAT @ 0xe46300
// > png_crc_read @ 0xe54fec
// > png_read_chunk_header @ 0xe58120
// > png_write_chunk_start @ 0xe61504
// > png_write_chunk_data @ 0xe61580
// > png_write_chunk @ 0xe6168c
// > png_write_IHDR @ 0xe618ec
// > png_write_PLTE @ 0xe61b74
// > png_compress_IDAT @ 0xe61db8
// > png_compress_IDAT @ 0xe61f74
// > png_write_IEND @ 0xe6216c
// > png_write_gAMA_fixed @ 0xe62258
// > png_write_sRGB @ 0xe62348
// > png_write_iCCP @ 0xe624d0
// > png_write_sPLT @ 0xe62680
// > png_write_sBIT @ 0xe628d8
// > png_write_cHRM_fixed @ 0xe62a70
// > png_write_tRNS @ 0xe62bec
// > png_write_tRNS @ 0xe62c74
// > png_write_tRNS @ 0xe62d3c
// > png_write_bKGD @ 0xe62e50
// > png_write_bKGD @ 0xe62f58
// > png_write_bKGD @ 0xe63030
// > png_write_hIST @ 0xe630f4
// > png_write_tEXt @ 0xe63254
// > png_write_zTXt @ 0xe63414
// > png_write_iTXt @ 0xe63694
// > png_write_iTXt @ 0xe63814
// > png_write_oFFs @ 0xe63a04
// > png_write_pCAL @ 0xe63b90
// > png_write_sCAL_s @ 0xe63e2c
// > png_write_pHYs @ 0xe63f5c
// > png_write_tIME @ 0xe640b0
// > ??> @ 0xcecf8
//
// This function is hookable on this platform (idp: arm, 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 13:10:00 +0000
//
__int64 __fastcall png_calculate_crc(_DWORD *a1, __int64 a2, __int64 a3)
{
__int64 v5; // x19
__int64 result; // x0
__int64 v7; // x1
__int64 v8; // x1
v5 = a3;
if ( (a1[148] & 0x20000000) != 0 )
{
result = a1[90] & 0x300;
if ( (a1[90] & 0x300) == 0x300 )
return result;
}
else
{
result = (unsigned int)a1[90];
if ( (result & 0x800) != 0 )
return result;
}
if ( a3 )
{
result = (unsigned int)a1[165];
do
{
while ( (_DWORD)v5 )
{
v7 = a2;
a2 += (unsigned int)v5;
result = crc32(result, v7, (unsigned int)v5);
v5 -= (unsigned int)v5;
if ( !v5 )
goto LABEL_8;
}
v8 = a2;
a2 += 0xFFFFFFFFLL;
result = crc32(result, v8, 0xFFFFFFFFLL);
v5 -= 0xFFFFFFFFLL;
}
while ( v5 );
LABEL_8:
a1[165] = result;
}
return result;
}