//
// TIFFComputeTile from 0x6f21ec to 0x6f2488 (668 bytes)
//
// 3 xrefs:
// > TIFFReadTile @ 0x6eeb08
// > TIFFWriteTile @ 0x6f3ef0
// > ??> @ 0x587bc
//
// 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 TIFFComputeTile(int a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned __int16 a5)
{
unsigned int v5; // r3
unsigned int v6; // r3
unsigned int v7; // r3
unsigned int v10; // [sp+14h] [bp-28h]
unsigned int v11; // [sp+18h] [bp-24h]
unsigned int v12; // [sp+1Ch] [bp-20h]
int v13; // [sp+20h] [bp-1Ch]
unsigned int v14; // [sp+24h] [bp-18h]
unsigned int v15; // [sp+28h] [bp-14h]
v10 = *(_DWORD *)(a1 + 68);
v11 = *(_DWORD *)(a1 + 72);
v12 = *(_DWORD *)(a1 + 76);
v13 = 1;
if ( *(_DWORD *)(a1 + 64) == 1 )
a4 = 0;
if ( v10 == -1 )
v10 = *(_DWORD *)(a1 + 56);
if ( v11 == -1 )
v11 = *(_DWORD *)(a1 + 60);
if ( v12 == -1 )
v12 = *(_DWORD *)(a1 + 64);
if ( v10 && v11 && v12 )
{
if ( *(_DWORD *)(a1 + 56) >= -v10 )
v5 = 0;
else
v5 = (*(_DWORD *)(a1 + 56) + v10 - 1) / v10;
v14 = v5;
if ( *(_DWORD *)(a1 + 60) >= -v11 )
v6 = 0;
else
v6 = (*(_DWORD *)(a1 + 60) + v11 - 1) / v11;
v15 = v6;
if ( *(_DWORD *)(a1 + 64) >= -v12 )
v7 = 0;
else
v7 = (*(_DWORD *)(a1 + 64) + v12 - 1) / v12;
if ( *(_WORD *)(a1 + 126) == 2 )
return a5 * v7 * v15 * v14 + a4 / v12 * v15 * v14 + v14 * (a3 / v11) + a2 / v10;
else
return a4 / v12 * v15 * v14 + v14 * (a3 / v11) + a2 / v10;
}
return v13;
}