//
// sub_63E9A4 from 0x63e9a4 to 0x63eb8e (490 bytes)
//
// 1 xrefs:
// > sub_61D9EC @ 0x61de1a
//
// 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
//
char *__fastcall sub_63E9A4(const char *a1)
{
size_t v2; // r0
char *result; // r0
char *v4; // r5
char *v5; // r0
char *v6; // r10
char *v7; // r0
char *v8; // r7
char *v9; // r4
char *v10; // r11
int v11; // r3
const char *v12; // r7
size_t v13; // r0
int v14; // r3
int v15; // r3
int v16; // t1
int v17; // r3
int v18; // r3
int v19; // t1
int v20; // r3
int v21; // r3
bool v22; // zf
bool v23; // r3
v2 = strlen(a1);
result = (char *)off_ABAEAC(v2 + 1);
v4 = result;
if ( !result )
return result;
v5 = off_ABAEB8(a1);
v6 = v5;
if ( !v5 || !*v5 )
{
off_ABAEB0(v4);
return v6;
}
v7 = strchr(v5, 63);
v8 = v7;
if ( v7 )
*v7 = 0;
v9 = v4;
v10 = v6;
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
while ( !strncmp("./", v10, 2u) )
{
LABEL_14:
v14 = (unsigned __int8)v10[2];
v10 += 2;
if ( !v14 )
goto LABEL_10;
}
if ( strncmp("../", v10, 3u) )
break;
v11 = (unsigned __int8)v10[3];
v10 += 3;
if ( !v11 )
goto LABEL_10;
}
if ( !strncmp("/./", v10, 3u) )
goto LABEL_14;
if ( strcmp("/.", v10) )
break;
*++v10 = 47;
}
if ( strncmp("/../", v10, 4u) )
break;
if ( v9 > v4 )
{
v15 = (unsigned __int8)*--v9;
if ( v15 != 47 )
{
while ( v9 != v4 )
{
v16 = (unsigned __int8)*--v9;
if ( v16 == 47 )
goto LABEL_26;
}
v9 = v4;
}
}
LABEL_26:
*v9 = 0;
v17 = (unsigned __int8)v10[3];
v10 += 3;
if ( !v17 )
goto LABEL_10;
}
if ( strcmp("/..", v10) )
break;
v10[2] = 47;
if ( v9 > v4 )
{
v18 = (unsigned __int8)*--v9;
if ( v18 != 47 )
{
while ( v9 != v4 )
{
v19 = (unsigned __int8)*--v9;
if ( v19 == 47 )
goto LABEL_35;
}
v9 = v4;
}
}
LABEL_35:
*v9 = 0;
v20 = (unsigned __int8)v10[2];
v10 += 2;
if ( !v20 )
goto LABEL_10;
}
if ( !strcmp(".", v10) || !strcmp("..", v10) )
break;
while ( 1 )
{
*v9 = *v10;
v21 = (unsigned __int8)v10[1];
v22 = v21 == 47;
if ( v21 != 47 )
v22 = v21 == 0;
v23 = !v22;
if ( v22 )
break;
++v9;
++v10;
}
*++v9 = v23;
if ( !*++v10 )
goto LABEL_10;
}
*v10 = 0;
LABEL_10:
if ( v8 )
{
v12 = &a1[v8 - v6];
v13 = strlen(v12);
memcpy(v9, v12, v13 + 1);
}
off_ABAEB0(v6);
return v4;
}