//
// __cxa_demangle from 0x78590c to 0x7859d8 (204 bytes)
//
// 1 xrefs:
// > __gnu_cxx::__verbose_terminate_handler @ 0x779d90
//
// 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 *_cxa_demangle(const char *lpmangled, char *lpout, size_t *lpoutlen, int *lpstatus)
{
size_t v8; // r8
char *v9; // r4
size_t v10; // r0
char *v11[2]; // [sp+0h] [bp-10h] BYREF
size_t v12; // [sp+8h] [bp-8h]
int v13; // [sp+Ch] [bp-4h]
if ( !lpmangled || lpout && !lpoutlen )
{
if ( lpstatus )
{
*lpstatus = -3;
return nullptr;
}
return nullptr;
}
v11[0] = nullptr;
v11[1] = nullptr;
v12 = 0;
v13 = 0;
if ( !sub_7855B0((char *)lpmangled, (void (__fastcall *)(_BYTE *))sub_77C24C, (int)v11) )
{
free(v11[0]);
if ( !lpstatus )
return nullptr;
goto LABEL_18;
}
v8 = 1;
if ( !v13 )
v8 = v12;
v9 = v11[0];
if ( !v11[0] )
{
if ( !lpstatus )
return nullptr;
if ( v8 == 1 )
{
*lpstatus = -1;
return nullptr;
}
LABEL_18:
*lpstatus = -2;
return nullptr;
}
if ( !lpout )
{
if ( !lpoutlen )
goto LABEL_13;
goto LABEL_21;
}
v10 = strlen(v11[0]);
if ( v10 >= *lpoutlen )
{
free(lpout);
LABEL_21:
*lpoutlen = v8;
goto LABEL_13;
}
memcpy(lpout, v11[0], v10 + 1);
free(v9);
v9 = lpout;
LABEL_13:
if ( lpstatus )
*lpstatus = 0;
return v9;
}