//
// sub_841790 from 0x841790 to 0x841946 (438 bytes)
//
// 3 xrefs:
// > sub_841970 @ 0x8419c2
// > sub_8419F8 @ 0x841a32
// > sub_8419F8 @ 0x841acc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:02:21 +0000
//
int __fastcall sub_841790(int *a1, int a2)
{
int v4; // r10
int v5; // r11
int v6; // r6
void *v7; // r0
void *v8; // r7
unsigned int v9; // r0
unsigned int v10; // r5
const char *v11; // r2
int v12; // r0
int v14; // r3
int v15; // r11
int v16; // r10
v4 = *(_DWORD *)(a2 + 152);
v5 = *(_DWORD *)(a2 + 148);
v6 = a2 + 148;
v7 = off_D200AC(0x4000u);
v8 = v7;
if ( v7 )
{
*(_DWORD *)(a2 + 160) = v7;
*(_DWORD *)(a2 + 164) = 0x4000;
v9 = inflate(v6, 2);
v10 = v9;
if ( v9 <= 1 )
goto LABEL_10;
if ( v9 == -3 )
{
inflateEnd(v6);
if ( inflateInit2_(v6, -15, "1.2.8", 56) )
{
off_D200B0(v8);
v11 = *(const char **)(a2 + 172);
v12 = *a1;
if ( v11 )
goto LABEL_8;
goto LABEL_25;
}
*(_DWORD *)(a2 + 148) = v5;
*(_DWORD *)(a2 + 152) = v4;
while ( 1 )
{
*(_DWORD *)(a2 + 160) = v8;
*(_DWORD *)(a2 + 164) = 0x4000;
v10 = inflate(v6, 2);
if ( v10 > 1 )
break;
LABEL_10:
v14 = *(_DWORD *)(a2 + 164);
if ( v14 != 0x4000 )
{
v15 = *(unsigned __int8 *)(a2 + 229);
if ( !*(_BYTE *)(a2 + 229) )
{
v16 = sub_8287C8((int)a1, 1, (const char *)v8, 0x4000 - v14);
if ( v16 )
{
off_D200B0(v8);
inflateEnd(v6);
*(_DWORD *)(a2 + 144) = v15;
return v16;
}
}
}
if ( v10 == 1 )
{
off_D200B0(v8);
if ( !inflateEnd(v6) )
{
inflateEnd(v6);
*(_DWORD *)(a2 + 144) = 0;
return 0;
}
v11 = *(const char **)(a2 + 172);
v12 = *a1;
if ( v11 )
goto LABEL_8;
goto LABEL_25;
}
if ( !*(_DWORD *)(a2 + 152) )
{
off_D200B0(v8);
return 0;
}
}
}
off_D200B0(v8);
v11 = *(const char **)(a2 + 172);
v12 = *a1;
if ( v11 )
{
LABEL_8:
sub_828178(v12, "Error while processing content unencoding: %s", v11);
LABEL_9:
inflateEnd(v6);
*(_DWORD *)(a2 + 144) = 0;
return 61;
}
LABEL_25:
sub_828178(v12, "Error while processing content unencoding: Unknown failure within decompression software.");
goto LABEL_9;
}
inflateEnd(v6);
*(_DWORD *)(a2 + 144) = 0;
return 27;
}