//
// sub_140457120 from 0x140457120 to 0x140457382 (610 bytes)
//
// 2 xrefs:
// > TouchControlEditLayer::copyTouchFrom @ 0x140456555
// > ??> @ 0x140927b60
//
// 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 11:32:29 +0000
//
unsigned __int64 __fastcall sub_140457120(__int64 a1, __int64 a2, unsigned __int64 a3)
{
_QWORD *v3; // rbx
unsigned __int64 v6; // r8
unsigned __int64 v8; // rdx
unsigned __int64 v9; // rcx
unsigned __int64 v10; // rdi
__int64 v11; // rbx
_QWORD *v12; // rax
__int64 i; // rdi
unsigned __int64 result; // rax
_DWORD *v15; // rbx
int v16; // eax
unsigned __int64 v17; // r15
unsigned __int64 v18; // rsi
__int64 v19; // rbx
__int64 v20; // r15
v3 = *(_QWORD **)a1;
v6 = 0x8888888888888889uLL;
v8 = (*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) / 60LL;
if ( a3 <= v8 )
{
i = *(_QWORD *)(a1 + 8);
result = (unsigned __int64)(i
- (_QWORD)v3
+ ((unsigned __int128)((i - (__int64)v3) * (__int128)(__int64)0x8888888888888889uLL) >> 64)) >> 63;
v17 = (i - (__int64)v3) / 60;
if ( a3 <= v17 )
{
for ( i = (__int64)v3 + 60 * a3; a3; --a3 )
{
result = sub_140457390(v3, a2);
v3 = (_QWORD *)((char *)v3 + 60);
a2 += 60;
}
}
else
{
for ( ; v3 != (_QWORD *)i; a2 += 60 )
{
result = sub_140457390(v3, a2);
i = *(_QWORD *)(a1 + 8);
v3 = (_QWORD *)((char *)v3 + 60);
}
v18 = a3 - v17;
if ( v18 )
{
v19 = a2 + 48;
v20 = i - a2;
do
{
sub_14044BA50(i, v19 - 48);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v20 + v19 - 8), (const struct cocos2d::CCPoint *)(v19 - 8));
i += 60;
*(_DWORD *)(v20 + v19) = *(_DWORD *)v19;
*(_DWORD *)(v20 + v19 + 4) = *(_DWORD *)(v19 + 4);
*(_BYTE *)(v20 + v19 + 8) = *(_BYTE *)(v19 + 8);
result = *(unsigned __int8 *)(v19 + 9);
*(_BYTE *)(v20 + v19 + 9) = result;
v19 += 60;
--v18;
}
while ( v18 );
}
}
}
else
{
if ( a3 > 0x444444444444444LL )
sub_14005A170();
v9 = v8 >> 1;
if ( v8 <= 0x444444444444444LL - (v8 >> 1) )
{
v10 = v8 + v9;
if ( v8 + v9 < a3 )
v10 = a3;
}
else
{
v10 = 0x444444444444444LL;
}
if ( v3 )
{
if ( 60 * v8 >= 0x1000 )
{
if ( (unsigned __int64)v3 - *(v3 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v3 = (_QWORD *)*(v3 - 1);
}
j_j_free(v3);
*(_QWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0;
*(_QWORD *)(a1 + 16) = 0;
}
if ( v10 > 0x444444444444444LL )
sub_140009CF0(v9, v8, v6);
v11 = 60 * v10;
v12 = sub_14003D460(60 * v10);
*(_QWORD *)a1 = v12;
i = (__int64)v12;
*(_QWORD *)(a1 + 8) = v12;
result = (unsigned __int64)v12 + v11;
*(_QWORD *)(a1 + 16) = result;
if ( a3 )
{
v15 = (_DWORD *)(a2 + 48);
do
{
sub_14044BA50(i, (__int64)(v15 - 12));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(i + 40), (const struct cocos2d::CCPoint *)(v15 - 2));
v16 = *v15;
v15 += 15;
*(_DWORD *)(i + 48) = v16;
*(_DWORD *)(i + 52) = *(v15 - 14);
*(_BYTE *)(i + 56) = *((_BYTE *)v15 - 52);
result = *((unsigned __int8 *)v15 - 51);
*(_BYTE *)(i + 57) = result;
i += 60;
--a3;
}
while ( a3 );
}
}
*(_QWORD *)(a1 + 8) = i;
return result;
}