//
// sub_65C1DC from 0x65c1dc to 0x65c290 (180 bytes)
//
// 2 xrefs:
// > png_handle_iCCP @ 0x65d1b0
// > png_read_start_row @ 0x65f574
//
// 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 sub_65C1DC(int a1, int a2)
{
int v3; // r5
int v5; // r0
int v6; // r2
int v7; // r1
bool v8; // zf
int v9; // r0
int v10; // r5
char v12[68]; // [sp+0h] [bp-44h] BYREF
v3 = *(_DWORD *)(a1 + 320);
if ( v3 )
{
v12[3] = *(_DWORD *)(a1 + 320);
v12[0] = HIBYTE(v3);
v12[1] = BYTE2(v3);
v12[2] = BYTE1(v3);
png_safecat((int)v12, 0x40u, 4u, " using zstream");
png_chunk_warning(a1, v12);
*(_DWORD *)(a1 + 320) = 0;
}
v5 = *(_DWORD *)(a1 + 312);
v6 = (*(unsigned __int8 *)(a1 + 744) >> 2) & 3;
*(_DWORD *)(a1 + 324) = 0;
*(_DWORD *)(a1 + 328) = 0;
*(_DWORD *)(a1 + 336) = 0;
if ( v6 == 3 )
v7 = 15;
else
v7 = 0;
v8 = (v5 & 2) == 0;
*(_DWORD *)(a1 + 340) = 0;
v9 = a1 + 324;
if ( v8 )
{
v10 = inflateInit2_(v9, v7, "1.2.8", 56);
if ( !v10 )
{
*(_DWORD *)(a1 + 312) |= 2u;
goto LABEL_8;
}
}
else
{
v10 = inflateReset2(v9, v7);
if ( !v10 )
{
LABEL_8:
*(_DWORD *)(a1 + 320) = a2;
return 0;
}
}
png_zstream_error(a1, v10);
return v10;
}