//
// TIFFCheckTile from 0xc621cc to 0xc622d0 (260 bytes)
//
// 3 xrefs:
// > TIFFReadTile @ 0xc5fc68
// > TIFFWriteTile @ 0xc63d94
// > ??> @ 0x46cf8
//
// 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 TIFFCheckTile(__int64 a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned __int16 a5)
{
__int64 v6; // x1
unsigned int v8; // w6
unsigned int v9; // w6
unsigned int v10; // w6
int v11; // w2
__int64 result; // x0
unsigned int v13; // w1
v6 = a1 + 56;
v8 = *(_DWORD *)(a1 + 88);
if ( v8 <= a2 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "%lu: Col out of range, max %lu", a2, v8 - 1);
return 0;
}
else
{
v9 = *(_DWORD *)(a1 + 92);
if ( v9 <= a3 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "%lu: Row out of range, max %lu", a3, v9 - 1);
return 0;
}
else
{
v10 = *(_DWORD *)(a1 + 96);
if ( v10 <= a4 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "%lu: Depth out of range, max %lu", a4, v10 - 1);
return 0;
}
else
{
v11 = *(unsigned __int16 *)(a1 + 170);
result = 1;
if ( v11 == 2 )
{
v13 = *(unsigned __int16 *)(v6 + 74);
if ( v13 <= a5 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), *(_QWORD *)a1, "%lu: Sample out of range, max %lu", a5, (int)(v13 - 1));
return 0;
}
}
}
}
}
return result;
}