//
// sub_ED313C from 0xed313c to 0xed3238 (252 bytes)
//
// 2 xrefs:
// > sub_ED3238 @ 0xed3344
// > sub_ED3238 @ 0xed334c
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:11:41 +0000
//
__int64 __fastcall sub_ED313C(__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;
}
}