//
// sub_CCC59C from 0xccc59c to 0xccc6dc (320 bytes)
//
// 3 xrefs:
// > __gxx_personality_v0 @ 0xcccbdc
// > __cxa_call_unexpected @ 0xcccc94
// > __cxa_call_unexpected @ 0xcccccc
//
// 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
//
__int64 __fastcall sub_CCC59C(__int64 a1, __int64 *a2, unsigned __int64 *a3, __int64 a4)
{
char *v7; // x23
__int64 v8; // x2
int v9; // w1
char v10; // t1
unsigned __int64 v11; // x0
int v12; // w0
__int64 v13; // x2
unsigned __int64 v14; // x25
__int64 v15; // x1
__int64 result; // x0
unsigned __int64 *v17; // [xsp+58h] [xbp+58h] BYREF
v7 = (char *)(*(_QWORD *)(a1 + 24) + ~a4);
while ( 1 )
{
v8 = 0;
v9 = 0;
do
{
v10 = *v7++;
v11 = (unsigned __int64)(v10 & 0x7F) << v9;
v9 += 7;
v8 |= v11;
}
while ( v10 < 0 );
if ( !v8 )
break;
v12 = *(unsigned __int8 *)(a1 + 40);
if ( v12 == 255 )
{
v13 = 0;
}
else
{
switch ( v12 & 7 )
{
case 0:
case 4:
v13 = -8 * v8;
break;
case 2:
v13 = -2 * v8;
break;
case 3:
v13 = -4 * v8;
break;
default:
abort();
return result;
}
}
sub_CCC304(v12, *(char **)(a1 + 16), (char *)(*(_QWORD *)(a1 + 24) + v13), (unsigned __int64 *)&v17);
v14 = (unsigned __int64)v17;
v15 = *a2;
v17 = a3;
if ( (*(unsigned __int8 (__fastcall **)(__int64 *))(v15 + 16))(a2) )
v17 = (unsigned __int64 *)*v17;
result = (*(unsigned __int8 (__fastcall **)(unsigned __int64, __int64 *, unsigned __int64 **, __int64))(*(_QWORD *)v14 + 32LL))(
v14,
a2,
&v17,
1);
if ( (_BYTE)result )
return result;
}
return 0;
}