//
// sub_8E4BA0 from 0x8e4ba0 to 0x8e4da4 (516 bytes)
//
// 1 xrefs:
// > sub_8E5900 @ 0x8e5964
//
// 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_8E4BA0(_DWORD *a1)
{
int v1; // r4
int v2; // r0
int j; // [sp+8h] [bp-14h]
int i; // [sp+8h] [bp-14h]
int v8; // [sp+Ch] [bp-10h]
v8 = (1 << *((_WORD *)a1 + 12)) - 1;
if ( *((_WORD *)a1 + 12) == 16 )
v8 = 255;
a1[14] = TIFFmalloc(v8 + 1);
if ( a1[14] )
{
if ( *((_WORD *)a1 + 16) )
{
for ( i = 0; i <= v8; ++i )
*(_BYTE *)(a1[14] + i) = 255 * i / v8;
}
else
{
for ( j = 0; j <= v8; ++j )
*(_BYTE *)(a1[14] + j) = 255 * (v8 - j) / v8;
}
if ( *((unsigned __int16 *)a1 + 12) <= 0x10u && (*((_WORD *)a1 + 16) == 1 || !*((_WORD *)a1 + 16)) )
{
if ( !sub_8E4588(a1) )
return 0;
TIFFfree(a1[14]);
a1[14] = 0;
}
return 1;
}
v1 = *(_DWORD *)(*a1 + 628);
v2 = TIFFFileName(*a1);
TIFFErrorExt(v1, v2, "No space for photometric conversion table");
return 0;
}