//
// sub_8F3A18 from 0x8f3a18 to 0x8f3c5c (580 bytes)
//
// 3 xrefs:
// > TIFFInitPixarLog @ 0x8f7574
// > TIFFInitPixarLog @ 0x8f7578
// > ??> @ 0x8f7708
//
// 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:13 +0000
//
int __fastcall sub_8F3A18(_DWORD *a1)
{
__int16 v1; // r3
int v2; // r0
int v3; // r0
int v7; // [sp+Ch] [bp-18h]
int v8; // [sp+10h] [bp-14h]
int v9; // [sp+14h] [bp-10h]
v7 = (int)(a1 + 10);
v8 = a1[144];
if ( !v8 )
_assert2();
a1[163] = TIFFNoPostDecode;
if ( *(_WORD *)(v7 + 86) == 1 )
v1 = *(_WORD *)(v7 + 58);
else
v1 = 1;
*(_WORD *)(v8 + 124) = v1;
v2 = sub_8F398C(*(unsigned __int16 *)(v8 + 124), *(_DWORD *)(v7 + 16));
v3 = sub_8F398C(v2, *(_DWORD *)(v7 + 60));
v9 = sub_8F398C(v3, 2);
if ( !v9 )
return 0;
*(_DWORD *)(v8 + 120) = TIFFmalloc(2 * *(unsigned __int16 *)(v8 + 124) + v9);
if ( !*(_DWORD *)(v8 + 120) )
return 0;
if ( *(_DWORD *)(v8 + 132) == -1 )
*(_DWORD *)(v8 + 132) = sub_8F3814(v7);
if ( *(_DWORD *)(v8 + 132) == -1 )
{
TIFFErrorExt(
a1[157],
(int)"PixarLogSetupDecode",
"PixarLog compression can't handle bits depth/data format combination (depth: %d)",
*(unsigned __int16 *)(v7 + 44));
return 0;
}
else if ( j_inflateInit_(v8 + 64, "1.2.3", 56) )
{
TIFFErrorExt(a1[157], (int)"PixarLogSetupDecode", "%s", *(const char **)(v8 + 88));
return 0;
}
else
{
*(_DWORD *)(v8 + 128) |= 1u;
return 1;
}
}