//
// cocos2d::CCTouchDispatcher::rearrangeHandlers from 0xb3f4e8 to 0xb3f5ac (196 bytes)
//
// 3 xrefs:
// > cocos2d::CCTouchDispatcher::setPriority @ 0xb3f5f0
// > cocos2d::CCTouchDispatcher::setPriority @ 0xb3f608
// > ??> @ 0x43008
//
// 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 cocos2d::CCTouchDispatcher::rearrangeHandlers(cocos2d::CCTouchDispatcher *a1, cocos2d::CCArray *a2)
{
cocos2d::ccArray *data; // x0
__int64 arr; // x22
__int64 v4; // x19
__int64 v5; // x21
_QWORD *v6; // x19
_QWORD *v7; // x0
data = a2->data;
arr = (__int64)data->arr;
v4 = 8LL * data->num;
v5 = arr + v4;
if ( arr != arr + v4 )
{
std::__introsort_loop>(
(__int64)data->arr,
(char *)(arr + v4),
2 * (63 - __clz(v4 >> 3)),
(unsigned __int8 (__fastcall *)(_QWORD, __int64))sub_B3E808);
if ( (unsigned __int64)v4 <= 0x87 )
{
std::__insertion_sort>(
arr,
(char *)(arr + v4),
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_B3E808);
}
else
{
v6 = (_QWORD *)(arr + 128);
std::__insertion_sort>(
arr,
(char *)(arr + 128),
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_B3E808);
if ( v5 != arr + 128 )
{
do
{
v7 = v6++;
std::__unguarded_linear_insert>(
v7,
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_B3E808);
}
while ( (_QWORD *)v5 != v6 );
}
}
}
}