//
// sub_8FA23C from 0x8fa23c to 0x8fa48c (592 bytes)
//
// 12 xrefs:
// > sub_8F7C58 @ 0x8f7d6c
// > sub_8F7C58 @ 0x8f7d70
// > sub_8F7C58 @ 0x8f7d8c
// > sub_8F7C58 @ 0x8f7d90
// > sub_8F7C58 @ 0x8f7e08
// > sub_8F7C58 @ 0x8f7e0c
// > sub_8F7C58 @ 0x8f7e28
// > sub_8F7C58 @ 0x8f7e2c
// > ??> @ 0x8f7e60
// > ??> @ 0x8f7e64
// > ??> @ 0x8f7e74
// > ??> @ 0x8f7e78
//
// 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:15 +0000
//
int __fastcall sub_8FA23C(int a1, const void *a2, signed int a3, unsigned __int16 a4)
{
_DWORD *v10; // [sp+10h] [bp-1Ch]
char *v11; // [sp+14h] [bp-18h]
int v12; // [sp+18h] [bp-14h]
int v13; // [sp+1Ch] [bp-10h]
char *v14; // [sp+20h] [bp-Ch]
int v15; // [sp+24h] [bp-8h]
v10 = *(_DWORD **)(a1 + 576);
v12 = a3;
if ( !v10 )
_assert2();
if ( !v10[6] )
_assert2();
if ( !v10[5] )
_assert2();
v11 = (char *)TIFFmalloc(a3);
if ( v11 )
{
memcpy(v11, a2, a3);
v14 = v11;
v13 = v10[2];
if ( v13 <= 0 )
_assert2();
if ( a3 % v13 )
_assert2();
while ( v12 > 0 )
{
((void (__fastcall *)(int, char *, int))v10[6])(a1, v14, v13);
v12 -= v13;
v14 += v13;
}
v15 = ((int (__fastcall *)(int, char *, signed int, _DWORD))v10[5])(a1, v11, a3, a4);
TIFFfree(v11);
return v15;
}
else
{
TIFFErrorExt(
*(_DWORD *)(a1 + 628),
(int)"PredictorEncodeTile",
"Out of memory allocating %ld byte temp buffer.",
a3);
return 0;
}
}