//
// sub_1004C3D78 from 0x1004c3d78 to 0x1004c3f04 (396 bytes)
//
// 1 xrefs:
// > sub_1004C2344 @ 0x1004c23d4
//
// This function is hookable on this platform (idp: arm, 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:06:21 +0000
//
void __fastcall sub_1004C3D78(__int64 a1, std::string *__str, __int128 *a3, unsigned __int64 a4)
{
__int128 *v6; // x21
std::string *v8; // x22
unsigned __int64 v9; // x9
unsigned __int64 v10; // x1
char *v11; // x0
char *v12; // x23
signed __int64 v13; // x25
signed __int64 v14; // x24
const std::string *v15; // x23
int v16; // w8
v6 = (__int128 *)__str;
v8 = *(std::string **)a1;
if ( 0xAAAAAAAAAAAAAAABLL * ((__int64)(*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) >> 3) < a4 )
{
sub_1004C3F14(a1);
if ( a4 > 0xAAAAAAAAAAAAAAALL )
sub_10000A5F8();
v9 = 0x5555555555555556LL * ((__int64)(*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) >> 3);
if ( v9 <= a4 )
v9 = a4;
if ( 0xAAAAAAAAAAAAAAABLL * ((__int64)(*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) >> 3) >= 0x555555555555555LL )
v10 = 0xAAAAAAAAAAAAAAALL;
else
v10 = v9;
sub_1002062C0((_QWORD *)a1, v10);
v11 = sub_100382E48(a1, v6, a3, *(char **)(a1 + 8));
LABEL_15:
*(_QWORD *)(a1 + 8) = v11;
return;
}
v12 = *(char **)(a1 + 8);
v13 = v12 - (char *)v8;
if ( 0xAAAAAAAAAAAAAAABLL * ((v12 - (char *)v8) >> 3) < a4 )
{
if ( v12 != (char *)v8 )
{
v14 = v12 - (char *)v8;
v15 = __str;
do
{
std::string::operator=(v8++, v15++);
v14 -= 24LL;
}
while ( v14 );
v12 = *(char **)(a1 + 8);
}
v11 = sub_100382E48(a1, (__int128 *)((char *)v6 + v13), a3, v12);
goto LABEL_15;
}
if ( __str != (std::string *)a3 )
{
do
{
std::string::operator=(v8, (const std::string *)v6);
v6 = (__int128 *)((char *)v6 + 24);
++v8;
}
while ( v6 != a3 );
v12 = *(char **)(a1 + 8);
}
while ( v12 != (char *)v8 )
{
v16 = *(v12 - 1);
v12 -= 24;
if ( v16 < 0 )
operator delete(*(void **)v12);
}
*(_QWORD *)(a1 + 8) = v8;
}