//
// sub_140223100 from 0x140223100 to 0x140223311 (529 bytes)
//
// 3 xrefs:
// > GJGameLevel::clearPlatformerSave @ 0x140264188
// > GJAccountManager::onSyncAccountCompleted @ 0x140308cc6
// > ??> @ 0x14091bc8c
//
// 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 11:28:25 +0000
//
// Hidden C++ exception states: #wind=4
int __fastcall sub_140223100(int a1, const void **a2)
{
_Mtx_t v4; // r13
DS_Dictionary *v5; // rdi
const void **v6; // r15
const void **i; // rbx
const void *v8; // rdx
const void *v9; // rcx
size_t v10; // r8
bool v11; // al
int IntegerForKey; // esi
const char *v13; // rdx
__int64 v14; // rbx
__int64 v15; // rsi
const char *v16; // rdx
__int128 v18; // [rsp+20h] [rbp-58h] BYREF
__int64 v19; // [rsp+30h] [rbp-48h]
const void **v20; // [rsp+38h] [rbp-40h] BYREF
const void **v21; // [rsp+40h] [rbp-38h]
DS_Dictionary *v22; // [rsp+98h] [rbp+20h]
v4 = qword_14090A8C8;
if ( Mtx_lock(qword_14090A8C8) )
{
std::_Throw_Cpp_error(5);
__debugbreak();
}
if ( *((_DWORD *)v4 + 19) == 0x7FFFFFFF )
{
*((_DWORD *)v4 + 19) = 2147483646;
std::_Throw_Cpp_error(6);
}
v22 = (DS_Dictionary *)operator new(0xF0u);
v5 = DS_Dictionary::DS_Dictionary(v22);
if ( sub_140222A60((__int64)v5) )
{
v18 = 0;
v19 = 0;
DS_Dictionary::getAllKeys(v5, &v20);
v6 = v21;
for ( i = v20; i != v6; i += 4 )
{
if ( a1 )
{
if ( a1 == 3 )
{
v8 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v8 = *a2;
v9 = i;
if ( (unsigned __int64)i[3] > 0xF )
v9 = *i;
v10 = (size_t)i[2];
v11 = (const void *)v10 == a2[2] && (!v10 || memcmp(v9, v8, v10) == 0);
}
else
{
IntegerForKey = 0;
v13 = (const char *)i;
if ( (unsigned __int64)i[3] > 0xF )
v13 = (const char *)*i;
if ( DS_Dictionary::stepIntoSubDictWithKey(v5, v13) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v5, "t");
DS_Dictionary::stepOutOfSubDict(v5);
}
v11 = IntegerForKey != 2;
}
if ( !v11 )
continue;
}
sub_140075F50((__int64 *)&v18, (__int64)i);
}
v15 = *((_QWORD *)&v18 + 1);
v14 = v18;
if ( (_QWORD)v18 != *((_QWORD *)&v18 + 1) )
{
do
{
v16 = (const char *)v14;
if ( *(_QWORD *)(v14 + 24) > 0xFu )
v16 = *(const char **)v14;
DS_Dictionary::removeKey(v5, v16);
v14 += 32;
}
while ( v14 != v15 );
sub_140222B40((__int64)v5);
}
if ( v5 )
{
DS_Dictionary::~DS_Dictionary(v5);
j_j_free(v5);
}
sub_1400760C0((__int64 *)&v20);
sub_1400760C0((__int64 *)&v18);
}
else if ( v5 )
{
DS_Dictionary::~DS_Dictionary(v5);
j_j_free(v5);
}
return Mtx_unlock(v4);
}