//
// cocos2d::extension::CCControlSwitchSprite::needsLayout from 0x5a434c to 0x5a45c8 (636 bytes)
//
// 3 xrefs:
// > cocos2d::extension::CCControlSwitchSprite::initWithMaskSprite @ 0x5a47f4
// > cocos2d::extension::CCControlSwitchSprite::setSliderXPosition @ 0x5a4864
// > cocos2d::extension::CCControlSwitch::ccTouchBegan @ 0x5a4c06
//
// 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::CCControlSwitchSprite::needsLayout(cocos2d::CCSprite *this)
{
int v2; // r0
void (__fastcall *v3)(int, cocos2d::CCPoint *); // r8
float *v4; // r0
int v5; // r7
float v6; // s17
int v7; // r0
void (__fastcall *v8)(int, cocos2d::CCPoint *); // r8
float v9; // s17
float *v10; // r0
int v11; // r7
float v12; // s17
float v13; // s15
int v14; // r0
int v15; // r7
void (__fastcall *v16)(int, cocos2d::CCPoint *); // r9
float v17; // s17
int v18; // r7
void (__fastcall *v19)(int, cocos2d::CCPoint *); // r9
float v20; // s18
float v21; // s17
int v22; // r0
int v23; // r7
void (__fastcall *v24)(int, cocos2d::CCPoint *); // r9
float v25; // s18
float v26; // s17
int v27; // r0
cocos2d::CCRenderTexture *v28; // s16
int v29; // r2
cocos2d::CCRenderTexture *v30; // r5
int v31; // r0
int v32; // r0
void (__fastcall *setTexture)(cocos2d::CCSprite *__hidden, cocos2d::CCTexture2D *); // r7
int v34; // r0
int v35; // r0
float v36[2]; // [sp+4h] [bp-18h] BYREF
cocos2d::CCPoint v37; // [sp+Ch] [bp-10h] BYREF
v2 = *((_DWORD *)this + 134);
v3 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v2 + 92);
v4 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v2 + 156))(v2);
v5 = *((_DWORD *)this + 134);
v6 = *((float *)this + 128) + (float)(*v4 * 0.5);
v7 = (*(int (__fastcall **)(int))(*(_DWORD *)v5 + 156))(v5);
cocos2d::CCPoint::CCPoint(&v37, v6, *(float *)(v7 + 4) * 0.5);
v3(v5, &v37);
v8 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(**((_DWORD **)this + 135) + 92);
v9 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 156))(*((_DWORD *)this + 134));
v10 = (float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 156))(*((_DWORD *)this + 135));
v11 = *((_DWORD *)this + 135);
v12 = v9 + (float)(*v10 * 0.5);
v13 = *((float *)this + 128);
v14 = (*(int (__fastcall **)(int))(*(_DWORD *)v11 + 156))(v11);
cocos2d::CCPoint::CCPoint(&v37, v12 + v13, *(float *)(v14 + 4) * 0.5);
v8(v11, &v37);
v15 = *((_DWORD *)this + 136);
v16 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v15 + 92);
v17 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 156))(*((_DWORD *)this + 134))
+ *((float *)this + 128);
(*(void (__fastcall **)(float *))(**((_DWORD **)this + 131) + 72))(v36);
cocos2d::CCPoint::CCPoint(&v37, v17, v36[1] * 0.5);
v16(v15, &v37);
v18 = *((_DWORD *)this + 137);
if ( v18 )
{
v19 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v18 + 92);
v20 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 96))(*((_DWORD *)this + 134));
v21 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 136) + 156))(*((_DWORD *)this + 136)) / 6.0;
v22 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 156))(*((_DWORD *)this + 134));
cocos2d::CCPoint::CCPoint(&v37, v20 - v21, *(float *)(v22 + 4) * 0.5);
v19(v18, &v37);
}
v23 = *((_DWORD *)this + 138);
if ( v23 )
{
v24 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v23 + 92);
v25 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 96))(*((_DWORD *)this + 135));
v26 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 136) + 156))(*((_DWORD *)this + 136)) / 6.0;
v27 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 156))(*((_DWORD *)this + 135));
cocos2d::CCPoint::CCPoint(&v37, v25 + v26, *(float *)(v27 + 4) * 0.5);
v24(v23, &v37);
}
(*(void (__fastcall **)(float *))(**((_DWORD **)this + 131) + 72))(v36);
v28 = (cocos2d::CCRenderTexture *)(int)v36[0];
(*(void (__fastcall **)(cocos2d::CCPoint *))(**((_DWORD **)this + 131) + 72))(&v37);
v30 = (cocos2d::CCRenderTexture *)cocos2d::CCRenderTexture::create(v28, (int)v37.y, v29);
cocos2d::CCRenderTexture::begin(v30);
(*(void (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 368))(*((_DWORD *)this + 134));
(*(void (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 368))(*((_DWORD *)this + 135));
v31 = *((_DWORD *)this + 137);
if ( v31 )
(*(void (__fastcall **)(int))(*(_DWORD *)v31 + 368))(v31);
v32 = *((_DWORD *)this + 138);
if ( v32 )
(*(void (__fastcall **)(int))(*(_DWORD *)v32 + 368))(v32);
cocos2d::CCRenderTexture::end(v30);
setTexture = this->setTexture;
v34 = (int)v30->getSprite(v30);
v35 = (*(int (__fastcall **)(int))(*(_DWORD *)v34 + 528))(v34);
setTexture(this, (cocos2d::CCTexture2D *)v35);
cocos2d::CCSprite::setFlipY(this, 1);
}