//
// sub_C90EC from 0xc90ec to 0xc917c (144 bytes)
//
// 3 xrefs:
// > ??> @ 0xc90ea
// > sub_CA5FC @ 0xca60e
// > sub_CA5FC @ 0xca64a
//
// 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_C90EC(__int64 *a1, unsigned int a2)
{
int v3; // r5
__int64 v4; // kr00_8
int v5; // r3
int v6; // r1
int v7; // r0
if ( a2 > 0x20 )
return -1;
v3 = *((_DWORD *)a1 + 4);
v4 = *a1;
v5 = *((_DWORD *)a1 + 1) + a2;
if ( *(_DWORD *)a1 < v3 - 4 )
goto LABEL_6;
if ( (int)v4 > v3 - ((v5 + 7) >> 3) )
return -1;
if ( !v5 )
return 0;
LABEL_6:
v6 = dword_41784[a2];
v7 = **((unsigned __int8 **)a1 + 3) >> SBYTE4(v4);
if ( v5 >= 9 )
{
v7 |= *(unsigned __int8 *)(v4 + 1) << (8 - BYTE4(v4));
if ( v5 >= 17 )
{
v7 |= *(unsigned __int8 *)(v4 + 2) << (16 - BYTE4(v4));
if ( v5 >= 25 )
{
v7 |= *(unsigned __int8 *)(v4 + 3) << (24 - BYTE4(v4));
if ( HIDWORD(v4) )
{
if ( v5 >= 33 )
v7 |= *(unsigned __int8 *)(v4 + 4) << (32 - BYTE4(v4));
}
}
}
}
return v7 & v6;
}