//
// cocos2d::extension::CCControlSwitchSprite::needsLayout from 0xa9f2bc to 0xa9f658 (924 bytes)
//
// 5 xrefs:
// > cocos2d::extension::CCControlSwitchSprite::initWithMaskSprite @ 0xa9f9ac
// > cocos2d::extension::CCControlSwitchSprite::setSliderXPosition @ 0xa9f9f0
// > cocos2d::extension::CCControlSwitchSprite::setSliderXPosition @ 0xa9fa00
// > cocos2d::extension::CCControlSwitch::ccTouchBegan @ 0xaa0050
// > ??> @ 0x450d8
//
// 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 cocos2d::extension::CCControlSwitchSprite::needsLayout(cocos2d::CCSprite *this)
{
__int64 v2; // x0
void (__fastcall *v3)(__int64, cocos2d::CCPoint *); // x24
float *v4; // x0
__int64 v5; // x23
__int64 v6; // x0
void (__fastcall *v7)(__int64, cocos2d::CCPoint *); // x24
float v8; // s9
float *v9; // x0
__int64 v10; // x23
__int64 v11; // x0
__int64 v12; // x23
void (__fastcall *v13)(__int64, cocos2d::CCPoint *); // x24
__int64 v14; // x23
void (__fastcall *v15)(__int64, cocos2d::CCPoint *); // x24
float v16; // s9
__int64 v17; // x0
__int64 v18; // x23
void (__fastcall *v19)(__int64, cocos2d::CCPoint *); // x24
float v20; // s8
__int64 v21; // x0
unsigned int v22; // w20
int v23; // w2
cocos2d::CCRenderTexture *v24; // x20
__int64 v25; // x0
__int64 v26; // x0
cocos2d::CCRenderTexture *v27; // x0
cocos2d::CCSprite *(__fastcall *getSprite)(cocos2d::CCRenderTexture *__hidden); // x1
void (__fastcall *setTexture)(cocos2d::CCSprite *__hidden, cocos2d::CCTexture2D *); // x20
__int64 v30; // x0
__int64 v31; // x0
float v33; // [xsp+50h] [xbp+50h]
float v34; // [xsp+50h] [xbp+50h]
float v35; // [xsp+50h] [xbp+50h]
float v36; // [xsp+50h] [xbp+50h]
float v37; // [xsp+50h] [xbp+50h]
__int64 v38; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v39; // [xsp+70h] [xbp+70h] BYREF
v2 = *((_QWORD *)this + 80);
v3 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v2 + 184LL);
v4 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v2 + 312LL))(v2);
v5 = *((_QWORD *)this + 80);
v33 = *((float *)this + 152) + (float)(*v4 * 0.5);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 312LL))(v5);
cocos2d::CCPoint::CCPoint(&v39, v33, *(float *)(v6 + 4) * 0.5);
v3(v5, &v39);
v7 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(**((_QWORD **)this + 81) + 184LL);
v8 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 80) + 312LL))(*((_QWORD *)this + 80));
v9 = (float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 81) + 312LL))(*((_QWORD *)this + 81));
v10 = *((_QWORD *)this + 81);
v34 = (float)(v8 + (float)(*v9 * 0.5)) + *((float *)this + 152);
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 312LL))(v10);
cocos2d::CCPoint::CCPoint(&v39, v34, *(float *)(v11 + 4) * 0.5);
v7(v10, &v39);
v12 = *((_QWORD *)this + 82);
v13 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v12 + 184LL);
v35 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 80) + 312LL))(*((_QWORD *)this + 80))
+ *((float *)this + 152);
(*(void (__fastcall **)(__int64 *__return_ptr, _QWORD))(**((_QWORD **)this + 78) + 144LL))(
&v38,
*((_QWORD *)this + 78));
cocos2d::CCPoint::CCPoint(&v39, v35, *((float *)&v38 + 1) * 0.5);
v13(v12, &v39);
v14 = *((_QWORD *)this + 83);
if ( v14 )
{
v15 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v14 + 184LL);
v16 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 80) + 192LL))(*((_QWORD *)this + 80));
v36 = v16
- (float)(*(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 82) + 312LL))(*((_QWORD *)this + 82))
/ 6.0);
v17 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 80) + 312LL))(*((_QWORD *)this + 80));
cocos2d::CCPoint::CCPoint(&v39, v36, *(float *)(v17 + 4) * 0.5);
v15(v14, &v39);
}
v18 = *((_QWORD *)this + 84);
if ( v18 )
{
v19 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v18 + 184LL);
v20 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 81) + 192LL))(*((_QWORD *)this + 81));
v37 = v20
+ (float)(*(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 82) + 312LL))(*((_QWORD *)this + 82))
/ 6.0);
v21 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 81) + 312LL))(*((_QWORD *)this + 81));
cocos2d::CCPoint::CCPoint(&v39, v37, *(float *)(v21 + 4) * 0.5);
v19(v18, &v39);
}
(*(void (__fastcall **)(__int64 *__return_ptr, _QWORD))(**((_QWORD **)this + 78) + 144LL))(
&v38,
*((_QWORD *)this + 78));
v22 = (int)*(float *)&v38;
(*(void (__fastcall **)(cocos2d::CCPoint *__return_ptr, _QWORD))(**((_QWORD **)this + 78) + 144LL))(
&v39,
*((_QWORD *)this + 78));
v24 = (cocos2d::CCRenderTexture *)cocos2d::CCRenderTexture::create((cocos2d::CCRenderTexture *)v22, (int)v39.y, v23);
cocos2d::CCRenderTexture::begin(v24);
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 80) + 736LL))(*((_QWORD *)this + 80));
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 81) + 736LL))(*((_QWORD *)this + 81));
v25 = *((_QWORD *)this + 83);
if ( v25 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v25 + 736LL))(v25);
v26 = *((_QWORD *)this + 84);
if ( v26 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v26 + 736LL))(v26);
cocos2d::CCRenderTexture::end(v24);
v27 = v24;
getSprite = v24->getSprite;
setTexture = this->setTexture;
v30 = (__int64)getSprite(v27);
v31 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v30 + 1056LL))(v30);
setTexture(this, (cocos2d::CCTexture2D *)v31);
cocos2d::CCSprite::setFlipY(this, 1);
return _stack_chk_guard;
}