//
// sub_8FF5F4 from 0x8ff5f4 to 0x8ff844 (592 bytes)
//
// 1 xrefs:
// > TIFFFillTile @ 0x8ff230
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:04:16 +0000
//
int __fastcall sub_8FF5F4(int a1, unsigned int a2)
{
unsigned int v3; // r3
unsigned int v4; // r3
_DWORD *v8; // [sp+Ch] [bp-10h]
v8 = (_DWORD *)(a1 + 40);
if ( !TIFFFillStriles() || !*(_DWORD *)(a1 + 176) )
return 0;
if ( (*(_DWORD *)(a1 + 12) & 0x20) == 0 )
{
if ( !(*(int (__fastcall **)(int))(a1 + 508))(a1) )
return 0;
*(_DWORD *)(a1 + 12) |= 0x20u;
}
*(_DWORD *)(a1 + 492) = a2;
if ( v8[4] >= (unsigned int)-v8[7] )
v3 = 0;
else
v3 = (unsigned int)(v8[4] + v8[7] - 1) / v8[7];
*(_DWORD *)(a1 + 444) = v8[8] * (a2 % v3);
if ( v8[5] >= (unsigned int)-v8[8] )
v4 = 0;
else
v4 = (unsigned int)(v8[5] + v8[8] - 1) / v8[8];
*(_DWORD *)(a1 + 488) = v8[7] * (a2 % v4);
*(_DWORD *)(a1 + 12) &= ~0x100000u;
if ( (*(_DWORD *)(a1 + 12) & 0x20000) != 0 )
{
*(_DWORD *)(a1 + 604) = 0;
*(_DWORD *)(a1 + 608) = 0;
}
else
{
*(_DWORD *)(a1 + 604) = *(_DWORD *)(a1 + 588);
*(_DWORD *)(a1 + 608) = *(_DWORD *)(v8[34] + 8 * a2);
}
return (*(int (__fastcall **)(int, _DWORD))(a1 + 512))(a1, (unsigned __int16)(a2 / v8[31]));
}