//
// TIFFReadEncodedTile from 0xc5fabc to 0xc5fbec (304 bytes)
//
// 2 xrefs:
// > TIFFReadTile @ 0xc5fca8
// > ??> @ 0x641b8
//
// 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
//
__int64 __fastcall TIFFReadEncodedTile(__int64 a1, unsigned int a2, __int64 a3, __int64 a4)
{
__int64 v7; // x20
unsigned int v9; // w4
v7 = a4;
if ( *(_DWORD *)(a1 + 12) == 1 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "File not open for reading");
}
else if ( (*(_DWORD *)(a1 + 16) & 0x400) != 0 )
{
v9 = *(_DWORD *)(a1 + 228);
if ( v9 <= a2 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), (__int64)"TIFFReadEncodedTile", "%lu: Tile out of range, max %lu", a2, v9);
return -1;
}
if ( a4 == -1 || *(_QWORD *)(a1 + 688) < a4 )
v7 = *(_QWORD *)(a1 + 688);
if ( (unsigned int)TIFFFillTile(a1, a2)
&& (*(unsigned int (__fastcall **)(__int64, __int64, __int64, _QWORD))(a1 + 792))(
a1,
a3,
v7,
a2 / *(_DWORD *)(a1 + 224)) )
{
(*(void (__fastcall **)(__int64, __int64, __int64))(a1 + 1000))(a1, a3, v7);
return v7;
}
}
else
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "Can not read tiles from a stripped image");
}
return -1;
}