//
// sub_140677060 from 0x140677060 to 0x1406770f7 (151 bytes)
//
// 2 xrefs:
// > sub_140045BF0 @ 0x140045c41
// > ??> @ 0x14093260c
//
// 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:35:59 +0000
//
__int64 __fastcall sub_140677060(char *a1, __int64 a2, unsigned __int8 *a3, __int64 a4)
{
unsigned __int8 *v5; // rbx
__int64 result; // rax
unsigned __int8 *i; // rcx
__int64 v10; // rax
_BYTE v11[296]; // [rsp+20h] [rbp-128h] BYREF
v5 = a3;
if ( (dword_1408FE01C & 4) != 0 )
return sub_140675C40(a1, a2, a3, a4);
memset(v11, 0, 0x100u);
for ( i = &v5[a4]; v5 != i; v11[v10] = 1 )
v10 = *v5++;
result = 0;
if ( !a2 )
return -1;
while ( !v11[(unsigned __int8)a1[result]] )
{
if ( ++result == a2 )
return -1;
}
return result;
}