//
// png_push_read_IDAT from 0x65305c to 0x6531de (386 bytes)
//
// 1 xrefs:
// > png_process_some_data @ 0x65320a
//
// 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_read_IDAT(_DWORD *a1)
{
unsigned int v2; // r3
unsigned int v3; // r2
int v4; // r3
unsigned int v5; // r5
int v6; // r0
unsigned int v7; // r1
unsigned int v8; // r5
unsigned int v9; // r1
int v10; // r3
unsigned int v11; // r0
unsigned int v12; // r3
int v13; // r1
int v14; // r3
char v15[4]; // [sp+0h] [bp-Ch] BYREF
unsigned int v16; // [sp+4h] [bp-8h] BYREF
if ( (a1[77] & 0x100) != 0 )
{
v2 = a1[127];
if ( !v2 )
{
LABEL_5:
v3 = a1[174];
LABEL_6:
if ( v3 <= 3 )
{
png_push_save_buffer((int)a1);
}
else
{
png_crc_finish(a1, 0);
v4 = a1[77];
a1[80] = 0;
a1[77] = v4 & 0xFFFFFEF7 | 8;
}
return;
}
}
else
{
if ( a1[174] <= 7u )
{
png_push_save_buffer((int)a1);
return;
}
png_push_fill_buffer(a1, v15, 4u);
a1[170] = png_get_uint_31(a1, v15);
png_reset_crc((int)a1);
png_crc_read(a1, &v16, 4);
v12 = _byteswap_ulong(v16);
v13 = a1[77] | 0x100;
a1[119] = v12;
a1[77] = v13;
if ( v12 != 1229209940 )
{
v14 = a1[78];
a1[176] = 1;
if ( (v14 & 8) == 0 )
png_error((int)a1, "Not enough compressed data");
return;
}
v2 = a1[170];
a1[127] = v2;
if ( !v2 )
goto LABEL_5;
}
v5 = a1[172];
if ( v5 )
{
if ( v5 >= v2 )
v5 = v2;
png_calculate_crc(a1, a1[166], v5);
png_process_IDAT_data((unsigned int)a1, a1[166], v5);
v2 = a1[127] - v5;
v6 = a1[166];
v3 = a1[174] - v5;
v7 = a1[172] - v5;
a1[127] = v2;
a1[174] = v3;
a1[172] = v7;
a1[166] = v5 + v6;
if ( !v2 )
goto LABEL_6;
}
v8 = a1[175];
if ( v8 )
{
if ( v8 >= v2 )
v8 = v2;
png_calculate_crc(a1, a1[168], v8);
png_process_IDAT_data((unsigned int)a1, a1[168], v8);
v9 = a1[127] - v8;
v10 = a1[168];
v3 = a1[174] - v8;
v11 = a1[175] - v8;
a1[127] = v9;
a1[174] = v3;
a1[175] = v11;
a1[168] = v10 + v8;
if ( !v9 )
goto LABEL_6;
}
}