//
// sub_8E7104 from 0x8e7104 to 0x8e7360 (604 bytes)
//
// 3 xrefs:
// > sub_8EB950 @ 0x8eb9dc
// > sub_8EB950 @ 0x8eb9e0
// > ??> @ 0x8ebb98
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:04:10 +0000
//
int __fastcall sub_8E7104(_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;
}
}