//
// sub_6B2994 from 0x6b2994 to 0x6b2adc (328 bytes)
//
// 5 xrefs:
// > TIFFReadDirectory @ 0x6b121c
// > TIFFReadDirectory @ 0x6b1320
// > TIFFReadCustomDirectory @ 0x6b2bc8
// > TIFFReadCustomDirectory @ 0x6b2ccc
// > sub_6B455C @ 0x6b4594
//
// 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_6B2994(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;
}