//
// sub_6D7544 from 0x6d7544 to 0x6d77a0 (604 bytes)
//
// 3 xrefs:
// > sub_6DBD90 @ 0x6dbe1c
// > sub_6DBD90 @ 0x6dbe20
// > ??> @ 0x6dbfd8
//
// 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_6D7544(_DWORD *a1, int a2, int a3, __int16 a4)
{
int v9; // [sp+18h] [bp-1Ch]
int v10; // [sp+1Ch] [bp-18h]
int i; // [sp+20h] [bp-14h]
int v12; // [sp+24h] [bp-10h]
unsigned __int8 *v13; // [sp+28h] [bp-Ch]
int v14; // [sp+2Ch] [bp-8h]
v9 = a1[144];
if ( a4 )
_assert2();
if ( !v9 )
_assert2();
v12 = a3 / *(_DWORD *)(v9 + 8);
if ( *(_DWORD *)v9 == 2 )
{
v14 = a2;
}
else
{
if ( *(_DWORD *)(v9 + 16) < v12 )
_assert2();
v14 = *(_DWORD *)(v9 + 12);
}
v13 = (unsigned __int8 *)a1[151];
v10 = a1[152];
for ( i = 0; i < v12 && v10 > 0; ++i )
{
*(_DWORD *)(v14 + 4 * i) = (*v13 << 16) | (v13[1] << 8) | v13[2];
v13 += 3;
v10 -= 3;
}
a1[151] = v13;
a1[152] = v10;
if ( i == v12 )
{
(*(void (__fastcall **)(int, int, int))(v9 + 20))(v9, a2, v12);
return 1;
}
else
{
TIFFErrorExt(
a1[157],
(int)"LogLuvDecode24",
"Not enough data at row %lu (short %llu pixels)",
a1[111],
(__int64)(v12 - i));
return 0;
}
}