//
// cocos2d::CCGLProgram::~CCGLProgram from 0x1800897c0 to 0x180089949 (393 bytes)
//
// 4 xrefs:
// > sub_180089950 @ 0x1800899ab
// > sub_180089950 @ 0x18008996c
// > ??> @ 0x18014cf68
// > ??> @ 0x1801bf994
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:05 +0000
//
void __fastcall cocos2d::CCGLProgram::~CCGLProgram(cocos2d::CCGLProgram *this, unsigned int a2)
{
cocos2d *v3; // rcx
__int64 v4; // rdi
__int64 i; // rsi
__int64 v6; // rdx
__int64 v7; // r10
__int64 v8; // r9
__int64 v9; // r11
__int64 v10; // r9
__int64 v11; // rdx
__int64 v12; // r9
__int64 v13; // rcx
__int64 v14; // r9
_QWORD *v15; // rcx
__int64 v16; // rcx
__int64 v17; // rcx
*(_QWORD *)this = &cocos2d::CCGLProgram::`vftable';
v3 = (cocos2d *)*((unsigned int *)this + 14);
if ( (_DWORD)v3 )
cocos2d::ccGLDeleteProgram(v3, a2);
v4 = *((_QWORD *)this + 13);
if ( v4 )
{
for ( i = *(_QWORD *)(v4 + 32); ; i = *(_QWORD *)(i + 32) )
{
v6 = *(_QWORD *)(v4 + 24);
if ( v6 || *(_QWORD *)(v4 + 32) )
{
v7 = *((_QWORD *)this + 13);
v8 = *(_QWORD *)(v7 + 16);
v9 = *(_QWORD *)(v8 + 32);
if ( v4 == *(_QWORD *)(v8 + 24) - v9 )
{
*(_QWORD *)(v8 + 24) = v6 + v9;
v7 = *((_QWORD *)this + 13);
}
v10 = *(_QWORD *)(v4 + 24);
v11 = *(_QWORD *)(v4 + 32);
if ( v10 )
{
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v7 + 16) + 32LL) + v10 + 16) = v11;
v11 = *((_QWORD *)this + 13);
}
else
{
*((_QWORD *)this + 13) = v11;
}
v12 = *(_QWORD *)(v4 + 32);
if ( v12 )
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v11 + 16) + 32LL) + v12 + 8) = *(_QWORD *)(v4 + 24);
v13 = *(_QWORD *)(*((_QWORD *)this + 13) + 16LL);
v14 = *(_DWORD *)(v4 + 68) & (unsigned int)(*(_DWORD *)(v13 + 8) - 1);
--*(_DWORD *)(16 * v14 + *(_QWORD *)v13 + 8);
v15 = *(_QWORD **)(*((_QWORD *)this + 13) + 16LL);
if ( *(_QWORD *)(16 * v14 + *v15) == v4 + 16 )
*(_QWORD *)(*v15 + 16 * v14) = *(_QWORD *)(v4 + 48);
v16 = *(_QWORD *)(v4 + 40);
if ( v16 )
*(_QWORD *)(v16 + 32) = *(_QWORD *)(v4 + 48);
v17 = *(_QWORD *)(v4 + 48);
if ( v17 )
*(_QWORD *)(v17 + 24) = *(_QWORD *)(v4 + 40);
--*(_DWORD *)(*(_QWORD *)(*((_QWORD *)this + 13) + 16LL) + 16LL);
}
else
{
free(**(void ***)(*((_QWORD *)this + 13) + 16LL));
free(*(void **)(*((_QWORD *)this + 13) + 16LL));
*((_QWORD *)this + 13) = 0;
}
free(*(void **)v4);
free((void *)v4);
v4 = i;
if ( !i )
break;
}
}
cocos2d::CCObject::~CCObject(this);
}