//
// sub_100668560 from 0x100668560 to 0x10066861f (191 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
//
void *__fastcall sub_100668560(unsigned int *a1, unsigned int *a2)
{
int v3; // r15d
unsigned int v4; // esi
void *result; // rax
__int64 v6; // rsi
unsigned __int64 v7; // r15
__int64 v8; // rdx
unsigned int v9; // esi
__int64 v10; // rsi
v3 = *a2;
v4 = a1[1];
result = (void *)(v3 + *a1);
if ( v4 < (unsigned int)result )
{
result = *((void **)a1 + 2);
do
{
v6 = 2 * v4;
a1[1] = v6;
result = realloc(result, 8 * v6);
*((_QWORD *)a1 + 2) = result;
v4 = a1[1];
}
while ( v4 < v3 + *a1 );
v3 = *a2;
}
if ( v3 )
{
v7 = 0;
do
{
v8 = *a1;
*(_QWORD *)(*((_QWORD *)a1 + 2) + 8 * v8) = *(_QWORD *)(*((_QWORD *)a2 + 2) + 8 * v7);
*a1 = v8 + 1;
v9 = a1[1];
if ( (int)v8 + 1 >= v9 )
{
v10 = 2 * v9;
a1[1] = v10;
*((_QWORD *)a1 + 2) = realloc(*((void **)a1 + 2), 8 * v10);
}
++v7;
result = (void *)*a2;
}
while ( v7 < (unsigned __int64)result );
}
return result;
}