//
// png_push_crc_finish from 0x652500 to 0x6525b6 (182 bytes)
//
// 1 xrefs:
// > png_process_some_data @ 0x6531fe
//
// 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
//
void __fastcall png_push_crc_finish(_DWORD *a1)
{
unsigned int v2; // r3
unsigned int v3; // r2
unsigned int v4; // r5
int v5; // r0
unsigned int v6; // r1
unsigned int v7; // r5
unsigned int v8; // r1
int v9; // r3
unsigned int v10; // r0
v2 = a1[171];
if ( !v2 )
{
v3 = a1[174];
LABEL_3:
if ( v3 <= 3 )
{
png_push_save_buffer((int)a1);
}
else
{
png_crc_finish(a1, 0);
a1[176] = 1;
}
return;
}
v4 = a1[172];
if ( v4 )
{
if ( v4 >= v2 )
v4 = a1[171];
png_calculate_crc(a1, a1[166], v4);
v2 = a1[171] - v4;
v5 = a1[166];
v3 = a1[174] - v4;
v6 = a1[172] - v4;
a1[171] = v2;
a1[174] = v3;
a1[172] = v6;
a1[166] = v4 + v5;
if ( !v2 )
goto LABEL_3;
}
v7 = a1[175];
if ( v7 )
{
if ( v7 >= v2 )
v7 = v2;
png_calculate_crc(a1, a1[168], v7);
v8 = a1[171] - v7;
v9 = a1[168];
v3 = a1[174] - v7;
v10 = a1[175] - v7;
a1[171] = v8;
a1[174] = v3;
a1[175] = v10;
a1[168] = v9 + v7;
if ( !v8 )
goto LABEL_3;
}
}