//
// inflateReset2 from 0xcc296c to 0xcc2a14 (168 bytes)
//
// 4 xrefs:
// > sub_BDE648 @ 0xbde6a8
// > sub_BDE95C @ 0xbdea00
// > inflateInit2_ @ 0xcc2a88
// > ??> @ 0x96ae0
//
// 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 inflateReset2(__int64 a1, int a2)
{
__int64 v3; // x20
int v4; // w22
int v5; // w19
if ( !a1 )
return 4294967294LL;
v3 = *(_QWORD *)(a1 + 56);
if ( !v3 )
return 4294967294LL;
if ( a2 < 0 )
{
v5 = -a2;
v4 = 0;
}
else
{
v4 = (a2 >> 4) + 1;
v5 = a2 > 47 ? a2 : a2 & 0xF;
}
if ( (unsigned int)(v5 - 8) > 7 && v5 )
return 4294967294LL;
if ( *(_QWORD *)(v3 + 64) )
{
if ( v5 != *(_DWORD *)(v3 + 48) )
{
(*(void (__fastcall **)(_QWORD))(a1 + 72))(*(_QWORD *)(a1 + 80));
*(_QWORD *)(v3 + 64) = 0;
}
}
*(_DWORD *)(v3 + 8) = v4;
*(_DWORD *)(v3 + 48) = v5;
return inflateReset((_QWORD *)a1);
}