//
// sub_77E7B0 from 0x77e7b0 to 0x77e8c6 (278 bytes)
//
// 14 xrefs:
// > sub_77C6FA @ 0x77c6fc
// > sub_77C6FA @ 0x77caf2
// > sub_77CB5C @ 0x77cb78
// > sub_77D3D0 @ 0x77d446
// > sub_77D918 @ 0x77d91a
// > sub_77D87C @ 0x77defe
// > sub_77E8CC @ 0x77e9c4
// > sub_77F4C0 @ 0x77f522
// > sub_77FAEA @ 0x77faec
// > sub_77FAEA @ 0x77fb68
// > sub_77FAEA @ 0x77fd90
// > sub_77FAEA @ 0x77ff78
// > sub_77FFEE @ 0x78000a
// > sub_780080 @ 0x78009e
//
// 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_77E7B0(_DWORD *a1)
{
unsigned __int8 *v1; // r3
unsigned int v3; // r12
unsigned int v4; // r7
int v5; // r5
int v6; // r1
int v7; // r3
char **v8; // r2
unsigned int v9; // r4
_DWORD *result; // r0
unsigned int v11; // r4
unsigned int v12; // r3
int v14; // r5
int v15; // r2
unsigned int v16; // r5
_DWORD *v17; // r0
int v18; // r2
_DWORD *v19; // r3
int v20; // r1
_DWORD *v21; // r3
v1 = (unsigned __int8 *)a1[3];
if ( !*v1 )
{
v3 = 0;
v4 = 0;
goto LABEL_3;
}
a1[3] = v1 + 1;
v4 = *v1;
if ( !v1[1] )
{
v3 = 0;
goto LABEL_3;
}
a1[3] = v1 + 2;
v12 = v1[1];
v3 = v12;
if ( v4 == 118 )
{
v16 = v12 - 48;
if ( (unsigned __int8)(v12 - 48) <= 9u )
{
v17 = sub_77C404(a1);
v18 = a1[5];
if ( v18 < a1[6] )
{
v19 = (_DWORD *)(12 * v18 + a1[4]);
a1[5] = v18 + 1;
if ( v17 )
{
if ( v19 )
{
v19[2] = v17;
*v19 = 50;
v19[1] = v16;
return v19;
}
}
}
return nullptr;
}
goto LABEL_3;
}
if ( v12 != 118 || v4 != 99 )
{
LABEL_3:
v5 = 61;
v6 = 0;
while ( 1 )
{
v7 = (v5 - v6) / 2 + v6;
v8 = &off_A2EA90[4 * v7];
v9 = (unsigned __int8)**v8;
if ( v4 == v9 )
{
v11 = (unsigned __int8)(*v8)[1];
if ( v3 == v11 )
{
v20 = a1[5];
if ( v20 < a1[6] )
{
v21 = (_DWORD *)(12 * v20 + a1[4]);
a1[5] = v20 + 1;
result = nullptr;
if ( v21 )
{
*v21 = 49;
v21[1] = v8;
return v21;
}
return result;
}
return nullptr;
}
if ( v11 <= v3 )
{
LABEL_12:
v6 = v7 + 1;
goto LABEL_7;
}
}
else if ( v9 <= v4 )
{
goto LABEL_12;
}
v5 = (v5 - v6) / 2 + v6;
LABEL_7:
if ( v6 == v5 )
return nullptr;
}
}
v14 = a1[14];
a1[14] = a1[13] == 0;
v15 = sub_77D87C((int)a1);
if ( a1[14] )
result = sub_77BD98(a1, 52, v15, 0);
else
result = sub_77BD98(a1, 51, v15, 0);
a1[14] = v14;
return result;
}