//
// cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite from 0x10033ed20 to 0x10033f11b (1019 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b1e000
// > ??> @ 0x100b526e8
//
// 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 12:28:42 +0000
//
__int64 __fastcall cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite(
__int64 a1,
const void *a2,
__int64 a3)
{
__int64 result; // rax
void *v6; // r13
_QWORD *v7; // rax
_QWORD *v8; // rdi
_QWORD *v9; // r12
_QWORD *v10; // rax
_QWORD *v11; // rdi
_QWORD *v12; // r12
_QWORD *v13; // rax
_QWORD *v14; // rdi
_QWORD *v15; // r12
_QWORD *v16; // rax
_QWORD *v17; // rdi
_QWORD *v18; // r12
const void *v19; // rdi
__int64 v20; // rdi
const char *v21; // r12
size_t v22; // rax
size_t v23; // r13
char *v24; // r14
size_t v25; // r15
__int64 v26; // r14
unsigned __int16 *v27; // rax
__int64 v28; // [rsp+0h] [rbp-60h]
void *v29; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
unsigned __int8 v32; // [rsp+37h] [rbp-29h]
result = cocos2d::extension::CCControl::init((_DWORD *)a1);
if ( !(_BYTE)result )
return result;
v32 = result;
if ( a2 )
{
v6 = __dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCLabelProtocol,
-2);
v29 = __dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
}
else
{
v6 = nullptr;
v29 = nullptr;
}
*(_BYTE *)(a1 + 525) = 1;
v7 = cocos2d::CCDictionary::create();
v8 = *(_QWORD **)(a1 + 528);
if ( v8 != v7 )
{
v9 = v7;
if ( v7 )
{
cocos2d::CCObject::retain(v7);
v8 = *(_QWORD **)(a1 + 528);
}
if ( v8 )
cocos2d::CCObject::release(v8);
*(_QWORD *)(a1 + 528) = v9;
}
v10 = cocos2d::CCDictionary::create();
v11 = *(_QWORD **)(a1 + 536);
if ( v11 != v10 )
{
v12 = v10;
if ( v10 )
{
cocos2d::CCObject::retain(v10);
v11 = *(_QWORD **)(a1 + 536);
}
if ( v11 )
cocos2d::CCObject::release(v11);
*(_QWORD *)(a1 + 536) = v12;
}
v13 = cocos2d::CCDictionary::create();
v14 = *(_QWORD **)(a1 + 544);
if ( v14 != v13 )
{
v15 = v13;
if ( v13 )
{
cocos2d::CCObject::retain(v13);
v14 = *(_QWORD **)(a1 + 544);
}
if ( v14 )
cocos2d::CCObject::release(v14);
*(_QWORD *)(a1 + 544) = v15;
}
v16 = cocos2d::CCDictionary::create();
v17 = *(_QWORD **)(a1 + 552);
if ( v17 != v16 )
{
v18 = v16;
if ( v16 )
{
cocos2d::CCObject::retain(v16);
v17 = *(_QWORD **)(a1 + 552);
}
if ( v17 )
cocos2d::CCObject::release(v17);
*(_QWORD *)(a1 + 552) = v18;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
*(_BYTE *)(a1 + 524) = 0;
*(_BYTE *)(a1 + 512) = 1;
*(_QWORD *)(a1 + 472) = 0;
*(_BYTE *)(a1 + 483) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1312LL))(a1);
sub_100278630(__dst, &qword_100BE2D48);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)a1 + 1368LL))(a1, __dst);
*(_BYTE *)(a1 + 512) = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 440LL))(a1, 0);
sub_100278250((float *)__dst, 0.5, 0.5);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)a1 + 296LL))(a1, __dst);
v19 = *(const void **)(a1 + 488);
if ( v19 != a2 )
{
if ( a2 )
{
cocos2d::CCObject::retain(a2);
v19 = *(const void **)(a1 + 488);
}
if ( v19 )
cocos2d::CCObject::release(v19);
*(_QWORD *)(a1 + 488) = a2;
}
v20 = *(_QWORD *)(a1 + 496);
if ( v20 != a3 )
{
if ( a3 )
{
cocos2d::CCObject::retain(a3);
v20 = *(_QWORD *)(a1 + 496);
}
if ( v20 )
cocos2d::CCObject::release(v20);
*(_QWORD *)(a1 + 496) = a3;
}
BYTE2(__dst[0]) = -1;
LOWORD(__dst[0]) = -1;
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)a1 + 1216LL))(a1, __dst);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 255);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1248LL))(a1, 1);
v21 = (const char *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v6 + 8LL))(v6);
v22 = strlen(v21);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v23 = v22;
if ( v22 >= 0x17 )
{
v28 = a3;
v25 = 26;
if ( (v22 | 7) != 0x17 )
v25 = (v22 | 7) + 1;
v24 = (char *)operator new(v25);
__p = v24;
__dst[0] = v25 + 1;
a3 = v28;
__dst[1] = v23;
}
else
{
LOBYTE(__dst[0]) = 2 * v22;
v24 = (char *)__dst + 1;
if ( !v22 )
goto LABEL_49;
}
memmove(v24, v21, v23);
LABEL_49:
v24[v23] = 0;
v26 = sub_10088E600(__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 1448LL))(a1, v26, 1);
v27 = (unsigned __int16 *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v29 + 8LL))(v29);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 1464LL))(
a1,
*v27 | (*((unsigned __int8 *)v27 + 2) << 16),
1);
(*(void (__fastcall **)(__int64, const void *, __int64))(*(_QWORD *)a1 + 1480LL))(a1, a2, 1);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 1544LL))(a1, a3, 1);
sub_100278250((float *)__dst, 0.5, 0.5);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)a1 + 1400LL))(a1, __dst);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1312LL))(a1);
return v32;
}