//
// sub_100718ED0 from 0x100718ed0 to 0x100718ff0 (288 bytes)
//
// 2 xrefs:
// > sub_100719B10 @ 0x100719b28
// > sub_100719B10 @ 0x100719b54
//
// 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:36:09 +0000
//
__int64 __fastcall sub_100718ED0(__int64 **a1, unsigned int a2)
{
__int64 v3; // rax
unsigned int v4; // ecx
__int64 *v5; // rcx
__int64 v6; // rax
__int64 v7; // rsi
__int64 result; // rax
__int64 v9; // rdx
__int64 v10; // rcx
__int64 *v11; // rdx
__int64 v12; // rsi
__int64 *v13; // rdi
unsigned int v14; // ecx
int v15; // edx
__int64 v16; // rbx
__int64 v17; // [rsp-20h] [rbp-20h] BYREF
if ( !*a1 )
return 0;
v3 = **a1;
v4 = v3 & 7;
if ( v4 >= 2 || a2 < 2 || v4 != 0 && a2 - 9 >= 0xFFFFFFFE )
return 0;
v5 = *(__int64 **)(v3 & 0xFFFFFFFFFFFFFFE0LL);
v6 = v5[1];
v7 = v6 + 64;
if ( (unsigned __int64)(v6 + 64) < 0x8001 )
{
v9 = *v5;
result = *v5 + v6 + 48;
v5[1] = v7;
}
else
{
result = sub_100724BD0(v5, 64, &v17);
v9 = v17;
}
v10 = v9 | (int)(a2 - 1);
*(_QWORD *)result = v10;
*(_OWORD *)(result + 8) = 0;
*(_OWORD *)(result + 24) = 0;
*(_OWORD *)(result + 40) = 0;
*(_QWORD *)(result + 56) = 0;
v11 = *a1;
*(_QWORD *)(result + 8) = *a1;
v12 = v11[4];
if ( v12 )
{
v13 = (__int64 *)(v12 + 40);
*(_QWORD *)(result + 40) = *(_QWORD *)(v12 + 40);
}
else
{
v13 = (__int64 *)(result + 40);
}
*v13 = result;
*(_QWORD *)(result + 48) = v12;
v11[4] = result;
if ( a2 == 7 )
{
v14 = v10 & 7;
if ( v14 <= 6 )
{
v15 = 98;
if ( _bittest(&v15, v14) )
{
v16 = result;
sub_100717DB0((const char **)(result + 16), (__int64 *)result, 16, "xml");
return v16;
}
}
}
return result;
}