//
// sub_CCC490 from 0xccc490 to 0xccc59c (268 bytes)
//
// 3 xrefs:
// > __gxx_personality_v0 @ 0xccc7f0
// > __gxx_personality_v0 @ 0xccc838
// > __cxa_call_unexpected @ 0xcccc7c
//
// 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_CCC490(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
__int64 RegionStart; // x0
int v6; // w20
char *v7; // x0
char *v8; // x2
char *v9; // x0
int v10; // w1
__int64 v11; // x4
int v12; // w2
char v13; // t1
unsigned __int64 v14; // x1
char v15; // w1
__int64 v16; // x4
char *result; // x0
int v18; // w2
char v19; // t1
unsigned __int64 v20; // x1
int v21; // w1
unsigned __int8 *v22; // [xsp+38h] [xbp+38h]
char *v23; // [xsp+38h] [xbp+38h]
if ( a1 )
{
v22 = a2;
RegionStart = Unwind_GetRegionStart(a1);
a2 = v22;
}
else
{
RegionStart = 0;
}
*(_QWORD *)a3 = RegionStart;
v6 = *a2;
if ( v6 != 255 )
{
v23 = (char *)(a2 + 1);
v7 = (char *)sub_CCC414(v6, a1);
v8 = sub_CCC304(v6, v7, v23, (unsigned __int64 *)(a3 + 8));
v9 = v8 + 1;
v10 = (unsigned __int8)*v8;
*(_BYTE *)(a3 + 40) = v10;
if ( v10 != 255 )
goto LABEL_5;
LABEL_12:
*(_QWORD *)(a3 + 24) = 0;
goto LABEL_8;
}
*(_QWORD *)(a3 + 8) = RegionStart;
v9 = (char *)(a2 + 2);
v21 = a2[1];
*(_BYTE *)(a3 + 40) = v21;
if ( v21 == 255 )
goto LABEL_12;
LABEL_5:
v11 = 0;
v12 = 0;
do
{
v13 = *v9++;
v14 = (unsigned __int64)(v13 & 0x7F) << v12;
v12 += 7;
v11 |= v14;
}
while ( v13 < 0 );
*(_QWORD *)(a3 + 24) = &v9[v11];
LABEL_8:
v15 = *v9;
v16 = 0;
result = v9 + 1;
*(_BYTE *)(a3 + 41) = v15;
v18 = 0;
do
{
v19 = *result++;
v20 = (unsigned __int64)(v19 & 0x7F) << v18;
v18 += 7;
v16 |= v20;
}
while ( v19 < 0 );
*(_QWORD *)(a3 + 32) = &result[v16];
return result;
}