//
// sub_100550CA0 from 0x100550ca0 to 0x100550da8 (264 bytes)
//
// 17 xrefs:
// > sub_10054DB30 @ 0x10054e8a0
// > sub_10054DB30 @ 0x10054ec8c
// > sub_10054DB30 @ 0x10054eda4
// > sub_10054DB30 @ 0x10054f2c0
// > sub_10054DB30 @ 0x10054f45c
// > sub_10054DB30 @ 0x10054f4b0
// > sub_10054DB30 @ 0x10054f4d4
// > sub_10054DB30 @ 0x10054f4fc
// > sub_10054DB30 @ 0x10054f54c
// > sub_10054DB30 @ 0x10054f570
// > sub_10054DB30 @ 0x10054f5a4
// > sub_10054DB30 @ 0x10054f6d8
// > sub_10054DB30 @ 0x10054f780
// > sub_10054DB30 @ 0x10054f7a4
// > sub_100550C00 @ 0x100550c48
// > sub_10057AD10 @ 0x10057b424
// > sub_10057AD10 @ 0x10057b444
//
// 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
//
__int64 __fastcall sub_100550CA0(void **a1, void *__src, size_t __n)
{
size_t v6; // x8
char *v7; // x0
signed __int64 v8; // x9
bool v9; // cc
size_t v10; // x8
size_t v11; // x22
v6 = (size_t)a1[2];
if ( v6 <= ~__n )
{
v7 = (char *)*a1;
if ( *a1 && (char *)(v6 + __n) <= (char *)a1[1] - 1 )
goto LABEL_14;
v8 = v6 | __n;
v9 = 2 * v6 > ~(2 * __n);
v10 = 2 * (v6 + __n);
if ( v9 )
v10 = -1;
if ( v8 >= 0 )
v11 = v10;
else
v11 = -1;
if ( v7 )
v7 = (char *)off_10085DEC0(v7, v11);
else
v7 = (char *)off_10085DEB0(v11);
if ( v7 )
{
*a1 = v7;
a1[1] = (void *)v11;
v6 = (size_t)a1[2];
LABEL_14:
memcpy(&v7[v6], __src, __n);
a1[2] = (char *)a1[2] + __n;
return 0;
}
}
off_10085DEB8(*a1);
*a1 = nullptr;
off_10085DEB8(a1);
return 27;
}