//
// sub_C5CF7C from 0xc5cf7c to 0xc5d078 (252 bytes)
//
// 2 xrefs:
// > sub_C5D078 @ 0xc5d184
// > sub_C5D078 @ 0xc5d18c
//
// 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
//
__int64 __fastcall sub_C5CF7C(__int64 a1, const void *a2, signed __int64 byte_count, unsigned __int16 a4)
{
unsigned int v6; // w26
__int64 v7; // x23
char *v8; // x0
void *v9; // x25
char *v10; // x21
__int64 v11; // x20
__int64 v12; // x19
char *v13; // x1
unsigned int v14; // w19
v6 = a4;
v7 = *(_QWORD *)(a1 + 848);
v8 = (char *)TIFFmalloc(byte_count);
v9 = v8;
if ( v8 )
{
v10 = v8;
v11 = byte_count;
memcpy(v8, a2, byte_count);
v12 = *(_QWORD *)(v7 + 16);
if ( byte_count > 0 )
{
do
{
v13 = v10;
v11 -= v12;
v10 += v12;
(*(void (__fastcall **)(__int64, char *, __int64))(v7 + 48))(a1, v13, v12);
}
while ( v11 > 0 );
}
v14 = (*(__int64 (__fastcall **)(__int64, void *, signed __int64, _QWORD))(v7 + 40))(a1, v9, byte_count, v6);
TIFFfree(v9);
return v14;
}
else
{
TIFFErrorExt(
*(_QWORD *)(a1 + 952),
(__int64)"PredictorEncodeTile",
"Out of memory allocating %ld byte temp buffer.",
byte_count);
return 0;
}
}