//
// cocos2d::extension::CCControlPotentiometer::potentiometerMoved from 0x180009070 to 0x1800091c1 (337 bytes)
//
// 3 xrefs:
// > cocos2d::extension::CCControlPotentiometer::ccTouchMoved @ 0x180008f07
// > ??> @ 0x180032408
// > ??> @ 0x18004b924
//
// 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:15:37 +0000
//
double __fastcall cocos2d::extension::CCControlPotentiometer::potentiometerMoved(
__int64 a1,
const struct cocos2d::CCPoint *a2)
{
float *v4; // rsi
const struct cocos2d::CCPoint *v5; // rax
float *v6; // rdi
float *v7; // rbx
const struct cocos2d::CCPoint *v8; // rax
float *v9; // rax
float v10; // xmm6_4
float v11; // xmm2_4
_BYTE v13[16]; // [rsp+20h] [rbp-48h] BYREF
char v14; // [rsp+70h] [rbp+8h] BYREF
char v15; // [rsp+80h] [rbp+18h] BYREF
char v16; // [rsp+88h] [rbp+20h] BYREF
v4 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v14, (const struct cocos2d::CCPoint *)(a1 + 488));
v5 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 200LL))(*(_QWORD *)(a1 + 480));
v6 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v15, v5);
v7 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v16, a2);
v8 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 200LL))(*(_QWORD *)(a1 + 480));
v9 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v13, v8);
v10 = atan2f(*v7 - *v9, v7[1] - v9[1]);
v11 = (float)((float)(v10 - atan2f(*v4 - *v6, v4[1] - v6[1])) * 180.0) / 3.141592653589793;
if ( v11 <= 180.0 )
{
if ( v11 < -180.0 )
v11 = v11 + 360.0;
}
else
{
v11 = v11 + -360.0;
}
cocos2d::extension::CCControlPotentiometer::setValue(
(cocos2d::extension::CCControlPotentiometer *)a1,
(float)((float)(*(float *)(a1 + 504) - *(float *)(a1 + 500)) * (float)(v11 / 360.0)) + *(float *)(a1 + 496));
return cocos2d::CCPoint::operator=(a1 + 488, a2);
}