//
// sub_1006957CC from 0x1006957cc to 0x1006959cc (512 bytes)
//
// 2 xrefs:
// > sub_1006956C4 @ 0x100695778
// > sub_1006959CC @ 0x100695ab0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:11:34 +0000
//
__int64 __fastcall sub_1006957CC(__int64 *a1, __int64 a2)
{
z_stream *v4; // x20
__int64 v5; // x26
int v6; // w27
void *v7; // x22
int i; // w24
unsigned int v9; // w0
unsigned int v10; // w25
__int64 v11; // x24
__int64 v12; // x0
v4 = (z_stream *)(a2 + 216);
v5 = *(_QWORD *)(a2 + 216);
v6 = *(_DWORD *)(a2 + 224);
v7 = off_1009E5FD0(0x4000u);
if ( v7 )
{
for ( i = 1; ; i = 0 )
{
while ( 1 )
{
*(_QWORD *)(a2 + 240) = v7;
*(_DWORD *)(a2 + 248) = 0x4000;
v9 = inflate(v4, 2);
v10 = v9;
if ( v9 <= 1 )
break;
if ( !i || v9 != -3 || (inflateEnd(v4), inflateInit2_(v4, -15, "1.2.8", 112)) )
{
off_1009E5FD8(v7);
goto LABEL_17;
}
i = 0;
*(_QWORD *)(a2 + 216) = v5;
*(_DWORD *)(a2 + 224) = v6;
}
if ( 0x4000 != *(_DWORD *)(a2 + 248) && !*(_BYTE *)(a2 + 369) )
{
v11 = sub_1006790A4((__int64)a1, 1, (char *)v7, (unsigned int)(0x4000 - *(_DWORD *)(a2 + 248)));
if ( (_DWORD)v11 )
{
off_1009E5FD8(v7);
inflateEnd(v4);
*(_DWORD *)(a2 + 212) = 0;
return v11;
}
}
if ( v10 == 1 )
break;
if ( !*(_DWORD *)(a2 + 224) )
{
off_1009E5FD8(v7);
return 0;
}
}
off_1009E5FD8(v7);
if ( !inflateEnd(v4) )
{
inflateEnd(v4);
v11 = 0;
*(_DWORD *)(a2 + 212) = 0;
return v11;
}
LABEL_17:
v12 = *a1;
if ( *(_QWORD *)(a2 + 264) )
sub_10067889C(v12, "Error while processing content unencoding: %s");
else
sub_10067889C(v12, "Error while processing content unencoding: Unknown failure within decompression software.");
inflateEnd(v4);
*(_DWORD *)(a2 + 212) = 0;
return 61;
}
else
{
inflateEnd(v4);
*(_DWORD *)(a2 + 212) = 0;
return 27;
}
}