//
// sub_8F87F0 from 0x8f87f0 to 0x8f8a60 (624 bytes)
//
// 3 xrefs:
// > sub_8F7960 @ 0x8f7b14
// > sub_8F7960 @ 0x8f7b18
// > ??> @ 0x8f7c40
//
// 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:14 +0000
//
int __fastcall sub_8F87F0(int a1, _DWORD *a2, int a3)
{
int v3; // r3
int v4; // r2
int result; // r0
int v7; // [sp+10h] [bp-14h]
int v9; // [sp+18h] [bp-Ch]
int v10; // [sp+18h] [bp-Ch]
int i; // [sp+1Ch] [bp-8h]
v7 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v3 = a3;
v4 = a3 + 3;
if ( v3 < 0 )
v3 = v4;
v9 = v3 >> 2;
result = a3 / (4 * v7);
if ( a3 % (4 * v7) )
result = _assert2();
if ( v9 > v7 )
{
result = TIFFSwabArrayOfLong(a2, v9);
v10 = v9 - v7;
while ( 2 )
{
switch ( v7 )
{
case 0:
goto LABEL_15;
case 1:
goto LABEL_14;
case 2:
goto LABEL_13;
case 3:
goto LABEL_12;
case 4:
goto LABEL_11;
default:
for ( i = v7 - 4; i > 0; --i )
{
a2[v7] += *a2;
++a2;
}
LABEL_11:
a2[v7] += *a2;
++a2;
LABEL_12:
a2[v7] += *a2;
++a2;
LABEL_13:
a2[v7] += *a2;
++a2;
LABEL_14:
a2[v7] += *a2;
++a2;
LABEL_15:
v10 -= v7;
if ( v10 <= 0 )
return result;
continue;
}
}
}
return result;
}