//
// sub_140101170 from 0x140101170 to 0x140101275 (261 bytes)
//
// 5 xrefs:
// > sub_1400EACF0 @ 0x1400eaf0d
// > sub_140100A80 @ 0x140100bd1
// > ??> @ 0x1408955c4
// > ??> @ 0x1408955d4
// > ??> @ 0x1409157dc
//
// 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:26:42 +0000
//
__int64 __fastcall sub_140101170(_QWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
_QWORD *v4; // rbx
_QWORD *i; // rdi
_QWORD *v10; // r8
__int64 result; // rax
v4 = (_QWORD *)*a1;
if ( *a1 )
{
for ( i = (_QWORD *)a1[1]; v4 != i; v4 += 10 )
{
sub_14003D310((__int64)(v4 + 5));
sub_14003D310((__int64)(v4 + 1));
}
v10 = (_QWORD *)*a1;
if ( (unsigned __int64)(80 * ((a1[2] - *a1) / 80LL)) >= 0x1000 )
{
if ( (unsigned __int64)v10 - *(v10 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v10 = (_QWORD *)*(v10 - 1);
}
j_j_free(v10);
}
*a1 = a2;
a1[1] = a2 + 80 * a3;
result = a2 + 80 * a4;
a1[2] = result;
return result;
}