//
// sub_8F82E4 from 0x8f82e4 to 0x8f8564 (640 bytes)
//
// 3 xrefs:
// > sub_8F7960 @ 0x8f7ad8
// > sub_8F7960 @ 0x8f7adc
// > ??> @ 0x8f7c34
//
// 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_8F82E4(int a1, _WORD *a2, int a3)
{
int result; // r0
int v4; // [sp+10h] [bp-14h]
int v6; // [sp+18h] [bp-Ch]
int v7; // [sp+18h] [bp-Ch]
int i; // [sp+1Ch] [bp-8h]
v4 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v6 = a3 / 2;
result = a3 / (2 * v4);
if ( a3 % (2 * v4) )
result = _assert2();
if ( v6 > v4 )
{
result = TIFFSwabArrayOfShort(a2, v6);
v7 = v6 - v4;
while ( 2 )
{
switch ( v4 )
{
case 0:
goto LABEL_13;
case 1:
goto LABEL_12;
case 2:
goto LABEL_11;
case 3:
goto LABEL_10;
case 4:
goto LABEL_9;
default:
for ( i = v4 - 4; i > 0; --i )
{
a2[v4] += *a2;
++a2;
}
LABEL_9:
a2[v4] += *a2;
++a2;
LABEL_10:
a2[v4] += *a2;
++a2;
LABEL_11:
a2[v4] += *a2;
++a2;
LABEL_12:
a2[v4] += *a2;
++a2;
LABEL_13:
v7 -= v4;
if ( v7 <= 0 )
return result;
continue;
}
}
}
return result;
}