//
// CCScrollLayerExt::ccTouchEnded from 0x3c8d24 to 0x3c8ec8 (420 bytes)
//
// 2 xrefs:
// > `non-virtual thunk to'CCScrollLayerExt::ccTouchEnded @ 0x3c8ee0
// > TableView::ccTouchEnded @ 0x3ca9d6
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:46:36 +0000
//
int __fastcall CCScrollLayerExt::ccTouchEnded(int a1, int a2)
{
cocos2d::CCDirector *LocationInView; // r0
const cocos2d::CCPoint *v5; // r0
const cocos2d::CCPoint *v6; // r2
float v7; // s16
float v8; // s15
float MinY; // r0
float v10; // s18
float v11; // s16
float v12; // s17
const cocos2d::CCPoint *v13; // r0
int v14; // r5
void (__fastcall ***v15)(_DWORD, int); // r0
const cocos2d::CCPoint *v16; // r2
cocos2d::CCEaseOut *v17; // r0
float v18; // r2
cocos2d::CCSequence *v19; // r0
cocos2d::CCSequence *v20; // r8
cocos2d::CCFiniteTimeAction *v21; // r0
cocos2d::CCNode *v22; // r7
cocos2d::CCAction *v23; // r0
_BYTE v25[8]; // [sp+4h] [bp-20h] BYREF
_BYTE v26[8]; // [sp+Ch] [bp-18h] BYREF
int v27; // [sp+14h] [bp-10h] BYREF
float v28; // [sp+18h] [bp-Ch]
_BYTE v29[4]; // [sp+1Ch] [bp-8h] BYREF
float v30; // [sp+20h] [bp-4h]
_DWORD v31[2]; // [sp+24h] [bp+0h] BYREF
LocationInView = (cocos2d::CCDirector *)cocos2d::CCTouch::getLocationInView((cocos2d::CCTouch *)v25);
v5 = (const cocos2d::CCPoint *)cocos2d::CCDirector::sharedDirector(LocationInView);
cocos2d::CCDirector::convertToGL((cocos2d::CCDirector *)v31, v5);
cocos2d::CCPoint::operator=(v25, v31);
if ( a2 != *(_DWORD *)(a1 + 320) )
goto LABEL_17;
cocos2d::CCTime::gettimeofdayCocos2d(v26, 0);
v7 = COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v25, (const cocos2d::CCPoint *)(a1 + 332), v6));
v8 = cocos2d::CCTime::timersubCocos2d(a1 + 340, v26);
if ( (float)(v7 / v8) < 0.5 )
{
CCScrollLayerExt::constraintContent((CCScrollLayerExt *)a1);
goto LABEL_17;
}
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)(a1 + 364));
cocos2d::CCPoint::operator-(&v27, v25, a1 + 332);
if ( *(_BYTE *)(a1 + 372) )
{
v28 = 0.0;
}
else if ( *(_BYTE *)(a1 + 371) )
{
v27 = 0;
}
MinY = CCScrollLayerExt::getMinY((CCScrollLayerExt *)a1);
v10 = *(float *)(a1 + 384);
v11 = MinY;
v12 = COERCE_FLOAT(CCScrollLayerExt::getMaxY((CCScrollLayerExt *)a1)) + *(float *)(a1 + 388);
v13 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 364) + 96))(*(_DWORD *)(a1 + 364));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, v13);
if ( (float)(v30 + v28) <= v12 )
{
if ( (float)(v30 + v28) >= (float)(v11 - v10) )
{
v14 = 1050253722;
goto LABEL_13;
}
v28 = (float)(v11 - v10) - v30;
}
else
{
v28 = v12 - v30;
}
v14 = 1036831949;
LABEL_13:
v15 = *(void (__fastcall ****)(_DWORD, int))(a1 + 360);
if ( v15 )
(**v15)(v15, a1);
CCScrollLayerExt::constraintContent((CCScrollLayerExt *)a1);
v17 = (cocos2d::CCEaseOut *)cocos2d::CCMoveBy::create((cocos2d::CCMoveBy *)v14, COERCE_FLOAT(&v27), v16);
v19 = (cocos2d::CCSequence *)cocos2d::CCEaseOut::create(v17, (cocos2d::CCActionInterval *)0x40000000, v18);
v31[1] = 0;
v31[0] = CCScrollLayerExt::constraintContent;
v20 = v19;
v21 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, CCScrollLayerExt::constraintContent, 0);
v22 = *(cocos2d::CCNode **)(a1 + 364);
v23 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v20, v21, 0);
cocos2d::CCNode::runAction(v22, v23);
*(_BYTE *)(a1 + 349) = 1;
LABEL_17:
*(_BYTE *)(a1 + 348) = 0;
return cocos2d::CCPoint::operator=(a1 + 324, &unk_D2A5A4);
}