//
// sub_6E3E58 from 0x6e3e58 to 0x6e409c (580 bytes)
//
// 3 xrefs:
// > TIFFInitPixarLog @ 0x6e79b4
// > TIFFInitPixarLog @ 0x6e79b8
// > ??> @ 0x6e7b48
//
// 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
//
int __fastcall sub_6E3E58(_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_6E3DCC(*(unsigned __int16 *)(v8 + 124), *(_DWORD *)(v7 + 16));
v3 = sub_6E3DCC(v2, *(_DWORD *)(v7 + 60));
v9 = sub_6E3DCC(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_6E3C54(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;
}
}