//
// cocos2d::extension::WebSocket::~WebSocket from 0x180019930 to 0x180019a69 (313 bytes)
//
// 4 xrefs:
// > sub_180019490 @ 0x1800194ee
// > sub_180019490 @ 0x1800194ac
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004ac74
//
// 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
//
void __fastcall cocos2d::extension::WebSocket::~WebSocket(cocos2d::extension::WebSocket *this)
{
cocos2d::CCObject *v2; // rcx
_QWORD *v3; // rcx
__int64 v4; // rsi
__int64 v5; // rdi
void *v6; // rcx
unsigned __int64 v7; // rdx
_QWORD *v8; // rcx
unsigned __int64 v9; // rdx
void *v10; // rcx
*(_QWORD *)this = &cocos2d::extension::WebSocket::`vftable';
cocos2d::extension::WebSocket::close(this);
v2 = *((cocos2d::CCObject **)this + 11);
if ( v2 )
{
cocos2d::CCObject::release(v2);
*((_QWORD *)this + 11) = 0;
}
v3 = *((_QWORD **)this + 16);
if ( v3[1] )
{
v4 = 0;
v5 = 0;
do
{
v6 = (void *)v3[v5];
if ( v6 )
{
j_j_free(v6);
*(_QWORD *)(v5 * 8 + *((_QWORD *)this + 16)) = 0;
}
++v4;
v5 = 7 * v4;
v3 = *((_QWORD **)this + 16);
}
while ( v3[7 * v4 + 1] );
}
if ( v3 )
{
j_j_free(v3);
*((_QWORD *)this + 16) = 0;
}
v7 = *((_QWORD *)this + 10);
if ( v7 > 0xF )
{
v8 = *((_QWORD **)this + 7);
if ( v7 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v8 - *(v8 - 1) - 8 > 0x1F )
goto LABEL_21;
v8 = (_QWORD *)*(v8 - 1);
}
j_j_free(v8);
}
*((_QWORD *)this + 9) = 0;
*((_QWORD *)this + 10) = 15;
*((_BYTE *)this + 56) = 0;
v9 = *((_QWORD *)this + 5);
if ( v9 > 0xF )
{
v10 = *((void **)this + 2);
if ( v9 + 1 < 0x1000 )
{
LABEL_19:
j_j_free(v10);
goto LABEL_20;
}
if ( (unsigned __int64)v10 - *((_QWORD *)v10 - 1) - 8 <= 0x1F )
{
v10 = *((void **)v10 - 1);
goto LABEL_19;
}
LABEL_21:
invalid_parameter_noinfo_noreturn();
}
LABEL_20:
*((_QWORD *)this + 4) = 0;
*((_QWORD *)this + 5) = 15;
*((_BYTE *)this + 16) = 0;
}