//
// sub_99310C from 0x99310c to 0x993266 (346 bytes)
//
// 3 xrefs:
// > std::__ndk1::ctype_byname::do_toupper @ 0x9703da
// > std::__ndk1::ctype_byname::do_toupper @ 0x9703ee
// > sub_992FF8 @ 0x992ffe
//
// 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:06:37 +0000
//
unsigned int __fastcall sub_99310C(unsigned int a1)
{
unsigned int v1; // r9
_BOOL4 v2; // r0
bool v3; // cf
int i; // r2
unsigned __int16 *v5; // r6
int v6; // r0
unsigned int v7; // r5
unsigned __int16 v8; // r1
unsigned __int16 *v9; // r0
unsigned __int16 *v10; // r2
int v11; // t1
v1 = a1;
v2 = sub_992F68(a1);
if ( v1 - 43008 >= 0x5700 )
{
v3 = v1 - 11776 >= 0x7840;
if ( v1 - 11776 >= 0x7840 )
v3 = v1 - 1536 >= 0xA00;
if ( v3 && v2 )
{
if ( v1 - 11520 > 0x25 )
{
for ( i = 0; i != 61; ++i )
{
v5 = (unsigned __int16 *)((char *)&unk_C50A30 + 4 * i);
v6 = *((char *)v5 + 2);
v7 = v1 - *v5;
if ( v7 - v6 < *((unsigned __int8 *)v5 + 3) )
{
if ( (unsigned __int8)v6 == 1 )
v1 -= v7 & 1;
else
v1 -= v6;
return v1;
}
}
v8 = unk_C50B2A;
if ( unk_C50B2A )
{
v9 = (unsigned __int16 *)&unk_C50B28;
v10 = (unsigned __int16 *)&unk_C50B2E;
while ( v8 != v1 )
{
v11 = *v10;
v10 += 2;
v8 = v11;
v9 += 2;
if ( !v11 )
goto LABEL_16;
}
return *v9;
}
else
{
LABEL_16:
if ( v1 - 66600 <= 0x27 )
v1 -= 40;
}
}
else
{
v1 -= 7264;
}
}
}
return v1;
}