//
// sub_6499D8 from 0x6499d8 to 0x649a5c (132 bytes)
//
// 2 xrefs:
// > lws_read @ 0x64636a
// > lws_read @ 0x6463cc
//
// 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_6499D8(int a1, int *a2, int a3)
{
int v4; // r6
unsigned __int8 *v6; // r3
int v7; // r3
int result; // r0
v4 = a3;
switch ( *(_BYTE *)(a1 + 263) )
{
case 4:
case 8:
case 9:
case 0xC:
case 0xD:
if ( !a3 )
goto LABEL_13;
if ( (*(_BYTE *)(a1 + 260) & 8) != 0 )
{
do
{
if ( (*(_BYTE *)(a1 + 179) & 0x40) != 0 )
{
if ( sub_648E28(a1, 0, a3) < 0 )
return -1;
}
else
{
if ( *(_DWORD *)(a1 + 196) )
++*(_DWORD *)(a1 + 244);
v6 = (unsigned __int8 *)(*a2)++;
if ( sub_64AD70(a1, *v6) )
return -1;
if ( !--v4 )
goto LABEL_13;
}
v7 = *(unsigned __int8 *)(a1 + 260);
a3 = v7 << 28;
}
while ( (v7 & 8) != 0 );
}
sub_647274((_DWORD *)a1, *a2, 0, v4);
result = 0;
break;
default:
LABEL_13:
result = 0;
break;
}
return result;
}