//
// sub_100718FF0 from 0x100718ff0 to 0x100719137 (327 bytes)
//
// 2 xrefs:
// > sub_100719BD0 @ 0x100719be8
// > sub_100719BD0 @ 0x100719c14
//
// 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_100718FF0(_QWORD **a1, unsigned int a2, __int64 *a3)
{
__int64 v3; // rax
_QWORD *v4; // rcx
__int64 v6; // rsi
__int64 result; // rax
__int64 *v8; // rcx
__int64 v9; // rax
__int64 v10; // r8
__int64 *v11; // r15
__int64 v12; // rsi
__int64 v13; // rcx
_QWORD *v14; // rsi
__int64 v15; // rdx
__int64 v16; // rdi
__int64 *v17; // rsi
unsigned int v18; // ecx
int v19; // edx
__int64 v20; // rbx
__int64 v21; // [rsp-28h] [rbp-28h] BYREF
v4 = *a1;
if ( !*a1 )
return 0;
v21 = v3;
v6 = *v4 & 7LL;
if ( (unsigned int)v6 >= 2 || a2 < 2 || (_DWORD)v6 != 0 && a2 - 9 >= 0xFFFFFFFE || !*a3 || *(_QWORD **)(*a3 + 8) != v4 )
return 0;
v8 = *(__int64 **)(*v4 & 0xFFFFFFFFFFFFFFE0LL);
v9 = v8[1];
v10 = v9 + 64;
if ( (unsigned __int64)(v9 + 64) < 0x8001 )
{
v12 = *v8;
result = *v8 + v9 + 48;
v8[1] = v10;
}
else
{
v11 = a3;
result = sub_100724BD0(v8, 64, &v21);
a3 = v11;
v12 = v21;
}
v13 = v12 | (int)(a2 - 1);
*(_QWORD *)result = v13;
*(_OWORD *)(result + 8) = 0;
*(_OWORD *)(result + 24) = 0;
*(_OWORD *)(result + 40) = 0;
*(_QWORD *)(result + 56) = 0;
v14 = *a1;
*(_QWORD *)(result + 8) = *a1;
v15 = *a3;
v16 = *(_QWORD *)(v15 + 40);
v17 = v14 + 4;
if ( *(_QWORD *)(v16 + 48) )
v17 = (__int64 *)(v16 + 48);
*v17 = result;
*(_QWORD *)(result + 40) = v16;
*(_QWORD *)(result + 48) = v15;
*(_QWORD *)(v15 + 40) = result;
if ( a2 == 7 )
{
v18 = v13 & 7;
if ( v18 <= 6 )
{
v19 = 98;
if ( _bittest(&v19, v18) )
{
v20 = result;
sub_100717DB0((const char **)(result + 16), (__int64 *)result, 16, "xml");
return v20;
}
}
}
return result;
}