//
// sub_BDE648 from 0xbde648 to 0xbde770 (296 bytes)
//
// 2 xrefs:
// > png_handle_iCCP @ 0xbdfe2c
// > png_read_start_row @ 0xbe321c
//
// 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
//
__int64 __fastcall sub_BDE648(__int64 a1, int a2)
{
int v4; // w4
int v5; // w2
unsigned __int64 v6; // x0
__int64 v7; // x1
unsigned int v8; // w21
char v10[64]; // [xsp+38h] [xbp+38h] BYREF
v4 = *(_DWORD *)(a1 + 368);
if ( v4 )
{
v10[0] = HIBYTE(*(_DWORD *)(a1 + 368));
v10[1] = BYTE2(v4);
v10[2] = BYTE1(v4);
v10[3] = v4;
png_safecat((__int64)v10, 0x40u, 4u, " using zstream");
png_chunk_warning(a1, v10);
*(_DWORD *)(a1 + 368) = 0;
}
v5 = *(_DWORD *)(a1 + 360);
v6 = ((unsigned __int64)*(unsigned __int8 *)(a1 + 1024) >> 2) & 3;
*(_QWORD *)(a1 + 376) = 0;
*(_DWORD *)(a1 + 384) = 0;
*(_QWORD *)(a1 + 400) = 0;
if ( (_DWORD)v6 == 3 )
v7 = 15;
else
v7 = 0;
*(_DWORD *)(a1 + 408) = 0;
if ( (v5 & 2) == 0 )
{
v8 = inflateInit2_(a1 + 376, v7, "1.2.8", 112);
if ( !v8 )
{
*(_DWORD *)(a1 + 360) |= 2u;
goto LABEL_8;
}
LABEL_12:
png_zstream_error(a1, v8);
return v8;
}
v8 = inflateReset2(a1 + 376, v7);
if ( v8 )
goto LABEL_12;
LABEL_8:
*(_DWORD *)(a1 + 368) = a2;
return 0;
}