//
// deflateBound from 0xcbe0b8 to 0xcbe1c0 (264 bytes)
//
// 1 xrefs:
// > ??> @ 0x80640
//
// 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 deflateBound(__int64 a1, unsigned __int64 a2)
{
unsigned __int64 v2; // x3
__int64 v3; // x0
int v4; // w4
__int64 v5; // x2
__int64 v7; // x7
unsigned __int8 *v8; // x4
int v9; // t1
unsigned __int8 *v10; // x4
int v11; // t1
v2 = ((a2 + 63) >> 6) + ((a2 + 7) >> 3) + a2;
if ( !a1 )
return v2 + 11;
v3 = *(_QWORD *)(a1 + 56);
if ( !v3 )
return v2 + 11;
v4 = *(_DWORD *)(v3 + 44);
if ( v4 == 1 )
{
v5 = 10;
if ( !*(_DWORD *)(v3 + 156) )
v5 = 6;
LABEL_7:
if ( *(_DWORD *)(v3 + 72) != 15 )
return v2 + 5 + v5;
goto LABEL_19;
}
if ( v4 != 2 )
{
v5 = 6;
if ( !v4 )
v5 = 0;
goto LABEL_7;
}
v7 = *(_QWORD *)(v3 + 48);
if ( !v7 )
{
v5 = 18;
goto LABEL_7;
}
if ( *(_QWORD *)(v7 + 24) )
v5 = (unsigned int)(*(_DWORD *)(v7 + 32) + 2) + 18LL;
else
v5 = 18;
v8 = *(unsigned __int8 **)(v7 + 40);
if ( v8 )
{
do
{
v9 = *v8++;
++v5;
}
while ( v9 );
}
v10 = *(unsigned __int8 **)(v7 + 56);
if ( v10 )
{
do
{
v11 = *v10++;
++v5;
}
while ( v11 );
}
if ( *(_DWORD *)(v7 + 68) )
v5 += 2;
if ( *(_DWORD *)(v3 + 72) != 15 )
return v2 + 5 + v5;
LABEL_19:
if ( *(_DWORD *)(v3 + 120) != 15 )
return v2 + 5 + v5;
return a2 + 7 + (a2 >> 12) + (a2 >> 14) + (a2 >> 25) + v5;
}