//
// sub_D1A7C4 from 0xd1a7c4 to 0xd1a860 (156 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_D1A7C4(__int64 *a1, wchar_t *s, size_t a3)
{
size_t v5; // x0
__int64 v6; // x20
size_t v7; // x21
size_t v8; // x0
size_t v10; // x0
size_t v11; // x19
const wchar_t *v12; // x20
const wchar_t *v13; // x0
v5 = wcslen(s);
v6 = *a1;
v7 = v5;
v8 = *(_QWORD *)(v6 - 24);
if ( v7 > v8 )
return -1;
v10 = v8 - v7;
if ( v10 > a3 )
v11 = a3;
else
v11 = v10;
v12 = (const wchar_t *)(v6 + 4 * v11);
while ( 1 )
{
v13 = v12--;
if ( !wmemcmp(v13, s, v7) )
break;
if ( !v11 )
return -1;
--v11;
}
return v11;
}