//
// sub_10005F0A0 from 0x10005f0a0 to 0x10005f21f (383 bytes)
//
// 1 xrefs:
// > ??> @ 0x100ab7cb0
//
// This function is hookable on this platform (idp: pc, 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 12:19:41 +0000
//
__int64 __fastcall sub_10005F0A0(__int64 a1, __int64 a2)
{
__int64 v2; // r12
const char *v3; // r15
_QWORD *v4; // rbx
size_t v5; // r12
char *v6; // r14
__int64 i; // r15
size_t v8; // r12
const char *v9; // rsi
char *v10; // rbx
const char *v11; // r14
const char *v12; // rbx
__int64 v13; // rax
__int64 v14; // r14
void *v15; // rdi
__int64 v17; // [rsp+10h] [rbp-30h]
v2 = a2;
if ( !a2 )
v2 = *(_QWORD *)(a1 + 8);
v3 = (const char *)sub_10005AD20((int *)(a1 + 24));
v4 = sub_10005BD80(v2 + 128);
v4[1] = v2;
v4[2] = 0;
*((_OWORD *)v4 + 3) = 0;
*((_OWORD *)v4 + 4) = 0;
*v4 = off_100AB7C50;
*((_DWORD *)v4 + 22) = 0;
v4[12] = 0;
v4[10] = v2 + 128;
*((_DWORD *)v4 + 6) = 0;
*((_OWORD *)v4 + 2) = 0;
v5 = strlen(v3);
v6 = (char *)operator new[](v5 + 1);
v4[4] = v6;
memcpy(v6, v3, v5 + 1);
v4[5] = &v6[v5];
v17 = (__int64)v4;
*((_DWORD *)v4 + 6) = 512;
for ( i = *(_QWORD *)(a1 + 96); i; i = *(_QWORD *)(i + 56) )
{
v11 = (const char *)sub_10005AD20((int *)(i + 8));
v12 = (const char *)sub_10005AD20((int *)(i + 32));
v13 = sub_10005E890(v17, v11);
v14 = v13;
if ( (*(_BYTE *)(v13 + 33) & 2) != 0 )
{
v15 = *(void **)(v13 + 40);
if ( v15 )
operator delete[](v15);
}
*(_DWORD *)(v14 + 32) = 0;
*(_OWORD *)(v14 + 40) = 0;
v8 = strlen(v12);
v9 = v12;
v10 = (char *)operator new[](v8 + 1);
*(_QWORD *)(v14 + 40) = v10;
memcpy(v10, v9, v8 + 1);
*(_QWORD *)(v14 + 48) = &v10[v8];
*(_DWORD *)(v14 + 32) = 512;
}
return v17;
}