//
// sub_7770DC from 0x7770dc to 0x77712c (80 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
size_t __fastcall sub_7770DC(int *a1, wchar_t *s, size_t a3)
{
size_t v6; // r0
int v7; // r6
size_t v8; // r4
size_t v9; // r7
size_t v11; // r4
const wchar_t *v12; // r6
const wchar_t *v13; // r0
v6 = wcslen(s);
v7 = *a1;
v8 = *(_DWORD *)(*a1 - 12);
v9 = v6;
if ( v6 > v8 )
return -1;
v11 = v8 - v6;
if ( v11 >= a3 )
v11 = a3;
v12 = (const wchar_t *)(v7 + 4 * v11);
while ( 1 )
{
v13 = v12--;
if ( !wmemcmp(v13, s, v9) )
break;
if ( !v11 )
return -1;
--v11;
}
return v11;
}