//
// sub_C54268 from 0xc54268 to 0xc54340 (216 bytes)
//
// 2 xrefs:
// > sub_C56154 @ 0xc562e4
// > sub_C56154 @ 0xc562ec
//
// 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_C54268(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // x0
__int64 v5; // x8
__int64 v6; // x9
__int64 v7; // x4
unsigned __int8 *v8; // x2
__int64 i; // x7
int v10; // w6
v4 = *(_QWORD *)(a1 + 848);
v5 = a3 / *(int *)(v4 + 8);
if ( *(_DWORD *)v4 == 2 )
v6 = a2;
else
v6 = *(_QWORD *)(v4 + 16);
v7 = 0;
v8 = *(unsigned __int8 **)(a1 + 904);
for ( i = *(_QWORD *)(a1 + 912); v5 > v7; *(_DWORD *)(v6 + 4 * v7++) = (*(v8 - 2) << 8) | (v10 << 16) | *(v8 - 1) )
{
if ( i <= 0 )
break;
v10 = *v8;
v8 += 3;
i -= 3;
}
*(_QWORD *)(a1 + 904) = v8;
*(_QWORD *)(a1 + 912) = i;
if ( v7 == v5 )
{
(*(void (__fastcall **)(__int64, __int64, __int64))(v4 + 32))(v4, a2, v7);
return 1;
}
else
{
TIFFErrorExt(
*(_QWORD *)(a1 + 952),
(__int64)&unk_F4FA10,
"Not enough data at row %lu (short %llu pixels)",
*(unsigned int *)(a1 + 636),
v5 - v7);
return 0;
}
}