//
// sub_140378850 from 0x140378850 to 0x14037895b (267 bytes)
//
// 5 xrefs:
// > sub_140374400 @ 0x1403745ed
// > sub_14054FC90 @ 0x14054fde8
// > ??> @ 0x1408bc8f4
// > ??> @ 0x1408bc904
// > ??> @ 0x1409225a4
//
// 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:31:02 +0000
//
__int64 __fastcall sub_140378850(_QWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
_QWORD *v4; // rbx
_QWORD *i; // rsi
_QWORD *v10; // r8
__int64 result; // rax
v4 = (_QWORD *)*a1;
if ( *a1 )
{
for ( i = (_QWORD *)a1[1]; v4 != i; v4 += 65 )
{
sub_140069730((__int64)(v4 + 61));
sub_1403620A0((__int64)(v4 + 55));
}
v10 = (_QWORD *)*a1;
if ( (unsigned __int64)(520 * ((a1[2] - *a1) / 520LL)) >= 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 + 520 * a3;
result = a2 + 520 * a4;
a1[2] = result;
return result;
}