//
// sub_8EC51C from 0x8ec51c to 0x8ec740 (548 bytes)
//
// 3 xrefs:
// > TIFFInitLZW @ 0x8eee8c
// > TIFFInitLZW @ 0x8eee90
// > ??> @ 0x8eefa4
//
// 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:04:12 +0000
//
int __fastcall sub_8EC51C(int a1)
{
int v5; // [sp+8h] [bp-Ch]
int v6; // [sp+Ch] [bp-8h]
v5 = *(_DWORD *)(a1 + 576);
if ( v5 )
{
LABEL_5:
if ( !v5 )
_assert2();
if ( !*(_DWORD *)(v5 + 124) )
{
*(_DWORD *)(v5 + 124) = TIFFmalloc(40952);
if ( !*(_DWORD *)(v5 + 124) )
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), (int)"LZWSetupDecode", "No space for LZW code table");
return 0;
}
v6 = 255;
do
{
*(_BYTE *)(*(_DWORD *)(v5 + 124) + 8 * v6 + 6) = v6;
*(_BYTE *)(*(_DWORD *)(v5 + 124) + 8 * v6 + 7) = v6;
*(_WORD *)(*(_DWORD *)(v5 + 124) + 8 * v6 + 4) = 1;
*(_DWORD *)(*(_DWORD *)(v5 + 124) + 8 * v6) = 0;
}
while ( v6-- != 0 );
TIFFmemset(*(_DWORD *)(v5 + 124) + 2048, 0, 16);
}
return 1;
}
*(_DWORD *)(a1 + 576) = TIFFmalloc(160);
if ( *(_DWORD *)(a1 + 576) )
{
*(_DWORD *)(*(_DWORD *)(a1 + 576) + 124) = 0;
*(_DWORD *)(*(_DWORD *)(a1 + 576) + 104) = 0;
TIFFPredictorInit(a1);
v5 = *(_DWORD *)(a1 + 576);
goto LABEL_5;
}
TIFFErrorExt(*(_DWORD *)(a1 + 628), (int)"LZWSetupDecode", "No space for LZW state block");
return 0;
}