//
// TIFFNumberOfTiles from 0x6f2644 to 0x6f284c (520 bytes)
//
// 3 xrefs:
// > TIFFReadDirectory @ 0x6b1690
// > TIFFSetupStrips @ 0x6f45a8
// > ??> @ 0x5817c
//
// 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
//
unsigned int __fastcall TIFFNumberOfTiles(_DWORD *a1)
{
unsigned int v1; // r4
unsigned int v2; // r3
unsigned int v3; // r4
unsigned int v4; // r3
unsigned int v5; // r3
_DWORD *v8; // [sp+Ch] [bp-20h]
unsigned int v9; // [sp+10h] [bp-1Ch]
unsigned int v10; // [sp+14h] [bp-18h]
unsigned int v11; // [sp+18h] [bp-14h]
unsigned int v12; // [sp+1Ch] [bp-10h]
v8 = a1 + 10;
v9 = a1[17];
v10 = a1[18];
v11 = a1[19];
if ( v9 == -1 )
v9 = a1[14];
if ( v10 == -1 )
v10 = a1[15];
if ( v11 == -1 )
v11 = a1[16];
if ( v9 && v10 && v11 )
{
if ( a1[14] >= -v9 )
v1 = 0;
else
v1 = (a1[14] + v9 - 1) / v9;
if ( a1[15] >= -v10 )
v2 = 0;
else
v2 = (a1[15] + v10 - 1) / v10;
v3 = TIFFMultiply32((int)a1, v1, v2, "TIFFNumberOfTiles");
if ( v8[6] >= -v11 )
v4 = 0;
else
v4 = (v8[6] + v11 - 1) / v11;
v5 = TIFFMultiply32((int)a1, v3, v4, "TIFFNumberOfTiles");
}
else
{
v5 = 0;
}
v12 = v5;
if ( *((_WORD *)v8 + 43) == 2 )
return TIFFMultiply32((int)a1, v5, *((unsigned __int16 *)v8 + 29), "TIFFNumberOfTiles");
return v12;
}