//
// sub_140100380 from 0x140100380 to 0x140100462 (226 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetFollowingCompleted @ 0x140251930
// > ??> @ 0x1408953a0
// > ??> @ 0x1408953b8
// > ??> @ 0x1409156d4
//
// 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_140100380(unsigned __int8 *a1, unsigned __int8 *a2, unsigned __int64 a3)
{
unsigned __int8 *v3; // rdi
__int64 v4; // rsi
unsigned __int8 *v6; // r14
unsigned __int64 v7; // rax
unsigned __int8 *v9; // rbx
unsigned __int64 v10; // rbp
unsigned __int8 *i; // rcx
__int64 v12; // rax
_BYTE v13[280]; // [rsp+20h] [rbp-118h] BYREF
v3 = a2;
v4 = -1;
while ( a2[++v4] != 0 )
;
v6 = a1;
if ( *((_QWORD *)a1 + 3) > 0xFu )
v6 = *(unsigned __int8 **)a1;
v7 = *((_QWORD *)a1 + 2);
if ( a3 >= v7 )
return -1;
v9 = &v6[a3];
v10 = (unsigned __int64)&v6[v7];
memset(v13, 0, 0x100u);
for ( i = &v3[v4]; v3 != i; v13[v12] = 1 )
v12 = *v3++;
if ( (unsigned __int64)v9 >= v10 )
return -1;
while ( v13[*v9] )
{
if ( (unsigned __int64)++v9 >= v10 )
return -1;
}
return v9 - v6;
}