//
// sub_6A31A0 from 0x6a31a0 to 0x6a3304 (356 bytes)
//
// 1 xrefs:
// > sub_6A344C @ 0x6a3e30
//
// 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_6A31A0(int a1, _DWORD *a2, unsigned int *a3)
{
int v5; // [sp+10h] [bp-Ch]
unsigned int i; // [sp+14h] [bp-8h]
*a3 = (unsigned __int16)*a2;
if ( (unsigned __int16)*a3 > (unsigned int)*(unsigned __int16 *)(a1 + 58) )
return 0;
v5 = a2[1];
if ( *a3 && !v5 )
return 0;
for ( i = 0; *a3 > i; ++i )
{
if ( *(unsigned __int16 *)(v5 + 2 * i) > 2u )
{
if ( *(_WORD *)(v5 + 2 * i) != 999 )
return 0;
*(_WORD *)(v5 + 2 * i) = 2;
}
}
*(_WORD *)(a1 + 116) = *a3;
TIFFsetShortArray(a1 + 120, v5, *(unsigned __int16 *)(a1 + 116));
return 1;
}