//
// png_read_image from 0x65707c to 0x6570fe (130 bytes)
//
// 2 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0x5e1c08
// > png_read_png @ 0x6576ae
//
// 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
//
int __fastcall png_read_image(int result, void **a2)
{
int v2; // r7
int v4; // r9
int v5; // r6
int i; // r8
void **v7; // r5
int v8; // r4
void *v9; // t1
if ( result )
{
v2 = result;
if ( (*(_DWORD *)(result + 312) & 0x40) != 0 )
{
if ( *(_BYTE *)(result + 532) && (*(_DWORD *)(result + 316) & 2) == 0 )
{
png_warning(result, "Interlace handling should be turned on when using png_read_image");
*(_DWORD *)(v2 + 456) = *(_DWORD *)(v2 + 452);
}
result = png_set_interlace_handling(v2);
v4 = result;
}
else
{
v4 = png_set_interlace_handling(result);
result = png_start_read_image(v2);
}
v5 = *(_DWORD *)(v2 + 452);
if ( v4 > 0 )
{
for ( i = 0; i != v4; ++i )
{
v7 = a2;
v8 = 0;
if ( v5 )
{
do
{
++v8;
v9 = *v7++;
result = png_read_row(v2, v9, nullptr);
}
while ( v8 != v5 );
}
}
}
}
return result;
}