//
// sub_8CAFFC from 0x8caffc to 0x8cb130 (308 bytes)
//
// 4 xrefs:
// > sub_8C7DD0 @ 0x8c8214
// > sub_8C7DD0 @ 0x8c8434
// > sub_8C7DD0 @ 0x8c8478
// > sub_8C7DD0 @ 0x8c878c
//
// 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:03 +0000
//
int __fastcall sub_8CAFFC(int a1, _DWORD *a2, int a3, unsigned __int16 a4, __int16 a5)
{
int v11; // [sp+18h] [bp-14h]
_WORD *v12; // [sp+1Ch] [bp-10h]
unsigned __int16 i; // [sp+22h] [bp-Ah]
int v14; // [sp+24h] [bp-8h]
if ( a3 )
{
v11 = TIFFmalloc(2 * *(unsigned __int16 *)(a1 + 98));
if ( v11 )
{
v12 = (_WORD *)v11;
for ( i = 0; i < (unsigned int)*(unsigned __int16 *)(a1 + 98); ++i )
*v12++ = a5;
v14 = sub_8CC40C(a1, a2, a3, a4, *(unsigned __int16 *)(a1 + 98), v11);
TIFFfree(v11);
return v14;
}
else
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), "TIFFWriteDirectoryTagShortPerSample", "Out of memory");
return 0;
}
}
else
{
++*a2;
return 1;
}
}