//
// TIFFReadEncodedTile from 0x6eeb34 to 0x6eec9c (360 bytes)
//
// 2 xrefs:
// > TIFFReadTile @ 0x6eeb20
// > ??> @ 0x587cc
//
// 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 TIFFReadEncodedTile(int a1, unsigned int a2, int a3, int a4)
{
int v10; // [sp+18h] [bp-14h]
int v11; // [sp+1Ch] [bp-10h]
v10 = a1 + 40;
v11 = *(_DWORD *)(a1 + 496);
if ( !sub_6EFC84(a1, 1) )
return -1;
if ( *(_DWORD *)(v10 + 128) > a2 )
{
if ( a4 == -1 )
{
a4 = v11;
}
else if ( a4 > v11 )
{
a4 = v11;
}
if ( TIFFFillTile(a1, a2)
&& (*(int (__fastcall **)(int, int, int, _DWORD))(a1 + 548))(
a1,
a3,
a4,
(unsigned __int16)(a2 / *(_DWORD *)(v10 + 124))) )
{
(*(void (__fastcall **)(int, int, int))(a1 + 652))(a1, a3, a4);
return a4;
}
else
{
return -1;
}
}
else
{
TIFFErrorExt(
*(_DWORD *)(a1 + 628),
(int)"TIFFReadEncodedTile",
"%lu: Tile out of range, max %lu",
a2,
*(_DWORD *)(v10 + 128));
return -1;
}
}