//
// sub_77C520 from 0x77c520 to 0x77c5a8 (136 bytes)
//
// 15 xrefs:
// > sub_77C6FA @ 0x77c85c
// > sub_77CB5C @ 0x77cf6c
// > sub_77CB5C @ 0x77cfc8
// > sub_77D3D0 @ 0x77d590
// > sub_77D87C @ 0x77dbb0
// > sub_77D87C @ 0x77e0f8
// > sub_77E3B0 @ 0x77e3b2
// > sub_77EC0C @ 0x77eec0
// > sub_77F4C0 @ 0x77f6a8
// > sub_77F970 @ 0x77fd0a
// > sub_7805C4 @ 0x7805c6
// > sub_780764 @ 0x780766
// > sub_780FA4 @ 0x780fa6
// > sub_78111C @ 0x78111e
// > sub_781362 @ 0x781364
//
// 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
//
_DWORD *__fastcall sub_77C520(_DWORD *a1)
{
_BYTE *v1; // r5
_DWORD *result; // r0
_BYTE *v3; // r1
int v4; // r4
unsigned __int8 *v5; // r5
int v6; // r3
int v7; // r6
int v8; // r6
int v9; // r2
int v10; // r3
_DWORD *v11; // r3
v1 = (_BYTE *)a1[3];
if ( *v1 != 84 )
return nullptr;
v3 = v1 + 1;
a1[3] = v1 + 1;
v4 = (unsigned __int8)v1[1];
if ( v4 == 95 )
{
v8 = 0;
}
else
{
if ( v4 == 110 )
return nullptr;
if ( (unsigned __int8)(v4 - 48) > 9u )
return nullptr;
v5 = v1 + 2;
v6 = 0;
do
{
v7 = 10 * v6 + v4;
a1[3] = v5;
v4 = *v5;
v3 = v5;
v6 = v7 - 48;
++v5;
}
while ( (unsigned __int8)(v4 - 48) <= 9u );
v8 = v7 - 47;
if ( v4 != 95 )
return nullptr;
}
v9 = a1[5];
++a1[10];
v10 = a1[6];
a1[3] = v3 + 1;
if ( v9 >= v10 )
return nullptr;
v11 = (_DWORD *)(12 * v9 + a1[4]);
a1[5] = v9 + 1;
result = nullptr;
if ( v11 )
{
*v11 = 5;
v11[1] = v8;
return v11;
}
return result;
}