//
// EditorUI::constrainGameLayerPosition from 0x7c6758 to 0x7c697c (548 bytes)
//
// 3 xrefs:
// > EditorUI::constrainGameLayerPosition @ 0x7c6994
// > EditorUI::init @ 0x7cffb4
// > ??> @ 0xf37d8
//
// This function is hookable on this platform (idp: arm, 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:54:09 +0000
//
__int64 __fastcall EditorUI::constrainGameLayerPosition(EditorUI *this, float a2, float a3)
{
const cocos2d::CCPoint *v6; // x0
cocos2d::CCDirector *v7; // x0
cocos2d::CCDirector *v8; // x0
float v9; // s0
cocos2d::CCNode *v10; // x24
cocos2d::CCDirector *v11; // x0
cocos2d::CCDirector *v12; // x0
cocos2d::CCDirector *ScreenRight; // x0
float v14; // s0
float v15; // s8
cocos2d::CCDirector *v16; // x0
float v17; // s0
__int64 v18; // x1
float v19; // s1
cocos2d::CCNode *v20; // x24
float v21; // s0
float v22; // s1
float v23; // s0
float v24; // s1
__int64 v25; // x0
float v27; // [xsp+58h] [xbp+58h] BYREF
float v28; // [xsp+5Ch] [xbp+5Ch]
float v29; // [xsp+60h] [xbp+60h] BYREF
float v30; // [xsp+64h] [xbp+64h]
__int64 v31; // [xsp+68h] [xbp+68h] BYREF
float v32; // [xsp+70h] [xbp+70h] BYREF
float v33; // [xsp+74h] [xbp+74h]
__int64 v34; // [xsp+78h] [xbp+78h] BYREF
__int64 v35; // [xsp+80h] [xbp+80h] BYREF
v6 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(*((_QWORD *)this + 180) + 3920LL)
+ 192LL))(*(_QWORD *)(*((_QWORD *)this + 180) + 3920LL));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, v6);
v7 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(_QWORD, int *))(**(_QWORD **)(*((_QWORD *)this + 180) + 3920LL)
+ 184LL))(
*(_QWORD *)(*((_QWORD *)this + 180) + 3920LL),
&dword_155C778);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getScreenLeft(v8);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v9, *((float *)this + 213));
v10 = *(cocos2d::CCNode **)(*((_QWORD *)this + 180) + 3920LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, (float)(a2 * 30.0) + -30.0, (float)(a3 * 30.0) + 90.0);
cocos2d::CCNode::convertToWorldSpace(&v31, v10, (const cocos2d::CCPoint *)&v35);
cocos2d::CCNode::convertToNodeSpace(&v35, *((cocos2d::CCNode **)this + 180), (const cocos2d::CCPoint *)&v31);
cocos2d::CCPoint::operator=(&v31, &v35);
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v12);
v15 = v14;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
cocos2d::CCDirector::getScreenTop(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v32, v15, v17);
v18 = *((_QWORD *)this + 180);
if ( *(_BYTE *)(*(_QWORD *)(v18 + 3272) + 453LL) )
v19 = 30120.0;
else
v19 = 2520.0;
v20 = *(cocos2d::CCNode **)(v18 + 3920);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, 240030.0, v19);
cocos2d::CCNode::convertToWorldSpace(&v34, v20, (const cocos2d::CCPoint *)&v35);
cocos2d::CCNode::convertToNodeSpace(&v35, *((cocos2d::CCNode **)this + 180), (const cocos2d::CCPoint *)&v34);
cocos2d::CCPoint::operator=(&v34, &v35);
v21 = v29 - *(float *)&v31;
if ( v27 <= (float)(v29 - *(float *)&v31) )
v21 = v27;
v22 = v32 - *(float *)&v34;
if ( v21 >= (float)(v32 - *(float *)&v34) )
v22 = v21;
v23 = v30 - *((float *)&v31 + 1);
v27 = v22;
if ( v28 <= (float)(v30 - *((float *)&v31 + 1)) )
v23 = v28;
v24 = v33 - *((float *)&v34 + 1);
if ( v23 >= (float)(v33 - *((float *)&v34 + 1)) )
v24 = v23;
v25 = *((_QWORD *)this + 180);
v28 = v24;
(*(void (__fastcall **)(_QWORD, float *))(**(_QWORD **)(v25 + 3920) + 184LL))(*(_QWORD *)(v25 + 3920), &v27);
return _stack_chk_guard;
}