//
// sub_8C2554 from 0x8c2554 to 0x8c269c (328 bytes)
//
// 5 xrefs:
// > TIFFReadDirectory @ 0x8c0ddc
// > TIFFReadDirectory @ 0x8c0ee0
// > TIFFReadCustomDirectory @ 0x8c2788
// > TIFFReadCustomDirectory @ 0x8c288c
// > sub_8C411C @ 0x8c4154
//
// 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:00 +0000
//
int __fastcall sub_8C2554(int result, unsigned __int16 a2, int *a3)
{
int v3; // [sp+14h] [bp-10h]
int v4; // [sp+18h] [bp-Ch]
int v5; // [sp+1Ch] [bp-8h]
v3 = -1;
v5 = *(_DWORD *)(result + 660);
while ( 1 )
{
if ( v3 + 1 == v5 )
{
*a3 = -1;
return result;
}
v4 = (v3 + v5) / 2;
if ( **(_DWORD **)(*(_DWORD *)(result + 656) + 4 * v4) == a2 )
break;
if ( **(_DWORD **)(*(_DWORD *)(result + 656) + 4 * v4) >= (unsigned int)a2 )
v5 = (v3 + v5) / 2;
else
v3 = (v3 + v5) / 2;
}
while ( v4 && **(_DWORD **)(*(_DWORD *)(result + 656) + 4 * (v4 - 1)) == a2 )
--v4;
*a3 = v4;
return result;
}