//
// sub_778E20 from 0x778e20 to 0x778e60 (64 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
//
_DWORD *__fastcall sub_778E20(_DWORD *a1, int *a2, unsigned int a3, unsigned int a4)
{
int v4; // r1
unsigned int v6; // r0
unsigned int v8; // r2
const wchar_t *v9; // r0
unsigned int v10; // r4
v4 = *a2;
v6 = *(_DWORD *)(v4 - 12);
if ( a3 > v6 )
sub_7732C4(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::basic_string",
a3,
*(_DWORD *)(v4 - 12));
v8 = v6 - a3;
v9 = (const wchar_t *)(v4 + 4 * a3);
if ( v8 > a4 )
v10 = a3 + a4;
else
v10 = a3 + v8;
*a1 = sub_778D28(v9, (const wchar_t *)(v4 + 4 * v10));
return a1;
}