//
// sub_100653290 from 0x100653290 to 0x100653381 (241 bytes)
//
// 2 xrefs:
// > sub_1006513B0 @ 0x10065152a
// > sub_1006513B0 @ 0x10065169f
//
// 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_100653290(__int64 a1, const char *a2, _QWORD *a3)
{
__int64 result; // rax
size_t v5; // rbx
__int64 v6; // rax
unsigned __int64 v7; // rcx
char *v8; // r13
_QWORD *v9; // rax
int *v10; // rdi
unsigned __int8 v11; // [rsp+17h] [rbp-29h]
result = *(unsigned __int8 *)a2;
if ( (_BYTE)result )
{
v11 = *a2;
v5 = strlen(a2);
v6 = a3[1];
v7 = (v5 & 0xFFFFFFFFFFFFFFF8LL) + v6 + 8;
if ( v7 > 0x1000 )
{
v9 = (_QWORD *)off_10099E670();
if ( !v9 )
{
v10 = (int *)a3[2];
if ( v10 )
longjmp(v10, 1);
sub_1007CE8B0();
}
*v9 = *a3;
*a3 = v9;
a3[1] = (v5 & 0xFFFFFFFFFFFFFFF8LL) + 8;
v8 = (char *)(v9 + 1);
}
else
{
v8 = (char *)(*a3 + v6 + 8);
a3[1] = v7;
}
memcpy(v8, a2, v5);
v8[v5] = 0;
result = v11;
}
else
{
v8 = "";
}
*(_QWORD *)a1 = v8;
*(_BYTE *)(a1 + 8) = (_BYTE)result != 0;
return result;
}