//
// sub_1000B0164 from 0x1000b0164 to 0x1000b0364 (512 bytes)
//
// 2 xrefs:
// > sub_1000B00FC @ 0x1000b0124
// > sub_1000B03C4 @ 0x1000b03fc
//
// This function is hookable on this platform (idp: arm, 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 10:58:38 +0000
//
void __fastcall sub_1000B0164(int a1, __int64 a2)
{
std::mutex *v4; // x19
_QWORD *v5; // x20
void **v6; // x23
void **v7; // x26
int v8; // w8
size_t v9; // x2
__int64 v10; // x10
int v11; // w9
void **v12; // x0
const void *v13; // x1
void *v14; // x1
int IntegerForKey; // w25
__int64 *v16; // x21
__int64 *v17; // x22
__int64 *v18; // x1
void *v19; // x0
void *v20; // x0
void *v21; // x0
void *v22; // x0
void **v23; // [xsp+8h] [xbp-78h] BYREF
void **v24; // [xsp+10h] [xbp-70h]
__int64 *v25; // [xsp+20h] [xbp-60h] BYREF
__int64 *v26; // [xsp+28h] [xbp-58h]
__int64 v27; // [xsp+30h] [xbp-50h]
void ***v28; // [xsp+38h] [xbp-48h] BYREF
v4 = (std::mutex *)qword_1009F3988;
std::mutex::lock((std::mutex *)qword_1009F3988);
v5 = operator new(0xF0u);
j_DS_Dictionary::DS_Dictionary();
if ( (sub_1000AF258((__int64)v5) & 1) != 0 )
{
v25 = nullptr;
v26 = nullptr;
v27 = 0;
sub_1001EA444(&v23, v5);
v6 = v23;
v7 = v24;
if ( v23 != v24 )
{
while ( 1 )
{
if ( !a1 )
goto LABEL_25;
if ( a1 == 3 )
break;
v14 = v6;
if ( *((char *)v6 + 23) < 0 )
v14 = *v6;
if ( (DS_Dictionary::stepIntoSubDictWithKey(v5, v14) & 1) != 0 )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v5, "t");
sub_1001EA32C(v5);
if ( (a1 != 2) == (IntegerForKey == 2) )
goto LABEL_26;
goto LABEL_25;
}
if ( a1 != 2 )
goto LABEL_25;
LABEL_26:
v6 += 3;
if ( v6 == v7 )
goto LABEL_27;
}
v8 = *((char *)v6 + 23);
if ( v8 >= 0 )
v9 = *((unsigned __int8 *)v6 + 23);
else
v9 = (size_t)v6[1];
v10 = *(unsigned __int8 *)(a2 + 23);
v11 = (char)v10;
if ( (v10 & 0x80u) != 0LL )
v10 = *(_QWORD *)(a2 + 8);
if ( v9 != v10 )
goto LABEL_26;
v12 = v8 >= 0 ? v6 : (void **)*v6;
v13 = v11 >= 0 ? (const void *)a2 : *(const void **)a2;
if ( memcmp(v12, v13, v9) )
goto LABEL_26;
LABEL_25:
sub_100017C70((__int64)&v25);
goto LABEL_26;
}
LABEL_27:
v16 = v25;
v17 = v26;
if ( v25 != v26 )
{
do
{
v18 = v16;
if ( *((char *)v16 + 23) < 0 )
v18 = (__int64 *)*v16;
DS_Dictionary::removeKey(v5, v18);
v16 += 3;
}
while ( v16 != v17 );
sub_1000AF6A4();
}
v19 = (void *)v5[26];
if ( v19 )
{
v5[27] = v19;
operator delete(v19);
}
v20 = (void *)pugi::xml_document::dxml_document(v5);
operator delete(v20);
v28 = &v23;
sub_100018250((void ***)&v28);
v23 = (void **)&v25;
sub_100018250(&v23);
}
else
{
v21 = (void *)v5[26];
if ( v21 )
{
v5[27] = v21;
operator delete(v21);
}
v22 = (void *)pugi::xml_document::dxml_document(v5);
operator delete(v22);
}
std::mutex::unlock(v4);
}