//
// sub_6EA67C from 0x6ea67c to 0x6ea8cc (592 bytes)
//
// 12 xrefs:
// > sub_6E8098 @ 0x6e81ac
// > sub_6E8098 @ 0x6e81b0
// > sub_6E8098 @ 0x6e81cc
// > sub_6E8098 @ 0x6e81d0
// > sub_6E8098 @ 0x6e8248
// > sub_6E8098 @ 0x6e824c
// > sub_6E8098 @ 0x6e8268
// > sub_6E8098 @ 0x6e826c
// > ??> @ 0x6e82a0
// > ??> @ 0x6e82a4
// > ??> @ 0x6e82b4
// > ??> @ 0x6e82b8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_6EA67C(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;
}
}