//
// cocos2d::extension::CCControlButton::needsLayout from 0x1003400d0 to 0x1003405e4 (1300 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b1df98
// > ??> @ 0x100b52680
//
// 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:43 +0000
//
void __fastcall cocos2d::extension::CCControlButton::needsLayout(_QWORD *a1)
{
__int64 v2; // rdi
__int64 v3; // rdi
__int64 v4; // rdi
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rdi
const void *v9; // r14
void (__fastcall ***v10)(_QWORD, __int64); // rax
__int64 v11; // rdi
void (__fastcall ***v12)(_QWORD, __int64); // r15
__int64 CString; // rax
void (__fastcall ***v14)(void *, __int64); // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rdi
__int64 v18; // r14
__int64 v19; // rax
_DWORD *v20; // rsi
__int64 *v21; // r14
__int64 v22; // rax
__int64 *v23; // rdi
_DWORD *v24; // rsi
_DWORD *v25; // rsi
__int64 v26; // r14
__int64 v27; // rax
__int64 v28; // r14
__int64 v29; // rax
__m128 v30; // [rsp-64h] [rbp-64h] BYREF
unsigned __int64 v31; // [rsp-54h] [rbp-54h] BYREF
float v32; // [rsp-4Ch] [rbp-4Ch]
float v33; // [rsp-48h] [rbp-48h]
float v34; // [rsp-44h] [rbp-44h] BYREF
__int64 v35; // [rsp-3Ch] [rbp-3Ch] BYREF
__m128 v36; // [rsp-34h] [rbp-34h] BYREF
float v37; // [rsp-24h] [rbp-24h]
if ( *((_BYTE *)a1 + 525) != 1 )
return;
v2 = a1[61];
if ( v2 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v2 + 344LL))(v2, 0);
v3 = a1[62];
if ( v3 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v3 + 344LL))(v3, 0);
sub_1002782D0(&v36, (_QWORD *)((char *)a1 + 516));
(*(void (__fastcall **)(_QWORD *, __m128 *))(*a1 + 1400LL))(a1, &v36);
v4 = a1[59];
if ( v4 )
cocos2d::CCObject::release(v4);
v5 = (*(__int64 (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1440LL))(a1, *((unsigned int *)a1 + 107));
a1[59] = v5;
if ( v5 )
cocos2d::CCObject::retain(v5);
v6 = (*(__int64 (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1456LL))(a1, *((unsigned int *)a1 + 107));
*((_WORD *)a1 + 240) = v6;
*((_BYTE *)a1 + 482) = BYTE2(v6);
v7 = (*(__int64 (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1472LL))(a1, *((unsigned int *)a1 + 107));
v8 = a1[61];
if ( v8 == v7 )
{
v9 = (const void *)a1[61];
if ( !v8 )
goto LABEL_24;
goto LABEL_18;
}
v9 = (const void *)v7;
if ( v7 )
{
cocos2d::CCObject::retain(v7);
v8 = a1[61];
}
if ( v8 )
cocos2d::CCObject::release(v8);
a1[61] = v9;
if ( v9 )
{
LABEL_18:
v10 = (void (__fastcall ***)(_QWORD, __int64))__dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCLabelProtocol,
-2);
if ( !v10
|| (v11 = a1[59]) == 0
|| (v12 = v10,
CString = cocos2d::CCString::getCString(v11),
(**v12)(v12, CString),
(v9 = (const void *)a1[61]) != nullptr) )
{
v14 = (void (__fastcall ***)(void *, __int64))__dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
if ( !v14 || ((**v14)(v14, (__int64)(a1 + 60)), (v9 = (const void *)a1[61]) != nullptr) )
{
v37 = *(float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1) * 0.5;
v15 = (*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1);
sub_100278250(v36.f32, v37, 0.5 * *(float *)(v15 + 4));
(*(void (__fastcall **)(const void *, __m128 *))(*(_QWORD *)v9 + 184LL))(v9, &v36);
}
}
}
LABEL_24:
v16 = (*(__int64 (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1536LL))(a1, *((unsigned int *)a1 + 107));
v17 = a1[62];
if ( v17 == v16 )
{
v18 = a1[62];
if ( v17 )
{
LABEL_30:
v37 = *(float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1) * 0.5;
v19 = (*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1);
sub_100278250(v36.f32, v37, 0.5 * *(float *)(v19 + 4));
(*(void (__fastcall **)(__int64, __m128 *))(*(_QWORD *)v18 + 184LL))(v18, &v36);
}
}
else
{
v18 = v16;
if ( v16 )
{
cocos2d::CCObject::retain(v16);
v17 = a1[62];
}
if ( v17 )
cocos2d::CCObject::release(v17);
a1[62] = v18;
if ( v18 )
goto LABEL_30;
}
sub_100278600(&v35);
v20 = (_DWORD *)a1[61];
if ( v20 )
{
cocos2d::CCNode::boundingBox((__int64)&v36, v20);
sub_100278660(&v35, &v36.i64[1]);
}
v21 = (__int64 *)a1[62];
if ( *((_BYTE *)a1 + 483) == 1 )
{
if ( v21 )
{
sub_100278260(
v36.f32,
(float)(2 * *((_DWORD *)a1 + 141)) + *(float *)&v35,
(float)(2 * *((_DWORD *)a1 + 140)) + *((float *)&v35 + 1));
v22 = *v21;
v23 = v21;
LABEL_42:
(*(void (__fastcall **)(__int64 *, __m128 *))(v22 + 320))(v23, &v36);
}
}
else if ( v21 )
{
(*(void (__fastcall **)(__m128 *, _QWORD))(*v21 + 1008))(&v36, a1[62]);
if ( v36.f32[0] <= 0.0 )
v36.i32[0] = v35;
if ( v36.f32[1] <= 0.0 )
v36.i32[1] = HIDWORD(v35);
v23 = (__int64 *)a1[62];
v22 = *v23;
goto LABEL_42;
}
sub_1002787A0(&v36);
v24 = (_DWORD *)a1[61];
if ( v24 )
{
cocos2d::CCNode::boundingBox((__int64)&v30, v24);
sub_100278810(&v36, (unsigned __int64 *)&v30);
}
sub_1002787A0(&v30);
v25 = (_DWORD *)a1[62];
if ( v25 )
{
cocos2d::CCNode::boundingBox((__int64)&v31, v25);
sub_100278810(&v30, &v31);
}
cocos2d::extension::CCControlUtils::CCRectUnion(&v31, &v36, &v30);
sub_100278260(&v34, v32, v33);
(*(void (__fastcall **)(_QWORD *, float *))(*a1 + 320LL))(a1, &v34);
v26 = a1[61];
if ( v26 )
{
v37 = *(float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1) * 0.5;
v27 = (*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1);
sub_100278250(&v34, v37, 0.5 * *(float *)(v27 + 4));
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v26 + 184LL))(v26, &v34);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)a1[61] + 344LL))(a1[61], 1);
}
v28 = a1[62];
if ( v28 )
{
v37 = *(float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1) * 0.5;
v29 = (*(__int64 (__fastcall **)(_QWORD *))(*a1 + 328LL))(a1);
sub_100278250(&v34, v37, 0.5 * *(float *)(v29 + 4));
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v28 + 184LL))(v28, &v34);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)a1[62] + 344LL))(a1[62], 1);
}
}